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 |
---|---|---|---|---|---|---|
Modify sign up params to include firt and last names. When adding new parameters, need to edit views/devise/registrations/new to include new fields. | def sign_up_params
params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name << :phone_number\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:zip, :address, :phone, :last_name, :first_name, :last_name_kana, :first_name_kana])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, \\\n keys: %i[name date_of_birth username terms_of_service])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:last_name, :first_name, :last_name_kana, :first_name_kana, :zip, :address, :phone])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:attribute, :first_name, :last_name, :terms_and_conditions, :profile_image]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :first_name << :time_zone\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer\n .permit(:sign_up,\n keys:\n %i[first_name\n last_name\n affiliation\n training_status_id\n timezone])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:last_name, :first_name, :birthday])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name, :email, :password,\n :password_confirmation, :phone, :photo, :bio]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first, :last, :email, :password])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute, :first_name, :last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname,:middlename,:lastname,:contact,:birthday,:gender, :bio, :username])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :middle_name, :last_name, \n :phone, :gender, :birthday, :graduation_date, :school, :organization])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :nationality_id ])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :email, :password, :password_confirmation])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name organization admin])\n end",
"def sign_up_params\n\t\tparams.require(:user).permit(:firstname, :lastname, :age, :email, :password, :password_confirmation)\n\tend",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :role])\n end",
"def sign_up_params\n params.require(:sign_up).permit(:first_name, :last_name, :email, :company_name, :company_mailing_address, :city, :state, :zip, :company_phone_number, :password, :password_confirmation, :company_type, :user_name)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first, :last])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[email password username name lastname\n birth_date address type avatar phone_number])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:fname, :lname, :avatar, :avatar_cache, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[attribute full_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstName])\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name,:avatar, :nickname])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :caterer_user])\n end",
"def configure_sign_up_params\n #devise_parameter_sanitizer.for(:sign_up) << :email, :password, :password_confirmation\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :picture, :bio, :username ) }\n\n devise_parameter_sanitizer.for(:account_update) << :bio\n devise_parameter_sanitizer.for(:account_update) << :role\n devise_parameter_sanitizer.for(:account_update) << :type\n devise_parameter_sanitizer.for(:account_update) << :picture\n devise_parameter_sanitizer.for(:account_update) << :username\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up) do |params|\n #binding.pry\n #ユーザー(入力者)が新規登録をするとき変更できるのは、sign_up(deviseのデフォルト設定のカラム、emailやpasswordなど)に加え、追加した独自カラムnicknameとsexのみ変更を許可\n #加えて子モデルaddress_listのprefectures_master_idカラムのみ変更を許可\n params.permit(:sign_up, kays: [:last_name, :first_name, :last_name_kana, :first_name_kana, :phone_num, :user_flag, :user_status, address_attributes: [:post_num, :address, :shipping_address]])\n end\n end",
"def sign_up_params\n params.require(:sign_up).permit(:fullname, :store_location)\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :avatar, :last_name, :display_name, :gender, :phone, :email, :password, :password_confirmation, )\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:name, :surname, :username, :email, :password, :password_confirmation) }\n end",
"def sign_up_params\n params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:role, :first_name, :last_name, :company_name, :postal_code, :city, :province, :gender, :birth_date])\n end",
"def sign_up_params\n params.require(resource_name).permit(\n :name,\n :email,\n :profile,\n :password,\n :password_confirmation\n )\n end",
"def sign_up_params\n params.require(:user).permit(:firstName, :email, :password, :password_confirmation, :lastName, :gender, :age, :bio, :username)\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :rememberable)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :admin])\n end",
"def sign_up_user_params\n # params[:sign_up_user]\n # super.user_params\n params.require(:sign_up_user).permit(:fullname, :username, :password, :password_confirmation, :email)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation, profile_attributes: [:name, :last_name, :phone]])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :age, :address, :pincode, :phone, :gender, :dob, :position_id])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end",
"def sign_up_params\n params.require(:user).permit(\n :email,\n :password,\n :password_confirmation,\n :username,\n :firstname,\n :lastname\n )\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :food, :outdoors)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n profile_attributes: [:id, :name, :last_name, :male]\n ])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:first_name ,:last_name ,:gender ,:username,:password ,:password_confirmation,:email)\n end\n end",
"def signup_params\n params.require(:signup).permit(:full_name, :attending, :user_id, :seminar_id)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :birth_date, :password])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :mobile_number, :email, :country, :state,\n :city, :address, :sponsor_id, :dob])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :phone, :workgroup, :timezone])\n params.require(:user).permit(:name, :email, :password, :password_confirmation, :phone, :timezone)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer().permit(:sign_up, keys: [:name, :surname, :picture, :invite_token, :organization_name])\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :profile_name, :email, :password, :password_confirmation ) \nend",
"def configure_permitted_paramaters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)\n end",
"def configure_sign_up_params\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :password, :password_confirmation, :current_password, :names, :surnames, :area_of_residence_id, :area_of_interest_id])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :subdomain, :domain])\n end",
"def configure_sign_up_params\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n end",
"def sign_up_params\n params.require(:user).permit(:name, :last_name, :email, :password, :password_confirmation)\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :second_name, :email, :password, :password_confirmation)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :name\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :name\n end",
"def device_signup_params\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :name) }\n end",
"def configure_permitted_parameters\n \t\tdevise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n \tend",
"def configure_permitted_parameters\n # For additional fields in app/views/devise/registrations/new.html.erb\n devise_parameter_sanitizer.permit(:sign_up, keys: [:last_name, :first_name])\n end",
"def sign_up_params()\n params.require(:user).permit(:First_Name, :Last_Name, :UserName, :email, :password, :password_confirmation, :Age_Agreement)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :cpf])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :name])\n end",
"def sign_up_params\r\n params.require(:user).permit(:email, :password, :password_confirmation, :full_name, :amka, :father_amka, :mother_amka, :gender)\r\n end",
"def sign_up_params(params)\n params.permit(:password, :password_confirmation, :name, :email)\n end",
"def signup_params\n params.require(:signup).permit(:name, :email, :phone_number, :shift_id, :team_affiliation)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :password, :password_confirmation])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :dob, :email, :password, :password_confirmation, :phone_number, :role_id])\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation)\n end",
"def signup_params\n params.permit(:email, :password, :name)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up).push(:username, :x, :y)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n end",
"def configure_sign_up_params\n\n devise_parameter_sanitizer.permit(:sign_up, keys: [:prenom, :nom, :email, :password, :password_confirmation])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n :username,\n :name,\n :middle_name,\n :last_name\n ])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up).push(:first_name, :last_name)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :username])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up) {|u| u.permit(:email, :password, :password_confirmation, :role_id,\n :city_id, :identification, :name, :surname)}\n end",
"def configure_sign_up_params\n if request.content_type == 'application/json'\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n else\n params[:user].permit(:email, :password, :birth_date, :first_name, :last_name, :user_name)\n end\n # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])\n end",
"def configure_sign_up_params\n # devise_parameter_sanitizer.permit(:sign_up, :keys => [:username])\n devise_parameter_sanitizer.for(:sign_up) << :username\n end",
"def sign_up_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation, :type)\n end",
"def configure_sign_up_params\n\n added_attrs = [:event_code, :email, :password, :password_confirmation, :contact_number,\n :full_name, :member_id, :member_type, :affiliation, :abo_number, :aes_number,\n :company, :id_number, :distributor_number, :employee_number, :mailing_address,\n :member_company, :upline, :who_invited_you, :abo_type, :distributor_type]\n\n devise_parameter_sanitizer.permit(:sign_up, keys: added_attrs)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:fullname)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [{ name_translations: [:en, :zh_HK] }, :display_name, :gender, :birthday, :mobile, :cuid_type, :cuid, :cu_resident, :major, :year_of_admission, :year_of_graduation])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:api_key, :home_zip_code, :full_name, :found_option])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :first_name\n devise_parameter_sanitizer.for(:sign_up) << :last_name\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:password, :password_confirmation, :first_name, :last_name, :circonscription])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :circonscription])\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname, :major_id])\n end"
] | [
"0.7825672",
"0.77927095",
"0.77289957",
"0.76966476",
"0.76915294",
"0.7689279",
"0.7676229",
"0.7664107",
"0.7647835",
"0.7633539",
"0.7618216",
"0.7589338",
"0.7587957",
"0.757993",
"0.7544609",
"0.7533399",
"0.7533028",
"0.75178266",
"0.75052375",
"0.7497262",
"0.7478427",
"0.7470277",
"0.74551314",
"0.74285084",
"0.7424559",
"0.74228334",
"0.74189115",
"0.74182767",
"0.74041927",
"0.74023825",
"0.7378149",
"0.73651445",
"0.7360271",
"0.73576224",
"0.7356462",
"0.7345609",
"0.7336786",
"0.7335579",
"0.73342776",
"0.733405",
"0.73296076",
"0.7317574",
"0.7316813",
"0.7311315",
"0.731087",
"0.73043597",
"0.72927725",
"0.7288053",
"0.7275473",
"0.7271387",
"0.72617",
"0.72563237",
"0.7255054",
"0.72190845",
"0.72187835",
"0.7213154",
"0.72095764",
"0.7205306",
"0.7204841",
"0.7204091",
"0.7203398",
"0.7188",
"0.7187618",
"0.71856254",
"0.71855265",
"0.7182134",
"0.7182134",
"0.71813864",
"0.71805966",
"0.71674854",
"0.71647006",
"0.71539754",
"0.71539754",
"0.7150162",
"0.71490675",
"0.7148954",
"0.7147217",
"0.713865",
"0.71337265",
"0.7131653",
"0.7129275",
"0.7127121",
"0.71232826",
"0.71141785",
"0.7111615",
"0.7101183",
"0.70974934",
"0.7095609",
"0.7088124",
"0.70847005",
"0.7084528",
"0.7080343",
"0.7077595",
"0.70634556",
"0.7063295",
"0.7062251",
"0.70608044",
"0.7059075",
"0.7058457",
"0.7055987"
] | 0.7287222 | 48 |
>> quiz = [0,0,0,1,0,0,1,1,0,1] >> count_quiz_completions(quiz) => "The number of participants who did not attempt Quiz 1 is 6 out of 10 total participants." | def count_quiz_completions(quiz_results)
no_quiz = quiz_results.count(0)
total = quiz_results.count
"The number of participants who did not attempt Quiz 1"\
" is #{no_quiz} out of #{total} total participants."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_quiz(questions)\r\n answer = \"\"\r\n score = 0\r\n for question in questions #a for loop for every question in the above array\r\n puts question.prompt\r\n answer = gets.chomp()\r\n if answer == question.answer\r\n score += 1\r\n end\r\nend\r\n puts \"you got\" + score.to_s + \"/\" + questions.length.to_s \r\nend",
"def run_test(questions)\n answer = \"\"\n score = 0\n for question in questions\n puts question.prompt\n answer = gets.chomp().to_s\n if answer == question.answer\n score += 1\n end #end if\n end #end loop\n puts (\"You got \" + score.to_s + \"/\" + questions.length().to_s)\nend",
"def number_correct\n @correct_answers = []\n\n @turns.each do |turn|\n @correct_answers << turn.correct?\n end\n @correct_answers.count(true)\n end",
"def run_test(questions)\n answer = \"\"\n score = 0\n\n for question in questions\n puts question.prompt\n answer = gets.chomp().to_s\n if(answer == question.answer)\n score += 1\n end\n end\n\n puts \"You got #{score} questions correct out of #{questions.length()}\"\nend",
"def num_answered_questions\n return Answer.where(id: answers.map(&:id)).includes({ question: :question_format }, :question_options).reduce(0) do |m, a|\n if a.is_valid?\n m+=1\n end\n m\n end\n end",
"def run_quiz(questions)\n answer = \"\"\n score = 0\n questions.each do |question| \n puts question.prompt \n answer = gets.chomp()\n if answer == question.answer\n score+=1\n end\n end\n puts \" You got a score of #{score}/#{questions.length} congratulations!\"\nend",
"def run_test(questions)\n answer = \"\" # create a variable called answer empty string\n score = 0 # keeping track of the questions they get right\n\n # looping through the questions\n for question in questions\n puts question.prompt\n \n # get answer from the user\n answer = gets.chomp()\n\n if answer == question.answer\n score += 1\n end\n end\n\n puts (\"You got \" + score.to_s + \" / \" + questions.length().to_s)\n\nend",
"def answered_questions_count\n return 0 if survey.nil?\n survey.answered_count\n end",
"def run_test(questions)\n answer = \"\"\n score = 0\n for question in questions \n puts question.prompt\n answer = gets.chomp() #it will store whatever the user respond into the answer \n if answer == question.answer #another attribute of question class\n score += 1 \n end\n end \n puts (\"You got\" + score.to_s + \"/\" + questions.length().to_s)\nend",
"def take_quiz(title)\n score = 0\n\n puts title.upcase\n puts \"-----------\"\n\n @quizzes[title].each do |question, answer|\n puts question\n user_ans = gets.chomp.downcase\n\n if user_answer == \"y\" || user_ans == \"n\"\n if user_ans == answer\n score += 1\n end\n else\n puts \"Try again: Y or N\"\n redo\n end\n end\n\n puts \"You got a score of #{score} out of #{@quizzes[title].length}\"\n\nend",
"def num_answered_questions(plan)\n return 0 if plan.nil?\n return sections.reduce(0) do |m, s|\n m + s.num_answered_questions(plan) \n end\n end",
"def alsquiz_count\n self.alsquiznr.nil? ? 0 : 1\n end",
"def marks(my_answers, correct_answers)\n marks = 0\n wrong = []\n my_answers.each_with_index do |x,i|\n if x == correct_answers[i]\n marks += 1\n else\n wrong << i + 1\n end\n end\n puts \"I scored #{marks} out of 20\"\n puts \"I got these questions wrong:\"\n puts wrong.empty? ? \"None!!\" : wrong.join(\",\") \nend",
"def question_count \n @by_question.count\n end",
"def answer_count\n return @answers.length if @answers\n \n Factory.count_answers_at_machine(@location)\n end",
"def bad_results\n answer_choice_count = {}\n answer_choices = self.answer_choices\n answer_choices.each do |answer_choice|\n answer_choice_count[answer_choice.answer_choice_body] = answer_choice.responses.length\n end\n\n answer_choice_count\n end",
"def num_questions\n n = 0\n sections.each do |s|\n n += s.questions.size\n end\n n\n end",
"def num_votes \n @scores.reject { |a| a[:option] == 'absent' }.count\n end",
"def score_factor_count\n com_count = self.complaints.finished.count\n dep_review_count = count_scorable_department_reviews\n city_review_count = count_scorable_city_reviews\n petition_count = self.petitions.finished.count\n return score_count = com_count + dep_review_count + city_review_count + petition_count\n end",
"def total_quizzes_stats\n Float(self.quizzes.length)\n end",
"def answer_count\n if is_standard?\n respond_to?(:copy_answer_count_col) ? copy_answer_count_col : copies.inject(0){|sum,c| sum += c.answer_count}\n else\n respond_to?(:answer_count_col) ? answer_count_col : answers.count\n end\n end",
"def number_correct\n turns.count do |each_turn|\n each_turn.correct?\n end\n end",
"def number_correct\n @turns.count do |turn|\n turn.correct?\n end\n end",
"def number_of_completed_responses\n if statistics && !statistics.empty? && (completed_data = statistics.find {|a| a[0] == 'Complete'})\n completed_data[1]\n else\n 0\n end\n end",
"def number_correct\n count_of_correct_turns = 0\n\n @turns.each do |turn|\n if turn.correct? == true\n count_of_correct_turns += 1\n end\n end\n count_of_correct_turns\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 num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end",
"def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end",
"def num_answered_questions(plan)\n plan&.num_answered_questions.to_i\n end",
"def num_answered_calls\n answered_contacts.count\n end",
"def find_number_of_responses(question)\n empty_response_character=''\n case question.question_type.q_type\n when \"TextBox\", \"TextArea\", \"Rating\" # For ratings, we count responses for comments instead of dropdown\n empty_response_character=''\n when \"DropDown\"\n empty_response_character= @questionnaire.min_question_score\n end\n response_count=Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != ? AND s.question_id=?\", @map.reviewed_object_id, @map.reviewee_id, empty_response_character, question.id]).count\n response_count\n end",
"def find_number_of_responses(question)\n empty_response_character=''\n case question.question_type.q_type\n when \"TextBox\", \"TextArea\", \"Rating\" # For ratings, we count responses for comments instead of dropdown\n empty_response_character=''\n when \"DropDown\"\n empty_response_character= @questionnaire.min_question_score\n end\n response_count=Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != ? AND s.question_id=?\", @map.reviewed_object_id, @map.reviewee_id, empty_response_character, question.id]).count\n response_count\n end",
"def votes\n scenario_answers.count\n end",
"def num_questions\n n = 0\n self.sections.each do |s|\n n+= s.questions.size()\n end\n return n\n end",
"def count_quizzes\n @worksheet.num_rows\n end",
"def count_json_correct(qajson_array)\n result = 0\n qajson_array.each do |hash|\n if hash[\"selection\"] == hash[\"correct\"] then result += 1 end\n end\n puts result\n result\n end",
"def find_number_of_responses(question)\n empty_response_character = ''\n case question.question_type.q_type\n when \"TextBox\", \"TextArea\", \"Rating\" # For ratings, we count responses for comments instead of dropdown\n empty_response_character = ''\n when \"DropDown\"\n empty_response_character = @questionnaire.min_question_score\n end\n response_count = Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != ? AND s.question_id=?\", @map.reviewed_object_id, @map.reviewee_id, empty_response_character, question.id]).count\n response_count\n end",
"def points_possible(question)\n @total = question.choices.size + 1\n @attempts = current_user.attempt_choices.where(question_id: question.id).size\n @possible = @total - @attempts\n end",
"def ask_count\n @asks.count\n end",
"def count_incomplete\n return self.incomplete_tests.size\n end",
"def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end",
"def n_plus_one_result\n poll_result = {}\n\n all_answer = self.answer_choices\n all_answer.each do |ans|\n poll_result[ans.choice] = ans.responses.count\n end\n\n poll_result\n end",
"def amount_of_suggestions\n system('clear')\n puts '》 RECOMMENDATIONS 《'\n amount = @prompt.ask('How many recommendations would you like to generate?'.colorize(:light_green)) do |q|\n q.in '1-10'\n q.messages[:range?] = 'Number must be between 1 and 10'\n end\n recommend(amount.to_i)\n end",
"def games_played\n self.results.to_a.count\n end",
"def progress_stats\n word_count = Float(Word.all.length)\n quizzed_count = Float(Quiz.all.uniq { |noun| noun.word_id }.length)\n rate = quizzed_count / word_count\n rate.round(2) * 100\n end",
"def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end",
"def answers_count\n\n\n self.answers_count_yeses + self.answers_count_noes\n\n\n end",
"def results\n # { answer choice text => count of responses }\n results_hash = Hash.new(0)\n\n answer_choices.each do |choice|\n # results_hash[choice.question.text] += choice.responses.length \n results_hash[choice.text] += choice.responses.length \n end\n \n results_hash\n end",
"def percentage_completed_by_user user\n question_ids = questions.collect &:id\n return 1.0 if question_ids.count == 0\n \n question_count = question_ids.count\n correctly_answered_questions = Question.joins(:in_reply_to_posts).where('questions.id' => question_ids).where('posts.user_id' => user.id, 'posts.correct' => true).group('questions.id')\n correctly_answered_questions.to_a.count / question_count.to_f\n end",
"def vote_counts\n counts = {\n :option1 => 0,\n :option2 => 0,\n :option3 => 0,\n :option4 => 0,\n :option5 => 0,\n :option6 => 0\n }\n\n self.votes.each do |vote|\n if vote.option_num == \"1\"\n counts[:option1] += 1\n elsif vote.option_num == \"2\"\n counts[:option2] += 1\n elsif vote.option_num == \"3\"\n counts[:option3] += 1\n elsif vote.option_num == \"4\"\n counts[:option4] += 1\n elsif vote.option_num == \"5\"\n counts[:option5] += 1\n elsif vote.option_num == \"6\"\n counts[:option6] += 1\n end\n end\n\n return counts\nend",
"def get_count(input)\n input.count('aeiou')\nend",
"def run_test(questions_capital)\n answer = \"\"\n score = 0\n for question in questions_capital\n puts question.prompt\n answer = gets.chomp.upcase\n puts \" \"\n puts \"You've answered: #{answer}\"\n puts \"The correct answer is: #{question.answer}\"\n if answer == question.answer\n score += 1\n puts \"You have answered correctly!\".green\n else\n puts \"Better luck next time!\".red\n end\n puts \" \"\n end\n puts \"You got\" \" \" + score.to_s + \"/\" + questions_capital.length().to_s\n end",
"def word_count\n @tried_solutions.length\n end",
"def incomplete_count\n incomplete.count\n end",
"def number_of_stats_skillz(text)\n result = 0\n @statistics_skillz.each do |s|\n if text.downcase.include?(s)\n result += 1\n end\n end\n return result\nend",
"def get_num_of_completed_trips\n return @trips.length - 1 if !@trips.empty? && @trips.last.is_in_progress?\n return @trips.length\n end",
"def get_completed_count\n todo_items.where(completed: true).count\n end",
"def total_guess_count()\r\n\t\t# TODO: fill in method body\r\n\t\treturn -1\r\n\tend",
"def finishQuestion()\n # Compares the arrays of correct answers and user's selected answers\n # and creates another array with correct (true) answers\n arrTrueAnswers = $arrUserAnswers.zip($arrCorrectAnswers).map { |x, y| x == y}\n x = arrTrueAnswers.count(true)\n msgBox = Tk.messageBox(\n 'type' => \"ok\",\n 'icon' => \"info\",\n 'title' => \"GemQuiz - Stats\",\n 'message' => \"You have \" + x.to_s + \" correct answers out of \" + $intTotalQuestions.to_s + \".\n That's \" + ((x.to_f / $intTotalQuestions.to_f) * 100).round(2).to_s + \"%.\")\nend",
"def questionnaire(questions)\n answer = \"\"\n score = 0\n for question in questions\n puts question.question\n answer = gets.strip.downcase.to_s\n if answer == question.answer\n score += question.score\n elsif answer == question.incorrect \n score += 0\n else \n # method raises an error message if true or false input is entered\n invalid_input(answer)\n end \n end\n return score\nend",
"def challenge_accepted_count\n self.challenges.where.not(status: \"pending\").order(updated_at: :desc).count\n end",
"def count_items(electives)\n electives.length #counts number of items in the array\nend",
"def questions_count\n self.questions.count\n end",
"def wrong_count()\n $game_won == true ? 11 : $wrong_count.length # if the user won use 11, otherwise use the number of wrong letters\nend",
"def nombre_questions_in code\n code.scan(/div([^>]+)class=\"question\"/).to_a.count\n end",
"def success\n (correct_answers_count*100.0/answers_count).round.to_i if answers_count > 0\n end",
"def numberPlayers\n list = []\n system('clear')\n numberPlayer = validNumberPlayer\n 3.times {puts \"\\n\"}\n i = 1\n numberPlayer.times do |player|\n player = capturePlayer(i)\n @@listPlayer << player\n i+=1\n end\n @@scoreTable.displayListPlayer(@@listPlayer)\n return \"Validation of players\"\n end",
"def questionings_count\n respond_to?(:questionings_count_col) ? (questionings_count_col || 0).to_i : questionings.count\n end",
"def achievements_done\n @achievements.size\n end",
"def get_num_players\n return prompt_positive_integer(\"Number of players? [1]\",1)\n end",
"def completed_polls\n polls_with_completion_counts\n .having('COUNT(DISTINCT questions.id) = COUNT(responses.id)')\n end",
"def counting\n puts \"hard to do right\"\n end",
"def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end",
"def get_habits_count\n habits.count\n end",
"def get_num_rides(rides)\n return rides.length\nend",
"def count \n trips.length\n end",
"def vote_count\n options.values.reduce(:+)\n end",
"def num_of_correct(crct)\n if self.total.nil?\n self.total = 1\n else\n self.total += 1\n end\n \n if crct == 1\n if self.correct.nil?\n self.correct = 1\n else\n self.correct += 1\n end \n else\n self.correct = 0\n end\n end",
"def vote_count\n count = Vote.find_all_by_question_id(self.id)\n if count\n return count.count\n else\n return 0\n end\n end",
"def question_lines_count(question_lines)\n question_lines.reduce(0) do |acc, line|\n acc + @prompt.count_screen_lines(line)\n end\n end",
"def pitch_counts\n games = pitcher_games\n pitches = pitches_for_games(games)\n counts = pitches.collect{|pitches| pitches.size}\n counts\n end",
"def rate\n votes = answers.inject(0) do |sum, a| \n sum + a.votes.count \n end\n \n # Return a count of votes and answers\n answers.count + votes\n end",
"def count_rulings(card)\n ruling_arr = scryfall.rulings(card['id']) \n \"(#{ruling_arr.length})\"\n end",
"def solution(a)\n return a.count(a.max)\nend",
"def total_complete\n tasks.select { |task| task.complete? }.count\n end",
"def picked(report)\n report.answered_questions.find_all_by_answer_id(self.id).count\n end",
"def test_13_games_lost_count_incremented_upon_lost\r\n letter = \"p\"\r\n $games_lost = 0\r\n $wrong_count = [\"z\", \"x\", \"w\", \"q\", \"d\", \"f\", \"k\", \"m\", \"u\"]\r\n results = wrong_letter(letter)\r\n assert_equal(1, $games_lost)\r\n end",
"def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end",
"def total_review_character_count\n review_character_counts.inject(:+)\n end",
"def get_total_games_played\n return games.size\n end",
"def count_votes\n votes = 0\n QuestionVote.where(question_id: self.id).each do |question|\n votes += question.vote\n end\n votes\n end",
"def complete_check_count\r\n check_number = []\r\n self.jobs.each do |job|\r\n if job.job_status = JobStatus::COMPLETED\r\n check_number << job.check_number\r\n end\r\n end\r\n check_number.uniq!\r\n if check_number.nil?\r\n return 0\r\n else\r\n return check_number.size\r\n end\r\n end",
"def card_count(input)\n count = 0\n\n return false if input.size > CARDS_IN_A_DECK\n\n played_cards = input.chars\n\n played_cards.each do |input|\n if input == '2' || input == '3' || input == '4' || input == '5' || input == '6'\n count += 1\n elsif input == 'T' || input == 'J' || input == 'Q' || input == 'K' || input == 'A'\n count -= 1\n end\n end\n\n # return false if more_than_four_of_each_rank_played(played_cards)\n #\n # count += case card\n # when '2', '3', '4', '5', '6'\n # 1\n # when 'T', 'J', 'Q', 'K', 'A'\n # -1\n # else\n # 0\n # end\n\n return count\nend",
"def take_quiz\n end",
"def count_items\n QuestionCell.count(\"id\", :conditions => [\"question_id = ? AND answer_item != ? AND col = 2\", self.id, \"\" ])\n end",
"def number_of_items()\n print \"Please enter a number of items you're interested in seeing: \"\n number_of_items = gets.chomp\n number_of_items = confirm_a_number(number_of_items)\n count = 0\n while number_of_items > @fav_food.length\n count+=1\n print \"Please enter a value less than the size of the menu: \"\n puts \"You have #{@NUMBER_OF_ATTEMPTS-count+1} left\"\n number_of_items = gets.chomp\n number_of_items = confirm_a_number(number_of_items)\n if count >= @NUMBER_OF_ATTEMPTS\n puts \"You have exceeded the required amounts of guesses, default amount of values will be (5).\\n\"\n break\n end\n end\n return number_of_items\nend",
"def get_completed_count\n TodoItem.where(completed: true).count\n end",
"def count_correct_characters(correct, guess)\n\n\tif (correct.length != guess.length)\n\t\traise \"An error has occurred.\"\n\tend\n\n\tif (correct === guess)\n\t\treturn correct.length\n\tend\n\n\tcorrect_guesses = guess.split(\"\").each_with_index.select {|char,index| char === correct.split(\"\")[index]}\n\t# if correct_guesses.length === 0\n\t# \treturn \"No letters are in the correct position\"\n\t# else\n\t# \treturn correct_guesses.map {|item| \"\\\"#{item[0]}\\\"\"}.join(\" and \")\n\t# end\n\treturn correct_guesses.length\n\nend",
"def returned_sheets\n return 0 if course.profs.empty? || form.get_tutor_question.nil?\n tutor_db_column = form.get_tutor_question.db_column.to_sym\n RT.count(form.db_table, {:barcode => course.barcodes, \\\n tutor_db_column => tutnum})\n end",
"def how_many_students\n number = roster.length\n \"There are #{number} students in our class\"\nend"
] | [
"0.7076016",
"0.6728585",
"0.6710225",
"0.6652424",
"0.6644462",
"0.663831",
"0.6636416",
"0.6606279",
"0.6586398",
"0.64089113",
"0.6376458",
"0.6270606",
"0.6246921",
"0.6238103",
"0.6178607",
"0.6170431",
"0.61440253",
"0.61341083",
"0.61295664",
"0.611574",
"0.61090994",
"0.6107974",
"0.609538",
"0.60824305",
"0.6077778",
"0.60603595",
"0.60223264",
"0.60007644",
"0.5995147",
"0.5991227",
"0.59874606",
"0.59874606",
"0.59860593",
"0.59432256",
"0.594148",
"0.5941262",
"0.5937697",
"0.5932976",
"0.59173965",
"0.5907242",
"0.59025997",
"0.5887938",
"0.588381",
"0.58728826",
"0.58531964",
"0.5823253",
"0.5818499",
"0.581318",
"0.57960856",
"0.57861847",
"0.57785386",
"0.5777791",
"0.5772181",
"0.5771547",
"0.5763056",
"0.57477355",
"0.57436144",
"0.57255906",
"0.5721794",
"0.57168174",
"0.5709191",
"0.57080483",
"0.5687251",
"0.5685884",
"0.56855404",
"0.568124",
"0.56790715",
"0.5667979",
"0.56674635",
"0.56649166",
"0.5663647",
"0.5655842",
"0.56547666",
"0.5642857",
"0.56414425",
"0.5637526",
"0.5633754",
"0.56221205",
"0.56170744",
"0.5613855",
"0.5613656",
"0.5612045",
"0.56043947",
"0.5603296",
"0.56003416",
"0.55978656",
"0.5596713",
"0.5596416",
"0.55905163",
"0.55871177",
"0.55819255",
"0.5578917",
"0.5575555",
"0.55724174",
"0.5569056",
"0.5563437",
"0.55465704",
"0.5542925",
"0.553455",
"0.553383"
] | 0.8939018 | 0 |
Examples: puts digit_list(12345) == [1, 2, 3, 4, 5] => true puts digit_list(7) == [7] => true puts digit_list(375290) == [3, 7, 5, 2, 9, 0] => true puts digit_list(444) == [4, 4, 4] => true | def digit_list(n)
list = n.to_s
list = list.split('')
list = list.map do |i|
i.to_i
end
return list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digit_list(num)\n if num < 10\n [num % 10]\n else\n num, digit = num.divmod(10)\n digit_list(num).push(digit)\n end\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(num)\n num.to_s.chars.map(&:to_i)\nend",
"def digit_list(num)\n num.to_s.chars.map {|val| val.to_i}\nend",
"def digit_list(number)\n number.to_s.chars.map { |char| char.to_i }\nend",
"def digit_list(number)\n list = number.to_s.split('').map { |i| i.to_i }\nend",
"def digit_list(num)\n num.to_s.split(//).map(&:to_i)\nend",
"def digit_list(num)\n num.to_s.split(//).map(&:to_i)\nend",
"def digit_list(number)\n digits = number.to_s.split('')\n digits = digits.map { |digit| digit.to_i }\n digits\nend",
"def digit_list(number)\n list = number.to_s.split('')\n list.map{ |item| item.to_i }\nend",
"def digit_list(number)\n digits = []\n\n until number == 0 do\n digits.unshift(number % 10)\n number /= 10\n end\n\n digits\nend",
"def digit_list(number)\n if number < 0\n puts \"Please choose a positive number!\"\n else\n number.to_s.chars.map(&:to_i)\n end \nend",
"def digit_list(number)\r\n digits = []\r\n loop do\r\n number, remainder = number.divmod(10)\r\n digits.unshift(remainder)\r\n break if number == 0\r\n end\r\n digits\r\nend",
"def digit_list(number)\n digits = []\n\n loop do\n number, rem = number.divmod(10)\n digits.unshift(rem)\n\n break if number == 0\n end\n\n digits\nend",
"def digit_list(int)\n int.to_s.chars.map { |n| n.to_i }\nend",
"def digit_list(int)\r\n int.to_s.chars.map{|x| x.to_i }\r\nend",
"def digit_list(num)\n digits = []\n\n loop do\n number, remainder = number.divmod(10)\n digits.unshift(remainder)\n break if number == 0\n end\n\n digits\nend",
"def digit_list(int)\n if int.to_i.integer? && int.to_i > 0\n array_of_strings = int.to_s.split(\"\")\n nums_array = array_of_strings.map {|a| a.to_i}\n else\n \"Not a positive integer.\"\n end\nend",
"def digit_list(integer)\n integer.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n digits = []\n\n loop do\n break if number == 0\n\n digit = number % 10\n digits.unshift(digit)\n\n number = number / 10\n end\n\n digits\nend",
"def digit_list(number)\n return number.abs.to_s.split('').map(&:to_i)\nend",
"def digit_list(num)\n int_array = []\n digit_array = num.to_s.split(//)\n digit_array.each do |numb|\n int_array += [numb.to_i]\n end\n int_array\nend",
"def digit_list(num)\n string = num.to_s\n array = string.split('')\n array.map {|num| num.to_i}\nend",
"def digit_list(num)\n array = []\n \n num.to_s.each_char do |c| \n array.push(c.to_i)\n end\n array\nend",
"def digit_list(num)\n str = num.to_s\n nums = str.split(//)\n nums.map{|char| char.to_i}\nend",
"def digit_list(num)\n result = []\n\n until num.zero?\n num, remainder = num.divmod(10)\n result.unshift(remainder)\n end\n result\nend",
"def matches_digits?( digits )\n\t\t\treturn true if digits.size < 2\n\t\t\n\t\t\tdigits.sort!\n\t\t\ttest = @dice.uniq.sort\n\t\t\tloop do\n\t\t\t\t(0..(@dice.length - digits.length)).each do |index|\n\t\t\t\t\treturn true if test[index, digits.length] == digits\n\t\t\t\tend\n\t\t\n\t\t\t\tdigits.collect! { |d| d + 1 }\n\t\t\t\tbreak if digits.last > 6\t\n\t\t\tend\n\t\t\n\t\t\tfalse\n\t\tend",
"def valid?\n digits = ''\n # double every other number starting with the next to last\n # and working backwards\n @number.split('').reverse.each_with_index do |d,i|\n digits += d if i%2 == 0\n digits += (d.to_i*2).to_s if i%2 == 1\n end\n\n # sum the resulting digits, mod with ten, check against 0\n digits.split('').inject(0){|sum,d| sum+d.to_i}%10 == 0\n end",
"def digit_list(number)\n string_array = number.to_s.split(\"\")\n string_array.map { |n| n.to_i }\nend",
"def digit_list(number)\n loop do \n puts \"Validating number.\"\n break if number >= 0 && number.is_a?(Integer)\n puts \"Number must be a positive integer! Please enter a positive integer:\"\n number = gets.chomp.to_i\n end\n puts \"Number successfully validated\"\n \n array = number.to_s.split(//)\n array.map! do |i|\n i.to_i\n end\n array\nend",
"def digit_list(num)\n arr = []\n divisor = 10**((num.to_s.length) - 1)\n \n while divisor >= 1\n digit = num/divisor\n arr << (num / divisor)\n num -= digit*divisor\n\n divisor = divisor / 10\n end\n \n arr\nend",
"def palindromic_number?(num)\n # my_list = num.digits\n # array_palindrome?(my_list)\n my_list = num.to_s\n palindrome?(my_list)\nend",
"def all_same_digits?(number)\n ary_of_chars = number.to_s.chars\n ary_of_chars.all? { |digit| digit == ary_of_chars[0] }\n end",
"def digit_list(integer)\n array = integer.split('')\n if array.length <= 2\n return array.join(' and ')\n else\n return array.join(', ')\n end\nend",
"def digit_list(int)\n string_ints = int.to_s\n array_string_ints = string_ints.split(//)\n ints = Array.new\n array_string_ints.each do |string|\n ints << string.to_i\n end\n return ints\nend",
"def is_valid?\n # Declare array variable for use in iterative block\n iterated_array = []\n\n # Split card_number into an array, iterate to double even indexes, and assign to variable\n card_number.chars.each_with_index do |number, index|\n # Look for digit to left of final digit and every second digit moving left.\n if (index - card_number.length).even?\n # If so, return doubled value\n doubled_number = card_number.chars[index].to_i * 2\n # Check if resulting number greater than 9 (i.e., double digits)\n if doubled_number > 9\n # If so, subtract 9 (equivalent to adding the two digits)\n doubled_number -= 9\n end\n # Push to array\n iterated_array << doubled_number\n # If not even index value...\n else\n # Push unmodified number to array\n iterated_array << number.to_i\n end\n end\n\n # Return true or false result of following boolean comparison\n iterated_array.sum % 10 == 0\n end",
"def is_valid_number?(string_of_digits, input_string)\n\n # input_string is a string, can be 1 or multiple characters\n # Go from the beginning of input_string to the end\n\n input_string.each do |char|\n digit_valid = is_valid_digit?(string_of_digits, char)\n return false if !digit_valid\n end\n\n true\nend",
"def uniq_digits?(num)\n digits = num.to_s.chars\n digits == digits.uniq\nend",
"def count_spec_digits(integer_list, digit_list)\n arr = integer_list.join.chars.select {|x| x =~ /\\d/}.map(&:to_i)\n digit_list.map {|num| [num, arr.count(num)]}\n end",
"def digits(input)\n verify_int(input).to_s.split(//)\nend",
"def check_numbers(data)\n hash = {}\n\n data.each do |number|\n integer = number.to_i\n\n if integer > 0 && integer < 10\n if hash[integer]\n return false\n else\n hash[integer] = 1\n end\n end\n end\n\n return true\nend",
"def validateCardNumber lst\n lunhNumbers = [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]\n sum = 0\n lst_rev = lst.reverse\n (0...(lst_rev.length)).each do |i|\n if i % 2 ==0 then\n sum += lst_rev[i]\n else\n sum += lunhNumbers[lst_rev[i]]\n end\n end\n if sum % 10 == 0 then\n return 1\n else\n return 0\n end\nend",
"def digit_list_two(positive_integer)\n list = []\n array_of_integer_strings = positive_integer.to_s.split('')\n array_of_integer_strings.each do |number|\n list << number.to_i\n end\n list \nend",
"def contains_number?(item) #analyse chaque login pour détecter la présence d'au moins un chiffre#\n i=0\n (item.length-1).times do\n if (item[i] == \"0\"||item[i] == \"1\"||item[i] == \"2\"||item[i] == \"3\"||item[i] == \"4\"||item[i] == \"5\"||item[i] == \"6\"||item[i] == \"7\"||item[i] == \"8\"||item[i] == \"9\")\n return true\n end\n i+=1\n end\n return false\nend",
"def numbers_with_digit_inside(x, d)\n included_nums = []\n num_arr = (1..x).to_a.map { |num| num.to_s }\n num_arr.each do |num|\n if num.include?(\"#{d}\")\n included_nums << num.to_i\n end\n end\n if included_nums.empty?\n return [0, 0, 0]\n else\n answer = []\n answer << included_nums.length\n answer << included_nums.inject(&:+)\n answer << included_nums.inject(&:*)\n return answer\n end\nend",
"def unused_digits(*num)\n digits = (0..9)\n arr = *num.join.split('')\n \n unused_digits = digits.select do |num|\n !arr.include?(num.to_s)\n end\n unused_digits.sort.join\nend",
"def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend",
"def digits(number)\n return [0] if number.zero?\n\n number = number.abs\n digits = []\n loop do\n digits.unshift(number % 10)\n number = number.div(10)\n return digits if number.zero?\n end\n end",
"def interesting_number(number)\n #check if the length is greater than 3 digits\n number_in_array = number.digits.reverse\n return false if number_in_array.length < 3\n increasing_numbers?(number_in_array)\n decreasing_numbers?(number_in_array)\nend",
"def digit_list(number)\n # Thank you rubocop for the &:to_i syntax\n number.to_s.chars.map &:to_i\nend",
"def featured_num?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq == num.digits\nend",
"def digits_repeat?(number)\n !(number.to_s.chars.eql? number.to_s.chars.uniq)\nend",
"def digitArray(num)\n\tdigs = []\n\twhile num > 9\n\t\tnum, last_digit = num.divmod(10)\n\t\tdigs << last_digit\n\tend\n\tdigs << num\n\tdigs\nend",
"def list_of_nums(num)\n num.to_s.split('').map! {|n| n.to_i}\nend",
"def digits_repeat?(number)\n number.to_s.chars.any? { |s| number.to_s.count(s) > 1 }\nend",
"def valid(number)\n puts '---------------------------valid?'\n digits = ''\n # double every other number starting with the next to last\n # and working backwards\n number.split('').reverse.each_with_index do |d,i|\n digits += d if i%2 == 0\n digits += (d.to_i*2).to_s if i%2 == 1\n end\n\n # sum the resulting digits, mod with ten, check against 0\n digits.split('').inject(0){|sum,d| sum+d.to_i}%10 == 0\n\n # puts '=============== !!!!valid always returning true for testing !!!!==========='\n # return true #just for testing\n end",
"def digits(pos_int)\n list = pos_int.to_s.split(\"\").map { |i| i.to_i }\nend",
"def is_all_big(numbers)\n result = true\n index = 0\n while index < numbers.length\n if numbers[index] <= 10\n result = false\n end\n index += 1\n end\n result\nend",
"def digit_list(positive_integer)\n positive_integer.digits.reverse!\nend",
"def contains_pair digits\n valid = false\n current_digit = digits.first\n current_count = 0\n digits.each do |d|\n if d == current_digit\n current_count += 1\n else\n if current_count == 2\n valid = true\n end\n current_count = 1\n current_digit = d\n end\n end\n if current_count == 2\n valid = true\n end\n valid\nend",
"def valid_numbers?\n numbers.each do |phone_number|\n return false unless phone_number =~ /\\A^[\\d\\-]+\\z/\n end\n true\n end",
"def find_numbers(nums)\n return nums.select{ |x| x.digits.length.even? }.length\nend",
"def checkdigit(number)\n\t\t\tdigits = number.to_s.reverse.scan(/\\d/).map { |x| x.to_i }\n\t\t\tdigits = digits.each_with_index.map { |d, i|\n\t\t\t d *= 2 if i.even?\n\t\t\t d > 9 ? d - 9 : d\n\t\t\t}\n\t\t\tsum = digits.inject(0) { |m, x| m + x }\n\t\t\tmod = 10 - sum % 10\n\t\t\tmod==10 ? 0 : mod\n \tend",
"def featured_num?(num)\n return false unless num.odd?\n return false unless num % 7 == 0\n return false unless num.digits.size == num.digits.uniq.size\n true\nend",
"def containsDigit str\n (\"0\"..\"9\").each {|x|\n result = str.include?(x)\n if (result)\n return true\n end\n }\n return false\n end",
"def digit_list(int)\n int.digits.reverse\nend",
"def digit_list(int)\n int.digits.reverse\nend",
"def num_valid?\r\n number = ''\r\n # (1)need to split the number down first to handle it digit by digit\r\n # (2)because number length can change, better to reverse it and go front to back\r\n # (3)put through an each block to loop through the digits, adding with_index to help the modulo\r\n # (4)using a modulo to apply *2 if remainder is not 0 (i.e. every other number starting at position 1, using the index)\r\n # (5)building up the number string with << (could use += but no need to create a new object every time)\r\n @num.split('').reverse.each_with_index do |digit, index|\r\n number << digit if index%2 == 0\r\n number << (digit.to_i*2).to_s if index%2 != 0\r\n end\r\n\r\n # lastly have to check the result added together modulo's to zero\r\n # consulted http://blog.jayfields.com/2008/03/ruby-inject.html for inject syntax refresher\r\n # (1)need to split the number down into an array so inject() can turn them to_i and give us the sum\r\n # (2)using a modulo to ensure the final sum is a multiple of 10\r\n number.split('').inject { |r,e| r.to_i + e.to_i } % 10 == 0\r\n end",
"def isDigit(c)\n ('0' .. '9').include?(c)\nend",
"def luhn?(cardNumber)\n cardNumber.split(//).map_with_index do |el, i|\n #1)Starting with the next to last digit\n #and continuing with every other\n #digit going back to the beginning of the card, double the digit\n #\n #This means that, if the length is even, even indices\n #are doubled, and vice versa\n if i % 2 == cardNumber.length % 2\n #Doubled digits will have to be split again\n (el.to_i * 2).to_s.split(//).map{|n| n.to_i}\n else\n el.to_i\n end\n #2) Sum all numbers\n end.flatten.enum_for.inject(0){|sum, num|sum + num } %\n #3)Check for multiple of 10\n 10 == 0\nend",
"def digits(number)\n number.to_s.chars.map(&:to_i)\nend",
"def contains_a_digit(pass)\n nums = [*1..9]\n if nums.select { |value| pass.include? value.to_s }.empty?\n 'Sorry, password must contain a number.'\n else\n 'Yay, password contains a number.'\n end\nend",
"def digit_list(num)\n num.digits.reverse\nend",
"def digit_list(num)\n num.digits.reverse\nend",
"def all_digits_are_the_same?(digits)\n digits.uniq.length == 1\nend",
"def get_digits(num)\n digits = []\n result = num \n first_iter_flag = true\n while(result != 0)\n result = result/10 if(!first_iter_flag)\n first_iter_flag = false if(first_iter_flag)\n digits.unshift result%10 if(result != 0)\n end\n digits\nend",
"def digit_list(int)\n #ex 12345\n arr = []\n int.to_s.split('').map do |x|\n arr << x.to_i\n end\n=begin\nORIGINAL LOGIC\nstring = int.to_s # => [\"12345\"]\narr_of_strings = string.split('') #=> [\"1\", \"2\", \"3\", \"4\", \"5\"]\narr_of_strings.map do |x|\n arr << x.to_i\nend\n=end\n p arr\nend",
"def digit_list(integer)\n integer.digits.reverse\nend",
"def isvalid?(cc_num) \r\n cc_num = cc_num.reverse.split(\"\").map! {|x| x.to_i}\r\n checkdig = cc_num[0]\r\n cc_num.delete_at(0)\r\n odds = []\r\n sd_evens = []\r\n dd_evens = []\r\n total = 0\r\n dd_evs_spl = []\r\n \r\n cc_num.each_index { |x|\r\n if x % 2 == 1\r\n odds << cc_num[x]\r\n elsif cc_num[x] < 5\r\n sd_evens << cc_num[x]\r\n else\r\n dd_evens << cc_num[x]\r\n end\r\n }\r\n \r\n sd_evens.map! {|x| x * 2}\r\n dd_evens.map! {|x| (x * 2).to_s}\r\n dd_evens = dd_evens.join(\"\").split(\"\")\r\n dd_evens.map! {|x| x.to_i}\r\n \r\n odds.each {|x| total += x}\r\n sd_evens.each {|x| total += x}\r\n dd_evens.each {|x| total += x}\r\n \r\n check_dig = (total * 9) % 10\r\n \r\n if checkdig == check_dig\r\n puts \"The number is valid.\"\r\n else\r\n puts \"The number is invalid.\"\r\n end\r\n\r\nend",
"def digits_condition\n @number.scan(/\\D/).empty?\n end",
"def digits(num)\n cs = num.to_s.chars\n [].tap do |o|\n while cs.size > 0\n c = cs.shift\n o << (c + Array.new(cs.length) { |_i| 0 }.join).to_i\n end\n end\nend",
"def featured?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq.size == num.digits.size\nend",
"def unused_digits(*a)\n numbers = [*a].join.split(\"\")\n digits_left = (0..9).to_a\n\n digits_left.length.times do |num|\n if numbers.include?(num.to_s) == true\n digits_left.delete(num)\n end\n end\n\n return digits_left.join\n\nend",
"def digit_list(integer)\n integer.digits.reverse\nend",
"def number_is_valid? number\n true if number.join('').to_i.to_s == number.join('')\nend",
"def ten_digits (num, set)\n\tnum_a = num.to_s.split(\"\")\n\tresult_a = []\n\n\tfor x in num_a.length-11..num_a.length-1\n\t\tresult_a << num_a[x]\n\tend\n\n\treturn result_a.join.to_i\nend",
"def check_str(str)\n num=[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\"]\n new_str=str.split(\"\")\n new_str.each do |n|\n if num.include?(n)\n return true\n end\n end\n return false\nend",
"def available?(digit)\n @available_digits.member? digit\n end",
"def same_digits?(a, b)\n return a != b &&\n a.to_s.split(/(?=.)/).sort == b.to_s.split(/(?=.)/).sort\nend",
"def calculate_check_digit\n sum = digits.first(12).each_with_index.sum do |digit, index|\n index.even? ? digit : (digit * 3)\n end\n remainder = sum % 10\n remainder.zero? ? remainder : (10 - remainder)\n end",
"def featured(int)\n for num in (int + 1...9_999_999_999) \n return num if num.odd? && num % 7 == 0 && num.digits == num.digits.uniq\n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def sequential(number)\r\n # number.digits.reverse.each_with_index do |num, idx|\r\n # if idx + 1 == num\r\n # return true\r\n # end\r\n # end\r\n \r\n number.digits.reverse.all? {|num| num.index + 1 == num }\r\nend",
"def check_digit(input)\n input = letter_sub(input)\n input = to_int_array(input)\n input = multiply_by_2(input)\n input = sums_units_and_tens(input)\n input = sums_all_elements(input)\n input = substracts_from_next_ten(input)\n input\n end",
"def test_and_pass_1919fdjksl3_return_false\r\n\t\tassert_equal(false, all_numeric_digits?(\"1919fdjksl3\"))\r\n\tend",
"def only_numbers_in_my_array?(isbn_array)\n #join array to apply regex functionality\n nums_only = isbn_array.join(\"\")\n true if nums_only =~ /\\D/\nend",
"def no_repeat?(number)\n digits = number.to_s.chars\n seen = []\n digits.each do |digit|\n return false if seen.include?(digit)\n seen << digit\n end\n true\nend"
] | [
"0.7146804",
"0.7023496",
"0.7023496",
"0.7023496",
"0.7023496",
"0.7023496",
"0.70180815",
"0.7003432",
"0.69714344",
"0.69529855",
"0.6861188",
"0.6861188",
"0.6854448",
"0.68284076",
"0.6825373",
"0.6822835",
"0.68216735",
"0.6801563",
"0.68005943",
"0.677273",
"0.67655754",
"0.6734166",
"0.6732451",
"0.67173797",
"0.6655983",
"0.66538465",
"0.65970093",
"0.6578309",
"0.65595007",
"0.6512313",
"0.65082294",
"0.65041155",
"0.648792",
"0.64836466",
"0.6463186",
"0.6452806",
"0.6428225",
"0.6409376",
"0.6385805",
"0.6381989",
"0.63047767",
"0.62949425",
"0.6294619",
"0.6290913",
"0.62830776",
"0.6270859",
"0.6255865",
"0.6214868",
"0.6184466",
"0.6183079",
"0.61754996",
"0.6170646",
"0.6136909",
"0.61329126",
"0.6131537",
"0.61312234",
"0.61241287",
"0.6108413",
"0.60961866",
"0.6088692",
"0.6073693",
"0.60606575",
"0.6052935",
"0.60526145",
"0.6047196",
"0.60417306",
"0.60363543",
"0.60338825",
"0.60257477",
"0.6018326",
"0.6018326",
"0.6012176",
"0.60044557",
"0.60028976",
"0.59991384",
"0.599866",
"0.5997504",
"0.5997504",
"0.5996532",
"0.599501",
"0.59800446",
"0.5977976",
"0.5955299",
"0.5954726",
"0.5944559",
"0.59334874",
"0.59311396",
"0.5928415",
"0.59262806",
"0.5917883",
"0.590802",
"0.59066635",
"0.5897114",
"0.5893725",
"0.5882702",
"0.5868883",
"0.5859071",
"0.5832665",
"0.5820479",
"0.5814335"
] | 0.6549808 | 29 |
Reloads the current page. | def reload(opts = {})
options = {}
options[:ignoreCache] = true if opts[:skip_cache]
options[:scriptToEvaluateOnLoad] = opts[:onload] if opts[:onload]
@rpc.call 'Page.reload', options
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reloads\n load_page\n end",
"def reload\n Howitzer::Log.info \"Reload '#{current_url}'\"\n visit current_url\n end",
"def reload\n\t\tself.request( :reload )\n\tend",
"def refresh\n command(\"Page.reload\", wait: timeout, slowmoable: true)\n end",
"def refresh()\r\n #set_browser_document()\r\n $jssh_socket.send(\"#{BROWSER_VAR}.reload();\\n\", 0)\r\n read_socket();\r\n wait()\r\n end",
"def reload\n @view = nil\n end",
"def reload\n get\n end",
"def reload\n refresh\n end",
"def reload\n refresh\n end",
"def refresh\n @browser.refresh\n end",
"def reload\n selenium.get_eval(\"selenium.browserbot.getCurrentWindow().location.reload()\")\n end",
"def refresh\n render js: \"location.reload()\"\n end",
"def reload\n get_eval(\"selenium.browserbot.getCurrentWindow().location.reload()\")\n end",
"def reload\n end",
"def reload\n do_url 'reload', :put\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def reload\n end",
"def refresh\n store\n\n render\n\n self\n end",
"def reload\n end",
"def reload\n end",
"def restore( page )\n load page, take_snapshot: false\n end",
"def reload\n load_from_response(perform(:get))\n end",
"def reload\n load_from_response(perform(:get))\n end",
"def refresh\r\n @view.refresh\r\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def reload\n @reloaded = true\n restart\n end",
"def reload!\n @reloader.reload! if @reloader\n end",
"def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end",
"def reload\n restart\n end",
"def reload_case_detail_page(uuid)\n visit \"/queue/appeals/#{uuid}\"\n page.find(\"a\", text: \"refresh the page\").click if page.has_text?(COPY::CASE_DETAILS_LOADING_FAILURE_TITLE)\n end",
"def reload\n begin\n @driver.reload\n\n rescue Exception => e\n @@logger.an_event.error \"browser reload #{url}\"\n raise Errors::Error.new(BROWSER_NOT_RELOAD, :values => {:url => url}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser reload #{url}\"\n\n ensure\n\n end\n end",
"def refresh\n load if changed?\n end",
"def restart\n init_ivars\n @pages.clear\n @scheduler.restart\n end",
"def refresh\n driver.navigate.refresh\n end",
"def refresh\n driver.navigate.refresh\n end",
"def refresh\n driver.navigate.refresh\n end",
"def reload!\n end",
"def refresh\n url=$driver.current_url\n $driver.navigate.to 'http://www.google.com/'\n quiesce\n $driver.navigate.to url\n quiesce\n $driver.current_url.should == url\n end",
"def refresh\n @window.refresh\n end",
"def refresh!\n refresh\n @window.refresh\n end",
"def reload\n browser_files\n end",
"def reload\n self.class.find_by_url(href, token: token, headers: headers)\n end",
"def repage\n with_command \"+repage\"\n end",
"def reload\n self\n end",
"def refresh\n do_refresh\n end",
"def refresh\n do_refresh\n end",
"def refresh!\n load if changed?\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def refresh\n end",
"def restore\n authorize @page\n @version = @page.versions.find(params['version_id'])\n @page = @version.reify\n @page.reify_page_slots!\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_versions_path(@page), notice: 'Page version was successfully restored.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :versions }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def refresh\n Vedeu.trigger(\"_refresh_#{current}_\".to_sym)\n end",
"def page_revisions\n self.back_to_top\n page_revisions_button\n wait_for_ajax\n \n end",
"def refresh!\n unpack(agent.get(url))\n self\n end",
"def refresh\n send_cmd \"refresh\"\n nil\n end",
"def refresh\r\n end",
"def refresh\n do_refresh\n self\n end",
"def refresh\n end",
"def refresh\n end",
"def reload!\n load force: true\n end",
"def reload\n self.replace( CouchDB.get( uri ) )\n end",
"def reload!\n fetch_data!\n end",
"def reload\n @session_id = nil\n login\n end",
"def reload!; end",
"def reload!; end",
"def reload!; end",
"def reload!; end",
"def reload;end",
"def refresh!; end",
"def refresh\n Vedeu.trigger(:_refresh_, current)\n end",
"def reload\n read\n @previous = nil\n self\n end",
"def refresh\n # FIXME\n end",
"def refresh\n #==========================================================================\n # Here we set the Y-origin for the window's display to 0, so that the new\n # page will display from the top even if the player had scrolled all the\n # way to the bottom of the previous page. We also build the contents for\n # the current page, draw the page number display, and then draw whatever\n # the page is intended to contain. When creating a child window for this\n # class, make sure to create a draw_page# method for each page in the\n # window. I've set things up so that a page will remain blank (or display\n # its text from @pagetext, if it has any) if the method doesn't exist\n # rather than throwing an error and crashing, but that's no excuse to\n # leave a poor little page without a handler! Well, unless you're just\n # displaying text, but still. Try to be creative! You can create\n # encyclopedias with pictures, or magazines with articles set in various\n # column styles, or dozens of other things! Don't limit yourself to just\n # plain books - though those are good, too.\n #==========================================================================\n self.oy = 0\n create_contents and draw_scroll\n send(\"draw_page#{@page}\")\n return true\n end",
"def refresh()\n self.route(history.state.path, history.state.query)\n end",
"def reload\n self.replace( CouchSpring.get( uri ) )\n end",
"def flush_pages\n Rails.application.reload_routes!\n render :nothing => true\n end",
"def reload_flash\n page.replace \"flash_messages\", :partial => 'layouts/flasher'\n end",
"def page!\n save_and_open_page\n end",
"def page!\n save_and_open_page\n end",
"def refresh\n response = Clever.request :get, url\n refresh_from response[:data]\n self\n end",
"def closeCurrent\n @selPocket = 0\n @page = -1\n @back = false\n @ret = nil\n self.refresh\n end",
"def reload\n true\n end",
"def reload\n true\n end",
"def refresh; end",
"def reload\n return false unless visible?\n call('app.reset')\n true\n end",
"def restore\n authorize @page\n @version = @page.versions.find(params['version_id'])\n @page = @version.reify\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to page_versions_path(@page), notice: 'Page version was successfully restored.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :versions }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restart\n page.driver.browser.restart\n end",
"def update_page_on_show(page)\n if wants_refresh?\n page.update_frame_for(object)\n else\n page.push_frame_for(object)\n end\n end",
"def reload_flash\n page.replace \"flash_messages\", :partial => 'layouts/flash'\n end",
"def reload_if_needed\n load_breadcrumbs if reload?\n end",
"def reload\n if params[:imdb_id].present? && params[:imdb_id] != @video_content.imdb_id\n if @video_content.unique_imdb_id?(params[:imdb_id])\n @video_content.imdb_id = params[:imdb_id]\n # If the imdb id changes any existing poster are invalid\n @video_content.video_posters.clear\n else\n @video_content = @video_content.merge_with_imdb_id(params[:imdb_id])\n end \n end \n \n @video_content.state = 'pending'\n @video_content.save!\n \n MiddleMan.worker(:scrap_imdb_worker).async_scrap_for_video_content(:arg => @video_content.id)\n \n flash[:notice] = \"#{@video_content.name} refreshing from IMDB. Please wait a little while and then refresh the page\"\n redirect_to(@video_content) \n rescue\n flash[:error] = \"Error refreshing video: #{$!}\"\n redirect_to(@video_content)\n end",
"def reload\n stop\n start\n end"
] | [
"0.85944563",
"0.77237356",
"0.6736358",
"0.6511745",
"0.6510518",
"0.650939",
"0.6459356",
"0.6456156",
"0.6456156",
"0.6436067",
"0.6384718",
"0.63736385",
"0.6370422",
"0.6206377",
"0.6179553",
"0.61768574",
"0.61768574",
"0.61768574",
"0.61768574",
"0.61768574",
"0.61768574",
"0.61768574",
"0.61738014",
"0.6157288",
"0.6157288",
"0.60868806",
"0.60847086",
"0.60847086",
"0.6078049",
"0.6074944",
"0.6074944",
"0.6072516",
"0.6014997",
"0.60088706",
"0.5997464",
"0.59827024",
"0.5971487",
"0.5955657",
"0.5942492",
"0.5932139",
"0.5932139",
"0.5932139",
"0.5923119",
"0.5921326",
"0.5916609",
"0.5906738",
"0.5901241",
"0.588778",
"0.58679336",
"0.5863224",
"0.58399755",
"0.58399755",
"0.5812092",
"0.58112675",
"0.58112675",
"0.58112675",
"0.58112675",
"0.5806496",
"0.57898116",
"0.5786962",
"0.57777625",
"0.577309",
"0.57720464",
"0.5760361",
"0.5755225",
"0.5755092",
"0.5755092",
"0.57503366",
"0.57062733",
"0.5687593",
"0.5672758",
"0.566995",
"0.566995",
"0.566995",
"0.566995",
"0.56652874",
"0.56637055",
"0.5638096",
"0.56348026",
"0.5622307",
"0.5611818",
"0.5611659",
"0.5594948",
"0.55843186",
"0.5576664",
"0.55757153",
"0.55757153",
"0.5567573",
"0.55641884",
"0.5551183",
"0.5551183",
"0.5546485",
"0.55461025",
"0.5527361",
"0.5522286",
"0.55087847",
"0.55085254",
"0.54777724",
"0.5477657",
"0.5476775"
] | 0.6024481 | 32 |
Enables or disables the generation of events in the Page domain. | def page_events=(new_page_events)
new_page_events = !!new_page_events
if new_page_events != page_events
@rpc.call(new_page_events ? 'Page.enable' : 'Page.disable')
@page_events = new_page_events
end
new_page_events
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable\n {\n method: \"Page.enable\"\n }\n end",
"def set_lifecycle_events_enabled(enabled:)\n {\n method: \"Page.setLifecycleEventsEnabled\",\n params: { enabled: enabled }.compact\n }\n end",
"def disable\n {\n method: \"Page.disable\"\n }\n end",
"def is_site_pages_creation_enabled=(value)\n @is_site_pages_creation_enabled = value\n end",
"def disable_section\n layout_id = params[:layout_id]\n layout = PageLayout.find(layout_id)\n se = PageEvent::SectionEvent.new(\"disable_section\", layout )\n se.notify\n \n end",
"def enable\n end",
"def enable\n end",
"def enable\n @enabled = true\n end",
"def enable\n {\n method: \"DOM.enable\"\n }\n end",
"def set_pages_flag\n @pages_flag = true\n end",
"def set_event_values\n self.domain ||= self.class.event_domain\n end",
"def enable!\n self.enabled = true\n end",
"def create_before\n return unless Spree::Config[:cms_page_status_default]\n @page.is_active = Spree::Config[:cms_page_status_default]\n end",
"def conditionally_disable_page\n if page.present? && respond_to?(:live) && !live?\n page.update(live: false)\n end\n end",
"def after_save\r\n self.blockable.touch if self.blockable_type == 'Page'\r\n end",
"def send_events; end",
"def enable!; end",
"def test_pages\n oldpage = @current_page\n @current_page = nil\n for i in 0...pages.size\n if test_page_conditions(i)\n @current_page = i\n if oldpage != @current_page\n # Run only if the page actually changed\n @direction = current_page.graphic[:direction] || 2\n # Delete any interpreters there may be left trying to run the old page\n if oldpage\n if oldpage.has_trigger?(:parallel_process)\n $game.map.parallel_interpreters.delete_if { |i| i.event == self }\n else\n $game.map.event_interpreters.delete_if { |i| i.event == self }\n end\n end\n # Execute event if new page is Parallel Process or Autorun\n if current_page.has_trigger?(:parallel_process) || current_page.has_trigger?(:autorun)\n trigger\n end\n if current_page.automoveroute[:commands].size > 0\n # Wait 1 frame to start the new autonomous move route so the visuals have time to adjust to the new page.\n @automove_wait = 1\n end\n end\n break\n end\n end\n end",
"def is_commenting_on_site_pages_enabled=(value)\n @is_commenting_on_site_pages_enabled = value\n end",
"def set_enabled\n\t\t\tself.enabled = true\n\t\tend",
"def download_events?\n event_planner? || super_admin?\n end",
"def enable\n @service.disabled = false\n end",
"def enable\n exclusively do\n @enabled = true\n @manual_toggle = true\n end\n\n save_state\n\n sync_control do\n start_upkeep unless upkeep_running?\n end\n end",
"def disable\n @disabled = true\n end",
"def create_events\n end",
"def enable\n\t\t\t@last_request = nil\n\t\t\tBase.instance.add_observer(self)\n\t\tend",
"def enabled!\n self\n end",
"def enabled!\n self\n end",
"def disable_section\n layout_id = params[:layout_id]\n layout = PageLayout.find(layout_id)\n se = PageEvent::SectionEvent.new(\"disable_section\", layout )\n se.notify\n end",
"def disable_section\n layout_id = params[:layout_id]\n layout = PageLayout.find(layout_id)\n se = PageEvent::SectionEvent.new(\"disable_section\", layout )\n se.notify\n end",
"def event_change\n\t\n\tend",
"def activate\n Page.send :include, FrenchDatesTags\n end",
"def is_site_creation_enabled=(value)\n @is_site_creation_enabled = value\n end",
"def activate\n admin.page.edit.add('extended_metadata', 'edit_dates')\n end",
"def enabled; end",
"def enabled; end",
"def enabled; end",
"def enabled; end",
"def enable\n @blog.enabled = !@blog.enabled\n @blog.save\n redirect_to_blogs\n end",
"def activate\n Page.send :include, IfIdTags\n end",
"def before_save(record)\n expire_page(:controller => \"/schedule\", :action => 'index')\n expire_page(:controller => \"/schedule\", :action => 'list')\n \n for year in Event.find_all_years\n expire_page(:controller => \"/schedule\", :action => 'index', :year => year)\n expire_page(:controller => \"/schedule\", :action => 'list', :year => year)\n end\n end",
"def gt_enable!\n unless self.gt_enabled?\n self.gt_enabled = true\n\n self.cohorts << Settings::User.current_cohort unless self.cohorts.include? Settings::User.current_cohort\n GT::UserManager.ensure_users_special_rolls(self, true)\n\n self.save(:validate => false)\n\n public_roll = self.public_roll\n if (self.user_type == User::USER_TYPE[:real] || self.user_type == User::USER_TYPE[:converted])\n public_roll.roll_type = Roll::TYPES[:special_public_real_user]\n end\n public_roll.save(:validate => false)\n end\n end",
"def enable\n\n @enabled = true\n\n return self\n\n end",
"def has_any_event\n include InstanceMethods unless @published_events\n @published_events = :any_event_is_ok\n end",
"def evented\n @evented = true\n end",
"def become_public\n page.touch(:published_at)\n activate!\n end",
"def onProviderEnabled(eventData)\n end",
"def disable!\n @disabled = true\n end",
"def enabled_state\n super\n end",
"def enabled_state\n super\n end",
"def enabled_state\n super\n end",
"def enabled_state\n super\n end",
"def enabled_state\n super\n end",
"def enabled_state\n super\n end",
"def action_enable\n end",
"def activate\n Page.send :include, ExtraRadiantTags\n Admin::PagesController.send :include, InterfaceAdditions\n \n # admin.page.edit.add :form, \"/admin/page/hide_page\", :before => \"edit_extended_metadata\"\n # admin.tabs.remove \"Assets\"\n # admin.tabs.add \"Bilder\", \"/admin/assets\", :after => \"Snippets\", :visibility => [:all]\n # admin.tabs.remove \"Pages\"\n # admin.tabs.add \"Seiten\", \"/admin/pages\", :before => \"Snippets\", :visibility => [:all]\n end",
"def disabled; end",
"def enable_tracking\n @DoNotTrack = false\n #Enable do not track for admin and any future employees. Har har. Employees. Yah right.\n if user_signed_in? && current_user.is_admin?\n @DoNotTrack = true\n end\n true\n end",
"def span_events_enabled?\n NewRelic::Agent.config[:'span_events.enabled']\n end",
"def sign_up_for_event(event)\n self.events << event unless self.events.include?(event)\n end",
"def permitted_events\n events = self.states_events_config.map { |se| se[:event] }\n events.delete_if { |e| !event_permitted(e) }\n end",
"def events\r\n load_private_events\r\n load_completed_private_events\r\n end",
"def enable\n {\n method: \"DOMStorage.enable\"\n }\n end",
"def set_Enable(value)\n set_input(\"Enable\", value)\n end",
"def show_pages\n false\n end",
"def events=(events)\n events = Array(events).map { |event| event.to_s.underscore }\n # TODO: Validate events from specified list in Integral.config which can be used to\n # list them on the backend for click and create\n # super(Webhook::Event::EVENT_TYPES & events)\n super(events)\n end",
"def disabled?\n self.time_event <= Time.now\n end",
"def activate\n Page.send :include, PageOptions::PageExtensions\n admin.page.index.add :top, \"caching_header\"\n admin.page.index.add :sitemap_head, 'caching_th', :before => 'status_column_header'\n admin.page.index.add :node, 'caching_td', :before => 'status_column'\n admin.page.edit.add :extended_metadata, 'caching_meta'\n end",
"def is_site_pages_creation_enabled\n return @is_site_pages_creation_enabled\n end",
"def enable_group(group)\n @event_groups[group] = true\n end",
"def disable\n @enabled = false\n end",
"def disable\n end",
"def events=(flags)\n self[:events] = flags\n end",
"def events\n end",
"def set_event\n @event = Event.find(params[:id])\n skip_authorization\n end",
"def events=(value)\n @events = value\n end",
"def enable_for_public\n # TODO Create and write all the checks necessary for the listing to become active and public\n self.update_attribute(:active, true)\n end",
"def enable=(value); self.is_enable = value end",
"def enable_subject\n enable_disable_subject('Enabled')\n end",
"def write_events(events)\n @events += @before_write.call(events)\n end",
"def disable\n {\n method: \"DOM.disable\"\n }\n end",
"def touch_pages\n pages.update_all updated_at: Time.now\n end",
"def enable!\n @mutex.synchronize do\n @advised.each { | x | x.enable! }\n end\n self\n end",
"def may_edit_pages(user)\n true\n end",
"def disable!\n @enabled = false\n end",
"def web_spidering=(enable)\n gen = REXML::XPath.first(@xml, 'ScanTemplate/General')\n gen.attributes['disableWebSpider'] = enable ? '0' : '1'\n end",
"def enable_dates\n @expression = load_expression_instance_from_session\n @expression.expression_start = Time.now\n @expression.expression_finish = Time.now\n save_expression_instance_in_session\n end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def events; end",
"def enable_domgen(repository_key, load_task_name, generate_task_name)\n define_table_order_resolver do |module_key|\n require 'domgen'\n data_module = Domgen.repository_by_name(repository_key).data_module_by_name(module_key.to_s)\n data_module.entities.select { |entity| !entity.abstract? }.collect do |entity|\n entity.sql.qualified_table_name\n end\n end\n\n self.modules = Proc.new do\n require 'domgen'\n Domgen.repository_by_name(repository_key).data_modules.collect{|data_module| data_module.name}\n end\n\n task \"#{task_prefix}:load_config\" => load_task_name\n task \"#{task_prefix}:pre_build\" => generate_task_name\n end",
"def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n expire_page :controller => :website, :action => :index\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 enable!\n swap_in_delegator\n end",
"def enabled\n\t\ttrue\n\tend",
"def enabled_release_stages\n @notify_release_stages\n end"
] | [
"0.67002696",
"0.6632279",
"0.5825981",
"0.5763034",
"0.55463254",
"0.5482061",
"0.545053",
"0.5421582",
"0.5420663",
"0.53439677",
"0.5221659",
"0.52019787",
"0.5195125",
"0.5152388",
"0.5122626",
"0.51105136",
"0.5058344",
"0.5049732",
"0.5035277",
"0.50184125",
"0.4998353",
"0.4997377",
"0.49619076",
"0.49342802",
"0.4934118",
"0.4932466",
"0.49237895",
"0.4916017",
"0.48863322",
"0.48863322",
"0.48746976",
"0.487147",
"0.48662904",
"0.48648307",
"0.4846532",
"0.4846532",
"0.4846532",
"0.4846532",
"0.48454255",
"0.48449165",
"0.48410475",
"0.48366237",
"0.48251185",
"0.48241523",
"0.4819199",
"0.48071685",
"0.47931054",
"0.47878814",
"0.47839314",
"0.47839314",
"0.47839314",
"0.47839314",
"0.47839314",
"0.47839314",
"0.47726214",
"0.47655338",
"0.47610426",
"0.4755123",
"0.47372514",
"0.47353274",
"0.47264472",
"0.47108436",
"0.47087082",
"0.47006366",
"0.46993682",
"0.46993464",
"0.46952534",
"0.46949026",
"0.4685827",
"0.4683481",
"0.46830976",
"0.46674198",
"0.4663942",
"0.46539456",
"0.46462628",
"0.46377537",
"0.46334842",
"0.46257928",
"0.46139488",
"0.46097347",
"0.46075684",
"0.45902714",
"0.45867255",
"0.45792356",
"0.4578343",
"0.45762116",
"0.4576153",
"0.45729914",
"0.45729914",
"0.45729914",
"0.45729914",
"0.45729914",
"0.45729914",
"0.45729914",
"0.45729914",
"0.4570317",
"0.45662296",
"0.45576727",
"0.45319676",
"0.45170593"
] | 0.7110019 | 0 |
Returns string containing respondent's first and last name | def respondent_full_name
[respondent_first_name, respondent_last_name].compact.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def full_name\n [@first_name, @last_name].join(' ')\n end",
"def full_name\n return first_name + \" \" + last_name\n end",
"def full_name\n return first_name + \" \" + last_name\n end",
"def name\n if first_name && last_name\n return \"#{first_name} #{last_name}\"\n else\n return email\n end\n end",
"def full_name\n\t\treturn self.salutation.to_s + \" \" + self.last_name.to_s + \" \" + self.first_name.to_s\n end",
"def fullname\n [firstname, middlename, lastname].compact.join(\" \")\n end",
"def full_name\n [first_name, last_name].join(\" \")\n end",
"def full_name\n [first_name, last_name].join(\" \")\n end",
"def full_name\n [first_name, last_name].join(\" \")\n end",
"def full_name\n [first_name, last_name].join(\" \")\n end",
"def full_name\n [first_name, last_name].join(\" \")\n end",
"def full_name\n [first_name, last_name].join(\" \")\n end",
"def full_name()\n name + ' ' + last_name\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def full_name\n [first_name, last_name].join(' ')\n end",
"def whole_name\n [given_name, family_name].compact.join(' ')\n end",
"def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end",
"def full_name\n @first_name + ' ' + @last_name\n end",
"def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end",
"def full_name \n [first_name, last_name].join(' ')\n end",
"def full_name\n \t[self.first_name, self.last_name].join(\" \")\n end",
"def fullname\n return first_name + \" \" + last_name\n end",
"def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end",
"def fullName\n return first_name + \" \" + last_name\n end",
"def full_name\n return \"#{@first_name} #{@last_name}\"\n end",
"def full_name\n return \"#{@first_name} #{@last_name}\"\n end",
"def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end",
"def full_name\n [first_name, last_name].join(' ').strip\n end",
"def full_name\n \n if (not self.first_name.nil? and not self.first_name.eql? \"\") or (not self.last_name.nil? and not self.last_name.eql? \"\")\n \"#{self.title} #{self.first_name} #{self.last_name}\".strip\n elsif self.username\n self.username \n else\n # wrapped email only prefix\n\n parsed_email = self.email.split('@')\n parsed_email[0]\n end\n end",
"def fullname\n [firstname,middlename,lastname].join(' ')\n end",
"def fullname\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n [self.first_name, self.last_name].compact.join(\" \").strip\n end",
"def name\n name_str = \"#{first_name} #{last_name}\".strip\n if name_str.length < 1\n name_str = email\n end\n if name_str.length < 1\n name_str = \"Person utan namn (id #{id})\"\n end\n name_str\n end",
"def full_name\n first_name + \" \" + last_name\n end",
"def proper_name #returns lastname, firstname\n \treturn self.last_name + ', ' + self.first\n end",
"def name\n [first_name, last_name].compact.join(' ')\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def get_full_name\n [first_name, last_name].select(&:present?).join(' ')\n end",
"def full_name\n [self.first_name, self.last_name].join(' ')\n end",
"def full_name\n \"#{first_name}\" \" #{last_name}\"\n end",
"def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end",
"def full_name\n if (first_name && last_name) && (!first_name.blank? && !last_name.blank?)\n \" #{first_name} #{last_name}\"\n else\n \" #{nickname}\"\n end\n end",
"def full_name\n \"#{firstname} #{lastname}\".strip\n end",
"def last_name_first_name\n \"#{last_name}, #{first_name}\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def name\n [first_name, last_name].join(' ').strip\n end",
"def full_name(person)\n name = person[\"first_name\"] + \" \" + person[\"last_name\"]\n return name\nend",
"def name\n [first_name, last_name].join(' ')\n end",
"def name\n [first_name, last_name].join(' ')\n end",
"def name\n [first_name, last_name].join(' ')\n end",
"def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end",
"def display_name\n return \"#{first_name} #{last_name}\".strip if first_name\n return email\n end",
"def full_name\n [first_name.to_s, last_name.to_s.upcase].join(' ')\n end",
"def full_name\r\n last_name.blank? ? \"#{first_name} #{mi}\" : \"#{last_name}, #{first_name} #{mi}\"\r\n end",
"def full_name\n\t\tfirst_name + \" \" + last_name\n\tend",
"def full_name\n \"#{@first} #{@last}\"\n end",
"def first_name_last_name\n \"#{first_name} #{last_name}\"\n end",
"def name\n\t\treturn first_name + \" \" + last_name\n\tend",
"def full_name\n \"#{name} #{first_last_name} #{second_last_name}\"\n end",
"def full_name\n \"#{last_name} #{first_name}\"\n end",
"def full_name\n \"#{first_name} #{family_name}\"\n end",
"def fullname\n return @first_name.capitalize + \" \" + @surname.capitalize\n end",
"def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end",
"def full_name\n if first_name.blank?\n last_name\n else\n [last_name, first_name].compact.join(', ')\n end\n end",
"def full_name\n if self.first_name && self.last_name \n self.first_name + \" \" + self.last_name \n else\n \"unknown\"\n end\n end",
"def full_name\n if self.first_name.present? and self.last_name.present?\n \"#{self.first_name} #{self.last_name}\"\n else\n self.first_name\n end\n end",
"def full_name\n \"#{ first_name } #{ last_name }\"\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n #returns the first and last name of an actor.\n \"#{self.first_name} #{self.last_name}\"\n end",
"def get_full_name\n return self.first_name + \" \" + self.last_name\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n return self.first_name + \" \" + self.last_name\n end",
"def full_name\n return self.first_name + \" \" + self.last_name\n end",
"def full_name\n (first_name + ' ' + last_name).titleize\n end",
"def full_name\n \t\"#{first_name} #{last_name}\"\n end",
"def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end",
"def name\n [first_name, last_name].compact.join(\" \").presence || email\n end",
"def name_lastfirst\n\t\treturn [ self.sn, self.givenName ].compact.join( ', ' )\n\tend",
"def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end",
"def fullName()\n return first + \" \" + middle + \" \" + last\n end",
"def full_name\n \"#{first_name.titleize} #{last_name.titleize}\"\n end",
"def fullname\n return @first_name + ' ' + @surname\n end",
"def full_name\n\t\tfirst_name + ' ' + last_name\n\tend",
"def full_name\n\t\tfirst_name + ' ' + last_name\n\tend",
"def full_name\n if last_name != nil\n first_name + \" \" + last_name\n else\n first_name\n end\n end",
"def name_display\n if first_name || last_name\n \"#{first_name} #{last_name}\".strip\n else\n email\n end\n end",
"def full_name\n \"#{@first_name} #{@last_name}\"\n end",
"def full_name\n [first_name, last_name].select(&:'present?').join(' ')\n end",
"def name\n \"#{first_name[0]}. #{last_name}\"\n end",
"def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end",
"def full_name\n \"#{first_name} #{last_name}\"\n end",
"def full_name\n \tfirst_name + \" \" + last_name\n end",
"def first_and_last_name\n \"#{first_name} #{last_name}\"\n end"
] | [
"0.7651924",
"0.7569874",
"0.7541533",
"0.75231886",
"0.75231886",
"0.7517006",
"0.7505338",
"0.74688125",
"0.74542254",
"0.74542254",
"0.74542254",
"0.74542254",
"0.74542254",
"0.74542254",
"0.7438604",
"0.74363995",
"0.74363995",
"0.74363995",
"0.74363995",
"0.74363995",
"0.7422431",
"0.74120647",
"0.7403855",
"0.7401664",
"0.7392273",
"0.73802376",
"0.7377513",
"0.73727137",
"0.7372151",
"0.736977",
"0.736977",
"0.73685414",
"0.7363871",
"0.735139",
"0.735032",
"0.7346345",
"0.73437506",
"0.7339924",
"0.7338586",
"0.7331398",
"0.7320756",
"0.7318511",
"0.7318511",
"0.7318511",
"0.731739",
"0.7306868",
"0.72996944",
"0.72982794",
"0.72934484",
"0.728736",
"0.7275327",
"0.7273813",
"0.7264623",
"0.7256706",
"0.7254304",
"0.7254304",
"0.7254304",
"0.7245723",
"0.72441953",
"0.7243144",
"0.7238959",
"0.7238777",
"0.72375786",
"0.7235265",
"0.7235069",
"0.72318006",
"0.7224334",
"0.72224486",
"0.7222382",
"0.7216601",
"0.72127455",
"0.7212609",
"0.7211136",
"0.720816",
"0.72070086",
"0.7206899",
"0.7204615",
"0.7204506",
"0.72023916",
"0.72023916",
"0.72016037",
"0.72011167",
"0.7198739",
"0.719812",
"0.7191513",
"0.7187875",
"0.71871865",
"0.71811754",
"0.7179204",
"0.71769965",
"0.71769965",
"0.7175118",
"0.71700513",
"0.7169516",
"0.71688795",
"0.71668226",
"0.71668005",
"0.71649534",
"0.7148606",
"0.71476626"
] | 0.8590738 | 0 |
custom validation for custom message without standard attribute prefix | def presence_of_subject_relationship_other
if subject_relationship_other.blank?
errors.add(:subject_relationship_other, ActiveRecord::Error.new(
self, :base, :blank, {
:message => "You must specify a relationship with 'other relationship' is selected." } ) )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_valid_message; nil; end",
"def not_valid_message; nil; end",
"def test_generate_message_exclusion_with_default_message\n assert_equal \"is reserved\", @person.errors.generate_message(:title, :exclusion, value: \"title\")\n end",
"def full_message(attribute, message)\n return message if attribute == :base\n attr_name = attribute.to_s.tr('.', '_').humanize\n #attr_name = @base.class.human_attribute_name(attribute, default: attr_name)\n I18n.t(:\"errors.format\", {\n default: \"%{attribute} %{message}\",\n attribute: attr_name,\n message: message\n })\n end",
"def attribute_to_check_message_against; end",
"def message\n @props.fetch(:message, \"must be valid\")\n end",
"def custom_error_message\n message = component.dig('errors', schema_key, 'any')\n\n message % error_message_hash if message.present?\n end",
"def error_message_from_model(model, attribute, message, extra = {})\n ::ActiveModel::Errors.new(model).generate_message(attribute, message, extra)\n end",
"def test_generate_message_invalid_with_default_message\n assert_equal \"is invalid\", @person.errors.generate_message(:title, :invalid, value: \"title\")\n end",
"def validates_type_error_message(m, klass)\n # SEQUEL6: Make this the default behavior in validation_helpers\n if OVERRIDE_PROC.equal?(m)\n TYPE_ERROR_STRINGS[klass]\n else\n super\n end\n end",
"def test_generate_message_inclusion_with_default_message\n assert_equal \"is not included in the list\", @person.errors.generate_message(:title, :inclusion, value: \"title\")\n end",
"def validations\n [:line_style_names] + super\n end",
"def test_generate_message_accepted_with_default_message\n assert_equal \"must be accepted\", @person.errors.generate_message(:title, :accepted)\n end",
"def negative_failure_message\n \"validation succeeded, expected one or more validation errors\"\n end",
"def literal_validation; end",
"def literal_validation; end",
"def error_message(flag, value, valid)\n classes = valid.compact.map do\n s = _1.to_s\n s = s.downcase if s =~ /\\b(Array|Float|Hash|Integer|String|Symbol)\\b/\n s\n end.join('/')\n \"expected :#{flag} to be #{classes}, not #{value.inspect}\"\n end",
"def not_spam\n errors.add(:base, \"invalid reply\") if check_field.present?\n end",
"def test_generate_message_not_a_number_with_default_message\n assert_equal \"is not a number\", @person.errors.generate_message(:title, :not_a_number, value: \"title\")\n end",
"def standard_validation_error options= {message: {}}\n options[:error]||= \"Unprocessable entity\"\n status = options.delete(:status)\n error!(options, status || options[:error].parameterize.underscore.to_sym || 422)\n end",
"def message\n @options[:message] || \"failed validation\"\n end",
"def format_error_message( msg, count = nil, singular = nil, *rest )\n return super unless msg.is_a?( Symbol ) and r18n\n if limit = count and singular\n limit = t.form_input.units[ singular, count ].to_s\n end\n text = t.form_input.errors[ msg, *limit, self ].to_s\n super( text )\n end",
"def add(attribute, msg = @@default_error_messages[:invalid])\n @errors[attribute.to_s] = [] if @errors[attribute.to_s].nil?\n @errors[attribute.to_s] << msg\n end",
"def test_validates_length_of_within_finds_custom_model_key_translation\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:wrong_length => 'custom message'}}}}}\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:wrong_length => 'global message'}}\n \n Topic.validates_length_of :title, :is => 5\n @topic.valid?\n assert_equal 'custom message', @topic.errors.on(:title)\n end",
"def validate_exclusion_of(attr); end",
"def full_message(attribute, message)\n return message if attribute == :base\n\n if message =~ /\\A\\^/\n I18n.t(:\"errors.format.full_message\", {\n default: \"%{message}\",\n message: message[1..-1]\n })\n else\n original_full_message(attribute, message)\n end\n end",
"def message_is_upcase\n errors.add(:message,'must be uppercase!') unless message == message.upcase\n end",
"def test_generate_message_blank_with_default_message\n assert_equal \"can’t be blank\", @person.errors.generate_message(:title, :blank)\n end",
"def test_validates_numericality_of_odd_finds_custom_model_key_translation\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:odd => 'custom message'}}}}}\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:odd => 'global message'}}\n \n Topic.validates_numericality_of :title, :only_integer => true, :odd => true\n @topic.title = 0\n @topic.valid?\n assert_equal 'custom message', @topic.errors.on(:title)\n end",
"def add(attribute, msg)\n @errors[attribute.to_s] = [] if @errors[attribute.to_s].nil?\n @errors[attribute.to_s] << msg\n end",
"def validate_each(record, attribute, value)\n # Already validated by the presence validator.\n return if value.nil?\n return if value =~ NAME_REGEXP\n\n record.errors[attribute] << \"can only contain lower case alphanumeric \"\\\n \"characters, with optional underscores and dashes in the middle.\"\n end",
"def test_validates_numericality_of_finds_custom_model_key_translation\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:not_a_number => 'custom message'}}}}}\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:not_a_number => 'global message'}}\n \n Topic.validates_numericality_of :title\n @topic.title = 'a'\n @topic.valid?\n assert_equal 'custom message', @topic.errors.on(:title)\n end",
"def validate_format(attribute_name, format, message = nil)\n value = attributes[attribute_name]\n if value && !(format =~ value)\n append_error(attribute_name, message || :is_invalid)\n end\n end",
"def invalid_message\r\n @invalid_message ||= 'Please enter Yes or No.'\r\n end",
"def validate(value)\n if required? && (value == nil || value == \"\") && (default == nil || default == \"\")\n return \"#{name} is a required attribute\"\n end\n # TODO: add type validation here\n nil\n end",
"def test_validates_length_of_within_finds_custom_model_key_translation\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:too_short => 'custom message'}}}}}\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:too_short => 'global message'}}\n \n Topic.validates_length_of :title, :within => 3..5\n @topic.valid?\n assert_equal 'custom message', @topic.errors.on(:title)\n end",
"def test_generate_message_too_short_with_default_message_plural\n assert_equal \"is too short (minimum is 10 characters)\", @person.errors.generate_message(:title, :too_short, count: 10)\n end",
"def validator_description\n\t\t\treturn \"a value matching the pattern %p\" % [ self.pattern ]\n\t\tend",
"def test_generate_message_greater_than_with_default_message\n assert_equal \"must be greater than 10\", @person.errors.generate_message(:title, :greater_than, value: \"title\", count: 10)\n end",
"def validation\n # Rails.logger.debug \"#{self.class}.#{__method__} Default validator is empty\"\n end",
"def test_validates_numericality_of_less_than_finds_custom_model_key_translation\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:less_than => 'custom message'}}}}}\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:less_than => 'global message'}}\n \n Topic.validates_numericality_of :title, :only_integer => true, :less_than => 0\n @topic.title = 1\n @topic.valid?\n assert_equal 'custom message', @topic.errors.on(:title)\n end",
"def format_model_validation_errors(resource)\n resource.errors&.messages&.each_with_object([]) do |(attribute, errors), messages|\n next unless VALIDATION.key?(attribute) || attribute == :base\n\n # NOTE: If the value is a date, the typecast value may not correspond to original user input, so get value_before_type_cast\n unless attribute == :base\n value = VALIDATION.dig(attribute, :checks)&.include?(:date) ? resource.public_send(\"#{attribute}_before_type_cast\") : resource[attribute]\n msg_header = (value ? \"Value '#{value}' for \" : '') + \"'#{VALIDATION[attribute][:label]}'\"\n end\n errors.each do |error_message|\n # Exclude the actual value in logging to avoid PII/PHI\n Rails.logger.info \"Validation Error on: #{attribute}\"\n messages << \"#{msg_header} #{error_message}\".strip\n end\n end\n end",
"def validate_email_format(attribute_name, message = nil)\n validate_format(attribute_name, EMAIL_FORMAT, message)\n end",
"def validation_tag(model, attribute, options = {})\n return if model.blank? or model.errors.blank? \n unless model.errors[attribute].blank?\n # generate error markup\n return content_tag :span, [model.errors[attribute]].flatten.join(options[:separator] || \", \").to_s, :class => \"error-message\"\n end\n end",
"def validator_description\n\t\t\treturn \"a '%s'\" % [ self.pattern_name ]\n\t\tend",
"def test_generate_message_confirmation_with_default_message\n assert_equal \"doesn’t match Title\", @person.errors.generate_message(:title, :confirmation)\n end",
"def register_message_validator(validator)\n\t\tend",
"def failure_message\n \"validation failed with #{@errors.inspect}, expected no validation errors\"\n end",
"def validation_tag(model, attribute, options = {})\n return if model.blank? or model.errors.blank? \n unless model.errors[attribute].blank?\n # generate error markup\n content_tag :span, :class => \"error-message\" do\n [model.errors[attribute]].flatten.join(options[:separator] || \", \").to_s\n end\n end\n end",
"def test_generate_message_empty_with_default_message\n assert_equal \"can’t be empty\", @person.errors.generate_message(:title, :empty)\n end",
"def meaningful_error_message callback, model, attributes\n rv = \"Unable to #{callback} a #{model.name}\"\n if attributes and !attributes.empty?\n rv << \" with #{attributes.inspect}\"\n end\n end",
"def validation_class\n if self.required?\n 'required' \n else\n ''\n end\n end",
"def valid?(message)\n true\n end",
"def subclass_validations ; true ; end",
"def test_generate_message_wrong_length_with_default_message_plural\n assert_equal \"is the wrong length (should be 10 characters)\", @person.errors.generate_message(:title, :wrong_length, count: 10)\n end",
"def empty_name_error(type, what)\n validation_error(type, what, 'name is empty')\n end",
"def invalid_quantity_message_label()\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.span.className(create_ats_regex_string(\"ats-badqty\")), format_method(__method__))\n end",
"def adjust_errors(form_errors)\n form_errors.each do |e|\n case e[:failed_attribute]\n when 'Required'\n e[:message].gsub!(\"The property '#/'\", 'The request')\n end\n e[:message].gsub!(\"The property '#/\", \"The property '\")\n e[:message] = e[:message][/.+?(?= in schema)/]\n end\n end",
"def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end",
"def validate_display_name\nif ! validate_a_display_name( self.display_name )\nerrors.add( :display_name , \"Invalid display name (see RFC 3261).\" )\nend\nend",
"def extra_validations\n success\n end",
"def vdate_pin(attr)\nvalidates_presence_of attr , :message => \"^Please Fill #{attr}\"\nvalidates_format_of attr , :with => /^\\d{6}$/ ,\n :message => \"^invalid #{attr}, #{attr} is 6 digit number\"\nend",
"def validate_presence(attribute_name, message = nil)\n value = send(attribute_name)\n if !value || value.to_s.empty?\n append_error(attribute_name, message || :cant_be_empty)\n end\n end",
"def error_message_for(attribute)\n case attribute\n when :email, :password, :password_confirmation\n @admin_registration.errors[attribute].join(', ')\n else\n raise \"Error messages not implmeneted for \\\"#{attribute}\\\"\"\n end\n end",
"def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end",
"def failure_message_when_negated\n # Failure cases:\n # * object is not a model (\"to respond to valid\")\n # * expected one or more errors, received one or more (\"not to have\n # errors\")\n # * expected one or more messages on attribute, received one or more\n # (\"not to have errors on\")\n # * expected specific messages on attribute, received all (\"not to have\n # errors on\")\n\n if !@validates\n \"expected #{@actual.inspect} to respond to :valid?\"\n elsif expected_errors.empty?\n return \"expected #{@actual.inspect} not to have errors#{received_errors_message}\"\n else\n return \"expected #{@actual.inspect} not to have errors#{expected_errors_message}#{received_errors_message}\"\n end # if-else\n end",
"def add_validation_errors(value); end",
"def validate_each(record, attribute, value)\n unless value.blank?\n unless value =~ VALID_MASK\n if value =~ /\\A[^a-z]/i\n record.errors[attribute] << (options[:message] || 'must start with a letter')\n elsif value =~ /_\\z/\n record.errors[attribute] << (options[:message] || 'must not end with an underscore')\n else\n record.errors[attribute] << (options[:message] || 'must contain only letters, numbers, and underscore')\n end\n end\n end\n end",
"def error_message(attribute)\n unless @object.errors.on(attribute).blank?\n content_tag(:p, :class => 'notice') do\n concat ERB::Util.html_escape(@object.errors.on(attribute).mb_chars.capitalize)\n end\n else\n ''\n end\n end",
"def badge_name_is_valid\n if badge_name.present?\n unless self.badge.kind_of?(Badge)\n badge_names = self.authoritative_company.company_badges.map(&:short_name).to_sentence(two_words_connector: ' or ', last_word_connector: ' or ')\n errors.add(:badge, I18n.t('activerecord.errors.models.recognition.attributes.badge_id.invalid_name', badge_names: badge_names))\n end\n end\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 validation_regex\n /\\s*validates(?:\\s+|_\\w+\\s+)(?:\\S|\\s)+/\n end",
"def required_attribute(name, options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' requires a '#{name}' attribute\", options) do\n\t\t\t\t\t!raw_attribute(name.to_sym).blank?\n\t\t\t\tend\n\t\t\tend",
"def required_label_text; end",
"def full_message(attribute, message)\n return message if attribute == :base\n attr_name = attribute.to_s.gsub('.', '_').humanize\n attr_name = @base.class.human_attribute_name(attribute, :default => attr_name)\n I18n.t(:\"hints.format\", \n :default => \"%{attribute} %{message}\",\n :attribute => attr_name,\n :message => message\n )\n end",
"def test_validates_numericality_of_only_integer_finds_custom_model_key_translation\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:custom => {:topic => {:title => {:not_a_number => 'custom message'}}}}}\n I18n.backend.store_translations 'en-US', :active_record => {:error_messages => {:not_a_number => 'global message'}}\n \n Topic.validates_numericality_of :title, :only_integer => true\n @topic.title = 'a'\n @topic.valid?\n assert_equal 'custom message', @topic.errors.on(:title)\n end",
"def valid_xml_attribute(name, options={:level => :warning})\n\t\t\t\tvalidate(\"Invalid XML attribute '#{name}'\", options) { name.to_s.match(/^([^[:punct:]0-9<>]|_)[^<>\"']*/) }\n\t\t\tend",
"def validate_string_attributes\n validation_regex.each_key do |m|\n t = valid_string_match?(\n send(m).to_s,\n validation_regex[m][:regex],\n validation_regex[m][:mandatory]\n )\n raise \"#{self.class} error #{m} : #{send(m)}\" unless t == true\n end\n end",
"def mark_error(model, attr_name)\n if model.errors.any? && model.errors.get(attr_name) && model.errors.get(attr_name) != \"\"\n return ' error'\n end\n return ''\n end",
"def error_message; end",
"def test_generate_message_too_long_with_default_message_plural\n assert_equal \"is too long (maximum is 10 characters)\", @person.errors.generate_message(:title, :too_long, count: 10)\n end",
"def validate!(msg = nil)\n unless valid?\n if msg\n fail msg\n else\n fail \"The version string, #{self}, is not valid!\"\n end\n end\n self\n end",
"def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n unless l.call(self, attr, val)\n raise \"validation error : #{attr}=#{val} (#{self.class})\"\n end\n end\n end\n end",
"def check_tag_format\n errors.add(:name, 'is not a valid tag') unless name =~ Tag.validation_regex\n end",
"def validates_message_length\n errors.add(:message, \"must be less than #{max_message_length} characters\") unless message_length < max_message_length\n end",
"def validate_message(message)\n\n\n validated_message = message.gsub(/[^a-zA-Z]/, '').upcase.gsub('J','I')\n\n\n end",
"def error_message\n # :nocov:\n options.fetch(:messages, :valid)\n # :nocov:\n end",
"def to_s\n \"ValidationError on #{@element_type} #{@element_name}: #{@message}\"\n end",
"def validate_any(attribute_name, message = nil)\n value = attributes[attribute_name]\n if value && value.empty?\n append_error(attribute_name, message || :cant_be_empty)\n end\n end",
"def failure_message_when_negated; end",
"def failure_message_when_negated; end",
"def failure_message_when_negated; end",
"def validator; end",
"def validated_attribute_names(params); end",
"def describe_error\n message = \"\"\n if self.account_number == nil\n message = message + I18n.t(:wrong_or_missing_account_number, :scope => [:model, :index]) + \" \"\n end\n if self.account_bank_number == nil\n message = message + I18n.t(:wrong_or_missing_account_bank_number, :scope => [:model, :index]) + \" \"\n end\n if self.student.uic == nil\n message = message + I18n.t(:missing_uic, :scope => [:model, :index]) + \" \"\n end\n if self.sident == -666\n message = message + I18n.t(:missing_sident_666, :scope => [:model, :index]) + \" \"\n end\n if self.sident == nil\n message = message + I18n.t(:missing_sident, :scope => [:model, :index]) + \" \"\n end\n return message\n\n end",
"def validate\n validate_string_attributes\n end",
"def add_null_message_to_errors(field)\n @errors << {message: \"#{field} must not be blank.\", variable: \"#{field}\"}\n end",
"def full_messages_for(field)\n attr_name = object.class.human_attribute_name(field.to_s)\n\n object.errors[field].inject([]) do |full_messages, message|\n next unless message\n full_messages << attr_name + I18n.t('activerecord.errors.format.separator', :default => ' ') + message\n end\n end",
"def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end",
"def val_err (message1, value1 = false, message2 = false, value2 = false,\n message3 = false)\n message = \"#{message1}\" +\n (value1 == false ? \"\" : \" (#{value1.to_s.gsub(/[\\\"\\[\\]]/,\"\")})\") +\n (message2 == false ? \"\" : \" #{message2}\") +\n (value2 == false ? \"\" : \" (#{value2.to_s})\") +\n (message3 == false ? \"\" : \" #{message3}\")\n self.errors.push(message)\n false\n end",
"def validate\n super\n end"
] | [
"0.6785426",
"0.6785426",
"0.65165544",
"0.65028995",
"0.64755994",
"0.64455605",
"0.6276569",
"0.62678266",
"0.62557137",
"0.6157303",
"0.61564267",
"0.6112558",
"0.6104179",
"0.60769665",
"0.607073",
"0.607073",
"0.6026137",
"0.5985616",
"0.598447",
"0.59594524",
"0.592398",
"0.58871275",
"0.5886488",
"0.58720183",
"0.5868476",
"0.58668125",
"0.58551437",
"0.58454454",
"0.5837663",
"0.58375645",
"0.58356047",
"0.5832216",
"0.582001",
"0.58194566",
"0.58190596",
"0.58179384",
"0.5812762",
"0.5806848",
"0.5791093",
"0.5787248",
"0.57862073",
"0.5773419",
"0.5759752",
"0.57330376",
"0.5731394",
"0.5729416",
"0.5726696",
"0.5724531",
"0.57245123",
"0.5724033",
"0.57178026",
"0.5686851",
"0.56804276",
"0.56797546",
"0.5676308",
"0.5670545",
"0.5663939",
"0.5662847",
"0.56564856",
"0.56522185",
"0.56517726",
"0.5651276",
"0.56492656",
"0.5635715",
"0.5630399",
"0.5630097",
"0.5614674",
"0.5612157",
"0.5605335",
"0.5589682",
"0.55861956",
"0.5579825",
"0.5573535",
"0.5552928",
"0.5536493",
"0.5535452",
"0.5520453",
"0.5517742",
"0.5507502",
"0.54929143",
"0.5487004",
"0.5486566",
"0.54829836",
"0.54822886",
"0.547022",
"0.54699445",
"0.5466166",
"0.5461906",
"0.5460229",
"0.5458895",
"0.5458895",
"0.5458895",
"0.5452984",
"0.5435547",
"0.543285",
"0.5429549",
"0.5426033",
"0.54217446",
"0.541289",
"0.54127944",
"0.54114157"
] | 0.0 | -1 |
If input lines are not equal length, we might land in the middle of a line | def rewind_line(file, line)
until file_at_starting_position?(file, line)
line_rewind_one_char(file, line) do |rewound_line|
return line if newline?(rewound_line)
line = rewound_line
end
end
line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_line( x, y )\n x + @left_column < line_at( y ).length\n end",
"def in_line( x, y )\n x + @left_column < line_at( y ).length\n end",
"def two_empty_in_line(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(marker, initial, initial)\n end",
"def is_same_line on_line, off_line\n\tif on_line == off_line\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def is_on_line?(line)\n to_a.zip(line.point.to_a, line.vector.to_a).map { |a, b, c| (a - b) / c }.uniq.length == 1\n end",
"def same_line(line, start_index, end_index)\n if (start_index > end_index)\n start_index = reverse_direction(line, start_index)\n end_index = reverse_direction(line, end_index)\n line.reverse!\n line[start_index..end_index]\n elsif start_index == end_index\n \"\\nBuddy, have a look around, you are already there...\\n\"\n else\n line[start_index..end_index]\n end\nend",
"def cover_line(segment)\n l = segment.l\n r = segment.r\n l = 0 if l < 0\n r -= 1\n r = @line.length-1 if r > @line.length-1\n\n for i in l..r\n @line[i] = true\n end\n end",
"def same_entries_in_a_line?(line_array)\n line_array.uniq.size <= 1 && line_array[0] != \" \"\n end",
"def on_line?(line)\n end",
"def exhasusted?\n @index >= @lines.count\n end",
"def part_of_head?\n return true if self.position == 0\n begin\n if self.nominal?\n # there are no non-nominal segments between given\n # segment and the beginning of its spelling\n gap = false\n self.spelling.segments.each do |prev_segment|\n break if prev_segment == self\n gap = true if !prev_segment.nominal?\n end\n !gap\n end\n rescue Exception => ex\n #puts ex\n false\n end\n end",
"def lex_ignore(length)\n \n return if length.eql?0 #Si no hay nada regresa\n\n word = @input[0..length-1] # Se crea un aux de lo que se quiere ignorar\n lineas = (word + ' ').lines.to_a.length.pred #Se saca el numero de lineas, \n #convirtiendo en arreglo de las palabras separadas \\n y midiendolo\n @line += lineas\n @input = @input[length..@input.length] # Se omite la solicitado\n\n if lineas.eql?0 then\n @column += length #Se suma las columnas omitidas a las que habia\n else\n @column = 1 #Sino se colocan en 1 por salto de linea\n end\n end",
"def check_for_line(original_x, original_y)\n\t\t@direction = 1\n\t\t\t@line_count = 1\n\t\t\tif check_next_holes(original_x, original_y)\n\t\t\t\treturn true\n\t\t\tend\n\t\treturn false\n\tend",
"def pos_on_line(offset)\n end",
"def good_divider(lines,i)\n above_and_below = lines.rows(0...i)+lines.rows((i+1)..-1)\n segments(lines[i]).all? { |text,range|\n text =~ /^( +|---+)$/ or above_and_below.columns(range).blank?\n }\n end",
"def jump_to_line l\n l = l.clamp 0, num_lines - 1\n return if @topline == l\n @topline = l\n @botline = [l + buffer.content_height, num_lines].min\n buffer.mark_dirty!\n end",
"def alignContinuations(theLines)\n\n\tsplitAndAlign(theLines, /^(.*?)\\s+(\\\\)$/, \"\");\n\nend",
"def is_left_to_union line, on_stop, changing_stop\n\tif line.index(on_stop) <= line.index(changing_stop)\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend",
"def join_lines_into_one\n\t\t@complete_letter = Array.new\n\t\t@master = 0\n\t\tmaster_comp = @top_line.length\n\t\tuntil @master == master_comp\n\t\t\ttheory_case\n\t\tend\n\tend",
"def crosses_line_string?(rhs)\n self_ints = SweeplineIntersector.new(segments).proper_intersections\n self_ints += SweeplineIntersector.new(rhs.segments).proper_intersections\n overlay_ints = SweeplineIntersector.new(segments + rhs.segments).proper_intersections\n\n (overlay_ints - self_ints).each do |int|\n s1s = int.s1.s\n s1e = int.s1.e\n s2s = int.s2.s\n s2e = int.s2.e\n return true unless [s1s, s1e, s2s, s2e].include?(int.point)\n end\n\n false\n end",
"def none_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 0 && board.squares.values_at(*the_line).count(' ') == 3\n return true\n end\n end\n end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def is_line_same(line)\n return false if @board[line[0]].value == \" \"\n line.each do |i|\n return false unless @board[i].value == @board[line[0]].value\n end\n return true\n end",
"def find_start(line, len)\n (stream,answer) = line.split(':')\n return if stream.nil?\n stream.chars.each_with_index do |c, i|\n # take slice of array starting at i\n # check if uniq.\n sub = stream[i..i+len-1]\n \n if sub.chars.uniq.length == len\n puts \"sub=#{sub}\" \n puts \"found at index=#{i} chars recv=#{i+len} answer=#{answer}\"\n return\n end\n end \nend",
"def test_file_must_contain_prepend()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::PREPEND)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[0])\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"anchor line\", :position => Cfruby::FileEdit::PREPEND, :anchor => /third/)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"anchor line\\n\", lines[3])\n\t\t\tassert(lines[4] =~ /third/)\n\t\t}\t\t\n\tend",
"def one_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 1 && board.squares.values_at(*the_line).count(' ') == 2\n return true\n end\n end\n end",
"def partition_and_process_non_tabular_lines\n non_tabular_lines.each do |line|\n if line =~ @start_line_pattern\n # This is a start line\n start_record(line)\n elsif line =~ @end_line_pattern\n # This is an end line\n end_record(line)\n else\n @non_tabular_record << line if @in_a_record\n end\n end\n end",
"def irrelevant_line?(source_line); end",
"def line_a(line, height_headers)\n total_count = height_headers.count\n line = line.split(' ')\n\n if line.count != total_count\n (total_count - line.count).times do\n line.insert(1, '')\n end\n end\n line\n end",
"def do_part2(lines)\n map, _, end_loc = map_from(lines)\n remove_inaccessible_cells(map, end_loc)\n paths = []\n map.height.times do |row|\n map.width.times do |col|\n paths << a_star(map, [row, col], end_loc) if map.at(row, col) == 0\n end\n end\n\n paths.compact.map(&:length).min\n end",
"def junky?(line)\n explode(line).select {|s| s && !s.strip.empty?}.count <= 2\n end",
"def win_line_with_uniform_markers\n populated_win_lines.select do |line|\n pos1 = squares[line[0]]\n pos2 = squares[line[1]]\n pos3 = squares[line[2]]\n [pos1.marker, pos2.marker, pos3.marker].uniq.length == 1\n end\n end",
"def first_line_only(range); end",
"def first_line_only(range); end",
"def first_line_only(range); end",
"def rl_beg_of_line(count, key)\r\n @rl_point = 0\r\n 0\r\n end",
"def teardown_to_oneline(line, length = 60)\n lines = []\n line.split(\" \").each {|line|\n if !lines.empty? && lines[-1].size + line.size + 1 <= length\n lines[-1].concat(\" \" + line)\n else\n lines << line\n end\n }\n return lines\n end",
"def line_exists?(line_index)\n line_index >= 0 && line_index < total_lines\n end",
"def is_box_full(column, line)\n if @array[column][line] != \" \"\n return true\n else\n return false\n end\n end",
"def grab_line(search, row, col, length, orientation)\n line = \"\"\n\n case orientation\n when :down\n # check boundary case\n if search.has_key?([row + length, col])\n (0..length).each do |i|\n line += search[[row + i, col]]\n end\n end\n\n when :down_right\n # check boundary case\n if search.has_key?([row + length, col + length])\n (0..length).each do |i|\n line += search[[row + i, col + i]]\n end\n end\n\n when :right\n # check boundary case\n if search.has_key?([row, col + length])\n (0..length).each do |i|\n line += search[[row, col + i]]\n end\n end\n\n when :up_right\n # check boundary case\n if search.has_key?([row - length, col + length])\n (0..length).each do |i|\n line += search[[row - i, col + i]]\n end\n end\n\n when :up\n # check boundary case\n if search.has_key?([row - length, col])\n (0..length).each do |i|\n line += search[[row - i, col]]\n end\n end\n\n when :up_left\n # check boundary case\n if search.has_key?([row - length, col - length])\n (0..length).each do |i|\n line += search[[row - i, col - i]]\n end\n end\n\n when :left\n # check boundary case\n if search.has_key?([row, col - length])\n (0..length).each do |i|\n line += search[[row, col - i]]\n end\n end\n\n when :down_left\n # check boundary case\n if search.has_key?([row + length, col - length])\n (0..length).each do |i|\n line += search[[row + i, col - i]]\n end\n end\n end\n\n return line\nend",
"def line(ppl)\n \n # If the line is empty...\n if ppl.length == 0\n\n # Tell us the line is empty.\n puts \"The line is currently empty.\"\n\n # If there are people in line... \n else\n crnt_ln = []\n \n ppl.each_with_index do |nm, ndx|\n ln = ndx + 1\n crnt_ln << \" #{ln}. #{nm}\"\n end\n \n crnt_ln.unshift(\"The line is currently:\")\n puts crnt_ln.join\n end\nend",
"def check_endpoints(line1, line2, delta)\n if (line1.start_point.same?(line2.start_point) ||\n line1.start_point.same?(line2.end_point) ||\n line1.end_point.same?(line2.start_point) ||\n line1.end_point.same?(line2.end_point))\n return true\n end\n return false\nend",
"def distance_to_line(line)\n end",
"def onLine(c1,c2,buffer,c3)\n\n if equalCoordinates?(c1, c2)\n return equalCoordinates?(c1, c3) || buffer > getGeoDistance(c1, c3)\n end\n\n if equalCoordinates?(c1, c3)\n return true\n end\n\n # we get the difference Geodesic angles\n theta1 = getGeoAngle(c1,c2)\n theta2 = getGeoAngle(c1,c3)\n theta3 = theta2-theta1\n\n # buf buf\n # (--- c1 ----------------- c2 ---)\n # * |\n # H(c1-c3) * | H*Sin(theta3)\n # * |\n # c3\n hc1c3 = getGeoDistance(c1,c3)\n hc1c2 = getGeoDistance(c1,c2)\n #\n # if the point is with in a buffer's radius of C1 then it is on the line,\n # Otherwise, its distance from C1 must be less than the distance to C2\n # plus the buffer, and its distance to the C1-C2 line must be less than the buffer.\n # Furthermore this calculation only works if difference in angles is less than PI/2.\n # If the difference in angles is greater than that, then the point is not near\n # the line, unless it was within the buffer radius of C1.\n #\n result = hc1c3 < buffer || abs(theta3) < Math::PI/2 &&\n hc1c3 <= hc1c2 + buffer/2 && abs(Math.sin(theta3) * hc1c3) <= buffer/2\n\n return result\n end",
"def test_step_on_line\n h_step = [[2,1],[2,3],[2,5]]\n l_step = [[1,4],[2,3],[3,2]]\n r_step = [[1,2],[2,3],[3,4]]\n\n assert @chess._is_step_on_line(h_step, \"horizonal\")\n assert @chess._is_step_on_line(l_step, \"leftdown\")\n assert @chess._is_step_on_line(r_step, \"rightdown\")\n\n b_step = [[0,3],[3,0]]\n t_step = [[2,3],[3,2],[3,4]]\n assert !@chess._is_step_on_line(b_step, \"boundary\")\n assert !@chess._is_step_on_line(t_step, \"triangle\")\n end",
"def fresh_line?\n @content.empty? || @content[-1].eql?(NL)\n end",
"def previous_line_to_wrap; end",
"def kill_line(*)\n if current_buffer[current_buffer.point] == \"\\n\"\n current_buffer.slice!(current_buffer.point)\n return true\n end\n\n line_end = current_buffer.index(/$/, current_buffer.point)\n current_buffer.slice!(current_buffer.point, line_end - current_buffer.point)\n true\nend",
"def checkLine\r\n\t\tif(@Line == \"\" || @Line == nil || @Line == \"\\n\" || @Line == \"\\r\\n\")\r\n\t\t\tnextLine\r\n\t\tend\r\n\tend",
"def check_the_line(relevant_line)\n puts '0' && exit if relevant_line == []\nend",
"def out_of_bounds?(line)\n line.each do |location|\n return true unless location[0].between?(0, 6)\n return true unless location[1].between?(0, 5)\n end\n false\n end",
"def run_line_length_cop; end",
"def should_insert_before(line, regexp_hash)\n !(regexp_hash['spacing'] == \"a\")\n end",
"def is_continuing_line?(line)\n line.expunge =~ /^[^#]*\\\\\\s*(#.*)?$/\n #first use expunge to eliminate inline closures\n #that may contain comment char '#'\n end",
"def line_to_wrap; end",
"def offset_on_line(offset)\n end",
"def find_line_boundary(text, start_index, rightwards)\n index = start_index\n vector = -1\n vector = 1 if rightwards\n\n loop do\n character = text[index]\n\n if rightwards\n break if index >= text.length\n break if character == \"\\n\"\n else\n break if index <= 0\n break if text[index - 1] == \"\\n\"\n end\n\n index = index + vector\n end\n\n index\n end",
"def lineCheck (l1, l2)\n if(l1 == l2)\n true;\n else\n false;\n end\nend",
"def part1_is_valid(line)\n words = line.split(\" \")\n return words.uniq.length == words.length\nend",
"def linebreak?(cell)\n cell.nonzero? && (cell % columns).zero?\n end",
"def missed_lines; end",
"def missed_lines; end",
"def is_multiline?(line) # ' '[0] == 32\n line && line.length > 1 && line[-1] == MULTILINE_CHAR_VALUE && line[-2] == 32\n end",
"def line(other_deli)\n if(other_deli.length == 0)\n puts \"The line is currently empty.\"\n else\n result = \"The line is currently: \"\n other_deli.each_with_index do |name, index|\n result += \"#{index + 1}. #{name}\"\n if(index != other_deli.length - 1)\n result += \" \"\n end\n end\n puts result\n end\nend",
"def num_lines() @line_indices.length + 1 end",
"def two_in_a_row?(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n return true\n end\n end\n end",
"def begin_line(kind); end",
"def begin_line(kind); end",
"def look_for_win\n Game::LINES.each do |winning_line|\n markers = group_positions_by_marker(winning_line)\n if markers[marker].length == 2 and markers.keys.include?(nil)\n puts markers.keys\n choice = markers[nil].first\n return choice\n end\n end\n false\n end",
"def line x0, y0, x1, y1, c\n dx = (x1 - x0).abs\n sx = x0 < x1 ? 1 : -1\n dy = (y1 - y0).abs\n sy = y0 < y1 ? 1 : -1\n err = (dx > dy ? dx : -dy) / 2\n \n loop do\n set x0, y0, c\n break if x0 === x1 && y0 === y1\n e2 = err\n if e2 > -dx\n err -= dy\n x0 += sx\n end \n if e2 < dy\n err += dx\n y0 += sy \n end\n end \n end",
"def check_comments(input, markers)\n lines = input.split(\"\\n\")\n output = ''\n lines.each do |line|\n line_end = line.length\n line.chars.each_with_index do |char, index|\n line_end = index if markers.include?(char)\n end\n new_line = line[0...line_end].rstrip\n output += new_line + (line == lines.last ? '' : \"\\n\")\n end\n output\nend",
"def sub_horizontal_line(start, length)\n offset = byte_offset start\n data[offset .. (offset + (length*pixel_byte_size)-1)]\n end",
"def challenge_lines(line, defenderIndex = 0)\n return if (defenderIndex >= @longest_line_arr.length)\n\n defender = @longest_line_arr[defenderIndex];\n puts \"ChallengerLine = #{line}, \" \\\n \"Defender = #{defender}, index= #{defenderIndex}\" if @debug\n \n if (line.length > defender.length)\n puts \"Challenge victory!\" if @debug\n @longest_line_arr[defenderIndex] = line\n challenge_lines(defender, defenderIndex + 1)\n end\nend",
"def need_to_transfer?(start_line, ending_line)\n\n if start_line != ending_line\n transfer = true\n else\n transfer = false\n end\nend",
"def bol?\n if pos.equal?(0)\n return true\n end\n pminus = pos - 1\n string[pminus..pminus] == \"\\n\"\n end",
"def starts_here(search, word, row, col)\n\n len = word.length - 1\n\n orientations = [\n :down,\n :down_right,\n :right,\n :up_right,\n :up,\n :up_left,\n :left,\n :down_left]\n\n orientations.each do |orientation|\n found = grab_line(search, row, col, len, orientation)\n\n if word == found\n return true\n end\n end\n\n return false\nend",
"def check(lines_mod)\n index = 0\n indexes = []\n acc = 0\n until index == lines_mod.length\n indexes << index\n case lines_mod[index][0..2]\n when 'acc'\n acc += lines_mod[index].match(/[\\-\\+]\\d+/).to_s.to_i\n index += 1\n when 'nop'\n index += 1\n when 'jmp'\n index += lines_mod[index].match(/[\\-\\+]\\d+/).to_s.to_i\n end\n raise 'nope' if indexes.include?(index)\n end\n acc\nend",
"def buffer_empty?\n @line_no.zero? || @pos > @line.length - 1\n end",
"def f_alter_not_start_end?(str, b, e, j)\n e[j] + 1 < str.length && b[0].positive?\n end",
"def nextLine\r\n\t\twhile (@allLines[0] == \"\" || @allLines[0] == \"\\r\\n\" || @allLines[0] == \"\\n\")\r\n\t\t\t@allLines.shift\r\n\t\tend\r\n\t\tif(@allLines[0]!=nil)\r\n\t\t\t@Line = @allLines[0]\r\n\t\t\t@allLines.shift\r\n\t\t\tcheckSpace\r\n\t\tend\r\n\tend",
"def spot_middle\n indent = (@width - 1) / 2\n [ draw_line(indent, nil) ]\n end",
"def test_text_invariant(t)\n\tt1 = t.text.gsub(\"\\n\", \"\\\\n\")\n\trep = \"line indices: [#{t.line_indices.join(', ')}], text = #{t1}\"\n\n\tassert(t.text.gsub(/[^\\n]/, '').length == t.line_indices.length, \"Incorrect number of newlines: #{rep}\")\n\tassert(t.line_indices == t.line_indices.sort)\n\tt.line_indices.each do |i| \n\t\tassert(t.text[i,1] == \"\\n\", \"line_indices false positive: #{rep}\")\n\tend\nend",
"def test_caret_anchors_to_the_start_of_lines\n assert_equal \"2\", \"num 42\\n2 lines\"[/^\\d+/]\n end",
"def line_is_empty? line\n\tcheck = line.clone\n\tcheck.strip!.empty?\nend",
"def matching_lines(lined_content, surrounding_lines, query)\n used_lines = []\n lined_content.each_with_index do |line, line_number|\n used_lines.concat bounded_line_numbers(\n line_number,\n 0,\n lined_content.size,\n surrounding_lines\n ) if line.downcase.include?(query.downcase)\n end\n\n used_lines.uniq.sort\n end",
"def is_lpar(latex, step)\n\tlatex[step+1..step+5].join == \"left(\"\nend",
"def unimportant_missing_cr?(index, last_line, line); end",
"def line(katz_deli)\n current_position = []# current position is to show the line is empty.\n if katz_deli.empty?# if the line is currently empty\n puts \"The line is currently empty.\"#print the phrase\n else\n !katz_deli.empty?# If the line is not empty. this line is not required in the code but helps me understand it easier\n counter = 1# there is now 1 person in line\n katz_deli.each do |customer|\n current_position << \"#{counter}. #{customer}\"# to display the current position of the elements of the array\n counter += 1\n end\n puts \"The line is currently: #{current_position.join(\" \")}\"# display the current position in a linear way.\n end\nend",
"def before_and_after begin_delimeter, end_delimeter\n\n Throw.if_nil_or_empty_strings [ self, begin_delimeter, end_delimeter ]\n\n before_after_lines = []\n in_middle_bit = false\n\n self.each do |candidate_line|\n\n is_middle_boundary = !in_middle_bit && candidate_line.downcase.include?(begin_delimeter.downcase)\n if is_middle_boundary\n in_middle_bit = true\n next\n end\n\n unless in_middle_bit\n before_after_lines.push candidate_line\n next\n end\n\n #--\n #-- Now we are definitely in the middle bit.\n #-- Let's check for the middle end delimeter\n #--\n if candidate_line.downcase.include? end_delimeter.downcase\n in_middle_bit = false\n end\n\n end\n\n return before_after_lines\n\n end",
"def at_start_rows?\n row = pos[0]\n \n return true if row == 1 || row == 6\n \n false\n end",
"def test_file_must_contain_insert()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \"new line\", :position => Cfruby::FileEdit::PREPEND, :anchor => 3)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(\"new line\\n\", lines[3])\n\t\t}\n\tend",
"def multiline_kspawn? line\n if @kspawn_multiline\n @kspawn[:text] << line\n if line.include?(\"~\")\n @kspawn_multiline = false\n # However nothing but whitespace can follow that tilde!\n validate_tilde(\n line: line,\n line_number: @current_line,\n present: false\n )\n end\n true\n else\n false\n end\n # Returning true skips the rest of the parse method for this line\n end",
"def instinct(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n the_line.each {|e| (board.squares[e] == ' ') ? board.squares[e] = 'o' : e }\n board.draw_board\n break\n end\n end\n end",
"def match?(other_line)\n (key_tokens - other_line.key_tokens) == [] || (other_line.key_tokens - key_tokens) == []\n end",
"def run_newline\n newline = @raw_lines.shift\n\n # First, we test if the new line contains from/to timestamps,\n # and if so, start reading.\n try_match_to_from = @to_from_match.match(newline)\n if try_match_to_from.nil?\n newline_might_have_content(newline)\n else\n newline_has_from_to(try_match_to_from)\n end\n end",
"def start_of_line\n self.cursor = 0\n end",
"def test_file_must_nofuzzy()\n\t\tCfruby::FileEdit.file_must_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length + 1)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(2, firstcount)\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \" first line\", :fuzzymatch => false)\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert(lines.length == @multilinefilecontents.split(\"\\n\").length)\n\t\t\tfirstcount = 0\n\t\t\tlines.each() { |line|\n\t\t\t\tif(line =~ /first/)\n\t\t\t\t\tfirstcount = firstcount + 1\n\t\t\t\tend\n\t\t\t}\n\t\t\tassert_equal(1, firstcount)\n\t\t}\n\tend",
"def taken?(input)\n position(input) != \" \"\n end",
"def check_duplicate(line)\n return line.uniq.length == line.length\nend"
] | [
"0.6792005",
"0.6792005",
"0.6657288",
"0.63800746",
"0.6377823",
"0.6270609",
"0.6257391",
"0.6173206",
"0.60937303",
"0.60112345",
"0.5990658",
"0.5978543",
"0.5940403",
"0.590957",
"0.58649224",
"0.5851992",
"0.5829994",
"0.58281827",
"0.5816978",
"0.58121437",
"0.5777859",
"0.5776662",
"0.5776662",
"0.5776662",
"0.57717425",
"0.57558405",
"0.5754266",
"0.5739082",
"0.5724397",
"0.57108164",
"0.57042843",
"0.56960845",
"0.56832135",
"0.5675371",
"0.56447107",
"0.56447107",
"0.56447107",
"0.56400514",
"0.56389755",
"0.563407",
"0.5610544",
"0.5608973",
"0.5605522",
"0.5602257",
"0.5587149",
"0.5586116",
"0.5583791",
"0.5567909",
"0.5561718",
"0.55533105",
"0.55506533",
"0.5548522",
"0.55426455",
"0.554123",
"0.5538521",
"0.5538066",
"0.5537",
"0.55294216",
"0.55291647",
"0.5525321",
"0.55184937",
"0.54958904",
"0.5489542",
"0.5489542",
"0.5485487",
"0.5481869",
"0.5472216",
"0.5460891",
"0.54559004",
"0.54559004",
"0.54555404",
"0.54484",
"0.54423815",
"0.5433739",
"0.542421",
"0.54234767",
"0.54216534",
"0.54152083",
"0.54146713",
"0.5413156",
"0.53927326",
"0.5392269",
"0.53835624",
"0.53796446",
"0.5371994",
"0.53645474",
"0.5361531",
"0.5360776",
"0.53587145",
"0.53526396",
"0.534934",
"0.5346059",
"0.5339785",
"0.5339596",
"0.53391147",
"0.5338556",
"0.5337467",
"0.53326064",
"0.5324386",
"0.5323184",
"0.5318622"
] | 0.0 | -1 |
================= = Guard methods = ================= Call once when guard starts | def start
UI.info "Starting up WEBrick..."
if running?
UI.error "Another instance of WEBrick::HTTPServer is running."
false
else
@pid = Spoon.spawnp('ruby',
File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),
@options[:host],
@options[:port].to_s,
@options[:ssl].to_s,
@options[:docroot]
)
wait_for_port
if @options[:launchy]
scheme = options[:ssl] ? "https" : "http"
Launchy.open("#{scheme}://#{@options[:host]}:#{@options[:port]}")
@options[:launchy] = false # only run once
end
@pid
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard; end",
"def guard(*args)\n @guard_count += 1\n super\n end",
"def unguarded(&block)\n @guard_count += 1\n super\n end",
"def sharded?; true; end",
"def sharded?; false; end",
"def start\n ::Guard.start(options)\n end",
"def guard(guard_result)\r\n @guard_temp=guard_result\r\n end",
"def start\r\n ::Guard.start(options)\r\n end",
"def define_guard_on(action_name)\r\n @guards.push action_name \r\n #self.state_machine.class.send(:define_method , \"_guard_on_#{action_name.to_s}\") do \r\n @state_machine.define_singleton_method \"_guard_on_#{action_name.to_s}\" do \r\n\r\n begin\r\n puts_debug \"Guard on: #{action_name}\"\r\n return yield\r\n rescue LocalJumpError \r\n # ignore, this is just a plain action.\r\n end # end rescue\r\n end # end proc\r\n \r\n end",
"def include_guard_begin(&block)\n lang_eval { @include_guard_begin_block = block }\n nil\n end",
"def guard!\n unless Actor.current == reference\n raise \"can be called only inside actor #{reference} but was #{Actor.current}\"\n end\n end",
"def precheck\n end",
"def once\n end",
"def before_run; end",
"def will_verify_before\n return 'No block' unless block_given?\n\n yield\nend",
"def start\n return if ENV[\"GUARD_ENV\"] == 'test'\n\n if !@thread || !@thread.alive?\n @thread = Thread.new do\n while entry = $stdin.gets.chomp\n scopes, action = extract_scopes_and_action(entry)\n case action\n when :stop\n ::Guard.stop\n when :pause\n ::Guard.pause\n when :reload\n ::Guard::Dsl.reevaluate_guardfile if scopes.empty?\n ::Guard.reload(scopes)\n when :run_all\n ::Guard.run_all(scopes)\n end\n end\n end\n end\n end",
"def guard(guard)\n @item.guard = guard\n self\n end",
"def mon_enter\n mon_try_enter ||\n ActiveSupport::Dependencies.interlock.permit_concurrent_loads { super }\n end",
"def enforce\n @@mutex.synchronize {\n\treturn false if @defused\n\n\t@thread.raise @klass, 'execution expired'\n\t@defused = true\n\ttrue\n }\n end",
"def defuse!\n @@mutex.synchronize { @defused = true }\n end",
"def lock!; end",
"def only_once\n end",
"def before_block_boundary?; end",
"def synchronized?; end",
"def captured_by_block?; end",
"def check ; true ; end",
"def lift\n @mutex.lock\n\n @once ||= true\n\n @condition.broadcast\n ensure\n @mutex.unlock\n end",
"def always_run=(_arg0); end",
"def require_that guard, message, return_guard = false\n if not guard then\n raise ExpectationFailedError.new(message)\n end\n if return_guard == true then\n guard\n elsif return_guard != false then\n return_guard\n end\n end",
"def before; end",
"def if_access_locked; end",
"def before() nil ; end",
"def before_all\n super if defined?(super)\n end",
"def add_guard_command\n if @actor.perfaction? == false#@actor.guard_usable?\n add_command(Vocab::guard, :defend, true)\n else\n add_command(GTBS::Menu_Wait, :wait, true)\n end\n end",
"def check_all_here\n end",
"def check_pre_guard_effects(user, item)\n check_effects(effect_objects, \"pre_guard\", user, item)\n end",
"def init(guard_name = nil)\n ::Guard.initialize_template(guard_name)\n end",
"def enter_pending; end",
"def lock; end",
"def lock; end",
"def lock; end",
"def always\n scope._match_hook\n super\n end",
"def before_dispatch(env); end",
"def once\n @once\n end",
"def pre_run_check\n Puppet.warning(\"#{self[:name]}: Doing some pre-run checks\")\n binding.pry if defined?(Pry)\n end",
"def check\n \n end",
"def check\n \n end",
"def get_guard\r\n return @guard_temp\r\n end",
"def checks; end",
"def application_guard_enabled\n return @application_guard_enabled\n end",
"def before() ; end",
"def allow_in_post_mortem=(_arg0); end",
"def robots_mutex; end",
"def enable!; end",
"def guard_process_payment_from_created; true; end",
"def guard_process_payment_from_created; true; end",
"def init(guard_name = nil)\r\n if !File.exist?('Guardfile')\r\n puts \"Writing new Guardfile to #{Dir.pwd}/Guardfile\"\r\n FileUtils.cp(File.expand_path('../templates/Guardfile', __FILE__), 'Guardfile')\r\n elsif guard_name.nil?\r\n Guard::UI.error \"Guardfile already exists at #{ Dir.pwd }/Guardfile\"\r\n exit 1\r\n end\r\n\r\n if guard_name\r\n guard_class = ::Guard.get_guard_class(guard_name)\r\n guard_class.init(guard_name)\r\n end\r\n end",
"def before\n\t\t\ttrue\n\t\tend",
"def ready=(_); end",
"def state_guard?(state_id)\n return false\n end",
"def pausable; end",
"def enforce_logged_in\n bounce unless current_user\n end",
"def access_locked?; end",
"def locked; end",
"def dead?; end",
"def lock\n end",
"def actual_flow_control\n super\n end",
"def mark_as_used\n # noop\n end",
"def double_check\n if any_damage?\n @used = true\n @missed = false\n @evaded = false\n end\n end",
"def scannerWillSync(scanner)\n updateCache(\"syncing...\")\n end",
"def captured?; @captured end",
"def auth_trap_state\n super\n end",
"def allow_in_post_mortem; end",
"def monitor; end",
"def before(&block)\n handle(0, &block)\n end",
"def check!\n true\n end",
"def pass; end",
"def pass; end",
"def lock!\n @handlers.freeze\n end",
"def include_guard_end(&block)\n lang_eval { @include_guard_end_block = block }\n nil\n end",
"def check_process\n super\n end",
"def verify\n # nothing to do here, so just return\n end",
"def check_guard(message)\n guard = message.guard\n\n if guard.nil? || guard.empty?\n return true\n else\n guard.keys.all? do |key|\n value = self.__send__(\"request_#{key}\")\n if value.kind_of? Symbol\n value.to_s == guard[key].to_s\n else\n value == guard[key]\n end\n end\n end\n end",
"def before\n end",
"def blocks_to_hit\n super + (task.variable ? task.variable.checkers : [])\n end",
"def called_from; end",
"def called_from; end",
"def around_hooks; end",
"def mutex; end",
"def mutex; end",
"def mutex; end",
"def mutex; end",
"def activate; end",
"def run\n time_it do\n capture_exceptions do\n self.class.roby_should_run(self, Roby.app)\n super\n end\n end\n self\n end",
"def run\n time_it do\n capture_exceptions do\n self.class.roby_should_run(self, Roby.app)\n super\n end\n end\n self\n end",
"def guard_method(method)\n StoneWall::Helpers.guard(@guarded_class, method)\n StoneWall::Helpers.fix_alias_for(@guarded_class, method)\n end",
"def authenticate_once_state\n super\n end",
"def ready; end",
"def ready; end",
"def verify_not_before; end",
"def verify_not_before; end"
] | [
"0.81878746",
"0.7439578",
"0.70606685",
"0.6533401",
"0.63737994",
"0.6347317",
"0.6341487",
"0.6247641",
"0.6201087",
"0.61370736",
"0.6052029",
"0.6016231",
"0.59248835",
"0.5913648",
"0.5906934",
"0.58924174",
"0.58633196",
"0.5851018",
"0.57840735",
"0.5767945",
"0.5765016",
"0.57577515",
"0.57180786",
"0.56889457",
"0.56792873",
"0.56678414",
"0.5631918",
"0.56221837",
"0.5600331",
"0.5587536",
"0.5575792",
"0.5560734",
"0.5558014",
"0.5551846",
"0.5540405",
"0.5529463",
"0.55253565",
"0.5523623",
"0.5519962",
"0.5519962",
"0.5519962",
"0.5519496",
"0.55192417",
"0.55051136",
"0.5501261",
"0.55005974",
"0.55005974",
"0.54899967",
"0.548897",
"0.54799485",
"0.5472365",
"0.54680693",
"0.5458768",
"0.54582953",
"0.54451287",
"0.54451287",
"0.5439289",
"0.5433262",
"0.5429608",
"0.54276985",
"0.54257506",
"0.5420084",
"0.5417294",
"0.541569",
"0.54052985",
"0.5405205",
"0.5405203",
"0.5397598",
"0.5393799",
"0.53862107",
"0.5375808",
"0.53677166",
"0.53635305",
"0.5362157",
"0.53605026",
"0.5351455",
"0.53512365",
"0.53512365",
"0.53398854",
"0.5339329",
"0.5338121",
"0.5336402",
"0.5335892",
"0.53341955",
"0.5332231",
"0.532637",
"0.532637",
"0.5326214",
"0.53230065",
"0.53230065",
"0.53230065",
"0.53230065",
"0.531509",
"0.5312844",
"0.5312844",
"0.5306778",
"0.5304506",
"0.5304407",
"0.5304407",
"0.5304085",
"0.5304085"
] | 0.0 | -1 |
Call with CtrlC signal (when Guard quit) | def stop
UI.info "Shutting down WEBrick..."
Process.kill("TERM", @pid)
Process.wait(@pid)
@pid = nil
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_on_ctrl_c(pids, options); end",
"def trap_sigint(metabolizer, &block)\n trap 'SIGINT', proc {\n block.call if block\n metabolizer.stop\n }\nend",
"def add_sigint_handler\n trap 'INT' do\n puts '\\nCancelled. Bye Bye!'\n exit!\n end\n end",
"def trap_signals\n Signal.trap('INT') do\n say \"\\nQuitting...\", :red\n Kernel.exit\n end\n end",
"def _interrupt\n\t\tbegin\n\t\t\tuser_want_abort?\n\t\trescue Interrupt\n\t\t\t# The user hit ctrl-c while we were handling a ctrl-c, send a\n\t\t\t# literal ctrl-c to the shell. XXX Doesn't actually work.\n\t\t\t#$stdout.puts(\"\\n[*] interrupted interrupt, sending literal ctrl-c\\n\")\n\t\t\t#$stdout.puts(run_cmd(\"\\x03\"))\n\t\tend\n\tend",
"def signal; end",
"def signal; end",
"def with_repl_like_sigint\n orig_handler = trap(\"INT\") { raise Interrupt }\n yield\n rescue Interrupt\n puts(\"^C\")\n retry\n ensure\n trap(\"INT\", orig_handler)\n end",
"def trap_exit_signal(signal)\n trap(signal) {\n Serv::Initializer.stop!\n }\n end",
"def handle_interrupt\n system \"SIGINT received, starting shutdown\"\n @shutdown = true\n end",
"def on_termination_signal( signo )\n\t\tself.log.warn \"Terminated (%p)\" % [ signo ]\n\t\tself.shutdown\n\tend",
"def on_interrupt(&block)\n trap(\"INT\") { yield \"SIGINT\" }\n trap(\"QUIT\") { yield \"SIGQUIT\" }\n trap(\"TERM\") { yield \"SIGTERM\" }\n end",
"def interrupt; end",
"def trap_signals\n Signal.trap(\"TERM\") { stop! }\n Signal.trap(\"INT\") { manual_stop! }\n end",
"def onCmdPanic(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip, :panic\n @watcher.cmdPanic\n end",
"def kill!() end",
"def trap_signals\n # kill\n trap('INT') do\n puts('INT received')\n notify_subscribers('INT received')\n stop\n end\n\n # kill\n trap('TERM') do\n puts('TERM received')\n notify_subscribers('TERM received')\n stop\n end\n\n # graceful\n trap('QUIT') do\n puts('QUIT received')\n notify_subscribers('QUIT received')\n stop_soft\n end\n\n # reset things\n trap('HUP') do\n puts('HUP received')\n notify_subscribers('HUP received')\n reset\n end\n end",
"def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end",
"def doge_control_signal\r\n end",
"def signal\n end",
"def interrupt?; end",
"def on_term_signal(&block)\n # trap(:TERM) {}\n warn \"Missing implementation 'on_term_signal'\"\n end",
"def signal\n @cmd_result.signal\n end",
"def expect_interrupt\n\tbegin\n\t\tyield\n\trescue Interrupt\n\t\tputs # to separate the typed `^C` from upcoming program output or shell prompt\n\tend\nend",
"def watch\n begin\n yield\n rescue Interrupt\n puts\n exit 0\n end\n end",
"def test_ask_sigint\n start_process do\n begin\n Prompt.ask('q')\n rescue Interrupt\n @ret.write(Marshal.dump(:SIGINT))\n end\n end\n\n sleep(0.05)\n Process.kill('INT', @pid)\n\n assert_result(\"? q\\n> \", \"^C\\n\", :SIGINT)\n end",
"def trap_signals\n trap(\"TERM\") do\n\tself.fatal!(\"TERM received\",1)\n end\n\n trap(\"INT\") do\n\tself.fatal!(\"Interrupt signal received.\", 2)\n end\n end",
"def trap_signals\n trap(\"TERM\") do\n\tself.fatal!(\"TERM received\",1)\n end\n\n trap(\"INT\") do\n\tself.fatal!(\"Interrupt signal received.\", 2)\n end\n end",
"def manual_stop!\n exit 1 if stopping?\n stop!\n STDOUT.puts \"Press Ctrl-C again to stop immediately.\"\n end",
"def set_signal_trap\n finalizer = Proc.new { finalize }\n Signal.trap(:INT, finalizer)\n end",
"def handle_interrupt; end",
"def trap_signals\n %w(TERM INT).each do |signal|\n trap(signal) { stop }\n end\n end",
"def kill() end",
"def cancel!; end",
"def register_signals\n trap(:INT) { debug \"Recieved INT\"; exit!}\n end",
"def do_exit\n log \"caught signal, shutting down\"\n self.class.remove_pid_file\n exit 130\n end",
"def signal\n @monitor.mon_check_owner\n @cond.signal\n end",
"def onsig(sig)\n close_screen\n @exit = true\n end",
"def signal_handle\n unless @context.ignore_sigint?\n print \"\\nabort!\\n\" if @context.verbose?\n exit\n end\n\n case @signal_status\n when :IN_INPUT\n print \"^C\\n\"\n raise RubyLex::TerminateLineInput\n when :IN_EVAL\n IRB.irb_abort(self)\n when :IN_LOAD\n IRB.irb_abort(self, LoadAbort)\n when :IN_IRB\n # ignore\n else\n # ignore other cases as well\n end\n end",
"def kill\n signal(\"KILL\", scope: :all)\n cleanup\n end",
"def interrupt_handler\n signal_handler(2)\n end",
"def install_signal_handlers\n trap 'TERM' do do_exit end\n trap 'INT' do do_exit end\n end",
"def trap_signals\n [:INT, :QUIT, :TERM].each do |sig|\n trap(sig) do\n ProcessManager::Log.info \"#{description}: Received #{sig} - setting internal shutting down flag and possibly finishing last run\"\n stop_thread = Thread.new {stop}\n stop_thread.join\n end\n end\n # make sure we do not handle children like the master process\n trap(:CHLD, 'DEFAULT')\n end",
"def trap(sig)\n ::Signal.trap(sig) do\n puts\n puts \"Interrupt! Signals from an interruption are not thread-safe.\"\n \n call_prompt = true\n 3.times do\n print \"Wait for thread-safe break? (y/n): \"\n\n case gets.strip\n when /^y(es)?$/i\n puts \"waiting for break...\"\n app.pq(self, [])\n call_prompt = false\n break\n\n when /^no?$/i\n break\n end\n end\n\n if call_prompt\n call([])\n end\n end\n end",
"def terminate!() end",
"def test_loop(options)\n Snooper.watch options\nrescue Interrupt\n puts # This is where the ^C is on unix\n puts \"Testing over, time for a coffee...\".yellow\nend",
"def stop\n\t\tC.glyr_signal_exit(to_native)\n\tend",
"def capture_signals\n %w[ TERM INT QUIT HUP ].each do |signal|\n Signal.trap(signal) { stop }\n end\n end",
"def handle_interrupt\n case @interrupt\n when :signal\n Process.kill('SIGINT', Process.pid)\n when :exit\n exit(130)\n when Proc\n @interrupt.call\n when :noop\n return\n else\n raise InputInterrupt\n end\n end",
"def keyctrl_d(*)\n @stop = true\n end",
"def user_interrupt\n write 'Terminating' # XXX get rid of this\n stoploop\n end",
"def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end",
"def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end",
"def terminates\n event :failed, command: true, terminal: true\n interruptible\n end",
"def handle_signal(signal)\n case signal.chop #remove new line in the end\n when SIGNALS[:close] #when user going to close the console\n close_console\n when SIGNALS[:clear] #when user going to clear eval stack\n Console.clear_eval\n :continue\n end\n end",
"def handle_signal(signal)\n case signal.chop #remove new line in the end\n when SIGNALS[:close] #when user going to close the console\n close_console\n when SIGNALS[:clear] #when user going to clear eval stack\n Console.clear_eval\n :continue\n end\n end",
"def rescue_interrupt\n `stty icanon echo`\n puts \"\\n Command was cancelled due to an Interrupt error.\"\n end",
"def forced_exit?; @quit > 1 end",
"def test_ask_free_form_sigint\n start_process do\n Prompt.ask('q')\n rescue Interrupt\n @ret.write(Marshal.dump(:SIGINT))\n end\n\n sleep(0.05)\n Process.kill('INT', @pid)\n\n assert_result(\"? q\\n> \", \"^C\\n\", :SIGINT)\n end",
"def quit _signal = :SIGINT\n @networks.each do |network|\n network.transmit :QUIT, 'Got SIGINT?'\n network.disconnect\n end\n\n EventMachine.stop\n end",
"def cancel\n self.break_condition = 1\n end",
"def kill\n sig :KILL\n end",
"def exit!() end",
"def on_int_signal(&block)\n # trap(:INT)\n warn \"Missing implementation 'on_int_signal'\"\n end",
"def handle_signal( signal )\n\t\tself.log.info \"Handling %p signal.\" % [ signal ]\n\t\tcase signal\n\t\twhen :INT, :TERM, :HUP\n\t\t\tself.stop\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def c_quit()\n \tputs \"closing mucs\"\n\tcb = proc { \n\t\tsleep 5\n\t\treturn 1\n\t}\n#\t@muc.each {|chan,mucobj| }\n#\tEventMachine::defer (cb, proc {|r| on_quit(r)})\n\tend",
"def on_exit\n end",
"def signal_received; end",
"def register_signal_handlers\n trap(\"QUIT\") { stop }\n trap(\"INT\") { @stop ? stop! : stop }\n trap(\"TERM\") { stop! }\n end",
"def register_signals\n trap(\"TERM\") { self.bunny.stop }\n trap(\"INT\") { self.bunny.stop }\n end",
"def kill!\n @die = true\n end",
"def shutdown\n @signal_squash.call\n end",
"def kill_captain(signal, cpid)\n logger.debug \"admiral sending #{signal} to #{cpid}\" if $DEBUG\n Process.kill(signal, cpid)\n rescue Errno::ESRCH\n captain = CAPTAINS.delete(cpid) rescue nil\n end",
"def stop\n sig :TERM\n end",
"def stop\n control :kill\n self\n end",
"def pop_interrupt; end",
"def event_sighup()\n _load_registrations\n load_command_methods\n dispatch :log, \"SIG-HUP, controls.rb reloaded\"\nend",
"def local_quit(body)\n ### send notice of disconnection?\n Kernel.exit\nend",
"def signal\n @condition.signal\n true\n end",
"def signal\n @condition.signal\n true\n end",
"def interruptible?; event(:stop).controlable? end",
"def on_quitting\n end",
"def force_quit; @quit = 2 end",
"def shutdown!\n _shutdown 'SIGKILL' unless dead?\n end",
"def signal\r\n Ragweed::Wrap32::set_event(@h)\r\n end",
"def stop!(signal = 'QUIT', in_signal_handler=true)\n shutdown(in_signal_handler=in_signal_handler)\n shutdown_sandboxes(signal, in_signal_handler=in_signal_handler)\n end",
"def detect_interruption\n trap('INT') do\n interrupted!\n puts\n puts 'Hold on, let me finish this file...'\n end\n end",
"def cancel; end",
"def cancel; end",
"def stop\n stop_control_loop\n end",
"def register_signal_handlers!\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n end",
"def stop!; end",
"def trap_signals\n [\"TERM\", \"INT\"].each do |signal|\n trap(signal) do\n @thin_server.stop! if @thin_server\n EM.stop\n end\n end\n end",
"def signal\n @monitor.__send__(:mon_check_owner)\n @cond.signal\n end",
"def terminate() end",
"def push_interrupt(e); end",
"def run_interrupted; end",
"def finally_do\n pause_rt\n put \"put my compendium in my shroud\"\nend",
"def shutdown\n _shutdown 'SIGUSR1' unless dead?\n end",
"def abort\n # only abort once\n self.stop\n\n # assume that the thread has abort_on_exception and it does not rescue non-StandardError\n @thread.raise Abort, \"ABORT #{@subject} watchdog timeout\"\n end",
"def call_cancel_handler; call_handler(:cancel); end"
] | [
"0.66534656",
"0.65227354",
"0.64948726",
"0.63025624",
"0.62676966",
"0.6243309",
"0.6243309",
"0.62404484",
"0.62300026",
"0.6173701",
"0.6061436",
"0.6013525",
"0.59871143",
"0.5986814",
"0.5983193",
"0.596696",
"0.5964279",
"0.5955736",
"0.5937405",
"0.5930841",
"0.5899446",
"0.5898332",
"0.58940494",
"0.5886334",
"0.58578295",
"0.5843629",
"0.5816858",
"0.5816858",
"0.58098507",
"0.58063674",
"0.5803897",
"0.5803442",
"0.5788374",
"0.57770294",
"0.5759943",
"0.575934",
"0.5738535",
"0.5708929",
"0.5689541",
"0.56848717",
"0.56817573",
"0.5677861",
"0.5677537",
"0.5669472",
"0.5655116",
"0.5654259",
"0.5651975",
"0.5646796",
"0.5629996",
"0.56269336",
"0.56264037",
"0.5593642",
"0.5593642",
"0.55757034",
"0.5573025",
"0.5573025",
"0.55721754",
"0.55649155",
"0.5559713",
"0.5553703",
"0.55534315",
"0.5544046",
"0.5536261",
"0.5516274",
"0.5503961",
"0.55004483",
"0.54990757",
"0.549293",
"0.5485931",
"0.54668343",
"0.54570746",
"0.5438109",
"0.541496",
"0.5410616",
"0.5399079",
"0.5397425",
"0.53972",
"0.53881747",
"0.53841573",
"0.53841573",
"0.5381543",
"0.53776556",
"0.5367885",
"0.53629136",
"0.5347185",
"0.53461",
"0.53231233",
"0.5322832",
"0.5322832",
"0.53180295",
"0.53179437",
"0.5312607",
"0.5312249",
"0.5311632",
"0.53054005",
"0.53002584",
"0.52991813",
"0.5298867",
"0.52985543",
"0.5292234",
"0.5283313"
] | 0.0 | -1 |
Call with CtrlZ signal | def reload
restart
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal; end",
"def signal; end",
"def doge_control_signal\r\n end",
"def signal\n end",
"def onCmdPanic(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip, :panic\n @watcher.cmdPanic\n end",
"def interrupt; end",
"def _interrupt\n\t\tbegin\n\t\t\tuser_want_abort?\n\t\trescue Interrupt\n\t\t\t# The user hit ctrl-c while we were handling a ctrl-c, send a\n\t\t\t# literal ctrl-c to the shell. XXX Doesn't actually work.\n\t\t\t#$stdout.puts(\"\\n[*] interrupted interrupt, sending literal ctrl-c\\n\")\n\t\t\t#$stdout.puts(run_cmd(\"\\x03\"))\n\t\tend\n\tend",
"def handle_interrupt\n system \"SIGINT received, starting shutdown\"\n @shutdown = true\n end",
"def signal\n @cmd_result.signal\n end",
"def shutdown\n @signal_squash.call\n end",
"def signal\r\n Ragweed::Wrap32::set_event(@h)\r\n end",
"def trap_exit_signal(signal)\n trap(signal) {\n Serv::Initializer.stop!\n }\n end",
"def keyctrl_d(*)\n @stop = true\n end",
"def interrupt?; end",
"def trap_signals\n Signal.trap('INT') do\n say \"\\nQuitting...\", :red\n Kernel.exit\n end\n end",
"def add_sigint_handler\n trap 'INT' do\n puts '\\nCancelled. Bye Bye!'\n exit!\n end\n end",
"def handle_interrupt; end",
"def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end",
"def handle_signal( signal )\n\t\tself.log.info \"Handling %p signal.\" % [ signal ]\n\t\tcase signal\n\t\twhen :INT, :TERM, :HUP\n\t\t\tself.stop\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend",
"def signal_received; end",
"def pop_interrupt; end",
"def signal_received=(_arg0); end",
"def onCmdReverse(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip\n @watcher.cmdReverse\n end",
"def trap_sigint(metabolizer, &block)\n trap 'SIGINT', proc {\n block.call if block\n metabolizer.stop\n }\nend",
"def trap_signals\n # kill\n trap('INT') do\n puts('INT received')\n notify_subscribers('INT received')\n stop\n end\n\n # kill\n trap('TERM') do\n puts('TERM received')\n notify_subscribers('TERM received')\n stop\n end\n\n # graceful\n trap('QUIT') do\n puts('QUIT received')\n notify_subscribers('QUIT received')\n stop_soft\n end\n\n # reset things\n trap('HUP') do\n puts('HUP received')\n notify_subscribers('HUP received')\n reset\n end\n end",
"def send_vi_exit_nosave\n send_ctrl_escape\n data = \":q!\" + \"\\n\"\n session.shell_write(data)\n end",
"def trap_signals\n Signal.trap(\"TERM\") { stop! }\n Signal.trap(\"INT\") { manual_stop! }\n end",
"def on_quit\n end",
"def register_signals\n trap(:INT) { debug \"Recieved INT\"; exit!}\n end",
"def manual_stop!\n exit 1 if stopping?\n stop!\n STDOUT.puts \"Press Ctrl-C again to stop immediately.\"\n end",
"def on_quitting\n end",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def user_interrupt\n write 'Terminating' # XXX get rid of this\n stoploop\n end",
"def kill_on_ctrl_c(pids, options); end",
"def push_interrupt(e); end",
"def with_repl_like_sigint\n orig_handler = trap(\"INT\") { raise Interrupt }\n yield\n rescue Interrupt\n puts(\"^C\")\n retry\n ensure\n trap(\"INT\", orig_handler)\n end",
"def onsig(sig)\n close_screen\n @exit = true\n end",
"def ctrl_w() send_keys(:ctrl_w) end",
"def process_handling\n return unless open? && active\n process_reset if handle?(:reset) && Input.trigger?(:CTRL)\n super\n end",
"def on_termination_signal( signo )\n\t\tself.log.warn \"Terminated (%p)\" % [ signo ]\n\t\tself.shutdown\n\tend",
"def trap_signals\n %w(TERM INT).each do |signal|\n trap(signal) { stop }\n end\n end",
"def on_exit\n end",
"def kill!() end",
"def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end",
"def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end",
"def handle_signal(signal)\n case signal.chop #remove new line in the end\n when SIGNALS[:close] #when user going to close the console\n close_console\n when SIGNALS[:clear] #when user going to clear eval stack\n Console.clear_eval\n :continue\n end\n end",
"def handle_signal(signal)\n case signal.chop #remove new line in the end\n when SIGNALS[:close] #when user going to close the console\n close_console\n when SIGNALS[:clear] #when user going to clear eval stack\n Console.clear_eval\n :continue\n end\n end",
"def signal_queue; end",
"def force_quit; @quit = 2 end",
"def set_signal_trap\n finalizer = Proc.new { finalize }\n Signal.trap(:INT, finalizer)\n end",
"def shutdown!; end",
"def shutdown!; end",
"def shutdown!; end",
"def cancel!; end",
"def on_shutdown\n\t\tend",
"def register_signals\n trap(\"TERM\") { self.bunny.stop }\n trap(\"INT\") { self.bunny.stop }\n end",
"def kill() end",
"def trap_signals\n trap(\"TERM\") do\n\tself.fatal!(\"TERM received\",1)\n end\n\n trap(\"INT\") do\n\tself.fatal!(\"Interrupt signal received.\", 2)\n end\n end",
"def trap_signals\n trap(\"TERM\") do\n\tself.fatal!(\"TERM received\",1)\n end\n\n trap(\"INT\") do\n\tself.fatal!(\"Interrupt signal received.\", 2)\n end\n end",
"def control_key_up\r\n command 'controlKeyUp'\r\n end",
"def shutdown!\n _shutdown 'SIGKILL' unless dead?\n end",
"def reenable_on_interrupt=(_arg0); end",
"def deActivateKey _args\n \"deActivateKey _args;\" \n end",
"def reenable_on_interrupt; end",
"def noExitWhenQuit(flag = true)\n @device.noExitWhenQuit(flag) ;\n end",
"def stop\n\t\tC.glyr_signal_exit(to_native)\n\tend",
"def trap_shutdown\r\n trap('INT') do\r\n # Marshal.dump @notified_orders_set\r\n File.open(@notified_orders_filename,'w') { |file| Marshal.dump(@notified_orders_set, file) }\r\n\r\n puts \"#{$0} has ended (crowd applauds)\"\r\n exit 0\r\n\r\n end\r\nend",
"def trap_signals\n [:INT, :QUIT, :TERM].each do |sig|\n trap(sig) do\n ProcessManager::Log.info \"#{description}: Received #{sig} - setting internal shutting down flag and possibly finishing last run\"\n stop_thread = Thread.new {stop}\n stop_thread.join\n end\n end\n # make sure we do not handle children like the master process\n trap(:CHLD, 'DEFAULT')\n end",
"def isolate_signals=(_arg0); end",
"def test_loop(options)\n Snooper.watch options\nrescue Interrupt\n puts # This is where the ^C is on unix\n puts \"Testing over, time for a coffee...\".yellow\nend",
"def stop!; end",
"def test_ask_sigint\n start_process do\n begin\n Prompt.ask('q')\n rescue Interrupt\n @ret.write(Marshal.dump(:SIGINT))\n end\n end\n\n sleep(0.05)\n Process.kill('INT', @pid)\n\n assert_result(\"? q\\n> \", \"^C\\n\", :SIGINT)\n end",
"def before_exit\n system 'tput reset; stty icanon; stty echo; clear'\n end",
"def signal_stop\n @stop_requested = true\n end",
"def quit\n send_cmd \"quit\"\n nil\n end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def shutdown; end",
"def signal\n @result.signal\n end",
"def forced_exit?; @quit > 1 end",
"def trap(sig)\n ::Signal.trap(sig) do\n puts\n puts \"Interrupt! Signals from an interruption are not thread-safe.\"\n \n call_prompt = true\n 3.times do\n print \"Wait for thread-safe break? (y/n): \"\n\n case gets.strip\n when /^y(es)?$/i\n puts \"waiting for break...\"\n app.pq(self, [])\n call_prompt = false\n break\n\n when /^no?$/i\n break\n end\n end\n\n if call_prompt\n call([])\n end\n end\n end",
"def register_signal_handlers\n trap(\"QUIT\") { stop }\n trap(\"INT\") { @stop ? stop! : stop }\n trap(\"TERM\") { stop! }\n end",
"def interrupt_handler\n signal_handler(2)\n end",
"def kill\n sig :KILL\n end",
"def signal_handle\n unless @context.ignore_sigint?\n print \"\\nabort!\\n\" if @context.verbose?\n exit\n end\n\n case @signal_status\n when :IN_INPUT\n print \"^C\\n\"\n raise RubyLex::TerminateLineInput\n when :IN_EVAL\n IRB.irb_abort(self)\n when :IN_LOAD\n IRB.irb_abort(self, LoadAbort)\n when :IN_IRB\n # ignore\n else\n # ignore other cases as well\n end\n end",
"def shutdown!\n @gateway&.shutdown!\n sleep 0.5 until !@gateway&.active?\n @gateway = nil\n end",
"def at_exit\n\n\t\tend",
"def on_int_signal(&block)\n # trap(:INT)\n warn \"Missing implementation 'on_int_signal'\"\n end",
"def stopcmd\n end",
"def capture_signals\n %w[ TERM INT QUIT HUP ].each do |signal|\n Signal.trap(signal) { stop }\n end\n end",
"def on_term_signal(&block)\n # trap(:TERM) {}\n warn \"Missing implementation 'on_term_signal'\"\n end",
"def back_main_menu\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend",
"def back_main_menu\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend",
"def delayed_exit\n sleep 0.1\n exit\n end",
"def shutdown\nend",
"def shutdown\n _shutdown 'SIGUSR1' unless dead?\n end",
"def will_quit\n end"
] | [
"0.6227386",
"0.6227386",
"0.6156666",
"0.6150177",
"0.5945292",
"0.58566076",
"0.57252514",
"0.56801915",
"0.567889",
"0.56499046",
"0.56159925",
"0.559462",
"0.5574696",
"0.55651414",
"0.5536165",
"0.5512863",
"0.5481604",
"0.54298174",
"0.542644",
"0.5418715",
"0.53748584",
"0.53681034",
"0.53527725",
"0.534717",
"0.5344774",
"0.5332703",
"0.5308673",
"0.5308436",
"0.5305636",
"0.52943856",
"0.52920544",
"0.5282342",
"0.5277762",
"0.52742773",
"0.5255233",
"0.52500194",
"0.5247923",
"0.52353185",
"0.5220368",
"0.5213373",
"0.51930904",
"0.51927644",
"0.519254",
"0.5190608",
"0.5190608",
"0.5187126",
"0.5187126",
"0.5173714",
"0.5170845",
"0.5163088",
"0.5151703",
"0.5151703",
"0.5151703",
"0.51154095",
"0.50813776",
"0.50805247",
"0.5072717",
"0.50478184",
"0.50478184",
"0.5046307",
"0.5035893",
"0.5019753",
"0.5019357",
"0.5019001",
"0.5012735",
"0.50108325",
"0.5010034",
"0.5007246",
"0.50041974",
"0.5000665",
"0.49979326",
"0.49874514",
"0.49865487",
"0.4975359",
"0.4971099",
"0.4970248",
"0.4970248",
"0.4970248",
"0.4970248",
"0.4970248",
"0.4970248",
"0.4970248",
"0.49670142",
"0.49664617",
"0.496039",
"0.4959859",
"0.49566287",
"0.49546963",
"0.49434364",
"0.49377942",
"0.4933803",
"0.49292448",
"0.4928403",
"0.49242687",
"0.49193054",
"0.49153754",
"0.49153754",
"0.4906216",
"0.49062002",
"0.49051467",
"0.4901202"
] | 0.0 | -1 |
Call on file(s) modifications | def run_on_change(paths = {})
restart
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modified_files(options); end",
"def modified_files(options); end",
"def modified_files; end",
"def on_change(modified, added, deleted)\n # Modifications and additions are treated the same.\n (modified + added).uniq.each do |path|\n if file = Ichiban::ProjectFile.from_abs(path)\n begin\n @loader.change(file) # Tell the Loader that this file has changed\n file.update\n rescue Exception => exc\n Ichiban.logger.exception(exc)\n end\n end\n end\n \n # Deletions are handled specially.\n deleted.each do |path|\n Ichiban::Deleter.new.delete_dest(path)\n end\n \n # Finally, propagate this change to any dependent files.\n (modified + added + deleted).uniq.each do |path|\n begin\n Ichiban::Dependencies.propagate(path)\n rescue => exc\n Ichiban.logger.exception(exc)\n end\n end\n end",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n \n contents = []\n \n file = File.open(file_path, 'r')\n file.each_line do | line |\n contents << line\n end\n file.close\n \n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\nend",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n\n contents = []\n\n file = File.open(file_path, 'r')\n file.each_line do | line |\n contents << line\n end\n file.close\n\n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\nend",
"def process(orig_file)\n end",
"def file_watcher; end",
"def file_watcher; end",
"def changed_files\n @files.each do |file, stat|\n if new_stat = safe_stat(file)\n if new_stat.mtime > stat.mtime\n @files[file] = new_stat\n yield(file)\n end\n end\n end\n end",
"def altered_files\n parse!\n @altered_files\n end",
"def run_on_modifications(paths)\n run(paths) \n end",
"def files_changed(file, event)\n puts motivate\n # return true so that the watch loop keeps running\n return true\n end",
"def change_lines_in_file(file_path, &change)\n print \"Fixing #{file_path}...\\n\"\n\n contents = []\n\n file = File.open(file_path, 'r')\n file.each_line do |line|\n contents << line\n end\n file.close\n\n File.open(file_path, 'w') do |f|\n f.puts(change.call(contents))\n end\n end",
"def source_change(change, filename)\n end",
"def update_modification_time(file)\n MTIMES[file] = File.mtime(file)\n end",
"def replaced_files; end",
"def run_on_change(paths)\n jammit\n end",
"def run_on_change(paths)\n end",
"def reload!\n rotation do |file|\n next unless file_changed?(file)\n reload_special(file) || reload_regular(file)\n end\n end",
"def scan_changed(&block) # :yields: file\n known_files.each do |known_file|\n new_mtime = mtime_for(known_file)\n if new_mtime != last_mtime[known_file]\n block.call(known_file)\n last_mtime[known_file]= new_mtime\n end\n end\n end",
"def update_content(file, relation = :original_file)\n IngestJob.perform_later(wrapper!(file: file, relation: relation), notification: true)\n end",
"def update_file(filename, old, replacement)\n\n#filename = (File.expand_path(filename))\n\n#file_temp = Tempfile.new('temp')\n\nFileUtils.mv(filename, filename + '.temp')\n\nFile.open(filename, 'w') do |line|\n\n IO.foreach(file_temp) do |line_temp|\n line_temp.gsub!(/#{old}/, replacement) if line_temp =~ /#{old}/ \n line << line_temp\n end\n\nend\n\nFileUtils.rm(filename + \".temp\", :force => true)\n\n#file_temp.unlink\n\nend",
"def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end",
"def updated_source_file; end",
"def run_on_changes(paths)\n run(paths)\n end",
"def run_on_changes(paths)\n run_all()\n end",
"def file_finished(file, offenses); end",
"def update!(**args)\n @file = args[:file] if args.key?(:file)\n @function = args[:function] if args.key?(:function)\n @line = args[:line] if args.key?(:line)\n end",
"def change(file)\n @previous = dup if change?(file)\n set(file)\n end",
"def run_on_change(paths)\n copy_all_functions \"Functions have changed, copying over\"\n end",
"def update!(**args)\n @file = args[:file] if args.key?(:file)\n @line = args[:line] if args.key?(:line)\n @function_name = args[:function_name] if args.key?(:function_name)\n end",
"def file_watcher=(_arg0); end",
"def file_watcher=(_arg0); end",
"def edit_file(filename, content, options={})\n end",
"def finished_file(_file, _lints); end",
"def on_other_file; end",
"def run_on_changes(paths)\n restart\n end",
"def update_content(file, relation = :original_file)\n # HELIO-3506 override for tempfiles uploaded via Versioning\n if file.is_a?(Hyrax::UploadedFile)\n IngestJob.perform_later(wrapper!(file: file, relation: relation), notification: true)\n else\n IngestJob.perform_now(wrapper!(file: file, relation: relation), notification: true)\n end\n end",
"def update_content( file, relation = :original_file )\n Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n Deepblue::LoggingHelper.called_from,\n \"user=#{user}\",\n \"file_set.id=#{file_set.id}\",\n \"file=#{file}\",\n \"relation=#{relation}\" ]\n current_version = file_set.latest_version\n prior_revision_id = current_version.label\n prior_create_date = current_version.created\n file_set.provenance_update_version( current_user: user,\n event_note: \"update_content\",\n new_create_date: '',\n new_revision_id: '',\n prior_create_date: prior_create_date,\n prior_revision_id: prior_revision_id,\n revision_id: '' )\n IngestJob.perform_later( wrapper!(file: file, relation: relation), notification: true )\n end",
"def scan_now\r\n # Setup the checks\r\n # ToDo: CRC\r\n checks = {\r\n \t :name => {\r\n :use=>false,\r\n :proc=>Proc.new{ |the_file,stats| the_file.path }\r\n },\r\n :date => {\r\n :use=>false,\r\n :proc=>Proc.new{ |the_file,stats| stats.mtime }\r\n },\r\n :size => {\r\n :use=>true,\r\n :proc=>Proc.new{ |the_file,stats| stats.size }\r\n },\r\n }\r\n checks.each_pair{ |check_name,check|\r\n check[:use] = (@onmodify_checks == check_name) || ( @onmodify_checks.respond_to?( :include? ) && @onmodify_checks.include?( check_name ) )\r\n }\r\n\r\n #Check for add/modify\r\n @directory.rewind\r\n count = 0\r\n @directory.each{ |fname|\r\n file_path = \"#{@directory.path}/#{fname}\"\r\n next if (@name_regexp.respond_to?( :match ) && !@name_regexp.match( fname )) || !File.file?( file_path )\r\n the_file = File.new( file_path )\r\n file_stats = File.stat( file_path )\r\n\r\n saved_stats = @known_file_stats[file_path]\r\n new_stats = {}\r\n checks.each_pair{ |check_name,check|\r\n new_stats[check_name] = check[:proc].call( the_file, file_stats )\r\n }\r\n\r\n\t @known_files.push file_path if !@known_files.include? file_path\r\n\r\n if saved_stats\r\n if @on_modify.respond_to?( :call )\r\n sufficiently_modified = @onmodify_requiresall\r\n saved_stats = @known_file_stats[file_path]\r\n checks.each_pair{ |check_name,check|\r\n stat_changed = check[:use] && ( saved_stats[check_name] != new_stats[check_name] )\r\n if @onmodify_requiresall\r\n sufficiently_modified &&= stat_changed\r\n else\r\n sufficiently_modified ||= stat_changed\r\n end\r\n saved_stats[check_name] = new_stats[check_name]\r\n }\r\n @on_modify.call( the_file, saved_stats ) if sufficiently_modified\r\n end\r\n elsif @on_add.respond_to?( :call ) && (@scanned_once || @onadd_for_existing)\r\n @known_file_stats[file_path] = new_stats\r\n @on_add.call( the_file, new_stats )\r\n count += 1\r\n end\r\n the_file.close\r\n }\r\n\r\n # Check for removed files\r\n if @on_remove.respond_to?( :call )\r\n @known_file_stats.each_pair{ |path,stats|\r\n next if File.file?( path )\r\n stats[:path] = path\r\n @on_remove.call( stats )\r\n @known_file_stats.delete(path)\r\n }\r\n end\r\n\r\n @scanned_once = true\r\n return count\r\n end",
"def file_edit(filename, regexp, replacement)\n Tempfile.open(\".#{File.basename(filename)}\", File.dirname(filename)) do |tempfile|\n File.open(filename).each do |line|\n tempfile.puts line.gsub(regexp, replacement)\n end\n tempfile.fdatasync\n tempfile.close\n stat = File.stat(filename)\n FileUtils.chown stat.uid, stat.gid, tempfile.path\n FileUtils.chmod stat.mode, tempfile.path\n FileUtils.mv tempfile.path, filename\n end\n end",
"def update!(**args)\n @uncommitted_file_changes = args[:uncommitted_file_changes] if args.key?(:uncommitted_file_changes)\n end",
"def update_written(event)\n info \"Update file written to file system: #{File.join(Rails.root, event.payload[:path])} (size: #{event.payload[:size]})\"\n end",
"def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @function_name = args[:function_name] if args.key?(:function_name)\n @line_number = args[:line_number] if args.key?(:line_number)\n end",
"def updated_source_file?; end",
"def patch_file(file, &block)\n filename = \"#{Dir.pwd}/#{file}\"\n if File.exist?(filename)\n contents = IO.read(filename)\n new_contents = block.call(contents.dup)\n if contents != new_contents\n File.open(filename, 'wb') {|f| f.write new_contents}\n mysystem(\"git add #{file}\")\n return true\n end\n end\n false\n end",
"def file_update\n File.rename(file_path,\n File.join(File.dirname(file_path),\n File.basename(file_path).gsub(/_\\d+\\.txt/, \"_#{Time.now.to_i}.txt\")))\n end",
"def modified?; end",
"def handle_moved_file(globed_path, globed_path_stat, file_attr_to_checksum)\n # --------------------- MANUAL MODE\n # check if file name and attributes exist in global file attr map\n file_attr_key = [File.basename(globed_path), globed_path_stat.size, globed_path_stat.mtime.to_i]\n file_ident_info = file_attr_to_checksum[file_attr_key]\n # If not found (real new file) or found but not unique then file needs indexing. skip in manual mode.\n if file_ident_info && file_ident_info.unique\n Log.debug1(\"update content data with file:%s checksum:%s index_time:%s\",\n File.basename(globed_path), file_ident_info.checksum, file_ident_info.index_time.to_s)\n # update content data (no need to update Dir tree)\n $local_content_data_lock.synchronize{\n $local_content_data.add_instance(file_ident_info.checksum,\n globed_path_stat.size,\n Params['local_server_name'],\n globed_path,\n globed_path_stat.mtime.to_i,\n file_ident_info.index_time)\n }\n end\n end",
"def run_on_modifications(paths)\n @builder.notify\n end",
"def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n files.delete(filename)\n next\n end\n if current_mtime != mtime \n updated << filename\n # update the mtime in file registry so we it's only send once\n files[filename] = current_mtime\n puts \"quick_serve: spotted change in #{filename}\"\n end\n end\n QuickServe::Rails::Snapshot.reset if updated != []\n false\n end",
"def on_file(&block)\n @on_file = block\n end",
"def update!(**args)\n @file_contents = args[:file_contents] if args.key?(:file_contents)\n end",
"def modified_at(file, timestamp = nil)\n require 'date'\n time = timestamp ? DateTime.parse(\"#{timestamp}\") : DateTime.now\n timestamp = time.strftime('%Y%m%d%H%M')\n execute(\"/bin/touch -mt #{timestamp} #{file}\")\n end",
"def write_file\n\n # file_edited is false when there was no match in the whole file and thus no contents have changed.\n if file_edited\n backup_pathname = original_pathname + \".old\"\n FileUtils.cp(original_pathname, backup_pathname, :preserve => true)\n File.open(original_pathname, \"w\") do |newfile|\n contents.each do |line|\n newfile.puts(line)\n end\n newfile.flush\n end\n end\n self.file_edited = false\n end",
"def run_commands_for_changed_file(files)\n if files and there_are_test_files_to_run?(files)\n commands = @application.construct_commands_for_changed_files(files)\n @application.run!(commands)\n end\n end",
"def change_names(offset)\n puts \"Changing files...\"\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..' or item == 'numberFix.rb'\n fullname = modify_item(item, offset)\n File.rename(item, fullname)\n end\n puts \"Done.\"\nend",
"def new_files; end",
"def altered_files\n raise NotImplementedError.new(\"altered_files() must be implemented by subclasses of AbstractChangeset.\")\n end",
"def run_file(changed_file)\n continuous_test_server.rerun_strategy(changed_file.name)\n end",
"def modified?(file)\n @mutex.synchronize do\n @data[file.to_s].modified?(file)\n end\n end",
"def can_modify\n write_file( @output, read_file(@message).gsub(/[ ]/, \" modified text \") )\n end",
"def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end",
"def update_info_from_file()\n @ole.UpdateInfoFromFile()\n end",
"def update_filepath(_package_id:, _filepath:, _sha1:, _size:); end",
"def on_modified(&block)\n #raise \"Not implemented\"\n @on_modified_block = block\n end",
"def on_file_changed(content, out, path)\n SpacewalkHtmlClean.generate_diff(content, out, path)\n end",
"def lex\n file_beg_changed\n notify_file_beg_observers(@file_name)\n\n super\n\n file_end_changed\n notify_file_end_observers(count_trailing_newlines(@original_file_text))\n end",
"def cmd_after_replace(file, lineno, content, cmd)\n change_line(file, lineno, content)\n cmd\n end",
"def notify_file_mv(src, dst)\r\n notify_file_cp(src, dst)\r\n notify_file_rm(src)\r\n end",
"def act_on(directory, file)\n raise NotImplementedError.new('act_on not implemented')\n end",
"def rebuild(event)\n info \"Rebuilding updates from file system\"\n end",
"def altered_files; raw_changeset.files; end",
"def run_on_change(paths)\n perform\n end",
"def execute(\n target_file_path:,\n rewrite: false\n )\n source_code = File.read(target_file_path)\n new_source_code = process(source_code)\n\n if rewrite\n File.write(target_file_path, new_source_code)\n else\n puts new_source_code\n end\n\n nil\n end",
"def update_file(path, &block)\n original_mtime = File.exist?(path) ? File.mtime(path) : Time.at(0)\n new_time = original_mtime + 1\n File.open(path, 'w', &block)\n File.utime(new_time, new_time, path)\n end",
"def update!\n if canonical_file.exist?\n if file.mtime > canonical_file.mtime\n save!\n end\n else\n save!\n end\n end",
"def update_content(file, preferred, relation = :preservation_master_file)\n IngestJob.perform_later(wrapper!(file: file, relation: relation, preferred: preferred), notification: true)\n end",
"def test_stat_modifications\n @client.write(@file, '')\n\n [0745, 0600, 0443].each do |mode|\n @client.chmod(@file, mode)\n assert_equal mode, @client.stat(@file, refresh: true).mode\n end\n end",
"def run_on_change(paths)\n UI.info \"Functions have changed, copying over\"\n ::Forge::Guard.builder.clean_functions\n ::Forge::Guard.builder.copy_functions\n ::Forge::Guard.builder.clean_includes\n ::Forge::Guard.builder.copy_includes\n end",
"def run_on_changes(_)\n restart\n end",
"def update(files)\n reset_variables\n\n files.each do |filename|\n @files_processed[filename] = false\n @errors = false\n if File.file?(filename)\n begin\n temp_file = Tempfile.new('closed_courseware')\n @@current_filename = filename\n\n File.open(filename, 'r+') do |file|\n file.each_line do |line|\n begin\n line = https_it(line)\n\n temp_file.puts line\n rescue\n @errors = true\n end\n end\n end\n\n FileUtils.mv(temp_file.path, filename)\n temp_file.close\n temp_file.unlink\n\n if !@errors\n @files_processed[filename] = true\n end\n ensure\n temp_file.close\n temp_file.unlink\n end\n end\n end\n end",
"def set_modify_time(new_modify_time)\r\n File.utime(access_time, new_modify_time, file_path)\r\n end",
"def process_mods_file(mods_file, druid)\n compare_mods_to_template(mods_file, druid)\n @data[druid] = mods_file.transform_mods_file if @analysis_only == false\n end",
"def reformatFile(theArgs, theFile)\n\n\t# Get the state we need\n\toldContent = File.read(theFile);\n\toldCache = getContentCache(oldContent);\n\n\n\t# Reformat the file\n\t#\n\t# Our cache maintains the checksum of reformatted files.\n\t#\n\t# We assume that a file whose checksum exists in the cache\n\t# contains content that has already been reformatted.\n\tif (!File.exist?(oldCache))\n\t\t# Reformat the file\n\t\tnewContent = reformattedFile(theArgs, theFile);\n\t\tnewCache = getContentCache(newContent);\n\n\t\tif (newContent.empty? && !oldContent.empty?)\n\t\t\tputs \"Skipping #{theFile}, clang-format failed!\";\n\n\t\telse\n\t\t\t# Rewrite the file\n\t\t\tif (theArgs[:rewrite])\n\n\t\t\t\tif (newContent != oldContent || !File.exist?(newCache))\n\t\t\t\t\tputs \"Reformatted #{theFile}\";\n\t\t\t\t\tFile.write(theFile, newContent);\n\t\t\t\t\tFileUtils.mkdir_p( newCache);\n\t\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t# Or display it\n\t\t\telse\n\t\t\t\tputs newContent;\n\t\t\tend\n\t\tend\n\t\n\tend\n\nend",
"def watch(&block)\n\n # Startup File Watcher\n script_changed = lambda { |modified, added, removed|\n\n @log.debug \"File(s) changed! - #{modified.join(\", \")}\" unless (modified.nil? || modified.empty?)\n @log.debug \"File(s) added! - #{added.join(\", \")}\" unless (added.nil? || added.empty?)\n @log.debug \"File(s) removed! - #{removed.join(\", \")}\" unless (removed.nil? || removed.empty?)\n\n block.call(modified, added, removed)\n }\n\n pig_listener = Listen.to(@project_root_path,\n :ignore => /(^\\..*$|logs.*)/)\n\n pig_listener.change(&script_changed)\n pig_listener.start\n\n\tend",
"def file_changed(f)\n if !MrBucket.exists?(f)\n return true\n end\n local_time = open(f).mtime\n live_time = Time.parse(MrBucket.find(f).about[:\"last-modified\"])\n return local_time > live_time\nend",
"def apply_diff(diff)\n diff.deltas.each do |d|\n case d.status\n when :deleted\n remove_file(d.new_file[:path])\n File.delete(File.join(path, path))\n when :added, :modified\n add_file(d.new_file[:path])\n when :renamed\n remove_file(d.old_file[:path])\n File.delete(File.join(path, path))\n add_file(d.new_file[:path])\n else\n logger.warn(\"File has a status of #{d.status}\")\n end\n end\n end",
"def make line_to_change, phrase_we_have_now, phrase_we_want_to_have, file_path\n verbose = $conf[:verbose]\n if verbose\n puts \"\\e[39m-----------------------------\"\n puts \"I'm changing:\\n#{phrase_we_have_now}\"\n puts '-----------------------------'\n puts \"to:\\n#{phrase_we_want_to_have}\"\n puts '-----------------------------'\n end\n\n #Change every occurence\n puts \"in file:\\n#{file_path}\" if verbose\n data = File.read(file_path)\n puts \"\\n\\e[31m++Old version: \\e[30m\\n\" if verbose\n puts data + \"\\n\" if verbose\n\n line_changed = line_to_change.gsub(phrase_we_have_now, phrase_we_want_to_have)\n data.sub! line_to_change, line_changed\n\n puts \"\\n\\e[32m++New version: \\e[30m\\n\" if verbose\n puts data + \"\\n\" if verbose\n puts \"\\e[31mOld line:\\n #{line_to_change}\\e[32m\\nNew line:\\n#{line_changed}\\e[30m\" #Standard info. verbose = true -> shows all file\n #Write the file\n res = false\n res = File.open(file_path, \"w\") do |f|\n f.write(data)\n end\n if res\n return true\n end\n false\n end",
"def changed_files\n until @changed.empty?\n descriptor = @changed.shift\n file = @watcher.watch_descriptors.delete(descriptor)\n watch(file)\n yield(file)\n end\n end",
"def update\n @mtime = File.mtime(path)\n end",
"def retrack_everything()\n\t\tputs \"******************* START RETRACKING ********************\"\n\t\t@files.each{ |number, file|\n\t\t\tputs \"#{number}. Processing \\\"#{file}\\\"...\"\n\t\t\ttagger = ID3Tagger.new( @tag )\n\n\t\t\t# special cases for track renumbering\n\t\t\tif( @renumber )\n\t\t\t\ttagger.track_number = transform_track_number( number )\n\t\t\tend\n\n\t\t\tif( @tag.title )\n\t\t\t\ttagger.title = transform_meta_chars( @tag.title, number )\n\t\t\tend\n\n\t\t\tif @preserve\n\t\t\t\t# preserve file times\n\t\t\t\tatime = File.stat( file ).atime\n\t\t\t\tmtime = File.stat( file ).mtime\n\t\t\tend\n\n\t\t\t# tag the track\n\t\t\ttagger.tag( file )\n\n\t\t\tif @preserve\n\t\t\t\t# preserve file times\n\t\t\t\tFile.utime( atime, mtime, file )\n\t\t\tend\n\t\t}\n\n\t\tputs \"\\t...done.\"\n\t\tputs \"******************* FINIS RETRACKING ********************\"\n\tend",
"def edit_file(opts = {})\n File.open(opts[:file]) do |f|\n invoke_editor(f.path, opts[:line], opts[:blocking])\n @content = File.read(f.path)\n end\n end",
"def new_file?(file_handle, stat)\n # seek to 0\n Snoopit.logger.debug 'FileTracker.updated? file new read from start of file: ' + @file\n @offset = 0\n @size = stat.size\n @mtime = stat.mtime\n @last_line = nil\n file_handle.seek 0, IO::SEEK_SET\n true\n end",
"def commit_modified_files_task\n really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split(\"\\n\")\n if really_modified.any?\n really_modified.each { |file| sh git, 'add', file }\n sh git, 'commit', '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end\n end",
"def file_changed?(file)\n file_new?(file) || File.mtime(file) > MTIMES[file]\n end",
"def record_modification_timestamp(path, timestamp)\n File.utime(timestamp, timestamp, path)\n record_access_timestamp(path, timestamp)\n record_changed_timestamp(path, timestamp)\n end",
"def update(uploaded_file)\n _set(uploaded_file)\n end",
"def run_on_changes(paths)\n if options[:all_on_change]\n paths = Watcher.match_files(self, Dir.glob('**{,/*/**}/*').uniq.compact)\n end\n paths = paths.select {|path| not options[:exclude] =~ path and File.file? path}\n\n directories = detect_nested_directories(watchers, paths, options)\n written = []\n\n directories.each do |directory, files|\n files.each do |file|\n begin\n act_on(directory, file)\n written << file\n rescue Exception => e\n error(e.message, file)\n throw :task_has_failed\n end\n end\n end\n if written.length > 0\n notify(written)\n end\n end"
] | [
"0.72283614",
"0.72283614",
"0.7162714",
"0.69458354",
"0.6847766",
"0.6808504",
"0.6670028",
"0.6489144",
"0.6489144",
"0.6477731",
"0.6453445",
"0.6439013",
"0.64367425",
"0.6427774",
"0.6408381",
"0.6404536",
"0.6350342",
"0.6317544",
"0.631484",
"0.6302051",
"0.6300315",
"0.6298877",
"0.62339026",
"0.62300205",
"0.62031645",
"0.61496097",
"0.61453736",
"0.6114877",
"0.61139053",
"0.61128914",
"0.61034995",
"0.6098467",
"0.609608",
"0.609608",
"0.60665935",
"0.60646886",
"0.6064091",
"0.60564333",
"0.6043438",
"0.60398376",
"0.60159594",
"0.60064316",
"0.59988785",
"0.5993194",
"0.5968698",
"0.59686184",
"0.59526926",
"0.5931704",
"0.592324",
"0.5922672",
"0.59219664",
"0.59085226",
"0.59004825",
"0.58943176",
"0.58925414",
"0.58916676",
"0.58816135",
"0.58771646",
"0.5866219",
"0.58513457",
"0.5850741",
"0.584961",
"0.5846067",
"0.58448726",
"0.5835724",
"0.58352673",
"0.5829746",
"0.5827958",
"0.5825961",
"0.58173466",
"0.5808599",
"0.58066815",
"0.58012015",
"0.57904625",
"0.5786508",
"0.5781024",
"0.5774259",
"0.5759555",
"0.5759542",
"0.5758435",
"0.57525516",
"0.57447505",
"0.5730434",
"0.57252",
"0.5724947",
"0.5707518",
"0.57030493",
"0.5698878",
"0.56981105",
"0.5692782",
"0.5690754",
"0.5681261",
"0.56805265",
"0.56631964",
"0.5654692",
"0.5648454",
"0.5645289",
"0.56401515",
"0.5638404",
"0.56341606"
] | 0.5685971 | 91 |
Called when accepting invitation should return an instance of resource class | def accept_resource
resource = resource_class.accept_invitation!(update_resource_params)
SubscriptionService.new(account).update_subscription
resource
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_resource\n resource_class.accept_invitation!(update_resource_params)\n resource\n end",
"def accept_resource\n resource = resource_class.accept_invitation!(update_resource_params)\n if resource.is_a?(Admin)\n OnboardingMailer.admin_onboarding(resource).deliver_later\n elsif resource.is_a?(Mentor)\n OnboardingMailer.mentor_onboarding(resource).deliver_later\n elsif resource.is_a?(Client)\n OnboardingMailer.client_onboarding(resource).deliver_later\n end\n resource\n end",
"def accept_resource\n # resource = resource_class.accept_invitation!(update_resource_params)\n # ## Report accepting invitation to analytics\n # Analytics.report('invite.accept', resource.id)\n # resource\n end",
"def accept_resource\n resource_class.accept_invitation!(update_resource_params)\n ## Report accepting invitation to analytics\n \n end",
"def accept_resource\n resource = resource_class.accept_invitation!(update_resource_params)\n @user = User.find(resource.invited_by_id)\n resource.company_id = @user.company.id\n resource.save\n resource\n end",
"def accept_invitation\n \n end",
"def resource_class\n return params.dig(:invitation, :type).constantize if params.dig(:invitation, :type).present?\n\n super\n end",
"def invite_resource\n ## skip sending emails on invite\n u = resource_class.invite!(invite_params, current_inviter) do |u|\n u.skip_invitation = true\n u.invitation_sent_at = DateTime.now\n end\n flash[:link] = accept_user_invitation_url(:invitation_token => u.raw_invitation_token)\n u\n end",
"def create\n self.resource = User.find_by(email: params[:user][:email]) || invite_resource\n\n # Set roles, whether they are a new user or not\n # safe because adding the same role twice is a noop\n site = Site.instance\n if params[:user][:roles].present?\n params[:user][:roles].split(',').each do |role|\n resource.add_role(role.strip, site)\n end\n end\n # end of override code\n\n yield resource if block_given?\n\n # Override destination as this was a success either way\n if is_flashing_format? && resource.invitation_sent_at\n set_flash_message :notice, :send_instructions, email: resource.email\n end\n if method(:after_invite_path_for).arity == 1\n respond_with resource, location: after_invite_path_for(current_inviter)\n else\n respond_with resource, location: after_invite_path_for(current_inviter, resource)\n end\n end",
"def build_resource(*)\n super\n resource.build_from_invitation(@invitation) if @invitation && action_name == 'create'\n end",
"def invite_resource(&block)\n resource_class.invite!(invite_params, current_inviter, &block) \n end",
"def accept_contact_invitation(invitation)\n _sender = invitation.sender\n _sender.facilities.create(name: self.name, access: 'r--', consumer_ids: [self._id])\n _sender.save!\n # create UserEvent to sender's timeline\n create_user_event_to_sender(invitation)\n end",
"def resource_from_invitation_token\n unless params[:invitation_token] &&\n self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)\n\n redirect_to root_path(error: :invalid_invitation_token)\n end\n end",
"def invite_resource\n resource_class.invite!(invite_params, current_inviter) do |invitable|\n invitable.company_id = current_user.company_id\n invitable.is_admin = true\n invitable.require_email = true\n invitable.save\n end\n end",
"def accept!()\n self.status = Invite::Status::ACCEPTED\n invitable.add_member invitee\n save!\n end",
"def accept invitation\n @logger.log(BEFORE_ACCEPT_INVITATION)\n parsed_response = get_and_parse \"/api/invitations/#{invitation[\"id\"]}/accept\"\n game_id = parsed_response[\"body\"][\"game_id\"]\n @logger.log(AFTER_ACCEPT_INVITATION, \"Created game #{game_id}\")\n game_id\n\n #response = self.class.post \"/api/invitations/#{invitation[\"id\"]}/accept\"\n\n #raise response.inspect unless response.parsed_response['status'] == 'success'\n\n #response.parsed_response[\"body\"]\n end",
"def create\n resource = find_resource\n organizer = resource.organizers.new(resource_params)\n organizer.created_by_id = current_user_id\n organizer.organizer_id = current_user_id # to skip user validation\n\n # we are not saving the organizer yet, just checking that it's valid\n validation_error!(organizer.errors.messages) if organizer.invalid?\n\n klass = Models::V1::Invite.class_factory(organizer.class)\n invite_params = params\n .require(self.class.resource_param)\n .permit(klass.column_names)\n\n invite = klass.new(invite_params)\n invite.send(:\"#{ self.class.resource_params_key }=\", resource.id)\n invite.created_by_id = current_user_id\n\n invite.save!\n\n # no way this is right\n options = {\n include: permittable_read_includes(params[:id])\n }\n\n render \\\n json: Service::V1::UserResourceView.factory(invite, current_user)\n .as_json(options),\n status: 201\n end",
"def update\n inviter_mail = resource_params.delete \"invitermail\"\n \n accepted_inviter = resource_class.to_adapter.find_first(email: inviter_mail)\n \n # before inviting person gets credit for the new user: check if he is\n # really allowed to claim. Only certain vip users are allowed...\n if accepted_inviter && accepted_inviter.ability.can?(:invite, resource_class)\n self.resource = resource_class.accept_invitation!(resource_params) \n resource.invited_by = accepted_inviter\n else\n ## No discussion. User didn't have the right to invite, so show...\n flash[:error] = I18n.t(\"devise.invitations.no_authorized_inviter\")\n raise CanCan::AccessDenied\n end\n\n if resource.errors.empty?\n flash_message = resource.active_for_authentication? ? :updated : :updated_not_active \n set_flash_message :notice, flash_message\n sign_in(resource_name, resource)\n respond_with resource, :location => after_accept_path_for(resource)\n else\n respond_with_navigational(resource){ render :edit }\n end\n end",
"def accept_invitation(invite)\n self.invitation= invite\n self.validation_level = invite.validation_level\n self.invitation_code = invite.code\n end",
"def accept! = self.user.create_accepted_request",
"def new\n @invitation = Invitation.new\n respond_with(@invitation)\n end",
"def new\n @invitation = Invitation.new\n end",
"def new\n @invitation = Invitation.new\n end",
"def accept(invitation)\n invitation.update_attribute(:accepted, true)\n end",
"def create\n build_resource sign_up_params\n\n resource.save\n yield resource if block_given?\n if resource.persisted?\n if resource.active_for_authentication?\n set_flash_message! :notice, :signed_up\n sign_up resource_name, resource\n if invitation_param && invitation_param != ''\n invitation = Invitation.find_by(token: invitation_param)\n invitation.update! user: current_user\n end\n if participate_param && participate_param != ''\n game = Game.find_by(id: participate_param)\n Invitation.create! user: current_user, game: game if game\n end\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n set_flash_message! :notice,\n :\"signed_up_but_#{resource.inactive_message}\"\n expire_data_after_sign_in!\n respond_with resource,\n location: after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n @title = \"Editing #{@invitation.guest.name}\"\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to @invitation, success: 'Invitation was successfully created.' }\n format.json { render json: @invitation, status: :created, location: @invitation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept_invite3\n # find the invitation\n @invitation = Invitation.find_by_verify_email_token(params[:token])\n duplicate_accept_invite = false\n\n # has the invitation already been accepted?\n if @invitation.status.eql?('accepted')\n duplicate_accept_invite = true\n @invitation.accept_count += 1\n @invitation.save\n else\n @invitation.update_attributes(:status => 'accepted')\n end\n # do we know the invitee?\n @person = People.where(\"email => ? AND status => ?\", @invitation.invitee_email, 'active_mobile').first\n if @person\n create_relationships(@invitation)\n end\n end",
"def invite_resource\n ## skip sending emails on invite\n # super do |u|\n # u.skip_invitation = true\n # end\n end",
"def accept_invite2\n # find the invitation\n @invitation = Invitation.find_by_verify_email_token(params[:token])\n duplicate_accept_invite = false\n\n # has the invitation already been accepted?\n if @invitation.status.eql?('accepted')\n duplicate_accept_invite = true\n @invitation.accept_count += 1\n @invitation.save\n else\n if @invitation.accept_count.blank?\n @invitation.accept_count = 1\n end\n @invitation.update_attributes(:status => 'accepted')\n end\n # do we know the invitee? is used in the view to customize the msg \n @person = Person.where(\"email = ? AND status = 'active_mobile'\", @invitation.invitee_email).first\n\n end",
"def invitation\n InvitationSerializer.new(object.invitation, { :scope => scope, :root => false })\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n @invitation.user = @user\n @invitation.initialize_code\n @invitation.save\n Notifier.invitation_notification(@invitation).deliver\n respond_with(@invitation)\n end",
"def accept_invite(requestor_id)\n respond_to_invite(requestor_id, true)\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n @user = current_user\n @title = @user.name\n UserMailer.reseller_added(@invitation).deliver\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to(@invitation, :notice => 'Thank you, your invitation has been sent.') }\n format.xml { render :xml => @invitation, :status => :created, :location => @invitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @invitation = Invitation.find_by_token(params[:invite_code])\n \n if @invitation\n @contest_instance = @invitation.contest_instance\n\n if @invitation.is_accepted?\n flash[:notice] = \"You have already accepted the invitation for the '#{@contest_instance.name}' contest.\"\n redirect_to contest_participants_path(:contest => @contest_instance.contest.permalink,\n :role => @contest_instance.role_for(current_user),\n :contest_id => @contest_instance.permalink,\n :uuid => @contest_instance.uuid)\n return\n end\n participation = Participation.new(:user_id => current_user.id,\n :contest_instance_id => @contest_instance.id,\n :invitation_id => @invitation.id,\n :active => true)\n\n if participation.save\n flash[:notice] = \"You have now successfully accepted the invitation and joined the '#{@contest_instance.name}' contest.\"\n redirect_to contest_participants_path(:contest => @contest_instance.contest.permalink,\n :role => @contest_instance.role_for(current_user),\n :contest_id => @contest_instance.permalink,\n :uuid => @contest_instance.uuid)\n else\n raise \"Failed to accept invitation with invite code: \" + params[:invite_code]\n redirect_to pending_invitations_path(\"championship\")\n end\n else\n raise \"Failed to find invitation with invite code: \" + (params[:invite_code] ? params[:invite_code] : \"nil\")\n redirect_to pending_invitations_path(\"championship\")\n end\n end",
"def invite\n invitation_service.invite(invitation_params)\n end",
"def accept\n self.status = :accepted\n self.group.add_members(self.receiver, self.role, :was_invited, self.sender)\n self.save\n end",
"def accept\n user = User.find_by(email: @invitation.email)\n if current_user == user\n @invitation.accept!(user.id)\n flash[:notice] = \"Invitation accepted!\"\n redirect_to admins_events_path\n else\n redirect_to admins_event_event_registrations_path, alert: \"Ups! Action not allowed for this user.\"\n end\n end",
"def accept_invitation_existing_user\n # find and update the invitation\n @invitation = Invitation.find_by_verify_email_token(params[:token])\n @invitation.update_attributes(:status => \"accepted\")\n # find the two people\n @invitor = Person.where(:email => @invitation.requestor_email, :status => 'active mobile').order('updated_at DESC').first!\n @invitee = Person.where(:email => @invitation.email, :status => 'active mobile').order('updated_at DESC').first!\n # create the first person_connection \n @invitor.person_connections.build(:person_a_id => self, :person_b_id => @invitee.id,\n :category => @invitation.category, :invitation_id => @invitation.id, :status => 'active')\n # create the second (reverse) person_connection \n @invitee.person_connections.build(:person_a_id => self, :person_b_id => @invitor.id,\n :category => @invitation.category, :invitation_id => @invitation.id, :status => 'active')\n if @invitor.save && @invitee.save \n # redirect_to \"PetOwner://epetfolio/%{token}\"\n redirect_to \"PetOwner://epetfolio/accepted_invite_known_user\"\n else \n logger.error(\"Error accepting f&f invitation\")\n end\n end",
"def create\n @invite = Invite.new(params[:invite])\n @user = current_user\n @user.invites << @invite\n @candidate = current_user.candidate\n @invites = Invite.scoped\n respond_to do |format|\n if @user.save\n InviteMailer.invite_friend(@invite, @user).deliver\n format.html { redirect_to new_invite_path, notice: \"Invitation was successfully sent to #{@invite.name} <#{@invite.email}>\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invitation = Invitation.new(invitation_params)\n @invitation.inviter = current_user\n @invitation.token = Digest::SHA1.hexdigest([@invitation.sender_id, Time.now, rand].join)\n @team = Team.find(@invitation.sender_id)\n receiver = User.find_by_email(@invitation.email)\n if receiver\n @invitation.receiver_id = receiver.id\n end\n respond_to do |format|\n if @invitation.save\n if receiver\n UserMailer.existing_user_invite_email(@invitation).deliver_now\n message = 'Invitation sent to existing user'\n else\n UserMailer.new_user_invite_email(@invitation, new_user_registration_path(:invitation_token => @invitation.token)).deliver_now\n message = 'Invitation sent to new user'\n end\n format.html { redirect_to @team, notice: message }\n format.json { render :show, status: :created, location: @invitation }\n else\n format.html { render :new }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n\n respond_to do |format|\n if @invitation.save\n\t #sending change password email through Resque\n Resque.enqueue(InvitationNotificationWorker, current_user.id, @invitation.id )\n flash[:notice] = 'Your invitation was sent successfully.' unless request.xhr?\n format.html {\n render :action=>\"thanks\", :layout=>false and return if request.xhr?\n redirect_to thanks_new_invitation_url and return\n }\n format.xml { head :created, :location => invitation_url(@invitation) }\n else\n format.html {\n render :action => \"new\", :layout=>false and return if request.xhr?\n render :action => \"new\" and return\n }\n format.xml { render :xml => @invitation.errors.to_xml }\n end\n end\n end",
"def create\n validate_save_and_respond(change_set_class.new(resource_class.new), :new)\n end",
"def accepted_by(user)\n return false unless self.active?\n # assign user to startup unless they are already part of a startup\n relationship_role = nil\n\n if self.invite_type == Invite::TEAM_MEMBER\n user.startup_id = self.startup_id if !self.startup_id.blank? or !user.startup_id.blank?\n user.set_account_type(:entrepreneur)\n # Bypass forcing user to setup account if they were invited from startup that is setup, also don't suggest startups\n user.setup_complete! if self.startup.account_setup?\n elsif self.invite_type == Invite::STARTUP\n user.set_account_type(:entrepreneur)\n relationship_role = :startup_startup\n elsif self.invite_type == Invite::MENTOR || self.invite_type == Invite::NREDUCE_MENTOR # Add user as mentor to startup\n user.set_account_type(:mentor)\n user.roles << :nreduce_mentor if self.invite_type == Invite::NREDUCE_MENTOR\n relationship_role = :startup_mentor\n elsif self.invite_type == Invite::INVESTOR\n user.set_account_type(:investor)\n relationship_role = :startup_investor\n end\n\n # Add user to startup if invite came from startup\n if !self.startup.blank? and !relationship_role.blank?\n r = Relationship.start_between(user, self.startup, relationship_role, true)\n if r.blank?\n self.errors.add(:user_id, 'could not be added to startup')\n else\n self.errors.add(:user_id, 'could not be added to startup') unless r.approve!\n end\n end\n \n if user.save\n self.to = user\n self.accepted_at = Time.now\n self.save\n else\n false\n end\n end",
"def create\n build_resource(sign_up_params)\n if resource.save\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n else\n clean_up_passwords resource\n if resource.errors[:email].include?(I18n.t(\"errors.messages.taken\"))\n user = User.where(email: resource.email).first\n if user.active_for_authentication?\n # Send mail that already registered and ready to log in\n user.already_active_user_mail\n elsif user.invitation_token.nil?\n # Is not invited yet? tell him that he is already on the\n # waiting list\n user.already_waiting_mail\n else\n # Probably didn't get the invitation mail. Resend!\n user.re_invite!(:selfrequest)\n end\n resource.errors.clear\n end\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n end",
"def update\n raw_invitation_token = update_resource_params[:invitation_token]\n self.resource = accept_resource\n\n invitation_accepted = resource.errors.empty?\n\n yield resource if block_given?\n\n if invitation_accepted\n if Devise.allow_insecure_sign_in_after_accept\n flash_message = resource.active_for_authentication? ? :updated : :updated_not_active\n set_flash_message :notice, flash_message if is_flashing_format?\n sign_in(resource_name, resource)\n respond_with resource, location: after_accept_path_for(resource)\n else\n set_flash_message :notice, :updated_not_active if is_flashing_format?\n respond_with resource, location: new_user_session_path\n end\n else\n resource.invitation_token = raw_invitation_token\n respond_with_navigational(resource) { render :edit }\n end\n end",
"def accept(user)\r\n self.accepted_at = Time.now\r\n self.new_user_id = user.id\r\n self.save!\r\n self.user.add_friend(self.new_user)\r\n self.new_user.add_friend(self.user)\r\n InvitationMailer.deliver_user_accepted_invitation(self)\r\n end",
"def create\n @member=current_member\n @invitation=Invitation.new(params[:invitation])\n \n \n respond_to do |format|\n if @invitation.save\n @myevent.invitations << @invitation\n \n format.html { redirect_to event_invitations_path, :notice => 'Invitation was successfully sent to your friends email address.' }\n format.json { render :json => @invitation, :status => :created, :location => @invitation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @invitation = Invitation.new(event: Event.find(params[:event_id]), user: User.new)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end",
"def create\n @invitation = Invitation.new(invitation_params)\n @invitation.sender = current_user\n\n# respond_to do |format|\n if @invitation.save\n\n if signed_in?\n UserMailer.invitation(@invitation, signup_url(@invitation.token)).deliver\n\n format.html { redirect_to current_user, notice: 'Thank you, invitation sent.' }\n format.json { render :show, status: :created, location: @invitation }\n else\n flash[:notice] =\"申请已接受,一旦受理将及时邮件反馈您!\"\n redirect_to root_path\n end \n\n\n else\n format.html { render :new }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n# end\n end",
"def create\n #create the guest\n @guest = Guest.new(guest_params)\n\n #save the guest and create the invitation\n if @guest.save\n @inv = Invitation.new()\n @inv.guest_id = @guest.id\n @inv.event_id = Event.find_by(id:request.headers['EventId'].to_s).id\n @inv.user_id = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).id\n else\n render json: @guest.errors, status: :unprocessable_entity\n end\n\n #save the invitation and return the guest\n if @inv.save\n render json: @guest, status: :created, location: @guest\n else\n render json: @inv.errors, status: :unprocessable_entity\n end\n end",
"def acceptEvent\n signedin\n @n = Notification.find_by(id: params[:id])\n if @n != nil && current_user.id == @n.user_id\n @user = User.find_by(id: @n.user_id)\n @event = Event.find_by(id: @n.sender_id)\n @a = @event.attendings.build(:event_id => @event.id, :user_id => @user.id)\n @a.save\n @n.destroy #delete notification after\n # send user confirmation that their event invite was accepted\n @notification = User.find_by(id: @event.user_id).notifications.build(:user_id => @event.user_id, :title => 'Event Invite Accepted', :desc => getName(@event.user_id, @user.id) + ' has accepted your invitation to ' + @event.name + '.', :sender_id => @event.id, :notification_type => 4)\n @notification.save\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Invite accepted.' }\n format.json { head :no_content }\n end\n else\n redirect_to notifications_url\n end\n end",
"def create\n logger.info('~log_invite: ' + invite_params.to_s)\n logger.info('~log_invite: ' + invite_params['reciever'])\n @invite = Invite.new(invite_params)\n @invite.sender = current_user.email\n @invite.accepted = false\n\n # check if target exists?\n invite_old = Invite.find_by(sender: current_user.email, reciever: invite_params['reciever'])\n invite_back = Invite.find_by(reciever: current_user.email, sender: invite_params['reciever'])\n\n logger.info('~log_no_old: ' + invite_old.nil?.to_s)\n logger.info('~log_no_back: ' + invite_back.nil?.to_s)\n\n ok = true\n\n ok = @invite.save if invite_old.nil?\n\n unless invite_back.nil?\n invite_back.accepted = true\n ok = (invite_back.save && ok)\n if invite_old.nil?\n @invite.accepted = true\n ok = (@invite.save && ok)\n else\n invite_old.accepted = true\n ok = (invite_old.save && ok)\n end\n end\n\n respond_to do |format|\n if ok\n format.html # { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept_invite(event)\n invite = Invite.where(user: self, event: event)\n invite.accept if invite.present?\n end",
"def create\n @invitation = Invitation.new(params[:invitation].merge(:inviter_id => current_user.id))\n\n begin\n @invitation.save\n redirect_to( @invitation, :notice => 'Invitation was successfully created.' )\n rescue Exception => e\n flash[:error] = e.message\n render :action => \"new\"\n end\n end",
"def create\n if resource.active_invitation? && !resource.new_record?\n # The user record already existed\n if resource.update(sign_up_params)\n resource.accept_invitation\n\n # Follow the standard Devise logic to sign in\n set_flash_message! :notice, :signed_up\n sign_up(resource_name, resource)\n respond_with resource, location: after_sign_up_path_for(resource)\n else\n # Follow the standard Devise failed registration logic\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end\n elsif !Rails.configuration.x.recaptcha.enabled || verify_recaptcha(action: 'register')\n\n # Devise doesn't set a flash message for some reason if its going to fail\n # so do it here\n super do |user|\n flash[:alert] = _('Unable to create your account!') unless user.valid?\n\n # Attach the Shib eppn if this is part of an SSO account creation\n hash = session.fetch('devise.shibboleth_data', {})\n if hash.present? && user.valid?\n user.attach_omniauth_credentials(scheme_name: 'shibboleth',\n omniauth_hash: hash)\n end\n end\n else\n flash[:alert] = _('Invalid security check! Please make sure your browser is up to date and then try again')\n end\n end",
"def invite\n \n end",
"def update\n invitation_token = Devise.token_generator.digest(User, :invitation_token, params[:invitation_token])\n user = User.find_by(invitation_token: invitation_token)\n if user.present? && user.encrypted_password.present?\n user.accept_invitation\n inviter = User.find(user.invited_by_id)\n user.firm_id = inviter.firm_id\n user.role = user.invitation_role\n user.invitation_role = nil\n user.save!\n\n redirect_to root_path, notice: 'Invitation accepted.'\n else\n super\n # resource.name = resource.first_name + \" \" + resource.last_name\n # resource.save\n end\n # super\n\n\n # class_string_name = User::USER_ROLES[current_user.role].humanize\n # puts \"CONTACT TYPE ------> \" + class_string_name\n # create_contact(class_string_name, current_user, current_user.firm)\n end",
"def invite\n Notifications.invite\n end",
"def create\n @invitation = Invitation.new(invitation_params)\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invitation }\n else\n format.html { render action: 'new' }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n @invitation.ip_address = request.remote_ip.to_s\n @invitation.verify_email_sent_at = Time.zone.now\n\n if current_user # 2. person inviting family or friend\n @invitation.requestor_email = current_user.email\n else # 1. person inviting themselves (sign up)\n @invitation.requestor_email = params[:invitation][:email]\n end\n\n # what about the scenario where a user forgets that they already signed up?\n\n @known_user_being_invited = User.where(:email => params[:invitation][:email], :status => 'active').first\n if @known_user_being_invited\n @invitation.existing_user = 'true' \n else \n @invitation.existing_user = 'false'\n end\n\n # check for duplicate\n @duplicate = Invitation.where(:email => params[:invitation][:email], :requestor_email => @invitation.requestor_email).first\n if @duplicate\n @duplicate.request_count += 1\n @duplicate.save\n UserMailer.invitation_confirmation(current_user, @duplicate).deliver if @duplicate.request_count < 3\n redirect_to person_path(current_user.person.id), :notice => \"Duplicate Invite\"\n elsif @invitation.save\n # does the person being invited already exist in epet?\n #@invite_to_known_user = User.find_by_email(@invitation.email)\n #UserMailer.invitation_confirmation(current_user, @invitation, @invite_to_known_user).deliver\n Spawnling.new do\n UserMailer.invitation_confirmation(current_user, @invitation).deliver\n end\n if current_user\n redirect_to person_path(current_user.person.id), :notice => \"Invite sent.\"\n else\n redirect_to root_url, :notice => \"Check your email inbox for instructions\"\n end\n else\n render \"new\"\n end\n end",
"def resource\n resource_klass.new(attributes.symbolize_keys.merge(new_record: false))\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' }\n format.json { render json: @invitation, status: :created, location: @invitation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to new_event_invitation_path(@invitation.event, Invitation.new(event: @invitation.event)), notice: \"#{@invitation.user.username} has been added\" }\n format.json { render json: @invitation, status: :created, location: @invitation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\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 create\n @invitation = Invitation.new(invitation_params)\n @invitation.sender = current_user\n\t path = request.host_with_port\n if @invitation.save\n if user_signed_in?\n Mailer.invite_friend(@invitation,current_user, path+new_user_registration_path(:invitation_token => @invitation.token)).deliver\n flash[:notice] = \"Thank you, invitation sent.\"\n redirect_to users_url\n else\n flash[:notice] = \"Thank you, we will notify when we are ready.\"\n redirect_to root_url\n end\n else\n render :action => 'new'\n end\n end",
"def accept!\n return unless accepted.nil?\n\n update(accepted: true)\n if add_owner_as_collaborator\n Collaborator.find_or_create_by!(user_id: cookbook.owner.id, resourceable: cookbook)\n end\n\n cookbook.update(user_id: recipient.id)\n end",
"def show\n @invitation = Invitation.find(params[:id])\n @invitation.update_attributes(:accepted_at=>Time.now) if @invitation.accepted_at.nil?\n\n # For now, just redirect to the homepage after marking the invitation?\n\n respond_to do |format|\n # format.html # show.rhtml\n format.html { redirect_to :controller=>\"home\", :action=>\"index\" }\n format.xml { render :xml => @invitation.to_xml }\n end\n end",
"def show\n @invitation = Invitation.find(params[:id])\n respond_with(@invitation)\n end",
"def new\n @invitation = Invitation.new(params[:invitation])\n end",
"def invitation_service\n @invitation_service ||= Course::UserInvitationService.new(current_course_user)\n end",
"def resource\n self\n end",
"def create\n @invitation = Invitation.new(invitation_params)\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' }\n format.json { render json: @invitation, status: :created, location: @invitation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n resource = nil\n caught = catch(:warden) do\n resource = warden.authenticate!(auth_options)\n end\n\n if resource\n # User is confirmed\n self.resource = resource\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n yield resource if block_given?\n @resource = resource\n elsif caught and caught[:message] == :not_approved\n # User is unconfirmed\n @resource = \"not_approved\"\n else\n # User is not signed in\n @resource = \"invalid\"\n end\n respond_to :html, :js\n end",
"def accepted\n OpportunityMailer.accepted\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n\n respond_to do |format|\n if @invitation.save\n flash[:notice] = 'Invitation was successfully created.'\n \n format.html { redirect_to(\"/users/#{current_user.id}/invitations/#{@invitation.permalink}\") }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def set_invitation\n @invitation = Invitation.find(params[:id])\n end",
"def to_resource\n self\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 deliver_invite_to_resident(resident, user)\n return\n end",
"def resource_class\n class_name\n end",
"def invitation_service\n @invitation_service ||= Course::UserInvitationService.new(current_user, current_course)\n end",
"def invitation_service\n @invitation_service ||= Course::UserInvitationService.new(current_user, current_course)\n end",
"def create\n if invited?\n super\n else\n redirect_to :back, flash: { error: 'Não encontramos convite para os dados fornecidos.' }\n end\n end",
"def accept_invite(_token)\n # stub\n end",
"def create\n @invitation = Invitation.new(invitation_params)\n @invitation.user_id = current_user.username\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' }\n format.json { render :show, status: :created, location: @invitation }\n else\n format.html { render :new }\n format.json { render json: @invitation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipient\n case self.class.to_s\n when \"Survey\"\n giver\n when \"User\"\n self\n else\n raise 'Not implemented.'\n end\n end",
"def create_invite\n @notification = Notification.new(notification_params)\n @notification.notification_type = 'invite'\n\n if @notification.save\n flash[:success] = \"Invite sent!\"\n redirect_to band_url(params[:id])\n else\n render 'invite'\n end\n end",
"def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invitation }\n end\n end",
"def find_invitee_and_create_invitation(network_or_survey)\n organization = Organization.find(params[:id])\n return network_or_survey.invitations.create(:invitee => organization, :inviter => current_organization)\n end",
"def add_as_client \n Event.create( \n :event_type => 'invitation',\n :detail_i1 => guest.id,\n :user_id => self.case.author.id\n ) \n self.case.author.add_client(guest) || true\n end",
"def accept_invitation\n accepted = false\n inv = Invitation.find_by_key(params[:key])\n\n if inv.present?\n s = Story.is_not_deleted.find_by_id(inv.story_id)\n if inv.accepted_at.blank?\n if s.present?\n s.users << current_user\n inv.accepted_at = Time.now\n inv.save\n redirect_to stories_path, :notice => t('app.msgs.invitation.accepted', :title => s.title)\n accepted = true\n end\n else\n redirect_to stories_path, :notice => t('app.msgs.invitation.accepted_already', :title => s.title)\n accepted = true\n end\n end\n\n if !accepted\n redirect_to settings_invitations_path, :notice => t('app.msgs.invitation.bad')\n end\n end",
"def resource\n self.class.resource\n end",
"def primary_invite\n self.primary_invite_id ? Invitation.find(self.primary_invite_id) : self.invitations.find(:first)\n end",
"def new\n @title = 'New Invitation'\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @invitation }\n end\n end",
"def create\n @invitation = current_user.invitations.build(:invitee_user_id => params[:user_id])\n\n respond_to do |format|\n if @invitation.save\n flash[:notice] = \"#{@invitation.invitee.email} was successfully invited.\"\n format.html { redirect_to(admin_users_path) }\n format.xml { render :xml => @invitation, :status => :created, :location => @invitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def accepted_receiver\n self.receiver ||= if accepted_response = self.responses.accepted.first\n accepted_response.person\n end\n end",
"def resource\n @resource\n end",
"def resource\n @resource\n end",
"def create\n @invite = Invite.new(invite_params)\n @invite.sender_id = current_user.id # set the sender to the current user\n # @invite.invited_at = Time.now.utc\n\n respond_to do |format|\n if @invite.save\n # if the user already exists\n if @invite.recipient != nil\n InvitationMailer.existing_user_invite(@invite).deliver\n @invite.recipient.projects.push(@invite.project)\n flash.now[:notice] = \"User convidado\"\n else\n InvitationMailer.deliver_invitation(@invite, invite_sign_up_url(:invite_token => @invite.token)).deliver\n\n format.html { redirect_to @invite, notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n end\n else\n format.html { redirect_to \"/\", notice: \"Não enviou convite\" }\n # format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.811412",
"0.79219496",
"0.7850943",
"0.76063305",
"0.7255781",
"0.70342654",
"0.6963639",
"0.6812012",
"0.670473",
"0.66814524",
"0.6668469",
"0.66216135",
"0.6439521",
"0.6403509",
"0.63733107",
"0.63627434",
"0.63505477",
"0.6298703",
"0.62884086",
"0.6278829",
"0.62623674",
"0.62040573",
"0.62040573",
"0.62005585",
"0.6136953",
"0.6077576",
"0.60279036",
"0.6002969",
"0.59988654",
"0.5981394",
"0.594406",
"0.59298795",
"0.5928145",
"0.5919489",
"0.5911067",
"0.5894303",
"0.5892052",
"0.5869251",
"0.58679074",
"0.5859819",
"0.58296657",
"0.58167255",
"0.5797453",
"0.57938254",
"0.5787198",
"0.57703465",
"0.57693976",
"0.5754646",
"0.57412124",
"0.5729202",
"0.57247365",
"0.5723944",
"0.57101583",
"0.5709978",
"0.5705511",
"0.56977123",
"0.568548",
"0.5670385",
"0.5662564",
"0.5658521",
"0.56561446",
"0.56557226",
"0.56555915",
"0.5653832",
"0.5653068",
"0.5647563",
"0.5644136",
"0.5620604",
"0.5620213",
"0.56159574",
"0.5612999",
"0.5611951",
"0.5607598",
"0.56017727",
"0.5598636",
"0.559711",
"0.5592941",
"0.55922323",
"0.5589317",
"0.5587789",
"0.5584817",
"0.5584817",
"0.5577878",
"0.5576199",
"0.5571658",
"0.5560872",
"0.5550825",
"0.55496514",
"0.55496514",
"0.55474854",
"0.55390054",
"0.55326027",
"0.5531501",
"0.55240774",
"0.5518715",
"0.5517826",
"0.55165464",
"0.55137247",
"0.55137247",
"0.5508428"
] | 0.753008 | 4 |
fixes birth number badly transfered from candidates | def fix_bad_birth_numbers(students = nil)
ActiveRecord::Base.connection.execute('SET NAMES UTF8')
notfound = []
students ||= Student.find(:all)
@@mylog.info "There are %i students" % students.size
students.each do |student|
if c = Candidate.find(:all, :conditions => ["birth_number like ?",
"%s_" % student.birth_number])
if c.size > 0
if c.size > 1
@@mylog.info "More than one candidate for student %i. Getting first." % student.id
end
c = c.first
@@mylog.info "Found one candidate for student %i" % student.id
if c.birth_number =~ /\d{6}\//
bn = c.birth_number.gsub(/\//, '')
@@mylog.info "Got slash in birth number. Fixin student %i with %s" % [student.id, bn]
student.update_attribute(:birth_number, bn)
else
@@mylog.info "No slash in birth number for %i" % student.id
end
else
@@mylog.info "Candidate has't been found"
notfound << student.id
end
end
end
return notfound
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def celebrate_birthday\n\t\t@age += 1\n\t\tabout(true)\n\tend",
"def celebrate_birthday(age)\n\t\t\tage = @age\n\t\t\tage + 1\n\t\tend",
"def celebrate_birthday\n\t\t@age += 1\n\tend",
"def celebrate_birthday\n\t\t@age += 1\n\tend",
"def celebrate_birthday\r\n\t\t@age += 1\r\n\tend",
"def celebrate_birthday(age)\n @age = age\n age = age + 1\n end",
"def celebrate_birthday(age)\n\t\t@age = age + 1\n\tend",
"def celebrate_birthday\r\n\t\t@age +=1\r\n\tend",
"def celebrate_birthday(given_age)\n @age = given_age + 1\n end",
"def celebrate_birthday \r\n\t@age += 1\r\n\tend",
"def celebrate_birthday\r\n @age += 1\r\n end",
"def celebrate_birthday\r\n @age += 1\r\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday(age)\n @age += 1\n end",
"def celebrate_birthday(age)\n age = @age += 1\n end",
"def fix_leader!(leader)\n\n if leader.length < 24\n # pad it to 24 bytes, leader is supposed to be 24 bytes\n leader.replace( leader.ljust(24, ' ') )\n elsif leader.length > 24\n # Also a problem, slice it\n leader.replace( leader.byteslice(0, 24))\n end\n # http://www.loc.gov/marc/bibliographic/ecbdldrd.html\n leader[10..11] = '22'\n leader[20..23] = '4500'\n\n if settings['horizon.destination_encoding'] == \"UTF8\"\n leader[9] = 'a'\n end\n\n # leader should only have ascii chars in it; invalid non-ascii\n # chars can cause ruby encoding problems down the line.\n # additionally, a force_encoding may be neccesary to\n # deal with apparent weird hard to isolate jruby bug prob same one\n # as at https://github.com/jruby/jruby/issues/886\n leader.force_encoding('ascii')\n\n unless leader.valid_encoding?\n # replace any non-ascii chars with a space.\n\n # Can't access leader.chars when it's not a valid encoding\n # without a weird index out of bounds exception, think it's\n # https://github.com/jruby/jruby/issues/886\n # Grr.\n\n #leader.replace( leader.chars.collect { |c| c.valid_encoding? ? c : ' ' }.join('') )\n leader.replace(leader.split('').collect { |c| c.valid_encoding? ? c : ' ' }.join(''))\n end\n\n\n\n end",
"def convert_birthday\r\n\tbirthdate_str = get_birthday\r\n\tyour_number = birthdate_str[0].to_i + birthdate_str[1].to_i + birthdate_str[2].to_i \r\n\tyour_number = your_number + birthdate_str[3].to_i + birthdate_str[4].to_i + birthdate_str[5].to_i \r\n\tyour_number = your_number + birthdate_str[6].to_i + birthdate_str[7].to_i\r\n\r\n\t#SECOND ROUND OF ADDING NUMBERS TOGETHER\r\n\tyour_number = your_number.to_s\r\n\tyour_number = your_number[0].to_i + your_number[1].to_i\r\n\r\n\t#LAST ROUND OF ADDING IF NEEDED\r\n\tif (your_number > 9)\r\n\t\tyour_number = your_number.to_s\r\n\t\tyour_number = your_number[0].to_i + your_number[1].to_i\r\n\tend\r\n\r\n\treturn your_number\r\nend",
"def celebrate_birthday\n @age = @age + 1\n end",
"def celebrate_birthday\n @age = @age + 1\n end",
"def celebrate_birthday\n @age = @age + 1\n end",
"def celebrate_birthday\n age = age+1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n @age += 1\n end",
"def celebrate_birthday\n b_day_age = @age + 1\n end",
"def fix_phone_number\n number = phone_number.to_s.gsub(/\\D/, '')\n number = number[1..-1] if number.starts_with?('1')\n self.phone_number = number\n end",
"def set_cpr_nr\n dato = self.birthdate.to_s.split(\"-\")\n dato[0] = dato[0][2..3]\n self.cpr = dato.reverse.join\n end",
"def celebrate_birthday=(age) \r\n \t@age += 1\r\n \t@age \r\n end",
"def celebrate_birthday\n\t\t@age += 1\n\t\tp @age\n\tend",
"def celebrate_birthday(age)\n\t\tage += 1\n\t\tputs \"Happy birthday! You are now #{age} years old!\"\n\t\tputs \"\"\n\tend",
"def celebrate_birthday\n\t\t@age = @age +=1 \n\t\treturn @age\n\tend",
"def celebrate_birthday\n\t\t@age = @age + 1\n\t\tputs \"Im #{@age}\"\n\tend",
"def celebrate_birthday\n @age = @age + 1\n puts \"It's Santa's Birthday! He is now #{@age} years old!\"\n end",
"def celebrate_birthday\n @age+= 1\n end",
"def birthdate_cannot_be_before_1900\n\t\tif birthday && birthday < Date.parse('1899-12-31')\n\t\t\terrors.add(:birthday, \"invalid date\")\n\t\tend\n\tend",
"def clean_bibnum(num)\n /\\d{7}/.match(num).to_s\n end",
"def happy_birthday!\r\n foaf::age = (foaf::age.first.to_i + 1).to_s\r\n end",
"def celebrate_birthday\n @age = @age + 1\n end",
"def celebrate_birthday\n @age = @age + 1\n if @age == 1\n puts \"Happy birthday! Now you're #{@age} year old!\"\n else\n puts \"Happy birthday! Now you're #{@age} years old!\"\n end\n end",
"def user_birthpath_number(birthdate)\n\t\n\tnumber = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n\tnumber = number.to_s\n\tnumber = number[0].to_i + number[1].to_i\n\t\n\tif(number > 9)\n\t\tnumber = number.to_s\n\t\tnumber = number[0].to_i + number[1].to_i\n\tend\n\t\n\treturn number\nend",
"def convert_yy_2_yyyy( birth_year )\n return nil if birth_year.nil?\n # Already a 4-digit year?\n if birth_year.to_i > 1900\n birth_year\n\n # 2-digit year?\n elsif birth_year.to_i < 100\n # We keep track upto M105:\n if DateTime.now.year - 1900 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1900 + birth_year.to_i\n end\n\n # 3-digit year?\n elsif birth_year.to_i < 1000\n # We keep track upto M105:\n if DateTime.now.year - 1000 - birth_year.to_i > 105\n 2000 + birth_year.to_i\n else\n 1000 + birth_year.to_i\n end\n end\n end",
"def reformat_ssn\n ssn = self.ssn.to_s # change to string in case input as all numbers \n ssn.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.ssn = ssn # reset self.ssn to new string\n end",
"def celebrate_birthday=(years)\n\t\t@age += years\n\tend",
"def clean_an\n if aleph_record?\n an_numeric_component.prepend('MIT01')\n elsif aleph_cr_record?\n an_numeric_component.prepend('MIT30')\n end\n end",
"def non_target_elderly_driver_birth_date\n Chronic.parse(\"#{rand(94..100)} years ago\").strftime('%m/%d/%Y')\n end",
"def determine_number(birthday)\n number = birthday[0].to_i + birthday[1].to_i + \n birthday[2].to_i + birthday[3].to_i +\n birthday[4].to_i + birthday[5].to_i +\n birthday[6].to_i + birthday[7].to_i\n\n# convert calculated number variable to string so we can use array syntax and add digits\n\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n\n# check to see if the newly calculated number is single digit; if not, reduce again\n\n if number > 9\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n end\n\n return number\nend",
"def strict_bouncer(people, hated_letter)\n\taccepted_people = []\n\tpeople.each do |person|\n\t\tif person[0][0] != hated_letter && person[1] >= 21\n\t\t\tnew_person = person[0]\n\t\t\taccepted_people.push(new_person)\n\t\tend\n\tend\n\taccepted_people\nend",
"def dateify_dob\n self.dob ||= \"\"\n parts = self.dob.split(\"/\").map{|i| i.to_i}\n self.dob = \"#{parts[0].to_s.rjust(2, \"0\")}/#{parts[1].to_s.rjust(2, \"0\")}/#{parts[2]}\"\n end",
"def birth_path_number(date)\n no1 = date[0].to_i\n no2 = date[1].to_i\n no3 = date[2].to_i\n no4 = date[3].to_i\n no5 = date[4].to_i\n no6 = date[5].to_i\n no7 = date[6].to_i\n no8 = date[7].to_i\n\n # Adds all the digits of the birthdate\n number = no1 + no2 + no3 + no4 + no5 + no6 + no7 + no8\n\n # Reverts the number into a string\n number = number.to_s\nend",
"def year_of_birth(current_year, age)\n\tcurrent_year - age\n\tend",
"def reformat_phone_ssn\n phone = self.phone.to_s # change to string in case input as all numbers \n phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.phone = phone # reset self.phone to new string\n ssn = self.ssn.to_s # change to string in case input as all numbers \n ssn.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.ssn = ssn # reset ssn.phone to new string\n end",
"def next_birthday\n @year = Date.today.year\n @mmdd = @date_of_birth.strftime('%m%d')\n @year += 1 if @mmdd < Date.today.strftime('%m%d')\n @mmdd = '0228' if @mmdd == '0229' && !Date.parse(\"#{@year}0101\").leap?\n @next_birthday = Date.parse(\"#{@year}#{@mmdd}\")\n end",
"def get_birth_num(birthday)\n number = birthday[0].to_i + birthday[1].to_i + birthday[2].to_i + birthday[3].to_i + birthday[4].to_i + birthday[5].to_i + birthday[6].to_i + birthday[7].to_i\n\n# convert the number to string, use array format\nnumber = number.to_s\nnumber = number[0].to_i + number[1].to_i\n\n# if statement if the number is greater than 9; if it is, reduce\n if number > 9\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n end\n \n return number\nend",
"def birth_path_number(birthdate)\nnumber = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\nnumber = number.to_s\nnumber = number[0].to_i + number[1].to_i\nif number > 9 \n\tnumber = number[0].to_i + number[i].to_i\nend\nreturn number\nend",
"def birth_path_number(birthdate)\nnumber = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\nnumber = number.to_s\nnumber = number[0].to_i + number[1].to_i\nif number > 9 \n\tnumber = number[0].to_i + number[i].to_i\nend\nreturn number\nend",
"def celebrate_birthday\n @age += 1\nend",
"def sanitize_age(age)\n ((age * 12.0).round / 12.0)\n end",
"def discard_and_replace(number = 1)\n number = faceup.count if number > faceup.count\n gamefield.slice(0, number).each_with_index do |card, i|\n card.faceup_position = nil\n card.facedown_position = nil\n return false unless card.save\n end\n gamefield.each do |card|\n card.faceup_position = card.faceup_position - number\n return false unless card.save\n end\n deal number\n end",
"def birth_path_number(birthday)\r\n\tnumber = birthday[0].to_i + birthday[1].to_i + birthday[2].to_i + birthday[3].to_i + birthday[4].to_i + birthday[5].to_i + birthday[6].to_i + birthday[7].to_i\r\n\tnumber = number.to_s\r\n\tnumber = number[0].to_i + number[1].to_i\r\n\r\n\tif (number > 9)\r\n\t\tnumber = number.to_s\r\n\t\tnumber = number[0].to_i + number[1].to_i\r\n\tend\r\n\treturn number\r\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 dob_with_age\n unless feed.birth_time.blank?\n #age_string = \" (#{age} #{t(:year, :count => year).downcase})\"\n age_string = \" (#{feed.age} years)\"\n return case self[:feed_birth_time_pref]\n when /y|md/:\n dob_string + age_string\n when /md/:\n dob_string\n end\n end\n return ''\n end",
"def reformat_phone_and_ssn\n phone = self.phone.to_s # change to string in case input as all numbers \n phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.phone = phone # reset self.phone to new string\n\n ssn = self.ssn.to_s # change to string in case input as all numbers \n ssn.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.ssn = ssn # reset self.phone to new string\n end",
"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 set_age\n birthday = Date.parse(@birthday)\n today = Date.today\n\n if (birthday.month == today.month && birthday.day <= today.day) || (birthday.month < today.month)\n @age = today.year - birthday.year\n else\n @age = today.year - birthday.year - 1\n end\n end",
"def clean\n @number.gsub!(/\\D/,\"\")\n\n if has_11_digits? and starts_with_1?\n @number = @number[1..-1] \n elsif invalid_length?\n @number = nil\n end\n end",
"def invalid_south_african_id_number; end",
"def cleanup(isbn_)\n isbn_.gsub(/[^0-9xX]/,'').gsub(/x/,'X') unless isbn_.nil? or isbn_.scan(/([xX])/).length > 1\n end",
"def get_birth_path_number(birthdate)\n number = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n \n number = number.to_s \n number = number[0].to_i + number[1].to_i\n \n if number > 9\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n end\n \n return number\nend",
"def full_adult_birth_date\n Chronic.parse(\"#{rand(21..63)} years ago\").strftime('%m/%d/%Y')\n end",
"def one_billion_seconds birth_year, birth_month, birth_day, birth_hour, birth_minute, birth_second\n \n birthday = Time.mktime(birth_year, birth_month, birth_day, birth_hour, birth_minute, birth_second)\n billion_seconds_old = birthday + 1000000000\n if Time.now < billion_seconds_old\n return \"Hey, you will be a BILLION seconds old on \" + billion_seconds_old.to_s\n else \n return \"You were a BILLION seconds old on \" + billion_seconds_old.to_s\n end\nend",
"def birth_info(p)\n if p.birth then\n ret = p.birth.to_s(:long)\n if p.birth_place != '' then\n ret = \"#{ret} in #{p.birth_place}\"\n end\n else\n ret = \"Unknown\"\n end\n ret\n end",
"def happy_birthday_spank\n puts \"Hey, Lets find out how old you are!\"\n puts \"Enter your birth year (yyyy) in numbers (1000-\" + Time.now.year.to_s + \")...\"\n birth_year = gets.chomp.to_i\n while (birth_year > Time.now.year or birth_year < 1000)\n puts \"Wrong, input. Please try again with numbers from 1000 to \" + Time.now.year.to_s\n birth_year = gets.chomp.to_i\n end\n puts \"Enter your birth month (mm) in numbers...\"\n birth_month = gets.chomp.to_i\n while (birth_month < 1 or birth_month > 12)\n puts \"Wrong, input. Please try again with numbers from 1 to 12\"\n birth_month = gets.chomp.to_i\n end\n puts \"Enter your birth day (dd) in numbers...\"\n birth_day = gets.chomp.to_i\n while (birth_day < 1 or birth_day > 31)\n puts \"Wrong, input. Please try again with numbers from 1 to 31\"\n birth_day = gets.chomp.to_i\n end\n birth_day_seconds = Time.now - Time.mktime(birth_year,birth_month,birth_day)\n birthday = (birth_day_seconds/(60*60*24*365)).to_i\n index = 1\n while index <= birthday\n puts \"SPANK! (\" + index.to_s + \")\"\n index+=1\n end\n puts \"You are \" + birthday.to_s + \" years old!\"\nend",
"def clean_numbers(original)\n number = original.delete(\"()-. \")\n\n if number.length == 10\n\n elsif number.length == 11\n if number.start_with?(\"1\")\n number = number[1..-1]\n else\n number = INVALID_PHONE\n end\n\n else\n number = INVALID_PHONE\n end\n return number\n end",
"def celebrate_birthday\n @age += 1\n puts \"My age: #{@age}\"\n end",
"def age= value\n value = DateTime.now.year-value.to_i\n self.birthday=DateTime.strptime(\"#{value}-1-1\", \"%Y-%m-%d\")\n end",
"def elderly_driver_birth_date\n Chronic.parse(\"#{rand(65..94)} years ago\").strftime('%m/%d/%Y')\n end",
"def birth_range\n if birth\n birth..birth # exact\n elsif death\n (death - max_le)..death # estimation based on death\n end\n end",
"def phone_number_cleaner!\n @phone_number = @phone_number.gsub(/[^0-9]/, '')\n if @phone_number.to_s.size == 11 && @phone_number[0] == '1'\n @phone_number[0] = ''\n end\n end",
"def phone_number_cleaner!\n @phone_number = @phone_number.gsub(/[^0-9]/, '')\n if @phone_number.to_s.size == 11 && @phone_number[0] == '1'\n @phone_number[0] = ''\n end\n end",
"def get_birth_path_number(birthdate)\n number = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i +\n birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n\n if number > 9\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n end\n\n return number\n\nend",
"def celebrate_birthday=(current_age)\n\t\t@age = current_age+1\n\t\tputs \"Happy Birthday #{@name}, you are now #{@age} years old\"\n\tend",
"def get_birth_path_num(birthdate)\n number = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\n\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n\n if number > 9\n number = number.to_s\n number = number[0].to_i + number[1].to_i\n end\n\n return number\nend",
"def year_rome_founded\n bce(753)\n end",
"def standardized_phone_number\n @standardized_phone_number ||= phone_number.gsub(/\\D/, '')\n end",
"def get_birthpath(birthdate)\n #determine birthpath\n #break date into a string of characters and put them in array\n birthdate_array = birthdate.split(//)\n\n # add numbers in array until they are less than 10\n birthpath = 0\n keep_going = 1\n while keep_going == 1\n birthdate_array.each do |x|\n birthpath += x.to_i # bsum += x.to_i\n end\n birthdate_array = birthpath .to_s.split(//)\n if birthpath < 10\n keep_going = 0\n else\n birthpath = 0\n end\n end\n return birthpath\n \nend",
"def expected_death_year\n Chronic.parse(\"#{years_to_live} years from now\").year.to_s\n end",
"def age=(val)\n @age = val\n val = val.to_i\n return unless val > 0\n return unless val < 200\n return if birthday && val == age # don't change birthday if we want to stay the same age\n\n self.birthday = val.years.ago\n end",
"def good_student_birth_date\n Chronic.parse(\"#{rand(16..24)} years ago\").strftime('%m/%d/%Y')\n end",
"def get_birth_number(birthdate)\n\n# 2 use array syntax to access each element (number) in the birthdate, convert each one to an integer, and add them all together \nnumber = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i\nputs \"1. The Number is currently #{number}\"\n\n# 3. convert the number back to a string so you can use array syntax again, and then follow step 3 to add the two numbers together \nnumber = number.to_s\nnumber = number[0].to_i + number[1].to_i\nputs \"2. The Number is currently #{number}\"\n\n# 4. use an if statement to determine if the number is greater than 9; if it is, reduce again\nif number > 9 \n number = number.to_s\n number = number[0].to_i + number[1].to_i\nend \n puts \"3. The number is #{number}\"\nreturn number\nend",
"def reformat_phone\n phone = self.phone.to_s \n phone.gsub!(/[^0-9]/,\"\") \n self.phone = phone \n end",
"def reformat_cell_phone\n cell_phone = self.cell_phone.to_s # change to string in case input as all numbers \n cell_phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.cell_phone = cell_phone # reset self.phone to new string\n end",
"def reformat_cell_phone\n cell_phone = self.cell_phone.to_s # change to string in case input as all numbers \n cell_phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.cell_phone = cell_phone # reset self.phone to new string\n end",
"def reformat_home_phone\n home_phone = self.home_phone.to_s # change to string in case input as all numbers \n home_phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.home_phone = home_phone # reset self.phone to new string\n end",
"def teen_smart_birth_date\n Chronic.parse(\"#{rand(16..20)} years ago\").strftime('%m/%d/%Y')\n end",
"def birth_year\n @current_year - @age\n end",
"def brazilian_company_number(formatted: false)\n digits = Array.new(8) { Faker::Number.digit.to_i } + [0, 0, 0, Faker::Number.non_zero_digit.to_i]\n\n factors = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2, 6].cycle\n\n 2.times do\n checksum = digits.inject(0) { |acc, digit| acc + digit * factors.next } % 11\n digits << (checksum < 2 ? 0 : 11 - checksum)\n end\n\n number = digits.join\n\n formatted ? format('%s.%s.%s/%s-%s', *number.scan(/(\\d{2})(\\d{3})(\\d{3})(\\d{4})(\\d{2})/).flatten) : number\n end"
] | [
"0.61577225",
"0.6135849",
"0.60823715",
"0.60823715",
"0.60721546",
"0.60409033",
"0.60383934",
"0.6026922",
"0.6012647",
"0.5918162",
"0.59168875",
"0.59168875",
"0.5915824",
"0.5908193",
"0.5894481",
"0.58818865",
"0.585106",
"0.5849952",
"0.5849952",
"0.5849952",
"0.58261967",
"0.57957464",
"0.57957464",
"0.57957464",
"0.57957464",
"0.57957464",
"0.57957464",
"0.57957464",
"0.5789512",
"0.57850075",
"0.57809776",
"0.57728046",
"0.5749075",
"0.5723178",
"0.5718055",
"0.5696338",
"0.5680788",
"0.56632864",
"0.5624899",
"0.56161386",
"0.5603125",
"0.5568848",
"0.5556207",
"0.55503696",
"0.5542927",
"0.55346006",
"0.5529365",
"0.55112475",
"0.5487154",
"0.5480852",
"0.5427832",
"0.5400296",
"0.53881824",
"0.53790313",
"0.53376323",
"0.5297708",
"0.529282",
"0.5288298",
"0.5288298",
"0.5284683",
"0.5271287",
"0.5269727",
"0.52684945",
"0.5251535",
"0.5247253",
"0.5241359",
"0.5241027",
"0.52329886",
"0.5226185",
"0.5222281",
"0.521459",
"0.52086216",
"0.52017415",
"0.5195964",
"0.51813155",
"0.5179361",
"0.5171474",
"0.517102",
"0.51512325",
"0.51488173",
"0.5146262",
"0.5141325",
"0.5141325",
"0.513582",
"0.51330984",
"0.51258814",
"0.5121026",
"0.51183486",
"0.5099417",
"0.5087419",
"0.50868976",
"0.50865966",
"0.50706875",
"0.5068963",
"0.50681114",
"0.50681114",
"0.5059875",
"0.50574",
"0.5054455",
"0.5038968"
] | 0.6877508 | 0 |
reads sident from webservice and change it for students | def repair_sident(indices)
@@mylog.info "There are %i students" % indices.size
@client = SOAP::NetHttpClient.new
service = SERVICE_URL + SIDENT_SERVICE_PATH
f = File.new("sident_errs.txt", "wb")
indices.each do |index|
@@mylog.info "Procesing index #%i" % index.id
service_url = service % [index.student.birth_number, index.specialization.code]
@@mylog.debug "Service url is: %s" % service_url
begin
sident = @client.get_content(service_url)
rescue URI::InvalidURIError
@@mylog.error "Bad service url %s" % service_url
next
end
if sident =~ /<SIDENT>(.*)<\/SIDENT>/
sident = $1
@@mylog.info "Got sident %i" % sident
if sident != "-1"
index.update_attribute(:sident, sident)
@@mylog.info "Updated sident"
else
@@mylog.error "Service returned bad code for student #%i" % index.id
f.puts "%i, %s, %s, %s" % [index.id, index.student.display_name, index.student.birth_number, index.specialization.code]
end
end
end
ensure
f.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uic(birth_number)\n service = prepare_service(birth_number)\n @@logger.debug \"Trying service for student with bn #{birth_number}\"\n @@logger.debug service\n begin\n service_response = query_service(service)\n rescue Exception => e\n @@logger.error 'Something gone wrong with service ' + e\n end\n begin\n uic = extract_uic(service_response)\n @@logger.debug \"Service and parsing successful. Updating student\"\n return uic\n rescue Exception => e\n @@logger.error \"Error parsing response: \" + e\n end\n end",
"def set_studentinfo\n @studentinfo = Studentinfo.find(params[:id])\n end",
"def set_studen\n @studen = Studen.find(params[:id])\n end",
"def student\n unless logged_user.student? then\n render_403 and return\n end\n\n if request.get? then\n @student = logged_user.student\n elsif request.put? then\n student = Student.find(logged_user.student.id)\n student.specialty_id = params[:specialty]\n student.course = params[:course]\n if student.save then\n if params[:reg] then\n redirect_to :root\n else\n redirect_to :settings_student, alert: t('settings.save_suc')\n end\n else\n redirect_to :settings_student, notice: t('settings.save_fail')\n end\n end\n end",
"def update\n @student = Student.find(params[:student][:id])\n\n \t# check that the issuer of the request has both the username and ID, prevent attack\n if params[:student][:login].gsub(/ /,'') != @student.login.gsub(/ /,'')\n \tlog_attack \"Student update \" + params[:student][:id] + \" : \" + params[:student][:login] + \" - student.login = \" + @student.login \t\n respond_to do |format|\n format.xml { render :xml => errorRsp( \"ATTACK: Error student update \" + params[:student][:id] + \" : \" + params[:student][:login]) }\n end\n \treturn\n end\n \n \n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.xml { render :xml => successRsp }\n else\n log_DB_errors( \"student\", @student.errors ) \n format.xml { render :xml => errorRsp( @student.errors.to_s ) }\n end\n end\n end",
"def set_student\n @student = current_school.students.find(params[:id])\n end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def set_student\n @student = User.students.find_by_id(params[:id])\n end",
"def set_student\n @student = Student.find_by_login(params[:login])\n end",
"def set_student\n @student = Student.find(session[:student_id])\n end",
"def set_studnet\n @studnet = Studnet.find(params[:id])\n end",
"def set_student\n @student = Student.includes(:scores, :nutritions).find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id] || params[:student_id])\n end",
"def set_student_id\n @student_id = StudentId.find(params[:id])\n end",
"def set_student\n @student = Student.find_by(id: params[:id])\n end",
"def show\n \n\n begin\n @students = Student.find(params[:id]) \n \n \t# check that the issuer of the request has both the username and ID, prevent attack\n \tif params[:login].gsub(/ /,'') != @students.login.gsub(/ /,'')\n \t\tlog_attack \"Student show \" + params[:id] + \" : \" + params[:login] + \" - students.login = \" + @students.login \t\n \t\trespond_to do |format|\n \t\tformat.xml { render :xml => errorRsp( \"Security error, contact support\" ) }\n \t\t end\n \t\treturn\n \tend \n rescue Exception => e \n respond_to do |format|\n format.xml { render :xml => errorRsp( e.message) }\n end\n return\n end\n \n respond_to do |format|\n format.xml { render :xml => @students }\n end\n end",
"def set_student\n student = Student.find(params[:id])\n end",
"def set_student_interest\n @student_interest = StudentInterest.find(params[:id])\n end",
"def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_people_student\n @people_student = People::Student.find(params[:id])\n end",
"def set_siren\n @siren = Siren.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def set_student\n @student = Student.find(params[:id])\n end",
"def sid\n data['sid']\n end",
"def student\n @student ||= Student.find_by_uic(uic)\n end",
"def set_student\n @user = Student.find(params[:id])\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end"
] | [
"0.6116094",
"0.6046837",
"0.6037891",
"0.5998901",
"0.59817576",
"0.59674853",
"0.59195304",
"0.5898165",
"0.5895579",
"0.5892546",
"0.58843505",
"0.58116835",
"0.58065975",
"0.5803452",
"0.5801357",
"0.58009857",
"0.5794507",
"0.57696253",
"0.5760095",
"0.57466507",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.57451147",
"0.5739174",
"0.5724937",
"0.5698057",
"0.5698057",
"0.5698057",
"0.5698057",
"0.5698057",
"0.5698057",
"0.5698057",
"0.56864315",
"0.56864315",
"0.56864315",
"0.5685741",
"0.5662691",
"0.56464016",
"0.5641342"
] | 0.64471924 | 0 |
removes , Ing from names | def remove_ings_from_lastname
students = Student.find(:all, :conditions => "firstname like '%, Mgr.' or firstname like '%, Ing.'")
@@mylog.info "There are %i students" % students.size
students.each do |student|
new_first = student.firstname[0..-7]
@@mylog.info "Changing student #{student.display_name}"
student.update_attribute(:firstname, new_first)
@@mylog.info "New first name #{student.firstname}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decommafy\n gsub(/(.+), (.+)/) { |s| \"#{$2} #{$1}\" }.strip.squeeze(' ')\n end",
"def clean_name(name)\n if name.present?\n name.gsub(/(\\s|-|\\.|,)/,'')\n end\n end",
"def format_name(name)\n name.match(/\\,/).nil? ? name : \"#{name.split(\", \").reverse.join(\" \")}\"\n end",
"def shift_comma!\n gsub!(/,(?!\\d)/o, ' , '.freeze)\n gsub!(/(?<=\\D),(?=\\S+)/, ' , '.freeze)\n end",
"def sans_whitespace_and_commas\n @str.gsub(' ', '').gsub(',', '')\n end",
"def name\n value = \"#{last_name}, #{first_name}\".strip\n if value == ','\n ''\n else\n value\n end\n end",
"def formatNameFromString( name )\n name.split(\",\")\n end",
"def formatNameFromString( name )\n name.split(\",\")\n end",
"def remove_excess_whitespace_from_name\n self.name = name&.split&.join(' ')\n end",
"def for_commas\n each_line! do |line| \n begin\n line.gsub! /,(\\S)/, ', \\1' unless line.match /.*\\\".*,.*\\\".*/ or line.match /','/\n rescue Exception => e\n puts e.message + \", ignored.\"\n end\n end\n end",
"def clean_up_word(word)\n\t\tword.strip!\n\t\tword.chomp!(\".\")\n\t\tword.chomp!(\",\")\n\t\tword.chomp!(\"\\\"\")\t\n\t\tword.downcase!\n\tend",
"def neat_genres\n genres.split(',').delete_if { |word| word.eql?(\"\") || word.eql?(\" \") }.join(', ')\n end",
"def swap_name(name)\n\tname.split.reverse.join(', ')\nend",
"def comma_names\n @comma_names\nend",
"def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend",
"def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend",
"def name_inverted\n [last_name, first_name].compact.join(', ')\n end",
"def clean_name\n name.gsub(/\\(.*?\\)/, \"\").gsub(/(.*)/, \"\").strip\n end",
"def strip_symbols(name)\n return name.to_s.gsub(/[[:punct:]]/, '')\n end",
"def data_cleansing(data)\n # Removes extra spaces, commas, dollar sign etc.\n data = data.strip.split('')\n (data - [',', '%', ' ', '$']).join\nend",
"def name_filter\n self.gsub(/[^a-zA-Z\\s\\-\\(\\)]/, '')\n end",
"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 rearrange(name)\n match = /(\\w+), (\\w+)( \\w+)?/.match(name) # (1)\n\n last_name = match[1]\n first_name = match[2]\n if match[3]\n separator = \"#{match[3][0,2]}. \" # (2)\n else\n separator = ' ' # (3)\n end\n \n \"#{first_name}#{separator}#{last_name}\" # (4)\nend",
"def name\n [last_name.upcase, first_name].delete_if { |n| n.blank? }.join(\", \")\n end",
"def swap_name(name)\r\n name.split.reverse.join(', ')\r\nend",
"def swap_name(name)\r\n name.split.reverse.join(\", \")\r\nend",
"def strip_strings\n self.name = name.strip\n end",
"def strip_strings\n self.name = name.strip\n end",
"def remove_apostrophe\n self.name = self.name.gsub(\"'\",\"\")\n end",
"def remove_unofficial(name)\n\tname = params[:param2]\n\tl_name = name.partition(\" \")\n\tl_name[0].clear\n\tname = \"\"\n\tl_name.each do |word|\n\t\tname += word\n\tend\n\treturn name\n\nend",
"def remove_internal_trailing_comma(node, corrector); end",
"def swap_name(name)\n name.split(' ').reverse.join(', ')\nend",
"def cleanupstr (str)\n str.strip.gsub(/\\s+/, ' ').gsub(/ ,/, ',') unless str.nil?\n end",
"def strip_formatting_from_numbers \t# to remove commas added to web form for readability\n\t\tif self.income.include? \",\"\n\t\t\tself.income = self.income.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\t\tif self.debt.include? \",\"\n\t\t\tself.debt = self.debt.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\t\tif self.down_payment.include? \",\"\n\t\t\tself.down_payment = self.down_payment.to_s.gsub!(/\\D+/, '').to_i\n\t\tend\n\tend",
"def name_clean\n self.name.gsub(/_/, \" \")\n end",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n name.split.reverse.join(', ')\nend",
"def swap_name(name)\n \"#{name.split[1]}, #{name.split[0]}\"\nend",
"def swap_name(name)\n name_array = name.split\n \"#{name_array[-1]}, #{name_array[0]}\"\nend",
"def undent\n gsub /^.{#{slice(/^ +/).length}}/, ''\n end",
"def full_names\n names = raw_names\n if match_names\n names += match_names.downcase.split(%r{,\\s*})\n end\n names\n end",
"def cleanup_firstname(name)\n name.gsub(/^Dean(\\w+)/) { |s| \"DeAn#{$1}\" }\n end",
"def clean\n keylist = self.list.split(',')\n keylist.each { |i| i.strip! }\n keylist.sort! { |a,b| a.downcase <=> b.downcase }\n self.list = keylist.join(', ')\n end",
"def flip_first_last_name(name)\n fixed_name = name.split(\", \")\n if fixed_name[1] \n fixed_name[1] + ' ' + fixed_name[0]\n else\n name\n end\n end",
"def remove(*names); end",
"def swap_name(name)\n arr = name.split\n arr[0], arr[1] = arr[1], arr[0]\n arr.join(', ')\nend",
"def formatCommas(n)\n\treturn n.to_s.reverse.gsub(/...(?=.)/,'\\&,').reverse\nend",
"def name_without_alias(name:)\n return '' if name.blank?\n\n name.split(' (')&.first&.strip\n end",
"def refactor_location(location)\n result = []\n location.split(',').each do |name|\n result << name.strip unless name.to_s.strip.empty?\n end\n result.uniq.join(',')\n end",
"def drop_for\n return @drop_for if @drop_for\n @drop_for = if @name =~ /drop (.+)/\n $1.split(',').map{|s|s.strip}\n else; []; end\n end",
"def cleanup_distro_name(word)\n # manjaro,arch\n word.gsub!(/[\"']/,'')\n word.gsub!(/,.*+/, '')\n # ubuntu debian\n word.gsub(/ [a-zA-Z]+/, '')\n end",
"def delete_special_chars(entries)\n entries.each { |entry|\n entry.delete(\"(),\")\n }\n return entries\n end",
"def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end",
"def remove_decimal_mark(value)\n value.delete('$,')\n end",
"def swap_name(name)\n #name_array = name.split(' ')\n #\"#{name_array[1]}, #{name_array[0]}\"\n name.split(' ').reverse.join(', ')\nend",
"def present_ingredients_names\n get_ingredients_names.reduce(\"\") {|memo, name| memo + \", #{name}\"}.delete_prefix(\", \")\n end",
"def space_around_comma!\n substitute!(/[[:space:]]*,[[:space:]]*/, ',\n ')\n end",
"def remove_formatting(str)\n Name.clean_incoming_string(str.gsub(/[_*]/, ''))\n end",
"def one_word_names(values)\n one_word_names = values.map {|names| names}\n one_word_names.delete_if{|names| names[1].include?\" \"}\n one_word_names.each {|info| puts info.to_s}\nend",
"def joined_names\n values.map(&:name).join(\", \").gsub(/, ([^,]*)$/, ' and \\1')\n end",
"def format_tag_input(txt)\n txt ? txt.gsub(\", \", \",\").gsub(' ', '_').gsub(/[^a-zA-Z0-9#_,]/, '') : ''\n end",
"def comma_file_parser\n @comma_names = File.open(\"text_files/comma.txt\").readlines.each do |line|\n if line.include?(\"\\n\") # removes '\\n' (line breaker)\n line.gsub!(/\\n/, '')\n else\n line\n end\n end\nend",
"def swap_name(name)\n name.split(' ')[1] + ', ' + name.split(' ')[0]\nend",
"def cleaned_tags\n @product.tags.split(',').reject{ |c| c.empty? or c == \" \" }.uniq.join(',')\n end",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def sanitize_order_string(string)\n s = string.gsub(/\\s*,\\s*/, ',')\n s = s.gsub(/[\\w-]+/) { |m| \"#{self.table_name}.#{m}\" }\n end",
"def strip_name\n if self.name.present?\n self.name.strip!\n end\n end",
"def swap_name(full_name)\n name_array = full_name.split(\" \")\n \"#{name_array[1]}, #{name_array[0]}\"\nend",
"def artist_names\n names = \"\"\n self.artists.each do |artist|\n names += \"#{artist.name}, \"\n end\n\n # Remove trailing ,\n names.chomp!(\", \")\n return names\n end",
"def swap_name(str)\n str.split.reverse.join(', ')\nend",
"def tokenize_person_comma_org(line) \n elems = line.split(',')\n if elems.size >= 2\n return elems.map{|e| e.strip } \n else\n return ['',''] # let caller to decide how to deal with empty info\n end\nend",
"def dechapterize(name)\n \"#{name.sub(/^\\d+\\.(\\d+)?\\s+/, '')}\"\n end",
"def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end",
"def swap_name(str)\n \"#{str.split[1]}, #{str.split[0]}\"\nend",
"def nameswap(name)\n name_reverse = []\n nameary = name.split(' ')\n counter = 1 \n loop do \n name_reverse << nameary[counter]\n counter -= 1\n break if counter < 0\n end\n \n name_reverse.join(', ')\nend",
"def invert_names(agent_name)\n inverted_names = []\n agent_name.split(\" \").each do |name|\n inverted_names.unshift(name)\n end\n inverted_names.join(\" \")\nend",
"def swap_name(full_name)\n first, last = full_name.split\n \"#{last}, #{first}\"\n\n # LS solution:\n # full_name.split.reverse.join(', ')\nend",
"def do_comma s; a = mega_pop(s); String == a.class ? s[:output] << \"#{a}\" : s[:output] << \"#{a.chr}\" end",
"def remove_company_type(name)\n return name.gsub(/(^|\\s)(gmbh|ag)($|\\s)/i, ' ').strip\n end",
"def swap_name(strings)\n strings.split.reverse.join(', ')\nend",
"def remove_symbols_from_name\n all_customers = Customer.all\n\n all_customers.each do |customer|\n customer.update(search_name: customer.name.gsub(/[^a-zA-Z\\s]/,'').downcase)\n end\n end",
"def handle_agent_corporate_punctuation(name_fields)\n name_fields.sort! {|a, b| a[0][0] <=> b[0][0]}\n\n # The value of subfield g must be enclosed in parentheses.\n g_index = name_fields.find_index {|a| a[0] == \"g\"}\n unless !g_index\n name_fields[g_index][1] = \"(#{name_fields[g_index][1]})\"\n end\n\n # The value of subfield n must be enclosed in parentheses.\n n_index = name_fields.find_index {|a| a[0] == \"n\"}\n unless !n_index\n name_fields[n_index][1] = \"(#{name_fields[n_index][1]})\"\n end\n\n #If subfield $e is present, the value of the preceding subfield must end in a comma.\n #If subfield $n is present, the value of the preceding subfield must end in a comma.\n #If subfield $g is present, the value of the preceding subfield must end in a comma.\n ['e', 'n', 'g'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index || s_index == 0\n preceding_index = s_index - 1\n\n # find preceding field and append a comma if there isn't one there already\n unless name_fields[preceding_index][1][-1] == \",\"\n name_fields[preceding_index][1] << \",\"\n end\n end\n end\n\n # Each part of the name (the a and the b’s) ends in a period, until the name itself is complete, unless there's a subfield after it that takes a different mark of punctuation before it, like an e or it's got term subdivisons like $b LYRASIS $y 21th century.\n\n ['a', 'b'].each do |subfield|\n s_index = name_fields.find_index {|a| a[0] == subfield}\n\n # check if $subfield is present\n\n unless !s_index\n\n # find field and append a period if there isn't one there already\n unless name_fields[s_index][1][-1] == \".\" || name_fields[s_index][1][-1] == \",\"\n name_fields[s_index][1] << \".\"\n end\n end\n end\n\n apply_terminal_punctuation(name_fields)\n\n return name_fields\n end",
"def remove_postcode(name)\n return name.gsub(/\\d{3,}/, '').strip\n end",
"def name_slicer(names_switched)\n\tstringed_switched_name = names_switched.join(' ')\n\tstringed_switched_name.split(\"\")\nend",
"def swap_name(str)\n str.split.reverse.join(\", \")\nend",
"def get_ingredients \n # get rid of all characters that are not: a-z A-Z 0-9 - [] () . ' / , blank;\n clean_ingredients = self.ingredients.gsub(%r{[^a-zA-Z0-9\\-\\[\\]\\.\\,\\'\\(\\)\\/\\s]}, '')\n return clean_ingredients.split(', ').each { |ingredient| ingredient.strip! }\n end",
"def remove_chars(str)\n return str.gsub(/,/, \" \").gsub(/[^\\w\\d ]/,\"\").downcase.split\n end",
"def add_commas_to_types(field_names_and_types)\n field_names_and_types.each do |array|\n array[1] = array[1].upcase + \",\"\n end\n end",
"def raw_names\n raw_names = [name.downcase] + aliases.downcase.split(%r{,\\s*})\n raw_names += alternate_names.downcase.split(%r{,\\s*}) if !alternate_names.nil?\n raw_names\n end",
"def separate_comma(num)\n\tnum = num.to_s\n\tif num.length < 4\n\t\treturn num\n\telse\n\t\tnum = num.reverse.gsub(/(.{3})/, '\\1,').reverse\n\t\tif num[0] == \",\"\n\t\t\tnum[0] = \"\"\n\t\tend\n\t\treturn num\n\tend\nend",
"def strip_selector_space!\n replace self.gsub(/\\n/, \"\").gsub(\",\", \", \").gsub(\", \", \", \")\n end",
"def strip_it\n new_name = self.name.gsub(/^[^a-zA-Z]+/, '').gsub(/[^a-zA-Z]+$/, '') + \"?\"\n self.update_attribute(:name, new_name)\n end",
"def fix_subfield_demarcators(value)\n value.gsub(/\\|\\w{1}/,\"--\")\n end",
"def fix_external_trailing_comma(node, corrector); end",
"def remove_commas(params)\n\t\tparams[:tne_invoice][:invoice_amt]= params[:tne_invoice][:invoice_amt].gsub(',','') if params[:tne_invoice][:invoice_amt]\n\t\tparams[:tne_invoice][:final_invoice_amt] = params[:tne_invoice][:final_invoice_amt].gsub(',','') if params[:tne_invoice][:final_invoice_amt]\n\t\tparams[:tne_invoice][:discount] = params[:tne_invoice][:discount].gsub(',','') if params[:tne_invoice][:discount]\n\t\tif params[:tne_invoice][:tne_invoice_details_attributes]\n\t\t\tparams[:tne_invoice][:tne_invoice_details_attributes].each do |k,v|\n\t\t\t\tparams[:tne_invoice][:tne_invoice_details_attributes][k][:amount] = params[:tne_invoice][:tne_invoice_details_attributes][k][:amount].gsub(',','')\n\t\t\t\tparams[:tne_invoice][:tne_invoice_details_attributes][k][:rate] = params[:tne_invoice][:tne_invoice_details_attributes][k][:rate].gsub(',','') if params[:tne_invoice][:tne_invoice_details_attributes][k][:rate]\n\t\t\tend\n\t\tend\n\t\tparams[:primary_tax_value] = params[:primary_tax_value].gsub(',','') if params[:primary_tax_value]\n\t\tparams[:secondary_tax_value] = params[:secondary_tax_value].gsub(',','') if params[:secondary_tax_value]\n\t\treturn params\n\tend",
"def move_commas_outside_outdents\n scan_tokens do |prev, token, post, i|\n if token[0] == :OUTDENT && prev[0] == ','\n @tokens.delete_at(i)\n @tokens.insert(i - 1, token)\n end\n next 1\n end\n end",
"def db_sanitize_name(name)\n (i = name.index(';')) and name = name[0...i]\n name.scan(/[\\w\\s]+/).join\nend",
"def trim_name_whitespace!\r\n self.name.strip!\r\n end",
"def normal_name(text)\n\t\t\tar = text.split(', ')\n\t\t\tlastname = ar[0]\n\t\t\tfirstpart = ar[1]\n\t\t\tfirstname = firstpart.gsub(/[[:upper:]]\\./, '').strip\n\t\t\tfirstname + ' ' + lastname\n\t\tend"
] | [
"0.70201904",
"0.692563",
"0.6634512",
"0.647524",
"0.6436294",
"0.6103208",
"0.6097855",
"0.6097855",
"0.60813886",
"0.6057161",
"0.6024773",
"0.6012544",
"0.5993728",
"0.5979346",
"0.59728575",
"0.59728575",
"0.59635544",
"0.59599197",
"0.5939945",
"0.5928204",
"0.5914653",
"0.5878975",
"0.58623064",
"0.58606863",
"0.5849387",
"0.58204657",
"0.5817471",
"0.5817471",
"0.5798877",
"0.5796634",
"0.57760453",
"0.5772731",
"0.5755936",
"0.57359296",
"0.5732253",
"0.5731277",
"0.5731277",
"0.5731277",
"0.5731277",
"0.5701906",
"0.5695727",
"0.5694649",
"0.568231",
"0.5651327",
"0.5648954",
"0.5640593",
"0.5639119",
"0.56227314",
"0.5619511",
"0.5606497",
"0.5602194",
"0.55984485",
"0.5595822",
"0.5595342",
"0.55830646",
"0.55794716",
"0.5576066",
"0.55698395",
"0.55684227",
"0.5567936",
"0.5558955",
"0.5546392",
"0.55432093",
"0.5536964",
"0.5525796",
"0.5522621",
"0.551552",
"0.55096406",
"0.5508722",
"0.5505306",
"0.5502512",
"0.5499751",
"0.54993594",
"0.54899985",
"0.548219",
"0.5481618",
"0.5473172",
"0.5471664",
"0.5470494",
"0.5467097",
"0.5466738",
"0.5465858",
"0.546523",
"0.5460696",
"0.54590523",
"0.545522",
"0.54537964",
"0.5451547",
"0.545115",
"0.5434495",
"0.54258424",
"0.5423957",
"0.54231983",
"0.5415246",
"0.54012305",
"0.5396291",
"0.53961843",
"0.53894424",
"0.53864574",
"0.53859824",
"0.5381969"
] | 0.0 | -1 |
creates copy of specializations with S on end of code | def copy_old_corridors(specializations)
specializations.map {|c|
c.clone.save
c.code = "%sS" % c.code
c.accredited = false
c.save
c
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates=(_arg0); end",
"def specializeMethodOrConstructor(newMethodName, arguments, store = Store.new)\n #this collection contains the parameters that need to be removed because the arguments passed in for the parameters are compile time\n paramsToRemove = []\n\n #loop through all the arguments and check if it are compile time variables.\n #if it is a compile time argument add it to the store and to the paramsToRemove collection.\n argCount = (arguments.respond_to? :length) ? arguments.length : 0\n\n return nil, nil if(argCount != @astNode.params.elements.length && !store.inStore?(Helpers.blockIdentifier))\n\n for i in 0..argCount-1\n paramName = @astNode.params.elements[i].param.token\n if (Helpers.compileTime?(arguments[i]))\n store.update(StoreVar.new(paramName, arguments[i], :compileTime))\n paramsToRemove << i\n else\n store.update(StoreVar.new(paramName, arguments[i], (arguments[i].respond_to?(:external) && arguments[i].external) ? :external : :runtime))\n end\n end\n\n #the cloned Method gets partial evaluated so it becomes the specialized method\n clonedMethod = @astNode.deep_copy\n\n #remove the parameters that contain ct arguments.\n paramsToRemove.reverse.each { |i| clonedMethod.params.elements.delete_at(i) }\n env = PeEnv.new\n env.store = store\n\n #set the new name of the method.\n clonedMethod.peIdentifier = newMethodName\n\n #be sure that there is always a whitespace between the method name and the first parameter and that it is not a \",\"\n if (clonedMethod.params.elements[0] && clonedMethod.params.elements[0].prolog.elements[0])\n clonedMethod.params.elements[0].prolog.elements[0].token = \" \"\n end\n\n #partial evaluate the method with the ct arguments mapped to the parameters of the method (using the store).\n peBodyExpResult, peBodyValueResult = clonedMethod.peBody(env)\n\n return clonedMethod, peBodyValueResult\n end",
"def specializations\n @specializations ||= Specialization.from_models(self, @models)\n end",
"def initialize(specifications = T.unsafe(nil)); end",
"def standard_specs; end",
"def build_singleton0(type_name); end",
"def lock_in_subs\n default_subs = []\n case @content_model\n when :simple\n default_subs = SUBS[:normal]\n when :verbatim\n if @context == :listing || (@context == :literal && !(option? 'listparagraph'))\n default_subs = SUBS[:verbatim]\n else\n default_subs = SUBS[:basic]\n end\n when :raw\n default_subs = SUBS[:pass]\n else\n return\n end\n\n if (custom_subs = @attributes['subs'])\n @subs = resolve_block_subs custom_subs, @context\n else\n @subs = default_subs.dup\n end\n\n # QUESION delegate this logic to method?\n if @context == :listing && @style == 'source' && (@document.basebackend? 'html') &&\n ((highlighter = @document.attributes['source-highlighter']) == 'coderay' ||\n highlighter == 'pygments') && (attr? 'language')\n @subs = @subs.map {|sub| sub == :specialcharacters ? :highlight : sub }\n end\n end",
"def sb(t, s, c)\n\n end",
"def initialize()\n #@source = aSourceTemplate\n #@representation = compile(aSourceTemplate)\n end",
"def extensions_for(template_class); end",
"def extensions_for(template_class); end",
"def add_spec sym, spec \n SPECS[sym] = spec\n end",
"def add_spec sym, spec \n SPECS[sym] = spec\n end",
"def copy_tmpl_args\n c = input()\n save_setqual = nil\n isDelphi4name = (c == 'S' || c == 'D') && (@source =~ /\\A(Set|DynamicArray|SmallString|DelphiInterface)\\$/)\n\n # Output the base name of the template. We use 'copy_name' instead of\n # 'copy_until', since this could be a template constructor name, f.ex.\n\n copy_name(1)\n assert(input() == ARGLIST)\n advance()\n\n # using @target[-1] will be ambiguous for ruby's string[-1] - last char of string\n copy_char(' ') if (@target-1)[0] == '<'\n copy_char('<')\n\n # Copy the template arguments over. Also, save the\n # '@set_qual' variable, since we don't want to mix up the\n # status of the currently known qualifier name with a\n # name from a template argument, for example.\n\n save_setqual = @set_qual\n @set_qual = false\n\n if isDelphi4name\n copy_delphi4args(TMPLCODE, 1)\n else\n copy_args(TMPLCODE, 1)\n end\n\n @set_qual = save_setqual\n\n # using @target[-1] will be ambiguous for ruby's string[-1] - last char of string\n copy_char(' ') if (@target-1)[0] == '>'\n copy_char('>')\n\n assert(input() == TMPLCODE)\n advance()\n end",
"def generate_rdf_specific(b,ty)\n case ty\n when 'thesis'\n th = setup_thesis_info(to_marc)\n typ = th[:type].to_s\n Rails.logger.debug \"********es287_dev #{__FILE__} #{__LINE__} #{__method__} #{th.inspect}\"\n b.z(:type,typ)\n else\n end\n end",
"def test_generate_raw_arity_0\n src = \"VALUE y(VALUE self) {blah;}\"\n\n expected = \"static VALUE y(VALUE self) {blah;}\"\n\n util_generate_raw(src, expected)\n end",
"def prepare_sproc(type, name)\n sp = clone\n prepare_extend_sproc(sp)\n sp.sproc_type = type\n sp.sproc_name = name\n sp\n end",
"def extends!(spec)\r\n @extended_spec.clear.push(spec)\r\n end",
"def register_spec_type(*args, &block); end",
"def test_singletemplates\n template = tempfile\n\n File.open(template, \"w\") do |f|\n f.puts \"template <%= @yay.nil?() ? raise('yay undefined') : @yay %>\"\n end\n\n func = nil\n assert_nothing_raised do\n\n func = Puppet::Parser::AST::Function.new(\n\n :name => \"template\",\n :ftype => :rvalue,\n\n :arguments => AST::ASTArray.new(\n :children => [stringobj(template)]\n )\n )\n end\n ast = varobj(\"output\", func)\n\n scope = mkscope\n assert_raise(Puppet::ParseError) do\n ast.evaluate(scope)\n end\n\n scope.setvar(\"yay\", \"this is yay\")\n\n assert_nothing_raised do\n ast.evaluate(scope)\n end\n\n\n assert_equal(\n \"template this is yay\\n\", scope.lookupvar(\"output\"),\n\n \"Templates were not handled correctly\")\n\n end",
"def create_instr_specs()\n instr_specs = []\n INSTR_DEFS.each do |instr_def|\n\tinstr_specs <<= extract_spec(instr_def)\n end\n instr_specs\nend",
"def build_stubbed(name, *traits_and_overrides, &block); end",
"def initialize_extension_partials\n @extension_partials = []\n end",
"def c_singleton src, options = {}\n options = {\n :expand_types => true,\n :singleton => true,\n }.merge options\n self.generate src, options\n end",
"def find_templates(name, prefix, partial, details)\n # checks if the format has a fallback chain\n if @fallback_formats.has_key?(details[:formats].first)\n details = details.dup\n details[:formats] = Array.wrap(@fallback_formats[details[:formats].first]) \n end\n super(name, prefix, partial, details)\n end",
"def initialize (template); @template = template; end",
"def singular_siegler; end",
"def simplify\n ꜧ = self.to_hash\n puts \"simplifying #{ꜧ}\" if SY::DEBUG\n SIMPLIFICATION_RULES.each { |rule| rule.( ꜧ ) }\n self.class[ ꜧ ].tap { |_| puts \"result is #{_}\" if SY::DEBUG }\n end",
"def create_easy_type_source\n create_source(TYPE_TEMPLATE, type_path)\n end",
"def s(type, *children); end",
"def build(name, *traits_and_overrides, &block); end",
"def spec_type(desc, *additional); end",
"def build_object(symbol)\n @template.instance_variable_get(\"@#{symbol}\") || Inflections.constantize(Inflections.camelize(symbol)).new\n end",
"def create_specialized_class(env, base_class_name, type_args)\n gen_cls = env.find_class(base_class_name)\n raise if !(SkGenericClass === gen_cls) &&\n !(SkGenericMetaClass === gen_cls)\n sp_cls = gen_cls.specialized_class(type_args, env)\n gen_meta = env.find_meta_class(base_class_name)\n sp_meta = gen_meta.specialized_class(type_args, env)\n return sp_cls, sp_meta\n end",
"def readwrite(*syms)\n return if syms.size == 0\n code = \"\"\n syms.each do |s|\n code << \"def #{s}; #{S}; end\\n\"\n code << \"def #{s}=(value); #{s}=value; end\\n\"\n end \n class_eval code \n end",
"def sld; end",
"def to_specs\n [to_spec]\n end",
"def variants; end",
"def spec=(_arg0); end",
"def generate_sunippets\n sunippet_define = read_sunippetdefine\n dsl = Dsl.new\n dsl.instance_eval sunippet_define\n output_methods(dsl)\n output_requires(dsl)\n end",
"def template_map\n \n end",
"def make_template obj\n return obj unless obj.respond_to? :to_ary or obj.respond_to? :to_hash\n spec = Marshal.load(Marshal.dump(obj))\n rot_for(spec).optimize!\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def to_prepare_blocks; end",
"def slug_generator_class=(_arg0); end",
"def generator_type() = self.class.name.deconstantize.underscore",
"def initialize_copy( original )\n\t\t\t@template = original.template\n\t\t\t@options = original.options.dup\n\t\t\t@tree = @tree.map( &:dup )\n\t\t\t@node_stack = [ @tree ]\n\t\t\t@include_stack = original.include_stack.dup\n\t\tend",
"def regenerate_helpers!; end",
"def to_register(compiler, source)\n type = known_object.get_type\n raise \"not sym for #{known_object}\" if type.is_a?(String)\n right = compiler.use_reg( type )\n const = Risc.load_constant(source, known_object , right)\n compiler.add_code const\n if slots_length > 1\n # desctructively replace the existing value to be loaded if more slots\n compiler.add_code Risc.slot_to_reg( source , right ,slots.name, right)\n end\n if slots_length > 2\n # desctructively replace the existing value to be loaded if more slots\n index = Risc.resolve_to_index(slots.name , slots.next_slot.name ,compiler)\n compiler.add_code Risc::SlotToReg.new( source , right ,index, right)\n if slots_length > 3\n raise \"3 slots only for type #{slots}\" unless slots.next_slot.next_slot.name == :type\n compiler.add_code Risc::SlotToReg.new( source , right , Parfait::TYPE_INDEX, right)\n end\n end\n return const.register\n end",
"def boilerplate(s)\n\n #Naming according to conventions\n s.metadata[\"namespaced_path\"] = s.name.tr('-', '/')\n s.metadata[\"constant_name\"] = camelize(s.metadata[\"namespaced_path\"])\n\n #Add lib to path so that the version file can be loaded\n lib = File.expand_path('lib')\n $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\n\n #Bootstrap the lib directory along with the basic *.rb files\n #This won't overwrite existing files\n Gemspec::bootstrap_lib!(s)\n\n #Get VERSION and VERSION_FOR_HUMANS from the version file\n require \"#{s.metadata[\"namespaced_path\"]}/version\"\n spec_module = Object.const_get(s.metadata[\"constant_name\"])\n s.version = spec_module::VERSION\n s.metadata[\"human_version\"] = spec_module::VERSION_FOR_HUMANS\n\n #Specify common paths and files\n s.test_files = Git::ls_files.grep(%r{^(test|s|features)/})\n s.files = Git::ls_files.reject { |f| f.match(%r{^(test|s|features)/}) }\n s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }\n s.require_paths = [\"lib\"]\n\n #Authors are all committers or `git config user.name` if the former is empty\n s.authors = Git::ls_authors\n end",
"def generate\n sensuctl_types = []\n Dir[File.join(File.dirname(__FILE__), '../provider/sensu_*/sensuctl.rb')].each do |file|\n type = File.basename(File.dirname(file))\n sensuctl_types << type.to_sym\n end\n sensuctl_types.each do |type|\n provider_class = Puppet::Type.type(type).provider(:sensuctl)\n provider_class.chunk_size = self[:chunk_size]\n provider_class.validate_namespaces = self[:validate_namespaces]\n provider_class.path = self[:path]\n end\n []\n end",
"def make(thing) end",
"def generate_types\n pal.generate_types(cache: true)\n end",
"def readwrite(*syms)\nreturn if syms.size == 0\ncode = \"\"\nsyms.each do |s|\ncode << \"def #{s}; @#{s} end\\n\"\ncode << \"def #{s}=(value); @#{s} = value; end\\n\"\nend\nclass_eval code\nend",
"def rewrite_sexpr(sexpr)\n case sexpr\n when SExp::List\n case sexpr[0].to_s\n when \"switchdoor\"\n sexpr.strip()\n reader = SExp::Reader.new(sexpr)\n\n switch_reader = reader.read_section(\"switch\")\n switch_pos = switch_reader.read_real_array(\"position\")\n\n door_reader = reader.read_section(\"door\")\n door_pos = door_reader.read_real_array(\"position\")\n door_height = door_reader.read_integer_array(\"height\")\n\n id = \"id#{rand(2**32)}\"\n\n return [SExp::List.new([SExp::Symbol.new(\"switchdoor-switch\"),\n SExp::Whitespace.new(\"\\n \"),\n SExp::List.new([SExp::Symbol.new(\"target-id\"),\n SExp::String.new(id)]),\n SExp::Whitespace.new(\"\\n \"),\n SExp::List.new([SExp::Symbol.new(\"position\")] +\n switch_pos.map{|i| SExp::Integer.new(i)})]),\n SExp::Whitespace.new(\"\\n \"),\n SExp::List.new([SExp::Symbol.new(\"switchdoor-door\"),\n SExp::Whitespace.new(\"\\n \"),\n SExp::List.new([SExp::Symbol.new(\"id\"),\n SExp::String.new(id)]),\n SExp::Whitespace.new(\"\\n \"),\n SExp::List.new([SExp::Symbol.new(\"height\"),\n SExp::Integer.new(door_height)]),\n SExp::Whitespace.new(\"\\n \"),\n SExp::List.new([SExp::Symbol.new(\"position\")] +\n door_pos.map{|i| SExp::Integer.new(i)})])]\n else\n lst = SExp::List.new([])\n sexpr.each{|i|\n el = rewrite_sexpr(i)\n if el\n if el.is_a?(Array)\n lst.concat(el)\n else\n lst.append(el)\n end\n end\n }\n return lst\n end\n else\n return sexpr\n end\nend",
"def custom_type_one\n one_helper + shared\n end",
"def dematerialize ; end",
"def initialize_templater\n @stategies = []\n @template_options = {}\n end",
"def _compile!\n code = @collection.attributes.map do |_,(klass,mapped)|\n %{\n def deserialize_#{ mapped }(value)\n Lotus::Utils::Kernel.#{klass}(value)\n end\n }\n end.join(\"\\n\")\n\n instance_eval %{\n def to_record(entity)\n if entity.id\n Hash[*[#{ @collection.attributes.map{|name,(_,mapped)| \":#{mapped},entity.#{name}\"}.join(',') }]]\n else\n Hash[*[#{ @collection.attributes.reject{|name,_| name == @collection.identity }.map{|name,(_,mapped)| \":#{mapped},entity.#{name}\"}.join(',') }]]\n end\n end\n\n def from_record(record)\n #{ @collection.entity }.new(\n Hash[*[#{ @collection.attributes.map{|name,(klass,mapped)| \":#{name},Lotus::Utils::Kernel.#{klass}(record[:#{mapped}])\"}.join(',') }]]\n )\n end\n\n #{ code }\n }\n end",
"def process_specs\n source_path = configuration['specs']['source_path']\n destin_path = configuration['specs']['destin_path']\n ignored_paths = configuration['specs']['ignored_paths']\n ignored_methods = configuration['specs']['ignored_methods']\n\n find_files_without(source_path, ignored_paths).each do |path|\n next unless path.include?('/models/') || path.include?('/controllers/') || path.include?('/helpers/')\n @spec_template = indent_template(spec_template, 0)\n @spec_describe_template = spec_describe_template.gsub(' ' * 8, ' ' * 2).strip.prepend(' ' * 2)\n\n spath = path.split(\"./#{source_path}/\")[1]\n dpath = \"./#{destin_path}/#{spath}\".gsub('.rb', '_spec.rb')\n\n unless File.exists?(dpath)\n methods_names_source = extract_methods_names_from_file(path)\n specs_methods_to_string = methods_names_source.map do |method_name|\n @spec_describe_template.gsub('%{method_name}', method_name)\n end.join(\"\\n\\n\")\n\n @spec_template = @spec_template.gsub('%{class}', extract_spec_name(path))\n @spec_template = @spec_template.gsub('%{methods}', specs_methods_to_string)\n @spec_template = @spec_template.gsub('%{file_path}', path)\n @spec_template = @spec_template.gsub('%{class_type}', extract_spec_type(path))\n @spec_template = @spec_template.gsub('%{author_name}', extract_author_name)\n\n FileUtils.mkdir_p(File.dirname(dpath))\n File.new(dpath, 'w+').puts(@spec_template)\n end\n end\n end",
"def as_replacements; end",
"def as_replacements; end",
"def as_replacements; end",
"def initialize(options)\n @mode = options[:mode].to_sym rescue options[:mode]\n raise \"invalid mode #{@mode}, expected one of: #{VALID_MODES.join(', ')}\" \\\n unless VALID_MODES.include?(@mode)\n\n @parlour = options[:parlour] || \\\n case @mode\n when :rbi\n Parlour::RbiGenerator.new\n when :rbs\n Parlour::RbsGenerator.new\n end\n @current_object = options[:root] || @parlour.root\n\n @namespace_count = 0\n @method_count = 0\n @warnings = []\n\n @replace_errors_with_untyped = options[:replace_errors_with_untyped]\n @replace_unresolved_with_untyped = options[:replace_unresolved_with_untyped]\n @keep_original_comments = options[:keep_original_comments]\n @hide_private = options[:hide_private]\n @skip_constants = options[:skip_constants]\n @use_original_initialize_return = options[:use_original_initialize_return]\n @exclude_untyped = options[:exclude_untyped]\n\n @type_converter_config = TypeConverter::Configuration.new(\n output_language: @mode,\n replace_errors_with_untyped: @replace_errors_with_untyped,\n replace_unresolved_with_untyped: @replace_unresolved_with_untyped,\n )\n\n # Hook the logger so that messages are added as comments\n Logging.add_hook do |type, msg, item, **opts|\n # Hack: the \"exclude untyped\" log message needs to print somewhere, but\n # if there's no future object for that comment to associate with, it'll\n # never be printed!\n # Instead, add an arbitrary containing the comment\n if opts[:immediate]\n @current_object.create_arbitrary(code: \"# sord #{type} - #{msg}\")\n else\n @current_object.add_comment_to_next_child(\"sord #{type} - #{msg}\")\n end\n end if options[:sord_comments]\n\n # Hook the logger so that warnings are collected\n Logging.add_hook do |type, msg, item|\n # TODO: is it possible to get line numbers here?\n warnings << [msg, item, 0] if type == :warn\n end\n end",
"def register(template_class, *extensions); end",
"def snat_type\n super\n end",
"def copy_special(value)\n case value\n when String then value.dup\n when SdArray then SdArray.from_sd_array value\n else value\n end\n end",
"def unique_section_object(key, container)\n Object.const_set(\"EDSLSpecSection#{key}\", Class.new(EDSL::PageObject::Section)).new(container)\nend",
"def pack\n\t\t@prototypes.values.collect do |object|\n\t\t\tnext unless object.respond_to? :pack\n\t\t\t\n\t\t\tclass_name = object.class.name.split('::').last # ignore modules\n\t\t\t[class_name] + object.pack\n\t\tend\n\tend",
"def types(types); end",
"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 prelude_type(t)\n case t\n when :render\n RenderType.new\n when :sequence\n SequenceType.new\n else\n CustomType.new(t)\n end\nend",
"def to_s\n <%= add_to_s %>\n end\n\n # @!group Constants\n<%= add_consts %>\n # @!endgroup\n\n # methods\n<%= add_methods %>\n\n # @!group Specializing\n<%= add_specializing %>\n # @!endgroup\n\n # types\n<%= add_types %>\n\nend",
"def template_locals template_name, supersed_options \n { :collection => @collection, :template_name => template_name, :separator => nil }.merge supersed_options\n end",
"def instantiate_subclasses(klass); end",
"def ps\n [VishParser.new, SexpTransform.new]\nend",
"def specs(s = nil, options = {})\n options = {\n type: nil,\n sub_type: nil,\n mode: current_mode.nil? ? nil : current_mode.name,\n spec: nil,\n symbol: false,\n creating_spec: false\n }.update(options || {})\n _specs\n if s.nil?\n show_specs(options)\n elsif s.is_a? Hash\n # no spec was passed but some option was passed\n options.update(s)\n show_specs(options)\n else\n # a spec was passed\n options[:spec] = s\n show_specs(options)\n end\n end",
"def deep_copy\n Sass::Util.abstract(self)\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 initialize spec, key_converter = nil\n unless spec.respond_to? :size and spec.respond_to? :each\n raise ArgumentError, \"cannot be used as a template: #{spec.inspect}\"\n end\n\n @spec = spec\n @size = spec.size\n @key_converter = key_converter\n @matchers = []\n \n if spec.respond_to? :to_hash # assume hash-like\n @shibboleth = :to_hash\n spec.each do |k, v|\n if key_converter\n k = key_converter[k => nil].keys[0]\n # Note: the [k=>nil].keys[0] is needed instead of just [k]\n # because the key_converter might not convert values, only keys.\n # We do not assume that k is a scalar.\n end\n fill_matchers k, v\n end\n\n else # assume array-like\n @shibboleth = :to_ary\n spec.each_with_index do |v, i|\n fill_matchers i, v unless v.nil?\n end\n end\n end",
"def prototype(*args)\n opts = args.extract_options!\n klass = args.shift || Layout\n\n if klass == Layout\n opts[:parent] ||= self.parent || self\n opts[:image_spec] ||= self.image_spec.try(:clone)\n opts[:name] ||= generate_copy_of_field(:name)\n opts[:template] ||= template\n opts[:region_types] ||= region_types\n else\n opts[:layout] ||= self\n end\n\n opts[:regions] ||= regions.map(&:copy)\n\n klass.new(opts).tap do |object|\n if klass.reflect_on_association(:images)\n object.images = image_specs.map do |image_spec|\n image_spec.image_mounts.build(:owner => object)\n end\n end\n\n if klass.reflect_on_association(:placements)\n object.placements = placeholders.map do |ph| \n ph.placements.build(:owner => object)\n end\n end\n end\n end",
"def templates; end",
"def create(name, *traits_and_overrides, &block); end",
"def initialize\n @templates = Array.new\n end",
"def test_gen\n assert_equal LFSR.gen(2).class, LFSR::Fast::Size3\n assert_equal LFSR.gen(3).class, LFSR::Fast::Size3\n assert_equal LFSR.gen(4).class, LFSR::Fast::Size3\n assert_equal LFSR.gen(5).class, LFSR::Fast::Size3\n assert_equal LFSR.gen(6).class, LFSR::Fast::Size3\n assert_equal LFSR.gen(7).class, LFSR::Fast::Size4\n assert_equal LFSR.gen(8).class, LFSR::Fast::Size4\n assert_equal LFSR.gen(9).class, LFSR::Fast::Size4\n\n assert_equal LFSR.gen(14).class, LFSR::Fast::Size4\n assert_equal LFSR.gen(15).class, LFSR::Fast::Size5\n assert_equal LFSR.gen(16).class, LFSR::Fast::Size5\n end",
"def new_plant(stem_type, leaf_type)\n plant = Object.new \n\n if stem_type == :fleshy\n def plant.stem\n 'fleshy'\n end\n else\n def plant.stem\n 'woody'\n end\n end\n\n if leaf_type == :broad\n def plant.leaf \n 'broad'\n end\n else\n def plant.leaf \n 'needle'\n end\n end\n plant\nend",
"def to_register(compiler, source)\n type = known_object.get_type\n raise \"not sym for #{known_object}\" if type.is_a?(String)\n last = Risc.load_constant(source, known_object)\n compiler.add_code last\n if slots_length > 1\n last = Risc.slot_to_reg( source , last.register ,slots.name)\n compiler.add_code(last)\n end\n if slots_length > 2\n last = Risc.slot_to_reg( source , last.register , slots.next_slot.name )\n compiler.add_code(last)\n end\n if slots_length > 3\n raise \"3 slots only for type #{slots}\" unless slots.next_slot.next_slot.name == :type\n last = Risc.slot_to_reg( source , last.register , slots.next_slot.name )\n compiler.add_code(last)\n end\n return last.register\n end",
"def types=(_arg0); end",
"def generate\n set_provider_paths\n\n resources = []\n\n {\n Puppet::Type::Splunk_alert_actions => self[:purge_alert_actions],\n Puppet::Type::Splunk_output => self[:purge_outputs],\n Puppet::Type::Splunk_input => self[:purge_inputs],\n Puppet::Type::Splunk_authentication => self[:purge_authentication],\n Puppet::Type::Splunk_authorize => self[:purge_authorize],\n Puppet::Type::Splunk_deploymentclient => self[:purge_deploymentclient],\n Puppet::Type::Splunk_distsearch => self[:purge_distsearch],\n Puppet::Type::Splunk_indexes => self[:purge_indexes],\n Puppet::Type::Splunk_metadata => self[:purge_metadata],\n Puppet::Type::Splunk_props => self[:purge_props],\n Puppet::Type::Splunk_server => self[:purge_server],\n Puppet::Type::Splunk_serverclass => self[:purge_serverclass],\n Puppet::Type::Splunk_transforms => self[:purge_transforms],\n Puppet::Type::Splunk_web => self[:purge_web],\n Puppet::Type::Splunk_uiprefs => self[:purge_uiprefs],\n Puppet::Type::Splunkforwarder_deploymentclient => self[:purge_forwarder_deploymentclient],\n Puppet::Type::Splunkforwarder_input => self[:purge_forwarder_inputs],\n Puppet::Type::Splunkforwarder_output => self[:purge_forwarder_outputs],\n Puppet::Type::Splunkforwarder_props => self[:purge_forwarder_props],\n Puppet::Type::Splunkforwarder_transforms => self[:purge_forwarder_transforms],\n Puppet::Type::Splunkforwarder_web => self[:purge_forwarder_web],\n Puppet::Type::Splunkforwarder_server => self[:purge_forwarder_server]\n }.each do |k, purge|\n resources.concat(purge_splunk_resources(k)) if purge == :true\n end\n\n resources\n end",
"def process\n title = statement.parameters.first.jump(:tstring_content, :ident).source\n\n # build Specification object\n # owner must be an RSpec::Context\n if owner.is_a?(YARD::CodeObjects::RSpec::Context)\n object = YARD::CodeObjects::RSpec::Specification.new(owner,title) do |spec|\n spec.source = statement.last.last.source.chomp\n spec.add_file(statement.file,statement.line)\n end\n owner.specifications << object # add spec to context\n register(object)\n end\n\n end",
"def generate(name); end",
"def clone_generic_family_with_generic_spares\n clone = self.dup\n self.generic_spares.each do | spare|\n clone_spare = spare.dup\n clone_spare.father_id = spare.id\n clone.generic_spares << clone_spare\n end\n clone.father = self\n clone\n end",
"def instantiate!\n (@@types[type] || []).each do |name, datatype|\n @named_elements[name.to_sym] = if datatype == :buffer\n remainder_as_buffer\n else\n send(\"read_#{datatype}\")\n end\n end\n end",
"def rsg(filename)\n # TODO: your implementation here\n rawdef = read_grammar_defs(filename)\n spldef = split_definition(rawdef)\n gram = to_grammar_hash(spldef)\n expand(gram)\n #Calls each function independently so that there was no confusion when\n #writing each one\n\nend",
"def create(macro_name, data, method_object = T.unsafe(nil)); end",
"def type=(_); end",
"def type=(_); end"
] | [
"0.54380274",
"0.54292226",
"0.5273696",
"0.51965106",
"0.5109746",
"0.50951195",
"0.5011174",
"0.4951381",
"0.49502075",
"0.48915944",
"0.48915944",
"0.48778608",
"0.48778608",
"0.48767236",
"0.48662916",
"0.48567697",
"0.48529667",
"0.48314938",
"0.4823196",
"0.48209405",
"0.47969225",
"0.477746",
"0.47690925",
"0.47598055",
"0.47444186",
"0.47307158",
"0.47229758",
"0.47208437",
"0.47202033",
"0.47062784",
"0.46936515",
"0.46889076",
"0.46822265",
"0.4664142",
"0.46613908",
"0.465908",
"0.46572074",
"0.46458435",
"0.4634394",
"0.46330765",
"0.46043673",
"0.46023715",
"0.45892337",
"0.45892337",
"0.45892337",
"0.45892337",
"0.4575918",
"0.45639712",
"0.45631602",
"0.4560956",
"0.45496616",
"0.45456755",
"0.45456493",
"0.4543093",
"0.453167",
"0.45200145",
"0.4517476",
"0.45132306",
"0.45095238",
"0.4508955",
"0.45056015",
"0.45055908",
"0.45046452",
"0.450455",
"0.450455",
"0.450455",
"0.44927904",
"0.44927594",
"0.4489895",
"0.44891843",
"0.44868618",
"0.4475823",
"0.44687283",
"0.44613945",
"0.44555342",
"0.44502637",
"0.44461018",
"0.444437",
"0.44422656",
"0.44397944",
"0.44397888",
"0.44358373",
"0.44247967",
"0.4421531",
"0.44214916",
"0.44189405",
"0.44173908",
"0.44151723",
"0.44150406",
"0.44124183",
"0.44122398",
"0.44121763",
"0.44121644",
"0.4402115",
"0.44002214",
"0.43951857",
"0.43837968",
"0.43803248",
"0.43793926",
"0.43793926"
] | 0.5362502 | 2 |
copies corridor subject from one to another corridor | def copy_corridor_subject(from_specialization, to_specialization)
SpecializationSubject.find_all_by_specialization_id(from_specialization).each {|cs|
csn = cs.clone
csn.update_attribute(:specialization_id, to_specialization)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_to(other); end",
"def assign_canned_subject\n self.subject = canned_subject\n end",
"def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end",
"def copy(new_prefix, other_vals = {})\n new_i = self.dup\n new_i.prefix = new_prefix\n other_vals.select { |key, val| new_i[key] = val }\n\n new_i.save!\n new_i.cc_sequences.first.destroy\n\n ref = {control_constructs: {}}\n ccs = {}\n PROPERTIES.each do |key|\n next if [:cc_conditions, :cc_loops, :cc_questions, :cc_sequences, :cc_statements].include?(key)\n ref[key] = {}\n self.__send__(key).find_each do |obj|\n new_obj = obj.dup\n ref[key][obj.id] = new_obj\n\n obj.class.reflections.select do |association_name, reflection|\n if association_name.to_s != 'instrument' && reflection.macro == :belongs_to\n unless obj.__send__(association_name).nil?\n new_obj.association(association_name).writer(ref[obj.__send__(association_name).class.name.tableize.to_sym][obj.__send__(association_name).id])\n end\n end\n end\n new_i.__send__(key) << new_obj\n end\n end\n\n ### Copy the control construct tree\n new_top_sequence = self.top_sequence.dup\n new_top_sequence.instrument_id = new_i.id\n new_top_sequence.save!\n deep_copy_children = lambda do |new_item, item|\n item.children.each do |child|\n new_child = child.dup\n new_child.instrument_id = new_i.id\n\n child.class.reflections.select do |association_name, reflection|\n if association_name.to_s != 'instrument' && association_name.to_s != 'parent' && reflection.macro == :belongs_to\n unless child.__send__(association_name).nil?\n new_child.association(association_name).writer(ref[child.__send__(association_name).class.name.tableize.to_sym][child.__send__(association_name).id])\n end\n end\n end\n\n new_item.children << new_child\n new_item.save!\n if child.is_a?(ParentalConstruct)\n deep_copy_children.call(new_child, child)\n end\n end\n end\n\n deep_copy_children.call(new_top_sequence, self.top_sequence)\n\n new_i\n end",
"def controller_copy(pass_obj=nil)\n from_name = @params[\"from_name\"]\n from_id = @params[\"from_id\"]\n from_rel = @params[\"from_rel\"]\n activity = @params[\"activity\"]\n to_name = @params[\"to_name\"]\n to_rel = @params[\"to_rel\"]\n to_ids = params[\"subjects\"].present? ? params[\"subjects\"].keys.to_a : []\n to_ids += [pass_obj.id.to_s] if (pass_obj.present? and !to_ids.include?(pass_obj.id.to_s))\n from_obj = from_name.singularize==\"user\" ? current_user : current_user.send(from_name.pluralize).find(from_id)\n for to_id in to_ids\n\tto_obj = current_user.send(to_name.pluralize).find(to_id)\n\tobj = to_obj.dup\n\tobj.update(makena(obj, :sender).split(\"_\").first.to_sym => obj.send(makena(obj, :sender).split(\"_\").first)+\"*\")\n\tobj.save\n\tfrom_id = obj.id\n\tif from_name==to_name\n\t sender, hsh = controller_sender_generate(from_name, to_id, from_rel, to_name, from_id, to_rel)\n\telse\n\t sender, hsh = controller_sender_generate(from_name, from_id, from_rel, to_name, to_id, to_rel)\n\tend\n\tcurrent_user.send(sender).find_or_create_by(hsh) if sender\n end\n notice = \"#{activity.upcase} #{from_name.humanize} #{(to_rel||to_name).humanize} processed.\"\n return [obj, notice]\n end",
"def copy(from, to)\n \n end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def subject=(_arg0); end",
"def copy_to\n\n cc_list = [self.designer.email]\n cc_list << self.design.designer.email if self.design.designer_id > 0\n\n self.design.board.users.each do |cc|\n cc_list << cc.email if cc.active?\n end\n\n cc_list += Role.add_role_members(['Manager', 'PCB Input Gate'])\n return cc_list.uniq\n\n end",
"def add_corridor_subjects(specialization_id, type, *ids)\n ids.each {|i|\n type.create(:subject_id => i, :specialization_id => specialization_id)\n }\n end",
"def contact_to!(subject)\n contact_to(subject) ||\n sent_contacts.create!(:receiver => Actor.normalize(subject))\n end",
"def set_subject(subject)\n\t\tend",
"def copy_group(from, to)\n sub_groups = from.getMemberGroups\n sub_groups.each do |g|\n to.addMember(g)\n end\n from.getMembers.each do |g|\n to.addMember(g)\n end\n to.update\n end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject; end",
"def subject(instructor, upsubj, schoolvar)\n\tschoolvar[:instructors].each do |instructors|\n\t\tif instructors[:name] == instructor\n\t\t\tinstructors[:subject] = upsubj \n\t\tend\n\tend\t\nend",
"def on subject\n @subject = subject\n self\n end",
"def copy(course_id)\n part = CourseParticipant.find_by_user_id_and_parent_id(self.user_id,course_id)\n if part.nil?\n CourseParticipant.create(:user_id => self.user_id, :parent_id => course_id) \n end\n end",
"def subject=(subject)\n @original_subject = subject\n @subject = subject.instance_of?(Class) ? subject.allocate : subject\n end",
"def assign_subject!\n return if subject_code.present?\n update(slice_subject_id: nil)\n end",
"def copy_values_from(other)\n self.name = other.name\n self.contributor = other.contributor\n self.share_mode = other.share_mode\n self.update_mode = other.update_mode\n self.public_view = other.public_view\n self.public_download = other.public_download\n end",
"def distribute_cc\n\n self.get_target_users.each do |user_id|\n next if self.user_id == user_id\n\n decided_inbox = WorkflowsHelper.get_decided_inbox(user_id)\n copied_item = self.item.copy(user_id, decided_inbox.id)\n end\n end",
"def subject=(subject)\n self.subjects = [subject]\n end",
"def prepare_copies\n return if to.blank?\n \n to do |recipient|\n recipient = User.find(recipient)\n message_copies.build(:recipient_id => recipient.id)\n end\n end",
"def copy_attributes(other, duplicator)\n self.course = duplicator.options[:destination_course]\n self.default_reference_time = duplicator.duplicate(other.default_reference_time)\n\n other_reference_times = other.reference_times - [other.default_reference_time]\n self.reference_times = duplicator.duplicate(other_reference_times).unshift(default_reference_time)\n\n self.title = other.title\n self.description = other.description\n self.published = duplicator.options[:unpublish_all] ? false : other.published\n self.base_exp = other.base_exp\n self.time_bonus_exp = other.time_bonus_exp\n end",
"def copy_wells(from_collection:, to_collection:, association_map:)\n association_map.each do |map|\n to_loc = map[:to_loc]\n from_loc = map[:from_loc]\n item = from_collection.part(from_loc[0], from_loc[1])\n to_collection.set(to_loc[0], to_loc[1], item)\n end\n end",
"def subject(&block); end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def conversar(person_one, person_two)\n person_one.hablar\n person_two.hablar\nend",
"def replicate(to_mission_or_replication = nil)\n\n # if mission or nil was passed in, we don't have a replication object, so we need to create one\n # a replication is an object to track replication parameters\n if to_mission_or_replication.is_a?(Replication)\n replication = to_mission_or_replication\n else\n replication = Replication.new(:src_obj => self, :to_mission => to_mission_or_replication)\n end\n\n # wrap in transaction if this is the first call\n return replication.redo_in_transaction unless replication.in_transaction?\n\n # do logging after redo_in_transaction so we don't get duplication\n Rails.logger.debug(replication.to_s) if self.class.log_replication?\n\n # if we're on a recursive step AND we're doing a shallow copy AND this is not a join class,\n # we don't need to do any recursive copying, so just return self\n if replication.recursed? && replication.shallow_copy? && !JOIN_CLASSES.include?(self.class.name)\n add_replication_dest_obj_to_parents_assocation(replication, self)\n return self\n end\n\n # if we get this far we DO need to do recursive copying\n # get the obj to copy stuff to, and also tell the replication object about it\n replication.dest_obj = dest_obj = setup_replication_destination_obj(replication)\n\n # set the proper mission ID if applicable\n dest_obj.mission_id = replication.to_mission.try(:id)\n\n # copy attributes from src to parent\n replicate_attributes(replication)\n\n # ensure uniqueness params are respected\n ensure_uniqueness_when_replicating(replication)\n\n # call a callback if requested\n self.send(replicable_opts(:after_copy_attribs), replication) if replicable_opts(:after_copy_attribs)\n\n # add dest_obj to its parent's assoc before recursive step so that children can access it\n add_replication_dest_obj_to_parents_assocation(replication)\n\n # if this is a standard obj, add the newly replicated dest obj to the list of copies\n # unless it is there already\n add_copy(dest_obj) if is_standard?\n\n replicate_child_associations(replication)\n\n dest_obj.save!\n\n return dest_obj\n end",
"def subject\n\t\t@subjct || (@subject = creation_block.call)\n\tend",
"def exact_copy(from_collection, to_collection: nil, label_plates: false)\n collection_type = from_collection.object_type\n if to_collection.nil?\n to_collection = make_new_plate(collection_type, label_plate: label_plates)\n end\n matrix = from_collection.matrix\n to_collection.matrix = matrix\n to_collection\n end",
"def reproduce_with(other)\n c = Chromosome.new\n self.length.times do |i|\n c << ((rand > 0.5) ? self[i] : other[i])\n end\n c\n end",
"def other_subjectify(options = {})\n generate_links(:subject, options)\n end",
"def update!(**args)\n @subject = args[:subject] if args.key?(:subject)\n end",
"def copy_old_corridors(specializations)\n specializations.map {|c|\n c.clone.save\n c.code = \"%sS\" % c.code\n c.accredited = false\n c.save\n c\n }\n end",
"def rewrite_statement_uris(old_subject, new_subject)\n graph.query(subject: old_subject).each do |st|\n graph.delete(st)\n\n st.subject = new_subject\n st.object = new_subject if st.object == old_subject\n graph.insert(st)\n end\n\n graph.query(object: old_subject).each do |st|\n graph.delete(st)\n\n st.object = new_subject\n graph.insert(st)\n end\n end",
"def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end",
"def subject\n subtype_instance\n end",
"def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end",
"def subject(value)\n merge(subject: value.to_s)\n end",
"def ties_to(subject)\n sent_ties.merge(Contact.received_by(subject))\n end",
"def initialize_copi(other)\n self.objects = other.objects.dup\n end",
"def createAssociation\n bda = nil\n if (@source.class == UONObject) && (@destination.class == UONObject) then\n # need to create three items: associator, two connections\n ed = self.getEditor\n \n # position half-way between the @source and the @destination\n srcCenter, destCenter, w = @source.getCenter, @destination.getCenter, 15\n x0, y0 = (srcCenter[0] + destCenter[0])/2, (srcCenter[1] + destCenter[1])/2\n\n bda = UONAssociator.new( ed.getModelCanvas, x0, y0, x0 + w, y0 + w, ed)\n # will need to passivate bda srcConnector and destConnector attributes, and fill color\n bda.srcConnector = UONConnection.new( ed.getModelCanvas, 0, 0, 0, 0, ed, @source, bda) {\n updateCoords; filling \"purple\"; lower\n }\n bda.destConnector = UONConnection.new( ed.getModelCanvas, 0, 0, 0, 0, ed, bda, @destination) {\n updateCoords; filling \"purple\"; lower\n }\n end\n bda\n end",
"def enroll(subject)\n\t\tsubjects[subject] = []\n\t\tsubjects\n\tend",
"def shift\n return nil if empty?\n\n value = first\n old_subject, new_subject = subject, rest_subject\n graph.delete([old_subject, RDF.type, RDF.List])\n graph.delete([old_subject, RDF.first, value])\n graph.delete([old_subject, RDF.rest, new_subject])\n\n @subject = new_subject\n return value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def send!(to_array, subject)\n begin\n conversation = Conversation.new\n conversation.subject = subject\n \n conversation.messages << self\n \n self.save!\n conversation.save!\n \n senderconversation = Userconversation.new\n senderconversation.user = self.sender\n senderconversation.readed = true\n senderconversation.conversation = conversation\n senderconversation.hide = false\n senderconversation.save!\n \n to_array.each do |to|\n receiverconversation = Userconversation.new\n receiverconversation.user = to\n receiverconversation.readed = false\n receiverconversation.hide = false\n receiverconversation.conversation = conversation\n receiverconversation.save!\n end\n return true\n rescue\n return false\n end\n end",
"def prep_subject(subject)\n add_command_requirements(subject)\n @command_set.add_defaults(subject)\n subject.required_fields(subject_requirements())\n subject.undo_stack = @undo_stack\n subject.command_set = @command_set\n subject.chain_of_command = @commands_pending\n subject.pause_decks = @pause_decks\n subject.mode_stack = @sub_modes\n return subject\n end",
"def subject\n @subject\n end",
"def subject\n @subject\n end",
"def inverse_company_id_field\n :subject_company_id\nend",
"def contact_to(subject)\n sent_contacts.received_by(subject).first\n end",
"def change_subject(school, instructor_name2, new_subject)\n school[:instructors].each do |instructor|\n if instructor_name2 == instructor[:name]\n instructor[:subject] = new_subject\n puts \"#{instructor_name2}'s subject has been updated to #{new_subject}\"\n end\n end\nend",
"def update_subject(school, name, subject)\n\tschool[:instructors].each { |instructor| instructor[:subject] = subject if instructor[:name] == name}\nend",
"def transfer_videos_to_default_subject\n subject = Subject.find(params[:id])\n unless subject.videos.empty?\n default_subject = Subject.where(default_subject: true, user_id: subject.user_id)[0]\n subject.videos.each do |video|\n video.update_attributes(subject_id: default_subject.id)\n end\n end\n end",
"def copy\n \n end",
"def update_from(other)\n @name = other.name\n @position = other.position\n @topic = other.topic\n @recipients = other.recipients\n @bitrate = other.bitrate\n @user_limit = other.user_limit\n @permission_overwrites = other.permission_overwrites\n @nsfw = other.nsfw\n @parent_id = other.parent_id\n @rate_limit_per_user = other.rate_limit_per_user\n end",
"def copy_graph\n @cadj_lists = adj_lists.clone\n @ca_matrix = a_matrix.clone\n end",
"def copy(seq, mailbox)\n tagged_response(\"COPY\", Net::IMAP::MessageSet.new(seq), to_utf7(mailbox))\n end",
"def update_subject(topic=[], geographic=[], temporal=[])\n\t\t#index = self.mods(0).subject.count\n\t\tindex = 0\n\t\tx = topic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif topic[x].strip == ''\n\t\t\t\ttopic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = geographic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif geographic[x].strip == ''\n\t\t\t\tgeographic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = temporal.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif temporal[x].strip == ''\n\t\t\t\ttemporal.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tself.mods(0).subject(index).topic = topic\n\t\tself.mods(0).subject(index).geographic = geographic\n\t\tself.mods(0).subject(index).temporal = temporal\n\tend",
"def clone\n copy = super\n transaction do\n copy.save!\n\n %w[\n registration_information support information_source advance_directive\n ].each do |assoc|\n copy.send(\"#{assoc}\\=\", send(assoc).clone) if send(assoc)\n end\n\n %w[\n patient_identifiers languages providers medications allergies conditions\n all_results immunizations encounters procedures medical_equipments social_history insurance_providers\n ].each do |assoc|\n send(assoc).each do |item|\n copy.send(assoc) << item.clone\n end\n end\n\n end\n copy\n end",
"def clone\n duplicate = self.class.new(source_end.client, target_end.client)\n duplicate.adopt(self)\n\n duplicate\n end",
"def copy_role( from_task_id, to_task_id )\n raise RuntimeError.new( \"from_task_id #{ from_task_id } does not exist.\" ) if from_task_id < 0 or from_task_id >= @task_list.count \n raise RuntimeError.new( \"to_task_id #{ to_task_id } does not exist.\" ) if to_task_id < 0 or to_task_id >= @task_list.count \n @task_list[ to_task_id ].role_id = @task_list[ from_task_id ].role_id\n end",
"def setup_replication_destination_obj(replication)\n # if this is a standard object AND we're copying to a mission AND there exists a copy of this obj in the given mission,\n # then we don't need to create a new object, so return the existing copy\n if is_standard? && replication.has_to_mission? && (copy = copy_for_mission(replication.to_mission))\n obj = copy\n else\n # otherwise, we init and return the new object\n obj = self.class.new\n end\n\n # set flag so that standardizable callback doesn't call replicate again unnecessarily\n obj.changing_in_replication = true\n\n obj\n end",
"def subject\n @subject\n end",
"def merge!(other); end",
"def subject= (subject)\n prep_subject(subject)\n\n subject.verify\n @subject = subject\n end",
"def for_subjects(subjects)\n result = Hash[subjects.map {|node| [node, false]}]\n subjects_by_id = Hash[subjects.map {|subject| [subject.id, subject]}]\n subject_rlshp_sources = Hash.new { |h, k| h[k] = [] }\n [:subject, :subject_agent_subrecord, :subject_agent_subrecord_place].each do |t|\n Subject.relationship_dependencies[t].each { |d| subject_rlshp_sources[d] << t }\n end\n\n subject_rlshp_sources.each do |model, sources|\n sources.each do |source|\n # i.e. one or more: subject_rlshp, subject_agent_subrecord_rlshp, subject_agent_subrecord_place_rlshp\n link_relationship = model.find_relationship(source)\n link_table = link_relationship.table_name\n\n link_relationship.reference_columns_for(model).each do |model_link_column|\n link_relationship.reference_columns_for(Subject).each do |subject_link_column|\n # Join subject_rlshp to (e.g.) accession\n linked_records = model\n .join(link_table,\n Sequel.qualify(link_table, model_link_column) => Sequel.qualify(model.table_name, :id))\n .filter(Sequel.qualify(link_table, subject_link_column) => subjects_by_id.keys)\n .select(Sequel.qualify(model.table_name, :id),\n Sequel.qualify(model.table_name, :publish),\n Sequel.qualify(model.table_name, :suppressed),\n Sequel.as(Sequel.qualify(link_table, subject_link_column),\n :subject_id))\n\n if model.columns.include?(:repo_id)\n linked_records = linked_records\n .select_append(Sequel.as(Sequel.qualify(model.table_name, :repo_id),\n :repository_id))\n end\n\n published_status = if model.included_modules.include?(TreeNodes)\n for_tree_nodes(linked_records\n .select_append(Sequel.qualify(model.table_name, :parent_id),\n Sequel.qualify(model.table_name, :root_record_id))\n .all)\n elsif model.to_s =~ /^Agent/\n for_agents_linked_to_subject(linked_records.all)\n else\n for_top_level_records(linked_records.all)\n end\n\n published_status.each do |linked_record, published|\n if published\n result[subjects_by_id.fetch(linked_record[:subject_id])] = true\n end\n end\n end\n end\n end\n end\n\n result\n end",
"def copy(from, to)\n @parent.gemset_copy(from, to)\n end",
"def set_papersubject_subjectship\n @papersubject_subjectship = PapersubjectSubjectship.find(params[:id])\n end",
"def copy_from(original)\n self.template = original.template\n self.position = original.position\n self.data = original.data\n self\n end",
"def copy_to(other)\n copyable_attributes.each do |ivar|\n ivar = \"@#{ivar}\"\n other.instance_variable_set(ivar, instance_variable_get(ivar))\n end\n other.docstring = @docstring.to_raw\n other\n end"
] | [
"0.62365746",
"0.590587",
"0.5584064",
"0.55696654",
"0.54849213",
"0.5470133",
"0.53966343",
"0.53966343",
"0.53966343",
"0.53966343",
"0.53966343",
"0.53966343",
"0.53966343",
"0.53966343",
"0.53887695",
"0.53752095",
"0.5329787",
"0.529699",
"0.52954537",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5282319",
"0.5250302",
"0.524376",
"0.5238016",
"0.5234753",
"0.5229234",
"0.5219407",
"0.51877886",
"0.516875",
"0.51547295",
"0.5115323",
"0.51133746",
"0.5079084",
"0.50627905",
"0.50610477",
"0.5035478",
"0.50341916",
"0.5033799",
"0.50230306",
"0.5016004",
"0.499848",
"0.49881735",
"0.4971784",
"0.49712333",
"0.49580982",
"0.49516264",
"0.4942749",
"0.49364734",
"0.4933103",
"0.49197546",
"0.49090523",
"0.48970824",
"0.48922706",
"0.48922706",
"0.48922706",
"0.48922706",
"0.48922706",
"0.48922706",
"0.48738715",
"0.48677823",
"0.48598763",
"0.48598763",
"0.48592484",
"0.4856391",
"0.48466223",
"0.4845777",
"0.48367387",
"0.483484",
"0.48263654",
"0.4821857",
"0.4821598",
"0.48204306",
"0.48188213",
"0.48168236",
"0.48103136",
"0.48035273",
"0.4796075",
"0.47871524",
"0.47857416",
"0.47824124",
"0.47798193",
"0.47715092",
"0.47662064",
"0.4763713"
] | 0.77002716 | 0 |
adds corridor subjects from type and subjects ids | def add_corridor_subjects(specialization_id, type, *ids)
ids.each {|i|
type.create(:subject_id => i, :specialization_id => specialization_id)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_ids=(*ids)\n ids.flatten!\n subjects = subscribables_subscriptions.find(:all, :conditions => { :subscribable_type => 'Subject' })\n subscribables_subscriptions.delete(subjects)\n subscribables.reload\n unless ids == [0]\n ids.delete('0')\n subscribables << Subject.find_all_by_id(ids)\n end\n end",
"def subjects\n subjects_array = object.syncable_subjects.to_a\n\n return subjects_array unless object.is_send?\n\n subjects_array << Subject.new(subject_code: \"U3\", subject_name: \"Special Educational Needs\")\n\n subjects_array\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n if ind2 == '7'\n sfs << ['2', subject['source']]\n end\n\n # add authority ID as subject 6xx $0\n authority_id = subject['authority_id']\n subfield_0 = authority_id ? [0, authority_id] : nil\n sfs.push(subfield_0) unless subfield_0.nil?\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def for_subjects(subjects)\n result = Hash[subjects.map {|node| [node, false]}]\n subjects_by_id = Hash[subjects.map {|subject| [subject.id, subject]}]\n subject_rlshp_sources = Hash.new { |h, k| h[k] = [] }\n [:subject, :subject_agent_subrecord, :subject_agent_subrecord_place].each do |t|\n Subject.relationship_dependencies[t].each { |d| subject_rlshp_sources[d] << t }\n end\n\n subject_rlshp_sources.each do |model, sources|\n sources.each do |source|\n # i.e. one or more: subject_rlshp, subject_agent_subrecord_rlshp, subject_agent_subrecord_place_rlshp\n link_relationship = model.find_relationship(source)\n link_table = link_relationship.table_name\n\n link_relationship.reference_columns_for(model).each do |model_link_column|\n link_relationship.reference_columns_for(Subject).each do |subject_link_column|\n # Join subject_rlshp to (e.g.) accession\n linked_records = model\n .join(link_table,\n Sequel.qualify(link_table, model_link_column) => Sequel.qualify(model.table_name, :id))\n .filter(Sequel.qualify(link_table, subject_link_column) => subjects_by_id.keys)\n .select(Sequel.qualify(model.table_name, :id),\n Sequel.qualify(model.table_name, :publish),\n Sequel.qualify(model.table_name, :suppressed),\n Sequel.as(Sequel.qualify(link_table, subject_link_column),\n :subject_id))\n\n if model.columns.include?(:repo_id)\n linked_records = linked_records\n .select_append(Sequel.as(Sequel.qualify(model.table_name, :repo_id),\n :repository_id))\n end\n\n published_status = if model.included_modules.include?(TreeNodes)\n for_tree_nodes(linked_records\n .select_append(Sequel.qualify(model.table_name, :parent_id),\n Sequel.qualify(model.table_name, :root_record_id))\n .all)\n elsif model.to_s =~ /^Agent/\n for_agents_linked_to_subject(linked_records.all)\n else\n for_top_level_records(linked_records.all)\n end\n\n published_status.each do |linked_record, published|\n if published\n result[subjects_by_id.fetch(linked_record[:subject_id])] = true\n end\n end\n end\n end\n end\n end\n\n result\n end",
"def subjects_with_permission(type, permission)\n raise Exceptions::NotACanHazSubject unless type.respond_to?(:acts_as_canhaz_subject)\n permissions = self.permissions_subjects.where(:type => self.class.to_s, :permission => permission.to_s)\n type.in(:id => permissions.collect(&:csubject_id))\n end",
"def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end",
"def copy_corridor_subject(from_specialization, to_specialization)\n SpecializationSubject.find_all_by_specialization_id(from_specialization).each {|cs|\n csn = cs.clone\n csn.update_attribute(:specialization_id, to_specialization)\n }\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n ind1 = ' '\n code, *ind2 = case term['term_type']\n when 'uniform_title'\n value = term['term'].split(\" \")[0]\n first_indicator = '0'\n if value\n hsh = {}\n hsh['A'] = '2'\n hsh['An'] = '3'\n hsh['The'] = '4'\n articles = []\n articles = hsh.keys\n first_indicator = hsh[value] if articles.include?(value)\n end\n ['630', first_indicator, source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n # code borrowed from Yale to export subject authority id\n unless subject['authority_id'].nil?\n sfs << ['0', subject['authority_id']]\n end\n\n \n # N.B. ind2 is an array at this point.\n if ind2[0] == '7'\n sfs << ['2', subject['source']]\n end\n\n # adding this code snippet because I'm making ind2 an array\n # for code 630 if the title begins with an article\n if (ind2.is_a?(Array) && code == '630')\n ind1, ind2 = ind2\n else\n ind2 = ind2[0]\n end\n\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def subject=(subject)\n self.subjects = [subject]\n end",
"def set_subject_type\n @subject_type = SubjectType.find(params[:id])\n end",
"def collect_subjects_with_curriculums( school_class )\n subjects = school_class.curriculums.collect do |c|\n [ c.qualification.subject.subject_name, c.id ]\n end\n end",
"def add_subject_terminology(t)\n t.subject(:attributes=>{:authority=>\"UoH\"}) {\n t.topic\n t.temporal\n t.geographic\n }\n t.subject_topic(:proxy=>[:subject, :topic], :index_as=>[:displayable, :facetable])\n t.subject_geographic(:proxy=>[:subject, :geographic], :index_as=>[:displayable])\n t.subject_temporal(:proxy=>[:subject, :temporal], :index_as=>[:displayable])\n end",
"def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end",
"def enhance_subjects(key, value)\n return unless key == 'dc_subject_sm'\n\n metadata[key] = value.map do |val|\n if subjects.include?(val)\n subjects[val]\n else\n val\n end\n end\n end",
"def add_seen_for(user_id, *subject_ids)\n [subject_ids].flatten.compact.each do |subject_id|\n user(user_id).seen.add subject_id\n end\n end",
"def assign_subject!\n return if subject_code.present?\n update(slice_subject_id: nil)\n end",
"def all_subjects\n observations + profile_users + glossary_terms\n end",
"def initialize(subjects)\n sub_data = [{\"id\"=>1,\"name\"=>\"ABS35H1F\", \"credit_hrs\"=>2}, {\"id\"=>2,\"name\"=>\"ACT20H1F\", \"credit_hrs\"=>3}, {\"id\"=>3,\"name\"=>\"ACT240H1\", \"credit_hrs\"=>6}, {\"id\"=>4,\"name\"=>\"ACT38H1F\", \"credit_hrs\"=>7}, {\"id\"=>5,\"name\"=>\"ACT3491F\", \"credit_hrs\"=>7},\n {\"id\"=>6,\"name\"=>\"ACT4601F\", \"credit_hrs\"=>10}, {\"id\"=>7,\"name\"=>\"ACT60H1F\", \"credit_hrs\"=>4}, {\"id\"=>8,\"name\"=>\"ANA300Y1\", \"credit_hrs\"=>8}, {\"id\"=>9,\"name\"=>\"ANT24H1F\", \"credit_hrs\"=>3}, {\"id\"=>10,\"name\"=>\"ANT3Y1Y\", \"credit_hrs\"=>5}]\n subjects = sub_data\n @subjects = subjects\n end",
"def subjects\n bib_subjects || get_item_data_by_name('Subject')\n end",
"def add_all_to\n if params[:contact_type] && [1, 2, 3].include?(params[:contact_type].to_i)\n contacts = Contact.find_all_by_contact_type_id(params[:contact_type])\n for contact in contacts\n Subscriber.find_or_create_by_subscriber_list_id_and_contact_id(@subscriber_list.id, contact.id)\n end\n\n flash[:notice] = \"Todos los #{Contact::SUBSCRIBER_TYPES.select{|x| x.idx == params[:contact_type].to_i}.first.name} han sido añadidos.\"\n end\n\n redirect_to :back\n end",
"def index\n @curriculum_subjects = Subject.all.where(is_core: false, is_pivats: false, is_lunch: false, is_tutorial: false, is_ppa: false)\n @core_subjects = Subject.all.where(is_core: true, is_pivats: false)\n authorize @curriculum_subjects\n\n @subject = Subject.new\n @subject.sub_subjects.build\n # authorize @curriculum_subjects\n\n end",
"def enroll(subject)\n\t\tsubjects[subject] = []\n\t\tsubjects\n\tend",
"def order_subjects\n subjects = super\n other_subjects = []\n templates = {}\n\n log_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order and name\n\n # Get template priorities for each subject\n subjects.each do |s|\n if (t = find_template(s)) && !t[:skip]\n t[:priority] ||= 99\n templates[s] = t\n else\n other_subjects << s\n end\n end\n\n # Order subjects by priority or identifier\n ordered_subjects = templates.keys.sort do |s1, s2|\n if templates[s1][:priority] == templates[s2][:priority]\n templates[s1][:identifier] <=> templates[s2][:identifier]\n else\n templates[s1][:priority] <=> templates[s2][:priority]\n end\n end\n\n log_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end",
"def order_subjects\n subjects = super\n \n add_debug \"order_subjects: #{subjects.inspect}\"\n\n # Order subjects by finding those with templates, and then by the template priority order\n prioritized_subjects = []\n other_subjects = []\n subjects.each do |s|\n template = find_template(s)\n next unless template\n \n priority = template[:priority] || 99\n add_debug \" priority(#{s}) = #{priority}\"\n prioritized_subjects[priority] ||= []\n prioritized_subjects[priority] << s\n end\n\n ordered_subjects = prioritized_subjects.flatten.compact\n \n other_subjects = subjects - ordered_subjects\n \n add_debug \"ordered_subjects: #{ordered_subjects.inspect}\\n\" + \n \"other_subjects: #{other_subjects.inspect}\"\n\n ordered_subjects + other_subjects\n end",
"def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connection.query(:xhdr, \"Subject\", range) do |status, data|\r\n if status[:code] == 221\r\n data.each do |line|\r\n message = Message.new\r\n message.num, message.subject = line.split(' ', 2)\r\n subjects << message\r\n end\r\n end\r\n end\r\n subjects\r\n end",
"def set_additional_subject\n @additional_subject = AdditionalSubject.find(params[:id])\n end",
"def set_subject_courses_relation\n @subject_courses_relation = SubjectCoursesRelation.find(params[:id])\n end",
"def create_subjects\n Subject.create!([{\n name: \"History\",\n teacher_id:1 \n },\n {\n name: \"Math\",\n teacher_id: 2\n },\n {\n name: \"Economics\",\n teacher_id: 3\n }])\nend",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n # LOCAL: hack to export buildings as 610s, part 1\n when 'topical'\n if subject['source'] == 'built'\n ['610', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n # LOCAL: occupation == 'x'\n when 'topical', 'cultural_context', 'occupation'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n # LOCAL: hack to export buildings as 610s, part 2\n if ind2 == '7'\n if subject['source'] == 'built'\n sfs << ['2', 'local']\n else\n sfs << ['2', subject['source']]\n end\n end\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def extract_subjects(mods_subject_nodes, template_subject_nodes)\n subjects = {}\n mods_subject_name_nodes, template_subject_name_nodes = get_subject_name_nodes(mods_subject_nodes, template_subject_nodes)\n mods_subject_other_nodes, template_subject_other_nodes = get_subject_other_nodes(mods_subject_nodes, template_subject_nodes, mods_subject_name_nodes)\n mods_subject_name_nodes.each_with_index do |sn, i|\n subjects.merge!(extract_subject_values_and_attributes(sn, template_subject_name_nodes[i]))\n end\n mods_subject_other_nodes.each_with_index do |su, i|\n subjects.merge!(extract_subject_values_and_attributes(su, template_subject_other_nodes[i]))\n end\n subjects.merge!(extract_other_geo_subjects(mods_subject_nodes, template_subject_nodes))\n end",
"def set_all_subject_role\n @all_subject_role = AllSubjectRole.find(params[:id])\n end",
"def subject_params\n params.require(:subject).permit(:id, :name, :description, :discipline => [:id, :name, :description])\n end",
"def build_user_subscriptions\n Subject.all.each do |s| \n s.id\n s.name \n s.subsection \n s.language \n Subscription.create(user_id: User.last.id, subject_id: s.id, active: false)\n end\n end",
"def set_subjects_user\n @subjects_user = SubjectsUser.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\r\n @subject = Subject.find(params[:id])\r\n end",
"def set_subject\n @subject = Subject.friendly.find(params[:id])\n end",
"def subject_map(terms, rel = :subjects)\n {\n :obj => :subject,\n :rel => rel,\n :map => {\n 'self::subfield' => proc { |subject, node|\n subject.publish = true\n subject.terms = terms.call(node)\n subject.source = node.parent.at_xpath(\"subfield[@code='2']\").inner_text unless node.parent.at_xpath(\"subfield[@code='2']\").nil?\n subject.vocabulary = '/vocabularies/1'\n subject.authority_id = set_auth_id(node) unless node.parent.at_xpath(\"subfield[@code='0']\").nil?\n }\n },\n :defaults => {\n :source => 'Source not specified'\n }\n }\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_tutor_subject\n @tutor_subject = TutorSubject.find(params[:id])\n end",
"def update_subject(topic=[], geographic=[], temporal=[])\n\t\t#index = self.mods(0).subject.count\n\t\tindex = 0\n\t\tx = topic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif topic[x].strip == ''\n\t\t\t\ttopic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = geographic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif geographic[x].strip == ''\n\t\t\t\tgeographic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = temporal.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif temporal[x].strip == ''\n\t\t\t\ttemporal.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tself.mods(0).subject(index).topic = topic\n\t\tself.mods(0).subject(index).geographic = geographic\n\t\tself.mods(0).subject(index).temporal = temporal\n\tend",
"def set_subject\n\t\t\t@subject = Subject.find(params[:id])\n\t\tend",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def subjects_person\n get_item_data_by_name('SubjectPerson')\n end",
"def insert_subject(topic=[], geographic=[], temporal=[])\n\t\tindex = self.mods(0).subject.count\n\t\tx = topic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif topic[x].strip == ''\n\t\t\t\ttopic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = geographic.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif geographic[x].strip == ''\n\t\t\t\tgeographic.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tx = temporal.size\n\t\twhile x > 0\n\t\t\tx -= 1\n\t\t\tif temporal[x].strip == ''\n\t\t\t\ttemporal.delete_at(x)\n\t\t\tend\n\t\tend\n\t\tself.mods(0).subject(index).topic = topic unless topic.blank?\n\t\tself.mods(0).subject(index).geographic = geographic unless geographic.blank?\n\t\tself.mods(0).subject(index).temporal = temporal unless temporal.blank?\n\tend",
"def process_subjects(subjects_arr)\n return_arr = []\n subjects_arr.each do |subject|\n unless subject['_resolved'].blank?\n return_arr.push(subject['_resolved'])\n end\n end\n return_arr\n end",
"def set_subject\n @subject = params[:id] ? Subject.find(params[:id]) : Subject.new(subject_params)\n end",
"def set_subject\n @subject = params[:id] ? Subject.find(params[:id]) : Subject.new(subject_params)\n end",
"def update_subjects_via_api(subject_name_array)\n return if subject_name_array.blank?\n\n # record the list of current teacher set <--> subject associations,\n # so we can prune the subjects later.\n old_subjects = Array.new\n\n self.subjects.each do |subject|\n old_subjects.push(subject.id)\n end\n\n # delete the current teacher set <--> subject associations,\n # so we can remake them fresh from the bib info.\n self.subjects.clear\n\n # Create all the subjects and teacher_set <--> subject associations specified in the bib\n # record we're processing, ignoring duplicate associations.\n subject_name_array.each do |subject_name|\n subject_name = clean_subject_string(subject_name)\n\n subject = Subject.find_or_create_by(title: subject_name)\n subject_teacher_set = SubjectTeacherSet.find_or_create_by(teacher_set_id: self.id, subject_id: subject.id)\n end\n\n prune_subjects(old_subjects)\n end",
"def assign_canned_subject\n self.subject = canned_subject\n end",
"def subjects(list=[], root=@result.at_css('article-meta article-categories'), prefix = nil)\n return unless root\n subj_node = root.at_css('> subject')\n\n subj_text = subj_node && subj_node.text\n\n if subj_text.present?\n prefix = [prefix, subj_text].compact.join(\" - \")\n list << prefix\n end\n\n root.css('> subj-group').each do |node|\n subjects(list, node, prefix)\n end\n\n list.presence\n end",
"def add_authority(name, type, klass)\n self.payload += self.add_record(name, type, klass).encode\n self.authority_rr += 1\n end",
"def subjects_for_csv\n roots = []\n if comments.any?\n comments.map do |comment|\n roots += comment.subjects.roots\n end\n end\n if roots.empty?\n structures.map do |structure|\n roots += structure.subjects.roots\n end\n end\n subjects_to_array_for_csv roots.uniq.map(&:name)\n end",
"def subject(instructor, upsubj, schoolvar)\n\tschoolvar[:instructors].each do |instructors|\n\t\tif instructors[:name] == instructor\n\t\t\tinstructors[:subject] = upsubj \n\t\tend\n\tend\t\nend",
"def set_subject\n @subject = Subject.find params[:subject_id]\n end",
"def create\n @subject = Subject.new(params[:subject])\n @subject_types = SubjectType.select_list\n respond_to do |format|\n if @subject.save\n format.html { redirect_to(admin_subject_path(@subject), :notice => 'Subject was successfully created.') }\n format.xml { render :xml => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end",
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @client.subjects << @subject\n flash[:notice] = 'Subject was successfully created.'\n format.html { redirect_to client_subject_url(@client, @subject) }\n format.xml { render :xml => @subject, :status => :created, :location => [@client, @subject] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def subject_id\n raise ArgumentError, \"#subject_id not implemented for #{self.class}\"\n end",
"def index\n @subject_types = SubjectType.all\n end",
"def set_subject\n @subject = Subject.find(params[:subject_id])\n end",
"def tutor_subject_params\n params.require(:tutor_subject).permit(:tutor_id, :subject_id)\n end",
"def subjects=(value)\n unless value == :all or value == :signed or value.is_a?(Array)\n raise ArgumentError, \"Subjects must be an array or :all; not #{value}\"\n end\n\n value = nil if value.is_a?(Array) and value.empty?\n\n @subjects = value\n end",
"def add(subject, index_type, type)\n @mutex.synchronize do\n # Add subject to queue if an update for the same subject hasn't been scheduled before\n if !@subject_map.has_key? subject\n @logger.debug(\"UPDATE HANDLER\") { \"Add update for subject <#{subject}> to queue\" }\n @queue << { timestamp: DateTime.now, subject: subject, type: type }\n else\n @logger.debug(\"UPDATE HANDLER\") { \"Update for subject <#{subject}> already scheduled\" }\n end\n @subject_map[subject].add(index_type)\n end\n end",
"def update\n @subject = Subject.find(params[:id])\n if (user_signed_in? && !(@subject.users.include?(current_user)))\n flash[:alert]=\"Nemôžeš sa vymazať z kurzu!\"\n render :action=> \"new\"\n else\n params[:subject][:user_ids] ||= []\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to @subject, notice: 'Kurz bol upravený.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def set_subject_carrer_user\n @subject_carrer_user = SubjectCarrerUser.find(params[:id])\n end",
"def configure\n super\n create_has_many_through :subject\n end",
"def format_final_subject(subjects)\n if subjects.size == 1\n subjects[0]\n elsif subjects.size == 2\n subjects[0] + ' and ' + subjects[1]\n else\n last_subject = subjects.pop()\n subjects.join(', ') + ' and ' + last_subject\n end\n end",
"def build_associations\n #\n # assumption: the associations will build in the order of appearance, subject to ruby behavior\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each { |type| build_user_type(type) }\n end",
"def subject_ids\n self.get_civet_outputs.map(&:dsid)\n end",
"def mark_columns_with_subject_ids(section)\n\t\th = Hash.new\n\t\tsection.sec_sub_maps.each do |map|\n\t\t\tname =map.subject_id\n\t\t\tmark_col = \"sub#{map.mark_column}\"\n\t\t\th[name] = mark_col\n\t\tend\n\t\treturn h\n\tend",
"def set_subject(subject)\n\t\tend",
"def associated_with_client\n self.contact_types = [ContactType.cliente.id]\n end",
"def subjects_user_params\n params.permit(:subject_id, :user_id) \n end",
"def set_course_subject\n @course_subject = CourseSubject.find(params[:id])\n end",
"def set_thesubject\n @thesubject = Thesubject.find(params[:id])\n end",
"def set_school_cycle_has_subject\n @school_cycle_has_subject = SchoolCycleHasSubject.find(params[:id])\n end",
"def order_subjects\n seen = {}\n subjects = []\n\n # Start with base_uri\n if base_uri && @subjects.keys.select(&:uri?).include?(base_uri)\n subjects << base_uri\n seen[base_uri] = true\n end\n\n # Add distinguished classes\n top_classes.each do |class_uri|\n graph.query({predicate: RDF.type, object: class_uri}).\n map {|st| st.subject}.sort.uniq.each do |subject|\n log_debug(\"order_subjects\") {subject.to_sxp}\n subjects << subject\n seen[subject] = true\n end\n end\n\n # Add formulae which are subjects in this graph\n @formulae.each_key do |bn|\n next unless @subjects.key?(bn)\n subjects << bn\n seen[bn] = true\n end\n\n # Mark as seen lists that are part of another list\n @lists.values.flatten.each do |v|\n seen[v] = true if @lists.key?(v)\n end\n\n list_elements = [] # Lists may be top-level elements\n\n # Sort subjects by resources over bnodes, ref_counts and the subject URI itself\n recursable = (@subjects.keys - list_elements).\n select {|s| !seen.include?(s)}.\n map {|r| [r.node? ? 1 : 0, ref_count(r), r]}.\n sort\n\n subjects += recursable.map{|r| r.last}\n end",
"def create\n admin_only\n @subject = Subject.new(subject_params)\n\n new_tutor_ids = []\n unless params[:subject][:people_teaching_attributes].blank?\n params[:subject][:people_teaching_attributes].each do |attribute|\n id = attribute[1][:incoming_tutor_id]\n new_tutor_ids << id unless attribute[1][:_destroy] == \"1\"\n end\n end\n\n respond_to do |format|\n if @subject.save\n\n unless new_tutor_ids == []\n new_tutor_ids.each do |id|\n e = ProvidingEnrollment.new\n e.user_id = id\n e.subject_id = @subject.id\n e.save!\n end\n end\n\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subjects\n @graphs.inject([]) {|memo, g| memo += g.subjects}\n end",
"def subject_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty? # only one or the other supposed to be sent\n return subject_taxon_name_id if !subject_taxon_name_id.empty?\n return []\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end"
] | [
"0.5937251",
"0.58760554",
"0.5841737",
"0.57777596",
"0.57418853",
"0.5698272",
"0.564167",
"0.5517109",
"0.55109835",
"0.54901993",
"0.545795",
"0.5440346",
"0.5438689",
"0.5360564",
"0.5348204",
"0.5291302",
"0.5288366",
"0.5284829",
"0.52696025",
"0.5267824",
"0.5262338",
"0.5231689",
"0.52199674",
"0.5218278",
"0.52050716",
"0.51990104",
"0.5160359",
"0.51527476",
"0.5118048",
"0.5117312",
"0.51144624",
"0.5091643",
"0.50809956",
"0.50752604",
"0.5052633",
"0.5051532",
"0.5049478",
"0.50478035",
"0.50387466",
"0.50387466",
"0.50300443",
"0.50271726",
"0.5010276",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50090283",
"0.50055575",
"0.5000619",
"0.49951607",
"0.49923658",
"0.49923658",
"0.49777701",
"0.49771",
"0.49661505",
"0.49565017",
"0.49501103",
"0.4946183",
"0.4939135",
"0.49326396",
"0.49304342",
"0.49217954",
"0.49185085",
"0.49178246",
"0.49169192",
"0.49151215",
"0.4908141",
"0.49061978",
"0.4895746",
"0.48866272",
"0.48814034",
"0.48797068",
"0.48785913",
"0.48711455",
"0.48680913",
"0.4867214",
"0.4855642",
"0.48499364",
"0.48325235",
"0.4828729",
"0.48211747",
"0.48175636",
"0.48157197",
"0.4812423",
"0.48065227",
"0.4802374",
"0.4802374",
"0.4802374",
"0.4802374"
] | 0.8289575 | 0 |
TEST URLS Gets the top entry of the LIST_FILE, returns it, if the file is not empty and deletes the entry from the file. | def get_next_list_entry!
begin
# Read out every line of list file
# into an array
full_file = []
File.open(@list_file, 'r') do |file|
while _line = file.gets
unless _line == '' || _line.start_with?('#')
full_file << _line.sub(/\n/, '')
end
end
end
# If the array is not empty, shift the first
# entry into an output variable and save the
# shifted array in the file by overwriting.
# Then, return the output variable
if !full_file.empty?
_out = full_file.shift.split('|')
File.open(@list_file, 'w') do |file|
full_file.each { |ln|
file.puts ln
}
end
return _out
end
return nil
rescue Exception => e
puts "[FATAL ERROR] in 'DavidGetter#get_next_list_entry': #{e}"
exit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(url, directory)\n puts \"Pulling \" + url\n package_list = HTTP.get url\n # Saves the file to list.json\n if File.open(directory + 'list.json', 'w') { |file| file.write(package_list) }\n puts \"Downloaded lits.json to \".green + directory.green\n end\nend",
"def delete_list_member(f)\n File.open f, 'r' do |file|\n file.each do |email|\n begin\n print email\n email.chomp!\n RestClient.delete(\"https://api:key-#{API_KEY}\" \\\n \"@api.mailgun.net/v3/lists/#{LIST}@#{DOMAIN_NAME}/members/#{email}\")\n rescue\n puts \"--------\\n#{email} Not found..NEXT\\n\"\n next\n end\n end\n end\nend",
"def list_exists(url, directory)\n unless File.file?(directory + 'list.json')\n update_list(url, directory)\n end\nend",
"def get_list_file(url)\n\t\tdownload_html_file(url)\n\t\tdoc = Nokogiri::HTML(File.new(@tmp_html))\n\n\t\tlist = []\n\t\t# Parsing each link to find the relevant one\n\t\tdoc.css('a[@href!=\"../\"]').each do |link|\n\t\t\tlist << {\n\t\t\t\t'name' => link.text,\n\t\t\t\t'url' => link['href']\n\t\t\t}\n\t\tend\n\t\treturn list\n\tend",
"def file_delete(file)\n\t\tputs \"Delete entries to the local site store from file: #{file}\" if @verbose\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\tsites=file_2_list(file)\n\t\tchanges=Array.new\n\t\tchanges=bulk_delete(sites) unless sites.nil? or sites.empty?\n\trescue => ee\n\t\tputs \"Exception on method file_delete: #{ee} for file: #{file}\" if @verbose\n\tend",
"def bulk_delete(list)\n\t\tputs \"Delete entries to the local site store from list:\\n #{list}\" if @verbose\n\t\tsites=list\n\t\tchanges=Array.new\n\t\tif sites.size > 0\n\t\t\tsites.map do |x|\n\t\t\t\tx=url_2_site(x)\n\t\t\t\tsite=delete(x)\n\t\t\t\tchanges.push(site) unless site.nil?\n\t\t\tend\n\t\t\tputs \"Done deleting sites from the list:\\n #{list}\"\n\t\t\treturn changes\n\t\telse\n\t\t\tputs \"Error: no entry is loaded. Please check your list and try again.\"\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def open_list(file)\n f = clean_path_to(file, allow_missing: true)\n if f\n f = File.open(f, 'r')\n elsif File.exist?(\"#{Origen.root}/list/#{File.basename(file)}\")\n f = File.open(\"#{Origen.root}/list/#{File.basename(file)}\", 'r')\n elsif @last_opened_list_dir && File.exist?(\"#{@last_opened_list_dir}/#{file}\")\n f = File.open(\"#{@last_opened_list_dir}/#{file}\", 'r')\n else\n fail \"Could not find list file: #{file}\"\n end\n lines = f.readlines\n f.close\n # Before we go save the directory of this list, this will help\n # us to resolve any relative path references to other lists that\n # it may contain\n @last_opened_list_dir = clean_path_to(Pathname.new(f).dirname)\n lines\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def file_delete(file)\n\t\tputs \"Delete the local host repository entries from file: #{file}\"\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\thosts=file_2_list(file)\n\t\tchanges=bulk_delete(hosts)\n\t\tputs \"Delete done.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def get_file_list(sequence_type,site_name)\n\n case sequence_type\n when 'asm'\n ftp_url = \"#{FTP_BASE_URLS['asm']}/#{site_name}/\"\n\n # get a file list from the FTP directory listing\n LOG.info \"Checking file list on FTP server at #{ftp_url} ...\"\n curl_res = `curl -l --progress-bar #{ftp_url}`\n print \"\\n\"\n\n file_list = curl_res.split(/\\n/).map { |f| \"#{ftp_url}#{f}\" }\n when 'rrna'\n require 'csv'\n ftp_url = \"#{FTP_BASE_URLS['rrna']}/\"\n\n # parse sample IDs from TSV sample ID map\n # linked from http://hmpdacc.org/micro_analysis/microbiome_analyses.php\n sample_ids_url = \"#{CONF_DIR}/ppAll_V35_map.txt\"\n file_list = CSV.new(File.open(sample_ids_url), { :headers => :first_row, :col_sep => \"\\t\" })\n .select { |line| line[-3] == site_name.capitalize && line[5] != 'Unavailable' }\n .map { |line| \"#{ftp_url}#{line[7]}.fsa.gz\" }\n .sort\n .uniq\n else\n raise \"Unknown sequence type '#{sequence_type}' requested.\"\n end\n\n file_list\n\nend",
"def test_list_file(basename)\n FilePath.new(build_module.root, \"%s.lists.%s\" % [ name, basename ])\n end",
"def clear\n if ::File.exists?(@file) \n @log.info(\"Deleted id list file.\")\n ::File.delete(@file)\n end\n end",
"def getlist(url)\n @url = url\n doc = Nokogiri::HTML(open(@url))\n # @fileset = doc.css(\"td a\")[1..-1]\n @fileset = doc.css(\"td a\")[1,1] #revert to above after testing\n @fileset.each do |item|\n @docname = item.text\n puts \"Downloading #{@docname}\"\n # download the zip files\n download(@url, @docname, \"/vagrant/src/ruby/JobSearch/nuvi/download/\")\n # unzip(@docname, @downloadpath)\n @zipcount += 1\n end\n @zipcount == @fileset.length ? (puts \"Retrieved #{@zipcount} zip files.\") : (puts \"missed a few\")\nend",
"def fetch_latest_task_lists\n\t\tresponse = @client.execute(api_method: @gtasks.tasklists.list)\n\t\tputs \"***************** ERROR FETCHING TASK LISTS *****************\" if response.status != 200\n\t\tputs response.body\n\t\t@task_lists = response.data.items\n\tend",
"def check_list_file(file, outlist)\n unless File.exists?(file)\n raise \"Can't find file \\\"#{opts.input}\\\"\"\n end\n File.open(file, \"r\").each_line do |line|\n unless line.nil?\n outlist << line.chomp\n end\n end\nend",
"def pending_file_url(item = nil)\n get_file_data(item)[:url].presence\n end",
"def remove_from_forum_list f=nil\n unless f\n print \"Remove forum from list: \"\n oldhist = Readline::HISTORY\n Readline::HISTORY.clear\n Readline::HISTORY.push(*$forumlist) \n f = Readline::readline('>', false)\n Readline::HISTORY.clear\n Readline::HISTORY.push(*oldhist)\n if f.nil? or f == \"\" \n return\n end\n end\n $forumlist.delete(f)\n log \"Removed #{f} from forumlist\"\n fn = data_cached_for f\n if fn\n system(\"mv #{fn} #{fn}.old\")\n end\n perror \"Removed #{f} from forum list and disk. Press a key.\"\nend",
"def url_grabber()\nFile.open('urls.txt').readlines.each do |url|\n @file_url.push(url)\nend\n\n# @file_url.each do |f_url|\n# puts \"This is one of the urls we read in from the file: \" + f_url.to_s\n# end\n\nend",
"def list\n @list ||= PublicSuffix::List::parse(File.new(list_path, \"r:utf-8\"))\n end",
"def handle_redirect(list, url)\n response = http_post_request(\"http://#{url}\")\n response = StringIO.new(response)\n\n while(line = response.gets)\n line = line.split(':')\n type = line[0]\n chunk_num = line[1].to_i\n hash_len = line[2].to_i\n chunk_len = line[3].to_i\n\n data = response.read(chunk_len)\n\n if(type == 'a')\n if(chunk_len == 0)\n # TODO\n end\n\n # store the chunk number in the add list\n store_add_chunk(list, chunk_num)\n\n entry_list = read_add_data(hash_len, data)\n\n # add all these prefixes\n add_entries(list, chunk_num, entry_list)\n elsif(type == 's')\n if(chunk_len == 0)\n # TODO\n end\n\n # store the chunk number in the sub list\n store_sub_chunk(list, chunk_num)\n\n entry_list = read_sub_data(hash_len, data)\n\n # delete all these prefixes\n sub_entries(list, chunk_num, entry_list)\n else\n say \"I don't know how to handle this!\"\n say line.inspect\n end\n end\n end",
"def remove_list_entry(serial)\n return nil if @crl_list_file.nil?\n\n data = read_data(@crl_list_file)\n\n updated_list = []\n\n data.each_line do |line|\n line.chomp!\n revoke_info = line.split(',', 3)\n if revoke_info[0].to_i != serial\n updated_list.push(line)\n end\n end\n write_data(@crl_list_file, updated_list.join(\"\\n\") + \"\\n\")\n nil\n end",
"def remove_item(file_name)\n frm.table(:class=>/listHier/).row(:text=>/#{Regexp.escape(file_name)}/).link(:href=>/doRemoveitem/).click\n end",
"def list(name)\n lists.find { |list| ::File.basename(list.url) == name }\n end",
"def test_getfilelist\n server = nil\n testdir, pattern, tmpfile = mktestdir\n\n file = nil\n\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n assert_nothing_raised {\n server.mount(testdir, \"test\")\n }\n\n # get our listing\n list = nil\n sfile = \"/test/tmpfile\"\n assert_nothing_raised {\n list = server.list(sfile, :manage, true, false)\n }\n\n output = \"/\\tfile\"\n\n # verify it got listed as a file\n assert_equal(output, list)\n\n # verify we got all fields\n assert(list !~ /\\t\\t/)\n\n # verify that we didn't get the directory itself\n list.split(\"\\n\").each { |line|\n assert(line !~ %r{remotefile})\n }\n\n # and then verify that the contents match\n contents = File.read(tmpfile)\n\n ret = nil\n assert_nothing_raised {\n ret = server.retrieve(sfile)\n }\n\n assert_equal(contents, ret)\n end",
"def file_history_pop(file)\n file_history = $file_history.to_h\n current_history = file_history.pop\n file_history.each_pair do |index, file_name|\n if file_name == current_history\n $file_history.delete_field(\"#{index}\")\n break\n end\n end\n end",
"def remove(list, item_name)\r\n\tlist.delete(item_name)\r\n\tp list\r\nend",
"def destroy\n @list_item.destroy\n\n head :no_content\n end",
"def clear_urls\n result = @client[URLS_COLLECTION].delete_many({})\n result.n\n ensure\n @last_result = result\n end",
"def update_xml_list\n # No file, we download it\n unless File.exists?(@xml_file) \n download_xml_list()\n end\n\n # File still young enough, we keep it\n if (Time.now() - File.mtime(@xml_file)).to_i < @download_delay\n puts \"Podcast list is up to date\"\n return\n end\n\n # We download a new file\n download_xml_list()\n end",
"def destroy\n begin\n @task_list = @active_project.task_lists.find(params[:id])\n rescue\n return error_status(true, :invalid_task_list)\n end\n \n authorize! :delete, @task_list\n\n @on_page = (params[:on_page] || '').to_i == 1\n @removed_id = @task_list.id\n @task_list.updated_by = @logged_user\n @task_list.destroy\n\n respond_to do |format|\n format.html {\n error_status(false, :success_deleted_task_list)\n redirect_to(task_lists_url)\n }\n format.js { index_lists(@logged_user.member_of_owner?) }\n format.xml { head :ok }\n end\n end",
"def delete_item(list_name,name)\n if storage.list_exists?(list_name)\n list = List.find(list_name)\n if list.delete_item(name)\n output \"#{cyan(\"Boom!\")} #{yellow(name)} is gone forever.\"\n save\n else\n output \"#{yellow(name)} #{red(\"not found in\")} #{yellow(list_name)}\"\n end\n else\n output \"We couldn't find that list.\"\n end\n end",
"def getScrapingURLs(shared)\n\tFile.open(\"urls.txt\").each do |line|\n\t\tshared.pushurl(line.chomp)\n\tend\nend",
"def get_working_listing_file\n local_instances_list_file_locations.reject {|f| f unless File.file?(f) }.first\n end",
"def remove list\n remove = @watch.objects.find { |obj| obj.name == \"remove\" }\n\n obix = OBIX::Builder.new do |obix|\n obix.obj is: \"obix:WatchIn\" do |obix|\n obix.list name: \"hrefs\" do |obix|\n list.each do |item|\n obix.uri val: item\n end\n end\n end\n end\n\n remove.invoke obix.object\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def remove_from_list\n empty_list if @mylist.length <= 0\n item_names = @mylist.map { |item| item['name'] }\n item_names << 'Back'\n selection = @prompt.select('Which item would you like to remove?'.colorize(:light_green), item_names)\n @menu.my_list if selection == 'Back'\n @mylist.each_with_index do |item, index|\n @mylist.delete_at(index) if item['name'] == selection\n end\n update_file\n end",
"def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end",
"def delete_list(list)\n @lists[list.title].delete(list.title)\n end",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def remove_item(list, item)\r\n# input: item to be removed, list\r\n# steps: \r\n # check if item exists\r\n # remove item\r\n list.delete(item)\r\n # print success message of item removed\r\n puts \"#{item.upcase} has been removed to your grocery list!\"\r\n p list\r\n# output: updated list\r\nend",
"def remove_from_list\n if $selected_files.size > 0\n sz = $selected_files.size\n ch = get_single \"Remove #{sz} files from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n $used_dirs = $used_dirs - $selected_files\n $visited_files = $visited_files - $selected_files\n unselect_all\n $modified = true\n return\n end\n #print\n ## what if selected some rows\n file = $view[$cursor]\n ch = get_single \"Remove #{file} from used list (y)?: \"\n #ch = get_char\n return if ch != \"y\"\n file = File.expand_path(file)\n if File.directory? file\n $used_dirs.delete(file)\n else\n $visited_files.delete(file)\n end\n c_refresh\n $modified = true\nend",
"def remove_item(list, removeitem)\n\t# input: existing list, item name\n\t# output: updated list\n\n\tmatch_index = find_item(list, removeitem)\n\t# alert if not found\n\tif not match_index\n\t\tmsg = \"\\n\\n** WARNING remove_item failure: item \\\"#{removeitem}\\\" \"\n\t\tmsg += \"not found in list. List unchanged **\"\n\t\treturn list\n\telse\t\t\t\n\t\tlist.delete_at(match_index)\n\t\tputs \"\\n\\nList updated: item '#{removeitem}' removed from list.\\n\"\n\t\tprint_list(list) if print\n\t\treturn list\n\tend\n\t# return updated list\n\t\nend",
"def resetLists()\n\t`rm -rf outputList.txt`\n\t`rm -rf outputListFinal.txt`\n\t`touch outputList.txt`\n\t`touch outputListFinal.txt`\nend",
"def get_top_list params = { :list_type => 1, :page => 1, :language => 'en' }\n json = send_request 'get_top_list', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def delete(list_id)\n Iterable.request(conf, \"/lists/#{list_id}\").delete\n end",
"def remove_url(url_with_file, removal_type = \"PAGE\")\n url = CGI::escape norm_url(url_with_file)\n page = agent.get(REMOVAL % [url, CGI::escape(url_with_file)])\n\n page.form.field_with(:name => 'removalmethod').value = removal_type\n page = agent.submit page.form\n files = page.search(\".wmt-external-url\").map { |n| File.basename(n.text) }\n raise \"could not submit URL\" unless files.include?(File.basename(url_with_file))\n end",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tp list\nend",
"def load_list(index)\n list = @storage.find_list(index)\n return list if list\n\n session[:error] = 'The specified list was not found.'\n redirect '/lists'\nend",
"def get_file_from_url(url)\n return $db.execute(\"SELECT * FROM files WHERE unique_url = ?\", url)[0]\nend",
"def test_it_returns_nil_if_pop_with_zero_nodes\n\t\tlink = List.new\n\t\tassert_equal nil,link.pop_node\n\tend",
"def delete_item(list_item)\n @list.delete(list_item)\n @list\n end",
"def show_unknown_list\n\t\tif @setup.secure then\n\t\t\turls = DispRef2Latest_cache.unknown_urls\n\t\telsif @setup['no_cache'] then\n\t\t\turls = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, @setup ).unknown_urls\n\t\telse\n\t\t\turls = DispRef2Cache.new( @setup ).unknown_urls\n\t\tend\n\t\tr = <<-_HTML\n\t\t\t<h3>URL Conversion</h3>\n\t\t\t<input name=\"dr2.current_mode\" value=\"#{RefList}\" type=\"hidden\">\n\t\t_HTML\n\t\tif @cache then\n\t\t\tr << \"<p>Picking up #{@setup['unknown.label']} from the cache.\"\n\t\telse\n\t\t\tr << \"<p>Picking up #{@setup['unknown.label']} from the latest view.\"\n\t\tend\n\t\tr << <<-_HTML\n\t\t\tURLs that match the Excluding list or the Ignore list are not\n\t\t\tlisted here.\n\t\t</p>\n\t\t<p>\n\t\t\tIf you don't want to see the URLs that you neither put into the\n\t\t\tConversion list or the Excluding list can be put in the Ignore\n\t\t\tlist. The Ignore list only affects the list shown here.\n\t\t\tPlease check <input name=\"dr2.clear_ignore_urls\" value=\"true\"\n\t\t\ttype=\"checkbox\">here if you want to reset the Ignore list.\n\t\t</p>\n\t\t_HTML\n\t\tif urls.size > 0 then\n\t\t\tr << <<-_HTML\n\t\t\t\t<p>Please fill in the titles for the URL(s) in the lower text\n\t\t\t\t\tbox(es) to put the URL(s) into the Conversion list. Please\n\t\t\t\t\tcheck the check box(es) if you want to put the URL(s) into the\n\t\t\t\t\tExcluding list.\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\tRegular expressions are made up automatically. You can edit them\n\t\t\t\t\tif you want.\n\t\t\t\t</p>\n\t\t\t\t<p>\n\t\t\t\t\tIn the titles, you can refer to the strings between\n\t\t\t\t\tparenthesis in the regular expression with something like\n\t\t\t\t\t"\\\\1" (backslash plus a number). You can also use\n\t\t\t\t\ta script fragment like "sprintf('[tdiary:%d]', $1.to_i+1)".\n\t\t\t\t</p>\n\t\t\t_HTML\n\t\t\tif ENV['AUTH_TYPE'] and ENV['REMOTE_USER'] and @setup['configure.use_link'] then\n\t\t\t\tr << <<-_HTML\n\t\t\t\t\t<p>\n\t\t\t\t\t\t[NOTE] Be aware that by clicking the URLs below, the author\n\t\t\t\t\t\tof the www site might know the URL of this page to edit and\n\t\t\t\t\t\tconfigure your diary.\n\t\t\t\t\t</p>\n\t\t\t\t_HTML\n\t\t\tend\n\t\t\tr << <<-_HTML\n\t\t\t\t<p>\n\t\t\t\t\tPlease edit URLs not shown here through "<a\n\t\t\t\t\thref=\"#{@conf.update}?conf=referer\">Today's link</a>"\n\t\t\t\t</p>\n\t\t\t\t<dl>\n\t\t\t_HTML\n\t\t\ti = 0\n\t\t\turls.sort.each do |url|\n\t\t\t\tshown_url = DispRef2String::escapeHTML( @setup.to_native( DispRef2String::unescape( url ) ) )\n\t\t\t\tif ENV['AUTH_TYPE'] and ENV['REMOTE_USER'] and @setup['configure.use_link'] then\n\t\t\t\t\tr << \"<dt><a href=\\\"#{url}\\\">#{shown_url}</a>\"\n\t\t\t\telse\n\t\t\t\t\tr << \"<dt>#{shown_url}\"\n\t\t\t\tend\n\t\t\t\tr << <<-_HTML\n\t\t\t\t\t<dd>\n\t\t\t\t\t\tAdd this URL to\n\t\t\t\t\t\t<input name=\"dr2.#{i}.noref\" value=\"true\" type=\"checkbox\">Excluding list\n\t\t\t\t\t\t<input name=\"dr2.#{i}.ignore\" value=\"true\" type=\"checkbox\">Ignore list<br>\n\t\t\t\t\t\t<input name=\"dr2.#{i}.reg\" value=\"#{DispRef2String::escapeHTML( DispRef2String::url_regexp( url ) )}\" type=\"text\" size=\"70\"><br>\n\t\t\t\t\t\t<input name=\"dr2.#{i}.title\" value=\"\" type=\"text\" size=\"70\">\n\t\t\t\t_HTML\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\tr << <<-_HTML\n\t\t\t\t<input name=\"dr2.urls\" type=\"hidden\" value=\"#{i}\">\n\t\t\t\t</dl>\n\t\t\t_HTML\n\t\t\tunless @setup.secure or @setup['no_cache'] then\n\t\t\t\tr << <<-_HTML\n\t\t\t\t\t<p>\n\t\t\t\t\t\tUpdating the cache might take some time. Please wait after\n\t\t\t\t\t\tclicking the OK button.\n\t\t\t\t\t</p>\n\t\t\t\t_HTML\n\t\t\tend\n\t\telse\n\t\t\tr << <<-_HTML\n\t\t\t\t<p>Currently there is no #{@setup['unknown.label']}.</p>\n\t\t\t_HTML\n\t\tend\n\t\tr << <<-_HTML\n\t\t\t<h3>Regular expressions for antennae</h3>\n\t\t\t<p>URLs or titles matching these expression will be categorized as\n\t\t\t\tantennae.</p>\n\t\t\t<ul>\n\t\t\t<li>URL:\n\t\t\t\t<input name=\"dr2.antenna.url\" value=\"#{DispRef2String::escapeHTML( @setup.to_native( @setup['antenna.url'] ) )}\" type=\"text\" size=\"70\">\n\t\t\t\t<input name=\"dr2.antenna.url.default\" value=\"true\" type=\"checkbox\">Use default\n\t\t\t<li>Title:<input name=\"dr2.antenna.title\" value=\"#{DispRef2String::escapeHTML( @setup.to_native( @setup['antenna.title'] ) )}\" type=\"text\" size=\"70\">\n\t\t\t\t<input name=\"dr2.antenna.title.default\" value=\"true\" type=\"checkbox\">Use default\n\t\t\t</ul>\n\t\t\t_HTML\n\t\tr\n\tend",
"def delete_tweet( list_name, owner, author, text, submitted )\n puts \"in delete \" + author + \" \" + list_name + \" \" + text + \" \" + submitted.to_s\n if list_name[0] == 64 # @ we don't want this in list names\n puts(\"Error @ sign in list name. Can't delete someone elses list.\")\n return false\n end\n \n #Created a list but no more items\n if text == \"\"\n #Can't delete if no text. use delete_list\n return false\n end\n \n @list = List.find( :first, \n :conditions => { :name => list_name,\n :owner => owner } )\n if not @list\n #Error can't delete can't find list TODO\n return false\n end\n \n #Check if the item exists, since we assume the messages\n #come in chronological order, we can just break when\n #we find something.\n @item = Item.find( :first,\n :conditions => { :author => author,\n :text => text } ) \n \n if @item == nil and owner == author\n @item = Item.find( :first,\n :conditions => { :text => text } ) \n end\n \n if @item == nil\n @item = Item.find( :first,\n :conditions=> [\"author = ? and text like ?\", author, text + \"%\"] ) \n end\n \n if @item == nil and owner == author\n @item = Item.find( :first,\n :conditions=> [\"text like ?\", text + \"%\"] )\n end\n \n #Clean up this search by using the submit time and the list name or ID TODO\n #TODO really need to check submit time to make sure it's the same message\n if @item\n if @item.deleted\n puts \"error item already deleted\"\n return true\n else\n puts \"deleting item\"\n @item.deleted = true\n @item.save\n return false\n end\n else\n puts \"error can't find item to delete\"\n #Error, can't find the item so don't delete\n end\n \n return false\n end",
"def delete(_url)\n # do nothing since we can't find the key by url\n end",
"def remove_from_list(list, item)\n list.delete(item)\n p list\nend",
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def clear_items_from_list(loc)\n @browser.select(parse_location(loc)).clear\n end",
"def items_list_deletion(tasks_to_delete_list,log_file)\n tasks_to_delete_list.each do |task|\n copy_to_log_file(log_file,\"Task deletion\",to_do_list:to_do_list,id:task)\n remove_an_item(task)\n print_out_all_items\n end\n end",
"def bulk_delete(list)\n\t\tputs \"Delete entries to the local host repository from:\\n #{list}\"\n\t\thosts=list\n\t\tchanges=Array.new\n\t\tif hosts.size > 0\n\t\t\thosts.map do |x|\n\t\t\t\thost=delete(x)\n\t\t\t\tchanges.push(host) unless host.nil?\n\t\t\tend\n\t\t\tputs \"Done deleting hosts.\"\n\t\t\treturn changes\n\t\telse\n\t\t\tputs \"Error: empty list - no entry is loaded. Please check your list and try again.\"\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend",
"def test_cachedel_non_empty_file\n _generic_cachedel_test 4000\n end",
"def remove_item_from_list(list,item)\r\n list.delete(item)\r\n print_list(list)\r\nend",
"def remove_item(list, list_item)\n if list.has_key?(list_item)\n list.delete(list_item)\n else\n puts \"Item is not in list\"\n end\n p list\n list\nend",
"def pop\n list.pop\n end",
"def fetch_cache(file, url)\n @path = \"tmp/\" + file + \".html\";\n @temp = @path + \".fetch\"\n @doFetch = !(FileTest.exists?(@path) && (Time.new - File.mtime(@path) < (5 * 60)))\n\n if @doFetch and download_page(@temp,url) then\n File.delete(@path) if File.exists?(@path)\n File.rename(@temp, @path)\n end\n\n if File.exists?(@path) then\n return @path\n else\n @useOnce = @path + \".\" + rand(100000).to_s + \".once\"\n download_page(@useOnce, url)\n return @useOnce\n end\n end",
"def deletelist\n if @head == nil\n puts \"List deleted\"\n end\n\n tmp = @head\n while(@head != nil)\n tmp = tmp.next\n @head.next = nil\n @head = tmp\n end\n end",
"def match_url_to_short_name(url_to_short_file, url, event)\n short_name_output = Array.new\n count = 0;\n CSV.foreach(url_to_short_file) do |row|\n # If the url matches, add short names to the array\n if row[0].include? url and not short_name_output.include? row[1]\n short_name_output[count] = row[1]\n count = count + 1\n # Special Case : Few files are not available in the api but their directories are available\n # So those short names are included\n elsif url.include? \"browse/\"\n index = url.index(\"browse/\") + 5\n temp_url = url[0..index]\n #puts temp_url\n if row[0].include? temp_url and not short_name_output.include? row[1]\n short_name_output[count] = row[1]\n count = count + 1\n end\n else\n index = url.rindex('/')\n temp_url = url[0..index]\n if row[0].include? temp_url and not short_name_output.include? row[1]\n short_name_output[count] = row[1]\n count = count + 1\n end\n end\n end\n\n return short_name_output\n end",
"def remove_item(item, list)\r\n list.delete(item)\r\n p list\r\n list\r\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def cleanupOutput()\n\tlines_array = IO.readlines(\"outputList.txt\")\n\n\toutputFile = File.open(\"outputListFinal.txt\", 'w')\n\tlines_array.each do |line|\n\t\tif line =~ /file '(.*)'/\n\t\t\tfilename = $1.to_s\n\t\t\tif(File.exist?(filename))\n\t\t\t\toutputFile.write(\"file '\"+filename+\"'\\n\")\n\t\t\tend\n\t\tend\n\tend\n\n\toutputFile.close\nend",
"def remove_item(name, list)\n list.delete(name)\n p list\n return list\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n p list\r\nend",
"def destroy\n authorize @list\n @list.destroy\n head :no_content\n end",
"def fetch!\n\n open(fetch_txt_file) do |io|\n \n io.readlines.each do |line|\n \n (url, length, path) = line.chomp.split(/\\s+/, 3)\n \n add_file(path) do |io|\n io.write open(url)\n end\n \n end\n \n end\n\n # rename the old fetch.txt\n Dir[\"#{fetch_txt_file}.?*\"].sort.reverse.each do |f|\n \n if f =~ /fetch.txt.(\\d+)$/\n new_f = File.join File.dirname(f), \"fetch.txt.#{$1.to_i + 1}\"\n FileUtils::mv f, new_f\n end\n \n end\n\n # move the current fetch_txt\n FileUtils::mv fetch_txt_file, \"#{fetch_txt_file}.0\"\n end",
"def random_media_file_from_list(filename_list)\n filename_list.shuffle.each do |filename|\n puts \"Drop \" + + \". No media filename\" if !is_media_file(filename)\n return filename\n end\n raise \"No media file found in list of files.\"\nend",
"def test_run_list_and_file\n T2Server::Run.create($uri, WKF_L_V, $creds, $conn_params) do |run|\n list = [\"one\", 2, :three]\n list_out = list.map { |v| v.to_s }\n\n run.input_port(\"list_in\").value = list\n run.input_port(\"singleton_in\").file = FILE_INPUT\n assert_nothing_raised { run.start }\n assert(run.running?)\n run.wait\n\n assert_equal(run.output_port(\"list_out\").value, list_out)\n assert_equal(run.output_port(\"singleton_out\").value, \"Hello, World!\")\n\n # Get the log file\n assert_nothing_raised(T2Server::T2ServerError) do\n assert_not_equal(run.log, \"\")\n end\n\n assert_nothing_raised(T2Server::T2ServerError) do\n log_cache = TestCache.new\n run.log(log_cache)\n assert_not_equal(log_cache.size, 0)\n end\n\n assert_raise(T2Server::AccessForbiddenError) do\n run.provenance\n end\n\n assert(run.delete)\n end\n end",
"def del_weblog_explain; \"Remove weblog from your list.\"; end",
"def list\n Lib.list @path, @no_follow\n end",
"def parseFileslist(doc, params, path)\n prev_commit_hash = (doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash') ? doc.find_first('//xmpp2rest/user/device/files/prev_commit_hash').content : nil) \n commit_hash = (doc.find_first('//xmpp2rest/user/device/files/commit_hash')) ? doc.find_first('//xmpp2rest/user/device/files/commit_hash').content : nil\n \n if not commit_hash\n raise Exception.new(\"Missing element: commit_hash\")\n end\n \n puts \"Prev_commit_hash: \" + prev_commit_hash.to_s\n puts \"Commit_hash: \" + commit_hash.to_s\n \n location = {}\n location['latitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/latitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/latitude').content : \"NULL\"\n location['longitude'] = (doc.find_first('//xmpp2rest/user/device/files/location/longitude')) ? doc.find_first('//xmpp2rest/user/device/files/location/longitude').content : \"NULL\"\n \n filelist = Hash.new\n doc.find('//user/device/files/file').each do |file|\n fullpath = (file.attributes.get_attribute(\"fullpath\")) ? file.attributes.get_attribute(\"fullpath\").value : nil \n filepath = (file.find_first('path')) ? file.find_first('path').content : nil\n filename = (file.find_first('filename')) ? file.find_first('filename').content : nil \n filedate = (file.find_first('filedate')) ? file.find_first('filedate').content : nil\n filetype = (file.find_first('filetype')) ? file.find_first('filetype').content : nil\n filesize = (file.find_first('filesize')) ? file.find_first('filesize').content : nil\n version_hash = (file.find_first('version_hash')) ? file.find_first('version_hash').content : nil\n\n if not filepath or not filename or not filetype or not filesize or not filedate or not version_hash\n raise Exception.new(\"Not all the needed metadata given: filename, filetype, filesize, filedate and version_hash are compulsory!\")\n elsif fullpath.to_s != filepath.to_s + filename.to_s\n raise Exception.new(\"fullpath: #{fullpath.to_s} doesn't match to path + name: #{filepath.to_s + filename.to_s}\")\n elsif fullpath[0,1] != '/' or filepath[0,1] != '/'\n raise Exception.new(\"path must begin with /\")\n end\nputs \"filepath: #{filepath}\"\n filelist.merge!({fullpath => {\"status\" => \"created\", \"blob_hash\" => version_hash, \"name\" => filename, \"path\" => filepath, \"size\" => filesize, \"filetype\" => filetype, \"filedate\" => filedate.to_s}}) \n end\n contains = YAML.dump_stream(filelist)\nputs \"contains: #{contains.to_s}\"\n if prev_commit_hash\n puts \"prev hash added!\"\n params['prev_commit_hash'] = prev_commit_hash\n end\n \n path += \"/files\"\n params.merge!({ 'contains' => contains, 'commit_hash' => commit_hash, 'commit_location' => location})\n return params, path\n end",
"def delete_list_item(client, uri, headers)\n # log what we are doing\n log(:info, \"Deleting Sharepoint list item at: #{uri}\")\n\n # send the delete request and return the response\n client.delete(uri, headers)\n end",
"def undelete(list)\n manifests = living_parents.map do |p|\n manifest.read changelog.read(p).manifest_node\n end\n \n # now we actually restore the files\n list.each do |file|\n unless dirstate[file].removed?\n UI.warn \"#{file} isn't being removed!\"\n else\n m = manifests[0] || manifests[1]\n data = file(f).read m[f]\n add_file file, data, m.flags(f) # add_file is wwrite in the python\n dirstate.normal f # we know it's clean, we just restored it\n end\n end\n end",
"def remove_item(list,item)\n\tlist.delete(item)\n\tp list\nend",
"def clear_tests_files_list\n @tests_files = nil\n end",
"def main\n\n feedlist = File.foreach('parselist') do |wholeline|\n\n wholeline.strip!\n\n next if wholeline.empty?\n\n line = wholeline.split(\",\")\n url = line[0].strip\n tag = line[1].strip\n\n #parse each feed\n\n rss = SimpleRSS.parse(open(url).read)\n\n puts ' '\n puts rss.feed.title\n puts ' '\n\n rss.items[0..2].each do|i|\n puts \"Date: #{i.pubDate or i.published}\"\n puts \"Title: #{i.title}\"\n puts \"Link: #{i.link}\"\n puts \"=\" * 80\n end\n\n end\n\nend",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def delete(value)\r\n prev = nil\r\n curr = @head \r\n\r\n while curr \r\n if curr.data == value \r\n if prev == nil\r\n @head = curr.next \r\n else \r\n prev.next = curr.next \r\n end\r\n return\r\n\r\n else\r\n prev = curr\r\n curr = curr.next\r\n end\r\n end\r\n\r\n # if u reached this point, then nothing matches, and no changes made to list\r\n end",
"def destroy\n @url_list.destroy\n respond_to do |format|\n format.html { redirect_to url_lists_url, notice: 'Url list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def fetch_links\n if @options[:timeout]\n stat = File.stat(@options[:filename]) rescue nil\n return update if !stat || stat.mtime < Time.now - @options[:timeout] || stat.size == 0 || @force_update_db\n end\n\n parse_links(File.read(@options[:filename]))\n end",
"def fetch_latest_tasks_for(list)\n\t\t@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\tend",
"def check_seo_file(file_obj, url_host)\n content_actual = nil\n \n # set failure to true and change if test passes\n failed_file = true\n\n ## Get Actual Content from URL\n begin\n f = open(file_obj.targeturl) \n\n ## Check Status Codes\n if(f.status[0] == \"200\" && f.status[1] == \"OK\")\n\n ## Get the content and strip out carriage returns (\\r)\n content_actual = f.readlines.join().gsub(\"\\r\",'')\n\n ## Check the content matches the DB\n if(content_actual == file_obj.valid_content.gsub(\"\\r\",\"\"))\n \n failed_file =false\n else\n\n failed_file = true\n end\n else\n\n failed_file = true\n end\n rescue => e\n begin\n f.close()\n rescue\n\n end\n return [false, content_actual, e.message]\n end\n\n return [failed_file == false, content_actual]\n end",
"def remove_item(item)\n $grocery_list.delete(item)\n # puts \"List with #{item} deleted\"\n $grocery_list\nend",
"def delete_item(rmstr,list)\n list.delete(rmstr)\n list\nend",
"def remove list\n list_action list, \"remove\"\n end",
"def ftpCleanUp(conf,ftp)\n limit=conf[:generations]\n puts \"Remote backup files:\"\n #must match generated archive names\n a=ftp.nlst(conf[:backupFile]+'????????-??????.tgz').sort\t\n a.each do |e| puts e end\n return if a.size<= limit\n while (a.size> limit)\n ftp.delete(a[0])\n puts 'Deleted old archive: '+a[0]\n a.delete_at(0)\n end\nend",
"def test_seenewfiles\n server = nil\n testdir, pattern, tmpfile = mktestdir\n\n\n newfile = File.join(testdir, \"newfile\")\n\n # go through the whole schtick again...\n file = nil\n checks = Puppet::Network::Handler.fileserver::CHECKPARAMS\n\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n assert_nothing_raised {\n server.mount(testdir, \"test\")\n }\n\n list = nil\n sfile = \"/test/\"\n assert_nothing_raised {\n list = server.list(sfile, :manage, true, false)\n }\n\n # create the new file\n File.open(newfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n\n newlist = nil\n assert_nothing_raised {\n newlist = server.list(sfile, :manage, true, false)\n }\n\n # verify the list has changed\n assert(list != newlist)\n\n # and verify that we are specifically seeing the new file\n assert(newlist =~ /newfile/)\n end",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def load_list(id)\n list = @storage.find_list(id)\n return list if list\n\n session[:error] = 'The specified list was not found.' # session[:lists] is an array of lists, each list being a hash. if an index is attempted to be accessed that doesn't exist, like /lists/10234, then we want a redirect to home page: https://launchschool.com/lessons/31df6daa/assignments/cb2ef1d2\n redirect '/lists' # \"/\" redirects to \"/lists\" of course, the home\nend",
"def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend",
"def parse_list(user, listfile)\n #match only first found line, there should be no duplicates; also, case insensitive SHOULD be ok.\n line=File.readlines(listfile).select { |line| line =~ /#{user}/i }[0]\n val=line.split(':')\n return val[6].strip, val[1], val[2].strip, home \nend"
] | [
"0.56352484",
"0.5620324",
"0.55731684",
"0.55662125",
"0.5500732",
"0.54530996",
"0.54254276",
"0.5311705",
"0.5285505",
"0.5261224",
"0.5246744",
"0.5213407",
"0.5176522",
"0.5166932",
"0.51295173",
"0.5122836",
"0.5098937",
"0.50776595",
"0.50772977",
"0.50565594",
"0.50428545",
"0.50369656",
"0.5032262",
"0.50283265",
"0.502807",
"0.49578452",
"0.49566504",
"0.49457562",
"0.49316856",
"0.49297675",
"0.49246055",
"0.49203625",
"0.48933047",
"0.48899716",
"0.48884436",
"0.48803228",
"0.4874543",
"0.48606876",
"0.48560888",
"0.48516113",
"0.48413506",
"0.4838464",
"0.48336264",
"0.4831463",
"0.4824563",
"0.4798157",
"0.47938168",
"0.47819796",
"0.477785",
"0.4776314",
"0.47757912",
"0.47745645",
"0.47729626",
"0.47728172",
"0.47695836",
"0.4761591",
"0.47591862",
"0.47572377",
"0.4750928",
"0.47507113",
"0.4744315",
"0.47442496",
"0.47379878",
"0.4732121",
"0.47209266",
"0.47169447",
"0.47051728",
"0.47007483",
"0.47007483",
"0.47007483",
"0.46947488",
"0.46939364",
"0.46927035",
"0.46910235",
"0.46910122",
"0.46838778",
"0.46837792",
"0.4683197",
"0.46814215",
"0.46770588",
"0.4675358",
"0.4674095",
"0.46725795",
"0.46655923",
"0.46647125",
"0.4664357",
"0.46588975",
"0.46583232",
"0.4651394",
"0.4650224",
"0.465022",
"0.46480033",
"0.4645056",
"0.46414256",
"0.46402466",
"0.46400133",
"0.46389285",
"0.46388954",
"0.4638662",
"0.46368444"
] | 0.5609063 | 2 |
Get the first image url from a website by link | def get_image_url (origin_url)
begin
html = open(origin_url).read
urls = URI.extract(html)
.select { |lnk| lnk[/\.jpg$|\.png$|\.gif$|\.jpeg/m] }
return urls.empty? ? nil : urls[0]
rescue Exception => e
puts "[ERROR] in 'DavidGetter#get_image': #{e}"
return nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_image_url(link)\n url = nil\n if !link.nil?\n url = image_url_instagram link if (link.index('instagr.am') || link.index('instagram.com'))\n url = image_url_picplz link if link.index 'picplz'\n url = image_url_twitpic link if link.index 'twitpic'\n url = image_url_yfrog link if link.index 'yfrog'\n url = image_url_imgly link if link.index 'img.ly'\n url = image_url_tco link if link.index 't.co'\n url = image_url_lockerz link if link.index 'lockerz.com'\n url = image_url_foursquare link if link.index '4sq.com'\n url = image_url_embedly link if url.nil? #just try embed.ly for anything else. could do all image url processing w/ embedly, but there's probably some kind of rate limit invovled.\n end\n url\n end",
"def find_image_from_link_tag\n begin\n meta = doc.css(\"link[rel~='image_src']\")\n meta.each do |item|\n next if item[\"href\"].empty?\n\n return item[\"href\"]\n end\n rescue\n log \"Error getting link tag: #{$!}\"\n end\n nil\n end",
"def get_image(image_url)\n # Open webpage and obtain HTML\n url = \"https://www.mariowiki.com\" + image_url\n document = Nokogiri::HTML(open(url))\n\n image_element = document.css('div.fullImageLink a')\n image_path = image_element.attr('href').value\n image = \"https://www.mariowiki.com\" + image_path\n\n return image\nend",
"def getImgURL(title, year)\n title = URI.escape(title + \" \" + year.to_s + \" movie poster\")\n req = \"https://www.googleapis.com/customsearch/v1?key=AIzaSyAyLoJQc-3aOYZLlHff3S4JPmeK88rL878&cx=015799936154194163641:2d_yj8n3fbm&q=\"+title+\"&searchType=image\"#&imgSize=medium\"\n img_results = JSON.parse(@shttp.call(req))\n if img_results && img_results[\"items\"]\n img_results[\"items\"].each do |img_result|\n link = img_result[\"link\"]\n\n begin\n # Return the first link that gives a 200\n if @shttp.head(link) == \"200\"\n return link\n else\n Rails.logger.warn \"Link inaccessible, skipping to next one...\"\n end\n rescue Exception => ex\n Rails.logger.error ex.message\n end\n end\n end\n\n # Return empty string if we don't find anything\n return \"\"\n end",
"def get_image_url(page_doc)\n\timage_url = page_doc.css('body center:nth-child(1) a img')\n\n\tif image_url.nil? or image_url.length == 0\n\t\treturn nil\n\tend\n\n\treturn @base_url + image_url[0][\"src\"]\nend",
"def getStockImage(link)\n dog_page = HTTParty.get(link, :verify => false)\n parsed_dog_page = Nokogiri::HTML(dog_page)\n\n info_table = parsed_dog_page.css(\".biota\")[0]\n \n image = info_table.css(\"img\")[0]\n pic = image != nil ? \"https:#{image['src']}\" : nil\nend",
"def search_for_first_image(doc)\n @first_image = doc.css('img')\n .map { |i| i.attribute('src') }\n .compact\n .map(&method(:absolutize_url))\n .first\n end",
"def get_image_link(page) # someday use regex here\n\t\t\tsource = getHtml(page)\n\t\t\tsource = source.gsub(\"enlarge()\", \"º\")\n\t\t\tsource = source[source.index(\"º\"), source.length]\n\t\t\tsource = source.gsub(\"http://\", \"$\")\n\t\t\tsource = source[source.index(\"$\"), source.length]\n\t\t\treturn source[1, source.index(\"\\\"\") - 1]\n\t\tend",
"def image_url_instagram(link_url)\n link_url['instagram.com'] = 'instagr.am' if link_url.index 'instagram.com' #instagram's oembed does not work for .com links\n response = http_get \"http://api.instagram.com/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def extract_image_url(tweet)\n link = extract_link tweet\n find_image_url link\n end",
"def docGetImageDownloadURL(imgTag)\n srcMatch = imgTag.scan(/src=\"(.*?)\"/)\n if not srcMatch.empty? then \n\tsrc = srcMatch[0][0]\n $lastImageUrl = src # Useful for logging when returning nil below\n if src.start_with?(\"http://www.mosync.com\") then\n return src\n elsif src.start_with?(\"https://raw.github.com\") then\n return src\n elsif src.start_with?(\"http://\") or \n src.start_with?(\"https://\") then\n\t # Return nil here if images from other domains\n\t # should not be downloaded.\n puts \" *** External image: \" + src\n return nil\n elsif src.start_with?(\"/\") then\n # Download from http://www.mosync.com/\n return \"http://www.mosync.com\" + src\n else \n puts \" *** UKNOWN IMAGE SOURCE: \" + src\n end\n end\n return nil\nend",
"def image_url_tco(link_url)\n service_url = link_url_redirect link_url\n find_image_url service_url\n end",
"def image_url_yfrog(link_url)\n response = http_get(\"http://www.yfrog.com/api/oembed?url=#{link_url}\")\n response['url'] if response\n end",
"def get_wikipedia_image_url(wikipedia_url)\n begin\n\n return nil if !wikipedia_url || wikipedia_url.empty?\n\n # Download the wikipedia page\n page = Nokogiri::HTML(open(wikipedia_url))\n\n # Get the image href:\n link = page.css( @settings.image_selector ).first\n return if !link\n image_href = link.attr('href')\n image_href = URI.unescape(image_href)\n # image_href => '/wiki/Archivo:Metallica_at_The_O2_Arena_London_2008.jpg'\n\n # Get the image \"id\":\n slash_idx = image_href.rindex('/')\n return if !slash_idx\n image_id = image_href[ slash_idx + 1 .. -1 ]\n # image_id => 'Archivo:Metallica_at_The_O2_Arena_London_2008.jpg'\n\n # Get the full URL:\n # /w/api.php?action=query&prop=imageinfo&format=json&iiprop=url&titles=Archivo%3AMetallica_at_The_O2_Arena_London_2008.jpg\n image_info = Wikipedia.client.request( {\n action: 'query',\n prop: 'imageinfo',\n iiprop: 'url',\n titles: image_id,\n format: 'json'\n } )\n # result => {\n # \"batchcomplete\": \"\",\n # \"query\": {\n # \"normalized\": [\n # {\n # \"from\": \"Archivo:Metallica_at_The_O2_Arena_London_2008.jpg\",\n # \"to\": \"Archivo:Metallica at The O2 Arena London 2008.jpg\"\n # }\n # ],\n # \"pages\": {\n # \"-1\": {\n # \"ns\": 6,\n # \"title\": \"Archivo:Metallica at The O2 Arena London 2008.jpg\",\n # \"missing\": \"\",\n # \"imagerepository\": \"shared\",\n # \"imageinfo\": [\n # {\n # \"url\": \"https://upload.wikimedia.org/wikipedia/commons/0/07/Metallica_at_The_O2_Arena_London_2008.jpg\",\n # \"descriptionurl\": \"https://commons.wikimedia.org/wiki/File:Metallica_at_The_O2_Arena_London_2008.jpg\"\n # }\n # ]\n # }\n # }\n # }\n # }\n image_info = search = JSON.parse(image_info)\n\n image_url = image_info['query']['pages']['-1']['imageinfo'][0]['url']\n return image_url\n rescue\n Log.log_last_exception\n return nil\n end\n end",
"def top_image(url)\n og_image = check_og_image(url)\n apple_image = check_apple_image(url)\n mechanize_search = mechanize_search(url)\n if og_image\n return og_image\n elsif apple_image\n return apple_image\n elsif mechanize_search\n mechanize_search \n # In case all else fails ...\n else\n \"../image-dne.jpg\"\n end\n end",
"def first_image(html)\n html =~ /\\<img.*?src=\"(.*?)\"/ ? $1 : \"/images/no_image_thumb.png\"\n end",
"def findThumbnailImageURL\n unless @doc.present?\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: document not initialized\"\n return nil\n end\n\n # meta tags to tell social media which image to use for links in order of importance\n # Reference: https://moz.com/blog/meta-data-templates-123\n metaTagsLookingFor = [\"meta[property='og:image:secure_url']\", \"meta[property='og:image']\", \"meta[itemprop='image']\", \"meta[name='twitter:image:src']\", \"link[rel='image_src']\", \"a[rel='image_src']\"]\n\n metaTagsLookingFor.each do |metaTag|\n node = @doc.at_css(metaTag)\n if node != nil\n imageURL = node.attribute('content') || note.attribute('href')\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: found image thumbnail #{imageURL}\"\n return imageURL\n end\n end\n\n #TODO: Find image if page does not use social media meta.\n\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: unable to find thumbnail image URL\"\n return nil\n end",
"def image_url_embedly(link_url)\n response = http_get \"http://api.embed.ly/1/oembed?url=#{link_url}\"\n response['url'] if response\n end",
"def image_url_lockerz(link_url)\n response = http_get \"http://api.plixi.com/api/tpapi.svc/json/metadatafromurl?details=false&url=#{link_url}\"\n response[\"BigImageUrl\"] if response\n end",
"def get_image_from_google_for(keywords)\n get_link_from_google_for keywords, :image\n rescue Exception\n ''\n end",
"def image_url_picplz(link_url)\n id = extract_id link_url\n #try short url\n response = http_get \"http://picplz.com/api/v2/pic.json?shorturl_ids=#{id}\"\n #if short url fails, try long url\n #response = HTTParty.get \"http://picplz.com/api/v2/pic.json?longurl_ids=#{id}\"\n #extract url\n if response && response['value'] && response['value']['pics'] && response['value']['pics'].first && response['value']['pics'].first['pic_files'] && response['value']['pics'].first['pic_files']['640r']\n response['value']['pics'].first['pic_files']['640r']['img_url'] \n else\n nil\n end\n end",
"def extract_image(page)\n imgs = page.css('.thumbimage')\n return unless imgs\n img = imgs.reject { |img| img[:src].starts_with? 'data:' }.first\n img[:src]\n end",
"def full_image_uri\n return nil if image.nil?\n return image if image.start_with?('http://')\n return 'http://bookmarket.webhop.org/' + image\n end",
"def get_img_url_from_html(html_path)\n\t\tf = File.open(html_path)\n\t\tdoc = Nokogiri::HTML(f)\n\t\timg_url = doc.css('img').attribute('src').value\n\t\tf.close\n\t\timg_url\n\tend",
"def image_url_imgly(link_url)\n image_url_redirect link_url, \"http://img.ly/show/full/\", \"\\r\\n\"\n end",
"def primary_image\n if images.length > 0\n images[0].url\n else\n \"https://vollrath.com/ClientCss/images/VollrathImages/No_Image_Available.jpg\"\n end\n end",
"def get_img_links()\n img = @page.css('img')\n @imgLinks = Array.new\n new_url = self.get_new_url()\n\t\t\n if @url[@url.length-1] != '/'\n @url += \"/\"\n end\n print new_url\n\n img.each do |i|\n @imgLinks.push(@url+i[\"src\"])\n end\n end",
"def photo_url\n src = details.at('#img_primary img')['src'] rescue nil\n\n if src =~ /^(http:.+@@)/ || src =~ /^(http:.+?)\\.[^\\/]+$/\n $1 + '.jpg'\n end\n end",
"def incremental_image_urls(url)\n log \"method begin\" if $DEBUG\n login if not logged_in?\n log \"logged in\" if $DEBUG\n\n page = agent.get(url)\n log \"got page\" if $DEBUG\n\n links = page.links.select {|l| l.href =~ /wallbase.cc\\/wallpaper/ } \n log \"selected links\" if $DEBUG\n links.each do |l|\n page = l.click\n log \"clicked link\" if $DEBUG\n url = page.image_urls().select {|e| e.match /wallbase2/ }.first\n puts url\n end\n\n end",
"def get_img(coords, mid)\n url = URI(URI.encode(\"http://google.com/movies?near=#{coords[0]}, #{coords[1]}&mid=#{mid}\"))\n\n\n doc_str = Net::HTTP.get(url)\n doc = Nokogiri::HTML(doc_str)\n\n#working here\n str = nil\n if doc.css('.img img').empty?\n return nil\n else\n str = doc.css('.img img').attr('src').to_s\n if str.include?('tbn')\n return str\n end\n end\n return nil\n end",
"def url\n if links.alternate\n links.alternate.href\n elsif links.self\n links.self.href\n else\n links.map.each do |l|\n l.href\n end.compact.first\n end\n end",
"def get_real_url(url)\n begin\n puts \"Getting real URL for: #{url}\"\n doc = Nokogiri::HTML(open(url))\n rescue OpenURI::HTTPError\n puts 'Too many requests, waiting 2 min then retrying...'\n sleep(120)\n doc = Nokogiri::HTML(open(url))\n end\n real_url = 'https://untappd.com' + doc.search('.details').search('a').first['href']\n puts \"Real URL is: #{real_url}\"\n real_url\nend",
"def single_picture(foursq_id)\n foursq_hash = Instagram.location_search(foursq_id)\n if foursq_hash.empty?\n return \"http://media.npr.org/assets/news/2010/01/30/tianshan2-1a2a29b83bc7a670bf8210d9c6daefa3ba46f971-s6-c30.jpg\"\n else\n all_results = Instagram.location_recent_media(foursq_hash[0][\"id\"])\n if all_results.empty?\n return \"http://media.npr.org/assets/news/2010/01/30/tianshan2-1a2a29b83bc7a670bf8210d9c6daefa3ba46f971-s6-c30.jpg\"\n else\n all_results.sample[\"images\"][\"standard_resolution\"][\"url\"]\n end\n end\n end",
"def get_large_image(asset_url)\n begin\n file = open(asset_url)\n doc = Nokogiri::HTML(file) \n# \n# EXPECTED FORMAT\n# \n# <ul class=\"slides\">\n# <li>\n# <img src=\"https://img.homesearch.com/img/20151211/08700ded-e77c-4a44-9366-374e9d8c054f_631x631.jpg\" alt=\"Image #1\" height=\"460\" width=\"631\" />\n# </li>\n# <li>\n# <img class=\"placeholder\" alt=\"Image #1\" height=\"460\" width=\"631\" />\n# </li>\n#</ul> \n \n doc.css('ul.slides li img')[0].attributes['src'].value\n rescue\n ''\n end\n end",
"def actual_url(url, options = {})\n response = Typhoeus::Request.head(url)\n if response.success?\n url\n elsif response.code == 302 || response.code == 301\n location = response.headers_hash[:location]\n (location =~ fb_ignore_pattern) ? nil : actual_url(location)\n elsif response.timed_out?\n Rails.logger.error(\"time out fetching profile photo from [#{url}]\")\n nil\n elsif response.code == 0\n Rails.logger.error(response.curl_error_message)\n nil\n elsif ((response.code == 403) || (response.code == 404)) && (options[:network] == :twitter)\n # Original size images for twitter may not exist\n Rails.logger.debug(\"Could not find image for twitter, url = #{url}\")\n nil\n else\n Rails.logger.error(\"HTTP request failed: \" + response.code.to_s)\n nil\n end\n end",
"def get_single_url(url)\n\n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url \n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n begin \n res2 = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n end\n\n r = \"\"\n begin\n r = res2.body\n rescue OpenURI::HTTPError=>e\n case e.to_s \n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return r\n end",
"def feed_url(url=self.blog_url)\n blog = Nokogiri::HTML(open(url))\n \n # select \n if (feed = blog.xpath(\"html/head/link[@rel='alternate']\")).present?\n feed.attribute(\"href\").text\n else\n nil\n end\n end",
"def get_sbi_url(html_302)\n if /HREF=\"(.+?)\"/ =~ html_302\n return $1\n else\n return PATH_SRC_NOTFOUND_IMG\n end\nend",
"def feature_img_url(image)\n return image if image.match(/^#{URI.regexp(%w[http https])}$/)\n\n image_url(['homepage', image].join('/'))\n end",
"def image_url_foursquare(link_url)\n image_url_embedly link_url\n end",
"def get_images_from_url\n @links = (images_from_img_tag + images_from_link_tag + images_from_extension).uniq\n @handler_link.remove_global_unless_symbols(@links)\n @links\n end",
"def image_url_twitpic(link_url)\n image_url_redirect link_url, \"http://twitpic.com/show/full/\"\n end",
"def display_img_url(url)\n url.sub(/s90$/, 's360') \n # recipe_response = Faraday.get(\"http://api.yummly.com/v1/api/recipe/#{id}\",\n # _app_id: ENV['YUMMLY_APP_ID'],\n # _app_key: ENV['YUMMLY_APP_KEY'])\n # image = JSON.parse(recipe_response.body)['images'].try(:first)\n # image['hostedLargeUrl'].present? ? image['hostedLargeUrl'] : image['hostedMediumUrl'] if image.present?\n end",
"def find_photo\n begin\n post_agent = Mechanize.new\n @html = post_agent.get(params[:site_url]).body\n url_host =URI.parse(params[:site_url]).host\n rescue => e\n end\n render :text=>@html\n end",
"def cover_medium_url\n images('medium').first[:src]\n end",
"def find_image(data)\n tags = Nokogiri::HTML(data)\n imgs = tags.css('img').map { |i| i['src'] }\n imgs.each do |img|\n if (img.include?(\".jpg\") || img.include?(\".png\"))\n return img\n end\n end\n return nil\n end",
"def get_next_article(url)\n uri = URI(URI::Parser.new.escape(url))\n response = Net::HTTP.get(uri)\n\n doc = Nokogiri::HTML.parse(response)\n\n #article = doc.at('a:contains(\"Article suivant\")')\n article = doc.at('a:contains(\"Nächster Artikel\")')\n article['href']\nend",
"def image_url_to_default_filename (image_url = @todays_image_url)\n\n matches = image_url.scan(/\\S+\\/(\\S+.jpg)/) # returns an array\n\n if (matches.length != 1)\n return nil\n end\n \n return matches[0].to_s\n \n end",
"def selection_image_url\n images.first.file.try(:cdn_url)\n end",
"def get_player_image (page, index)\n photo_downloaded = false\n\n # Attempt to find div that contains image\n\n image_divs = page.css('div.ohio-staff--photo')\n\n # If found, continue\n\n if !image_divs.nil? && !image_divs[0].children.empty?\n\n # Get image text from returned object\n\n image_url = image_divs.to_s\n\n # We only want the url, scan with regex\n\n image_url = image_url.scan /https[a-zA-Z0-9\\-\\/\\.:]*.jpg/\n\n # Only continue at this point if we were able to parse a url\n\n unless image_url.empty?\n\n # Download image file\n\n open(image_url.first) do |image|\n File.open(\"lib/outputs/photos/PlayerPhoto#{index}.jpg\", \"wb\") do |file|\n file.write(image.read)\n end\n end\n photo_downloaded = true\n end\n end\n\n # If we couldn't find, return path to default image. Otherwise return local path\n\n unless photo_downloaded\n return \"photos/default.jpg\"\n end\n\n \"photos/PlayerPhoto#{index}.jpg\"\n\nend",
"def image_url\n image.url.split('?').first if image\n end",
"def image_url\n image.url.split('?').first if image\n end",
"def canonical_for(url)\n req = Typhoeus.head(url)\n return unless req.success?\n return if req.headers['Content-Type'] == 'image/gif'\n return canonical_for(req.headers['Location']) if req.headers['Location']\n url\n end",
"def page_link(link, data)\n get_page_from_link(link, data, '//img[@id=\"image\"]')\n end",
"def find_image_from_open_graph_tag\n begin\n meta = doc.css(\"meta[property~='og:image']\")\n\n meta.each do |item|\n next if item[\"content\"].empty?\n\n return item[\"content\"]\n end\n rescue\n log \"Error getting OG tag: #{$!}\"\n end\n nil\n end",
"def get_next_url\n while true\n unless url = dequeue_url()\n # there are currently no further URLs in the queue\n return nil\n end\n\n unless http_url = HttpUrl.parse(url)\n log_error :invalid_url, url.inspect \n next\n end\n\n if has_file?(http_url.to_filename) \n log :skip_url__already_fetched, url.inspect\n next\n end\n\n return http_url\n end # while\n end",
"def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search('img').map{ |img| img['src'] }\n images\n end",
"def scrap_the_images\n url = RestClient.get(@url)\n parsed_result = Nokogiri::HTML(url)\n images = parsed_result.search('img').map { |img| img['src'] }\n images\n end",
"def fetch_url(body)\n aux = body.split('<link>').last\n aux = aux.split('<pubdate>').first\n aux\n end",
"def get_first_link(content)\n \n #Remove curly braces\n while content =~ /\\{\\{[^\\{\\\\}]+?\\}\\}/\n\t content.gsub!(/\\{\\{[^\\{\\}]+?\\}\\}/,'')\n end\n #remove info box\n content.sub!(/^\\{\\|[^\\{\\}]+?\\n\\|\\}\\n/,'')\n #remove anything in parens\n #content.gsub!(/\\(.*\\)/,'')\n content.gsub!(/(\\(.*\\))(?=^(?:(?!\\[\\])))/,'')\n #remove bold and italicized text\n content.gsub!(/'''''(.+?)'''''/,'')\n #remove italic text\n content.gsub!(/''(.+?)''/,'')\n #remove images and file links\n content.gsub!(/\\[\\[Image:.*?\\]\\]/,'')\n content.gsub!(/\\[\\[File:.*?\\]\\]/,'')\n content.gsub!(/\\[\\[image:.*?\\]\\]/,'')\n content.gsub!(/\\[\\[file:.*?\\]\\]/,'')\n #remove any link with colons in it\n #content.gsub!(/\\[\\[.*?:.*?\\]\\]/,'')\n #gets the first link\n content = content.slice(/\\[\\[.*?\\]\\]/)\n #replaces spaces with underscores (for correct resolving of links)\n content.gsub!(\" \",'_')\n #removes the trailing description (for correct resolving of links)\n content = content.gsub(/\\|.*?\\]\\]/,']]')\n return content\n end",
"def photo_url\r\n infoxml = get_info\r\n return infoxml.at('photosurl').inner_text\r\n end",
"def extract_url\n URI.extract(comment, %w[http https])[0]\n end",
"def get_image\n blog_contents = Nokogiri::HTML(self.content)\n\n if blog_contents.xpath(\"//img\").blank?\n self.post_image = nil\n else\n image_link = blog_contents.xpath(\"//img\")[0]['src']\n\n if image_link.include?(\"http://\")\n self.post_image = File.open(image_link)\n else\n image_link = Dir.pwd.concat(\"/public\" + image_link)\n self.post_image = File.open(image_link)\n end\n end\n\nend",
"def check_og_image(url)\n begin \n og_image = Nokogiri::HTML(open(url)).css('meta[property=\"og:image\"]')\n og_image.first.attributes[\"content\"].value if og_image\n rescue\n nil\n end\n end",
"def scrape_img( page, title )\n\t\t@desired_node=@img_url=nil\n\t\t@desired_nodes=[]\n\n\t\ttitle = scrape_title( page )\n\t\ttitle.slice!(title.rindex(\"|\")..title.length) unless title.rindex(\"|\").nil?\n\t\ttitle_words = title.downcase.strip.split(/ |-/).reject{|s| s=~/(\\|)|(with)|(recipe)|( [a-z]{1,3} )|\\d/}\n\n\t\t# for all 'img' tags, determine if it's title tag is \n\t\t# similar to the recipe title, or determine if the image filename\n\t\t# itself is similar to the title of the recipe. If so, hold on to the node\n\t\tpage.search(\"img\").each do |node|\n\t\t\tunless node.nil?\n\t\t\t\tunless node.attr(\"title\").nil?\n\t\t\t\t\ttitle_words.each do |word|\n\t\t\t\t\t\tif node.attr(\"title\").downcase =~ /(#{word})/\n\t\t\t\t\t\t\t@desired_nodes.push(node)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tunless node.attr(\"src\").nil?\n\t\t\t\t\ttitle_words.each do |word|\n\t\t\t\t\t\tif node.attr(\"src\").split(/\\//).last.downcase =~ /(#{word})/\n\t\t\t\t\t\t\t@desired_nodes.push(node)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\t\n\t\t# Some sites strip out the host; add it, if necessary\n\t\t# Use default image if the algorithm couldn't find anything\n\t\t@img_url = @desired_nodes.first.attr(\"src\")\n\n\t\tif @img_url.nil?\n\t\t\treturn \"/assets/img_404.png\"\n\t\telse\n\t\t\t@img_url = ( \"http://\" << page.canonical_uri.host << @img_url ) unless uri?( @img_url )\n\t\t\treturn @img_url\n\t\tend\n\tend",
"def size_link(size)\n link = images.find { |i| i.classifier == size }\n link ? link.url : nil\n end",
"def url; (page.url rescue ''); end",
"def url; (page.url rescue ''); end",
"def image_name(url)\n i = 1\n until ((url.last i)[\"/\"] == \"/\") do\n i +=1\n end\n return url.last i-1\n end",
"def get_href_content href\n href = href.to_s.unbowl.strip\n if href.end_with?(* %w{png jpg jpeg gif PNG JPG JPEG GIF})\n :img\n elsif /\\/\\/i\\.chzbgr/ =~ href\n :img\n else\n :text\n end\n\n # uri = URI(href.to_s.unbowl)\n # Net::HTTP.start(uri.host, uri.port) do |http|\n # http.open_timeout = 1\n # http.read_timeout = 1\n #\n # request = Net::HTTP::Head.new uri\n # response = http.request request\n # case response.to_hash[\"content-type\"].first\n # when /image/ then return :img\n # when /text/ then return :text\n # end\n # end\n # :unknown\n #rescue\n # logger.warn \"Unable to determine link [#{href.to_s.unbowl}] type: no internet connection. Reverting to default.\"\n # :unknown\n end",
"def thumbnail_value_from_document\n url = super\n return if url.blank?\n return unless url.match? URI::DEFAULT_PARSER.make_regexp # do not try to resolve invalid URLs\n\n return view_context.image_proxy_path(url: url) if url.to_s.start_with?('http://')\n\n url\n end",
"def description_image\n parsed_description.css('img').first # there's only one\n end",
"def first_image(folder_id, folder_name)\n if Folder.find(folder_id).cover == nil\n i = Image.joins(:exif).where(:folder_id => folder_id).\n order(\"exifs.date_time DESC\").first.name\n else\n i = Image.find(Folder.find(folder_id).cover).name\n end\n \"http://#{ENV['IMG_SERVER']}/#{folder_name}/#{i}\"\n end",
"def select_image_given_image_urls(image_urls, width, index = 0)\n if image_urls.nil? or image_urls == \"\"\n return \"/assets/Image_Missing.png\"\n end\n \n y = image_urls.to_s.split(\";\")\n \n if index < y.length\n y = y[index]\n elsif y.length > 0\n y = y[0]\n else\n return \"\"\n end\n \n z = y.split(\",\")\n image = select_closest_image(z, width)\n end",
"def imgurl\n picref.imgurl if picref\n end",
"def website\n _model.profile_links.where(profile_link_site_id: 29).first&.url\n end",
"def imageNameFromUrl(url,idx)\n ImageFinder.nameForImageFromUrl(url,@start_idx,idx)\n end",
"def url() processed_image.try(:url) || fallback_url end",
"def source_url\n return @node.inner_text.strip if image_url?\n\n image_node.attribute('src').value\n end",
"def canonical_url\n page_url || image_url\n end",
"def public_url_for(title)\n metadata_or_default_img_from(title) do |metadata|\n # effective_url_from(metadata.web_content_link)\n if content_type =~ /image/\n custom_thumbnail_image_for(metadata.thumbnail_link, 1000)\n else\n metadata.web_view_link\n end\n end\n end",
"def unwatermarked_url\n return nil if api_response[\"article_image_url\"].nil?\n Source::URL.parse(api_response[\"article_image_url\"])\n end",
"def image_url(source)\n abs_path = image_path(source)\n unless abs_path =~ /^http/\n abs_path = \"#{request.protocol}#{request.host_with_port}#{abs_path}\"\n end\n abs_path\n end",
"def rip\n # mech = Mechanize.new\n\n tag = folder\n puts \"Downloading Tag: '%s'...\" % tag\n cd_to folder_path(tag)\n\n base_url = url[/https?:..[^\\/]*/]\n next_link = url\n begin\n puts \"Downloading page '%s'...\" % next_link\n # doc = mech.get(next_link)\n doc = doc_for_url(next_link) # mech.get(next_link)\n links = doc.links\n next_link = links.find{|a| a.attributes.any?{|k,v| [k,v] == ['class','next_page'] } }\n next_link &&= base_url + next_link.href\n pages = links.select{|a| a.attributes.any?{|k,v| k == 'class' && v =~ /thumb/ } }\n pages.map do |a|\n puts \"a.href => #{base_url + a.href}\"\n # m = Mechanize.new\n # pg = m.get base_url + a.href\n pg = doc_for_url(base_url + a.href) #m.get base_url + a.href\n img = pg.links.find{|pga| pga.dom_id == 'highres' }\n\n if img == nil\n puts \"CAN NOT FIND #highres on '%s'\" % a.href\n next\n end\n\n filename = \"%s\" % [File.basename(img.href).sub(/\\?.*/,'')]\n\n if File.exists? filename\n puts \"Skip existing file '%s'...\" % filename\n else\n puts \"Saving '%s'...\" % filename\n # m.get(img.href).save_as(filename)\n doc_for_url(img.href).save_as(filename)\n end\n end\n end while next_link\n end",
"def original_asset_url(x)\n if x =~ ASSET\n # example: https://cdnb3.artstation.com/p/assets/images/images/003/716/071/large/aoi-ogata-hate-city.jpg?1476754974\n original_url = x.sub(%r!/(?:medium|small|large)/!, \"/original/\")\n\n if http_exists?(original_url, headers)\n return original_url\n end\n\n if x =~ /medium|small/\n large_url = x.sub(%r!/(?:medium|small)/!, \"/large/\")\n\n if http_exists?(large_url, headers)\n return large_url\n end\n end\n end\n\n return x\n end",
"def get_canonical_url\n self.doc = self.get_html(Media.html_options(self.url))\n if self.doc\n tag = self.doc.at_css(\"meta[property='og:url']\") || self.doc.at_css(\"meta[property='twitter:url']\") || self.doc.at_css(\"link[rel='canonical']\")\n get_parsed_url(tag) unless tag.blank?\n end\n end",
"def hub_url(url=feed_url)\n feed = Nokogiri::XML(open(url))\n \n # xpath of //*[@rel='hub'] is used instead of //link[@rel='hub'] since \n # the link element may be under different XML namespaces, e.g.\n # <atom:link> or <rss:link> etc\n if (hub = feed.xpath(\"//*[@rel='hub']\")).present?\n hub.attribute(\"href\").text\n else\n nil\n end\n end",
"def photo_link\n _link = photo_link_entry\n _link ? _link.href : nil\n end",
"def get_next_url\n while true\n unless url = @node_manager.dequeue_url\n # there are currently no further URLs in the queue\n return nil\n end\n\n unless http_url = HttpUrl.parse(url)\n @node_manager.log_error :invalid_url, url.inspect \n next\n end\n\n if @node_manager.has_file?(http_url.to_filename) \n @node_manager.log :skip_url__already_fetched, url.inspect\n next\n end\n\n return http_url\n end # while\n end",
"def getFinalUrl(url)\n return Net::HTTP.get_response(URI(url))['location']\nend",
"def get_company_url_from_internet( name )\n url_friendly_name = make_url_friendly name\n api_url = \"http://api.bing.net/xml.aspx?AppId=65E209AA925DE92F7B6235CFD453A33BE4893A66&Version=2.2&Market=en-US&Query=#{url_friendly_name}&Sources=web+spell&Web.Count=1\"\n url = ''\n response = open(api_url)\n xml = response.read\n doc = REXML::Document.new xml\n if ( doc != nil )\n results = doc.elements.to_a(\"//web:WebResult/web:Url\")\n url = results[0]\n else\n url = \"nothing\"\n end\n if url != nil\n begin\n domain_name = Domainatrix.parse(url.text)\n url = \"#{domain_name.domain}.#{domain_name.public_suffix}\"\n if is_noise? name, url\n url = ''\n end\n rescue\n url = ''\n end\n else\n url = ''\n end\n return url\n end",
"def get_google_img(query)\n img_search_keywords = query.strip.gsub(/\\s+/,'+')\n \n if img_search_keywords != ''\n url = \"http://ajax.googleapis.com/ajax/services/search/images?rsz=large&start=1&v=1.0&q=#{img_search_keywords}\"\n \n json_results = open(url) {|f| f.read };\n results = JSON.parse(json_results)\n image_array = results['responseData']['results']\n image = image_array[0] if image_array\n image = image['tbUrl']\n \n if image\n return image\n else\n return 'no image found'\n end\n end\n end",
"def full_img_url\n @full_image_url ||= nil\n if @full_image_url.nil?\n filename = \"#{reg_num}_1.jpg\"\n @full_image_url = File.exist?(\"#{RAILS_ROOT}/public/vehicles/#{filename}\") ? \"http://www.reeds.co.za/vehicles/#{filename}\" : \"\"\n end\n @full_image_url\n end",
"def fetch_movies_url\n # Visiter le site imdb: https://www.imdb.com/chart/top\n raw_html = URI.open(IMDB_TOP_CHART_URL).read\n # Utiliser nokogiri pour parser le fichier html recu\n html_doc = Nokogiri::HTML(raw_html)\n urls = []\n\n # Rechercher avec nokogiri les urls des 5 premiers films\n html_doc.search('.titleColumn a').first(5).each do |link|\n # Stocker dans un tableau\n urls << \"https://www.imdb.com#{link.attribute('href').value}\"\n end\n\n urls\nend",
"def read_link(item)\n link = item.search(\"link:first\")\n unless link.nil?\n post_url = link.text\n post_url = link.to_s.scan(/href=['\"]?([^'\"]*)['\" ]/).to_s if (post_url.nil? or post_url.empty?)\n return post_url\n else\n return nil\n end\n end",
"def href_regexp\n %r{\\[image-link-to:\\s+(?<url>.*?)\\]}\n end",
"def get_host_from_url(url)\n return url[0...url.index(\"/\")]\nend",
"def item_image_existed(item_id)\r\n image_link = all(:xpath, \"//*[@id='MainContent']//div[@id='#{item_id}']//a/img\").last\r\n image_link['src']\r\n end",
"def getFirstMatch page\n list = page.search('.findList')\n return nil if list.empty?\n return list.search('.findResult')[0].search('.result_text').children[1].attr('href')\nend",
"def image_url\n return '' if product_images.empty?\n product_images[0].filename.url\n end"
] | [
"0.7842618",
"0.7757024",
"0.75224406",
"0.7297792",
"0.72739816",
"0.71515715",
"0.71481353",
"0.7114568",
"0.705758",
"0.6992823",
"0.6981656",
"0.6940127",
"0.69209826",
"0.68506926",
"0.6827599",
"0.681797",
"0.6805199",
"0.6736064",
"0.6727465",
"0.6631616",
"0.662678",
"0.66163194",
"0.6574123",
"0.6557809",
"0.65208185",
"0.6481371",
"0.64547306",
"0.6454632",
"0.6428038",
"0.6413551",
"0.64092755",
"0.6396644",
"0.6376264",
"0.63758624",
"0.63372326",
"0.63364595",
"0.6328699",
"0.6298736",
"0.6296931",
"0.62957394",
"0.62761015",
"0.6271339",
"0.62672627",
"0.62626565",
"0.62619686",
"0.6255955",
"0.62286186",
"0.6222725",
"0.62218064",
"0.6216986",
"0.6212332",
"0.6212332",
"0.6211746",
"0.6209513",
"0.6194227",
"0.617805",
"0.6171466",
"0.616368",
"0.6156274",
"0.6146784",
"0.6145013",
"0.61316454",
"0.6124985",
"0.61145955",
"0.61030865",
"0.6096066",
"0.6092159",
"0.6092159",
"0.6086477",
"0.60749227",
"0.6069005",
"0.6067987",
"0.6056869",
"0.6054877",
"0.6048534",
"0.60441816",
"0.60434353",
"0.60351324",
"0.60317206",
"0.6023239",
"0.5989971",
"0.5983332",
"0.59813493",
"0.5977739",
"0.5966233",
"0.59543353",
"0.5952855",
"0.59173936",
"0.5915693",
"0.59151036",
"0.5910154",
"0.59033376",
"0.5896079",
"0.5893312",
"0.5879644",
"0.5872324",
"0.58404547",
"0.5837717",
"0.58339596",
"0.5827778"
] | 0.72258526 | 5 |
Download image by image url and save it to file | def dl_image (url)
_filename = @img_path + '/' + url.split('/').last
begin
if !File.directory?(@img_path)
require 'fileutils'
FileUtils::mkdir_p @img_path
puts "[INFO] created path '#{@img_path}'"
end
puts "[INFO] writing image file '#{_filename}'"
File.open(_filename, 'wb') do |file|
file.write open(url).read
end
return _filename
rescue Exception => e
puts "[ERROR] in 'DavidGetter#dl_image': #{e}"
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end",
"def save_image_to_file( image_url, filename )\n image_uri = URI.parse( image_url )\n data = Net::HTTP.get_response( image_uri.host, image_uri.path ).body\n open( filename, 'w' ) do |f|\n f.write( data )\n end\n end",
"def download_image\n Net::HTTP.start(@uri.host, @uri.port) do |http|\n\tif http.head(@uri.request_uri).code == \"200\"\n\tresp = http.get(@tempo.link)\n\topen(\"public/images/original/#{@original_image_name}\", \"wb\") do |file|\n\t file.write(resp.body)\n\tend\n end\n end\n end",
"def docDownloadImage(url, destFile)\n # Fix the image url, it cannot contain spaces.\n url = url.gsub(\" \", \"%20\")\n begin\n open(url) do |f|\n Pathname(destFile).parent.mkpath()\n File.open(destFile,\"wb\") do |file| file.puts(f.read) end\n end\n rescue\n puts \"*** Cannot download image: \" + url.to_s + \" ***\"\n end\nend",
"def download_file!(download_url = image_url)\n raise DownloadError, \"Download failed: couldn't find download url for #{url}\" if download_url.blank?\n response, file = http_downloader.download_media(download_url)\n raise DownloadError, \"Download failed: #{download_url} returned error #{response.status}\" if response.status != 200\n file\n end",
"def save_img_from_url(img_url, dst_path)\n\t\topen(dst_path, 'wb') do |output|\n\t open(img_url) do |data|\n\t output.write(data.read)\n\t end\n\t end\n\t\tnil\n\tend",
"def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end",
"def download_image(image_url)\n\n filename = \"temp.png\"\n data = image_url_to_base64(image_url)\n decoded_image = decode_base64_string(filename, data)\n write_swap_file(filename, decoded_image)\n\nend",
"def download_image(image_url)\n\n filename = \"temp.png\"\n data = image_url_to_base64(image_url)\n decoded_image = decode_base64_string(filename, data)\n write_swap_file(filename, decoded_image)\n\nend",
"def download_image(src_url,dest_path)\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\")\n content_type = content_type.gsub(\"pjpeg\",\"jpg\")\n content_type = content_type.gsub(\"jpeg\",\"jpg\")\n vortex_url = download_resource(src_url,dest_path,content_type)\n return vortex_url\nend",
"def download_image!(image_url)\n # lazy load libraries\n require 'zlib'\n require 'securerandom'\n require 'rubygems/package'\n\n file_with_ext = File.basename(image_url)\n extract_path = \"/tmp/ankus-downloads-#{SecureRandom.hex}\"\n file_name = case file_with_ext\n when /\\.tar\\.gz$/\n File.basename(file_with_ext, '.tar.gz')\n when /\\.tar$/\n File.basename(file_with_ext, '.tar')\n else\n File.basename(file_with_ext, '.*')\n end\n out = File.open(\"/tmp/#{file_name}-#{SecureRandom.hex}\", 'wb')\n\n FileUtils.mkdir_p extract_path\n\n # Efficient image write\n @log.info \"Downloading #{file_with_ext} file...\"\n streamer = lambda do |chunk, _, _|\n out.write chunk\n end\n Excon.get image_url, :response_block => streamer\n out.close\n @log.info \"Image downloaded to #{out.path}\"\n\n @log.info \"Extracting image contents to #{extract_path}...\"\n packaged_files = []\n Gem::Package::TarReader.new(Zlib::GzipReader.open(out.path)).each do |entry|\n FileUtils.mkdir_p \"#{extract_path}/#{File.dirname(entry.full_name)}\"\n packaged_files << entry.full_name\n File.open \"#{extract_path}/#{entry.full_name}\", 'w' do |f|\n f.write entry.read\n end\n end\n end",
"def download(file_name, options={})\n options['iiprop'] = 'url'\n\n attributes = image_info(file_name, options)\n if attributes\n RestClient.get attributes['url']\n else\n nil\n end\n end",
"def download_image(url, basename, limit = 3)\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n uri = URI(url)\n response = Net::HTTP.get_response(uri)\n\n case response\n when Net::HTTPRedirection\n new_url = response['location']\n download_image(new_url, basename, limit - 1)\n when Net::HTTPSuccess\n extension = File.extname(uri.path)\n local_file = \"#{basename}#{extension}\"\n File.write(\"images/#{local_file}\", response.body)\n @files_images << \"images/#{local_file}\"\n \n # Return the local file on success\n local_file\n end\n\nrescue StandardError => e\n warn \"Error downloading the image: #{e.message}\"\nend",
"def save_to_disk url, target_name\n from_url = URI.parse url\n Net::HTTP.start(from_url.host) do |http|\n resp = http.get(from_url.path)\n open(target_name, \"wb\") do |file|\n begin\n file.write(resp.body)\n rescue => err # FIXME don't fail on failed write (OTOH it's better it have no image than crash the whole app)\n return nil\n end\n return target_name\n end\n end\n end",
"def download_image\n if self.image_source_changed? && !self.image_source.empty?\n self.image = open(self.image_source)\n end\n end",
"def download_from_instagram\n path = File.join(File.dirname(__FILE__),\"tmp/#{@payload['title']}.jpg\") \n File.open(path, \"wb\") do |f| \n f.write HTTParty.get(@payload['photo_url']).parsed_response\n end\n path\n end",
"def save_image_from_url(url)\n save_instagram_load(fetch_image_by_id(retrieve_oembed_data_from_url(url).fields[\"media_id\"]))\n end",
"def store_image\n uri = URI.parse(profile_image_url)\n Net::HTTP.start(uri.host, uri.port) do |http|\n resp = http.get(uri.path)\n open(image_path, \"wb\") do |file|\n file.write(resp.body)\n end\n end\n end",
"def download_image(url, n, key)\n # Build the relative web path, the full local path, and a temp file path\n web_path = format(\"%s/%8.8x.jpg\", url.host, \"#{key}-#{n}\".hash & 0xFFFFFFFF)\n full_path = IMAGE_PATH + web_path\n temp_path = File.join(File.dirname(full_path), \"temp.img\")\n\n if File.exists?(full_path)\n # If the file exists, don't bother downloading it again\n Log.d(\"Skipping image: #{key}-#{n}\")\n else\n # Else download the image to a temp file\n # AMF - changed logic here to \"get\" the page first to see if it is valid, and then process it if it is\n Log.d(\"Downloading image: #{url} - #{key}-#{n}\")\n FileUtils.mkdir_p(File.dirname(temp_path))\n \n response = @client.get(URI.join(@base, url), nil, @headers) rescue nil\n\t\t\t\n # AMF - checking response.content.size > 1000 weeds out some missing image links\n # that seem to be undetectable \n if response != nil\n if response.status != 404 && response.content.size > 1000\n File.open(temp_path, \"wb\") {|f| f.write(response.content) }\n\n # Process the image using an overridable method\n process_image(temp_path, full_path, IMAGE_MAX_WIDTH * n, IMAGE_MAX_HEIGHT * n)\n\n # Delete the temp file\n File.delete(temp_path)\n else\n Log.d(\"Download failed. Status: #{response.status}, Size: #{response.content.size}\")\n Log.d(\"#{response.content}\")\n return nil\n end\n else\n return nil\n end\n end\n return web_path\n rescue Exception\n Log.e($!)\n return nil\n end",
"def download_image(src_url,dest_path)\n src_url = src_url.gsub(/\\?.*/,'')\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\").gsub(\"jpeg\",\"jpg\")\n content = open(src_url).read\n basename = Pathname.new(src_url).basename.to_s.gsub(/\\..*/,'')\n vortex_url = dest_path + basename + \".\" + content_type\n vortex_url = vortex_url.downcase\n begin\n @vortex.put_string(vortex_url, content)\n rescue Exception => e\n puts e.message\n pp e.backtrace.inspect\n puts \"vortex_url: \" + vortex_url\n exit\n end\n\n # Store a resized image to vortex\n puts \"Nedskalerer bilde: \" + src_url\n content_resized = resize_image(content, content_type,300)\n vortex_url_resized = dest_path + basename + \"_width_300.\" + content_type\n\n vortex_url_resized = vortex_url_resized.downcase\n begin\n @vortex.put_string(vortex_url_resized, content_resized)\n rescue Exception => e\n puts e.message\n pp e.backtrace.inspect\n puts \"vortex_url_resized: \" + vortex_url_resized\n exit\n end\n\n return { :vortex_url_resized => vortex_url_resized, :vortex_url => vortex_url}\nend",
"def download!(source_url, destination_file); end",
"def download_image(image)\r\n dir = File.join(@dirs[:content], image.rel_path)\r\n img = MiniMagick::Image.open(image.uri.to_s)\r\n img.combine_options(:mogrify) do |c|\r\n c.type \"optimize\"\r\n c.colorspace \"Gray\"\r\n c.quality 60\r\n c.resize '450x550>'\r\n end\r\n img.write dir\r\n end",
"def fetch_remote_image(filename)\r\n begin\r\n io = open(URI.parse(filename))\r\n def io.original_filename; base_uri.path.split('/').last; end\r\n return io\r\n rescue OpenURI::HTTPError => error\r\n log(\"Image #{filename} retrival returned #{error.message}, so this image was not imported\")\r\n rescue => error\r\n log(\"Image #{filename} could not be downloaded, so was not imported. #{error.message}\")\r\n end\r\n end",
"def download_remote_image1(remote_image_1_url)\n io = open(URI.parse(remote_image_1_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def download_image(url, directory, id, resize = false)\n uri = URI.parse(URI.escape(url))\n destination = File.join(File.dirname(__FILE__), \"images\", directory)\n filename = File.join(destination, \"#{id}.jpg\")\n\n begin\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.path)\n begin\n f = open(filename, \"wb\")\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n f.write(segment)\n end\n end\n ensure\n f.close\n end\n end\n rescue => e\n puts \"Error downloading #{url}\"\n puts e.message\n resize = false\n end\n \n # Resize the image if nessasary\n if resize\n begin\n resized_filename = File.join(destination, \"#{id}_resized.jpg\")\n ImageList.new(filename).resize_to_fit(SCALE_TO, SCALE_TO).write(resized_filename)\n rescue => e\n puts \"Error resizing image\"\n puts e.message\n end\n end\nend",
"def down_image(src, dest)\n\turl = URI::parse(src)\n\treq = Net::HTTP::Get.new(url.path)\n\tNet::HTTP.start(url.host, url.port) { |http|\n\t\tresp = http.request( req )\n\t\tcreate_file(resp, dest)\t\t\t\n\t}\nend",
"def download_remote_image4(remote_image_4_url)\n io = open(URI.parse(remote_image_4_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def download_file(url, dest)\n if File.exist?(dest)\n say \"File already downloaded #{dest}\"\n return dest\n end\n\n say \"Downloading...\"\n FileUtils.mkdir_p(File.dirname(dest)) # ensure parent folder exists\n\n File.open(dest, 'wb') do |saved_file|\n URI.open(url, 'rb') do |read_file|\n saved_file.write(read_file.read)\n end\n end\n dest\n end",
"def download_to_server full_url, path, ext\n require 'open-uri'\n\n user_directory = IMAGE_DIRECTORY + \"/#{session[:access_token].params['edam_userId']}\"\n unless File.directory? IMAGE_DIRECTORY\n Dir::mkdir( IMAGE_DIRECTORY ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n unless File.directory? user_directory\n Dir::mkdir( user_directory ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n file_name = user_directory + \"/\" + path + '.' + ext\n\n # TODO is this instance variable visible from the controller which include this module?\n @selected_file << file_name\n unless File.exists?(file_name)\n File.open(file_name, 'wb') do |output|\n # Download image\n # TODO: handle if session access token is nil\n open(full_url + \"?auth=#{session[:access_token].token}\") do |input|\n output << input.read\n end\n end\n end\n end",
"def download_remote_image3(remote_image_3_url)\n io = open(URI.parse(remote_image_3_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def download_remote_image2(remote_image_2_url)\n io = open(URI.parse(remote_image_2_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def save_file(url, file)\n puts \"Downloading http://...#{url[-8..-1]} -> #{file}\"\n File.open(file, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend",
"def download(url)\n base.get(url, @file_path)\n end",
"def image_from_url(url)\n self.image = open(url)\n self.direct_upload_url = \"none\"\n end",
"def save_local_path(url)\n return nil if url.nil? || ! url.match(%{^http})\n tmp_file = \"/tmp/#{Digest::SHA1.hexdigest(url)}\"\n agent = Mechanize.new { |_agent| _agent.user_agent = WebStat::Configure.get[\"user_agent\"] }\n image = agent.get(url)\n File.open(tmp_file, \"w+b\") do |_file|\n if image.class == Mechanize::File\n _file.puts(image.body)\n elsif image.respond_to?(:body_io)\n _file.puts(image.body_io.read)\n end\n end\n tmp_file\n rescue\n false\n end",
"def download_img_from_doc(file_path, dst_path, img_ext=\".jpg\")\n\t\tputs \"downloading from #{file_path} to #{dst_path}\"\n\t\tcollection = get_collection_by_url( File.dirname(file_path) )\n\t\tfile = collection.file_by_title(File.basename(file_path))\n\n\t\t# Download google document as html.\n\t\thtml_file_path = \"#{dst_path}/#{Pathname(file.title).sub_ext(\".html\")}\"\n\t\tfile.export_as_file(html_file_path)\n\n\t\t# Download image from html.\n\t\timg_url = get_img_url_from_html(html_file_path)\n\t\timg_path = Pathname(html_file_path).sub_ext(img_ext)\n\t\tsave_img_from_url(img_url, img_path)\n\n\t\t# remove image.\n\t\tFile.delete(html_file_path)\n\t\tnil\n\tend",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"def write_file_from_url(file, url)\n Net::HTTP.start(@download.base_url) do |http|\n begin\n http.request_get(url) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n ensure\n file.close\n end\n end\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download_remote_image5(remote_image_5_url)\n io = open(URI.parse(remote_image_5_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def download_wiki_image(artist)\n\n # Check if the artist image already exists\n return if artist.image_path(:medium)\n\n image_url = get_wikipedia_image_url(artist.wikilink)\n MetaGeneration::download_artist_image(artist, image_url)\n end",
"def download_and_save_file(url, path)\n options = {}\n\n proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']\n if proxy\n uri = URI.parse(proxy)\n proxy_host = uri.scheme + \"://\" + uri.host + \":\" + uri.port.to_s\n proxy_user, proxy_pass = uri.userinfo.split(/:/) if uri.userinfo\n options[:proxy_http_basic_authentication] = [proxy_host,proxy_user,proxy_pass]\n end\n\n open_and_save_file(path, open(url, options).read)\nend",
"def get_file(url); end",
"def download_to_file(url, path)\n result = false\n\n uri = URI(url)\n if uri.scheme == 'file'\n result = FileUtils.mv uri.path, path\n Rails.logger.info \"Moved to #{path}\" if result == 0\n else\n result = download_url_to_file uri, path\n end\n result\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def get_local_image(uri)\n # local?\n return uri unless uri[0,4] == 'http'\n\n ext = uri.split('.').last\n\n img_folder = './tmp/dl_img'\n Dir.mkdir(img_folder) unless Dir.exist?(img_folder)\n\n local_file = \"#{img_folder}/#{Digest::MD5.hexdigest(uri)}.#{ext}\"\n\n # wget is reliable downloader\n `wget -O #{local_file} #{uri}` unless File.exists?(local_file)\n\n local_file\n end",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def download()\n get_page\n puts \"Page Found\"\n get_img_names\n get_img_links\n len = @imgLinks.length\n a = @imgLinks\n files = @files\n len.times do |f|\n puts \"#{a[f]} found\"\n File.open(files[f], \"w\") do |fo|\t\n fo.write open(a[f]).read\n\t\tend\n puts \"#{files[f]} downloaded\"\n end\n end",
"def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end",
"def download_file(url, destination)\n raw_file = server_api.get_rest(url, true)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def download\n open(download_url, \"rb\")\n end",
"def save(name = nil)\n puts \"Downloading from #{@url}\"\n name = File.basename(@url) if name.nil?\n open(name, 'wb') do |file|\n file << open(@url).read\n end\n name\n end",
"def download\n path.dirname.mkpath\n\n case io = open(url)\n when StringIO\n begin\n exact_path.open('w', 0o755) { |fd| fd.write(io) }\n rescue StandardError\n exact_path.unlink if exact_path.exist?\n raise\n end\n when Tempfile\n io.close\n iopath = Pathname.new(io.path)\n iopath.chmod(0o755)\n iopath.rename exact_path\n end\n\n path.delete if path.symlink?\n path.make_symlink exact_path\n end",
"def download_image\n Net::HTTP.start(\"yuml.me\", 80) do |http|\n http.get(URI.escape(@diagram.get_uri))\n end\n end",
"def save_to_tempfile(url)\n verbose(\"Downloading #{url}\")\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n http.start do |http|\n resp = http.get(uri.path)\n file = Tempfile.new('master.zip')\n file.binmode\n file.write(resp.body)\n file.flush\n file.close\n\n verbose(\"Saved to #{file.path}\")\n\n file\n end\n end",
"def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end",
"def download_file(file_type)\n temp_file = File.new(public_url.split('/').last, \"wb\")\n remote_data = open(URI.parse(public_url))\n temp_file.write(remote_data.read)\n update_attributes(file_type => temp_file)\n File.delete temp_file\n end",
"def download(source_uri, destination, image_bounds, config)\n # don't re-download if the file already exists locally\n prefix = config[:pretend] ? '[pretend] ' : ''\n unless File.exists? destination\n begin\n unless config[:pretend]\n config[:logger].info {prefix + \"downloading #{source_uri} to #{destination}\"}\n system(\"mkdir -p \\\"#{File.dirname(destination)}\\\"\")\n plugin_send(:pre_download, destination, config)\n File.open(destination, \"wb\") {|f| f.write(open(source_uri).read)}\n image_bounds.resize destination\n image_bounds.fill_to destination\n plugin_send(:post_download, destination, config)\n end\n rescue => eMsg\n config[:logger].warn {prefix + \"Unable to download #{destination} - #{eMsg.to_s}\"}\n config[:logger].debug {eMsg.backtrace.join(\"\\n\")}\n # something bad happened, so cleanup the partially written local image file if it exists\n File.delete destination if File.exists? destination\n plugin_send(:on_download_error, destination, config)\n end\n else\n config[:logger].info {prefix + \"Skipping #{source_uri} => #{destination}\"}\n end\n end",
"def download(url, filename)\n require 'open-uri'\n if File.exists?(\"lib/\" + filename)\n puts \"'#{filename}' is already downloaded... skipped\"\n else\n puts \"'#{filename}' downloading...\"\n File.open(\"lib/\" + filename, \"wb\") do |saved_file|\n open(url + filename, \"rb\") { |read_file| saved_file.write(read_file.read) }\n end\n end\nend",
"def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end",
"def generate_png\n img = IMGKit.new(url).to_png\n file = File.new(\"#{id}-full.png\", \"w\", :encoding => 'ascii-8bit')\n file.write(img)\n return file.path\n end",
"def post_image(url, filename)\n post(url) do |req|\n req.body = open(filename).read\n end\n end",
"def convertUrlToFile(url, file_path)\n if (!(!file_path.nil? && !file_path.empty?))\n raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, \"convertUrlToFile::file_path\", \"image-to-image\", \"The string must not be empty.\", \"convert_url_to_file\"), 470);\n end\n \n output_file = open(file_path, \"wb\")\n begin\n convertUrlToStream(url, output_file)\n output_file.close()\n rescue Error => why\n output_file.close()\n FileUtils.rm(file_path)\n raise\n end\n end",
"def onlineBitmap(url)\n pbDownloadToFile(url,\"_temp.png\")\n return if !FileTest.exist?(\"_temp.png\")\n self.bitmap = pbBitmap(\"_temp\")\n File.delete(\"_temp.png\")\n end",
"def download(args = {})\n\t # \n\t # parse arguments\n\t # \n\t if args.keys.size == 1 and args.values.size == 1\n\t url = args.keys.first\n\t output_path = args.values.first\n\t else\n\t raise \"download() currently only accepts one {URL => location} pair\"\n\t end\n\t \n\t # \n\t # perform the download\n\t # \n\t \n\t # https://stackoverflow.com/questions/2263540/how-do-i-download-a-binary-file-over-http\n\t # instead of http.get\n\t require 'open-uri'\n\t \n\t File.open(output_path, \"wb\") do |saved_file|\n\t # the following \"open\" is provided by open-uri\n\t open(url, \"rb\") do |read_file|\n\t saved_file.write(read_file.read)\n\t end\n\t end\n\t \n\t return output_path\n\tend",
"def image_from_url(url)\n self.image.attach(io: URI.open(url), filename: 'generated-sketch.jpg')\n end",
"def download_img_dir(img_dir_path, dst_path)\n\t\tdst_path += ( \"/\" + File.basename(img_dir_path) ).gsub(\"//\", \"/\")\n\t\tFileUtils.makedirs(dst_path)\n\t\tcollection = get_collection_by_url( img_dir_path )\n\t\tcollection.files do |file|\n\t\t\tif file.is_a?(GoogleDrive::Collection)\n\t\t\t\tnew_img_dir_path = img_dir_path + \"/\" + file.title\n\t\t\t\tdownload_img_dir(new_img_dir_path, dst_path)\n\t\t\telse\n\t\t\t\t# ファイルは画像として保存する\n\t\t\t\t# TODO google documentかどうかのチェック\n\t\t\t\tfile_path = (img_dir_path + \"/\" + file.title).gsub(\"//\", \"/\")\n\t\t\t\timg_ext = File.extname(file.title)\n\t\t\t\tif img_ext.empty?\n\t\t\t\t\tdownload_img_from_doc(file_path, dst_path)\n\t\t\t\telse\n\t\t\t\t\tdownload_img_from_doc(file_path, dst_path, img_ext)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tnil\n\tend",
"def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(URI.escape(url))\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"def download_file(url, show_progress = false)\n if show_progress\n pbar = nil\n begin\n require 'progressbar'\n rescue LoadError => e\n Fog::Logger.warning \"progressbar rubygem not found. Install it for fancier progress.\"\n pbar = :noop\n end\n open(\n url,\n :content_length_proc => lambda { |total|\n if pbar != :noop\n if total && 0 < total\n pbar = ProgressBar.new(\"Downloading\", total)\n pbar.file_transfer_mode\n end\n end\n },\n :progress_proc => lambda { |read_size|\n if pbar != :noop\n pbar.set read_size if pbar\n else\n print \"\\rDownloading... #{\"%.2f\" % (read_size/1024.0**2)} MB\"\n end\n }\n )\n else\n open(url)\n end\n end",
"def fetch(base_url, file_name, dst_dir)\n FileUtils.makedirs(dst_dir)\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if File.exists?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n end\n return dst\n end",
"def downloadImage\n self.browser.find_element(:id => 'addimage').click\n sleep(2);\n end",
"def fetchRemoteImage(url)\n uri = ::URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Switch to HTTPS if necessary.\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n # Make the HTTP request.\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n if response.code == \"200\" && response[\"Content-Type\"].match(/^image\\/(.+)$/)\n # Strip the \"image/\" prefix from the content-type.\n return response.body, response[\"Content-Type\"].match(/^image\\/(.+)$/)[1]\n end\n end",
"def get_image_bytes(url)\n URI.open(url).read\nend",
"def download_url(url, output_filename, dir_name = \"media/tmp\")\n command = \"wget --quiet '#{url}' -O '#{dir_name}/#{output_filename}'\"\n system(command)\n end",
"def download!(uri)\n processed_uri = process_uri(uri)\n file = RemoteFile.new(processed_uri)\n raise CarrierWave::DownloadError, \"trying to download a file which is not served over HTTP\" unless file.http?\n cache!(file)\n end",
"def download_file(url, destination)\n raw_file = server_api.streaming_request(url)\n\n Chef::Log.info(\"Storing updated #{destination} in the cache.\")\n cache.move_to(raw_file.path, destination)\n end",
"def download_file(uri, dest_dir)\n begin\n u = URI.parse(uri)\n fname, ext = File.basename(u.path).scan(/(.+)\\.(.+)/).flatten\n dest_file = File.join(dest_dir, \"#{fname}_#{Time.now.to_i}.#{ext}\")\n res = send_http_get_request(uri)\n rescue Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,\n Errno::ECONNABORTED, Errno::EPIPE, Net::OpenTimeout,\n Errno::ETIMEDOUT => e\n print_error(\"#{e.message}: #{uri}\")\n return\n end\n\n save_file(res.body, dest_file)\n print_status(\"Download completed for #{uri}\")\n end",
"def get_image(image_url)\n # Open webpage and obtain HTML\n url = \"https://www.mariowiki.com\" + image_url\n document = Nokogiri::HTML(open(url))\n\n image_element = document.css('div.fullImageLink a')\n image_path = image_element.attr('href').value\n image = \"https://www.mariowiki.com\" + image_path\n\n return image\nend",
"def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend",
"def image_from_url\n io = open(URI.parse(image_url))\n def io.original_filename; base_uri.path.split('/').last; end\n self.image = io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...) \n end",
"def download_file_to_filename(filename, url)\n puts \"Downloading #{url}...\"\n uri = URI(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: uri.scheme == 'https'\n ) do |http|\n request = Net::HTTP::Get.new uri.request_uri\n\n http.request request do |response|\n if response.is_a?(Net::HTTPRedirection) || response.is_a?(Net::HTTPFound)\n return download_file_to_filename(filename, response['location'])\n end\n\n open filename, 'wb' do |io|\n response.read_body do |chunk|\n io.write(chunk)\n end\n end\n end\n end\nend",
"def copy_image_locally(img)\n begin\n # if an image is stored on typepad servers, copy it locally\n if img =~ /typepad/\n open(\"public/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\",\"w\").write(open(img).read)\n # update the link in the content\n update_image_source(img)\n end\n rescue\n puts \"was not able to capture \" << img << \" locally\"\n end\n end",
"def docGetImageDownloadURL(imgTag)\n srcMatch = imgTag.scan(/src=\"(.*?)\"/)\n if not srcMatch.empty? then \n\tsrc = srcMatch[0][0]\n $lastImageUrl = src # Useful for logging when returning nil below\n if src.start_with?(\"http://www.mosync.com\") then\n return src\n elsif src.start_with?(\"https://raw.github.com\") then\n return src\n elsif src.start_with?(\"http://\") or \n src.start_with?(\"https://\") then\n\t # Return nil here if images from other domains\n\t # should not be downloaded.\n puts \" *** External image: \" + src\n return nil\n elsif src.start_with?(\"/\") then\n # Download from http://www.mosync.com/\n return \"http://www.mosync.com\" + src\n else \n puts \" *** UKNOWN IMAGE SOURCE: \" + src\n end\n end\n return nil\nend",
"def get_random_image( )\n\n print \"getting image... \"\n\n dest_file = \"#{File::SEPARATOR}tmp#{File::SEPARATOR}#{SecureRandom.hex( 5 )}.jpg\"\n Net::HTTP.start( \"lorempixel.com\" ) do |http|\n resp = http.get(\"/640/480/cats/\")\n open( dest_file, \"wb\" ) do |file|\n file.write( resp.body )\n end\n end\n puts \"done\"\n return dest_file\n\n end",
"def download_protocol_images(page, district_dir, district_id, precinct_id)\n ##################\n # GET HTML PAGE\n ##################\n begin\n @logger_info.info(\"Retrieving: #{page}\")\n agent = Mechanize.new { |agent| agent.user_agent_alias = \"Mac Firefox\" }\n html = agent.get(page).body\n @logger_info.info(\"Retrieved page: #{page}\")\n rescue => e\n @logger_error.error(\"Unable to retrieve: #{page} | #{e}\")\n end\n\n ##################\n # GET IMAGES\n ##################\n doc = Nokogiri::HTML(html)\n images = doc.css(\"img\")\n links = images.map { |i| i['src']}\n amend_count = 1\n\n if links.length > 1\n links.each_with_index do |value,index|\n if index > 0\n img_uri = value.sub('../../','')\n img_url = \"http://#{@url}/#{img_uri}\"\n img_bname = \"#{district_id}-#{precinct_id}\"\n\n begin\n unless File.exists?(\"#{district_dir}#{img_bname}_amendment_#{amend_count}.jpg\")\n @logger_info.info(\"Downloading amendment: #{img_bname}\")\n open(\"#{district_dir}#{img_bname}_amendment_#{amend_count}.jpg\", 'wb') do |pfile|\n puts \"Downloading: #{district_dir}#{img_bname}_amendment_#{amend_count}.jpg\"\n pfile << open(img_url).read\n end\n @logger_info.info(\"Downloaded amendment: #{img_bname}\")\n amend_count += 1\n @amend_counter += 1\n end\n rescue => e\n @logger_error.error(\"Download failed: #{img_bname} | #{e}\")\n next\n end\n end # if index\n end # links\n end\n\n sleep(0)\nend",
"def get_file_via_http url, file_name, try\n\n @config.logger.trace(\"Downloading \" + url + \" to \" + file_name )\n p = URI::Parser.new\n uri = URI.parse( p.escape( url ) )\n req = Net::HTTP::Get.new(uri.request_uri)\n req[\"User-Agent\"] = NicInfo::VERSION_LABEL\n req[\"Accept\"] = NicInfo::JSON_CONTENT_TYPE\n req[\"Connection\"] = \"close\"\n http = Net::HTTP.new( uri.host, uri.port )\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode=OpenSSL::SSL::VERIFY_NONE\n end\n res = http.start do |http_req|\n http_req.request(req)\n end\n\n case res\n when Net::HTTPSuccess\n File.write(file_name, res.body)\n else\n if res.code == \"301\" or res.code == \"302\" or res.code == \"303\" or res.code == \"307\" or res.code == \"308\"\n res.error! if try >= 5\n location = res[\"location\"]\n return get_file_via_http( location, file_name, try + 1)\n end\n res.error!\n end\n end",
"def download_image!\n EventCreationJob.new.perform(\n source: self,\n resource: self\n )\n\n UserImageCreationJob.new.perform(self)\n end",
"def download_file(test = false)\n @update_file = Tempfile.new(['elasticsearch_update_file', @download.extension])\n\n @log.info('Downloading file from url.')\n\n write_file_from_url(@update_file, @download.url) unless test\n\n @update_file\n end",
"def download_slideshow\n Down.download bucket_url.url\n end",
"def write_image(filename, decoded_image)\r\n\r\n f = File.new \"./public/images/blog/#{filename}\", \"wb\"\r\n f.write(decoded_image)\r\n f.close if f\r\n\r\n end",
"def download_and_store(url, filename=\"#{SecureRandom.uuid}\")\n\n # https://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html\n file = Tempfile.new(filename) # use an array to enforce a format\n\n # set to write in binary mode (kinda weird api, but hey)\n file.binmode\n\n @task_result.logger.log_good \"Attempting to download #{url} and store in #{file.path}\" if @task_result\n\n begin\n\n uri = URI.parse(url)\n\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n # TODO enable proxy\n http = Net::HTTP.start(uri.host, uri.port, nil, nil, opts) do |http|\n http.read_timeout = 15\n http.open_timeout = 15\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n end\n\n rescue URI::InvalidURIError => e\n @task_result.logger.log_error \"Invalid URI? #{e}\" if @task_result\n return nil\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n return nil\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n return nil\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ETIMEDOUT => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unexpected end of file, consider looking at this file manually: #{url}\" if @task_result\n return nil\n ensure\n file.flush\n file.close\n end\n\n file.path\n end",
"def download(url, cache_dir, filename)\n run_script \"curl -L --create-dirs -o #{cache_dir[:guest_path]}/#{filename} #{url}\" unless File.exist?(\"#{cache_dir[:host_path]}/#{filename}\")\n end",
"def download_dynamic_image_url(record_or_array, options = {})\n dynamic_image_url(record_or_array, { action: :download }.merge(options))\n end",
"def save_images(mkd,path)\n regexp_img_links = /!\\[(.*?)\\]\\((.*?)\\)/\n img_dirname = File.basename(path)\n FileUtils.mkdir_p(path,{:mode => 0755})\n client = HTTPClient.new\n mkd.gsub!(regexp_img_links).with_index do |matched,i|\n #save image\n alttext = $1\n imgurl = $2\n $stdout.puts imgurl\n\n ext = File.extname(imgurl).match(/(.*?)(?:\\?.*)?$/)[1]\n filename = (\"%07\\d\" % i)+ext\n filename_fullpath = File.join(path,filename)\n begin\n data=client.get_content(imgurl)\n rescue\n # if we could not get image,we do not edit link.\n next \"\"\n end\n File.open(filename_fullpath,\"w\"){|file| file.write(data)}\n\n #fix the link\n \"})\"\n end\nend",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url) \n if r.class == String #success\n open(File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def download_file(url, dest_dir)\n @log.info(\"== Ensuring file is cached: #{url} to #{dest_dir}\")\n require 'down'\n filename = File.basename(url)\n downloaded_file = File.join(dest_dir,filename)\n remote_file = Down.open(url)\n unless File.exist?(downloaded_file) && File.size(downloaded_file) == remote_file.size\n @log.verbose(\"Downloading #{url} to #{downloaded_file}\")\n Down.download(url, destination: downloaded_file)\n else\n @log.verbose(\"Skipping download, already in cache: #{downloaded_file}\")\n end\n remote_file.close\n downloaded_file\n end",
"def picture_from_url(url) \n self.photo = open(url) \n end",
"def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end",
"def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end"
] | [
"0.8675342",
"0.8023153",
"0.7759042",
"0.75892997",
"0.75708723",
"0.75036615",
"0.7479027",
"0.74535763",
"0.74535763",
"0.7332216",
"0.722876",
"0.7179486",
"0.70956534",
"0.7051066",
"0.70368344",
"0.7001597",
"0.6983319",
"0.6982645",
"0.69601375",
"0.694726",
"0.6924285",
"0.6881206",
"0.6871354",
"0.6830706",
"0.67611545",
"0.66751844",
"0.6635256",
"0.6633443",
"0.6617682",
"0.66167295",
"0.66077185",
"0.6573929",
"0.6569671",
"0.6551059",
"0.65504444",
"0.6550274",
"0.6534945",
"0.65263385",
"0.6482966",
"0.64622957",
"0.64462274",
"0.64221007",
"0.6386169",
"0.63747334",
"0.63273597",
"0.63249844",
"0.6315423",
"0.6298099",
"0.62941873",
"0.62785697",
"0.6268768",
"0.6265048",
"0.62393844",
"0.6232752",
"0.6232086",
"0.6225855",
"0.6223693",
"0.6214639",
"0.62103593",
"0.62006825",
"0.6183829",
"0.6168555",
"0.6163183",
"0.6141528",
"0.6138734",
"0.6137979",
"0.61378616",
"0.6127599",
"0.612593",
"0.6124041",
"0.6124024",
"0.60748374",
"0.6070371",
"0.6053216",
"0.60496634",
"0.6037815",
"0.6033347",
"0.60301363",
"0.6027924",
"0.6011148",
"0.5993206",
"0.5990758",
"0.5980279",
"0.5968113",
"0.59656495",
"0.5962086",
"0.59477687",
"0.594231",
"0.59287566",
"0.5925578",
"0.5921148",
"0.59188044",
"0.5910907",
"0.59010655",
"0.5888426",
"0.58863825",
"0.5885858",
"0.58507013",
"0.5839085",
"0.582632"
] | 0.6971018 | 18 |
Get top url from iMG list, get url of image out of that url and download the file returning the file path after success. | def get_next
_info = self.get_next_list_entry!
unless _info.nil?
_url = _info[0]
_imgurl = self.get_image_url _url
unless _imgurl.nil?
_filename = self.dl_image _imgurl
return {
'filename' => _filename,
'author' => _info[1],
'title' => _info[2],
'origin' => _url
}
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_image\n Net::HTTP.start(@uri.host, @uri.port) do |http|\n\tif http.head(@uri.request_uri).code == \"200\"\n\tresp = http.get(@tempo.link)\n\topen(\"public/images/original/#{@original_image_name}\", \"wb\") do |file|\n\t file.write(resp.body)\n\tend\n end\n end\n end",
"def download_image(url, basename, limit = 3)\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n uri = URI(url)\n response = Net::HTTP.get_response(uri)\n\n case response\n when Net::HTTPRedirection\n new_url = response['location']\n download_image(new_url, basename, limit - 1)\n when Net::HTTPSuccess\n extension = File.extname(uri.path)\n local_file = \"#{basename}#{extension}\"\n File.write(\"images/#{local_file}\", response.body)\n @files_images << \"images/#{local_file}\"\n \n # Return the local file on success\n local_file\n end\n\nrescue StandardError => e\n warn \"Error downloading the image: #{e.message}\"\nend",
"def download_image(url, n, key)\n # Build the relative web path, the full local path, and a temp file path\n web_path = format(\"%s/%8.8x.jpg\", url.host, \"#{key}-#{n}\".hash & 0xFFFFFFFF)\n full_path = IMAGE_PATH + web_path\n temp_path = File.join(File.dirname(full_path), \"temp.img\")\n\n if File.exists?(full_path)\n # If the file exists, don't bother downloading it again\n Log.d(\"Skipping image: #{key}-#{n}\")\n else\n # Else download the image to a temp file\n # AMF - changed logic here to \"get\" the page first to see if it is valid, and then process it if it is\n Log.d(\"Downloading image: #{url} - #{key}-#{n}\")\n FileUtils.mkdir_p(File.dirname(temp_path))\n \n response = @client.get(URI.join(@base, url), nil, @headers) rescue nil\n\t\t\t\n # AMF - checking response.content.size > 1000 weeds out some missing image links\n # that seem to be undetectable \n if response != nil\n if response.status != 404 && response.content.size > 1000\n File.open(temp_path, \"wb\") {|f| f.write(response.content) }\n\n # Process the image using an overridable method\n process_image(temp_path, full_path, IMAGE_MAX_WIDTH * n, IMAGE_MAX_HEIGHT * n)\n\n # Delete the temp file\n File.delete(temp_path)\n else\n Log.d(\"Download failed. Status: #{response.status}, Size: #{response.content.size}\")\n Log.d(\"#{response.content}\")\n return nil\n end\n else\n return nil\n end\n end\n return web_path\n rescue Exception\n Log.e($!)\n return nil\n end",
"def download_from_instagram\n path = File.join(File.dirname(__FILE__),\"tmp/#{@payload['title']}.jpg\") \n File.open(path, \"wb\") do |f| \n f.write HTTParty.get(@payload['photo_url']).parsed_response\n end\n path\n end",
"def get_file(url); end",
"def download_remote_image1(remote_image_1_url)\n io = open(URI.parse(remote_image_1_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def fetch_remote_image(filename)\r\n begin\r\n io = open(URI.parse(filename))\r\n def io.original_filename; base_uri.path.split('/').last; end\r\n return io\r\n rescue OpenURI::HTTPError => error\r\n log(\"Image #{filename} retrival returned #{error.message}, so this image was not imported\")\r\n rescue => error\r\n log(\"Image #{filename} could not be downloaded, so was not imported. #{error.message}\")\r\n end\r\n end",
"def download(file_name, options={})\n options['iiprop'] = 'url'\n\n attributes = image_info(file_name, options)\n if attributes\n RestClient.get attributes['url']\n else\n nil\n end\n end",
"def download_remote_image3(remote_image_3_url)\n io = open(URI.parse(remote_image_3_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def download_remote_image2(remote_image_2_url)\n io = open(URI.parse(remote_image_2_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def image_url_lockerz(link_url)\n response = http_get \"http://api.plixi.com/api/tpapi.svc/json/metadatafromurl?details=false&url=#{link_url}\"\n response[\"BigImageUrl\"] if response\n end",
"def download()\n get_page\n puts \"Page Found\"\n get_img_names\n get_img_links\n len = @imgLinks.length\n a = @imgLinks\n files = @files\n len.times do |f|\n puts \"#{a[f]} found\"\n File.open(files[f], \"w\") do |fo|\t\n fo.write open(a[f]).read\n\t\tend\n puts \"#{files[f]} downloaded\"\n end\n end",
"def rip\n # mech = Mechanize.new\n\n tag = folder\n puts \"Downloading Tag: '%s'...\" % tag\n cd_to folder_path(tag)\n\n base_url = url[/https?:..[^\\/]*/]\n next_link = url\n begin\n puts \"Downloading page '%s'...\" % next_link\n # doc = mech.get(next_link)\n doc = doc_for_url(next_link) # mech.get(next_link)\n links = doc.links\n next_link = links.find{|a| a.attributes.any?{|k,v| [k,v] == ['class','next_page'] } }\n next_link &&= base_url + next_link.href\n pages = links.select{|a| a.attributes.any?{|k,v| k == 'class' && v =~ /thumb/ } }\n pages.map do |a|\n puts \"a.href => #{base_url + a.href}\"\n # m = Mechanize.new\n # pg = m.get base_url + a.href\n pg = doc_for_url(base_url + a.href) #m.get base_url + a.href\n img = pg.links.find{|pga| pga.dom_id == 'highres' }\n\n if img == nil\n puts \"CAN NOT FIND #highres on '%s'\" % a.href\n next\n end\n\n filename = \"%s\" % [File.basename(img.href).sub(/\\?.*/,'')]\n\n if File.exists? filename\n puts \"Skip existing file '%s'...\" % filename\n else\n puts \"Saving '%s'...\" % filename\n # m.get(img.href).save_as(filename)\n doc_for_url(img.href).save_as(filename)\n end\n end\n end while next_link\n end",
"def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end",
"def download_remote_image5(remote_image_5_url)\n io = open(URI.parse(remote_image_5_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def download_protocol_images(page, district_dir, district_id, precinct_id)\n ##################\n # GET HTML PAGE\n ##################\n begin\n @logger_info.info(\"Retrieving: #{page}\")\n agent = Mechanize.new { |agent| agent.user_agent_alias = \"Mac Firefox\" }\n html = agent.get(page).body\n @logger_info.info(\"Retrieved page: #{page}\")\n rescue => e\n @logger_error.error(\"Unable to retrieve: #{page} | #{e}\")\n end\n\n ##################\n # GET IMAGES\n ##################\n doc = Nokogiri::HTML(html)\n images = doc.css(\"img\")\n links = images.map { |i| i['src']}\n amend_count = 1\n\n if links.length > 1\n links.each_with_index do |value,index|\n if index > 0\n img_uri = value.sub('../../','')\n img_url = \"http://#{@url}/#{img_uri}\"\n img_bname = \"#{district_id}-#{precinct_id}\"\n\n begin\n unless File.exists?(\"#{district_dir}#{img_bname}_amendment_#{amend_count}.jpg\")\n @logger_info.info(\"Downloading amendment: #{img_bname}\")\n open(\"#{district_dir}#{img_bname}_amendment_#{amend_count}.jpg\", 'wb') do |pfile|\n puts \"Downloading: #{district_dir}#{img_bname}_amendment_#{amend_count}.jpg\"\n pfile << open(img_url).read\n end\n @logger_info.info(\"Downloaded amendment: #{img_bname}\")\n amend_count += 1\n @amend_counter += 1\n end\n rescue => e\n @logger_error.error(\"Download failed: #{img_bname} | #{e}\")\n next\n end\n end # if index\n end # links\n end\n\n sleep(0)\nend",
"def top_image(url)\n og_image = check_og_image(url)\n apple_image = check_apple_image(url)\n mechanize_search = mechanize_search(url)\n if og_image\n return og_image\n elsif apple_image\n return apple_image\n elsif mechanize_search\n mechanize_search \n # In case all else fails ...\n else\n \"../image-dne.jpg\"\n end\n end",
"def download_remote_image4(remote_image_4_url)\n io = open(URI.parse(remote_image_4_url))\n def io.original_filename; base_uri.path.split('/').last; end\n io.original_filename.blank? ? nil : io\n rescue # catch url errors with validations instead of exceptions (Errno::ENOENT, OpenURI::HTTPError, etc...)\n end",
"def docGetImageDownloadURL(imgTag)\n srcMatch = imgTag.scan(/src=\"(.*?)\"/)\n if not srcMatch.empty? then \n\tsrc = srcMatch[0][0]\n $lastImageUrl = src # Useful for logging when returning nil below\n if src.start_with?(\"http://www.mosync.com\") then\n return src\n elsif src.start_with?(\"https://raw.github.com\") then\n return src\n elsif src.start_with?(\"http://\") or \n src.start_with?(\"https://\") then\n\t # Return nil here if images from other domains\n\t # should not be downloaded.\n puts \" *** External image: \" + src\n return nil\n elsif src.start_with?(\"/\") then\n # Download from http://www.mosync.com/\n return \"http://www.mosync.com\" + src\n else \n puts \" *** UKNOWN IMAGE SOURCE: \" + src\n end\n end\n return nil\nend",
"def download_to_server full_url, path, ext\n require 'open-uri'\n\n user_directory = IMAGE_DIRECTORY + \"/#{session[:access_token].params['edam_userId']}\"\n unless File.directory? IMAGE_DIRECTORY\n Dir::mkdir( IMAGE_DIRECTORY ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n unless File.directory? user_directory\n Dir::mkdir( user_directory ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n file_name = user_directory + \"/\" + path + '.' + ext\n\n # TODO is this instance variable visible from the controller which include this module?\n @selected_file << file_name\n unless File.exists?(file_name)\n File.open(file_name, 'wb') do |output|\n # Download image\n # TODO: handle if session access token is nil\n open(full_url + \"?auth=#{session[:access_token].token}\") do |input|\n output << input.read\n end\n end\n end\n end",
"def download_image(src_url,dest_path)\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\")\n content_type = content_type.gsub(\"pjpeg\",\"jpg\")\n content_type = content_type.gsub(\"jpeg\",\"jpg\")\n vortex_url = download_resource(src_url,dest_path,content_type)\n return vortex_url\nend",
"def docDownloadImage(url, destFile)\n # Fix the image url, it cannot contain spaces.\n url = url.gsub(\" \", \"%20\")\n begin\n open(url) do |f|\n Pathname(destFile).parent.mkpath()\n File.open(destFile,\"wb\") do |file| file.puts(f.read) end\n end\n rescue\n puts \"*** Cannot download image: \" + url.to_s + \" ***\"\n end\nend",
"def download_image(url, directory, id, resize = false)\n uri = URI.parse(URI.escape(url))\n destination = File.join(File.dirname(__FILE__), \"images\", directory)\n filename = File.join(destination, \"#{id}.jpg\")\n\n begin\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.path)\n begin\n f = open(filename, \"wb\")\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n f.write(segment)\n end\n end\n ensure\n f.close\n end\n end\n rescue => e\n puts \"Error downloading #{url}\"\n puts e.message\n resize = false\n end\n \n # Resize the image if nessasary\n if resize\n begin\n resized_filename = File.join(destination, \"#{id}_resized.jpg\")\n ImageList.new(filename).resize_to_fit(SCALE_TO, SCALE_TO).write(resized_filename)\n rescue => e\n puts \"Error resizing image\"\n puts e.message\n end\n end\nend",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def get_player_image (page, index)\n photo_downloaded = false\n\n # Attempt to find div that contains image\n\n image_divs = page.css('div.ohio-staff--photo')\n\n # If found, continue\n\n if !image_divs.nil? && !image_divs[0].children.empty?\n\n # Get image text from returned object\n\n image_url = image_divs.to_s\n\n # We only want the url, scan with regex\n\n image_url = image_url.scan /https[a-zA-Z0-9\\-\\/\\.:]*.jpg/\n\n # Only continue at this point if we were able to parse a url\n\n unless image_url.empty?\n\n # Download image file\n\n open(image_url.first) do |image|\n File.open(\"lib/outputs/photos/PlayerPhoto#{index}.jpg\", \"wb\") do |file|\n file.write(image.read)\n end\n end\n photo_downloaded = true\n end\n end\n\n # If we couldn't find, return path to default image. Otherwise return local path\n\n unless photo_downloaded\n return \"photos/default.jpg\"\n end\n\n \"photos/PlayerPhoto#{index}.jpg\"\n\nend",
"def docDownloadImages\n puts \"Downloading images\"\n \n externalImages = \"EXTERNAL IMAGES:\\n\"\n \n # Find all files.\n n = 0\n Pathname.glob(pathDocuments() + \"**/*.html\").each do |filePath|\n n = n + 1\n puts \"Processing File \" + n.to_s + \": \" + filePath.to_s\n # Iterate over all images in the file.\n html = fileReadContent(filePath)\n html.scan(/<img.*?>/) do |imgTag|\n puts \" img: \" + imgTag\n # Get the scr url of the img tag\n # and download and save image.\n url = docGetImageDownloadURL(imgTag)\n if url != nil then\n\t destFile = docGetImagePath(url, filePath.parent)\n puts \" downloading from: \" + url\n puts \" writing image to: \" + destFile.to_s\n docDownloadImage(url, destFile)\n puts \" done\"\n\t else\n\t puts \" *** IMAGE NOT DOWNLOADED: \" + imgTag\n # A hack indeed.\n externalImages += filePath.to_s + \": \" + $lastImageUrl + \"\\n\"\n end\n end\n end\n \n puts externalImages\nend",
"def get_random_image( )\n\n print \"getting image... \"\n\n dest_file = \"#{File::SEPARATOR}tmp#{File::SEPARATOR}#{SecureRandom.hex( 5 )}.jpg\"\n Net::HTTP.start( \"lorempixel.com\" ) do |http|\n resp = http.get(\"/640/480/cats/\")\n open( dest_file, \"wb\" ) do |file|\n file.write( resp.body )\n end\n end\n puts \"done\"\n return dest_file\n\n end",
"def image_data\n response = nil\n\n Net::HTTP.start(SERVICE_HOST) do |http|\n response = http.get(URI.parse(@url).path + ':medium')\n\n if response.code.to_s =~ /\\A3\\d\\d/\n new_location = URI.parse(response['Location'])\n Net::HTTP.start(new_location.host) do |http|\n response = http.get(new_location.path + '?' + new_location.query)\n end\n end\n end\n\n response.body\n end",
"def download_file!(download_url = image_url)\n raise DownloadError, \"Download failed: couldn't find download url for #{url}\" if download_url.blank?\n response, file = http_downloader.download_media(download_url)\n raise DownloadError, \"Download failed: #{download_url} returned error #{response.status}\" if response.status != 200\n file\n end",
"def get_img_all\n while not @end_state\n puts \"Currently downloading: #{@current_title}\"\n get_img\n next_page\n @global_count += 1\n if not @ch_limit.nil? and @global_count == @ch_limit\n @end_state = true\n end\n end\n puts \"Finished downloading!\"\n end",
"def getStockImage(link)\n dog_page = HTTParty.get(link, :verify => false)\n parsed_dog_page = Nokogiri::HTML(dog_page)\n\n info_table = parsed_dog_page.css(\".biota\")[0]\n \n image = info_table.css(\"img\")[0]\n pic = image != nil ? \"https:#{image['src']}\" : nil\nend",
"def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end",
"def incremental_image_urls(url)\n log \"method begin\" if $DEBUG\n login if not logged_in?\n log \"logged in\" if $DEBUG\n\n page = agent.get(url)\n log \"got page\" if $DEBUG\n\n links = page.links.select {|l| l.href =~ /wallbase.cc\\/wallpaper/ } \n log \"selected links\" if $DEBUG\n links.each do |l|\n page = l.click\n log \"clicked link\" if $DEBUG\n url = page.image_urls().select {|e| e.match /wallbase2/ }.first\n puts url\n end\n\n end",
"def get_image(image_url)\n # Open webpage and obtain HTML\n url = \"https://www.mariowiki.com\" + image_url\n document = Nokogiri::HTML(open(url))\n\n image_element = document.css('div.fullImageLink a')\n image_path = image_element.attr('href').value\n image = \"https://www.mariowiki.com\" + image_path\n\n return image\nend",
"def download_image(src_url,dest_path)\n src_url = src_url.gsub(/\\?.*/,'')\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\").gsub(\"jpeg\",\"jpg\")\n content = open(src_url).read\n basename = Pathname.new(src_url).basename.to_s.gsub(/\\..*/,'')\n vortex_url = dest_path + basename + \".\" + content_type\n vortex_url = vortex_url.downcase\n begin\n @vortex.put_string(vortex_url, content)\n rescue Exception => e\n puts e.message\n pp e.backtrace.inspect\n puts \"vortex_url: \" + vortex_url\n exit\n end\n\n # Store a resized image to vortex\n puts \"Nedskalerer bilde: \" + src_url\n content_resized = resize_image(content, content_type,300)\n vortex_url_resized = dest_path + basename + \"_width_300.\" + content_type\n\n vortex_url_resized = vortex_url_resized.downcase\n begin\n @vortex.put_string(vortex_url_resized, content_resized)\n rescue Exception => e\n puts e.message\n pp e.backtrace.inspect\n puts \"vortex_url_resized: \" + vortex_url_resized\n exit\n end\n\n return { :vortex_url_resized => vortex_url_resized, :vortex_url => vortex_url}\nend",
"def fetch_file_by_url\n if (self.url)\n self.file = self.url\n end\n end",
"def getImgURL(title, year)\n title = URI.escape(title + \" \" + year.to_s + \" movie poster\")\n req = \"https://www.googleapis.com/customsearch/v1?key=AIzaSyAyLoJQc-3aOYZLlHff3S4JPmeK88rL878&cx=015799936154194163641:2d_yj8n3fbm&q=\"+title+\"&searchType=image\"#&imgSize=medium\"\n img_results = JSON.parse(@shttp.call(req))\n if img_results && img_results[\"items\"]\n img_results[\"items\"].each do |img_result|\n link = img_result[\"link\"]\n\n begin\n # Return the first link that gives a 200\n if @shttp.head(link) == \"200\"\n return link\n else\n Rails.logger.warn \"Link inaccessible, skipping to next one...\"\n end\n rescue Exception => ex\n Rails.logger.error ex.message\n end\n end\n end\n\n # Return empty string if we don't find anything\n return \"\"\n end",
"def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end",
"def download_slideshow\n Down.download bucket_url.url\n end",
"def image_url_picplz(link_url)\n id = extract_id link_url\n #try short url\n response = http_get \"http://picplz.com/api/v2/pic.json?shorturl_ids=#{id}\"\n #if short url fails, try long url\n #response = HTTParty.get \"http://picplz.com/api/v2/pic.json?longurl_ids=#{id}\"\n #extract url\n if response && response['value'] && response['value']['pics'] && response['value']['pics'].first && response['value']['pics'].first['pic_files'] && response['value']['pics'].first['pic_files']['640r']\n response['value']['pics'].first['pic_files']['640r']['img_url'] \n else\n nil\n end\n end",
"def first_image(folder_id, folder_name)\n if Folder.find(folder_id).cover == nil\n i = Image.joins(:exif).where(:folder_id => folder_id).\n order(\"exifs.date_time DESC\").first.name\n else\n i = Image.find(Folder.find(folder_id).cover).name\n end\n \"http://#{ENV['IMG_SERVER']}/#{folder_name}/#{i}\"\n end",
"def get_local_image(uri)\n # local?\n return uri unless uri[0,4] == 'http'\n\n ext = uri.split('.').last\n\n img_folder = './tmp/dl_img'\n Dir.mkdir(img_folder) unless Dir.exist?(img_folder)\n\n local_file = \"#{img_folder}/#{Digest::MD5.hexdigest(uri)}.#{ext}\"\n\n # wget is reliable downloader\n `wget -O #{local_file} #{uri}` unless File.exists?(local_file)\n\n local_file\n end",
"def get_file_via_http url, file_name, try\n\n @config.logger.trace(\"Downloading \" + url + \" to \" + file_name )\n p = URI::Parser.new\n uri = URI.parse( p.escape( url ) )\n req = Net::HTTP::Get.new(uri.request_uri)\n req[\"User-Agent\"] = NicInfo::VERSION_LABEL\n req[\"Accept\"] = NicInfo::JSON_CONTENT_TYPE\n req[\"Connection\"] = \"close\"\n http = Net::HTTP.new( uri.host, uri.port )\n if uri.scheme == \"https\"\n http.use_ssl=true\n http.verify_mode=OpenSSL::SSL::VERIFY_NONE\n end\n res = http.start do |http_req|\n http_req.request(req)\n end\n\n case res\n when Net::HTTPSuccess\n File.write(file_name, res.body)\n else\n if res.code == \"301\" or res.code == \"302\" or res.code == \"303\" or res.code == \"307\" or res.code == \"308\"\n res.error! if try >= 5\n location = res[\"location\"]\n return get_file_via_http( location, file_name, try + 1)\n end\n res.error!\n end\n end",
"def download!(source_url, destination_file); end",
"def dl_image (url)\n _filename = @img_path + '/' + url.split('/').last\n begin\n if !File.directory?(@img_path)\n require 'fileutils'\n FileUtils::mkdir_p @img_path\n puts \"[INFO] created path '#{@img_path}'\"\n end\n puts \"[INFO] writing image file '#{_filename}'\"\n File.open(_filename, 'wb') do |file|\n file.write open(url).read\n end\n return _filename\n rescue Exception => e\n puts \"[ERROR] in 'DavidGetter#dl_image': #{e}\"\n end\n return nil\n end",
"def get_tirerack_images\n start_time = Time.now\n tirerack_login\n completed = {}\n mfg_list = get_manufacturer_list\n mfg_list.each do |mfg|\n data = YAML.load(open_file('tires', mfg)) \n puts \"Checking Manufacturer #{mfg}\\n\"\n data.each_key do |model|\n puts \"\\tModel: #{model}\\n\"\n data[model][:images].each do |img|\n # base will be just image name but with the _s.jpg extension\n base = File.basename(img)\n large = base.gsub(/_s.jpg/,\"_l.jpg\")\n if completed.has_key?(base)\n puts \"\\t...already processed #{base}\\n\" \n else\n # check if image exists\n puts \"Checking if #{large} exists in public/images/tirerack.\\n\" \n unless File.exists?(File.join(RAILS_ROOT,\"public\",\"images\",\"tirerack\",large))\n puts \"Image #{large} was NOT found, Download it now...\\n\"\n iuri = URI.parse('http://www.tirerackwholesale.com/') + URI.parse(img.gsub(/_s.jpg/,'_l.jpg'))\n # write the binary image data to the public/images/wheels directory and be sure to log the filename too for later reference\n begin\n File.open(File.join(RAILS_ROOT, 'public','images','tirerack',File.basename(iuri.path)), 'wb') do | f |\n f << iuri.read \n end \n rescue Timeout::Error\n puts \"timed out trying to download #{File.basename(iuri.path)}\"\n end\n puts \"Image #{large} downloaded.\\n\"\n completed[base] = true\n else\n puts \"Image #{large} was found, SKIP it...\\n\"\n end\n end\n end\n end\n end\n puts \"Downloaded #{completed.length} images, in #{Time.now - start_time} seconds.\\n\"\n end",
"def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end",
"def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\n end",
"def file_by_url(url)\n return file_by_id(url_to_id(url))\n end",
"def download_image!(image_url)\n # lazy load libraries\n require 'zlib'\n require 'securerandom'\n require 'rubygems/package'\n\n file_with_ext = File.basename(image_url)\n extract_path = \"/tmp/ankus-downloads-#{SecureRandom.hex}\"\n file_name = case file_with_ext\n when /\\.tar\\.gz$/\n File.basename(file_with_ext, '.tar.gz')\n when /\\.tar$/\n File.basename(file_with_ext, '.tar')\n else\n File.basename(file_with_ext, '.*')\n end\n out = File.open(\"/tmp/#{file_name}-#{SecureRandom.hex}\", 'wb')\n\n FileUtils.mkdir_p extract_path\n\n # Efficient image write\n @log.info \"Downloading #{file_with_ext} file...\"\n streamer = lambda do |chunk, _, _|\n out.write chunk\n end\n Excon.get image_url, :response_block => streamer\n out.close\n @log.info \"Image downloaded to #{out.path}\"\n\n @log.info \"Extracting image contents to #{extract_path}...\"\n packaged_files = []\n Gem::Package::TarReader.new(Zlib::GzipReader.open(out.path)).each do |entry|\n FileUtils.mkdir_p \"#{extract_path}/#{File.dirname(entry.full_name)}\"\n packaged_files << entry.full_name\n File.open \"#{extract_path}/#{entry.full_name}\", 'w' do |f|\n f.write entry.read\n end\n end\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.path) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def download_images\r\n puts \"Downloading and processing images:\"\r\n STDOUT.flush\r\n images = @issue.images\r\n progress = ProgressBar.new(\"Downloading\", images.length)\r\n images.each do |i|\r\n download_image(i)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end",
"def download_image\n Net::HTTP.start(\"yuml.me\", 80) do |http|\n http.get(URI.escape(@diagram.get_uri))\n end\n end",
"def download(url, filename)\n uri = URI.parse(url)\n f = open(filename,'wb')\n begin\n http = Net::HTTP.start(uri.host) {|http|\n http.request_get(uri.request_uri) {|resp|\n resp.read_body {|segment|\n f.write(segment)\n }\n }\n }\n ensure\n f.close()\n end\nend",
"def images_fetch\n url_relations = get_relations(self.relations, \"url\")\n @imgurls = []\n url_relations.each do |relation|\n if @imgurls.count < 4\n puts \"url relation\"\n url = relation[\"url\"][\"resource\"]\n case relation[\"type\"]\n when \"allmusic\"\n puts \"allmusic\"\n begin\n doc = Nokogiri::HTML(open(url,'User-Agent' => 'firefox'))\n # parse for allmusic.com\n if doc.css(\".artist-image\").count != 0\n imgurl = doc.css(\".artist-image\").children.css(\"img\").attribute(\"src\").value\n @imgurls << imgurl\n end\n rescue\n puts \"skipped\"\n end\n puts \"exit allmusic\"\n # TODO -- can we get all images in lightbox gallery?\n when \"bandsintown\"\n puts \"bandsintown\"\n doc = Nokogiri::HTML(open(url))\n if doc.css(\".sidebar-image\").count != 0\n imgurl = doc.css(\".sidebar-image\").css(\"img\").attribute(\"src\").value\n @imgurls << imgurl\n end\n puts \"exit bandsintown\"\n when \"last.fm\"\n # parse for last.fm\n when \"myspace\"\n # parse for myspace.com\n when \"wikipedia\"\n puts \"wiki\"\n Wikipedia.find(url).image_urls.each do |url|\n # TODO DO NOT PUT SVG FILES HERE\n @imgurls << url unless url.include?(\".svg\")\n end\n puts \"exit wiki\"\n end\n end\n end\n puts \"images fetch return\"\n return @imgurls\n end",
"def downloadImgs(path)\n\t\tthreads = []\n\t\t5.times { \n\t\t\tthreads << Thread.new {\n\t\t\t\tif !@queue.empty?\n\t\t\t\t\timg_src = @queue.pop\n\t\t\t\t\timage = open(img_src)\n\t\t\t\t\tnames = img_src.split(\"/\")\n\t\t\t\t\tname = names[names.length - 1]\n\t\t\t\t\tFile.open(\"#{path}/#{name}\", \"wb\") {|file| file.write(image.read)}\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\tthreads.each {|thr| thr.join}\n\tend",
"def download_image(image_url)\n\n filename = \"temp.png\"\n data = image_url_to_base64(image_url)\n decoded_image = decode_base64_string(filename, data)\n write_swap_file(filename, decoded_image)\n\nend",
"def download_image(image_url)\n\n filename = \"temp.png\"\n data = image_url_to_base64(image_url)\n decoded_image = decode_base64_string(filename, data)\n write_swap_file(filename, decoded_image)\n\nend",
"def fetch_file_from_url(url)\n logger.debug \"Starting GET of file from #{url}\"\n start_time = Time.now\n uri = URI.parse(url)\n if (uri.kind_of?(URI::HTTP))\n resp = Net::HTTP.get_response(uri)\n case resp\n when Net::HTTPSuccess then\n filename = File.basename(uri.path)\n tmpfile = Tempfile.new(filename,Dir.tmpdir)\n File.open(tmpfile.path,'wb+') do |f|\n f.write resp.body\n end\n tmpfile.flush\n file= ActionDispatch::Http::UploadedFile.new(tempfile: tmpfile)\n file.original_filename = filename\n file.content_type = resp.content_type\n logger.debug \"GET took #{Time.now - start_time} seconds\"\n return file\n else\n logger.error \"Could not get file from location #{url} response is #{resp.code}:#{resp.message}\"\n return nil\n end\n else\n return nil\n end\n rescue URI::InvalidURIError\n logger.error \"Invalid URI #{url}\"\n nil\n rescue => e\n logger.error \"error in fetch_file_from_url #{url}\"\n logger.error e.backtrace.join(\"\\n\")\n nil\n end",
"def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n\t\t\tpath = f.path\n\t\t\turl = URI.parse(url)\n\t\t\tNet::HTTP.start( url.host) { |http|\n\t\t\t\tresp = http.get(url.path)\n\t\t\t\tf.write(resp.body)\n\t\t\t}\n\t\t\tf.close\n\t\t\treturn path\n\t\tend",
"def proxy_image\n multiresimage = Multiresimage.find(params[:id])\n img_length = params[:image_length]\n\n begin\n if multiresimage.DELIV_OPS.svg_image.svg_width[0].to_i <= params[:image_length].to_i\n img_length = multiresimage.DELIV_OPS.svg_image.svg_width[0].to_i-1\n end\n rescue Exception\n #this is a fix so that smaller images get shown. Currently, they break since larger versions do not exist.\n end\n\n default_image = File.open(\"app/assets/images/site/missing2.png\", 'rb') do |f|\n f.read\n end\n filename = \"missing2.png\"\n resp = ''\n\n if can?(:read, multiresimage)\n\n Net::HTTP.start(DIL_CONFIG['dil_fedora_base_ip'], DIL_CONFIG['dil_fedora_port']) { |http|\n resp = http.get(\"#{DIL_CONFIG['dil_fedora_url']}#{params[:id]}#{DIL_CONFIG['dil_fedora_disseminator']}#{img_length}\")\n #open(\"/usr/local/proxy_images/#{params[:id]}.jpg\" ,\"wb\") { |new_file|\n #new_file.write(resp.body)\n #send_file(new_file, :type => \"image/jpeg\", :disposition=>\"inline\")\n #send data uses server memory instead of storage.\n if(resp.body.include? \"error\")\n image = default_image\n else\n image = resp.body\n filename = \"#{params[:id]}.jpg\"\n end\n send_data(image, :disposition=>'inline', :type=>'image/jpeg', :filename=>filename)\n }\n #}\n else\n send_data(default_image, :disposition=>'inline', :type=>'image/jpeg', :filename=>filename)\n end\n end",
"def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents: ethon.response_body,\n link_url: last_location_header(ethon)\n }\n end",
"def download(url)\n filedl = url.split(\"/\").last\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n open(filedl, \"w\") do |file|\n file.write(response.body)\n end\n return filedl\nend",
"def image_url_yfrog(link_url)\n response = http_get(\"http://www.yfrog.com/api/oembed?url=#{link_url}\")\n response['url'] if response\n end",
"def url\n @client.get_download_link(@path)\n end",
"def save_to_disk url, target_name\n from_url = URI.parse url\n Net::HTTP.start(from_url.host) do |http|\n resp = http.get(from_url.path)\n open(target_name, \"wb\") do |file|\n begin\n file.write(resp.body)\n rescue => err # FIXME don't fail on failed write (OTOH it's better it have no image than crash the whole app)\n return nil\n end\n return target_name\n end\n end\n end",
"def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end",
"def get_large_image(asset_url)\n begin\n file = open(asset_url)\n doc = Nokogiri::HTML(file) \n# \n# EXPECTED FORMAT\n# \n# <ul class=\"slides\">\n# <li>\n# <img src=\"https://img.homesearch.com/img/20151211/08700ded-e77c-4a44-9366-374e9d8c054f_631x631.jpg\" alt=\"Image #1\" height=\"460\" width=\"631\" />\n# </li>\n# <li>\n# <img class=\"placeholder\" alt=\"Image #1\" height=\"460\" width=\"631\" />\n# </li>\n#</ul> \n \n doc.css('ul.slides li img')[0].attributes['src'].value\n rescue\n ''\n end\n end",
"def download_from_original_url\n return if self.original_url.blank?\n\n self.contents = begin\n Timeout::timeout(300) do\n io = open(URI.parse(self.original_url))\n def io.original_filename\n base_uri.path.split('/').last\n end\n io.original_filename.blank? ? nil : io\n end\n rescue\n errors.add :original_url, \"unable to download url\"\n nil\n end\n end",
"def download_b2_file(image_info, *sightings_count)\n\n folder = image_info[0]\n filename = image_info[1]\n b2_file_path = \"#{folder}/#{filename}\"\n\n if sightings_count\n sightings_count = sightings_count[0]\n subdirectory = folder.split(\"/\")[1]\n sightings_dir = create_directory(subdirectory, sightings_count)\n swap_file = \"#{sightings_dir}/#{filename}\"\n else\n create_folder()\n swap_file = \"./public/swap/#{filename}\" # use when running via app.rb\n # swap_file = \"../public/swap/#{file}\" # use when running locally from /lib/b2_bucket.rb\n end\n\n file_url = b2_generate_file_url(filename, folder)\n\n uri = URI(file_url)\n req = Net::HTTP::Get.new(uri)\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then\n res.body\n swapfile = File.new(swap_file, 'wb')\n swapfile.puts(res.body)\n swapfile.close\n when Net::HTTPRedirection then\n fetch(res['location'], limit - 1)\n else\n res.error!\n end\n\nend",
"def display_img_url(url)\n url.sub(/s90$/, 's360') \n # recipe_response = Faraday.get(\"http://api.yummly.com/v1/api/recipe/#{id}\",\n # _app_id: ENV['YUMMLY_APP_ID'],\n # _app_key: ENV['YUMMLY_APP_KEY'])\n # image = JSON.parse(recipe_response.body)['images'].try(:first)\n # image['hostedLargeUrl'].present? ? image['hostedLargeUrl'] : image['hostedMediumUrl'] if image.present?\n end",
"def get_image_url (origin_url)\n begin\n html = open(origin_url).read\n urls = URI.extract(html)\n .select { |lnk| lnk[/\\.jpg$|\\.png$|\\.gif$|\\.jpeg/m] }\n return urls.empty? ? nil : urls[0]\n rescue Exception => e\n puts \"[ERROR] in 'DavidGetter#get_image': #{e}\"\n return nil\n end\n end",
"def download_image\n if self.image_source_changed? && !self.image_source.empty?\n self.image = open(self.image_source)\n end\n end",
"def get_file(url)\n get(url).body\n end",
"def low\n unless self.url.nil?\n httpsimagepath = self.url.insert(4, 's')\n # httpsimagepath.slice! self.filename\n filename = self.url.split('/').last\n if filename.last(4) == \".jpg\"\n filename_noext = filename.split('.').first\n else\n filename_noext = filename\n end\n version = self.url.split('/').last(2).first\n httpsimagepath.slice! filename\n if version.match('[v]\\d*').to_s == version\n httpsimagepath.slice! version + '/'\n httpsimagepath = httpsimagepath + 'q_auto:low/' + version + '/' + filename_noext\n else\n httpsimagepath = httpsimagepath + 'q_auto:low/' + filename_noext\n end\n return httpsimagepath\n end\n end",
"def get_og_image_url\n og_image_filename = self.filename.split('.')[0] + \"_open-graph.jpg\"\n og_image_url = Storage.get_file_url(ENV['AWS_S3_DIR_PAGES'], self.issue_id, og_image_filename )\n return og_image_url\n end",
"def fetchRemoteImage(url)\n uri = ::URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Switch to HTTPS if necessary.\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n # Make the HTTP request.\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n\n if response.code == \"200\" && response[\"Content-Type\"].match(/^image\\/(.+)$/)\n # Strip the \"image/\" prefix from the content-type.\n return response.body, response[\"Content-Type\"].match(/^image\\/(.+)$/)[1]\n end\n end",
"def fetch(url)\n\tputs \"now fetchin \" + url\n\tresponse = \"\"\n\tfilename = \"cache/\" + url.split(\"/\")[-1]\n\t\n\tbegin\n\t#If the file doesn't exist, download it\n\t if ! File.exists?(filename)\n\t open(url) { |f| response = f.read }\n\t File.open(filename, 'w') {|f| f.write(response) }\n # Give the website a break\n sleep(5)\n\t end\n\t \n # Open the saved file eitherway\n open(filename) { |f| response = f.read }\n\t thedoc = Hpricot(response)\n\n\trescue Exception => e\n\t print e, \"\\n\"\n\t debugger\n\tend\n\treturn thedoc\nend",
"def get_wikipedia_image_url(wikipedia_url)\n begin\n\n return nil if !wikipedia_url || wikipedia_url.empty?\n\n # Download the wikipedia page\n page = Nokogiri::HTML(open(wikipedia_url))\n\n # Get the image href:\n link = page.css( @settings.image_selector ).first\n return if !link\n image_href = link.attr('href')\n image_href = URI.unescape(image_href)\n # image_href => '/wiki/Archivo:Metallica_at_The_O2_Arena_London_2008.jpg'\n\n # Get the image \"id\":\n slash_idx = image_href.rindex('/')\n return if !slash_idx\n image_id = image_href[ slash_idx + 1 .. -1 ]\n # image_id => 'Archivo:Metallica_at_The_O2_Arena_London_2008.jpg'\n\n # Get the full URL:\n # /w/api.php?action=query&prop=imageinfo&format=json&iiprop=url&titles=Archivo%3AMetallica_at_The_O2_Arena_London_2008.jpg\n image_info = Wikipedia.client.request( {\n action: 'query',\n prop: 'imageinfo',\n iiprop: 'url',\n titles: image_id,\n format: 'json'\n } )\n # result => {\n # \"batchcomplete\": \"\",\n # \"query\": {\n # \"normalized\": [\n # {\n # \"from\": \"Archivo:Metallica_at_The_O2_Arena_London_2008.jpg\",\n # \"to\": \"Archivo:Metallica at The O2 Arena London 2008.jpg\"\n # }\n # ],\n # \"pages\": {\n # \"-1\": {\n # \"ns\": 6,\n # \"title\": \"Archivo:Metallica at The O2 Arena London 2008.jpg\",\n # \"missing\": \"\",\n # \"imagerepository\": \"shared\",\n # \"imageinfo\": [\n # {\n # \"url\": \"https://upload.wikimedia.org/wikipedia/commons/0/07/Metallica_at_The_O2_Arena_London_2008.jpg\",\n # \"descriptionurl\": \"https://commons.wikimedia.org/wiki/File:Metallica_at_The_O2_Arena_London_2008.jpg\"\n # }\n # ]\n # }\n # }\n # }\n # }\n image_info = search = JSON.parse(image_info)\n\n image_url = image_info['query']['pages']['-1']['imageinfo'][0]['url']\n return image_url\n rescue\n Log.log_last_exception\n return nil\n end\n end",
"def fetch(base_url, file_name, dst_dir)\n FileUtils.makedirs(dst_dir)\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if File.exists?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n end\n return dst\n end",
"def docGetImagePath(url, dirPath)\n imageFileName = Pathname(url).basename.to_s\n return dirPath + \"images/\" + imageFileName\nend",
"def scrap_the_images\n url = RestClient.get(@url)\n parsed_result = Nokogiri::HTML(url)\n images = parsed_result.search('img').map { |img| img['src'] }\n images\n end",
"def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search('img').map{ |img| img['src'] }\n images\n end",
"def latest_image\n attachments.present? ? attachments.last.document.url(:medium) : \"#{APP_URL}/images/missing.png\"\n end",
"def download_img_from_doc(file_path, dst_path, img_ext=\".jpg\")\n\t\tputs \"downloading from #{file_path} to #{dst_path}\"\n\t\tcollection = get_collection_by_url( File.dirname(file_path) )\n\t\tfile = collection.file_by_title(File.basename(file_path))\n\n\t\t# Download google document as html.\n\t\thtml_file_path = \"#{dst_path}/#{Pathname(file.title).sub_ext(\".html\")}\"\n\t\tfile.export_as_file(html_file_path)\n\n\t\t# Download image from html.\n\t\timg_url = get_img_url_from_html(html_file_path)\n\t\timg_path = Pathname(html_file_path).sub_ext(img_ext)\n\t\tsave_img_from_url(img_url, img_path)\n\n\t\t# remove image.\n\t\tFile.delete(html_file_path)\n\t\tnil\n\tend",
"def download_media post\n files = []\n post.media_attachments.each_with_index do |img, i|\n extension = File.extname(img.url).split('?').first\n if ValidMediaTypes.include? extension\n files << \"#{i}#{extension}\"\n File.write(files[i], Net::HTTP.get(URI.parse(img.url)))\n end\n end\n files\n end",
"def find_image_url(link)\n url = nil\n if !link.nil?\n url = image_url_instagram link if (link.index('instagr.am') || link.index('instagram.com'))\n url = image_url_picplz link if link.index 'picplz'\n url = image_url_twitpic link if link.index 'twitpic'\n url = image_url_yfrog link if link.index 'yfrog'\n url = image_url_imgly link if link.index 'img.ly'\n url = image_url_tco link if link.index 't.co'\n url = image_url_lockerz link if link.index 'lockerz.com'\n url = image_url_foursquare link if link.index '4sq.com'\n url = image_url_embedly link if url.nil? #just try embed.ly for anything else. could do all image url processing w/ embedly, but there's probably some kind of rate limit invovled.\n end\n url\n end",
"def giant_url\n is_processed ?\n FileSystem.url(giant_path) : \n orig_image_url\n end",
"def download(url)\n base.get(url, @file_path)\n end",
"def server_image_url(filename)\n uri = \"#{@api_url}/#{@project_id}/images/get_upload_url?filename=#{filename}&access_token=#{@access_token}\"\n get uri\n end",
"def download_file!\n retries = 3\n\n begin\n options = {\n :read_timeout => 300,\n }\n\n open(from_url, options) do |f|\n save_to_cache(f)\n end\n rescue SocketError,\n Errno::ECONNREFUSED,\n Errno::ECONNRESET,\n Errno::ENETUNREACH,\n Timeout::Error,\n OpenURI::HTTPError => e\n if retries != 0\n retries -= 1\n retry\n else\n raise Exceptions::NetworkError.new(from_url, e)\n end\n end\n end",
"def download(url)\n Net::HTTP.get_response(url)\n end",
"def get_single_url(url)\n\n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url \n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n begin \n res2 = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n end\n\n r = \"\"\n begin\n r = res2.body\n rescue OpenURI::HTTPError=>e\n case e.to_s \n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return r\n end",
"def download_url(hash)\n _get(\"/files/#{hash}/download_url\") { |json| json }\n end",
"def save_local_path(url)\n return nil if url.nil? || ! url.match(%{^http})\n tmp_file = \"/tmp/#{Digest::SHA1.hexdigest(url)}\"\n agent = Mechanize.new { |_agent| _agent.user_agent = WebStat::Configure.get[\"user_agent\"] }\n image = agent.get(url)\n File.open(tmp_file, \"w+b\") do |_file|\n if image.class == Mechanize::File\n _file.puts(image.body)\n elsif image.respond_to?(:body_io)\n _file.puts(image.body_io.read)\n end\n end\n tmp_file\n rescue\n false\n end",
"def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end",
"def save_images(mkd,path)\n regexp_img_links = /!\\[(.*?)\\]\\((.*?)\\)/\n img_dirname = File.basename(path)\n FileUtils.mkdir_p(path,{:mode => 0755})\n client = HTTPClient.new\n mkd.gsub!(regexp_img_links).with_index do |matched,i|\n #save image\n alttext = $1\n imgurl = $2\n $stdout.puts imgurl\n\n ext = File.extname(imgurl).match(/(.*?)(?:\\?.*)?$/)[1]\n filename = (\"%07\\d\" % i)+ext\n filename_fullpath = File.join(path,filename)\n begin\n data=client.get_content(imgurl)\n rescue\n # if we could not get image,we do not edit link.\n next \"\"\n end\n File.open(filename_fullpath,\"w\"){|file| file.write(data)}\n\n #fix the link\n \"})\"\n end\nend",
"def fetch_map_preview(latitude, longitude, zoom)\n tile = get_tile_number(latitude, longitude, zoom)\n api_url = \"http://tile.openstreetmap.org/#{zoom}/#{tile[:x]}/#{tile[:y]}.png\"\n file_name = \"#{latitude}_#{longitude}_#{zoom}.png\"\n File.new(file_name, File::CREAT)\n Down::NetHttp.download(api_url, destination: \"./#{file_name}\")\n\n file_name\nend",
"def down_image(src, dest)\n\turl = URI::parse(src)\n\treq = Net::HTTP::Get.new(url.path)\n\tNet::HTTP.start(url.host, url.port) { |http|\n\t\tresp = http.request( req )\n\t\tcreate_file(resp, dest)\t\t\t\n\t}\nend",
"def extract_image_url(tweet)\n link = extract_link tweet\n find_image_url link\n end",
"def download(from, to = from.split(\"/\").last)\n #run \"curl -s -L #{from} > #{to}\"\n file to, open(from).read\nrescue\n puts \"Can't get #{from} - Internet down?\"\n exit!\nend"
] | [
"0.723736",
"0.7030896",
"0.7027722",
"0.69912356",
"0.6897342",
"0.68823",
"0.6858112",
"0.6749199",
"0.6727789",
"0.6681844",
"0.66760135",
"0.6673684",
"0.66621995",
"0.6653859",
"0.66529506",
"0.6650706",
"0.6621601",
"0.6542539",
"0.65372795",
"0.6476612",
"0.6472112",
"0.6455546",
"0.6408249",
"0.63507885",
"0.63220644",
"0.62785643",
"0.6266331",
"0.6209632",
"0.62066376",
"0.6148039",
"0.6145221",
"0.61385274",
"0.6137976",
"0.6121563",
"0.6114807",
"0.60956",
"0.6087258",
"0.6075226",
"0.6055219",
"0.60541725",
"0.6051705",
"0.60420614",
"0.60205567",
"0.60153717",
"0.6013991",
"0.5987498",
"0.5982338",
"0.597318",
"0.59702384",
"0.5964546",
"0.5962779",
"0.5955558",
"0.59531796",
"0.5938595",
"0.5936392",
"0.5904483",
"0.59027857",
"0.59027857",
"0.58970094",
"0.5894108",
"0.5892098",
"0.5887967",
"0.5886189",
"0.58703595",
"0.5864146",
"0.58632815",
"0.5840461",
"0.5836077",
"0.58314043",
"0.5827064",
"0.58254117",
"0.5824998",
"0.5814829",
"0.5814308",
"0.58105963",
"0.5802514",
"0.57981604",
"0.57935864",
"0.57921624",
"0.57844996",
"0.57842964",
"0.57810134",
"0.57772976",
"0.57738066",
"0.57684356",
"0.57682085",
"0.57661295",
"0.5764329",
"0.5758789",
"0.5752963",
"0.5751646",
"0.57496375",
"0.5749068",
"0.57449615",
"0.57421225",
"0.5739476",
"0.5737633",
"0.5737491",
"0.57365805",
"0.5727387",
"0.57180893"
] | 0.0 | -1 |
Breaks out the given name (key in the provided hash) into first and last, to be compared to email parts | def determine_name_parts(name)
@first_name = name[0..name.index(" ")].strip.downcase
@last_name = name[name.index(" ")..name.length].strip.downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_in_name(thing)\n return unless thing.include?(\"@\")\n parts = thing.split(\" \")\n emails = parts.reject { |part| !part.include?(\"@\") }\n results = []\n Array(emails).each do |email|\n id = email.split('@')[0]\n results << (login_name(id) || results_hash(mail: [email]))\n end\n results\n end",
"def hashes email\n text_with_hashes = \"\"\n entries = Entry.select(:text).uniq.where(:email => email).where(\"text LIKE ?\", \"%#%\")\n entries.each do |e|\n text_with_hashes += \" \" + e.text\n end\n\n return text_with_hashes.split(' ').delete_if {|a| !a.match('^#\\w+$') }.sort.uniq\n end",
"def parser_email(line)\n if line.include? MailHeader.from\n fields=line.split(MailHeader.key_separator)\n if fields.length>1\n\t\t\t\tvalue=fields[1].split(\" \")\n if value.length>1\n firstname_lastname=value[0];\n email_address=value[1].gsub(/[<>]/,'')\n company_url=\"www.\"+email_address.split('@')[1];\n # if the email address is not contains the '@',the address is not correct\n unless email_address.include? \"@\"\n mail_header_output.firstname_lastname=MailHeader.unknown\n mail_header_output.flastname=MailHeader.unknown\n end\n mail_header_output.company_url=company_url\n check_firstname_lastname(email_address)\n check_flastname(email_address)\n check_email_name_conflict()\n end #end value.length\n end #end fields.length\n end #end line include\n end",
"def is_valid_email(str)\n# CRITERIA 1: @ symbol\n parts = str.split(\"@\") # get you an array of parts, before and after the @ symbol\n \n if parts.length != 2 # if output isn't two parts...\n return false # then return false (check for 3+ parts)\n end\n\n# CRITERIA 2: only lowercase alphanumeric letters used - need to reference the alphabet\n\n left = parts[0]\n right = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\n left.each_char do |char|\n if !alpha.include?(char) # if char not in alphabet\n return false\n end\n end\n\n if right.split(\".\").length == 2 # if there's exactly one dot, we should have an array of two\n return true # if array has length 2, return true, b/c means there are two parts\n else \n return false\n end\n\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 check = \"abcdefghijklmnopqrstuvwxyz\"\n first.each_char do |char|\n if !check.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 \nend",
"def test_hash_end_and_start\n\t\ttest_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\tassert_equal test_array2[1], test_array1[4]\n\tend",
"def is_valid_email(str)\n parts = str.split(\"@\")\n\n if parts.length != 2\n return false \n end \n\n left = parts[0]\n right = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\n left.each_char do |char|\n if !alpha.include?(char)\n return false \n end\n end\n\n if right.split(\".\").length == 2\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 split_hash(h)\n _, v, c, mash = h.split('$')\n return v.to_str, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str\n end",
"def new_email_from_existing(oldEmail)\n newEmail=\"\"\n_count\n oldEmail.split(\"\").each do |a|\n if(a == '@')\n newEmail+= @@unique_email_marker.to_s\n @@unique_email_marker+=1\n end\n newEmail+=a\n end\n newEmail\nend",
"def is_valid_email(str)\n parts = str.split(\"@\")\n if parts.length != 2\n return false\n end\n\n first_part = parts[0]\n sec_part = parts[1]\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n first_part.each_char do |char|\n if !alphabet.include?(char)\n return false\n end\n end\n\n if sec_part.split(\".\").length != 2\n return false\n end\n\n return true\nend",
"def extract_name(email)\n\t\t# Uses regular expressions to remove everything after the \"@ as well as any digits\"\n\t\temail.gsub(/@.*$/,'').gsub(/[0-9]+/,'')\n\tend",
"def convert_email\n %w[paul@kristoffs.com paul.kristoff@kristoffs.com retail@kristoffs.com justfaith@kristoffs.com financial@kristoffs.com]\n end",
"def create_unique_name_from_email\n return unless name.blank?\n self.name = email.to_s.split(\"@\").first&.gsub('.', '-')\n last_user = User.where(\"name LIKE ?\", \"#{name}%\").order(:name).last\n if last_user\n number = 2\n last_part = last_user.name.split('-').last\n number = last_part.to_i + 1 if last_part && last_part.to_i.to_s == last_part\n self.name = \"#{name}-#{number}\"\n end\n end",
"def extract_token_from_email(token_name)\n mail_body = last_email.to_s\n mail_body[/#{token_name.to_s}_token=([^\"\\n\\r]+)/, 1]\n end",
"def title_after_name(emailname)\n result = nil\n if emailname.count(',') > 0\n new_name = emailname.split(',')[0]\n result = email_for_name(new_name) if new_name.count(' ') > 0\n end\n result\n end",
"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 name\n \temail.split('@')[0]\n end",
"def from_email_obscured\n return \"\" if from_email.blank?\n\n sender_parts = from_email.split(\"@\")\n if sender_parts.size > 1\n person_name = sender_parts.first\n if person_name.length > 2\n return \"#{person_name[0..(person_name.length - 3)]}..@#{sender_parts.last}\"\n else\n return \"..@#{sender_parts.last}\"\n end\n end\n\n \"\"\n end",
"def is_valid_email(str)\n str_arr = str.split('@')\n return false if str_arr.length != 2\n \n first = str_arr[0]\n second = str_arr[1]\n if !(first[/[a-zA-Z]+/] == first)\n return false \n elsif second.split('.').length == 2\n return true\n else\n return false \n end\n\nend",
"def fake_name(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0].downcase \n\treal_last_name = real_full_name[1].downcase\n\talphabet = [\"a\",\"b\", \"c\", \"d\", \"e\",\"f\", \"g\", \"h\",\"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\n\twhile i < length_first\n\t\tif real_first_name[i] == \"z\"\n\t\t\tfake_first_name += \"a\"\n\t\telsif real_first_name[i] == \"a\" || real_first_name[i] ==\"e\" || \n\t\t\t real_first_name[i] == \"i\" || real_first_name[i] == \"o\" || \n\t\t\t real_first_name[i] == \"u\"\n\t\t\tfake_first_name += real_first_name[i] \n\t\telsif \n\t\t\tind = alphabet.index(real_first_name[i])\n\t\t\tfake_first_name += alphabet[ind+1]\n\t\tend \n\t\ti+=1\n\t\t#fake_first_name[0] = fake_first_name[0].upcase\n\tend \n\tfake_first_name\nend",
"def extract_name(full_address)\n full_address = full_address.strip\n name = full_address.split('<').first.strip\n if name.present? && name != full_address\n name\n end\n end",
"def get_full_name(hash)\n return hash[\"first\"] + \" \" + hash[\"last\"] + \", the \" + hash[\"title\"]\nend",
"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\nend",
"def is_valid_email(str)\n\n lowerLetters = \"abcdefghijklmnopqrstuvwxyz\"\n sections = str.split(\"@\")\n \n# check if more than 2 @'s or no @'s\n if sections.length != 2\n return false\n end\n \n# check if left is letters\n sections[0].each_char do |letter|\n if !lowerLetters.include?(letter)\n \treturn false\n end\n end\n \n \n if sections[1].split(\".\").length == 2\n return true\n else \n return false\n end\n \nend",
"def split_hash(h)\n b, v, c, mash = h.split('$')\n return v, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str\n end",
"def list_students\n #code here \n # First redo hash to list last name first\n # and format into array to get only name and email values\n s = []\n @students.each do |stu|\n \tn = ''\n stu.each do |k,v| \n # *** instead of this process stu[:name] & stu[:email] ***\n #puts \"**key = #{k}, value = #{v}\"\n if (k == :name) #want every other value (only names not emails)\n \tn = v.split(' ')\n tmp = n[0]\n n[0] = n[1]\n n[1] = tmp\n n = n.join(\" \")\n else\n #puts \"pushing #{n}, #{v}\"\n \t#s.push({name: n, email: v})\n \ts.push(n + \", \" + v)\n\t end\n end\n end\n\n #@students.reverse.sort_by {|n| n[:name] } #this sorts by 1st name given the original hash array\n return s.sort\nend",
"def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend",
"def spy_name_map(str)\n# reverse first and last name\n\t# str = str.downcase\n\tsplit_name = str.split(' ')\n\treverse_name = split_name.reverse\n\tspy_name = reverse_name.join(' ')\n\tstored_names = []\n\nletters = spy_name.split('')\ni = 0\n\n\tletters.map! { |letter| letter.next }\n\tspy_final = letters.join('')\n# if spy_final.include? '!'\nspy_final = spy_final.gsub!('!', ' ')\n\tstored_names << spy_final\n\tp spy_final\nend",
"def name_parts(namething, count)\n parts = namething.split(\" \")\n first_name_count = parts.count - count\n return nil if count < 1\n { given: parts.first(first_name_count).join(\" \"), family: parts.last(count).join(\" \") }\n end",
"def decode(email, full_name)\n email_initial, self.email_domain = email.downcase.split('@')\n self.name = full_name.downcase.split(' ')\n self.email_format = given_formats.select{ |f| f.call(name) == email_initial}\n end",
"def contact_email\n EMAILS[:contact].split(' ').last[1..-2] \n end",
"def extract_name_from_email_address(email_address)\n m_data = /^([a-z]+)\\.?[a-z]?\\.([a-z]+)@([a-z0-9\\.\\-]+)$/i.match(email_address)\n\n m_data.nil? ? nil : m_data.to_a\nend",
"def formatAuthName(auth)\n str = \"\"\n if auth.at(\"lname\") && auth.at(\"fname\")\n str = auth.at(\"lname\").text.strip + \", \" + auth.at(\"fname\").text.strip\n auth.at(\"mname\") and str += \" \" + auth.at(\"mname\").text.strip\n auth.at(\"suffix\") and str += \", \" + auth.at(\"suffix\").text.strip\n elsif auth.at(\"fname\")\n str = auth.at(\"fname\").text\n elsif auth.at(\"lname\")\n str = auth.at(\"lname\").text\n else\n puts \"Warning: can't figure out author #{auth}\"\n str = auth.text\n end\n return str\nend",
"def get_domain_name_from_email_address(email)\nemail.scan(/@(\\w+)/)[0].pop\nend",
"def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end",
"def check_email_name_conflict()\n mail_header_output.name_conflicts = mail_header_output.firstname_lastname && mail_header_output.flastname\n if (!mail_header_output.firstname_lastname && !mail_header_output.flastname)\n mail_header_output.correct_email_format=MailHeader.unknown\n end\n\tend",
"def email_from_name(name)\n email_name = name.tr(\" \", \".\").gsub(/\\.{2,}/, \".\")\n \"correspondence-staff-dev+#{email_name}@digital.justice.gov.uk\"\nend",
"def parse_name(name)\n words = name.path_to_name.strip.split(/\\s+/)\n first = words.shift\n { first: first, last: words.join('-') }\n end",
"def split_hash(h)\n n, v, r, salt, hash = h.split('$')\n return [n, v, r].join('$') + \"$\", salt, hash\n end",
"def extract_token_from_email(token_name)\n mail_body = last_email.body.to_s\n mail_body[/#{token_name.to_s}_token=([^\"]+)/, 1]\n end",
"def parse\n @email_parser = email_parser.scan(/\\w+@\\w+.\\w+/)\n @email_parser.uniq\n end",
"def get_full_name(hash)\n first = hash[\"first\"]\n last = hash[\"last\"]\n title = hash [\"title\"]\n \n print first + \" \" + last + \" \" + title\nend",
"def is_valid_email(str)\n # check 1: include? 1 @\n # check 2: include? 1 .\n # check 3: split into an array to check(if) downcase, . after @\n\nend",
"def parse_employee(employee)\n email = employee.gsub(/\\([^()]*?\\)/).to_a[0].gsub!(/[()]/, \"\")\n name = employee.gsub(/\\(.*\\)/, \"\").rstrip!\n {name: name, email: email}\nend",
"def parse\n # emails = email_parser.scan(/\\w+@\\w+.\\w+/).uniq\n @emails.scan(/\\w+@\\w+.\\w+/).uniq\n end",
"def guessFromEmail\n name = self.email[ /[^@]+/ ]\n return false if !name\n name = name.split( \".\" )\n\n self.fname = name[0].downcase\n self.lname = name[1].downcase || ''\n self.save\n end",
"def create_first_name_from_mailing_name\n\t\t# remove any salutations first\n\t\tbad_char_array = [\"Miss\", \"Ms.\", \"Mr.\", \"Mrs.\", \"Dr.\", \"MRS\"]\n\t\trows = @input_file.split(\"\\r\")\n\t\t# open the output file and add the \"write\" param\n\t\tnew_header = rows.first + \"\\tfirst_name\\n\" \n\t\t@output_file << new_header\n\t\trows.each do |line|\n\t\t\t# skip header row\n\t\t\tnext if rows.index(line) == 0\n\t\t\ttabs = line.split(\"\\t\")\n\n\t\t\tmailing_name = tabs[1]\n\t\t\t# remove any salutation and unnecessary quotes and remove spaces\n\t\t\tbad_char_array.each{|b| mailing_name = mailing_name.gsub(\"\\\"\", \"\").gsub(b, \"\").strip}\n\t\t\t# find first name in mailing name array by finding first word in string\n\t\t\tfirst_name = mailing_name.split(\" \").first\n\t\t\t# put first name at end of row array\n\t\t\ttabs << first_name\n\n\t\t\t# put file back together\n\t\t\tnew_row = tabs.join(\"\\t\")+\"\\n\"\n\t\t\t# inserting new rows into new output file\n\t\t\t@output_file << new_row\n\t\tend\n\t\t@output_file.close\n\t\tputs \"The file /\" + @output_filename + \" is ready\"\n\tend",
"def parse_name(email)\n email.scan(/From: \\\"(.*)\\\"/).flatten.first || email.scan(/From: (.*) \\</).flatten.first\n end",
"def formatAuthName(auth)\n str = \"\"\n fname, lname = auth.text_at(\"./fname\"), auth.text_at(\"./lname\")\n if lname && fname\n str = \"#{lname}, #{fname}\"\n mname, suffix = auth.text_at(\"./mname\"), auth.text_at(\"./suffix\")\n mname and str += \" #{mname}\"\n suffix and str += \", #{suffix}\"\n elsif fname\n str = fname\n elsif lname\n str = lname\n elsif auth.text_at(\"./email\") # special case\n str = auth.text_at(\"./email\")\n else\n str = auth.text.strip\n str.empty? and return nil # ignore all-empty author\n puts \"Warning: can't figure out author #{auth}\"\n end\n return str\nend",
"def get_domain_name_from_email_address(email)\n med = email[/[@].*[.]/]\n domain = med[1..-2]\nend",
"def parse_email(s)\n e = Mail::Address.new(s)\n (s == '' || e.address != s || e.local == e.address) ? nil : e\nend",
"def formatNameForCompare( name ) \n nameArr = formatNameFromString( name )\n\n firstName = nameArr[0]\n if ( firstName.size >= 8 ) then\n firstName = firstName[0-7]\n else\n sizeDiff = 8 - firstName.size\n firstName = firstName + \" \".times(sizeDiff)\n end\n\n middleInitial = nameArr[1][0]\n\n lastName = nameArr[2]\n if( lastName.size >= 8 ) then \n lastName = lastName[0-7]\n else \n sizeDiff = 8 - lastName.size\n lastName = lastName + \" \".times(sizeDiff)\n end\n formatName = [firstName, middleInitial, lastName]\n formatName\n end",
"def get_account_name email_addr\n account, other = email_addr.split '@'\n dovecot_accounts[account.downcase]\n end",
"def split_name_for_automatic_splitting\n temp = name\n if temp\n if temp.match /\\A[A-Z]{3}[a-z]/\n temp = temp[2..-1]\n end\n (temp && temp.split(/([A-Z]?[a-z]+)/).map(&:downcase) || []).reject do |part|\n part.size < 3\n end\n else\n []\n end\n end",
"def parse\n emails.split(/, | /).uniq\n end",
"def is_valid_email(str)\n str_arr=str.split(\"@\")\n str_arr1=str.split(\".\")\n if str_arr.length==2 && str_arr1.length==2 and str_arr[1]==str_arr[1].downcase && str_arr[1].include?(\"1234567890\")==false\n return true\n else\n return false\n end\n \n \n\nend",
"def mail_to_parts(mail)\n mail.parts.empty? ? [mail.to_s] : mail.parts.map { |part| part.to_s } \n end",
"def email_from_creator created_by\n names = created_by.split(' ')\n return \"#{names[1]}#{names[0]}\".downcase + \"@swansea.ac.uk\"\nend",
"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 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 obfuscate_email(email)\n return nil if email.blank?\n parts = email.split(\"@\")\n \n local_parts = parts[0].split(\"+\")\n local_first = local_parts[0][0]\n local_last = local_parts[0][-1]\n local_rest = local_parts[0][1..-2]\n local_rest.gsub!(/[a-zA-Z0-9]/,\"*\")\n\n local_part = [local_first,local_rest,local_last].join(\"\")\n \n local_part = [local_part,local_parts[1]].join(\"+\") unless local_parts[1].blank?\n\n domain_part = parts[1]\n\n return \"#{local_part}@#{domain_part}\"\n end",
"def get_full_name(hash)\n \"#{hash[\"first\"]} #{hash[\"last\"]}, the #{hash[\"title\"]}\"\nend",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n first.gsub! (/[^a-z]/i, \"\")\n last.gsub! (/[^a-z]/i, \"\")\n ((first.split(\" \").join[0]<<last).split(\" \").join.downcase)\n\nend",
"def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end",
"def is_valid_email(str)\n parts = str.split(\"@\")\n print parts\n puts\n\nend",
"def email_with_name\n if email\n %Q{\"#{first} #{last}\" <#{email}>}\n end\n end",
"def split_hash(h)\n n, v, r, salt, hash = h.split('$')\n [[n, v, r].join('$') + '$', salt, hash]\n end",
"def split_and_parse_key(key)\n key.split(/(?<!\\\\)\\./).reject(&:empty?).map do |key_part|\n case key_part\n when /^\\.\\$/ # For keys in the form of .$key\n key_part.gsub(/^\\./, '')\n when /\\A[-+]?[0-9]+\\z/\n key_part.to_i\n else\n key_part.gsub('\\\\', '')\n end\n end.reject { |k| k == '$body' }\n end",
"def canonicalize(address_line)\n address_line.gsub(/\"[^\"]+\"/, '') # Git rid of quoted part of \"Joe Smith, the third\" <joe@gmail.com> addresses\n .split(/[,;]+/) # Account for multiple addresses delimited by either comma or semicolon\n .map(&:strip) # Git rid of surrounding whitespace\n .map { |a| a.gsub(/.*<(.+)>$/, '\\1') } # Strip angle brackets and any leading friendly names that weren't quoted\n .join(',') # ...and join them back together with the Tahi standard email separator\n end",
"def format_name(first, last)\nif first.length<1 || last.length<1\n\tnil\nelse\n first = first.split.join\n last = last.split.join\n str = (first[0]+last).downcase.gsub(/[^0-9a-z]/i, '')\nend\nend",
"def employer_address_line(first_address, last_address)\n return if percentage_similarity(first_address, last_address) < 0.97\n\n (first_address.length > last_address.length) ? first_address : last_address\n end",
"def test_sort_email_by_family_member\n results = Task.sortByName(\"Bob\", \"Bob\", \"Mary\", \"Joe\", \"Lisa\", \"fakeemail1@gmail.com\", \"fakeemail2@gmail.com\", \"fakeemail3@gmail.com\", \"fakeemail4@gmail.com\")\n assert_equal(\"fakeemail1@gmail.com\", results)\n end",
"def format_name(first, last)\n return nil if first.empty? || last.empty?\n f = first.delete(\" \")\n l = last.delete(\" \")\n username = f[0]\n username << l\n user = username.downcase\n user.gsub(/[\\W]/, '') # this is meant to remove special characters, but it doesn't work!\nend",
"def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end",
"def first_name_same_first_and_last_letter\n first_name[0] == first_name[-1]\n end",
"def split_email_domain\n return self.email.split('@')[1]\n end",
"def username \n #The code below will return the users email however, the split will seperate the email based on the parameters entered into the brackets. The code below will split the email at the @ symbol, resulting in the email changing from example@example.com to example @ example.com. The [0] after the brackets is used to determine the index value of the email that should be displayed. When the email is split each section is provided with an index value, starting at 0. The first part of the email (example) will be given the index of 0. This will result in the code displaying example. The capitalize at the end of the statement is used to caplitalise the first letter of the email address.\n return self.email.split('@')[0].capitalize\n end",
"def getLongNameFromEntry(ent)\n pre_name = \"\"; hashNames = %w(name name2 name3)\n hashNames.each {|name|\n n = ent[\"#{name}\"]\n\n # Regexp.new options used below:\n # nil (default options: not case insensitive, extended, multiline, etc.)\n # 'n' - No encoding on the regexp\n regex = Regexp.new('\\377', nil, 'n')\n pre_name += n.gsub(regex, \"\").UnicodeToUtf8.gsub(/\\000/, \"\")\n }\n return pre_name\n end",
"def to_email(name) ; \"#{name.gsub(/ /, '.')}@smartergrades.com\".downcase ; end",
"def read_hash(gmail, my_hash)\n\n @my_hash = my_hash\n @gmail = gmail\n\n @my_hash.each do |key, value|\n unless value == \"\" && EmailAddress.valid?(value)\n content = body_content(key)\n send_email(@gmail, content, value)\n end\n end\nend",
"def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n end\n str.gsub!(/\\.\\-/, '-')\n str.gsub!(/[\\,\\.]/, ' ')\n str.gsub!(/ +/, ' ')\n str.strip!\n\n if (str =~ /^[^\\s][^\\s]+(\\s+[^\\s]|\\s+[^\\s]\\-[^\\s])+$/)\n new_toks = str.split(/\\s+/)\n new_order = new_toks[1...new_toks.length];\n new_order << new_toks[0]\n str = new_order.join(\" \")\n end\n return str\n end",
"def set_email_parts(email)\n #If instance of EmailObject already has a value for email, then we're setting\n #another with another email format, append them accordingly.\n if @email.nil?\n @email = email\n @first_local_part = email[0..email.index(\".\") - 1].strip.downcase\n @last_local_part = email[email.index(\".\") + 1..email.index(\"@\") - 1].strip.downcase\n @domain = email[email.index(\"@\") + 1..email.length].strip.downcase\n else\n @email = @email + \" or \" + email\n @first_local_part = @first_local_part + \",\" + email[0..email.index(\".\") - 1].strip.downcase\n @last_local_part = @last_local_part + \",\" + email[email.index(\".\") + 1..email.index(\"@\") - 1].strip.downcase\n @domain = email[email.index(\"@\") + 1..email.length].strip.downcase\n end\n end",
"def get_domain_name_from_email_address(email)\n index_no = email.index('@') + 1\n email[index_no...email.length - 4]\nend",
"def name_encryption(full_name)\n\nfull_name = full_name.split(' ').rotate.join(' ')\n# .split(' ') splits full_name into array [\"first\", \"last\"]\n# .rotate rotates the first and last name within the array. (Ex. [\"last\", \"first\"])\n# .join(' ') combines array into a string. (Ex. \"last first\")\n\ncode_name = full_name.split('').map{ |x| x = next_letter(x)}\n# .split('') splits the string \"last first\" into individual characters.\n# .map{ |x| x = next_letter(x)} uses the next_letter method on each character and saves the changes.\n\ncode_name = code_name.join('')\n# .join('') combines individual characters into a\n\nend",
"def parse\n emails = @email_list.scan(/\\w+@\\w+.\\w+/)\n emails.uniq\n end",
"def format_name(first, last)\n if first == \"\" || last == \"\"\n return nil\n end\n new_first = first.gsub(/\\W+/,\"\")\n new_last = last.gsub(/\\W+/,\"\")\n username = new_first[0] + new_last\n username = username.downcase.gsub(/\\d/,\"\")\n\nend",
"def meeting(s)\n new_arr = []\n names_arr = s.split(\";\").map { |full_name| full_name.scan(/(\\w.+):(\\w.+)/) }\n names_arr.each {|i| new_arr << [i[0][1].upcase, i[0][0].upcase] }\n sorted = new_arr.sort\n str = \"\"\n sorted.each do |ele|\n str << \"(#{ele[0]}, #{ele[1]})\"\n end\n p str\nend",
"def email_parser(str) \n str.gsub(/, /,\" \").gsub(/,/,\" \").split.uniq\nend",
"def next_letter(full_name)\r\n\tidx = 0\r\n\twhile idx < full_name.length\r\n\t\tname = full_name.split('')\r\n\t\tname.map! { |letter| letter.next unless (letter.next == \"!\") }\r\n\t\tidx += 1\r\n\tend\r\n\tname\r\nend",
"def extract_name_by_multi_name\n name = ''\n names_arr = []\n @text.scan(/(Family|FAMILY|family|First|first|FIRST|Given|GIVEN|given|LAST|Last|last){1}[\\s|\\W]{0,}(name|Name|NAME){1}([\\:|\\s|\\,|\\W]{1,})+([A-Z]{1}[A-Za-z]+)/) do | track |\n names_arr << track\n end \n if names_arr.size == 2\n name = names_arr[0][-1] + names_arr[1][-1]\n end\n return name \n end",
"def email(text_array)\n email = nil\n text_array.each do |t|\n if t.match(/.{1,}[@].{1,}[.].{1,}/)\n email = t\n end\n end\n return email\nend",
"def get_namecoin_name\n return @chunks[-10] if is_name_firstupdate?\n return @chunks[-9] if is_name_update?\n end",
"def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n end\n str.gsub!(/\\.\\-/, '-')\n str.gsub!(/[\\,\\.]/, ' ')\n str.gsub!(/ +/, ' ')\n str.strip!\n\n if (str =~ /^[^\\s][^\\s]+(\\s+[^\\s]|\\s+[^\\s]\\-[^\\s])+$/)\n new_toks = str.split(/\\s+/)\n new_order = new_toks[1...new_toks.length];\n new_order << new_toks[0]\n str = new_order.join(\" \")\n end\n\n str.gsub!(/^[^A-Za-z0-9]+/, '')\n str.gsub!(/[^A-Za-z0-9]+$/, '')\n return str\n end",
"def email(name: T.unsafe(nil), separators: T.unsafe(nil), domain: T.unsafe(nil)); end",
"def normalize_name\n lower = @name.downcase\n non_word = lower.gsub(/\\W/,'_').gsub(/_+/,'_')\n normalized = non_word.split('_').compact.join('_')\n [normalized, Digest::SHA1.hexdigest(@name)[0..10]].join('_')\n end",
"def parse_cust_name\n @name_parsed = true\n\n @cust_tl = ''\n @cust_fs = ''\n @cust_ls = ''\n\n\n temp = subject_cname\n temp = body_cname if temp == nil\n temp = '' if temp == nil\n\n temp.gsub!(/^.*:/, '') # remove RE: FW: etc\n\n res = Customer.split_name(temp)\n\n @cust_tl = res[0]\n @cust_fs = res[1]\n @cust_ls = res[2]\n end",
"def clean_name\n return name.split(':').pop\n end",
"def name_swap\n\tuser_name = first_last.split(' ')\n\nend",
"def check_firstname_lastname(emailAddress)\n\t\tfirstname_lastname_regex=/^([_a-z0-9-]+)*\\.([a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/\n if firstname_lastname_regex.match(emailAddress) !=nil\n mail_header_output.firstname_lastname = true;\n mail_header_output.correct_email_format=\"firstname.lastname\"\n end\n\tend"
] | [
"0.68803895",
"0.60028666",
"0.5841405",
"0.58245814",
"0.5779989",
"0.57155174",
"0.56763613",
"0.55923903",
"0.5555105",
"0.55503273",
"0.55173415",
"0.5493623",
"0.5477868",
"0.5423242",
"0.5420122",
"0.5419688",
"0.5414454",
"0.5413704",
"0.5408585",
"0.5391888",
"0.53767276",
"0.535834",
"0.53541005",
"0.53532183",
"0.5350961",
"0.5350897",
"0.53441024",
"0.534097",
"0.53254664",
"0.5321291",
"0.5316276",
"0.53134185",
"0.5311857",
"0.5310517",
"0.53012526",
"0.5289994",
"0.5280628",
"0.5265434",
"0.5259272",
"0.5257446",
"0.5224827",
"0.5208774",
"0.52084005",
"0.5196491",
"0.51954454",
"0.5190572",
"0.51762885",
"0.51616627",
"0.51491433",
"0.5143782",
"0.5133569",
"0.5127115",
"0.5124597",
"0.51106006",
"0.51019305",
"0.510174",
"0.5099439",
"0.50923926",
"0.5087565",
"0.50862986",
"0.5083948",
"0.50717014",
"0.5070217",
"0.50701576",
"0.50679576",
"0.506146",
"0.50588816",
"0.5057037",
"0.5052307",
"0.5051965",
"0.504197",
"0.5031681",
"0.5026622",
"0.50214124",
"0.5018386",
"0.50173986",
"0.50167996",
"0.500654",
"0.5006265",
"0.49976286",
"0.49921218",
"0.49830216",
"0.49801496",
"0.49771246",
"0.49733073",
"0.49703884",
"0.4969822",
"0.4965038",
"0.49527305",
"0.4951267",
"0.49484938",
"0.49414393",
"0.49388158",
"0.4937255",
"0.49246973",
"0.49230683",
"0.4919579",
"0.49166963",
"0.4914566",
"0.49121362"
] | 0.563035 | 7 |
Breaks out email parts similarly to be compared to first and last names above to determine email format later | def set_email_parts(email)
#If instance of EmailObject already has a value for email, then we're setting
#another with another email format, append them accordingly.
if @email.nil?
@email = email
@first_local_part = email[0..email.index(".") - 1].strip.downcase
@last_local_part = email[email.index(".") + 1..email.index("@") - 1].strip.downcase
@domain = email[email.index("@") + 1..email.length].strip.downcase
else
@email = @email + " or " + email
@first_local_part = @first_local_part + "," + email[0..email.index(".") - 1].strip.downcase
@last_local_part = @last_local_part + "," + email[email.index(".") + 1..email.index("@") - 1].strip.downcase
@domain = email[email.index("@") + 1..email.length].strip.downcase
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser_email(line)\n if line.include? MailHeader.from\n fields=line.split(MailHeader.key_separator)\n if fields.length>1\n\t\t\t\tvalue=fields[1].split(\" \")\n if value.length>1\n firstname_lastname=value[0];\n email_address=value[1].gsub(/[<>]/,'')\n company_url=\"www.\"+email_address.split('@')[1];\n # if the email address is not contains the '@',the address is not correct\n unless email_address.include? \"@\"\n mail_header_output.firstname_lastname=MailHeader.unknown\n mail_header_output.flastname=MailHeader.unknown\n end\n mail_header_output.company_url=company_url\n check_firstname_lastname(email_address)\n check_flastname(email_address)\n check_email_name_conflict()\n end #end value.length\n end #end fields.length\n end #end line include\n end",
"def from_email_obscured\n return \"\" if from_email.blank?\n\n sender_parts = from_email.split(\"@\")\n if sender_parts.size > 1\n person_name = sender_parts.first\n if person_name.length > 2\n return \"#{person_name[0..(person_name.length - 3)]}..@#{sender_parts.last}\"\n else\n return \"..@#{sender_parts.last}\"\n end\n end\n\n \"\"\n end",
"def is_valid_email(str)\n# CRITERIA 1: @ symbol\n parts = str.split(\"@\") # get you an array of parts, before and after the @ symbol\n \n if parts.length != 2 # if output isn't two parts...\n return false # then return false (check for 3+ parts)\n end\n\n# CRITERIA 2: only lowercase alphanumeric letters used - need to reference the alphabet\n\n left = parts[0]\n right = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\n left.each_char do |char|\n if !alpha.include?(char) # if char not in alphabet\n return false\n end\n end\n\n if right.split(\".\").length == 2 # if there's exactly one dot, we should have an array of two\n return true # if array has length 2, return true, b/c means there are two parts\n else \n return false\n end\n\nend",
"def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end",
"def convert_email\n %w[paul@kristoffs.com paul.kristoff@kristoffs.com retail@kristoffs.com justfaith@kristoffs.com financial@kristoffs.com]\n end",
"def email_in_name(thing)\n return unless thing.include?(\"@\")\n parts = thing.split(\" \")\n emails = parts.reject { |part| !part.include?(\"@\") }\n results = []\n Array(emails).each do |email|\n id = email.split('@')[0]\n results << (login_name(id) || results_hash(mail: [email]))\n end\n results\n end",
"def parse\n # emails = email_parser.scan(/\\w+@\\w+.\\w+/).uniq\n @emails.scan(/\\w+@\\w+.\\w+/).uniq\n end",
"def format_email\n email.downcase!.strip!\n end",
"def parse\n @email_parser = email_parser.scan(/\\w+@\\w+.\\w+/)\n @email_parser.uniq\n end",
"def email(text_array)\n email = nil\n text_array.each do |t|\n if t.match(/.{1,}[@].{1,}[.].{1,}/)\n email = t\n end\n end\n return email\nend",
"def test_parser_handles_leading_restricted_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, \",#{valid_from_name}\"\n email_text_assert valid_from_name, \", #{valid_from_name}\"\n email_text_assert valid_from_name, \",, #{valid_from_name}\"\n email_text_assert valid_from_name, \", , #{valid_from_name}\"\n email_text_assert valid_from_name, \"<#{valid_from_name}\"\n email_text_assert valid_from_name, \"< #{valid_from_name}\"\n email_text_assert valid_from_name, \"<< #{valid_from_name}\"\n email_text_assert valid_from_name, \"< < #{valid_from_name}\"\n email_text_assert valid_from_name, \">#{valid_from_name}\"\n email_text_assert valid_from_name, \"> #{valid_from_name}\"\n email_text_assert valid_from_name, \">> #{valid_from_name}\"\n email_text_assert valid_from_name, \"> > #{valid_from_name}\"\n email_text_assert valid_from_name, \",<<>>,#{valid_from_name}\"\n email_text_assert valid_from_name, \",<<>>, #{valid_from_name}\"\n end",
"def parse\n emails.split(/, | /).uniq\n end",
"def emails\n email.split(/[, ]/)\n end",
"def is_valid_email(str)\n\n lowerLetters = \"abcdefghijklmnopqrstuvwxyz\"\n sections = str.split(\"@\")\n \n# check if more than 2 @'s or no @'s\n if sections.length != 2\n return false\n end\n \n# check if left is letters\n sections[0].each_char do |letter|\n if !lowerLetters.include?(letter)\n \treturn false\n end\n end\n \n \n if sections[1].split(\".\").length == 2\n return true\n else \n return false\n end\n \nend",
"def mail_to_parts(mail)\n mail.parts.empty? ? [mail.to_s] : mail.parts.map { |part| part.to_s } \n end",
"def check_firstname_lastname(emailAddress)\n\t\tfirstname_lastname_regex=/^([_a-z0-9-]+)*\\.([a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/\n if firstname_lastname_regex.match(emailAddress) !=nil\n mail_header_output.firstname_lastname = true;\n mail_header_output.correct_email_format=\"firstname.lastname\"\n end\n\tend",
"def test_parser_handles_trailing_restricted_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, \"#{valid_from_name},\"\n email_text_assert valid_from_name, \"#{valid_from_name} ,\"\n email_text_assert valid_from_name, \"#{valid_from_name} ,\"\n email_text_assert valid_from_name, \"#{valid_from_name} , ,\"\n email_text_assert valid_from_name, \"#{valid_from_name}<\"\n email_text_assert valid_from_name, \"#{valid_from_name} <\"\n email_text_assert valid_from_name, \"#{valid_from_name} <<\"\n email_text_assert valid_from_name, \"#{valid_from_name} < <\"\n email_text_assert valid_from_name, \"#{valid_from_name}>\"\n email_text_assert valid_from_name, \"#{valid_from_name} >\"\n email_text_assert valid_from_name, \"#{valid_from_name} >>\"\n email_text_assert valid_from_name, \"#{valid_from_name} > >\"\n email_text_assert valid_from_name, \"#{valid_from_name},<<>>,\"\n email_text_assert valid_from_name, \"#{valid_from_name} ,<<>>,\"\n end",
"def test_parser_handles_surrounding_restricted_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, \",#{valid_from_name},\"\n email_text_assert valid_from_name, \", #{valid_from_name} ,\"\n email_text_assert valid_from_name, \",, #{valid_from_name} ,,\"\n email_text_assert valid_from_name, \", , #{valid_from_name} , ,\"\n email_text_assert valid_from_name, \"<#{valid_from_name}<\"\n email_text_assert valid_from_name, \"< #{valid_from_name} <\"\n email_text_assert valid_from_name, \"<< #{valid_from_name} <<\"\n email_text_assert valid_from_name, \"< < #{valid_from_name} < <\"\n email_text_assert valid_from_name, \">#{valid_from_name}>\"\n email_text_assert valid_from_name, \"> #{valid_from_name} >\"\n email_text_assert valid_from_name, \">> #{valid_from_name} >>\"\n email_text_assert valid_from_name, \"> > #{valid_from_name} > >\"\n email_text_assert valid_from_name, \",<<>>,#{valid_from_name},<<>>,\"\n email_text_assert valid_from_name, \",<<>>, #{valid_from_name} ,<<>>,\"\n end",
"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 parse_email_address(emails,check_for_shared_netids=nil)\n emails = check_for_shared_netid(emails,1) if check_for_shared_netids\n emails = emails.split(\"|\") if emails =~ /|/\n if emails.class.to_s == \"String\"\n parsed_emails = emails + \"@\" + @configuration[:domain] if emails !~ /@/\n elsif emails.class.to_s == \"Array\"\n # this is ugly\n emails_string = \"\"\n emails.each do |address|\n address = address + \"@\" + @configuration[:domain] if address !~ /@/\n emails_string += \"#{address}, \"\n end\n emails_string.chomp(\", \")\n end\n end",
"def parse_email(s)\n e = Mail::Address.new(s)\n (s == '' || e.address != s || e.local == e.address) ? nil : e\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 check = \"abcdefghijklmnopqrstuvwxyz\"\n first.each_char do |char|\n if !check.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 \nend",
"def is_valid_email(str)\n parts = str.split(\"@\")\n\n if parts.length != 2\n return false \n end \n\n left = parts[0]\n right = parts[1]\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n\n left.each_char do |char|\n if !alpha.include?(char)\n return false \n end\n end\n\n if right.split(\".\").length == 2\n return true\n else \n return false \n end \nend",
"def decode(email, full_name)\n email_initial, self.email_domain = email.downcase.split('@')\n self.name = full_name.downcase.split(' ')\n self.email_format = given_formats.select{ |f| f.call(name) == email_initial}\n end",
"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 is_valid_email(str)\n # check 1: include? 1 @\n # check 2: include? 1 .\n # check 3: split into an array to check(if) downcase, . after @\n\nend",
"def email_parser(str) \n str.gsub(/, /,\" \").gsub(/,/,\" \").split.uniq\nend",
"def check_email_name_conflict()\n mail_header_output.name_conflicts = mail_header_output.firstname_lastname && mail_header_output.flastname\n if (!mail_header_output.firstname_lastname && !mail_header_output.flastname)\n mail_header_output.correct_email_format=MailHeader.unknown\n end\n\tend",
"def split_email_at_reply(text)\n text.split(/(-----Original Message-----|Sent from my iPhone|Sent from my BlackBerry|On\\s.+?\\n?.+?wrote:|________________________________)/, 2)\n end",
"def parse\n @emails.split(/[,\\s]+/).uniq\n end",
"def test_parser_handles_seeded_restricted_email_text\n from_name = 'From Name'\n\n email_text_assert from_name, 'From> Name'\n email_text_assert from_name, 'Fr<>om Na<>me'\n email_text_assert EmailAddress.new('From', 'Name'), 'From< Name'\n email_text_assert EmailAddress.new('From Na', 'me'), 'Fr>om Na<me'\n email_text_assert EmailAddress.new('Frme', 'om Na'), 'Fr<om Na>me'\n email_text_assert EmailAddress.new('Frme', 'om Na'), 'Fr<<om Na>>me'\n email_text_assert EmailAddress.new('From Na', 'me'), 'Fr>>om Na<<me'\n email_text_assert EmailAddress.new('Fm Name', 'ro'), 'F<ro>m Name'\n end",
"def check_flastname(emailAddress)\n\t\tflastname_regex=/^[_a-z0-9-]*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/\n if flastname_regex.match(emailAddress) !=nil\n mail_header_output.flastname = true;\n mail_header_output.correct_email_format=\"flastname\"\n end\n\tend",
"def parse\n emails = @email_list.scan(/\\w+@\\w+.\\w+/)\n emails.uniq\n end",
"def is_valid_email(str)\n parts = str.split(\"@\")\n if parts.length != 2\n return false\n end\n\n first_part = parts[0]\n sec_part = parts[1]\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n first_part.each_char do |char|\n if !alphabet.include?(char)\n return false\n end\n end\n\n if sec_part.split(\".\").length != 2\n return false\n end\n\n return true\nend",
"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 str_arr = str.split('@')\n return false if str_arr.length != 2\n \n first = str_arr[0]\n second = str_arr[1]\n if !(first[/[a-zA-Z]+/] == first)\n return false \n elsif second.split('.').length == 2\n return true\n else\n return false \n end\n\nend",
"def is_valid_email(str)\n str_arr=str.split(\"@\")\n str_arr1=str.split(\".\")\n if str_arr.length==2 && str_arr1.length==2 and str_arr[1]==str_arr[1].downcase && str_arr[1].include?(\"1234567890\")==false\n return true\n else\n return false\n end\n \n \n\nend",
"def new_email_from_existing(oldEmail)\n newEmail=\"\"\n_count\n oldEmail.split(\"\").each do |a|\n if(a == '@')\n newEmail+= @@unique_email_marker.to_s\n @@unique_email_marker+=1\n end\n newEmail+=a\n end\n newEmail\nend",
"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\nend",
"def parse_recipients(addresses)\n list_addresses = addresses.gsub(/[\\r\\n]+/, '').gsub(/(@((?:[-a-z0-9]+\\.)+[a-z]{2,})(\\>)?)\\,/i, '\\1'+\"\\n\")\n list_addresses.split(\"\\n\").map{|full_address|\n {'name' => extract_name(full_address), 'email' => extract_email_address(full_address)}\n }\n end",
"def contact_email\n EMAILS[:contact].split(' ').last[1..-2] \n end",
"def test_parser_handles_misc_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, valid_from_name\n end",
"def guessFromEmail\n name = self.email[ /[^@]+/ ]\n return false if !name\n name = name.split( \".\" )\n\n self.fname = name[0].downcase\n self.lname = name[1].downcase || ''\n self.save\n end",
"def is_valid_email(str)\n parts = str.split(\"@\")\n print parts\n puts\n\nend",
"def partial_email\n @partial_email ||=\n begin\n uid,_,domain = email.partition('@')\n if uid.length < 4\n uid = '*' * uid.length\n elsif uid.length < 8\n uid = uid[0..2] + ('*' * (uid.length - 3))\n else\n uid = uid[0..2] + ('*' * (uid.length - 6)) + uid[-3..-1]\n end\n \"#{uid}@#{domain}\"\n end\n end",
"def email_from_name(name)\n email_name = name.tr(\" \", \".\").gsub(/\\.{2,}/, \".\")\n \"correspondence-staff-dev+#{email_name}@digital.justice.gov.uk\"\nend",
"def parse_mail(mail)\n\n @mail = mail\n\n unless mail.date.nil?\n self.sent_at = mail.date.strftime('%Y-%m-%d %H:%M:%S')\n end\n\n unless mail.from.nil?\n begin\n addrs = mail[:from].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.from_address = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.from_address = mail.from.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.to.nil?\n begin\n addrs = mail[:to].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.to_addresses = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.to_addresses = mail.to.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.cc.nil?\n begin\n addrs = mail[:cc].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.cc_addresses = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.cc_addresses = mail.cc.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.bcc.nil?\n begin\n addrs = mail[:bcc].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.bcc_addresses = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.bcc_addresses = mail.bcc.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n unless mail.reply_to.nil?\n begin\n addrs = mail[:reply_to].to_s\n addrs = EmailsHelper.split_preserving_quot(addrs, '\"', ',')\n self.reply_to = addrs.join(Email::ADDRESS_SEPARATOR)\n rescue\n self.reply_to = mail.reply_to.join(Email::ADDRESS_SEPARATOR)\n end\n end\n\n self.subject = mail.subject\n\n # Email Body ###\n plain_part = (@mail.multipart?) ? ((@mail.text_part) ? @mail.text_part : nil) : nil\n html_part = (@mail.html_part) ? @mail.html_part : nil\n message_part = (plain_part || html_part)\n message_part ||= @mail unless @mail.multipart?\n\n if message_part.nil?\n self.message = ''\n else\n charset = @mail.header.charset\n charset = nil if !charset.nil? and (charset.casecmp('US-ASCII') == 0)\n\n charset ||= message_part.header.charset\n charset = nil if !charset.nil? and (charset.casecmp('US-ASCII') == 0)\n\n message = message_part.body.decoded\n unless charset.nil? or charset.empty?\n message.encode!(Encoding::UTF_8, charset, {:invalid => :replace, :undef => :replace, :replace => ' '})\n end\n self.message = message\n end\n end",
"def split_email_domain\n return self.email.split('@')[1]\n end",
"def test_parser_handles_proper_email_text\n name = 'From Name'\n email = 'from@name.com'\n\n email_text_assert EmailAddress.new(name, email), \"#{name} <#{email}>\"\n email_text_assert EmailAddress.new(name, email), \"#{name}<#{email}>\"\n email_text_assert EmailAddress.new(name, email), \"<#{email}> #{name}\"\n email_text_assert EmailAddress.new(name, email), \"<#{email}>#{name}\"\n\n email_text_assert EmailAddress.new(email, name), \"#{email} <#{name}>\"\n email_text_assert EmailAddress.new(email, name), \"#{email}<#{name}>\"\n email_text_assert EmailAddress.new(email, name), \"<#{name}> #{email}\"\n email_text_assert EmailAddress.new(email, name), \"<#{name}>#{email}\"\n end",
"def email_with_name\n if email\n %Q{\"#{first} #{last}\" <#{email}>}\n end\n end",
"def process\n parsed = {}\n parsed[:contents] = \"#{@email.subject} ::: #{@email.body}\"\n parsed[:from] = \"#{@email.from[:email]}\"\n #[:to] is an array of hashes, since possible multiple to's\n parsed[:to] = \"#{@email.to[0][:email]}\"\n\n email_of_interest = parsed[:to]\n if !(/@/.match(parsed[:to]))\n Rails.logger.warn \"Poorly formatted email! parsed: #{parsed}\"\n end\n\n object = Person.react_to_email(email_of_interest)\n if object.class.to_s == \"Person\"\n Communication.create(person_id: object.id,\n contents: parsed[:contents],\n medium: \"email\",\n when: Date.today)\n end\n end",
"def extract_name(email)\n\t\t# Uses regular expressions to remove everything after the \"@ as well as any digits\"\n\t\temail.gsub(/@.*$/,'').gsub(/[0-9]+/,'')\n\tend",
"def normalize_email(email)\n raise \"E-mail address is blank\" if email.blank?\n raise \"Invalid e-mail address\" unless Authentication.email_regex =~ email\n email.strip\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 parse_name(email)\n email.scan(/From: \\\"(.*)\\\"/).flatten.first || email.scan(/From: (.*) \\</).flatten.first\n end",
"def email_from_creator created_by\n names = created_by.split(' ')\n return \"#{names[1]}#{names[0]}\".downcase + \"@swansea.ac.uk\"\nend",
"def create_first_name_from_mailing_name\n\t\t# remove any salutations first\n\t\tbad_char_array = [\"Miss\", \"Ms.\", \"Mr.\", \"Mrs.\", \"Dr.\", \"MRS\"]\n\t\trows = @input_file.split(\"\\r\")\n\t\t# open the output file and add the \"write\" param\n\t\tnew_header = rows.first + \"\\tfirst_name\\n\" \n\t\t@output_file << new_header\n\t\trows.each do |line|\n\t\t\t# skip header row\n\t\t\tnext if rows.index(line) == 0\n\t\t\ttabs = line.split(\"\\t\")\n\n\t\t\tmailing_name = tabs[1]\n\t\t\t# remove any salutation and unnecessary quotes and remove spaces\n\t\t\tbad_char_array.each{|b| mailing_name = mailing_name.gsub(\"\\\"\", \"\").gsub(b, \"\").strip}\n\t\t\t# find first name in mailing name array by finding first word in string\n\t\t\tfirst_name = mailing_name.split(\" \").first\n\t\t\t# put first name at end of row array\n\t\t\ttabs << first_name\n\n\t\t\t# put file back together\n\t\t\tnew_row = tabs.join(\"\\t\")+\"\\n\"\n\t\t\t# inserting new rows into new output file\n\t\t\t@output_file << new_row\n\t\tend\n\t\t@output_file.close\n\t\tputs \"The file /\" + @output_filename + \" is ready\"\n\tend",
"def original_email(email)\n if email.match(/\\[\\w+-\\d+\\]/)\n email.sub(/\\[\\w+-\\d+\\]/, '')\n else\n email\n end\n end",
"def normalize\n @normalized_email = email.downcase\n normalized_email\n end",
"def parse \n #splits using regex\n #regex => comma space or space\n email_arr = @emails.split(/,\\s|\\s/)\n print email_arr\n #use set intersection with itself to remove dups\n (email_arr & email_arr)\n\n end",
"def canonicalize(address_line)\n address_line.gsub(/\"[^\"]+\"/, '') # Git rid of quoted part of \"Joe Smith, the third\" <joe@gmail.com> addresses\n .split(/[,;]+/) # Account for multiple addresses delimited by either comma or semicolon\n .map(&:strip) # Git rid of surrounding whitespace\n .map { |a| a.gsub(/.*<(.+)>$/, '\\1') } # Strip angle brackets and any leading friendly names that weren't quoted\n .join(',') # ...and join them back together with the Tahi standard email separator\n end",
"def email(name: T.unsafe(nil), separators: T.unsafe(nil), domain: T.unsafe(nil)); end",
"def normalize_email_address email_address\n email_address.downcase.sub(/swan\\.ac\\.uk/,'swansea.ac.uk')\nend",
"def get_domain_name_from_email_address(email)\nemail.scan(/@(\\w+)/)[0].pop\nend",
"def name_and_email\n email_address = Notifier.unprettify(self.email)\n self.name.blank? ? email_address : \"\\\"#{self.name}\\\" <#{email_address}>\"\n end",
"def email_list\n @entries.collect do |line|\n name, email = line.split(\",\")\n format_email_address name, email.chomp\n end.join(\", \")\n end",
"def recipients_from_string(emails_str)\n rec_strs = emails_str.to_s.split(/[\\;\\,]+/)\n rec_strs.map! do |rs|\n ValidateEmail.valid?(rs.strip) ? rs.strip : nil\n end\n rec_strs.compact!\n rec_strs.length == 1 ? rec_strs[0] : rec_strs\n end",
"def test_parser_handles_single_delim_with_text_email_array\n text = 'To Name'\n delim = ApiParser.email_delim\n\n email_array_assert [text, text], \"#{text}#{delim}#{text}\"\n end",
"def format_email_user_info(body, user)\n body.gsub!(/\\%name/,user.fullname)\n body.gsub!(/\\%email/,user.email)\n body.gsub!(/\\%phone/,user.phone)\n body.gsub!(/\\%program/,user.program)\n body.gsub!(/\\%school/,user.school)\n body.gsub!(/\\%status/,user.status)\n suggestion = Suggestion.where(:username => user.username).order(\"created_at\").last\n unless suggestion.nil?\n body.gsub!(/\\%suggestion/, suggestion.suggestion)\n end\n return body\n end",
"def extract_name_from_email_address(email_address)\n m_data = /^([a-z]+)\\.?[a-z]?\\.([a-z]+)@([a-z0-9\\.\\-]+)$/i.match(email_address)\n\n m_data.nil? ? nil : m_data.to_a\nend",
"def get_domain_name_from_email_address(email)\n med = email[/[@].*[.]/]\n domain = med[1..-2]\nend",
"def parse\n csv_emails.split(/,?\\s/).uniq\n end",
"def compose_email_details()\n\t email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n if !@email.cc.nil?\n email_details << \"Cc: \" + @email[:cc].formatted.join(', ') + \"\\n\"\n end\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details << \"Subject: \" + @email[:subject].to_s + \"\\n\"\n email_details = \"bq. \" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"\\n\"\n email_details\n end",
"def to_email(name) ; \"#{name.gsub(/ /, '.')}@smartergrades.com\".downcase ; end",
"def check_format\n @@email_regex = /^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\\-+)|([A-Za-z0-9]+\\.+)|([A-Za-z0-9]+\\++))*[A-Za-z0-9]+@((\\w+\\-+)|(\\w+\\.))*\\w{1,63}\\.[a-zA-Z]{2,6}$/i\n res=(@address =~ @@email_regex)\n #puts \" res is #{res}\"\n if res\n [true,\"format ok\"]\n else\n [false,\"format failed\"]\n end\n end",
"def sender_email_to_title_and_name\n known_emails = [Notifier.help_email, Notifier.search_filter_email, Notifier.message_email, Notifier.signup_email,\n Notifier.newsletter_email, Notifier.admin_email, Notifier.contact_email, Notifier.info_email,\n Notifier.feedback_email, Notifier.press_email].map {|m| Notifier.unprettify(m)}\n if known_emails.include?(self.sender_email)\n \"kann-ich-klagen.de\"\n elsif ps = Person.find_by_email(self.sender_email)\n ps.title_and_name\n else\n self.sender_email\n end\n end",
"def getEmailList()\n emailListFile = File.dirname(File.dirname(__FILE__)) + \"/config/\" +\n \"email_recepients.txt\"\n lines = IO.readlines(emailListFile)\n\n lines.each do |line|\n if line.match(/^EMAIL_RESULTS/)\n temp = line.gsub(/EMAIL_RESULTS=/, \"\")\n temp.strip!\n @resultRecepients = temp.split(\",\")\n elsif line.match(/^EMAIL_ERRORS/)\n temp = line.gsub(/EMAIL_ERRORS=/, \"\")\n temp.strip!\n @errorRecepients = temp.split(\",\") \n elsif line.match(/^EMAIL_CAPTURE/)\n temp = line.gsub(/EMAIL_CAPTURE=/, \"\")\n temp.strip!\n @captureRecepients = temp.split(\",\") \n end\n end\n end",
"def normalize_fields\n\t\tself.email.downcase!\n\tend",
"def determine_email\n return email[-7..-1] == \"uga.edu\" # this should be a constant\n end",
"def parse_mail_from( data )\n mailfrom, esmtp_info = data.split(\"\\0\", 2 )\n return [mailfrom, esmtp_info.split(\"\\0\")]\n end",
"def emails_full\n format_entities('gd$email')\n end",
"def email(email, direction = :push)\n if direction == :push\n # any whitespace will cause netsuite to throw a fatal error\n email = email.gsub(' ', '')\n\n # TODO consider throwing an exception instead of returning nil?\n # netsuite will throw a fatal error if a valid email address is not sent\n # http://stackoverflow.com/questions/742451/what-is-the-simplest-regular-expression-to-validate-emails-to-not-accept-them-bl\n if email !~ /.+@.+\\..+/\n return nil\n end\n\n email = email.\n # an error will be thrown if period is on the end of a sentence\n gsub(/[^A-Za-z]+$/, '').\n # any commas in the email with throw an error\n gsub(',', '').\n # double periods anywhere in the email cause issues\n gsub('..', '.').\n # a period before the @ seems to cause issues\n gsub('.@', '@').\n # backslashes in an email cause issues\n gsub(\"\\\\\", '')\n\n while email.count('@') > 1\n email.sub!('@', '')\n end\n\n if email.split('@').last.include?('&')\n pieces = email.split('@')\n first, last = pieces.first, pieces.last\n last = last.sub('&', '')\n email = [first, last].join('@')\n end\n\n email\n else\n email\n end\n end",
"def remove_gmail_periods(email_address)\n email_address = email_address.downcase\n return email_address unless email_address.end_with?('gmail.com')\n # sub out any periods with blanks, then replace the period for the '.com' at the end of the address\n email_address = email_address.gsub('.', '').gsub(/com\\z/, '.com')\n end",
"def prepare_email\n self.email = email.downcase.strip if email\n end",
"def extract_emails(emails)\n return [] if emails.blank?\n\n emails.\n split(',').\n select { |email| ::EmailValidator.valid?(email) }.\n first(100)\n end",
"def obfuscate_email(email)\n return nil if email.blank?\n parts = email.split(\"@\")\n \n local_parts = parts[0].split(\"+\")\n local_first = local_parts[0][0]\n local_last = local_parts[0][-1]\n local_rest = local_parts[0][1..-2]\n local_rest.gsub!(/[a-zA-Z0-9]/,\"*\")\n\n local_part = [local_first,local_rest,local_last].join(\"\")\n \n local_part = [local_part,local_parts[1]].join(\"+\") unless local_parts[1].blank?\n\n domain_part = parts[1]\n\n return \"#{local_part}@#{domain_part}\"\n end",
"def validates_email_format(email)\n # TODO: should this decode escaped entities before counting?\n begin\n local, domain = email.split('@', 2)\n rescue NoMethodError\n return false\n end\n\n begin\n email =~ Regex and not email =~ /\\.\\./ and domain.length <= 255 and local.length <= 64\n rescue Encoding::CompatibilityError\n # RFC 2822 and RFC 3696 don't support UTF-8 characters in email address,\n # so Regexp is in ASCII-8BIT encoding, which raises this exception when\n # you try email address with unicode characters in it.\n return false\n end\n end",
"def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend",
"def extract_email_address(email)\n # Check for <@> pattern and extract\n result = email[/<.+@.+>/]\n if result.nil?\n # If not found, return original email address for further validation\n return email\n else\n # If found return address minus the <> and leading/trailing spaces\n return result.gsub(/[<>]/,'<' => '', '>' => '').strip\n end\n end",
"def email_service\n self.email_service = self.email.match(/\\A\\w+\\.?\\w*\\@{1}([a-z]+)\\.{1}[a-z]+\\z/).to_a[1]\n end",
"def normalize_fields\n self.email.downcase!\n end",
"def email_status\n texts = []\n\n begin\n author = Mail::Address.new(params[:author].gsub(\"\\n\",''))\n recipients = Mail::AddressList.new(params[:recipients].gsub(\"\\n\",'')).addresses\n emails = [author, recipients].flatten.find_all { |addr| addr.domain && (addr.domain != 'mountainofpromos.com') }\n rescue Mail::Field::ParseError\n emails = []\n texts << \"Address Parse Error\"\n end\n\n subject = params[:subject]\n uri = nil\n\n emails.find do |addr|\n @supplier = Supplier.find(:first, :conditions => [\"lower(po_email) ~ ?\", addr.domain.downcase], :order => 'parent_id DESC')\n end\n if @supplier or emails.empty?\n texts << @supplier.name if @supplier\n if /(Q\\d{4})/i === subject and\n po = PurchaseOrder.find_by_quickbooks_ref($1)\n @order = po.purchase.order\n @supplier = po.purchase.supplier\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order }\n end\n end\n \n unless @supplier\n if /\\(#(\\d{4,5})\\)/ === subject and\n @order = Order.find_by_id($1)\n texts << \"ORDER DOESN'T MATCH CUSTOMER EMAIL\" unless emails.empty? or emails.find { |a| @order.customer.email_addresses.to_a.find { |b| b.address.downcase.include?(a.address.downcase) } }\n texts << (@order.user_id ? @order.user.name : \"UNASSIGNED\")\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order, :own => true } if @order.user_id.nil?\n else\n customers = emails.collect do |addr|\n Customer.find(:all, :include => :email_addresses, :conditions => [\"lower(email_addresses.address) ~ ?\", addr.address.downcase], :order => 'customers.id DESC')\n end.flatten\n\n unless customers.empty?\n texts << \"MULTIPLE CUSTOMERS\" if customers.length > 1\n orders = customers.collect do |customer|\n ret = customer.orders.find(:all, :conditions => { :closed => false }, :order => 'id')\n ret.empty? ? customer.orders : ret\n end.flatten\n orders.collect { |o| o.user }.uniq.each do |user|\n texts << (user ? user.name : \"UNASSIGNED\")\n end\n @order = orders.last\n else\n if !emails.empty? && recipients.find { |r| r.address == MAIN_EMAIL }\n texts << \"NEW CUSTOMER\"\n /M(\\d{4,5})/ === subject\n uri = { :controller => '/admin/orders', :action => :create_email, :email => author.address || '', :name => author.name, :subject => subject}\n else\n texts << \"UNKNOWN\"\n end\n end\n end\n end\n \n\n if @order\n texts << @order.customer.company_name unless @order.customer.company_name.blank?\n texts << @order.customer.person_name\n uri = { :controller => '/orders', :action => :status, :id => @order } unless uri\n end\n\n render :json => { :text => texts.join(' - '), :uri => uri && url_for(uri.merge({ :protocol => (Rails.env.production? ? 'https://' : 'http://') })) }\n end",
"def is_valid_email(str)\n parts = str.split(\"@\")\n\n if parts.length != 2\n return false \n end \n \nend",
"def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end",
"def my_parse_recipients(mail)\n %W(to cc bcc).inject({}) do |acc, header|\n acc[header] = [mail.header[header]].flatten.collect {|address| address.to_s}\n acc\n end\n end",
"def title_after_name(emailname)\n result = nil\n if emailname.count(',') > 0\n new_name = emailname.split(',')[0]\n result = email_for_name(new_name) if new_name.count(' ') > 0\n end\n result\n end",
"def email_safe_salutation\n return 'Hello,' if\n first_name.blank? || first_name !~ /\\A[\\p{Word}\\s'-]{1,30}\\z/i\n\n \"Dear #{first_name},\"\n end",
"def format_email!\n @email.gsub!(/@/, \"%40\")\n end",
"def email_from\n case self.type\n when 'test'\n \"milo.thurston@oerc.ox.ac.uk\"\n when 'left','sdm','lcc','cde'\n \"neil.caithness@oerc.ox.ac.uk\"\n else\n \"noreply.oboe@oerc.ox.ac.uk\"\n end\n end",
"def formatted_email(contact)\n \"#{contact.username} <#{contact.email}>\"\n end"
] | [
"0.69811",
"0.68171275",
"0.6684519",
"0.66841555",
"0.65945596",
"0.6575596",
"0.6541155",
"0.6524848",
"0.64863837",
"0.6403251",
"0.63669395",
"0.63220716",
"0.632016",
"0.6308765",
"0.62817734",
"0.62810695",
"0.6272382",
"0.62651664",
"0.62637085",
"0.62537616",
"0.6244072",
"0.6236582",
"0.6216701",
"0.6195053",
"0.6194466",
"0.6185292",
"0.6184696",
"0.6168597",
"0.6146076",
"0.6141854",
"0.6125838",
"0.6095975",
"0.60951185",
"0.60910255",
"0.60899246",
"0.6078229",
"0.60372126",
"0.60331494",
"0.6024989",
"0.6012456",
"0.6007097",
"0.5998788",
"0.5964117",
"0.59608835",
"0.595698",
"0.59557635",
"0.59554064",
"0.5941083",
"0.5936397",
"0.5936306",
"0.59357655",
"0.59019876",
"0.5894377",
"0.5890215",
"0.5882971",
"0.58800477",
"0.58694786",
"0.58427215",
"0.5831787",
"0.58278",
"0.58230656",
"0.58087856",
"0.57999444",
"0.57995003",
"0.5774908",
"0.5767975",
"0.57571733",
"0.57560647",
"0.57539505",
"0.5753242",
"0.5752889",
"0.57389075",
"0.5738333",
"0.57355535",
"0.57247275",
"0.5723836",
"0.5723281",
"0.57161224",
"0.5715293",
"0.5705408",
"0.5704739",
"0.56925184",
"0.56829953",
"0.56806296",
"0.56798947",
"0.56737965",
"0.5667951",
"0.5662522",
"0.56613886",
"0.56507343",
"0.5647079",
"0.5632798",
"0.5622768",
"0.5621788",
"0.5620336",
"0.56153286",
"0.56149584",
"0.56062067",
"0.56025463",
"0.5601622"
] | 0.6696235 | 2 |
For each keyvalue pair in the second provided hash, predict the email given the format(s) in company_email_format_hash | def predict_email(prediction_dataset_hash)
prediction_dataset_hash.each do |name, domain|
new_email = EmailObject.new(name)
new_email.domain = domain
if @company_email_format_hash.key? domain
new_email.email_format = @company_email_format_hash[domain]
puts "Name: #{new_email.name} Domain: #{new_email.domain} Format:#{new_email.email_format}"
if !new_email.email_format.include? ","
generate_email_address(new_email,new_email.email_format)
else
new_email.email_format.split(",").each do |format|
generate_email_address(new_email, format)
end
end
else
puts "We can't predict the email for " + new_email.domain + " as it wasn't in the sample hash"
end
puts "Email:#{new_email.email}"
puts "\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emails_to_hash(emails)\n {\n :primary => emails.find { |email| email.primary }.email,\n :additional => emails.select { |email| !email.primary && email.verified}.map { |email| email.email }\n }\nend",
"def read_hash(gmail, my_hash)\n\n @my_hash = my_hash\n @gmail = gmail\n\n @my_hash.each do |key, value|\n unless value == \"\" && EmailAddress.valid?(value)\n content = body_content(key)\n send_email(@gmail, content, value)\n end\n end\nend",
"def hash\n [actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n end",
"def parser_email(line)\n if line.include? MailHeader.from\n fields=line.split(MailHeader.key_separator)\n if fields.length>1\n\t\t\t\tvalue=fields[1].split(\" \")\n if value.length>1\n firstname_lastname=value[0];\n email_address=value[1].gsub(/[<>]/,'')\n company_url=\"www.\"+email_address.split('@')[1];\n # if the email address is not contains the '@',the address is not correct\n unless email_address.include? \"@\"\n mail_header_output.firstname_lastname=MailHeader.unknown\n mail_header_output.flastname=MailHeader.unknown\n end\n mail_header_output.company_url=company_url\n check_firstname_lastname(email_address)\n check_flastname(email_address)\n check_email_name_conflict()\n end #end value.length\n end #end fields.length\n end #end line include\n end",
"def hash_addresses(address_field)\n return nil unless address_field\n\n address_field.formatted.map do |address|\n address_obj = Mail::Address.new(address)\n {\n email: address_obj.address,\n name: address_obj.display_name,\n type: address_field.name.downcase\n }\n end\n end",
"def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend",
"def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid e-mail output!\")\n return\n end\n $logger.debug(\"The output for job_code #{jmd.job_code} does have valid e-mail output! See the rails log for details\")\n body = match[1]\n #get the subject from the body\n match = Regexp.new('SUBJECT:(.*)').match(body)\n subject = match[1] unless match.nil?\n body.sub!(\"SUBJECT:#{subject}\",'')#append on subject\n subject = $application_properties['service_subject'] + \" \" + subject if jlh.has_key?(:service)\n subject = subject + ' -- REMINDER ' + @reminder_hash[jmd.job_code].to_s if (jlh[:reminder_email])\n body.chomp!.reverse!.chomp!.reverse! unless jmd.email_content_type.eql?('text/html')\n from = $application_properties['PST_Team']\n content_type = jmd.email_content_type\n recipients = []\n cc = []# or should it be ''?\n #banana slug\n #integrate with escalation levels to get additional e-mails out of the escalation\n recipients = jlh[:email_to] if jlh.has_key?(:email_to)\n cc = jlh[:email_cc] if jlh.has_key?(:email_cc)\n\n if (jmd.track_status_change && jmd.email_on_status_change_only)\n esc = jle.get_escalation\n esc = JobLogEntry.before(jle).status_not(\"UNKNOWN\").limit(1).first.get_escalation if esc.nil? #if this is nil this jle is green\n\n if ! esc.nil? #this is added in the event that the alert has never been red and we are in this method because we are executing as a service\n esc_emails = esc.get_escalation_based_emails\n recipients = recipients | esc_emails[0]\n cc = cc | esc_emails[1]\n end\n end\n\n recipients = recipients.uniq.join(',')\n cc = cc.uniq.join(',')\n\n email_hash = {:request => jmd.job_code, :content_type => content_type, :subject=>subject,\n :recipients=>recipients, :from=>from, :cc=>cc,:body=>body,\n :incl_attachment=>jmd.incl_attachment,:attachment_path=>jmd.attachment_path,\n :jmd => jmd, :jle => jle}\n\n JobMailer.job_result(email_hash).deliver\n end",
"def constructShippingAddress(tmp_email_order_hash, email_order_hash)\n\t\temail_order_hash[:ship_to_first_name] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_first_name\"].to_s\n\t\temail_order_hash[:ship_to_last_name] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_last_name\"].to_s\n\t\temail_order_hash[:ship_to_company] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_company\"].to_s\n\t\temail_order_hash[:ship_to_addr1] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_addr1\"].to_s\n\t\temail_order_hash[:ship_to_addr2] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_addr2\"].to_s\n\t\temail_order_hash[:ship_to_city] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_city\"].to_s\n\t\temail_order_hash[:ship_to_state] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_state\"].to_s\n\t\temail_order_hash[:ship_to_zip] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_zip\"].to_s\n\t\temail_order_hash[:ship_to_phone] = formatPhoneNumber(tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_phone\"].to_s)\n\t\temail_order_hash[:ship_to_phone] = tmp_email_order_hash[\"response\"][\"order\"][\"ship_to_phone\"].to_s\n\t\temail_order_hash[:shipping_address] = \"#{email_order_hash[:ship_to_first_name]} #{email_order_hash[:ship_to_last_name]}<br />\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_company]}<br />\" if email_order_hash[:ship_to_company] !=\"\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_addr1]}<br />\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_addr2]}<br />\" if email_order_hash[:ship_to_addr2] !=\"\"\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_city]}, #{email_order_hash[:ship_to_state]} #{email_order_hash[:ship_to_zip]}<br />\"\t\n\t\temail_order_hash[:shipping_address] += \"#{email_order_hash[:ship_to_phone]}<br />\" if email_order_hash[:ship_to_phone] !=\"\"\n\t\t\n\tend",
"def hash\n [additional_contact_billing_id, additional_contact_billing_is_primary, additional_contact_billing_name, additional_contact_executive_sponsor_id, additional_contact_executive_sponsor_is_primary, additional_contact_executive_sponsor_name, additional_contact_hiring_manager_id, additional_contact_hiring_manager_is_primary, additional_contact_hiring_manager_name, additional_contact_internal_recruiter_id, additional_contact_internal_recruiter_is_primary, additional_contact_internal_recruiter_name, additional_contact_other_id, additional_contact_other_is_primary, additional_contact_other_name, attachments, created_by_id, created_by_name, created_on, expected_value, external_email_address, id, job_code, last_activity_date, last_engagement_date, modified_by_id, modified_by_name, modified_on, owners, status_id, status_name, time_to_close, actual_value, additional_contact_client_first_name, additional_contact_client_id, additional_contact_client_is_primary, additional_contact_client_last_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, bill_rate, bonus, commission, company_id, company_name, compensation, compensation_details, custom_field1, custom_field10, custom_field11, custom_field12, custom_field13, custom_field14, custom_field15, custom_field16, custom_field17, custom_field18, custom_field19, custom_field2, custom_field20, custom_field21, custom_field22, custom_field23, custom_field24, custom_field25, custom_field26, custom_field27, custom_field28, custom_field29, custom_field3, custom_field30, custom_field4, custom_field5, custom_field6, custom_field7, custom_field8, custom_field9, description, discount, estimated_close_date, external_primary_key, fee, fee_percent, hourly_rate, is_lead, is_on_hold, job_title_id, job_title_name, job_types, lead_source_id, lead_source_name, margin, name, number_of_openings, opportunity_type_id, opportunity_type_name, parent_job_id, parent_job_name, pay_rate, potential_value, priority_id, priority_name, probability, salary, start_date, tags, total_hours, website_description, website_description_is_primary, website_other, website_other_is_primary].hash\n end",
"def create_hash\n \n \thash = Hash[get_thoses_fucking_name.zip(get_bitches_mail)]\n \t\n \thash.each do |key, mail|\n\n\tputs \":nom => #{key} ; :e-mail => #{mail}\"\n\t\n\tend\nend",
"def email_creation(hash_to_manipulate,msg)\n retirement_site=[]\n others_site=[]\n sorted_hash = hash_to_manipulate.sort_by{ |instance, details| details[:not_before] }\n sorted_hash.each do |instance, details|\n if details[:code] == \"instance-retirement\"\n retirement_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n else\n unless details[:description] =~ /\\[Completed\\]|\\[Canceled\\]/\n others_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n end\n end\n end\n # This is so people know the system is working, but that nothing happened today\n if retirement_site.empty? and others_site.empty?\n msg << \"<html>\"\n msg << \"<body>\"\n msg << \"<h3>No events today! Have a nice day! :)</h3>\"\n msg << \"</body>\"\n msg << \"</html>\"\n end\n unless retirement_site.empty? and others_site.empty? \n msg << \"<html>\"\n msg << \"<body>\"\n unless retirement_site.empty?\n msg << \"<h3>Instances that are being terminated!</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{retirement_site.join(\"\\n\")}\"\n msg << \"</table>\"\n msg << \"<p><p>\"\n end\n unless others_site.empty?\n msg << \"<h3>Instances with non-terminal events.</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{others_site.join(\"\\n\")}\"\n msg << \"</table>\"\n end\n msg << \"</body>\"\n msg << \"</html>\"\n end\nend",
"def build_hash(emails, first_names, last_names)\n deputies_array = []\n\n emails.each_with_index do |email, index|\n deputy_hash = {}\n deputy_hash['first_name'] = first_names[index]\n deputy_hash['last_name'] = last_names[index]\n deputy_hash['email'] = email\n deputies_array << deputy_hash\n end\n\n deputies_array\nend",
"def get_townhall_email(townhalls_urls_and_cities)\n\n return nil if townhalls_urls_and_cities.nil? || townhalls_urls_and_cities.empty?\n # return nil if list_townhall_urls.nil? || list_townhall_urls.empty? || list_cities.empty? || list_cities.nil?\n\n # Pour une meilleur compréhension\n list_townhall_urls = townhalls_urls_and_cities[0]\n list_cities = townhalls_urls_and_cities[1]\n\n\n #2/Liste des emails--------------------je fais une recherche sur tout... qui contient du text et @ (email ;o)! ) \n list_townhall_email=Array.new\n\n list_townhall_email = list_townhall_urls.each{ |url_hall|\n\n # Lecture d'une page html url_hall (de la ville) pour chaque mairie\n Nokogiri::HTML(URI.open(url_hall)).xpath('//*[contains(text(), \"@\")]').text\n }\n \n # -=-=-=- Init d'un Array (tableau de hash, conformément au format demandé) -=-=-=-\n # -=-=-=- MISE EN FORME -=-=-=-\n townhall_and_email_tab = Array.new\n\n # for i in 0..cities.length-1 do \n (0..list_cities.length-1).each do | i |\n townhall_and_email_tab[i] = Hash.new\n townhall_and_email_tab[i][list_cities[i]] = list_townhall_email[i]\n end\n \n return townhall_and_email_tab\nend",
"def custom_contact_hash(current_user_id, import_hash)\n puts \"custom_contact_hash \"\n\n {\n first_name: import_hash[\"First Name\"],\n last_name: import_hash[\"Last Name\"],\n email: import_hash[\"email\"],\n primary_phone: import_hash[\"home_phone\"] || import_hash[\"mobile_phone\"],\n mobile_phone: import_hash[\"mobile_phone\"],\n home_phone: import_hash[\"home_phone\"],\n url: import_hash[\"url\"],\n importer_user_id: current_user_id,\n editor_user_id: current_user_id,\n status: \"approved\"\n }\n end",
"def update_from_auth_hash(auth_hash)\n if e_account_no && auth_hash.uid != e_account_no\n raise \"eAccount #'s don't match! Expected #{e_account_no} but \" +\n \"got #{auth_hash.uid}\"\n end\n EACCOUNT_MAP.each do |k,v|\n val = auth_hash.extra[k]\n if val && v == :email\n # Email fields come in as multiple <mail> xml nodes :/\n val = [] << val unless val.respond_to?(:each)\n self.email = val[0] if val[0]\n self.email_cc = val[1] if val[1]\n next\n elsif val && val.respond_to?(:blank?)\n self.send(\"#{v}=\", val) unless val.blank?\n else\n self.send(\"#{v}=\", val)\n end\n end\n self.e_account_no = auth_hash.uid\n self.save\n end",
"def predict_emails\n @test_dataset.each do |test_item|\n domain_name = test_item[1]\n if !@all_domains.keys.include?(domain_name)\n puts \"Predictions for \" + test_item[0] + \" are - \"\n puts \"Can not predict email for this domain as no sufficient information is available\"\n puts \"-\" * 50\n else\n current_domain = get_current_domain(domain_name) \n current_domain.display_predictions(test_item[0])\n end\n end\n end",
"def get_email_list\n return get_townhall_list_and_url.map{|town, url| {town => get_townhall_email(url)}}\n end",
"def email_map(emails)\n emails.each do |e|\n result = self.map[e]\n unless result.nil? || result.empty?\n return result\n end\n end\n nil\n end",
"def build_meteor_mail_hash(email, verified_state)\n {address: email, verified: verified_state}\n end",
"def import_hash(hash)\n clean_char_encoding!(hash)\n\n ref = {}\n {\"@referent\" => \"rft\", \"@referrer\" => \"rfr\", \"@referringEntity\" => \"rfe\",\n \"@requestor\" => \"req\"}.each do |ent, abbr|\n next unless hash[\"#{abbr}_val_fmt\"]\n val = hash[\"#{abbr}_val_fmt\"]\n val = val[0] if val.is_a?(Array)\n instance_variable_set(ent.to_sym, ContextObjectEntityFactory.format(val))\n end\n\n {\"@serviceType\" => \"svc\", \"@resolver\" => \"res\"}.each do |ent, abbr|\n next unless hash[\"#{abbr}_val_fmt\"]\n val = hash[\"#{abbr}_val_fmt\"]\n val = val[0] if val.is_a?(Array)\n instance_variable_set(ent.to_sym, [ContextObjectEntityFactory.format(val)])\n end\n\n openurl_keys = [\"url_ver\", \"url_tim\", \"url_ctx_fmt\"]\n hash.each do |key, value|\n val = value\n val = value[0] if value.is_a?(Array)\n\n next if value.nil? || value.empty?\n\n if openurl_keys.include?(key)\n next # None of these matter much for our purposes\n elsif @admin.has_key?(key)\n set_administration_key(key, val)\n elsif /^[a-z]{3}_val_fmt/.match?(key)\n next\n elsif /^[a-z]{3}_ref/.match?(key)\n # determines if we have a by-reference context object\n (entity, v, fmt) = key.split(\"_\")\n ent = get_entity_obj(entity)\n unless ent\n foreign_keys[key] = val\n next\n end\n # by-reference requires two fields, format and location, if this is\n # the first field we've run across, set a place holder until we get\n # the other value\n if ref[entity]\n if ref[entity][0] == \"format\"\n instance_variable_get(\"@#{ent}\").set_reference(val, ref[entity][1])\n else\n instance_variable_get(\"@#{ent}\").set_reference(ref[entity][1], val)\n end\n else\n ref_key = if fmt\n \"format\"\n else\n \"location\"\n end\n ref[entity] = [ref_key, val]\n end\n elsif /^[a-z]{3}_id$/.match?(key)\n # Get the entity identifier\n (entity, v) = key.split(\"_\")\n ent = get_entity_obj(entity)\n unless ent\n foreign_keys[key] = val\n next\n end\n # May or may not be an array, turn it into one.\n [value].flatten.each do |id|\n ent.add_identifier(id)\n end\n\n elsif /^[a-z]{3}_dat$/.match?(key)\n # Get any private data\n (entity, v) = key.split(\"_\")\n ent = get_entity_obj(entity)\n unless ent\n foreign_keys[key] = val\n next\n end\n ent.set_private_data(val)\n else\n # collect the entity metadata\n keyparts = key.split(\".\")\n if keyparts.length > 1\n # This is 1.0 OpenURL\n ent = get_entity_obj(keyparts[0])\n unless ent\n foreign_keys[key] = val\n next\n end\n ent.set_metadata(keyparts[1], val)\n elsif key == \"id\"\n # This is a 0.1 OpenURL. Your mileage may vary on how accurately\n # this maps.\n if value.is_a?(Array)\n value.each do |id|\n @referent.add_identifier(id)\n end\n else\n @referent.add_identifier(val)\n end\n elsif key == \"sid\"\n @referrer.set_identifier(\"info:sid/\" + val.to_s)\n elsif key == \"pid\"\n @referent.set_private_data(val.to_s)\n elsif key == \"doi\"\n @referent.set_identifier(\"info:doi/\" + val.to_s)\n elsif key == \"pmid\"\n @referent.set_identifier(\"info:pmid/\" + val.to_s)\n else\n @referent.set_metadata(key, val)\n end\n end\n end\n\n # Initialize a new ContextObject object from an existing key/value hash\n def self.new_from_hash(hash)\n co = new\n co.import_hash(hash)\n co\n end\n\n # if we don't have a referent format (most likely because we have a 0.1\n # OpenURL), try to determine something from the genre. If that doesn't\n # exist, just call it a journal since most 0.1 OpenURLs would be one,\n # anyway. Case insensitive match, because some providers play fast and\n # loose. (BorrowDirect sends 'Book', which can confuse us otherwise)\n unless @referent.format\n fmt = case @referent.metadata[\"genre\"]\n when /article|journal|issue|proceeding|conference|preprint/i then \"journal\"\n when /book|bookitem|report|document/i then \"book\"\n # 'dissertation' is not a real 'genre', but some use it anyway, and should\n # map to format 'dissertation' which is real.\n when /dissertation/i then \"dissertation\"\n else \"journal\"\n end\n @referent.set_format(fmt)\n end\n end",
"def get_test_email_recipients(campaign_mailout)\n\t\n \tproject_team_emails = Hash.new\n\t\n\tmarketing_campaign = campaign_mailout.marketing_campaign\n\tproject = marketing_campaign.project\n\t\n\tproject_team_members = project.project_team_members.map{|pm| pm.person}.uniq\n\t\t\n\tproject_team_members.each do |person|\n\t user_contactinfos = person.roles.collect{ |r| r.role_contactinfos.collect{|rc| rc.contactinfo }}.flatten.compact\n\t \n\t user_contactinfos.each do |c|\n\t\t project_team_emails.store(c.email_1, c.email_1) unless c.email_1.blank?\n\t\t project_team_emails.store(c.email_2, c.email_2) unless c.email_2.blank?\n\t\t project_team_emails.store(c.email_3, c.email_3) unless c.email_3.blank?\n\t end\n\tend\n\tproject_team_emails = project_team_emails \t\n \t\n\treturn project_team_emails\n end",
"def e_email_for(key = 'email_order_paid')\n (e_settings[key]) || case key.to_s\n when 'email_order_received'\n '<h1>ORDER SUMMARY {number}</h1> Dear {name}, please review and retain the following order information for your records.<br>{order_table}'\n when 'email_order_confirmed'\n '<h1>ORDER CONFIRMED {number}</h1> Dear {name}, your order has been confirmed. Please retain the following order information for your records<br>{order_table}'\n when 'email_order_shipped'\n '<h1>SHIPMENT SUMMARY</h1> Dear {name}, your order {number} has been shipped. Shipped method: {shipping_name} <br>{order_table}<br>{tracking_url}'\n when 'email_order_cancelled'\n '<h1>ORDER {number} CANCELLED</h1> Dear {name}, your order has been cancelled. Please retain this cancellation information for your records. <br>{order_table}'\n when 'email_order_invoice'\n '<table style=\"width: 100%;\"><tr><td><h1>INVOICE #{invoice_number}</h1> <h4>Order #{number}</h4><div>{current_date}</div></td><td style=\"text-align: center;\"><img src=\"http://camaleon.tuzitio.com/media/132/logo2.png\"></td></tr></table> <table style=\"width: 100%;\"><tr><td><strong>Billing Address</strong><br>{billing_info}</td><td><strong>Shipping Address</strong><br>{shipping_info}</td></tr><tr><td colspan=\"2\">{order_table}</td></tr></table>'\n end\n end",
"def vcard_emails(data, uri)\n # TODO: consider using regex: /.+@.+\\..+/i\n # The 'email' field might contain multiple entries, separated by\n # various kinds of delimiter and each item is not necessarily\n # validated, so this is an attempt to clean up some things, but\n # it's not fool proof. For more on this topic, see\n # http://davidcel.is/posts/stop-validating-email-addresses-with-regex/\n emails = []\n collect = data['email'].split rescue []\n collect.each_with_index do |email, i|\n email = email.gsub(/,\\z/,'').gsub(/>.*/,'').gsub(/\\A</,'')\n emails << {\n '@id' => uri + \"/email/#{i}\",\n 'a' => ['vcard:Email'], # must be array to allow addition of types\n 'vcard:email' => email\n }\n end\n emails\n end",
"def parse_email_address(emails,check_for_shared_netids=nil)\n emails = check_for_shared_netid(emails,1) if check_for_shared_netids\n emails = emails.split(\"|\") if emails =~ /|/\n if emails.class.to_s == \"String\"\n parsed_emails = emails + \"@\" + @configuration[:domain] if emails !~ /@/\n elsif emails.class.to_s == \"Array\"\n # this is ugly\n emails_string = \"\"\n emails.each do |address|\n address = address + \"@\" + @configuration[:domain] if address !~ /@/\n emails_string += \"#{address}, \"\n end\n emails_string.chomp(\", \")\n end\n end",
"def convert_email\n %w[paul@kristoffs.com paul.kristoff@kristoffs.com retail@kristoffs.com justfaith@kristoffs.com financial@kristoffs.com]\n end",
"def email_kyc_approve(data_to_format)\n {}\n end",
"def process\n parsed = {}\n parsed[:contents] = \"#{@email.subject} ::: #{@email.body}\"\n parsed[:from] = \"#{@email.from[:email]}\"\n #[:to] is an array of hashes, since possible multiple to's\n parsed[:to] = \"#{@email.to[0][:email]}\"\n\n email_of_interest = parsed[:to]\n if !(/@/.match(parsed[:to]))\n Rails.logger.warn \"Poorly formatted email! parsed: #{parsed}\"\n end\n\n object = Person.react_to_email(email_of_interest)\n if object.class.to_s == \"Person\"\n Communication.create(person_id: object.id,\n contents: parsed[:contents],\n medium: \"email\",\n when: Date.today)\n end\n end",
"def e_email_keys\n '{root_url} => site url, {date} => order date, {number} => order number, {name} => client first name, {full_name}, {order_table} => table of products of the order, {shipping_name} => shipping method name, {tracking_url} => the url of tracking, {shipping_info} => Shipping info, {billing_info} => Billing info, {invoice_number} => Sequential Invoice Number, {url} => Order Url'\n end",
"def email_kyc_report_issue(data_to_format)\n {}\n end",
"def email_cleaned\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :campaign_id => data['campaign_id'],\n :email => data['email'],\n :reason => data['reason'],\n :human => \"#{data['email']} was cleaned from Mailchimp list with ID #{data['list_id']}. Reason: '#{data['reason']}'\"\n }\n end",
"def lookup(company)\n cfpb_name = fuzzy_cfpb_lookup(company).first || {}\n iex_name = match_cfpb_to_iex(cfpb_name) || {}\n\n { cfpb: cfpb_name['name'], iex: iex_name['name'] }\n end",
"def compose\n terms = getUserQuery()\n VictimList.instance.victims.each { |vic|\n\t composed = String.new(@emailString)\n\t terms.each { |term|\n\t termString = term.to_s\n\t composed.gsub!(/\\[#{termString}\\]/, vic.attributes[term])\n\t\tcomposed.gsub!(/\\[_#{termString}\\]/, vic.attributes[term].gsub(/[^0-9a-zA-Z]+/, \"\").downcase)\n\t }\n\t writeEmailToDisk(composed)\n\t}\n \n end",
"def get_emails(emails,incidente)\n return ['informatica@botica.com.py'] if RAILS_ENV.include?'development'\n area_id=incidente.funcionario.cargo.area_id\n cargo_ids=Cargo.find(:all,:select=>'id',:conditions=>{:area_id=>area_id,:recibe_mails_hechos=>true}).map(&:id)\n mails1=Usuario.activos.find(:all,:select=>'email',:conditions=>{:cargo_id=>cargo_ids}).map(&:email)\n mails2=case true\n when (!emails[:parametro].blank? and !emails[:direcciones].blank?)\n Parametro.destinatarios(emails[:parametro]).concat(emails[:direcciones]).uniq\n when !emails[:parametro].blank?\n Parametro.destinatarios(emails[:parametro])\n when !emails[:direcciones].blank?\n emails[:direcciones].uniq \n else\n [\"no-responder@botica.com.py\"]\n end\n mails1.concat(mails2).uniq\n end",
"def civicrm_emails\n emails = ALF::Email.where('person', self.person_id)\n prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.person_id).take.contact_id;\n contact = CIVICRM::Contact.find(prev_id)\n\n emails.each do |e|\n e_type = ALF::EmailType.findId(e.email_type)\n\n if e_type.present? && (e_type.email_type == 'Personal')\n loc_type = CIVICRM::LocationType.where(name: 'Primary').take\n primary = true\n else\n loc_type = CIVICRM::LocationType.where(name: 'Secondary').take\n primary = false\n end\n\n email = CIVICRM::Email.new(\n contact_id: contact.id,\n email: e.email_address,\n location_type_id: loc_type.id,\n is_primary: primary\n )\n\n if !email.valid? || !email.save\n raise \"Invalid Email Model\\nCIVICRM::Email: #{email.inspect}\\nALF::Email: #{e.inspect}\\nPerson: #{self.person_id}\\n\"\n end\n end\n end",
"def hash\n [attachments, created_by_id, created_by_name, created_on, id, modified_by_id, modified_by_name, modified_on, name, owners, status_id, status_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_home_city, address_home_country, address_home_is_primary, address_home_line1, address_home_state, address_home_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, current_position_company_id, current_position_company_name, current_position_title, current_position_when_end, current_position_when_start, description, education_accreditation_id, education_accreditation_name, education_honors, education_institution_id, education_institution_name, education_when_end, education_when_start, email_address_other, email_address_other_is_primary, email_address_personal, email_address_personal_is_primary, email_address_work, email_address_work_is_primary, ethnicity_id, ethnicity_name, external_primary_key, first_name, gender_id, gender_name, key_date_anniversary, key_date_birthday, key_date_other, last_name, middle_name, nick_name, phone_number_fax, phone_number_fax_extension, phone_number_fax_is_primary, phone_number_home, phone_number_home_extension, phone_number_home_is_primary, phone_number_mobile, phone_number_mobile_extension, phone_number_mobile_is_primary, phone_number_other, phone_number_other_extension, phone_number_other_is_primary, phone_number_skype, phone_number_skype_extension, phone_number_skype_is_primary, phone_number_work_direct, phone_number_work_direct_extension, phone_number_work_direct_is_primary, phone_number_work_main, phone_number_work_main_extension, phone_number_work_main_is_primary, preferred_contact_method_type_id, preferred_contact_method_type_name, record_type, related_contact_assistant_first_name, related_contact_assistant_id, related_contact_assistant_is_primary, related_contact_assistant_last_name, related_contact_client_first_name, related_contact_client_id, related_contact_client_is_primary, related_contact_client_last_name, related_contact_other_first_name, related_contact_other_id, related_contact_other_is_primary, related_contact_other_last_name, related_contact_referred_by_first_name, related_contact_referred_by_id, related_contact_referred_by_is_primary, related_contact_referred_by_last_name, related_contact_spouse_first_name, related_contact_spouse_id, related_contact_spouse_is_primary, related_contact_spouse_last_name, salary, salary_details, salutation_id, salutation_name, social_aim, social_aim_is_primary, social_facebook_chat, social_facebook_chat_is_primary, social_face_time, social_face_time_is_primary, social_google_talk, social_google_talk_is_primary, social_icq, social_icq_is_primary, social_other, social_other_is_primary, social_skype, social_skype_is_primary, social_twitter, social_twitter_is_primary, social_yahoo_msg, social_yahoo_msg_is_primary, source_id, source_name, suffix_id, suffix_name, tags, website_blog, website_blog_is_primary, website_business, website_business_is_primary, website_facebook, website_facebook_is_primary, website_linked_in, website_linked_in_is_primary, website_other, website_other_is_primary, website_personal, website_personal_is_primary].hash\n end",
"def get_townhall_email(townhall_url)\r\n page = get_page(townhall_url)\r\n email = page.xpath('//*[contains(text(), \"@\")]').text\r\n town_name = page.xpath('//*[contains(text(), \"Adresse mairie de\")]').text.split #nom de ville\r\n email_array_one_hash = [{town_name[3] => email}] #nom\r\n return email_array_one_hash\r\nend",
"def parse_contact_info(table_cells)\n first_match = \"Contact Information:\"\n match_data = [ \"Property Management Company\", \"Private Owner\", \"Non-Profit\" ]\n complete_data = {}\n match_data.each do |data|\n table_cells.each_with_index do |cell, index|\n if cell.to_s.match(data)\n table_cell_match_content = table_cells[index]\n complete_data.merge!({ first_match.to_sym => table_cell_match_content.to_s.strip.gsub(/\\n/, '').gsub(/\\t/,'') })\n\n end\n end\n end\n\n complete_data\nend",
"def compareAndExtractEmail\n a = amazonSnackList()\n b = nibbleSnackList()\n c = amazonSnackListEmail()\n\n e = a.zip(c)\n\n g = a & b\n\n arr = []\n i = 0\n while (i < e.length)\n if g[0] == e[i][0] then\n d = e[i]\n arr << d\n elsif g[1] == e[i][0] then\n d = e[i]\n arr << d\n end\n i = i + 1\n end\n r = 0\n while (r < arr.length)\n puts 'Product sold: ' + arr[r][0].to_s\n puts 'Contact of person selling it: ' + arr[r][1].to_s\n r = r + 1\n end \nend",
"def townhall_and_email(html)\n \n contact = get_townhall_city(html).zip(get_townhall_email(html)).map{ |x| [x].to_h}\n puts contact\n\n end",
"def email(text_array)\n email = nil\n text_array.each do |t|\n if t.match(/.{1,}[@].{1,}[.].{1,}/)\n email = t\n end\n end\n return email\nend",
"def findemail(addr)\n found = @emails.find { |_ky, vl| vl == addr }\n return nil unless found\n\n { id: (id = found[0]), name: @names[id], pw: @passwords[id], email: addr }\n end",
"def export_emails(data)\n\t\t\t\t\t\tmy_string = \"\"\n\t\t\t\t\t\t\t\tmatch_val = 0\n\t\t\t\t\t\t\t\t\t\tloc_urn = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\temails = \"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata[\"configurable_attributes\"].each do |item|\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr = []\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif item[\"category\"] == \"Location\" && item[\"location_urn\"] != nil\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# only push values that are emails\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmy_string = item[\"value\"]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tmatch_val = /@/ =~ my_string\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# puts match_val\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif match_val >= 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# add data to csv\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tarr.push(item[\"location_urn\"], item[\"value\"])\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tadd_to_csv arr\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\nend",
"def hash\n [address1, address2, amount, business_description, business_type, corporate_number, email, end_date, prefecture, remark, representative_name, tel, url, zip_code].hash\n end",
"def subscriber_hash(email)\n # Simple hash of the email address.\n Digest::MD5.hexdigest(email)\n end",
"def decode(email, full_name)\n email_initial, self.email_domain = email.downcase.split('@')\n self.name = full_name.downcase.split(' ')\n self.email_format = given_formats.select{ |f| f.call(name) == email_initial}\n end",
"def format_email_user_info(body, user)\n body.gsub!(/\\%name/,user.fullname)\n body.gsub!(/\\%email/,user.email)\n body.gsub!(/\\%phone/,user.phone)\n body.gsub!(/\\%program/,user.program)\n body.gsub!(/\\%school/,user.school)\n body.gsub!(/\\%status/,user.status)\n suggestion = Suggestion.where(:username => user.username).order(\"created_at\").last\n unless suggestion.nil?\n body.gsub!(/\\%suggestion/, suggestion.suggestion)\n end\n return body\n end",
"def search_by_emailaddress entity_name,headers\n\n begin\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=1\",nil,headers)\n json = JSON.parse(response)\n puts json\n\n #check if entries different to null\n if json[\"entries\"]\n\n\n json[\"entries\"].each do |e|\n\n #check if email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if IP address different to null and create entity\n if e[\"ip_address\"]\n _create_entity(\"IpAddress\", {\"name\" => e[\"ip_address\"]})\n\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n #create an issue about the investigited email\n _create_issue({\n name: \"leak found related to: #{_get_entity_name}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n end\n while json[\"entries\"] do\n page_num += 1\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n\n end\n return\n end\n end\n #exciption\n rescue JSON::ParserError => e\n _log_error \"Unable to parse JSON: #{e}\"\n end\n\n end",
"def parse_recipients(addresses)\n list_addresses = addresses.gsub(/[\\r\\n]+/, '').gsub(/(@((?:[-a-z0-9]+\\.)+[a-z]{2,})(\\>)?)\\,/i, '\\1'+\"\\n\")\n list_addresses.split(\"\\n\").map{|full_address|\n {'name' => extract_name(full_address), 'email' => extract_email_address(full_address)}\n }\n end",
"def email(emails = nil, use_map: true, user: nil)\n emails = user.email if emails.nil? && !user.nil?\n # Check the emails as supplied\n result = email_domain(emails)\n return result unless result.nil?\n # If no match was found, apply substitutions and check again\n emails = email_sub(emails)\n result = email_domain(emails)\n # If no match was found after substitutions, check against the email address map\n result = email_map(emails) if result.nil? && use_map\n # If there is still no match, take the first email in the list\n result = emails[0] if result.nil?\n # Return the result\n result\n end",
"def format_hash(entry_hash)\n formatted = {}\n entry_hash.each do |column, value|\n if column =~ /fname|lname|addr|city/\n formatted[column] = capitalize_items(value)\n elsif column == \"state\"\n formatted[column] = value.upcase\n else\n formatted[column] = value\n end\n end\n return formatted\nend",
"def combine_address_fields\n %w[to cc bcc].map do |field|\n hash_addresses(@mail[field])\n end\n end",
"def test_hash\n {\n \"orgID\"=>\"660\",\n \"orgAbout\"=>\"\",\n \"orgAdoptionProcess\"=>\"Adoption Fees are:$250 - Adults & $300 - Puppies. All are vetted, spay/neutered, microchipped and other known medical conditions addressed\",\n \"orgAdoptionUrl\"=>\"\",\n \"orgCommonapplicationAccept\"=>\"No\",\n \"orgDonationUrl\"=>\"\",\n \"orgEmail\"=>\"info@atdr.org\",\n \"orgFacebookUrl\"=>\"http://www.facebook.com/pages/All-Texas-Dachshund-Rescue-ATDR/55375608508\",\n \"orgFax\"=>\"\",\n \"orgLocation\"=>\"77584\",\n \"orgAddress\"=>\"P.O. Box 841336\",\n \"orgCity\"=>\"Pearland\",\n \"orgCountry\"=>\"United States\",\n \"orgPostalcode\"=>\"77584\",\n \"orgState\"=>\"TX\",\n \"orgPlus4\"=>\"\",\n \"orgMeetPets\"=>\"Visit us online at our website and Facebook page or at one of our events\",\n \"orgName\"=>\"All Texas Dachshund Rescue\",\n \"orgPhone\"=>\"\",\n \"orgServeAreas\"=>\"State of Texas including the Houston, DFW, Austin & San Antonio metroplexes\",\n \"orgServices\"=>\"Adoptions\",\n \"orgSponsorshipUrl\"=>\"\",\n \"orgType\"=>\"Rescue\",\n \"orgWebsiteUrl\"=>\"http://www.atdr.org\"\n }\n end",
"def hash\n [format, display_header, display_from_email_address, display_email_address, display_to_email_address, display_cc_email_address, display_bcc_email_address, time_zone_offset, convert_attachments, field_labels, preserve_original_date].hash\n end",
"def validate_person_hash(person_hash, email, attribute_hash)\n truth_array = []\n person = Person.where(email: email).first\n attribute_hash.each do |attribute_key, arrays|\n # the form_id branch checks both the submit date and form id\n if attribute_key.include?('submit_date')\n next\n end\n if attribute_key.include?('form_id')\n truth_array << validate_submission_form_arrays(person_hash, person)\n else\n truth_array << validate_attribute_for_person(attribute_key, person, arrays)\n end\n end\n !truth_array.include? false\n end",
"def hashes email\n text_with_hashes = \"\"\n entries = Entry.select(:text).uniq.where(:email => email).where(\"text LIKE ?\", \"%#%\")\n entries.each do |e|\n text_with_hashes += \" \" + e.text\n end\n\n return text_with_hashes.split(' ').delete_if {|a| !a.match('^#\\w+$') }.sort.uniq\n end",
"def send_mail(changed_watched_paths, hash, paths_by_users)\n \n # send one email for email address\n paths_by_users.keys.each do |user_email|\n subject=nil\n body=String.new @body_prefix\n \n # merge in the changed paths this user is interested in\n paths_by_users[user_email].each do |watched_path|\n \n if changed_watched_paths[watched_path]\n \n body << \"\\n\" << changed_watched_paths[watched_path].join(\"\\n\")\n # take any to generate the branch\n if !subject\n \n subject= String.new @subject_prefix\n subject << extract_branch(changed_watched_paths[watched_path])\n subject << \" by user \"\n subject << hash[:author]\n\t @logger.debug(\"Subject is=\"<< subject)\n end\n end \n end\n \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"revision: \" << hash[:rev]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n \n yield(user_email, subject, body)\n \n end\n end",
"def each_match(hash)\n line[:type, :all].count.times do |i|\n next unless hash.all? { |k, v| line[k, :all][i] == v }\n yield(\n :type => line[:type, :all][i],\n :ssn => line[:ssn, :all][i],\n :ein => line[:ein, :all][i],\n :amount => line[:amount, :all][i]\n )\n end\n end",
"def email_addresses_with_details(only_validated = false)\n\t\t# {'email@address'=>{:name=>'member name'},...}\n\t\t{}\n\tend",
"def extract_user_emails(user_fields, client)\n user_emails = []\n user_fields.each_index do |row|\n user_emails.push(user_fields[row][0])\n end\n user_emails\nend",
"def my_parse_recipients(mail)\n %W(to cc bcc).inject({}) do |acc, header|\n acc[header] = [mail.header[header]].flatten.collect {|address| address.to_s}\n acc\n end\n end",
"def email_service\n self.email_service = self.email.match(/\\A\\w+\\.?\\w*\\@{1}([a-z]+)\\.{1}[a-z]+\\z/).to_a[1]\n end",
"def email_array_assert(exp_val, inp_val)\n exp_hash = {}\n unless exp_val.nil?\n exp_hash['to'] = exp_val\n exp_hash['to'] = [EmailAddress.new(exp_val)] unless exp_val.is_a?(Array)\n if exp_val.is_a? Array\n exp_hash['to'] = []\n exp_val.each do |val|\n exp_hash['to'].push EmailAddress.new val\n end\n end\n end\n exp = expected_response exp_hash\n assert_equal exp, ApiParser.parse_email(nil, inp_val)\n end",
"def subscriber_hash(email)\n Digest::MD5.hexdigest(email.downcase) unless email.nil?\n end",
"def hash\n [id, type, state, country, street, postal_code, city, phone_country, phone_number, email, ip, address_description, identification_number, identification_type, lang, name, first_name, middle_name, last_name, birth_date, occupation, nationality, legal_entity_type, registration_date, registration_number, nature_of_business, source_of_funds, custom_source_of_funds, core_business_activity, purpose_of_opening_account, office_phone, vat_registration_number, financial_regulator, regulatory_licence_number, contact_person_email, trading_country, trading_address, trading_name, number_monthly_transactions, amount_monthly_transactions, documents, metadata, errors, onboarding_status, politically_exposed_people, external_id, city_of_birth, country_of_birth, gender, sales_lead_id, created_at, company_office_number, company_office_number_country, aml_officer_email, aml_officer_phone, aml_officer_phone_country, company_website_url, number_of_employees_in_company, list_of_countries_of_operation, estimated_annual_revenue_turnover, declaration].hash\n end",
"def txt_hash(alternate_host=nil)\n fields = {}\n record = self.txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n,v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end",
"def txt_hash(alternate_host = nil)\n fields = {}\n record = txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n, v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end",
"def check_email_hash\n if self.class.column_names.include?(\"email_hash\")\n if email_changed?\n require 'digest/md5'\n self.email_hash = Digest::MD5.hexdigest(self.email.to_s.downcase.strip)\n end\n end\n end",
"def assign_generated_mail_id\n if is_hr_or_info\n formatted_domain = website.gsub(/https:\\/\\/|http:\\/\\//, \"\").gsub(/www\\./, \"\")\n fname = first_name.gsub(/\\s/, \"\")\n lname = last_name.gsub(/\\s/, \"\")\n self.generated_mail_id1 = fname + \".\" + lname + \"@\" + formatted_domain\n self.generated_mail_id2 = lname + \".\" + fname + \"@\" + formatted_domain\n end\n end",
"def list_students\n #code here \n # First redo hash to list last name first\n # and format into array to get only name and email values\n s = []\n @students.each do |stu|\n \tn = ''\n stu.each do |k,v| \n # *** instead of this process stu[:name] & stu[:email] ***\n #puts \"**key = #{k}, value = #{v}\"\n if (k == :name) #want every other value (only names not emails)\n \tn = v.split(' ')\n tmp = n[0]\n n[0] = n[1]\n n[1] = tmp\n n = n.join(\" \")\n else\n #puts \"pushing #{n}, #{v}\"\n \t#s.push({name: n, email: v})\n \ts.push(n + \", \" + v)\n\t end\n end\n end\n\n #@students.reverse.sort_by {|n| n[:name] } #this sorts by 1st name given the original hash array\n return s.sort\nend",
"def lookup btc_address\n\t\t\t\t@report.each do |address|\n\t\t\t\t\tif address[0].eql?(btc_address)\n\t\t\t\t\t\tresult = {\n\t\t\t\t\t\t\t:address => address[0],\n\t\t\t\t\t\t\t:lastHourShares => address[1][\"lastHourShares\"],\n\t\t\t\t\t\t\t:immatureBalance => address[1][\"immatureBalance\"],\n\t\t\t\t\t\t\t:lastHourRejectedShares => address[1][\"lastHourRejectedShares\"],\n\t\t\t\t\t\t\t:paidOut => address[1][\"paidOut\"],\n\t\t\t\t\t\t\t:unexchangedBalance => address[1][\"unexchangedBalance\"],\n\t\t\t\t\t\t\t:megahashesPerSecond => address[1][\"megahashesPerSecond\"],\n\t\t\t\t\t\t\t:bitcoinBalance => address[1][\"bitcoinBalance\"],\n\t\t\t\t\t\t\t:rejectedMegahashesPerSecond => address[1][\"rejectedMegahashesPerSecond\"]\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn result\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\treturn nil\n\t\t\tend",
"def parse\n @email_parser = email_parser.scan(/\\w+@\\w+.\\w+/)\n @email_parser.uniq\n end",
"def get_org_address\n result = Hash.new\n\n #org = Organization.find_by_short_description(self.organization_code)\n #contact_method = ContactMethodsParty.find_by_party_name_and_contact_method_type_code(org.party.party_name,\"CARTON_LABEL_ADDRESS\").contact_method\n\n contact_method_id = ActiveRecord::Base.connection.select_one(\"select contact_method_id from contact_methods_parties where (party_name = '#{self.organization_code}' and contact_method_type_code = 'CARTON_LABEL_ADDRESS')\")\n\n\n if !contact_method_id\n result[:error] = \"You must define a contact method of type 'CARTON_LABEL_ADDRESS' for the marketing org(\" + self.organization_code + \")\"\n else\n\n contact_method = ActiveRecord::Base.connection.select_all(\"select * from contact_methods where id = #{contact_method_id['contact_method_id'].to_s}\")[0]\n\n address_1 = contact_method['contact_method_code']\n address_2 = contact_method['contact_method_description']\n if(address_1 == nil||address_2 == nil)\n result[:error] = \"You must define both address lines for the contact method of type: 'CARTON_LABEL_ADDRESS' for the marketing org(\" + self.organization_code + \")\"\n else\n result[:address1]= address_1\n result[:address2]= address_2\n end\n end\n return result\n end",
"def hash\n [marketplace_technical_code, account_id, beez_up_order_id, beez_up_order_url, marketplace_business_code, order_marketplace_order_id, order_status_beez_up_order_status, order_status_marketplace_order_status, order_merchant_order_id, order_merchant_e_commerce_software_name, order_merchant_e_commerce_software_version, order_purchase_utc_date, order_last_modification_utc_date, order_marketplace_last_modification_utc_date, order_buyer_name, order_total_price, order_currency_code, processing, etag, links, order_market_place_channel, order_total_tax, order_total_commission, order_payment_method, order_paying_utc_date, order_comment, order_shipping_civility, order_shipping_company_name, order_shipping_address_name, order_shipping_email, order_shipping_address_line1, order_shipping_address_line2, order_shipping_address_line3, order_shipping_address_postal_code, order_shipping_address_city, order_shipping_address_state_or_region, order_shipping_address_country_name, order_shipping_address_country_iso_code_alpha2, order_shipping_phone, order_shipping_mobile_phone, order_shipping_price, order_shipping_method, order_shipping_shipping_tax, order_shipping_earliest_ship_utc_date, order_shipping_latest_ship_utc_date, order_buyer_identifier, order_buyer_civility, order_buyer_company_name, order_buyer_email, order_buyer_address_line1, order_buyer_address_line2, order_buyer_address_line3, order_buyer_address_postal_code, order_buyer_address_city, order_buyer_address_state_or_region, order_buyer_address_country_name, order_buyer_address_country_iso_code_alpha2, order_buyer_phone, order_buyer_mobile_phone, order_order_source_uri, order_order_items_source_uri, order_items, transition_links].hash\n end",
"def parse_entities_hash(entity_hash_arrays)\n entity_hash_arrays.each do |entity_hash_array|\n \n ## Do an existance check first\n unless (entity_hash_array.has_key?(\"Entity\"))\n next\n end\n \n # Loop through each entity in the entities block\n (entity_hash_array[\"Entity\"]).each do |entity_hash|\n \n puts \"[DEBUG] Entity pulled from XML: #{entity_hash.inspect}\"\n \n # Select or Insect Entity\n puts \"Searching for entity #{entity_hash['title']}\"\n result = Entity.select_or_insert(@project_id, @section_id, entity_hash['title'])\n result.save\n puts \"Result: #{result.inspect}\"\n \n # Select or Insert EntityType\n if (entity_hash.has_key?(\"type\"))\n puts \"Searching for entity type #{entity_hash['type']}\"\n type_result = EntityType.select_or_insert(entity_hash['type'])\n type_result.save\n puts \"Result: #{type_result.inspect}\"\n \n puts \"Setting entity type for entity\"\n result.entity_type_id = type_result.id\n result.save \n puts \"Done.\" \n end\n \n ## Other fields???\n ## Description\n if (entity_hash.has_key?(\"description\")) \n ## TODO: if / when needed \n end\n ## Title\n if (entity_hash.has_key?(\"title\"))\n ## TODO: if/when needed\n end\n \n ## Logic for attributes\n if (entity_hash.has_key?(\"AdditionalField\"))\n (entity_hash[\"AdditionalField\"]).each do |add_field|\n field_name = add_field['name']\n field_value = add_field['value']\n puts \"[DEBUG] name: #{field_name} value: #{field_value}\"\n \n ## Insert attribute field if not exists\n puts \"[DEBUG] entity id: #{result.id}\"\n entity_field = PoortegoEntityField.select_or_insert(result.id, field_name)\n entity_field.save\n \n ## Set attribute field\n entity_field.update_attributes('value' => field_value)\n entity_field.save\n \n end\n end\n end\n end\n end",
"def set_email_parts(email)\n #If instance of EmailObject already has a value for email, then we're setting\n #another with another email format, append them accordingly.\n if @email.nil?\n @email = email\n @first_local_part = email[0..email.index(\".\") - 1].strip.downcase\n @last_local_part = email[email.index(\".\") + 1..email.index(\"@\") - 1].strip.downcase\n @domain = email[email.index(\"@\") + 1..email.length].strip.downcase\n else\n @email = @email + \" or \" + email\n @first_local_part = @first_local_part + \",\" + email[0..email.index(\".\") - 1].strip.downcase\n @last_local_part = @last_local_part + \",\" + email[email.index(\".\") + 1..email.index(\"@\") - 1].strip.downcase\n @domain = email[email.index(\"@\") + 1..email.length].strip.downcase\n end\n end",
"def email_in_name(thing)\n return unless thing.include?(\"@\")\n parts = thing.split(\" \")\n emails = parts.reject { |part| !part.include?(\"@\") }\n results = []\n Array(emails).each do |email|\n id = email.split('@')[0]\n results << (login_name(id) || results_hash(mail: [email]))\n end\n results\n end",
"def email_text_assert(exp_val, inp_val)\n exp_hash = {}\n unless exp_val.nil?\n exp_hash['from'] = exp_val\n exp_hash['from'] = EmailAddress.new exp_val unless exp_val.is_a? EmailAddress\n end\n exp = expected_response exp_hash\n assert_equal exp, ApiParser.parse_email(inp_val)\n end",
"def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end",
"def create_hash_city_email\n emails_mairies = []\n villes = get_city\n url_villes = get_link\n townhall_emails = get_townhall_email(url_villes)\n @global_list = Hash.new\n @global_list = Hash[villes.zip(townhall_emails)]\n return @global_list\n end",
"def itemForEmailBody(order_hash, item_hash)\n\t\ttmp_path = File.join(File.dirname(__FILE__), 'orders', order_hash[:order_number])\n\t\tfile_2_path = File.join(tmp_path, item_hash[:file_2])\n\t\t\n\t\tif !File.exist?(file_2_path)\n\t\t\titem_hash[:file_2] = \"none\" \n\t\tend\n\t\t\n\t\titem_body = <<EOM \nItemNum: #{item_hash[:item_number]}<br/>\nFile1: #{item_hash[:file_1]}<br/>\nFile2: #{item_hash[:file_2]}<br/>\nProductCode: #{item_hash[:product_code]}<br/>\nProductName: #{item_hash[:product_desc]}<br/>\nQuantity: #{item_hash[:quantity]}<br/>\nPaper: #{item_hash[:paper]}<br/>\nTrimSize: #{item_hash[:trim_size]}<br/>\nFinalSize: #{item_hash[:final_size]}<br/>\nScore: #{item_hash[:score]}<br/>\nColorProcess: #{item_hash[:color_process]}<br/>\nPickOutItem: #{item_hash[:pick_out_item]}<br/>\nUVCoating: #{item_hash[:uv_coating]}<br/>\nDrill: #{item_hash[:drill]}<br/>\n<br/>\nEOM\n\t\titem_body\n\tend",
"def send_email_through_data(gmail)\n gmail = gmail\n read_hash(gmail,read_json)\n end",
"def morning_email_3\n # improves on old method by calculating slow/inefficient cases by looking\n # at performance relative to average _and_ sandard deviations.\n\n # Gather all the commits, agnostic of what branch(es) they belong to\n # sort them all in order of most recent to oldest\n start_date = 1.day.ago\n commit_ids = TestInstance.where(created_at: start_date..DateTime.now)\n .pluck(:commit_id).uniq\n @commits_tested = Commit.includes(test_case_commits: :test_case).find(commit_ids)\n @commits_tested.sort! { |a, b| -(a.commit_time <=> b.commit_time) }\n\n # Assign commits to their various branches. A commit might belong to more\n # than one branch, and that's okay; it won't result in duplicate db hits\n # since they're already loaded\n branch_ids = BranchMembership.where(commit_id: commit_ids)\n .pluck(:branch_id).uniq\n @branch_data = {}\n branch_ids.each do |branch_id|\n this_branch = Branch.includes(:commits).find(branch_id)\n # sorting is the same as @commits_tested, but we only include commits\n # that are part of the branch.\n @branch_data[this_branch] = @commits_tested.select do |commit|\n this_branch.commits.include? commit\n end\n end\n\n # make sure the main is the first branch displayed, if at all\n @ordered_branches = @branch_data.keys\n main_loc = @ordered_branches.map(&:id).index(Branch.main.id)\n if main_loc\n @ordered_branches.insert(\n 0, @ordered_branches.delete(@ordered_branches[main_loc])\n )\n end\n\n @commit_data = {}\n\n @commits_tested.each do |commit|\n test_case_commits = commit.test_case_commits.to_a\n res = {}\n res[:status] = case commit.status\n when 3 then :mixed\n when 2 then :checksums\n when 1 then :failing\n when 0 then :passing\n else\n :other\n end\n res[:tested_count] = (commit.passed_count + commit.failed_count +\n commit.mixed_count + commit.checksum_count)\n res[:computer_counts] = { total: commit.computer_count }\n res[:failing_cases] = test_case_commits.select { |tcc| tcc.status == 1 }\n res[:checksum_cases] = test_case_commits.select { |tcc| tcc.status == 2 }\n res[:mixed_cases] = test_case_commits.select { |tcc| tcc.status == 3 }\n res[:pass_counts] = {}\n res[:fail_counts] = {}\n res[:checksum_counts] = {}\n\n test_case_commits.each do |tcc|\n res[:computer_counts][tcc] = tcc.computer_count\n res[:checksum_counts][tcc] = tcc.checksum_count if tcc.status >= 2\n if tcc.status >= 3\n res[:pass_counts][tcc] = tcc.test_instances.where(passed: true).count\n res[:fail_counts][tcc] = tcc.test_instances.where(passed: false).count\n end\n end\n\n @commit_data[commit] = res\n end\n @make_green = \"style='color: rgb(0, 153, 51)'\".html_safe\n @make_yellow = \"style= 'color: rgb(255, 153, 0)'\".html_safe\n @make_blue = \"style= 'color: rgb(78, 114, 219)'\".html_safe\n @make_red = \"style='color: rgb(204, 0, 0)'\".html_safe\n @make_cyan = \"style='color: rgb(79, 159, 181)'\".html_safe\n\n # set up countdown at top of the email\n @countdown_days = countdown_days\n @countdown_color = case countdown_color\n when :red then @make_red\n when :yellow then @make_yellow\n when :green then @make_green\n else\n nil \n end\n\n # set up issue count\n @release_blocker_count = nil\n @release_blocker_count = Commit.api.issues(Commit.repo_path,\n labels: 'release-blocker', state: 'open').length\n @release_blocker_color = if @release_blocker_count.zero?\n @make_green\n else\n @make_red\n end\n\n # send the message\n mail(to: 'mesa-developers@lists.mesastar.org, p7r3d3c7y5u1u9e8@mesadevelopers.slack.com',\n subject: \"MesaTestHub Report #{Date.today}\")\n end",
"def convert_emails(emails, used)\n legal_used = []\n emails.each do |em|\n legal_used << em if legal_emails.include? em\n end\n emails.map do |em|\n convert_if_not_production(em, used, legal_used)\n end\n end",
"def hash_details\n hash_value = params[:value]\n sql = VerificationHash.where(hash_value: hash_value).select(:email).select(\"CASE WHEN entity_type='PropertyBuyer' THEN 'Buyer' WHEN entity_type='Agents::Branches::AssignedAgent' THEN 'Agent' WHEN entity_type='Developer' THEN 'Developer' ELSE 'Vendor' END as entity_type \").to_sql\n details = ActiveRecord::Base.connection.execute(sql)\n if details.first['entity_type'] == 'Agent'\n is_agent = Agents::Branches::AssignedAgent.unscope(where: :is_developer).where(is_developer: true, email: details.first['email']).last.nil?\n details.first['entity_type'] = 'Developer' if !is_agent\n end\n render json: { hash_details: details }, status: 200\n end",
"def create_team_by_email_index\n @data['private']['team'].each do |i|\n @team_by_email[i['email']] = i['name'] if i.member? 'email'\n end\n end",
"def joinData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"where\" => arr[2][1..-1]}\n end",
"def captureurlmail #capture url des villes du 95\r\nurl2 = \"http://www.annuaire-des-mairies.com/val-d-oise.html\"\r\ndoc2 = Nokogiri::HTML(open(url2))\r\nadresse2 = doc2.css('.lientxt')\r\nnoms = []\r\nvilles = []\r\nemails = []\r\nadresse2.each do |link|\r\n\t#noms.push(url2 + (link['href'][1..-1]))\r\n\tp=\"http://www.annuaire-des-mairies.com\"\t\r\n\t#puts link['href'][1..-1]\r\n\tp+=link['href'][1..-1]\r\n\tnoms << p\r\n\tq=link['href'][1..-1]\r\n\tr=q.split('/')\r\n\ts=r[2]\r\n\tt=s.split('.')\t\t\r\n\tville=t[0]\r\n\tvilles << ville\t\r\nend\r\nnoms.each do |adresse|\r\n\tdoc3 = Nokogiri::HTML(open(adresse))\r\n\tadresse3 = doc3.css(\".txt-primary\")[3].text.split(\" \")[2]\r\n\tif ['@'].include?(adresse3) == true\r\n\t\temails << adresse3.to_s\r\n\telse\r\n\t\temails << nil\r\n\tend\r\n\t\r\nend\r\n\r\nHash[villes.zip(emails)].each do |ville,email|\r\n\tputs ville+\" => \"+email\r\n#my_hash=Hash[villes.zip(emails)]\r\n#return my_hash(ville_entree)\r\nend\r\nend",
"def contact_emails_attributes=(emails)\n attributes_collection = emails.is_a?(Hash) ? emails.values : emails\n self.contact_emails = attributes_collection.map {|e| e['email']}.reject(&:blank?)\n end",
"def primary_email\n primary_contacts(emails, :email_rank_code, &:first)\n end",
"def email(emails = nil, use_map: true)\n return nil if emails.nil? || emails.empty?\n # Check the emails as supplied\n result = map(emails, use_map) || domain(emails)\n return result unless result.nil?\n # Check the emails after substitutions.\n # Return the first email in the list if mo domain or map match is found.\n emails = substitutions(emails)\n map(emails, use_map) || domain(emails) || emails[0]\n end",
"def to_hash\n\n json = {\n :from => @from_email_address.to_hash\n }\n\n unless @subject.nil? || @subject.empty?\n json[:subject] = @subject\n end\n\n unless @html_body.nil? || @html_body.empty?\n json[:htmlBody] = @html_body\n end\n\n unless @amp_body.nil? || @amp_body.empty?\n json[:ampBody] = @amp_body\n end\n\n unless @plain_text_body.nil? || @plain_text_body.empty?\n json[:textBody] = @plain_text_body\n end\n\n unless @api_template.nil?\n json[:apiTemplate] = @api_template\n end\n\n unless @mailing_id.nil? || @mailing_id.empty?\n json[:mailingId] = @mailing_id\n end\n\n unless @message_id.nil? || @message_id.empty?\n json[:messageId] = @message_id\n end\n\n unless @reply_to.nil?\n json[:replyTo] = @reply_to.to_hash\n end\n\n unless @charset.nil? || @charset.empty?\n json[:charSet] = @charset\n end\n\n unless @to_email_address.nil? || @to_email_address.length == 0\n e = Array.new\n @to_email_address.each do |value|\n e.push(value.to_hash)\n end\n json[:to] = e\n end\n\n unless @cc_email_address.nil? || @cc_email_address.length == 0\n e = Array.new\n @cc_email_address.each do |value|\n e.push(value.to_hash)\n end\n json[:cc] = e\n end\n\n unless @bcc_email_address.nil? || @bcc_email_address.length == 0\n e = Array.new\n @bcc_email_address.each do |value|\n e.push(value.to_hash)\n end\n json[:bcc] = e\n end\n\n unless @custom_headers.nil? || @custom_headers.length == 0\n e = Array.new\n @custom_headers.each do |value|\n e.push(value.to_hash)\n end\n json[:customHeaders] = e\n end\n\n unless @attachments.nil? || @attachments.length == 0\n e = Array.new\n @attachments.each do |value|\n e.push(value.to_hash)\n end\n json[:attachments] = e\n end\n\n unless @merge_data.nil? || @merge_data.empty\n json[:mergeData] = @merge_data.to_hash\n end\n\n json\n\n end",
"def email(value)\n merge(email: value.to_s)\n end",
"def email_kyc_deny(data_to_format)\n {}\n end",
"def parse\n # emails = email_parser.scan(/\\w+@\\w+.\\w+/).uniq\n @emails.scan(/\\w+@\\w+.\\w+/).uniq\n end",
"def parse_phonefax(table_cells)\n type = [\"Phone\\:\", \"Fax\\:\"]\n complete_data = {}\n type.each do |data|\n table_cells.each_with_index do |cell, index|\n if cell.children.to_s.match(data)\n table_cells_match = table_cells[index+1].children[1]\n if cell.children.to_s.match(\"Hablamos Español\")\n complete_data.merge! ({ data.to_s.strip.gsub(/\\n/, '').gsub(/\\t/, '').to_sym => table_cells_match.children[0].to_s.gsub(/\\n/, '').gsub(/\\t/, '') + \"Hablamos Español. Landlord can accept Spanish-language phone calls.\"})\n else\n complete_data.merge! ({ data.to_s.strip.gsub(/\\n/, '').gsub(/\\t/, '').to_sym => table_cells_match.children[0].to_s.gsub(/\\n/, '').gsub(/\\t/, '')})\n end\n end\n end\nend\n complete_data\nend",
"def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <mailgun@sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end",
"def hash\n [accounts_date, reporting_period, currency, consolidated_accounts, audit_qualification, number_of_employees, turnover, cost_of_sales, sga_plus_other_net_costs, operating_profit, interest_receivable, interest_payable, pre_tax_profit, taxation, post_tax_profit, dividends_payable, retained_profits, intangible_assets, tangible_assets, investments_and_other_assets, fixed_assets, stock, trade_debtors, other_debtors, miscellaneous_current_assets, cash, current_assets, total_assets, bank_loans_and_overdrafts, trade_creditors, miscellaneous_current_liabilities, other_short_term_finances, current_liabilities, contingent_liabilities, other_long_term_finances, total_long_term_liabilities, total_liabilities, net_assets, equity_paid_up, revaluation_reserve, sundry_reserves, profit_and_loss_account_reserve, shareholder_funds, depreciation, amortisation_of_intangibles, ebitda, working_capital, capital_employed, wages_and_salaries, directors_emoluments, audit_fees, bank_overdraft_and_long_term_loans, net_cash_flow_from_operations, net_cash_flow_before_financing, net_cash_flow_from_financing, increase_in_cash, debtor_days, exports, gross_margin_percentage, operating_profit_margin_percentage, ebitda_margin_percentage, pre_tax_profit_margin_percentage, net_margin_percentage, return_on_assets_percentage, return_on_capital_employed_percentage, return_on_equity, current_ratio, cash_to_current_liabilities_ratio, cash_to_total_assets_percentage, liquidity_ratio, gearing_percentage_on_liability_basis, gearing_percentage_on_gross_debt_basis, gearing_percentage_on_net_debt_basis, debt_to_capital_percentage, inventory_turnover_ratio, cash_to_turnover_ratio, cash_to_turnover_percentage, days_inventory_outstanding, days_sales_outstanding, days_payable_outstanding, cash_conversion_cycle, revenue_per_employee, human_capital_value_added, interest_coverage_ratio, net_debt_to_ebitda_ratio, cfo_to_sales_ratio, auditor, joint_auditor, solicitor, accountant].hash\n end",
"def get_townhall_mail(full_url, name, array_final)\n general_townhall = Nokogiri::HTML(open(full_url))\n townhall_mail = general_townhall.at('td:contains(\"@\")').text.strip\n array_final << {name => townhall_mail}\nend",
"def hash\n [ticker, company_name, industry_group_number, industry_group_name, fiscal_year_0, fiscal_year_1, fiscal_year_2, company_last_5_year_actual, company_fiscal_year_1_vs_fiscal_year_0, company_fiscal_year_2_vs_fiscal_year_1, company_long_term_growth_mean, company_fiscal_year_1_forward_price_to_earnings, industry_last_5_year_actual, industry_fiscal_year_1_vs_fiscal_year_0, industry_fiscal_year_2_vs_fiscal_year_1, industry_long_term_growth_mean, industry_fiscal_year_1_forward_price_to_earnings, sp500_last_5_year_actual, sp500_fiscal_year_1_vs_fiscal_year_0, sp500_fiscal_year_2_vs_fiscal_year_1, sp500_long_term_growth, sp500_fiscal_year_1_price_to_earnings, company].hash\n end",
"def test_feetToMeters\n\t\temail = EmailLogMain.new\n\t\temailHash = email.makeHash\n\t\temailString = emailHash[\"B6C161B2004\"]\n\n# START OF TESTING!\n\t\tassert(true,File.exist?(email.getFileName))\n#Checks if our regular expressions find the correct items needed for our report\n\t\tassert_equal(\"20131211132505.999FB1B2003@toilers.Mines.EDU\",email.RegexExist(\"messageid\",emailString))#Messageid\n\t\tassert_equal(\"echopper@mines.edu\", email.RegexExist(\"to\",emailString)) #to email\n\t\tassert_equal(\"root@toilers.Mines.EDU\",email.RegexExist(\"from\",emailString)) #from email\n\t\tassert_equal(\"6072\",email.RegexExist(\"size\",emailString))#size\n\t\tassert_equal(\"B6C161B2004\",email.RegexExist(\"uniqueid\",emailString)) #uniqueID\n\n#This test will show how many reg expression this program finds for each item\n\t\tassert_equal(3, emailString.scan(@@TO_REGEX).size) #to email\n\t\tassert_equal(1, emailString.scan(@@MESSAGE_ID_REGEX).size) #messageid\n\t\tassert_equal(1, emailString.scan(@@SIZE_REGEX).size) #size\n\t\tassert_equal(6, emailString.scan(@@TIMESTAMP_REGEX).size) #Time\n\t\tassert_equal(1, emailString.scan(@@FROM_REGEX).size) #from email\n\t\tassert_equal(6, emailString.scan(@@UNIQUE_ID).size) #uniqueID\n\n\t\t#This test will check for the correct ammount of emails since every email has a unique message ID \n\t\t#Messageid == total number of email i.e. the size of our hash\t\t\n\t\tholdEntireString = IO.read(email.getFileName)\n\t\tassert_equal(emailHash.length, holdEntireString.scan(@@MESSAGE_ID_REGEX).size)\n\tend"
] | [
"0.5980221",
"0.5902993",
"0.5503901",
"0.54622376",
"0.5426123",
"0.5385771",
"0.53739285",
"0.53543955",
"0.53529567",
"0.534108",
"0.5340184",
"0.5290035",
"0.5247238",
"0.5213672",
"0.5188327",
"0.51502",
"0.50781226",
"0.5064934",
"0.50607044",
"0.5059193",
"0.5049328",
"0.50463206",
"0.5046127",
"0.5028304",
"0.50140893",
"0.5009616",
"0.5009093",
"0.4996173",
"0.49827847",
"0.49783605",
"0.49693027",
"0.496534",
"0.49612764",
"0.49609873",
"0.49521348",
"0.49462396",
"0.49225992",
"0.49202982",
"0.4907783",
"0.49020565",
"0.4900115",
"0.4896245",
"0.48901093",
"0.488999",
"0.4888721",
"0.48815832",
"0.48809442",
"0.48639995",
"0.48625702",
"0.4861042",
"0.48481148",
"0.48427185",
"0.4839055",
"0.48283818",
"0.4819441",
"0.48084897",
"0.48080564",
"0.4805926",
"0.47977948",
"0.4765893",
"0.47603753",
"0.47517425",
"0.4727516",
"0.4725874",
"0.47209585",
"0.4720148",
"0.47067717",
"0.47048613",
"0.47032544",
"0.46955985",
"0.46881735",
"0.46864164",
"0.46815103",
"0.46779832",
"0.4671083",
"0.4669714",
"0.46695918",
"0.4668009",
"0.46666577",
"0.4664703",
"0.46622843",
"0.46601728",
"0.46496084",
"0.46490353",
"0.46479943",
"0.46468034",
"0.46459422",
"0.4636522",
"0.46363422",
"0.46222833",
"0.46028823",
"0.4598528",
"0.45977122",
"0.45871434",
"0.4579888",
"0.45794588",
"0.4576352",
"0.45720795",
"0.45717904",
"0.45704153"
] | 0.7308328 | 0 |
Returns map of word to ending position of word in input. | def substrings(words, input)
result = Hash.new {|h,k| h[k] = Set.new}
l = input.length
words.each do |word|
i = 0
while i + word.length <= l
j = input.index(word, i)
break if ! j
result[word] << j + word.length
i = j + 1
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word_end_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=\\p{Word})[^\\p{Word}]/)\n wsmarks = wsmarks.collect { |x| x + startpos - 1 }\n return wsmarks\n end",
"def word_break(s, dict)\n indices = {}\n\n for i in 0..dict.length-1\n pos = s.index(dict[i])\n indices[dict[i]] = pos\n end\n\n pos = 0\n \nend",
"def build_maps\n\t\t@start_map = {}\n\t\t@end_map = {}\n\t\t[*\"a\"..\"z\"].each{ |l|\n\t\t\t@start_map[ l ] = 0\n\t\t\t@end_map[ l ] = 0\n\t\t}\n\t\t\n\t\t@sorted_list.each {|word|\n\t\t\tfirst_letter = word[0]\n\t\t\tlast_letter = word[word.length-1]\n\n\t\t\t@start_map[ first_letter ] += 1\n\t\t\t@end_map[ last_letter ] += 1\n\t\t}\n end",
"def known_edits2 (word)\n # get every possible distance - 2 edit of the input word. Return those that are in the dictionary.\n end",
"def pos_breakdown(word)\n pos_code(word).chars.to_a.map {|c| pos_code_map[c] }\n end",
"def find_position(pass) = pass.gsub(/./, {\n FRONT => 0,\n LEFT => 0,\n BACK => 1,\n RIGHT => 1\n}).to_i(2)",
"def create_index2(word)\n word.each_char.map {|c| CHAR_MAP[c.downcase]}.reduce(:*)\n end",
"def get_word_start_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=[^\\p{Word}])\\p{Word}/)\n wsmarks = wsmarks.collect { |x| x + startpos }\n return wsmarks\n end",
"def word_end_pos(from: @cursor)\n end_pos = @text.index(separator, from) || text_size\n end_pos -= 1 unless @text.empty?\n end_pos\n end",
"def get_pos_of(word, tokens)\n pos = 0\n tokens.each do |w|\n if w == word then\n return pos\n else\n pos += 1\n end\n end\n return -1\nend",
"def test_9_return_positions_of_letter_in_word\r\n $word = \"repeated\"\r\n letter = \"e\"\r\n results = find_locations(letter)\r\n assert_equal([1, 3, 6], results)\r\n end",
"def find_guess_position(needle)\n get_index = lambda { |character, index| index if character == needle }\n indexes = @secret_word.split(\"\").map.with_index(&get_index).reject { |c| c.nil? }\n end",
"def char_indices(str)\n place = Hash.new { |place, k| place[k] = [] }\n\n str.each_char.with_index do |char, i|\n place[char] << i\n end\n\n place\nend",
"def input_end_offset\n _response_word.fetch(\"endingPos\", nil)\n end",
"def find_locations(letter)\n locations = [] # array for the index (position) of all instances of the letter in the word\n last_index = 0 # dual-purpose variable that holds the index (position) of the letter and the .index offset\n occurrences = $word.count letter # variable used to control do loop iteration count\n occurrences.times do # for every occurrence of the letter in the word\n last_index = $word.index(letter, last_index) # determine the position of the letter in the word\n locations.push(last_index) # push the position of the letter to the location array\n last_index += 1 # increment last_index by 1 to target the next occurrence of the letter (via .index offset)\n end\n add_letter(letter, locations) # pass the user-specified letter and array of locations to add_letter()\n # return locations # use for test 15\nend",
"def neighbors_by_substitution(word)\n word.split_around_each_char.lazy\n .flat_map do |prefix, char_to_substitute, suffix|\n get(prefix).lazy\n .reject do |substitution_possibility, _|\n substitution_possibility == char_to_substitute\n end\n .select do |_, substitution_possibility_subtree|\n # I'd usually use #try here but the instructions specify that I\n # can't include ant ActiveSupport functions.\n substitution_possibility_subtree &&\n substitution_possibility_subtree.contains?(suffix)\n end\n .map do |substitution_possibility, _|\n prefix + substitution_possibility + suffix\n end\n end\n end",
"def declare(map, start, string)\n count = start\n string.split(\" \").each do |token|\n map[token] = count\n count += 1\n end\nend",
"def longest_substring_positions\n return [nil,nil] if empty?\n\n s = longest_substring\n initial = self.index(s)\n [initial, initial+s.length]\n end",
"def get_word_ladder(start_word, end_word)\n unless Lexicon.is_word?(end_word)\n puts \"end_world is not a valid word\"\n exit\n end\n\n unless start_word.length == end_word.length\n puts \"end_world is not the same length as start_word\"\n exit\n end\n\n bfsHash = {}\n visited = {}\n ans = []\n queue = Queue.new\n\n queue << start_word.dup\n start_word_cpy = start_word.dup\n while !queue.empty?\n word = queue.pop\n start_word = word.dup\n bfsHash[word] = Set.new\n (0..start_word.length-1).each do |i|\n (\"a\"..\"z\").each do |letter|\n start_word[i] = letter\n if Lexicon.is_word?(start_word) and start_word != word\n bfsHash[word] << start_word.dup if visited[start_word] == nil\n queue << start_word.dup if visited[start_word] == nil\n visited[start_word] = word if visited[start_word] == nil\n end\n\n break if start_word == end_word\n\n end\n break if start_word == end_word\n start_word = word.dup\n end\n break if start_word == end_word\n end\n\n while visited[start_word] != start_word_cpy\n ans << visited[start_word].dup\n start_word = visited[start_word].dup\n end\n \n start_word = start_word_cpy\n ans.reverse\n end",
"def mapping(stringToSplit)\n arrSplit = stringToSplit.scan /\\w/\n return arrSplit.map { |n| n.ord }\nend",
"def compute_freq_map(str)\n # OPTIMIZATION IDEA: Make this function also be able to determine if the curr_freq_map matches the last_freq_map\n freq_map = {}\n str.each_char do |char|\n if freq_map[char]\n freq_map[char] += 1\n else\n freq_map[char] = 1\n end\n end\n return freq_map\nend",
"def pos_code(word)\n pos[word]\n end",
"def word_map(lines)\n words = []\n lines.each_with_index do |s, i|\n words[i] = []\n start = -1\n word = ''\n in_word = false\n (s + '|').each_char.each_with_index do |c, j|\n if in_word\n if '.?!*|'.include?(c)\n words[i][start] = word\n words[i][j-1] = word\n in_word = false\n else\n word << c\n end\n else\n unless '.?!*|'.include?(c)\n in_word = true\n word = c\n start = j\n end\n end\n end\n end\n words\n end",
"def substrings(word, dictionary)\n\tresult = Hash.new(0)\t\t\t# constructor passed a 0 makes 0 the default return value for non-exist keys\n\n\tdictionary.each do |w|\n\t\tfor i in 0..word.length-1\n\t\t\tresult[w] += 1 if word[i..word.length-1] == w \t\t\t\t\n\t\tend\n\tend\n\tresult\nend",
"def hash_char_positions\n [].tap do |results|\n @lines.each.with_index do |line, line_idx|\n line.enum_for(:scan, /#/).each do\n results << [line_idx, Regexp.last_match.begin(0)]\n end\n end\n end\n end",
"def letter_index(letter)\n @places = []\n @split_word.each_with_index do |char, index|\n if char == letter\n @places << index\n end\n end\n end",
"def find_ladders(begin_word, end_word, word_list)\n word_list = create_dictionary(word_list)\n queue = [[begin_word, 1, {}, [begin_word]]]\n paths = []\n min_count = nil\n \n until queue.empty?\n word, count, visited, path = queue.shift\n\n (0...word.length).each do |idx|\n sliced = word[0...idx] + \"_\" + word[idx + 1..-1]\n\n word_list[sliced].each do |w|\n if !visited[w]\n current_visited = visited.dup\n current_path = path.dup\n current_visited[w] = true\n current_path << w\n queue << [w, count + 1, current_visited, current_path]\n\n if w == end_word && !min_count\n min_count = count + 1\n paths << current_path\n elsif w == end_word && min_count == count + 1\n paths << current_path\n end\n end\n end\n end\n end\n\n paths\nend",
"def solve(words, letters)\n hash = Hash.new(0)\n hash2 = Hash.new(0)\n letters.each_char do |char|\n hash[char] += 1\n end\n \n longest = 0\n \n words.each_with_index do |word, idx|\n word.each_char.with_index do |char, idx|\n if !hash[char] || hash[char] <= 0\n next\n end\n if hash[char] > 0\n hash[char] -= 1\n end\n end\n \n end\n return longest\nend",
"def adjacent_words(word)\n same_length = @dictionary.select { |dict_word| dict_word.length == word.length }\n\n adj_words = []\n\n word.each_char.with_index do |char, idx|\n same_length.each do |length_word|\n if length_word[0...idx] + length_word[idx+1..-1] == word[0...idx] + word[idx+1..-1]\n adj_words << length_word\n end\n end\n end\n\n adj_words\n end",
"def substrings(phrase, dictionary)\n dictionary.reduce(Hash.new(0)) do |map, word| \n map[word] += phrase.upcase.scan(word.upcase).length if phrase.upcase.include?(word.upcase)\n map\n end\nend",
"def known_edits2 (word)\n # get every possible distance - 2 edit of the input word. Return those that are in the dictionary.\n words1 = edits1(word)\n words2 = []\n words1.each do |w|\n words2.concat(edits1(w))\n end\n return known(words2.uniq)\n end",
"def char_indices(str)\n solved = Hash.new() { |h, k| h[k] = [] }\n str.each_char.with_index do |char, i|\n solved[char] << i\n end\n solved\nend",
"def substring_offsets(sub)\n offsets = @index[sub[0]]\n i = 0\n\n while offsets.size > 0 && i < sub.size do\n offsets = offsets.select { |j| j < @str.size && @str[j] == sub[i] }.map!(&:succ)\n i += 1\n end\n\n i == sub.size ? offsets.map! { |j| j - sub.size } : []\n end",
"def scan_for_index_start_and_end(code, regex)\n res = []\n code.scan(regex) do\n res << {starts: Regexp.last_match.offset(0).first,\n ends: Regexp.last_match.offset(0).last}\n end\n res\nend",
"def upwards word\n\treturn word[1..-1]+word[0]\nend",
"def translate(text)\n mapping = [\"abc\", \"def\", \"ghi\", \"jkl\", \"mno\", \"pqrs\", \"tuv\", \"wxyz\"]\n text.chars.map do |c|\n match = mapping.find_index { |s| s.include?(c.downcase) }\n match ? (match + 2) : c\n end.join\nend",
"def compare_strings(input_text, dictionary_word)\n for i in 0..input_text.length - 1 do\n if input_text.length - i >= dictionary_word.length\n j = i + dictionary_word.length - 1\n arr = input_text.slice(i..j)\n if arr.eql?(dictionary_word)\n @output_hash = update_output_hash(arr, @output_hash)\n end\n end\n end\nend",
"def word_count\n result = { }\n words = @input.downcase.split(/[,\\s]/)\n words.each do |word|\n next if word.empty?\n word.gsub!(/\\W/, '') unless word.include?(\"'t\")\n\n if !result.key?(word)\n # puts \"new key: #{word}\"\n result[word] = 1\n else\n # puts \"Accumulating on #{word}: #{result[word]} + 1\n result[word] += 1\n end\n end\n result\n end",
"def word_to_digit(words)\n hash ={\n 'zero' => \"0\",\n 'one' => \"1\",\n 'two' => \"2\",\n 'three' => \"3\",\n 'four' => \"4\",\n 'five' => \"5\",\n 'six' => \"6\",\n 'seven' => \"7\",\n 'eight' => \"8\",\n 'nine' => \"9\"\n }\n# #words.delete(\".\").split(\" \").each{|s| words.gsub!(s, hash[s]) if hash.keys.include?(s)}\n# #WORK OF A GINIUS!!!!!!!\n words.split(/\\b/).map { |word| hash[word] || word }.join(\" \")\n return words\nend",
"def word_lengths(str)\n ans = Hash.new\n str.split.each do |word|\n ans[word] = word.length\n end\n ans\nend",
"def find_start_and_end(move)\n mv_start = move[0..1].split('')\n mv_end = move[3..4].split('')\n\n start_row = 8 - mv_start[1].to_i\n start_col = @@horizontal_key[mv_start[0].downcase]\n start_location = [start_row, start_col]\n\n end_row = 8 - mv_end[1].to_i\n end_col = @@horizontal_key[mv_end[0].downcase]\n end_location = [end_row, end_col]\n\n [start_location, end_location]\n end",
"def get_word( letter )\n\t\t# Try to find a word that starts with parameter\n\t\tword = @sorted_list.select{|l| l[0] == letter ? true : false }[0]\n\t\t# If no luck, pass nil back up\n\t\treturn nil if word == nil\n\t\t\n\t\t#TODO:appen || lenght\n\t\t@sorted_list.delete_at( @sorted_list.index( word ) )\n\n\t\t# Update the start/end counts in the maps\n\t\t@start_map[letter] -= 1\n\t\t@end_map[ word[word.length-1] ] -= 1\n\t\tputs \"next word is #{word}\"\n\t\t\n\t\treturn word\n end",
"def getrange(key, start, stop); end",
"def getrange(key, start, stop); end",
"def vowel_indices(word)\n word.enum_for(:scan, /[aeiouy]/i).map { Regexp.last_match.offset(0).first + 1 }\nend",
"def substrings(string, dictionary)\r\n\tresult = Hash.new(0)\r\n\tarr = string.downcase.split(\" \")\r\n\tarr.each do |word|\r\n\t\tdictionary.each do |sub|\r\n\t\t\tresult[sub] += 1 if word[sub]\r\n\t\tend\r\n\tend\r\n\tresult\r\nend",
"def word_lengths(str)\n hash = {}\n str.split.each do |word|\n hash[word] = word.length\n end\n hash\nend",
"def word_lengths(str)\n str.split.reduce({}) do |acc, word|\n acc[word] = word.length\n acc\n end\nend",
"def all_neighbords(base_word)\n \n matches = four_letter_words.select do |match_word|\n are_neighbors?(base_word, match_word)\n end \n\n return matches\n \nend",
"def to_offset(text, position); end",
"def word_lengths(str)\n result = {}\n str.split.each {|word| result[word] = word.length}\n result\nend",
"def finalize_pos word, pos\n final_pos = word_pos_cache.get_or_set(word) do\n doublecheck = wordpos_lookup(word)\n if ['noun', 'verb'].none? &doublecheck.m(:include?)\n finalize_engtagger_pos(pos)\n else\n finalize_wordpos_pos(pos)\n end\n end\n save_proc(final_pos, word)\n { word: word, pos: [final_pos] }\n end",
"def first_pos(string)\n\tanswer = Hash.new\n\n\tarray = string.split(' ')\n\n\tarray.each do |x|\n\t answer[x] = array.index(x)\n end\n answer\nend",
"def old_e_words(str)\n words = str.split\n count = 0\n\n words.each do |word|\n count += 1 if word[-1] == \"e\"\n end\n\n count\nend",
"def input_to_index(position)\nindex = position.strip.to_i - 1\nreturn index\nend",
"def e_words(str)\n str.split.reduce(0) do |count, word|\n if word[-1] == \"e\"\n count + 1\n else\n count # return existing count from block so count isn't reassigned to nil\n end\n end\nend",
"def bvi(word, n)\n p = 0\n word.reverse.chars.each.with_index do |c, i|\n p += 1 if $serhljodar.include?(c)\n return (word.length - i) - 1 if p == n\n end\n return -1\nend",
"def substrings(word, dict)\n count = Hash.new(0)\n\n (0...word.length).each do |start_idx|\n (start_idx...word.length).each do |end_idx|\n found = word[start_idx..end_idx].downcase\n if dict.include?(found)\n count[found] += 1\n end\n end\n end\n count.sort_by{ |k| k }.to_h\nend",
"def last_index(str, char)\n\tarr = str.split(\"\")\n \tarr2 = []\n \t# print arr\n \tarr.map.with_index do |letter, i|\n \tif letter == char\n \tarr2 << i\n end\n end\n \tputs\n \treturn arr2[-1]\nend",
"def word_sizes(str)\n hash = {}\n idx = 0\n\n loop do \n break if idx == (str.split.size)\n word = str.split[idx]\n hash[word.size] = 0 unless hash.keys.include?(word.size)\n hash[word.size] += 1\n idx += 1\n end\n\n hash\nend",
"def word_count\n word_map = {}\n words.each {|word| word_map[word] = words.count(word) }\n word_map\n end",
"def find_indices\n puts \"Tell me\"\n input = gets.chomp\n result = input.scan(/\\w/)\n hash = Hash.new\n result.each_with_index do |char, index|\n hash[char] = index\n end\n p hash\nend",
"def position_index(position)\n index = self.mapping(:type => :canonical).each.\n with_index do |suffix_with_position,suffix_index|\n suffix_position = suffix_with_position[1]\n if position.size == suffix_position.first.size &&\n suffix_position.include?(position)\n break suffix_index\n end\n end\n index.is_a?(Fixnum) ? index : nil\n end",
"def high(string)\n letter_scores = ('a'..'z').to_a\n words = string.split\n\n word_scores = words.map do |word|\n score = 0\n word.chars.each { |char| score += letter_scores.index(char}\n score \n end\n words[word_scores.index(word_scores.max)]\nend",
"def letter_counter(string)\n hash = {}\n string.split.each do |word|\n if hash.has_key?(word.size)\n hash[word.size] += 1\n else \n hash[word.size] = 1\n end\n end\n hash\nend",
"def substrings_offsets(subs)\n subs.each_with_object({}) { |sub, res| res[sub] = substring_offsets(sub) }\n end",
"def length_finder(words)\n lengths = {}\n words.each do |word|\n lengths[word] = word.length\n end\n lengths.values\nend",
"def high(x)\n x.split[high_word_position(x)]\nend",
"def closest_repeat(string)\n min_dist = nil\n closest_repeated_word = nil \n most_recent = {}\n pair_indices = nil\n \n string.split(\" \").each_with_index do |word, i|\n if most_recent[word]\n last_instance = most_recent[word]\n test_dist = i - last_instance\n\n if min_dist.nil? || test_dist < min_dist\n closest_repeated_word = word\n min_dist = test_dist\n pair_indices = [last_instance, i]\n end\n end\n \n most_recent[word] = i \n end\n \n\n [closest_repeated_word, pair_indices]\nend",
"def longest_two_words(string)\n\n hsh = Hash.new # created hash-table as accumulator\n words = string.split # words split into an array\n\n words.each_index do |i| # data (word:length) structured to hsh\n word = words[i].delete('.,')\n hsh[word] = word.length\n end\n # finding of two longest words\n wrd1, wrd2 = \"\", \"\"\n val1, val2 = 0, 0\n\n hsh.each do |wrd, val|\n\n if val >= val2\n wrd2, wrd1 = wrd, wrd2\n val2, val1 = val, val2\n elsif val >= val1\n wrd1 = wrd\n val1 = val\n end\n\n end\n # result\n [wrd1, wrd2]\nend",
"def adjacent_words(word)\n one_letter_off = []\n (word.length - 1).times do |i|\n dup_word = word.dup\n dup_word[i] = \".\"\n one_letter_off += @dictionary.select {|word| word =~ (/\\A#{dup_word}\\z/) }\n end\n one_letter_off\n end",
"def length_of_longest_substring_2(s)\r\n return 0 if s == \"\"\r\n result = 0\r\n chars = s.chars\r\n hash = Hash.new\r\n left, right = 0, 0\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n\r\n while right < chars.size\r\n result = [right - left + 1, result].max\r\n\r\n if hash.has_key?(chars[right + 1]) && left != right\r\n # Process the window\r\n hash.delete(chars[left])\r\n left += 1\r\n elsif !hash.has_key?(chars[right + 1])\r\n # Expand the window\r\n right += 1\r\n else\r\n # Move the window\r\n right += 1\r\n left += 1\r\n end\r\n\r\n # Update hash\r\n hash[chars[right]] = right\r\n hash[chars[left]] = left\r\n end\r\n\r\n result\r\nend",
"def substrings(input, dictionary)\n\thash = {}\t\t\t\t\t# Initialize empty hash\n\tdictionary.each do |word|\n\t\t# For each word, count the number of times it appears\n\t\tcount = input.downcase.scan(word.downcase).length\n\t\tif count > 0\n\t\t\t# If greater than 0:\n\t\t\thash[word] = count\t# Add word => count to hash\n\t\tend\n\tend\n\thash\nend",
"def most_recently_found_word\n i = index_of_most_recently_found_word\n @word_index.key(i)\n end",
"def char_indices(str) \n indicies = Hash.new { |h, k| h[k] = [] }\n\n str.each_char.with_index do |char, idx_1| \n indicies[char] << idx_1 \n end \n\n indicies\nend",
"def translate_string_to_number(input)\n\n #take the input\n #break it up into individual letters\n #map the letters to a dictionary (a = 1) or\n #map the input to a placement in an array\n\nend",
"def char_indices(str)\n result = Hash.new {|k,v| k[v]=[]}\n str.each_char.with_index { |char,i| result[char] << i}\n result\nend",
"def elmt_offset_at token_index\n # Defaults to the character position BEYOND the last text element\n (self[token_index]&.last if token_index) || (last.last + self.last.first.to_s.length)\n end",
"def word_lengths(str)\n # nested = []\n # str.split.each do |word|\n # nested << [word, word.length]\n # end\n # nested.to_h\n\n lengths = {}\n str.split.each {|word| lengths[word] = word.length}\n lengths\nend",
"def get_bnc_span_index\n @bnc_span_word_index = {} \n @bnc_span_caret_index = {} \n beg, lidx, lcat = -1, -1, '' ## begining word index, last word index, last category\n @tparses.each do |p|\n if NC_CAT.include?(p[:cat])\n beg = p[:idx] if beg < 0\n else\n if beg >= 0\n if NC_HEAD_CAT.include?(lcat) and @heads.include?(lidx)\n @bnc_span_word_index[lidx] = [beg, lidx]\n @bnc_span_caret_index[lidx] = [@tparses[beg][:beg], @tparses[lidx][:end]]\n end\n beg = -1\n end\n end\n\n lidx, lcat = p[:idx], p[:cat]\n end\n\n if (beg >= 0) and NC_HEAD_CAT.include?(lcat) and @heads.include?(lidx)\n @bnc_span_word_index[lidx] = [beg, lidx]\n @bnc_span_caret_index[lidx] = [@tparses[beg][:beg], @tparses[lidx][:end]]\n end\n end",
"def count_words(string)\n string.gsub!(/(\\W|\\d)/, \" \")\n string.gsub!(/\\s+/, \" \")\n puts(string)\n\n map = Hash.new\n stringAsArray = string.split(/ /)\n stringAsArray.each do |word|\n if map[word] == nil\n map[word] = 1\n else\n temp = map[word]\n map[word] = temp+1\n end\nend\nputs map\nend",
"def char_indices(str)\n count = Hash.new(0)\n\n str.each_char.with_index do |char, i|\n count[char.downcase] = (0..str.length - 1).find_all { |i| str[i, 1] == char }\n end\n count\nend",
"def last_index(str, char)\n return str.chars.each_with_index.select { |key, value| key == char }.map { |found| found.last }.last\nend",
"def char_indices(str)\n hash = {}\n\n str.each_char.with_index do |char, i|\n if !hash.has_key?(char)\n hash[char] = [i]\n else\n hash[char] << i\n end\n end\n hash\nend",
"def clean_up_input(word, start_position, direction)\n position_array = []\n if start_position.length > 2\n letter = start_position[2]\n position_array[0] = start_position[0,2]\n else\n letter = start_position[1]\n position_array[0] = start_position[0]\n end\n\n case letter #start_position[1]\n when \"A\"\n position_array[1] = \"0\"\n when \"B\"\n position_array[1] = \"1\"\n when \"C\"\n position_array[1] = \"2\"\n when \"D\"\n position_array[1] = \"3\"\n when \"E\"\n position_array[1] = \"4\"\n when \"F\"\n position_array[1] = \"5\"\n when \"G\"\n position_array[1] = \"6\"\n when \"H\"\n position_array[1] = \"7\"\n when \"I\"\n position_array[1] = \"8\"\n when \"J\"\n position_array[1] = \"9\"\n when \"K\"\n position_array[1] = \"10\"\n when \"L\"\n position_array[1] = \"11\"\n when \"M\"\n position_array[1] = \"12\"\n when \"N\"\n position_array[1] = \"13\"\n when \"O\"\n position_array[1] = \"14\"\n end\n\n\n v = position_array[0].to_i\n h = position_array[1].to_i\n\n word = word.upcase #changes all letters to uppercase\n direction = direction.downcase\n\n return [word, v, h]\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 score_word(word) \n points = {\n [\"A\", \"E\", \"I\", \"O\", \"U\", \"L\", \"N\", \"R\", \"S\", \"T\"] => 1,\n [\"D\", \"G\"] => 2,\n [\"B\", \"C\", \"M\", \"P\"] => 3,\n [\"F\", \"H\", \"V\", \"W\", \"Y\"] => 4,\n [\"K\"] => 5,\n [\"J\", \"X\"] => 8,\n [\"Q\", \"Z\"] => 10\n }\n\n score = 0 \n score += 8 if (word.length > 6) && (word.length < 11) \n\n tile_split = word.upcase.split(\"\")\n\n tile_split.each do |letter| \n points.each do |score_chart, point|\n score += point if score_chart.include?(letter) \n end \n end \n return score\nend",
"def positions_index(positions)\n index = self.mapping(:type => :canonical).each.\n with_index do |suffix_with_position,suffix_index|\n suffix_position = suffix_with_position[1]\n # TODO #6 optimize\n if positions.size == suffix_position.size &&\n positions.all?{|tags| suffix_position.include?(tags)}\n break suffix_index\n end\n end\n index.is_a?(Fixnum) ? index : nil\n end",
"def word_to_digit(phrase)\n numbers = {'zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4,\n 'five' => 5, 'six' => 6, 'seven' => 7, 'eight' => 8, 'nine' => 9}\n phrase_arr = phrase.split(\" \")\n phrase_arr.map! do |word|\n if word[-1] == \".\"\n front = word.chop\n if numbers.keys.include?(front)\n word = numbers[front].to_s + \".\"\n else\n word\n end\n elsif numbers.keys.include?(word)\n word = numbers[word]\n else\n word\n end\n end\n p phrase_arr.join(\" \")\nend",
"def decode(sentence)\n i = 0\n base = @alphabet.length\n sentence.each_char { |c| i = i * base + @alphabet.index(c) }\n i - @booster\n end",
"def letter_counts(word)\n letter_counts = Hash.new(0)\n\n word.split(\"\").each do |ele| \n letter_counts[ele] += 1\n end\n letter_counts\nend",
"def char_indices(str)\n hash = Hash.new([])\n str.each_char.with_index do |char, idx|\n hash[char] += [idx]\n end\n hash\nend",
"def get_word_ladder(start_word, end_word)\n # FILL ME IN\n return ['dog', 'cat']\n end",
"def last_index(str, char)\n arr = str.chars\n\n setupArr = arr.map.with_index do |ele, idx|\n\n if ele == char\n idx\n else\n 0\n end\n end\n\n returnStr = setupArr.select { |ele| ele > 0 }\n\n return returnStr[-1]\n\nend",
"def segments word\n (0..word.length-3).map do |i|\n word[i...i+3]\n end\nend",
"def word_to_digit(sentence)\n sentence.split(/\\b/).map { |i| DIGITS.include?(i) ? DIGITS.index(i) : i }\nend",
"def word_count string\n\thash = {}\n\tstring.split(\" \").each do |i|\n\t\tcount = 0\n\t\tstring.split(\" \").each do |j|\n\t\t\tif i.downcase == j.downcase\n\t\t\t\tcount += 1\n\t\t\tend\n\t\tend\n\t\thash[i.downcase] = count\n\tend\n\thash\nend",
"def last_index(str, char)\n \tarry = []\n\tstr.split(\"\").map.with_index do|i, indx|\n\tif i == char\n arry << indx\n end\n end\n return arry[-1]\nend",
"def word_break(s, word_dict)\n wb = Array.new(s.size + 1) { false }\n wb[0] = true\n 0.upto(s.size - 1).each { |i|\n next if !wb[i]\n current = s[i..-1]\n word_dict.select { |word| current.start_with?(word) }.each { |word|\n wb[i + word.size] = true\n }\n }\n\n wb[s.size]\nend",
"def last\n return nil if ! @map.last\n if @map.length == 1\n left = 0\n else\n left = @map[@map.length-2][0]+1\n end\n [@map.length-1,@map.last[1],left,@map.last[0]]\n end",
"def parse_string(input)\n #input is a string like \"dogg\"\n letters = input.chars \n #chars = characters\n \n letter_counts = {} \n \n letters.each do |letter|\n \n if letter_counts[letter] == nil \n letter_counts[letter] = 1 \n else \n letter_counts[letter] += 1 \n end \n end \n \n return letter_counts \n \n #return an output like \n # {'d' => 1 , 'o' => 1, 'g' => 2}\nend"
] | [
"0.6605645",
"0.613523",
"0.5933685",
"0.5891929",
"0.58277684",
"0.5756427",
"0.56902885",
"0.56832784",
"0.56231576",
"0.5605986",
"0.5581165",
"0.55264384",
"0.55207485",
"0.55062765",
"0.54799604",
"0.5407607",
"0.53735477",
"0.5367364",
"0.53637606",
"0.53330296",
"0.532442",
"0.5279058",
"0.52646303",
"0.52605426",
"0.52566564",
"0.5246606",
"0.5231108",
"0.52230686",
"0.52035373",
"0.5199691",
"0.51995844",
"0.51976436",
"0.51966757",
"0.51965195",
"0.5190973",
"0.5189747",
"0.51881653",
"0.5172313",
"0.51715356",
"0.5166491",
"0.516389",
"0.5158274",
"0.5154159",
"0.5154159",
"0.5150394",
"0.5145868",
"0.5143927",
"0.5140723",
"0.51385444",
"0.5127278",
"0.5125816",
"0.5123973",
"0.511513",
"0.51103747",
"0.5109046",
"0.5106737",
"0.5093464",
"0.5089353",
"0.5088354",
"0.5082419",
"0.5077854",
"0.507292",
"0.506471",
"0.5052258",
"0.50517464",
"0.50427824",
"0.5039871",
"0.50382596",
"0.50371605",
"0.50329524",
"0.50309014",
"0.5028869",
"0.50229466",
"0.50221294",
"0.5018873",
"0.5013918",
"0.5013311",
"0.5012514",
"0.5008193",
"0.5003824",
"0.4996202",
"0.49958956",
"0.49924073",
"0.49913207",
"0.49893236",
"0.49839836",
"0.49839473",
"0.4979681",
"0.4973798",
"0.497278",
"0.4969571",
"0.49690935",
"0.49634647",
"0.49589714",
"0.49585062",
"0.4958384",
"0.4957848",
"0.49577504",
"0.49577168",
"0.49519008",
"0.4950939"
] | 0.0 | -1 |
1. For a given person, return their favourite tv show | def tv_show(person)
return person[:favourites][:tv_show]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tv_show(person)\n tv_show = person[:favourites][:tv_show]\n return tv_show\nend",
"def fav_tv_show(person)\n return person[:favourites][:tv_show]\nend",
"def get_favourite_tv_show(person)\n return person[:favourites][:tv_show]\nend",
"def get_tv_show(person)\n return person[:favourites][:tv_show]\nend",
"def test_favourite_tv_show\n result = favourite_tv_show(@person5)\n assert_equal(\"Scrubs\", result)\n end",
"def same_tv_show(people)\n tv_shows = {}\n same_tv_shows = {}\n\n for person in people\n show = person[:favourites][:tv_show]\n if tv_shows[show] != nil\n tv_shows[show] << person[:name]\n else\n tv_shows[show] = [person[:name]]\n end\n end\n\n for show_name in tv_shows.keys\n if tv_shows[show_name].length > 1\n same_tv_shows[show_name] = tv_shows[show_name]\n end\n end\n return same_tv_shows\nend",
"def same_favourite_tv_show(people)\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n result = []\n for index in same_show\n result.push(people[index][:name])\n end\n return result\nend",
"def test_favourite_tv_show\n result = person_favourite_tv_show(@person5)\n assert_equal(\"Scrubs\",result)\n end",
"def tv_show(hash)\n return hash[:favourites][:tv_show]\nend",
"def favorite(category, user)\n shows_by_category = user.shows.group_by({|show| show.send(category.downcase + \"_id\")})\n category_count = shows_by_category.each { |k,v| shows_by_category[k] = v.count}\n if category_count.empty?\n \"None.\"\n else\n Object.const_get(category).find(category_count.max_by{|k,v| v}[0]).name\n end\nend",
"def find_show_buddies(people)\n\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n p tv_shows\n end\n p tv_shows\n\n same_show = []\n count = 0\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n p same_show\n p count\n end\n count += 1\n end\n p same_show\n\n show_buddies = []\n for index in same_show\n show_buddies.push(people[index][:name])\n p show_buddies\n end\n p show_buddies\n\n return show_buddies\nend",
"def find_show_buddies(people)\n\n tv_shows = []\n\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n show_buddies = []\n\n for index in same_show\n show_buddies.push(people[index][:name])\n end\n\n return show_buddies\nend",
"def favorite_players(fan)\n Fan.find_by(name: fan).players\nend",
"def favourite_for(user)\n favourites.find_by_user_id user\n end",
"def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end",
"def favourite_heroes()\n sql = \"\n SELECT DISTINCT h.id, h.name FROM players p\n INNER JOIN favourites f\n ON f.player_id = p.id\n INNER JOIN heroes h\n ON h.id = f.hero_id\n WHERE player_id = #{@id};\n \"\n return Hero.get_many( sql )\n end",
"def favorite_for(user)\n favs.find_by(user_id: user)\n end",
"def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end",
"def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend",
"def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend",
"def favorite(client)\n\tensemble = client.search(\"#bonjour_monde\", result_type: \"recent\").take(25)\n#\tensemble.each do |tweet|\n\t\tclient.favorite(ensemble)\n#\tend\nend",
"def show_favorite_players(fan) #this method is backend finding the players of a specifc fan\n players_array = favorite_players(fan)\n players_array.each do |player|\n puts player.name \n end\nend",
"def favourite_drink name\r\n\tif name == \"Jean-Luc\"\r\n\t\t\"tea, Earl Grey, hot\"\r\n\telsif name == \"Kathryn\"\r\n\t\t\"coffee, black\"\r\n\telse\r\n\t\t\"perhaps...horchata?\"\r\n\tend\r\nend",
"def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def all_fav_foods(people)\n fav_foods = []\n for person in people\n fav_foods.concat(person[:favourites][:things_to_eat])\nend\nreturn fav_foods\nend",
"def get_favorite_for user\n\t user.favorites.find_by_page_id(self)\n end",
"def underdog\n\t if home_team != favorite\n\t home_team\n\t else\n\t visitor_team\n\t end\n\tend",
"def favorite\n puts FAVE\n end",
"def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end",
"def favorites(action=nil)\n my.favorites(action)\n end",
"def fav_genre\n # NOTE : DID NOT ADD GENRES YET\n # r.shows.genres\n \"WIP - no genres yet\"\n end",
"def get_recent_fav\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => 2).order('interests.created_at DESC').limit(5)\n return shows.all\n end",
"def favorite_hashtags\n favorite_stuffs(:hashtags, :text, 3)\n end",
"def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end",
"def films\n self.screenings.map do |screening|\n screening.festival.title\n end\n end",
"def fans n = 0\n\t\tself.favorites.collect(&:person).reject { |p| p.hidden }\n\tend",
"def favourite_foods(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def favorited\r\n Favorite.find(:all, :conditions => {:favorable_type => self.class.to_s, :favorable_id => self.id})\r\n end",
"def test_return_tv_show__person1\n result = return_tv_show(@person1)\n assert_equal(\"Friends\", result)\n end",
"def favorite_hikes(user_id) #the area where the user can see their list of favorite hikes.\n#one line sql line that greg said I know how to do for showing the favorites of the user. \n # user = User.find_by(name: name)\n # user.hikes\n# binding.pry\n# user.hike.each do |hikes|\n# puts hike.name \n#SELECT hike_id FROM FAVORITES WHERE user_id = user_id\n \nputs \"The below are your favorite hikes:\"\nputs \"\"\n# binding.pry\nhikes_names_array =[]\nhikes_id_array = Favorite.where(user_id: user_id).pluck(\"hike_id\").uniq\nhikes_id_array.each do |hike|\n hikes_names_array << Hike.find(hike).name\n #binding.pry\nend\nputs hikes_names_array.join(\", \")\nputs \"\"\nfavorites_menu_question\nend",
"def describe_favorites(games)\n for game in games\n puts \"Favorite Game: #{game}\"\n end\nend",
"def get_user_favorites username_for\n do_request 'get_user_favorites', username_for: username_for\n end",
"def list_fav\r\n users = User.all \r\n users.each do |user|\r\n puts \"#{user}\"\r\n user.snacks.each do |snack|\r\n puts \"- #{snack}\"\r\n end\r\n end\r\nend",
"def show\n @favorite = current_user.favorites.find_by(recipe_id: @recipe.id)\n end",
"def show\n respond_with favorites.first!\n end",
"def favorites\n if params[:id]\n if params[:id].to_i.to_s == params[:id]\n\t@user = User.find(params[:id])\n else\n\t@user = User.find(:first, :conditions => [\"username=?\", params[:id]])\n end\n else\n @user = @current_user\n end\n\n @beu = @user.following_by_type('Beu')\n end",
"def likes\n people = []\n query = Activity.joins { verb }.where { activity_object_id.eq(my { id }) }\n\n activities_likes = query.where { verb.name.eq('like') }\n activities_likes.each do |activity|\n people.push activity.actor\n end\n\n activities_unlikes = query.where { verb.name.eq('unlike') }\n activities_unlikes.each do |activity|\n people.delete_at people.index(activity.actor)\n end\n\n people\n end",
"def popular_shows\nend",
"def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend",
"def show\n @user = User.find(params[:id])\n if params[:search]\n search = params[:search]\n @heading = \"Search results\"\n @movies = Movie.where('title LIKE :search OR genre LIKE :search or actors Like :search', search: \"%#{search}%\")\n else\n whichone()\n end\n @likes = Movie.where(id: @user.likes)\n end",
"def get_fans(person)\n get_comments_on_person_posts(person).in_e(:POSTED).out_v(type: 'person')\nend",
"def show\n @userID = (current_user.blank?) ? 0 : current_user.id\n @isUserFavourite = Favourite.where(user_id: @userID, movie_id: @movie.id).count > 0 ? true : false\n end",
"def suggest_movie\n\t\t# Take 5 random movies\n\t\tmovies = self.get_source_content.shuffle[0..4]\n\n\t\t# Create a readable list of movie names\n\t\tdisplay_list = movies.collect { |filepath|\n\t\t\tFile.basename(filepath).gsub(File.extname(filepath), '')\n\t\t}\n\n\t\t# Ask the user to veto a movie\n\t\tallowed_answers = (1..display_list.size).to_a\n\t\tusers = ['Tim', 'Maud'].shuffle\n\t\tuser = rand(1)\n\t\tmovie_id = nil\n\t\twhile movie_id.nil? do\n\t\t\tsystem 'clear'\n\t\t\tputs \n\n\t\t\t# Display list\n\t\t\tdisplay_list.each_with_index do |movie, i|\n\t\t\t\tputs \"#{i+1}: #{movie}\"\n\t\t\tend\n\t\t\tputs\n\n\t\t\t# If only one movie left, we select it\n\t\t\tif allowed_answers.size == 1\n\t\t\t\tmovie_id = allowed_answers[0] \n\t\t\t\tdisplay_name = display_list[movie_id-1]\n\t\t\t\tfilepath = movies[movie_id-1]\n\t\t\t\tputs \"On regarde donc #{display_name}, qui se trouve dans\"\n\t\t\t\tputs filepath\n\n\t\t\t\t# We remove it from the list\n\t\t\t\tself.remove_movie_from_list filepath\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\t# Ask user for a veto\n\t\t\tputs \"#{users[user]}, à toi de mettre un véto\"\n\t\t\tanswer = gets.chomp.to_i\n\n\t\t\t# Incorrect answer\n\t\t\tif !allowed_answers.include? answer\n\t\t\t\tputs \"#{answer} n'est pas une réponse valide.\"\n\t\t\t\tputs \"Les seuls réponses valides sont : #{allowed_answers.join(', ')}\"\n\t\t\t\tputs \"Appuyez sur Entrée pour recommencer\"\n\t\t\t\tgets\n\t\t\telse\n\t\t\t\t# We remove this answer from the list\n\t\t\t\tallowed_answers.delete(answer)\n\t\t\t\tdisplay_list[answer-1].gsub!(/./, '#')\n\t\t\t\t# Switch to next user\n\t\t\t\tuser = (user+1)%2\n\t\t\tend\n\t\tend\n\n\tend",
"def viewers(m)\n return @movies[m].collect{|itm| itm[0]}\n end",
"def show\n @favorites = Favorite.all\n end",
"def show_fans(player) \n player1 = Player.find_by(name: player)\n fans_array = player1.fans\n fans_array.each do |fan|\n puts fan.name \n end\nend",
"def show\n @snippet.snippet_content = CodeRay.scan(@snippet.snippet_content, :ruby).div(:line_numbers => :table)\n\n @snippetuser = User.find_by(email: session[:current_user_email])\n @hasFavorite = @snippetuser.favorites.find_by(snippet_id: @snippet.id)\n puts \"Getting user favorite\"\n puts @hasFavorite.blank?\n end",
"def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend",
"def is_favorite_of user\n\t fave = get_favorite_for user\n\t fave ? true : false\n\tend",
"def character_movies(character)\n output = []\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n results = character_hash[\"results\"]\n results.each do |person|\n if person[\"name\"].downcase == character\n output = person[\"films\"]\n end\n end\n return output\nend",
"def like_food?(food, person)\n person[:favourites][:things_to_eat].include?(food)\nend",
"def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n favorite_array = Favorite.where(user_id:current_user.id)\n \n favorite_array.each do |favorite|\n puts Brewery.find(favorite.brewery_id).name\n puts Brewery.find(favorite.brewery_id).street\n puts Brewery.find(favorite.brewery_id).city\n puts Brewery.find(favorite.brewery_id).state\n end \n # current_user.favorites\n end",
"def show\n redirect_to dashboard_url if current_user.team_id != @team.id\n teammates = @team.hackers.reject{ |h| h == current_user }\n @current_name = current_user.full_name.present? ? current_user.full_name : 'Me'\n @others = []\n 3.times do |i|\n teammate = teammates[i]\n if teammate.present?\n name = teammate.full_name.present? ? teammate.full_name : 'Friend'\n @others << {name: name, present: true, email: teammate.email}\n else\n @others << {name: 'Invite Friend', present: false}\n end\n end\n end",
"def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end",
"def favorite_opponent(team_id)\n team_id = team_id.to_i\n team = @teams.select { |each_team| each_team.team_id == team_id }.first\n favorite_opponent_id = team.matchup_win_percentage.max_by{|each_team, percentage| percentage}.first\n @teams.select { |each_team| each_team.team_id == favorite_opponent_id }.first.team_name\n end",
"def true_for_food(hash, item)\n food= hash[:favourites][:things_to_eat]\n\n for i in hash\n if i == food\n\n return \"Yes I like this food\"\n end\n end\n return \"No I don't like this\"\n end",
"def if_guest_fav_song_played(room)\n room_song_title_list =room.title_of_songs()\n guest_fav_song_list = room.guests_fav_song_list()\n for song in guest_fav_song_list\n room_song_title_list.find{|room_song| room_song =\"song\"}\n return \"whoo!\"\n end\n end",
"def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend",
"def all_foods(people)\n all_foods = []\n for person in people\n all_foods.concat(person[:favourites][:things_to_eat])\n end\n return all_foods\nend",
"def show\n\n @favoritepet_exists = Favoritepet.where(petprofile: @petprofile, user: current_user) == [] ? false : true\n end",
"def index_favorite\n\t\tif home_team == favorite\n\t home_team.upcase\n\t else\n\t \tfavorite\n\t end\n\tend",
"def popular_res\n separate\n @res_arr.each do |res|\n if res[:likes] > 600\n return \"The following restuarant is popular: #{res[:name]}\"\n end\n end\nend",
"def my_favorites\n\tend",
"def get_movie(actor=\"Brad Pitt\")\n movie_count = show_movies(actor).size\n show_movies(actor)[rand(movie_count)]\n end",
"def get_film_urls(character)\n character_hash = look_up('http://www.swapi.co/api/people/')\n film_urls = character_hash[\"results\"].find do |element|\n element[\"name\"].downcase == character\n end[\"films\"]\nend",
"def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n \n current_user.breweries.each do |brewery|\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery.name\n puts brewery.street\n puts brewery.city\n puts brewery.state\n puts brewery.phone\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n end \n end",
"def show\n @favorite = current_user.favorites.find_by(session_login_id: @session_login.id)\n end",
"def favoriter?\n true\n end",
"def favourites\n curr_user = User.find(current_user.id)\n fav_posts = curr_user.destring(curr_user)\n fav_users = curr_user.destring_user(curr_user)\n @top_posts = []\n @top_users = []\n fav_posts.each do |n|\n post = Post.find(n)\n @top_posts << post\n end\n fav_users.each do |n|\n user = User.find(n)\n @top_users << user\n end\n render :favourites\n end",
"def favoring?(article)\n favorites.include?(article)\n end",
"def favorite_artworks\n artworks.where(favorite: true)\n end",
"def found_friends(people)\n friends = []\n people.each do |person|\n if (person == \"Don\")\n friends << \"Don\"\n end\n if (person == \"John\")\n friends << \"John\"\n end\n if (person == \"Kent\")\n friends << \"Kent\"\n end\n end\n return friends\nend",
"def my_followers_motto\n my_followers.collect {|bloodoath| bloodoath.follower.life_motto}\n end",
"def get_info_on_club(fixture)\n puts \"See when your favourites are playing:(enter favourite club name)\"\n fav_club = gets.chomp\n all_fav_matches = fixture.map do |game|\n if game[:home_team].downcase.include?(fav_club) || game[:away_team].downcase.include?(fav_club)\n game\n end\n end.compact\n\n if all_fav_matches.empty?\n puts \"Did not match the database!\"\n else\n puts all_fav_matches\n end\nend",
"def wishlisted\n wishlisted = self.visits.select { |visit| visit.visited == false }\n wishlisted.map { |museum| museum.user }\n end",
"def favorite_brewery\n favorite :brewery\n end",
"def show\n @fives = Fiveparameter.find_by(anio: @quinto.anio)\n end",
"def find_tv_programmes_by_person(person)\n response = get(\"http://www.bbc.co.uk/programmes/topics/#{CGI::escape(person.name.gsub(' ', '_'))}.json\")\n return nil unless response.code == 200\n json_data = JSON.parse(response.body)\n\n p = json_data['category_page']['available_programmes'].take(30).map do |json|\n programme = Programme.new(\n pid: json['pid'],\n title: json['display_titles']['title'],\n subtitle: json['display_titles']['subtitle'],\n synopsis: json['short_synopsis']\n )\n programme.created_at = json['first_broadcast_date']\n\n return nil if json['media_type'] == 'audio'\n programme\n\n end\n p.compact!\n p\n end",
"def list_favourites(user_id)\n @favourites_store.where(user_id)\n end",
"def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end",
"def user_names_who_liked(id)\n\t\t(HTTP.get(\"https://twitter.com/i/activity/favorited_popup?id=#{id}\").body.to_s.scan(/data-screen-name=\\\\\"(.*?)\\\\\"/).flatten.uniq - [@config[\"Username\"]]).map { |s| \"@#{s}\" }.join(\", \")\n\tend",
"def show_character_movies(character)\n films_hash = get_character_movies_from_api(character) #returns films list/url\n parse_character_movies(films_hash)\nend",
"def favourites\n\t\tfavourites = Partay.get('http://shoponline.tescolotus.com/api/v1/favorites/by-category?page=1&sortby=Relevance&issecure=False', :headers => {'Content-Type' => 'application/json','language' => 'en-GB', 'region' => 'TH', 'userId' => access_token, 'Host' => 'r.tesco.com.my'})\n\t\tfavourites_counter = JSON(favourites)\n\t\tself.favourite_count(JSON(favourites_counter)[\"pageInformation\"][\"totalCount\"])\n\t\tif fav_count >= 1\n\t\t\tputs \"Your favourites count is:#{fav_count}\"\n\t\telse\n\t\t\traise \"There are no products in your favourites list.\"\n\t\tend\n\tend",
"def favorite_brewery\n favorite :brewery\n end",
"def viewers m\n \tusers = @userdata.keys\n \tmovie_viewers = []\n \tusers.each do |user|\n \t\tif rating(user, m) != 0\n \t\t\tmovie_viewers.push(user)\n \t\tend\n\n \tend\n \treturn movie_viewers\n end",
"def viewers(m, set=@trainingSet)\n (set.data.select {|item| item[@MOVIE_ID].to_i == m}).collect {|item| item[@USER_ID].to_i}\n end",
"def show\n redirect_to root_path if current_user.blocked_by? User.find(params[:user_id])\n @user = User.find(params[:user_id])\n @player_profile = @user.player_profile\n unless @player_profile.nil?\n @similar_profiles = User.recommender(@player_profile, \"player\")\n @similar_profiles = recommend_set(@similar_profiles, @user) & User.location(current_user, \"0\")\n else\n @similar_profiles = nil\n end\n end"
] | [
"0.7669126",
"0.74630356",
"0.7420349",
"0.7370223",
"0.7161871",
"0.71301794",
"0.71096283",
"0.69950676",
"0.68426484",
"0.6778154",
"0.676397",
"0.6762284",
"0.6553473",
"0.65082234",
"0.6430549",
"0.6378693",
"0.63551176",
"0.6304187",
"0.6287841",
"0.6226974",
"0.62209123",
"0.6213701",
"0.6128745",
"0.609228",
"0.60845596",
"0.60845596",
"0.60492617",
"0.60107905",
"0.6010013",
"0.5999395",
"0.5988926",
"0.5987901",
"0.5970545",
"0.5970384",
"0.5965464",
"0.5953299",
"0.59357715",
"0.5924847",
"0.59213394",
"0.5899229",
"0.58786917",
"0.58666074",
"0.5849267",
"0.5810039",
"0.58083606",
"0.5808044",
"0.58036983",
"0.5802203",
"0.57964087",
"0.5785371",
"0.5763388",
"0.57633114",
"0.5761709",
"0.5752533",
"0.5750662",
"0.57374984",
"0.5722233",
"0.571822",
"0.57085717",
"0.5704173",
"0.5702879",
"0.56990826",
"0.5681569",
"0.56773233",
"0.5673327",
"0.5658258",
"0.5658035",
"0.5650332",
"0.56403875",
"0.560876",
"0.5595709",
"0.558807",
"0.5585906",
"0.55762726",
"0.55710137",
"0.5568753",
"0.5563398",
"0.5554359",
"0.5547074",
"0.55451614",
"0.55442536",
"0.5543974",
"0.55413926",
"0.55309963",
"0.55309117",
"0.5526175",
"0.5522614",
"0.5517829",
"0.55123246",
"0.55121535",
"0.5510498",
"0.55087817",
"0.5505497",
"0.55040157",
"0.5501541",
"0.54911596",
"0.548559",
"0.548532",
"0.54793274",
"0.5477222"
] | 0.7502839 | 1 |
2. For a given person, check if they like a particular food | def favourite_foods(person, food)
return person[:favourites][:things_to_eat].include?(food)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def like_food?(food, person)\n person[:favourites][:things_to_eat].include?(food)\nend",
"def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend",
"def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend",
"def likes_to_eat(person, food)\n food_array = person[:favourites][:snacks]\nreturn food_array.include?food\nend",
"def true_for_food(hash, item)\n food= hash[:favourites][:things_to_eat]\n\n for i in hash\n if i == food\n\n return \"Yes I like this food\"\n end\n end\n return \"No I don't like this\"\n end",
"def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend",
"def test_check_food_liking_true\n result = check_food_liking(@person3, \"stew\")\n assert_equal(true, result)\n end",
"def likes?(food)\n\tresult = [\"bananas\", \"eggs\", \"bacon\", \"cheese\"].detect{|x| x == food}\n\t if result.nil?\n\t \tfalse\n\t else\n\t \ttrue\n\t end\nend",
"def test_likes_to_eat__person3_true\n result = likes_to_eat(@person3, \"Scooby snacks\")\n assert_equal(true, result)\n end",
"def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend",
"def hungry?\r\n @food <= 2\r\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def can_train_footman?\n gold >= 135 && food >= 2\n end",
"def like?(meal)\n self.customer_meals.find_by_meal_id(meal.id)\n end",
"def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def can_train_peasant?\n gold >= 90 && food >= 5\n end",
"def can_train_peasant?\n gold >= 90 && food >= 5\n end",
"def can_customer_afford_pet?(customer, wanted_pet)\n customer[:cash] >= wanted_pet[:price]\nend",
"def customer_can_afford_pet(customer, pet)\n if customer[:cash] == pet[:price]\n end\n return true\nend",
"def can_buy_beer?(person)\nend",
"def worthwhile?(monster)\n # sonias, colored valks\n if [911, 913, 1088, 972, 982, 1270, 1516].include?(monster.id)\n true\n elsif monster.pantheon\n true\n else\n monster.stars >= 5 && monster.types.include?(\"God\") && !monster.name.include?(\"Verche\")\n end\n end",
"def eat(food)\n if food.veggie? && !@carnivore\n @hunger -= 10\n elsif food.meat? && @carnivore\n @hunger -= 10\n end\n @hunger = 0 if @hunger < 0\n end",
"def find_the_cheese(foods)\n foods.find{ |cheese| cheese == \"cheddar\" || cheese == \"gouda\" || cheese ==\n \"camembert\"}\nend",
"def customer_can_afford_pet(customer, pet)\n return customer[:cash] >= pet[:price]\nend",
"def customer_can_afford_pet(customer,new_friend)\n return (customer[:cash] >= new_friend[:price])? true : false\nend",
"def can_this_person_vote?(person)\n # check if their age is >= 18\n age = person[\"age\"]\n if age >= 18\n return \"yes\"\n else\n return \"no\"\n end\nend",
"def customer_can_afford_pet?(customer_hash, wanted_pet)\n if customer_hash[:cash] >= wanted_pet[:price]\n true\n else\n false\n end\nend",
"def customer_can_afford_pet(customer, pet)\n if customer[:cash] >= pet[:price]\n return true\n else\n return false\n end\nend",
"def pbHasFatefulSpecies?(species)\n if species.is_a?(String) || species.is_a?(Symbol)\n species = getID(PBSpecies,species)\n end\n for pokemon in $Trainer.pokemonParty\n return true if pokemon.species==species && pokemon.obtainMode==4\n end\n return false\nend",
"def rate_my_food(food)\n case food\n when 'Githeri'\n 'pass the pilipili'\n when 'Mukimo'\n 'pass the thukuma'\n when 'ngima', 'muchere', 'ngacii'\n 'pass maziwa mala'\n else\n 'Nilale njaa'\n end\nend",
"def foodExists? (name)\n !!@BasicHash[name] #!! BasicHash checks if the food exists, evaluates to true if it does\n #otherwise false\n end",
"def should_eat( food, season )\n if (food == \"ice cream\" && season == \"winter\") || (food = \"hot chocolate\" && season == \"summer\")\n return false\n else\n return true\nend\nend",
"def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Hash of avaialble foods and associated counts\n \n pie_qty = 0\n cake_qty = 0 # quantity of the foods equals to 0 \n cookie_qty = 0\n \n has_fave = false # Initializes our has_fave tood to false\n\n my_list.each_key do |key| # iterating over my_list keys to do a comparison \n if key == fav_food # Favorite food comparison\n has_fave = true # confirms fav_food is in the list \n end\n # has_fave = true if key == fav_food\n end\n \n if has_fave == false # my_list does not contain fav_food \n raise ArgumentError.new(\"You can't make that food\") # Raise error if fav_food was not found\n else # Fav_food was in the list\n fav_food_qty = my_list[fav_food] #.values_at(fav_food)[0] # if in the list, return the quantity on hand *** refactor\n if num_of_people % fav_food_qty == 0 # Checks if num_of_people is evenly divisable by the fav_food_qty\n num_of_food = num_of_people / fav_food_qty # returns num_of_food eq to number of people / fav foods \n return \"You need to make #{num_of_food} #{fav_food}(s).\" # Return favorite food along with quantity\n else #num_of_people % fav_food_qty != 0 # num_of_people was not evenly divisable by fav_food_qty\n while num_of_people > 0 # while num_of_people is greater than zero \n if num_of_people / my_list[\"pie\"] > 0 # At least more people than the quantity of pie will feed \n pie_qty = num_of_people / my_list[\"pie\"] # quantity of pie is equal the number of people divided by my_list of pie \n num_of_people = num_of_people % my_list[\"pie\"] # number of people ramaining after distributing pies\n elsif num_of_people / my_list[\"cake\"] > 0 # At least more people than the quantity of cake \n cake_qty = num_of_people / my_list[\"cake\"] # quantity of cake is equal to the number of people divided by qty of people cake will feed\n num_of_people = num_of_people % my_list[\"cake\"] # number of people remaining after distributing cakes \n else # num_of_people is less than both qty that pie and cake will feed\n cookie_qty = num_of_people # cookie quantity is equal to the number of people \n num_of_people = 0 # Set num_of_people to 0 in order to end the loop\n end # Ending if-else conditions\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def should_eat(food, season)\n if food == \"hot chocolate\" && season == \"summer\"\n return \"False\"\n elsif food == \"ice cream\" && season == \"winter\"\n return \"False\"\n else return \"true\"\n end\nend",
"def is_basic_food(name)\n return @basic_foods.has_key? name\n end",
"def look_for_food(fish)\n fish.stop_turn\n food_range = fish.food_perception\n food = food_around(fish.position, food_range)\n if food.size > 0 && !(fish.status==Escaping)\n food_found = food[0]\n if fish.position.distance(food_found.position) <= EatingAndMatingRange\n fish.consume(food_found)\n @food.delete(food_found)\n @food.compact!\n else\n fish.spot_food(food_found)\n end\n end\n end",
"def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end",
"def rate_my_food(food)\n case food\n when \"Steak\" #if food is eq to Steak\n \"Pass the sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Tacos\", \"Burritos\", \"Strawhat\"\n \"That all is great\"\n when \"Tofu\", \"Brussels\"\n \"Yuck!\"\n else\n \"I dont know about this\"\n end\n\nend",
"def customer_can_afford_pet(customer_hash, pet)\n if customer_hash[:cash] >= pet[:price]\n return true\n else\n return false\n end\nend",
"def owners_favorite?(naming)\n lookup_naming(naming).users_favorite?(user)\n end",
"def users_favorite?(naming, user)\n lookup_naming(naming).users_favorite?(user)\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 customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= 100\n return true\n else\n return false\n end\nend",
"def favorite_food(name)\n formatted_name = name.capitalize\n\n return 'vindaloo' if formatted_name == 'Lister'\n return 'mashed potatoes' if formatted_name == 'Rimmer'\n\n 'hard to say...maybe fried plantain?'\nend",
"def customer_can_afford_pet?(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n else\n return false\n end\nend",
"def favorite_food?(string)\n @favorite_foods.map(&:downcase).include?(string.downcase)\n end",
"def printFood(name)\n i = 0 #initializing i to zero\n # if the given food matches basicHash food name\n # look into basicHash and set i to 1 to mark found\n if @BasicHash.has_key? name\n i = 1\n basicfood = @BasicHash[name]\n puts \"#{basicfood.name} #{basicfood.calories} \"\n end\n # if it is found in recipeHash then look into\n # recipe hash and print it out.\n if @RecipeHash.has_key? name\n i = 1\n recipePrintHelper(name)\n end\n # else case, if it can't find in both recipe\n # and basic hash\n if i == 0\n puts \"Can't find the food '#{name}'\"\n end\n end",
"def customer_can_afford_pet(customer, pet)\n can_afford = (pet[:price] <= customer[:cash])\n return can_afford\n# if pet[:price] <= customer[:cash]\n# return true\n# else\n# return false\n# end\nend",
"def customer_can_afford_pet(customer, pet)\n customer[:cash] >= pet[:price]\nend",
"def customer_can_afford_pet(customer, desired_pet)\n customer[:cash] >= desired_pet[:price]\nend",
"def rate_my_food(food)\n case food\n when \"Steak\"\n \"Pass the steak sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Pizza\"\n \"My favorite food\"\n when \"Tacos\", \"Burritos\", \"Quesadillas\"\n # o lo uno o lo otro\n \"Cheesy and filling!\"\n when \"Tofu\", \"Brussel Sprouts\"\n \"Disguisting!\"\n else\n \"I don't know about that food\"\n end\nend",
"def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end",
"def food_upvote?(topic)\n\ttopic == \"food\"\nend",
"def favorited?(user, coffeeshop)\n coffeeshop.users.each do |coffeeshop_user|\n return true if coffeeshop_user == user\n end\n return false\n end",
"def feed(food)\n puts \"Mmmm, \" + food + \"!\"\n @hungry = false\n end",
"def rate_my_food(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Great choice! My favorite food\"\r\n when \"Tacos\", \"Burritos\", \"Quesadillas\" # operator or\r\n \"Cheesy and filling! The perfect combination\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n \"Disgusting! Yuck!\"\r\n else\r\n \"I don't know about that food!\"\r\n end\r\nend",
"def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.include?(item)\n end\n end",
"def favoring?(article)\n favorites.include?(article)\n end",
"def food_item?\n @itype_id == 3\n end",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n end\n return false\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n end\n return false\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n end\n return false\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n \n return \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n return \"You need to make 0 pie(s), 0 cake(s), and #{num_of_people} cookie(s).\" if fav_food == \"cookie\"\n return \"You need to make #{num_of_people / my_list[fav_food]} pie(s), 0 cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"pie\"\n return \"You need to make 0 pie(s), #{num_of_people / my_list[fav_food]} cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"cake\"\n \nend",
"def customer_can_afford_pet(customer,new_pet)\n customer_cash=customer[:cash]\n @pet_shop[:pets].push(new_pet)\n for pet in @pet_shop[:pets] do\n if customer_cash >= pet[:price] \n return true\n else\n return false\n end\n end\n end",
"def people_who_can_buy_beer(people)\nend",
"def mood\n #it \"has a method 'mood' that returns 'happy' when the user is more happy than nauseous\" do\n if self.happiness && self.nausea\n if self.happiness > self.nausea\n \"happy\"\n #it \"has a method 'mood' that returns 'sad' when the user is more nauseous than happy\" do\n elsif self.happiness < self.nausea\n \"sad\"\n end\n end\n end",
"def recipe_learn?(recipe)\n recipe.is_a?(RPG::Recipe) && @recipes.include?(recipe.id)\n end",
"def response_to(mate)\n acceptance = false\n if @sex == Female and mate.sex == Male\n reaction = rand\n acceptance = (reaction <= mate.attractiveness/1000.0)\n end\n acceptance\n true\n end",
"def find_mached_recipe(fridge)\r\n system \"clear\"\r\nrecipes_you_can_make = []\r\nrecipe_count = 1\r\n fridge.recipes.each do |recipe|\r\n if recipe.ingredients & fridge.what_you_have.map(&:name) == recipe.ingredients\r\n recipes_you_can_make << recipe\r\n recipe_count += 1\r\n end #if end\r\n end # fridge.recipes.each end\r\n if recipe_count ==1\r\n puts \"Nothing! You better go out and get some food.\"\r\n sleep 2\r\n abort\r\n else\r\n puts \"Thank you! You can make these Japanese food\"\r\n end # if end\r\n recipes_you_can_make\r\nend",
"def customer_can_afford_pet(customer, new_pet)\n if (customer[:cash] >= new_pet[:price])\n return true\n else\n return false\n end\nend",
"def is_allergic?(score, item)\n test_by_score(score).include?(item)\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n true\n else\n false\n end\nend",
"def in_contest?(pet)\n pet.id == challenger.id || pet.id == challenged.id\n end",
"def customer_can_afford_pet(customer, new_pet_hash)\n if customer[:cash] > new_pet_hash[:price]\n return true\n else\n return false\n end\nend",
"def bakery_num(num_of_people, fav_food) #Defining a function that takes two parameters\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #Declaring a my_list hash\n pie_qty = 0 # Assigning three other variables \n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false #setting a default value of false \n\n my_list.each_key do |k| #looping through the keys of my_list\n if k == fav_food #An if statement, where the condition is comapred to one of the parameters\n has_fave = true #If true, declaring a has_fave to true \n fav_food = k #Assigning fav_food to that key\n end\n end\n if has_fave == false #If no matec ==> error\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #If match ==> find value from Hash \n if num_of_people % fav_food_qty == 0 #Module of the first function parameter, number of people by fav food quantity\n num_of_food = num_of_people / fav_food_qty #If true, get portions \n return \"You need to make #{num_of_food} #{fav_food}(s).\" #return an order \n else num_of_people % fav_food_qty != 0 #redundant but if not \n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if there are more people than pies\n pie_qty = num_of_people / my_list[\"pie\"] #This gets portions\n num_of_people = num_of_people % my_list[\"pie\"] #this gets amount of people for leftovers \n elsif num_of_people / my_list[\"cake\"] > 0 #If the number of people is not rgeater than pies, we go into cakes\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def customer_can_afford_drink(customer, beer)\n return customer[:cash] >= beer[:cost]\nend",
"def buy_gift_for(whom)\n if whom == TestConstants::FOR_HIM\n self.buy_gift_for_him\n elsif whom == TestConstants::FOR_HER\n self.buy_gift_for_her\n else\n raise \"Can not buy gift for #{whom} user type. Aborted!\"\n end\n end",
"def customer_can_afford_pet(customers, new_pet)\n if customers[:cash] >= new_pet[:price]\n return true\n else\n return false\n end\nend",
"def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:fishes].each { |fish| expect(fish).to be_a(Fish)}\n new_fish # expect(owner.pets[:fishes].count).to eq(1)\n # = knows about its fishes; Owner knows all about its pets - Owner sets name of pet, the pet can\\'t change its name\n # owner.buy_fish(\"Bubbles\")\n # expect(owner.pets[:fishes][0].name).to eq(\"Bubbles\")\n end",
"def rate_food(food)\n case food\n when \"Steak\"\n \"Pass the stack sause! Delicious!\"\n when \"Sushi\"\n \"Great choise, my favouirete food!\"\n when \"egss\", \"pizza\", \"barbecue\"\n \"even better! yep!\"\n when \"tofu\", \"pasulj\"\n \"yuck!\"\n else\n \"#{food} is not a food!!\"\n end\nend",
"def customer_can_afford_pet(customer,new_pet)\n customer[:cash] >= new_pet[:price] ?\n true : false\n end",
"def is_favorite_of user\n\t fave = get_favorite_for user\n\t fave ? true : false\n\tend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n \n#Determine whether fav_food is a key in my_list\n# if you type in a food that isn't on the list, it raises an argument error\n\nunless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\nend\n\n# takes the value of the favorite food\n fav_food_qty = my_list[fav_food]\n#checks whether the number of people is divisible by that value \n if num_of_people % fav_food_qty == 0\n \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n#if there is a remainder...\n else num_of_people % fav_food_qty != 0\n food_quantity[fav_food] = num_of_people / fav_food_qty\n remaining_people=num_of_people%fav_food_qty\n my_list.each do |k,v|\n if remaining_people / my_list[k] > 0\n food_quantity[k] += remaining_people / my_list[k]\n remaining_people = remaining_people % my_list[k]\n end\n end\n # returns the number of pies, cakes, and cookie that can be made\n return \"You need to make #{food_quantity['pie']} pie(s), #{food_quantity['cake']} cake(s), and #{food_quantity['cookie']} cookie(s).\"\n end\n end",
"def liked?(user_id)\n Like.where(user_id: user_id, dog_id: self.id).exists?\n end",
"def can_afford_to_rent?(movie)\n end",
"def check_dog\n if @vaccinated && @wormed\n \"#{@name} can be accepted\"\n elsif @vaccinated || @wormed\n \"#{@name} can only be accepted by itself\"\n else\n \"#{@name} can not be accepted\"\n end\nend",
"def snake_hit_food?(snake_x, snake_y)\n snake_x == @food_x && snake_y == @food_y\n end",
"def know_resto\n puts \"*\" * 45\n puts \"Which restaurant are you interested in? (Type in the name using proper nouns.)\"\n resto = gets.chomp\n\n choice = Restaurant.find_by(name: resto)\n\n if (choice)\n choice #case-sensitive\n puts \"Here's your restaurant: \\n \"+ \"#{choice.name}, rated: #{choice.rating}; great choice! \\n Call now: #{choice.phone}\"\n else\n try_again\n know_resto\n end\n\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] < new_pet[:price]\n return false\n else\n return true\n end\nend",
"def favorite_check user, img\n user.favorites.each do |fav|\n if fav.image_id == img.id\n return true\n end\n end\n\n return false\n end",
"def spiciest_foods(spicy_foods)\n spicy_foods.select { |spicy_food_hash| spicy_food_hash[:heat_level] > 5}\nend",
"def check_security(people)\n found = false\n people.each do |person|\n if person == \"Don\"\n send_alert\n break\n end\n if person == \"John\"\n send_alert\n break\n end\n end\nend",
"def bakery_num(num_of_people, fav_food) #defines the method and accepts arguments num_of_people and fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0 #declaring variables at 0\n cake_qty = 0 #declaring variables at 0\n cookie_qty = 0 #declaring variables at 0\n \n has_fave = false\n\n my_list.each_key do |k| #iterates through the keys in my_list\n if k == fav_food #checks if passed argument fav_food is in the hash as a key\n has_fave = true #sets boolean has_fave to true\n fav_food = k #re-assigns fav_food to the key in the hash\n end\n end\n \n if has_fave == false #if fav_food is not found in the list\n raise ArgumentError.new(\"You can't make that food\") #raise an error\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #declares a variable that is the quantity of fav food argument and sets it equal to first element in the value\n \n if num_of_people % fav_food_qty == 0 #if number of people is divisable by quantity of fav food\n num_of_food = num_of_people / fav_food_qty #number of food is set to number of people divided by fav food quantity\n return \"You need to make #{num_of_food} #{fav_food}(s).\" #returns string concatenated declaring how much of the food to make\n \n else num_of_people % fav_food_qty != 0 #if num of people is not divisable by fav food qty\n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if number of people divided by number of pies floor is greater than 0 \n pie_qty = num_of_people / my_list[\"pie\"] #sets pie quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"pie\"] #num of people reassigned to remainder \n elsif num_of_people / my_list[\"cake\"] > 0 #if number of people divided by number of cakes floor is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #sets cake quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"cake\"] #num of people reassigned to remainder \n else\n cookie_qty = num_of_people #sets cookie qty to number of people remaining\n num_of_people = 0 #ends the loop if \"cookie else\" is reached\n end\n end\n \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #returns the string, whole combination\n end\n end\nend",
"def found_friends(people)\n friends = []\n people.each do |person|\n if (person == \"Don\")\n friends << \"Don\"\n end\n if (person == \"John\")\n friends << \"John\"\n end\n if (person == \"Kent\")\n friends << \"Kent\"\n end\n end\n return friends\nend",
"def won?(pick)\n\t\t@doors[pick] == 'car'\n\tend",
"def beg_for_food(food_served)\n if food_served\n puts \"Whimper\"\n end\n end",
"def pet_available?(pet_name)\n pet_check = 0\n @pet_arr.each do |animal|\n if pet_name == animal.name_str\n pet_check += 1\n end\n end\n\n if pet_check > 0\n true\n else\n false\n end\n end"
] | [
"0.7919499",
"0.78323776",
"0.77574116",
"0.7713096",
"0.751024",
"0.7380237",
"0.7305857",
"0.7177955",
"0.70903224",
"0.6897792",
"0.66555876",
"0.66448325",
"0.66385484",
"0.66385484",
"0.6511732",
"0.6496382",
"0.64185596",
"0.64185596",
"0.6361961",
"0.6361961",
"0.62514377",
"0.6234234",
"0.6221128",
"0.6152931",
"0.6124165",
"0.6097047",
"0.60969216",
"0.60805583",
"0.60776645",
"0.6070883",
"0.606984",
"0.6065642",
"0.60596055",
"0.6051561",
"0.60498047",
"0.60493207",
"0.6046764",
"0.6045463",
"0.60448503",
"0.60427195",
"0.6031149",
"0.6014242",
"0.59848416",
"0.59567297",
"0.5938028",
"0.5936544",
"0.5932386",
"0.59309095",
"0.5928661",
"0.5922326",
"0.5918071",
"0.5915116",
"0.5910013",
"0.59079945",
"0.5901186",
"0.5888084",
"0.5877399",
"0.58726424",
"0.5858052",
"0.58574784",
"0.58308035",
"0.58232605",
"0.5820675",
"0.5799438",
"0.5799438",
"0.5787031",
"0.57851714",
"0.57817745",
"0.5781092",
"0.5780159",
"0.5777028",
"0.5776636",
"0.57681704",
"0.5766132",
"0.5759074",
"0.5753757",
"0.5735337",
"0.57329845",
"0.57304347",
"0.5729341",
"0.5723716",
"0.5712556",
"0.5710528",
"0.5699449",
"0.56991774",
"0.5693904",
"0.56892025",
"0.56817293",
"0.5678191",
"0.56765026",
"0.56712455",
"0.5667228",
"0.5663831",
"0.5663409",
"0.5662372",
"0.5657706",
"0.5645704",
"0.5644941",
"0.56427765",
"0.5637412"
] | 0.7660454 | 4 |
3. Allow a new friend to be added to a given person Amend to properly test whether the function actually appends the friend to the array. As it is, the test would pass if another friend named "Mick Jagger" were already in the array, but the function added nothing | def add_friend(person, friend)
return person[:friends].push(friend)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_friend(person, new_friend)\n person[:friends].push(new_friend)\n return person[:friends].length()\nend",
"def new_friend(person, new_friend)\n return person[:friends] << new_friend\nend",
"def add_friend(person, friend_to_add)\n person[:friends] << friend_to_add\n return person[:friends].length()\nend",
"def add_friends(friends_array,name)\n friends_array << name\nend",
"def add_friend(person, name)\n person[:friends].push(name)\nend",
"def add_friend(person, friend)\nperson[:friends].push(friend)\nend",
"def add_friend(person, friend)\nperson[:friends].push(friend)\nend",
"def test_add_friend\n add_friend_result = add_friend(@person2, \"Mick Jagger\")\n assert_equal(true, add_friend_result.include?(\"Mick Jagger\"))\n end",
"def test_NoRestrictionsBeingMyOwnFriend\n this_user_found = false;\n user = User.new(\n :first_name=>'forest',\n :last_name=>'gump',\n :username=>'forest',\n :password=>\"gump123\",\n :email=>\"fgump@uiuc.edu\",\n :start_year=>'2009',\n :start_sem=>'FA',\n :birthday=>'1990-10-29',\n :college => College.find(:first),\n :major => Major.find(:first)\n )\n assert_nothing_raised { user.save! }\n user.friends.concat user\n user.friends.each do |eUser |\n if(eUser.id == user.id)\n this_user_found = true\n end\n end\n assert this_user_found\n end",
"def test_add_friend__works\n result = add_friend(@person1, \"George\")\n end",
"def add_friend(friend)\n raise ArgumentError unless friend\n raise ArgumentError.new(\"Already friended\") if friends.include? friend\n\n f = Friendship.new :user_id => self.id, :friend_id => friend.id\n return f.save\n end",
"def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end",
"def is_friend?(all_friends, friend_name)\n # loop over each friend in friend array\n # get friend's name\n # if friend's name == friend_name,\n # return true\n # at end of loop, if friend name not found\n # return false\n\nend",
"def add\n params[:friends].each do |email|\n friend = User.find_by_email(email)\n next unless friend.present?\n\n # Check the inverse friendship and add if necessary\n friendship = Friendship.find_by_user_id_and_friend_id(friend.id, current_user.id)\n unless friendship.present?\n inverse_friendship = friend.friendships.build(friend_id: current_user.id)\n if inverse_friendship.save\n puts \"Added friendship for #{friend.name} (#{friend.id}) and #{current_user.name} (#{current_user.id})\"\n end\n end\n end\n\n render json: { success: true }\n end",
"def test_addFriends\n user1 = User.new(\n :first_name=>'forest',\n :last_name=>'gump',\n :username=>'forest1',\n :password=>\"gump123\",\n :email=>\"fgump1@uiuc.edu\",\n :start_year=>'2009',\n :start_sem=>'FA',\n :birthday=>'1990-10-29',\n :college => College.find(:first),\n :major => Major.find(:first)\n )\n user2 = User.new(\n :first_name=>'forest',\n :last_name=>'gump',\n :username=>'forest2',\n :password=>\"gump123\",\n :email=>\"fgump2@uiuc.edu\",\n :start_year=>'2009',\n :start_sem=>'FA',\n :birthday=>'1990-10-29',\n :college => College.find(:first),\n :major => Major.find(:first)\n )\n assert_nothing_raised { user1.save! }\n assert_nothing_raised { user2.save! }\n @friends_all = User.find :all, :order => 'last_name ASC, first_name ASC' \n @friends_all.each do |eUser|\n if(eUser.id != user1.id) \n friend = User.find eUser.id\n user1.friends.concat friend\n end\n end\n \n #shouldn't be friends with self\n assert_equal(@friends_all.size - 1, user1.friends.length)\n end",
"def isFriendWith(user, testedUser)\r\n if user.friendList.include? testedUser.id\r\n puts \"#{user.fullName} is friend with #{testedUser.fullName}\"\r\n else\r\n puts \"#{user.fullName} is not friend with #{testedUser.fullName}\"\r\n end\r\nend",
"def test_add_new_friend\n add_new_friend(@person5, \"Jason\")\n result = @person5[:friends].last\n assert_equal(\"Jason\", result) \n end",
"def add_friend\n # If there is no pending connection between persons,\n # add pendind/requested connections between them.\n # If there is already a pending connection requested from the other direction,\n # change friendship status to accepted.\n\n if (params['user_id'] == params['friend_id'])\n render_json :messages => \"Cannot add yourself to your friend.\", :status => :bad_request and return\n end\n\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n @friend = Person.find_by_guid(params['friend_id'])\n if ! @friend\n render_json :status => :not_found and return\n end\n\n if @person.association? or @friend.association?\n render_json :messages => \"Association users cannot have friends.\", :status => :bad_request and return\n end\n\n if @person.pending_contacts.include?(@friend) #accept if pending\n Connection.accept(@person, @friend)\n else\n unless @person.requested_contacts.include?(@friend) || @person.contacts.include?(@friend)\n Connection.request(@person, @friend) #request if didn't exist\n end\n end\n\n render_json :status => :ok\n end",
"def add_friend(name)\n # If friend does not already exist, create them without a phone number.\n friend = User.find_by_name name.downcase\n if !friend.nil? && !friend.id.nil?\n puts \"Found user, #{friend.id}, creating Friendship\"\n Friendship.create(:user_1_id => self.id, :user_2_id => friend.id)\n else\n friend = User.create :name => name.downcase\n if !friend.nil? && !friend.id.nil?\n puts \"Found no user, created use, #{friend.id}, creating Friendship\"\n Friendship.create(:user_1_id => self.id, :user_2_id => friend.id)\n else\n puts \"Found no user and could not create new User.\"\n return false\n end\n end\n end",
"def friending(a_user)\n # self.push_uniq(:attendees => a_user.id)\n friendship_ids << a_user.id\n save\n end",
"def pending_or_accepted_friends\n \t friends + pending_friends\n \t end",
"def is_pending_friends_with?(friend)\n \t pending_friends.include?(friend)\n \t end",
"def add_friend(receiver)\r\n self.friends << receiver\r\n receiver.friends << self\r\n self.friends.save && receiver.friends.save\r\n end",
"def add_friend\n\t\t# unless @current_user.friends.include? params[:id] \n\t\t@current_user.push(friends: params[:id])\n\t\t# push to friends array id number of friend\n\n\t\tredirect_to \"/profile/#{@current_user.id}\"\n\t\t# show the new friend\n\tend",
"def concat_friend(friend_email)\n\t\tfriend = self.class.find_by(email: friend_email.downcase)\n\t\treturn ERR_UNSUCCESSFUL if friend == nil\n\t\tif !self.friend_list.include?(friend.id)\n\t\t\tself.friend_list = (self.friend_list << friend.id)\n\t\t\tself.update_attribute(:friend_list, self.friend_list)\n\t\t\tnotif = FriendNotification.new(self)\n\t\t\tfriend.post_notification(notif)\n\t\t\tnotif.send_push(friend)\n\t\tend\n\t\tSUCCESS\n\tend",
"def add_to_friends_list(email)\n send_contact_command email, 'ADL', '1'\n end",
"def add_friend\n\n current_user.friends_list.push(define_friend)\n # binding.pry\n if current_user.save\n render json: current_user \n else\n render json: @user.errors, status: 422\n end\n\n end",
"def add_party(new_party)\n# add the new party to the array\n @list << new_party\n# make the new party the last entry in the array\n @list.last\n end",
"def add (p)\n @people << p \n end",
"def found_friends(people)\n friends = []\n people.each do |person|\n if (person == \"Don\")\n friends << \"Don\"\n end\n if (person == \"John\")\n friends << \"John\"\n end\n if (person == \"Kent\")\n friends << \"Kent\"\n end\n end\n return friends\nend",
"def add_many(new_players)\n #this function is being passed an array so loop!\n for player in new_players\n # @players << (player)\n add_player(player)\n ##OR - issue with this method is if you change add players to ban someone for example it won't apply here\n #@players.concat(new_players)\nend\n\n# good idea for this type of method/fuciton - put a ? in the name i.e. has_players?\n def search_players(player_name)\n # for player in @players\n # if player == player_name\n # return true\n # else\n # return false\n # end\n # end\n # better way to write - had implicit true/false result\n return @players.include?(player)\n end\n\ndef win_points(num)\n @points += num\nend\n\n # def team_name\n # return @team\n # end\n #\n # def coach_name\n # return @coach\n # end\n #\n # def points\n # return @points\n # end\n #\n #\n # def players\n # return @players\n # end\n\n\n\n # def player\n # return @player\n # end\n #\n # def add_player(player)\n # @players << player\n # end\n\nend",
"def add_friend\n # check if this friend isnt't to our list friend\n if params[:user_id].to_i == params[:friend_id].to_i \n render json: {\n message: \"Not yourself\"\n }, status: 400\n else\n @current_user = User.find(params[:user_id])\n if @current_user.friend.find_by(friend: params[:friend_id])\n render json: {\n message: \"#{User.find(params[:user_id]).name} can't be added, You are friend with this user\",\n errors: {\n error_code: \"\",\n error_description: \"\"\n }\n }, status: 401\n else\n # add friend\n puts \"Starting adding friend ...\"\n @new = @current_user.friend.new(friend: params[:friend_id], status: :pending)\n if @new.save\n render json: {\n message: \"#{User.find(params[:user_id]).name} added as friend\"\n }, status: 201\n else\n render json: {\n message: @new.errors.messages\n }, status: 401\n end\n end\n end\n\n end",
"def add_new_friends(emails)\n\t\t@list_email = []\n\t\temails.each {|email|\n\t\t\t@list_email << email if already_exits?(email)\n\t\t}\n @list_email_no_friend = []\n list_email.each {|email|\n id_email = get_id_by_email(email)\n #TODO: Sacar mi id de la sesion\n if !is_friend?(id_usuario_de_la_sesion,id_email)\n @list_email_no_friend << email\n end\n }\n\t\treturn @list_email_no_friend\n\tend",
"def enfriend!(friend)\n friendships.create(friend: friend)\n friend.friendships.create(friend: self)\n end",
"def test_remove_friend\n remove_friend_result = remove_friend(@person1, \"Keith\")\n # binding.pry\n assert_equal(false, remove_friend_result.include?(\"Keith\"))\n end",
"def befriend! new_friend\n run_callbacks :befriend do\n friendships.create! friend: new_friend\n end\n end",
"def is_friends_or_pending_with?(friend)\n \t pending_or_accepted_friends.include?(friend)\n \t end",
"def add_friend_ids=(attributes)\n # I need this custom attr because without it, the friends that were previously saved are not appended to the new\n # friends that are added in the add_friend form.\nattributes[:friend_ids].each do |attribute|\n if attribute != \"\"\n friend = User.find(attribute)\n create_this_transaction(self, friend.id, attributes[:transactions][:amount])\n set_relationship_for_friendship(friend, attributes)\n if !self.friends.include?(friend)\n self.friends << friend\n end\n end\n end\n self.save\nend",
"def insert( list_name, owner, author, text, full_message, submitted )\n # TODO Checking friendship existance requires oauth\n # if owner != author and not base.friendship_exists?(owner, author)\n # puts(owner + \" does not follow \" + author + \". Not adding list.\")\n # else\n # puts (owner + \" \" + author + \" are friends, adding to list.\")\n # end\n \n @list = List.find( :first, \n :conditions => { :name => list_name,\n :owner => owner } )\n \n if not @list\n \n #Don't allow creating a list for someone else.\n if owner != author\n puts (owner + \" \" + author + \" \" + list_name + \" doesn't exist, not creating.\")\n return false\n end\n \n @list = List.new({ \"owner\" => owner,\n \"name\" => list_name,\n \"permission\" => \"public\" } )\n @list.save #TODO error handling here like in list create method\n end\n \n #Created a list but no more items\n if text == \"\"\n return false\n end\n \n #Check if the item exists, since we assume the messages\n #come in chronological order, we can just break when\n #we find something.\n @item = Item.find( :first,\n :conditions => { :author => author,\n :text => text,\n :submitted => submitted } ) \n #Clean up this search by using the submit time and the list name or ID TODO\n #TODO really need to check submit time to make sure it's the same message\n if @item\n puts(\"Already saw this element before\")\n return true\n end\n \n @item = @list.items.build( { :author => author,\n :text => text,\n :fullMessage => full_message,\n :submitted => submitted } )\n @item.save #TODO error handling\n print \"item saved\"\n \n return false\n end",
"def befriend new_friend\n run_callbacks :befriend do\n friendships.create friend: new_friend\n end\n end",
"def save_friendships\n array = friendlist(current_user)\n puts \"array: \\n #{array}\"\n array.each do |user|\n puts \"user id is #{user.id}\"\n puts \"current user is #{current_user.id}\"\n if Friendship.where(\"user_id = ? AND friend_id = ?\", current_user.id, user.id).exists?\n puts \"Friendship already exists: #{Friendship.where(\"user_id = ? AND friend_id = ?\", current_user.id, user.id).inspect}\"\n next\n elsif Friendship.where(\"user_id = ? AND friend_id = ?\", user.id, current_user.id).exists?\n puts \"Friendship already exists: #{Friendship.where(\"user_id = ? AND friend_id = ?\", user.id, current_user.id).inspect}\"\n next\n elsif (user.id == current_user.id)\n puts \"Can't be friends with yourself!\"\n next\n else\n puts \"#{user.id} isn't a friend of #{current_user.id} yet!\"\n Friendship.create(user_id: current_user.id, friend_id: user.id, friendship_status: \"suggested\")\n end\n end\n end",
"def addFriend\n #Now i have this friend data from the data base and i already have the groupId\n #get the friend name\n @notify = current_user.invited_members;\n\t\t@friendName = params[:name]\t\n #check if it is null\n if @friendName.empty?\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Please insert some data !' }\n format.json { head :no_content }\n end\n else\n #check if it is wrong type\n if User.exists? name: @friendName\n #it is really a user\n #check if he is tring to add himself\n if @friendName == current_user.name\t\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Cant inser your self!' }\n format.json { head :no_content }\n end\n else\t\n #check if the user exist in the group itself before\n @fid = User.find_by(name: params[:name])\n @current_group = Group.find(params[:groupId])\n if @current_group.group_members.exists? user: @fid.id \t \n puts \"why you are tring to add the same friend\"\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This Friend is already assigned to this group !!' }\n format.json { head :no_content }\n end\n else\n #check if this user in friendship list or not\n @fid = User.find_by(name: params[:name])\n @user = current_user\n if @user.user_friends.exists? friend: @fid.id\n @fid = User.find_by(name: params[:name])\n @gid = params[:groupId]\n @group = @fid.group_members.create(group_id: @gid)\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This Friend is Add !!' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This user is not currently in your friend list! !!' }\n format.json { head :no_content }\n end\n \t\n end\n end\t\t\t\t\t\n \n \n end\t\n else\n #it is a robot\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This user is not exist !' }\n format.json { head :no_content }\n\n end\t\n end\n end\t\t\n\n end",
"def friend_request(other_user)\n\t\trequested_friends.push(other_user)\n\tend",
"def is_friends_with?(friend)\n self.friends.include?(friend)\n end",
"def add_future_friend(friend_id)\n add_future_params(:add_friends, [friend_id])\n end",
"def check_if_already_friends\n unless Friendship.find_friendship(requester_id, requestee_id).nil?\n errors.add(:base, \"You are already friends with this user\")\n end\n end",
"def change_to_friends(old_permission)\n # From private:\n # Add to my mutual friends' feeds\n # Add to my FriendStoriesList\n if old_permission == 'private'\n friend_ids = user.mutual_friend_ids\n pushed_user_ids = add_to_friend_feeds(friend_ids)\n\n FriendStoriesList.new(id: user.id).add_message(self)\n\n # From public:\n # Remove from the feeds of my followers who I haven't added back\n # Remove from my NonFriendStoriesList\n elsif old_permission == 'public'\n friend_ids = user.follower_ids - user.friend_ids\n delete_from_friend_feeds(friend_ids)\n\n NonFriendStoriesList.new(id: user.id).message_ids.delete(id)\n\n check_last_public_story\n end\n\n pushed_user_ids\n end",
"def participations_attributes_change(attributes)\n return unless attributes\n attributes.each do |index, participation|\n person_id = participation[:person_id]\n if person_id !~ /^([0-9]+|)$/\n friend = current_user_or_guest.friends.where(name: person_id).first_or_create!\n attributes[index][:person_id] = friend.id\n end\n end\n end",
"def add_new_gift(gifts_array, new_gift)\r\n gifts_array << new_gift\r\nend",
"def add_new_person\n\n puts \"What is the name?\"\n name = gets.chomp\n\n if @people.any? { |employee| employee.name == name }\n puts \"This person is already in the database.\"\n else\n employee = Employee.new\n employee.name = name\n puts \"What is the phone number?\"\n employee.phone = gets.chomp\n puts \"What is the address?\"\n employee.address = gets.chomp\n puts \"What is the position?\"\n employee.position = gets.chomp\n puts \"What is the salary?\"\n employee.salary = gets.chomp\n puts \"What is the slack account?\"\n employee.slack = gets.chomp\n puts \"What is the GitHub account?\"\n employee.github = gets.chomp\n puts\n puts \"Thank you. These records have been added to the database.\"\n puts\n\n @people << employee\n end\n end",
"def add_pet_to_customer(customer, new_friend)\n customer[:pets] << new_friend\nend",
"def send_friend_request(other_user)\n friend_requests << other_user\n end",
"def pending_friends\n \t pending_friends_by_me + pending_friends_for_me\n \t end",
"def add_responsible(responsible)\n users << responsible\n end",
"def add_member(input_jury)\n\t\t@members << input_jury\n\tend",
"def friend?(user)\n friends.include?(user)\n end",
"def add_fb_friends(fb_user_info)\n friend_ids = self.friends.pluck(:id)\n\n (fb_user_info ||= []).each do |index, friend|\n\n auth = UserAuthentication.find_by(provider: \"facebook\", uid: friend['id'])\n user_friend = auth.user if auth\n\n if user_friend && !(friend_ids.include? user_friend.id)\n self.friended_users << user_friend\n end\n end\n end",
"def addPerson(person)\n @person.push(person)\n end",
"def add_friends( whose, conn, friends )\n friends[whose] = true\n links = conn.delete( whose )\n return unless links\n\n # We added the user; now add all of their connections. Tack them on to the\n # end of the list (dropping duplicates) as we run through it, so they will\n # be similarly processed in turn. We must continue to make passes through\n # the list until it stopped growing, at which point we know we've added\n # all the friends and friends of friends of the first user. \n count = 0\n until count == links.size\n count = links.size\n\n links.keys.each do |link|\n sublinks = conn.delete( link )\n links.merge!( sublinks ) if sublinks\n end\n end \n\n # Now that we have the definitive list of this user's connections (and\n # their connections), tag them all as friends of the PM.\n friends.merge!( links )\n end",
"def allowed_friend?(friend)\n @allowed.include? friend.to_s.split('/').first\n end",
"def save\n return false unless valid?\n Friendship.create( member: member1, friend: member2 ) && Friendship.create( member: member2, friend: member1 )\n end",
"def is_friend?\n @friended\n end",
"def add_member(lineup)\n puts \"you have chosen to add a spice girl. Enter the name of the girl: \"\n lineup.list_names2\n pick_newby = gets.chomp\n lineup.name_check=(pick_newby)\n lineup.add_girl(pick_newby)\n puts \"your new lineup is :\"\n lineup.list_names\nend",
"def can_add_member?(team_name,member)\n true\n end",
"def approve(user)\n return false unless pending_inverse_friend_ids.include?(user.id) && user.pending_friend_ids.include?(self.id)\n pending_inverse_friend_ids.delete(user.id)\n user.pending_friend_ids.delete(self.id)\n inverse_friend_ids << user.id\n user.friend_ids << self.id\n self.save && user.save\n end",
"def make_friends(user, target)\n return false if user.blank? || target.blank? || user == target\n transaction do\n begin\n self.find(:first, :conditions => {:inviter_id => user.id, :invited_id => target.id, :status => MuckFriends::FOLLOWING}).update_attribute(:status, MuckFriends::FRIENDING)\n friend = self.create!(:inviter_id => target.id, :invited_id => user.id, :status => MuckFriends::FRIENDING)\n friend.add_friends_with_activity\n rescue Exception\n return make_friends(target, user) if user.followed_by?(target)\n return add_follower(user, target)\n end\n end\n true\n end",
"def get_a_friend\n unless self == User.first\n friends << User.first\n end\n end",
"def invite_people\n end",
"def add (person)\n if person.is_a? Person\n @lists << person\n else\n raise \"Only objects that are relate to class Person can only be entered in the address book.\"\n end\n end",
"def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"There was a problem! (Ya been blocked!)\"}\n end\n\n followee = User.find(follow_params[:user2])\n #insert the one way relation in db!\n friend_request = Follow.new(follower_id: user.id, followee_id: followee.id)\n if friend_request.save\n render json: {friend_request: followee} \n else\n render json: {error: \"There was a problem!\"}\n end\n end",
"def pending_or_accepted_friends\n self.friends + self.pending_friends\n end",
"def set_friendship\n end",
"def remove_friend\n end",
"def accept\n\t\tuser.friends << friend\n\t\tdestroy\n\tend",
"def test_remove_friend__works\n result = remove_friend(@person4, \"Velma\")\n end",
"def friends_of_friends\n # Unit Test is in Friendship.rb\n #The first 'row' is a list of the user's friends of friends,\n #which are each in rings farther than the ring of the friend's friendship with the user\n #The second 'row' is the number of common friends the user has with the person listed in the first row.\n friends_of_friends = Array.new\n for friend in self.mutual_friends\n for friend_of_friend in friend.mutual_friends\n #A friend's friend is only seen if you are as close or closer to your friend as your friend's friend.\n if friend.which_ring(friend_of_friend) >= friend.which_ring(self)\n #If you can view the friend, then his/her presence in the friend_of_friends list is determined\n if friends_of_friends.flatten.include?(friend_of_friend)\n #If he/she is in the list, then just the number of common friends in the second row of the correct friend is incremented.\n friends_of_friends.assoc(friend_of_friend)[1] += 1\n else\n #If he/she isn't in the list, then a new column is added to the list unless the friend is you or he/she is already your friend.\n unless friend_of_friend == self or self.friends.exists?(friend_of_friend.id)\n friends_of_friends << Array.[](friend_of_friend, 1) \n end\n end\n end\n end\n end\n return friends_of_friends\n end",
"def friend_request_requester?\n friend_request_exists? && friend.requester == record\n end",
"def pending_friendship?(other_user)\n pending_friends.include?(other_user)\n end",
"def is_pending_friends_with?(friend)\n self.pending_friends.include?(friend)\n end",
"def test_friends_for_and_by\n assert_equal [], users(:quentin).friends_for_me\n assert_equal [users(:quentin)], users(:user_20).friends_for_me\n assert_equal 50, users(:quentin).friends_by_me.size\n end",
"def add_reviewer(appl_for_offering , reviewer_info, offering_id, reviewer_or_mentor, award_type_letter, year)\r\n\t\t# Get the person record for the reviewer\r\n\t\tfind_info = {:firstname => reviewer_info.FirstName, :lastname => reviewer_info.LastName, :email => reviewer_info.EmailAddress, :address1 => reviewer_info.Address, :city => reviewer_info.City, :state => reviewer_info.State, :zip => reviewer_info.PostalCode, :salutation => \" \"}\r\n\t\treviewer = Person.find_or_create_by_best_guess(find_info)\r\n\t\t\r\n\t\tcommittee_id = award_type_letter == \"R\" ? MGE_RES_REV_COMM : OLD_MGE_REV_COMM\r\n\t\t\r\n\t\t#reviewer = Student.find_by_student_no(\"0528239\") # Use my own record to test\r\n\t\t\r\n\t\t# Adds the person as a comittee member if they are not already in it\r\n\t\tcomm_member = CommitteeMember.find(:first, :conditions => {:person_id => reviewer.id, :committee_id => committee_id})\r\n\t\tif comm_member.nil?\r\n\t\t\tcomm_member = CommitteeMember.new\r\n\t\t\tcomm_member.person_id = reviewer.id\r\n\t\t\tcomm_member.committee_id = committee_id\r\n\t\t\tcomm_member.committee_member_type_id = case reviewer_or_mentor.Status_Key\r\n\t\t\t\twhen 3 then 2 # specialist reviewer\r\n\t\t\t\telse 1 # general reviewer / feedback contact\r\n\t\t\tend\r\n\t\t\tcomm_member.skip_person_validations = true;\r\n\t\t\tcomm_member.save!\r\n#\t\t\tputs \" New Committee Member\"\r\n\t\telse\r\n\t\t\tcomm_member.skip_person_validations = true;\r\n#\t\t\tputs \" Already Committee Member\"\r\n\t\tend\r\n\t\t\r\n\t\t# Adds the person as a application reviewer if they are not already on it\r\n\t\tappl_reviewer = ApplicationReviewer.find(:first, :conditions => {:committee_member_id => comm_member.id, :application_for_offering_id => appl_for_offering.id})\r\n\t\tif appl_reviewer.nil?\r\n\t\t\tappl_reviewer = ApplicationReviewer.new\r\n\t\t\tappl_reviewer.committee_member_id = comm_member.id\r\n\t\t\tappl_reviewer.application_for_offering_id = appl_for_offering.id\r\n\t\t\tappl_reviewer.finalized = true\r\n\t\t\tappl_reviewer.save!\r\n\t\t\tappl_reviewer.create_scores\r\n#\t\t\tputs \" New App Reviewer\"\r\n\t\tend\r\n\t\t# Adds the additional comment of feedback person to reviewers that also were one\r\n\t\tif reviewer_or_mentor.Status_Key == 4\r\n\t\t\t\tappl_reviewer.comments = \"Feedback Person\"\r\n\t\t\t\tappl_reviewer.save!\r\n#\t\t\t\tputs \" Feedback Person\"\r\n\t\tend\r\n\t\t\r\n#\t\tputs \" App Reviewer app for offering id: #{appl_reviewer.application_for_offering_id.to_s}\"\r\n\t\t\r\n\t\t# make the score entry (there should only ever be one)\r\n\t\t\r\n\t\tif year > 2004\r\n\t\t\tif appl_reviewer.scores.count == 1\r\n\t\t\t\tunless appl_reviewer.scores[0].score.to_i >= reviewer_or_mentor.Rating_Key.to_i\r\n\t\t\t\t\tscore_to_change = appl_reviewer.scores[0]\r\n\t\t\t\t\tscore_to_change.score = reviewer_or_mentor.Rating_Key\r\n\t\t\t\t\tscore_to_change.save!\r\n#\t\t\t\t\tputs \" Reviewer Score: #{score_to_change.score}\"\r\n\t\t\t\telse\r\n#\t\t\t\t\tputs \" Reviewer Score: Kept the pervious due to duplicate person\"\r\n\t\t\t\tend\r\n\t\t\telse\r\n#\t\t\t\tputs \" BAD: It made #{appl_reviewer.scores.count.to_s} score entries instead of just 1\"\r\n\t\t\tend\r\n\t\tend \r\n\t\tappl_reviewer.save! # Save the application reviewer entry\r\n\t\t\r\n\tend",
"def add_first_friend\n if User.count > 0\n f = self.friendships.create!(:friend_id => User.find_by_username(DEFAULT_FRIEND_NAME).id)\n f.status=true;\n f.save\n end\n end",
"def add_friend_request(user_id)\n friend_suggestions.where(user_id: user_id).delete_all\n req = pending_friends.where(id: user_id).first\n if req.present?\n req.accept!\n else\n req = UserFriendRelationship.between(user_id, id).first || user_friend_relationships.create(user_to_id: user_id)\n PubSub::Publisher.new.publish_for([req.user_to], 'friend_request', {source: self.as_basic_json}, {title: full_name(false), body: 'wants to be your friend'})\n end\n # reset_cache('suggested_friends')\n end",
"def add\n\t\treturn ERR_INVALID_NAME if not name_valid?\n\t\treturn ERR_INVALID_EMAIL if not email_valid?\n\t\treturn ERR_INVALID_PASSWORD if not password_valid?\n\t\treturn ERR_EMAIL_TAKEN if not email_available?\n\t\tcreate_remember_token\n\t\tself.friend_list = Array.new\n\t\tself.event_list = Array.new\n\t\tself.notification_list = Array.new\n\t\tself.save\n\t\tSUCCESS\n\tend",
"def add_contact(ownnick, person)\n return ret_fail('can not add yourself') if person == ownnick #you cant add yourself !\n\n usr = User.first(:nickname=>person)\n return ret_fail('no such user') if usr == nil #user does not exist !\n\n ownusr = User.first(:nickname => ownnick) #get own record to get the contact list\n return ret_fail('already in list') if ownusr.contacts.first(:userid => usr.id) != nil\n\n c = ownusr.contacts.new\n c.userid = usr.id\n puts usr.id\n puts c.userid\n c.authgiven = 'f'\n c.save\n\n return ret_success\nend",
"def add_player(new_party_member)\n @player_characters << new_party_member unless(@player_characters.include?(new_party_member))\n end",
"def friend_with?(user)\n friends.include?(user)\n end",
"def add_to_friend_feeds(friend_ids = nil)\n # If friend_ids is not given (i.e. this is the first time setting the permission),\n # add it to the default friend ids for the permission\n friend_ids ||= if public?\n user.follower_ids.members\n elsif friends?\n user.mutual_friend_ids\n else\n []\n end\n\n pushed_user_ids = []\n\n results = redis.pipelined do\n friend_ids.each do |friend_id|\n feed = FriendFeed.new(id: friend_id)\n feed.add_message(self)\n end\n end\n\n results.each_with_index do |added, i|\n pushed_user_ids << friend_ids[i] if added\n end\n\n pushed_user_ids\n end",
"def add_entry(p)\n\t\t@persons += [p]\n\t\t@persons = @persons.sort {|a,b| by_name(a,b) }\n\tend",
"def user_already_friend(friend_id)\n @friend = Friendship.where('friend_id = ' + friend_id.to_s + \" AND user_id = \"+id.to_s)[0]\n return !@friend.blank?\n end",
"def delete_friend(person, delete_friend)\n person[:friends].delete(\"Rick\")\n return person[:friends]\nend",
"def updatable_by?(actor)\n return true if actor == invitee\n return false\n end",
"def add_attendee!(user, dont_tweet = false)\n # Return true if already a supporter\n return true if self.is_attendee?(user)\n self.attendee_ids ||= []\n # Add supporter id\n self.attendee_ids << user.id\n\n # Tweet from supporter's account - no longer doing this now\n # unless dont_tweet\n # tw = user.twitter_client\n # tw.update(DemoDay.tweet_content) if Rails.env.production? && tw.present?\n # end\n\n save\n end",
"def add_follower(user)\n followers << user\n end",
"def remove_friend(person, friend_to_remove)\n person[:friends].delete(friend_to_remove)\n return person[:friends].length()\nend",
"def addFriend(user)\n method = 'addFriend'\n type = true\n args = {:user=>user}\n return_object type,method,args,true\n end",
"def friend\n if params.include?(:id)\n @user.friends += [User.find(params[:id])]\n elsif params.include?(:username)\n @user.friends += [User.find_by(username: params[:username])]\n end\n redirect_to root_path\n end",
"def help_me\n puts \"Add an answer\"\n @sum_of_all_arrays << @answer_list.concat(@user_list)\n answer = gets.strip\n if @sum_of_all_arrays.flatten.include?(answer) == true\n puts \"It's already on the list\"\n else\n @user_list << answer\n puts @user_list\n end\n menu\nend",
"def attend_a_class(gym_membership, person_name, class_name, class_date, class_time)\n \n gym_membership[person_name.to_sym][:\"classes\"][:\"registered\"].each_with_index do |class_data_hash, index|\n if class_data_hash.keys[0].to_s == class_name && class_data_hash[class_data_hash.keys[0]][:\"scheduled\"] == \"#{class_time} #{class_date}\"\n gym_membership[person_name.to_sym][:\"classes\"][:\"attended\"].push(class_data_hash)\n #remove the class from the registered array\n gym_membership[person_name.to_sym][:\"classes\"][:\"registered\"].slice!(index, 1)\n return gym_membership\n end\n end\n \n return \"Attendance failure: #{class_name} at #{class_time} on #{class_date} was not registered\"\nend",
"def friends\n self.friended_users + self.users_friended_by\n end"
] | [
"0.73931926",
"0.72478646",
"0.71059775",
"0.7091791",
"0.70035666",
"0.6995056",
"0.6995056",
"0.6811375",
"0.64103395",
"0.62606937",
"0.62432367",
"0.62128067",
"0.61727315",
"0.6167333",
"0.61582047",
"0.61464274",
"0.6122372",
"0.6022118",
"0.60167253",
"0.60007757",
"0.5995019",
"0.594989",
"0.590335",
"0.5869309",
"0.58690745",
"0.5858417",
"0.5816547",
"0.5813029",
"0.5812819",
"0.5778626",
"0.5772056",
"0.5760937",
"0.5725973",
"0.57069093",
"0.5692733",
"0.5692249",
"0.5688908",
"0.56876636",
"0.56814003",
"0.566443",
"0.5653067",
"0.5645796",
"0.56109464",
"0.560664",
"0.5599204",
"0.55987364",
"0.5583772",
"0.5577459",
"0.5549298",
"0.5542323",
"0.55358636",
"0.5515988",
"0.5490161",
"0.548602",
"0.5485465",
"0.54787046",
"0.54767",
"0.5473467",
"0.5470302",
"0.54544926",
"0.54365766",
"0.54227966",
"0.5417473",
"0.5413891",
"0.54077286",
"0.54053175",
"0.5400098",
"0.5391195",
"0.53903306",
"0.53882366",
"0.53676724",
"0.53671855",
"0.5366124",
"0.53587306",
"0.5353754",
"0.5352309",
"0.5349205",
"0.5343837",
"0.5337558",
"0.5336076",
"0.53350335",
"0.5329513",
"0.53192234",
"0.5314874",
"0.5305532",
"0.5289266",
"0.52818394",
"0.5278459",
"0.52769846",
"0.527686",
"0.52739173",
"0.5273761",
"0.52698433",
"0.52623636",
"0.52580994",
"0.5257195",
"0.525619",
"0.52544993",
"0.52509123",
"0.5249898"
] | 0.70344627 | 4 |
4. Allow a friend to be removed from a given person Flawed because the [:friends] array could include more than one friend with the same name. You would only want to remove one of them, not all. | def remove_friend(person, friend)
# binding.pry
person[:friends].delete(friend)
return person[:friends]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_friend(person, friend)\n person[:friends].delete(friend)\nend",
"def remove_friend(person, friend)\n person[:friends].delete(friend)\nend",
"def remove_friend(person, friend_to_remove)\n person[:friends].delete(friend_to_remove)\n return person[:friends].length()\nend",
"def remove_friend\n end",
"def delete_friend(person, delete_friend)\n person[:friends].delete(\"Rick\")\n return person[:friends]\nend",
"def delete_friend(other_user)\t\t\n\t\tif requested_friends.include?(other_user) \n\t\t\t\trequested_friends.delete(other_user)\n\t\telsif received_friends.include?(other_user) && received_relationships.find_by(friend_active_id: other_user.id).accepted?\n\t\t\t\treceived_friends.delete(other_user)\n\t\tend\n\tend",
"def test_remove_friend__works\n result = remove_friend(@person4, \"Velma\")\n end",
"def remove_friend(friend_email)\n\t\tfriend = self.class.find_by(email: friend_email.downcase)\n\t\tif friend != nil\n\t\t\tself.friend_list.delete(friend.id)\n\t\t\tself.update_attribute(:friend_list, self.friend_list)\n\t\tend\n\t\tSUCCESS\n\tend",
"def remove_reverse_friendship\n Friendship.delete_all :user_id => self.friend_id, :friend_id => self.user_id\n end",
"def reject_friend(user)\n friendship = inverse_friendships.find { |friendship| friendship.user == user }\n friendship.destroy\n end",
"def delete_friendship_with(friend)\n \t friendship(friend).destroy if self.is_friends_or_pending_with?(friend)\n \t end",
"def unfriend friend\n friendships.where( friend: friend ).first.destroy\n end",
"def remove_from_friends_list(email)\n send_contact_command email, 'RML', '1'\n end",
"def remove\n\t\tif request.post?\n\t\t\tfriendship = Friendship.where(user_id: params[:user_id], friend_id: params[:friend_id]).first\n\t\t\tunless friendship\n\t\t\t\trender json: {error: \"You are not friends\"} and return\n\t\t\tend\n\t\t\tfriendship.destroy\n\t\t\trender json: {msg: \"Friend deleted\"}\n\t\tend\n\tend",
"def delete_friend\n \t#friend = User.find(params[:friend_id])\n respond_to do |format|\n \tif @user.friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} deleted!\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n else\n error = \"You aren't friends with #{@friend.nick_name}\"\n format.json { render :json => {:error => error, :status => \"400\"} }\n end\n end\n end",
"def remove_friends_access\r\n @friend_ids = current_user.friend_ids\r\n Share.destroy_all({:caused_by_friends => true, :image_id => @image.id, :user_id => @friend_ids})\r\n # delete image order IF no selected-share exists (cleanup dependent)\r\n current_user.friends.each do | friend |\r\n if !Share.exists?({:caused_by_friends => false, :image_id => @image.id, :user_id => friend.id})\r\n ImageOrder.destroy_all({:image_id => @image.id, :user_id => friend.id})\r\n end\r\n end \r\n end",
"def remove_friend\n return if !remove_any_connection_between(params['user_id'], params['friend_id'])\n render_json :status => :ok and return\n end",
"def destroy\n another_user = User.find params[:user_id]\n current_user.friends.delete(another_user)\n redirect_to users_path\n end",
"def delete_friend(receiver)\r\n self.friends.delete(receiver)\r\n receiver.friends.delete(self)\r\n self.friends.save && receiver.friends.save\r\n end",
"def remove\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n User.find(params[:user_id]).friends.delete(current_user)\n current_user.friends.delete(User.find(params[:user_id]))\n\n redirect_to friends_path\n end\n end",
"def destroy\n user = User.find(params[:id])\n begin\n current_user.friends.delete(user)\n user.friends.delete(current_user)\n rescue\n end\n\n respond_to do |format|\n format.html { redirect_to '/manage/friends' }\n end\n end",
"def remove\n @user = current_user\n @friend = User.find(params[:friend_id])\n @friendship = @user.send(:find_any_friendship_with, @friend)\n if @friendship\n @friendship.delete\n @removed = true\n flash[:friendship_removed] = \"Friendship removed #{@friend.email} $green\"\n else \n flash[:friendship_removed] = \"Friendship was not #{@friend.email} $red\"\n end\n l = Log.new\n l.user_id_1 = @user.id\n l.user_id_2 = @friend.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n name_2 = if @friend.name.nil? then @friend.email.split('@')[0] else @friend.name end\n l.message = \"#{name_1.humanize} removed friendship of #{name_2.humanize}\"\n l.loggingtype = 0\n l.save\n\n @user.rank = @user.rank - 4\n @user.save\n @friend.rank = @friend.rank - 4\n @friend.save\n\n redirect_to action: \"index\"\n end",
"def destroy\n @friend.destroy\n @delete_friend.each(&:destroy)\n redirect_to user_path(current_user)\n flash[:notice] =\n 'You Removed This Friend'\n end",
"def destroy\n @user = User.find(params[:user_id])\n\n #this is okay because only one of these EVER exists at a time\n current_user.friends_requested.delete(@user)\n current_user.friend_requesters.delete(@user)\n\n if current_user.save\n flash[:success] = \"Request deleted!\"\n else\n flash[:error] = \"You can't let that person go just yet.\"\n end\n\n redirect_to session.delete(:return_to)\n end",
"def destroy\n @friend = current_user.friendships.find(params[:id])\n @friend.destroy\n flash[:notice] = \"Removed friend.\"\n redirect_to current_user\n end",
"def delete_friendship\n user = User.find(params[:user_id])\n @friendship = user.friendships.where(friend_id: params[:friend_id]).first ||\n user.inverse_friendships.where(friend_id: params[:user_id]).first\n if @friendship.present? # Can't call exists on a single record\n @friendship.delete\n render status: :ok, json: {\n message: 'Successfully deleted friendship'\n }.to_json\n else\n render status: :bad_request, json: {\n message: 'No friendship to delete'\n }\n end\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friend = @friendship.friendshipped_for_me == @user ? @friendship.friendshipped_by_me : @friendship.friendshipped_for_me\n\n flash[:notice] =\n if @user.is_friends_with?(@friend)\n \"You are no longer a friend of #{@friend.login}\"\n else\n \"You are no longer an admirer of #{@friend.login}\"\n end\n\n @friendship.destroy_or_unaccept(@user)\n redirect_to user_path(@friend)\n\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = nil\n redirect_to user_path(@user)\n end",
"def destroy\n\n # Your friend will first remove you as friend\n your_friend = Friend.where(\"account_id = ? AND friend_account_id = ?\", @friend.friend_account_id, current_account.id).first\n your_friend.destroy\n\n # Now, Remove your friend\n @friend.destroy\n\n respond_to do |format|\n format.html { redirect_to friends_url, notice: 'Friend was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def accept\n\t\tuser.friends << friend\n\t\tdestroy\n\tend",
"def destroy\n\n @plant = Plant.find(params[:id])\n @friendship = @plant.friendships.find_by_friend_id(params[:friend_id])\n\n if @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to remove friend\"\n redirect_to request.referrer\n end\n end",
"def unfriend\n if relation = @user.friendships.find_by(friend_id: @friend.id)\n relation.destroy\n render json: { success: true }\n else\n render json: {message: relation.errors&.full_messages&.first}, status: 202\n end\n end",
"def reject\n other_id=params[:other_id].to_i()\n my_id=session[:user_id]\n if my_id<other_id then\n small_id=my_id\n big_id=other_id\n elsif my_id>other_id then\n small_id=other_id\n big_id=my_id\n else\n flash[:notice] = \"There was an removing the friend.\"\n redirect_to request.referrer\n return false\n end\n #NOTE: Don't copy and reuse the delete_all method for tables whose rows are dependencies.\n if Friend.destroy_all([\"(small_id=? AND big_id=?)\",\n small_id, big_id]) then\n flash[:notice] = \"Removed friend successfully.\"\n #redirect_to request.referrer\n return true\n else\n flash[:notice] = \"There was an error removing the friend.\"\n redirect_to request.referrer\n return false\n end\n session[:number_of_friend_invites]-=1\n end",
"def delete_friendship_with(friend)\n self.friendship(friend).destroy if self.is_friends_or_pending_with?(friend)\n end",
"def destroy\n\t @friendable = Friendable.where(from_id: [current_user, params[:id]]).where(to_id: [current_user, params[:id]]).last\n\t @friendable.destroy\n\t flash[:notice] = \"Removed friendship.\"\n\t redirect_to :back\n\t end",
"def destroy\n if @friendship.accepted\n @other_friendship = Friendship.find_by :requester_id => @friendship.granter_id, :granter_id => @friendship.requester_id\n @other_friendship.destroy\n notice = 'You and ' + Person.find(@friendship.granter_id).name + ' are no longer friends!'\n else\n notice = 'You have cancelled your friend request to ' + Person.find(@friendship.granter_id).name\n end\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: notice }\n format.json { head :no_content }\n end\n end",
"def destroy\n friend_id = current_user.id # as it's the current user who's deleting the friendship\n friend = User.find(friend_id)\n \n # a notification message will be delivered to the the requestor anyway;\n # it may contain a personal note, if any was supplied\n from_id = friend_id\n to_id = (@friendship.friend_id == friend_id ? @friendship.user_id : @friendship.friend_id) \n rejection = (@friendship.accepted_at.nil?) ? true : false\n \n # the same method ('destroy') works when friendship is rejected\n # or removed after being accepted previously\n if rejection\n subject = friend.name + \" has rejected your friendship request\" \n body = \"<strong><i>Personal message from #{friend.name}:</i></strong><hr/>\"\n \n if params[:reject_msg] && !params[:reject_msg].blank?\n body += ae_some_html(params[:reject_msg])\n else\n body += \"NONE\"\n end\n body += \"<hr/>\"\n else\n subject = User.find(from_id).name + \" has removed you from their friends list\"\n body = \"User: <a href='#{user_path(from_id)}'>#{friend.name}</a>\" +\n \"<br/><br/>If you want to contact this user directly, just reply to this message.\"\n end\n \n # the message will appear as 'deleted-by-sender', because the owner of the account effectively didn't send it,\n # so there is no reason for showing this message in their 'sent messages' folder\n message = Message.new( :from => from_id, :to => to_id, :subject => subject, :body => body, :reply_id => nil, :read_at => nil, :deleted_by_sender => true )\n message.save\n \n @friendship.destroy\n\n respond_to do |format|\n flash[:notice] = \"Friendship was successfully deleted\"\n format.html { redirect_to(params[:return_to] ? params[:return_to] : user_friendships_path(friend_id)) }\n end\n end",
"def removeFriend(user)\n method = 'removeFriend'\n type = Boolean\n args = {:user=>user}\n return_object type,method,args,true\n end",
"def unfriend(other_user)\n @friendship = user.friendships.find_by(friend: other_user)\n @friendship.destroy\n end",
"def destroy\n @friendship = @current_user.friendships.find_by_id(params[:id])\n if @friendship.destroy\n flash[:success] = \"This relationship has been deleted\"\n else\n flash[:error] = \"Delete failed, if you really want, please try again\"\n end\n redirect_to(individual_path(@current_user))\n end",
"def destroy\n @friendship = current_user.friendships.find_by_id(params[:id])\n @friendship = current_user.inverse_friendships.find_by_id(params[:id]) unless @friendship.present? \n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to user_friend_url(current_user), notice: 'Friendship was successfully Removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_user.end_friendship!(@relationship.friend)\n respond_to do |format|\n format.html { redirect_to relationships_url }\n end\n end",
"def destroy\n user = begin User.find(params[:id]) rescue nil end\n @friend = FriendsUser.find(:first, :conditions => [\"user_id = ? AND friend_id = ?\", current_user.id, user.id])\n if @friend\n if @friend.destroy\n flash[:notice] = I18n.t('friend.destroy.notice')\n else\n flash[:error] = I18n.t('friend.destroy.error')\n end\n else\n flash[:error] = I18n.t('user.general_error')\n end\n redirect_to user_friends_path(current_user)\n end",
"def test_remove_friend\n remove_friend_result = remove_friend(@person1, \"Keith\")\n # binding.pry\n assert_equal(false, remove_friend_result.include?(\"Keith\"))\n end",
"def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"No longer friends.\"\n redirect_to :back\n end",
"def decline_friend(friend)\n begin\n @roster.decline_subscription(friend)\n rescue\n @log.error \"Error declining friend #{friend}: #{$!}\"\n end\n end",
"def fellow_cult_members\n friends = cults.map {|cult| cult.followers}.flatten.uniq\n friends.delete(self)\n friends\n end",
"def destroy_arbitrary_friendship\n user_1 = current_admin.users.find(params[:user_1])\n user_2 = current_admin.users.find(params[:user_2])\n Friendship.destroy_arbitrary_friendship(user_2, user_1 )\n puts \"=============================================================\"\n redirect_to :back, :notice => \"#{user_1.username} totally hates #{user_2.username} and vice-versa, DE-FRIENDSHIP COMPLETE\"\n end",
"def destroy\n Friend.find_by(user: @friend.receiving_user, receiving_user: current_user).destroy! # Destroy other end of the friendship\n @friend.destroy! # Destroy friendship belonging to user \n redirect_to my_friends_path, notice: \"Sharey ended your friendship. One less friend :(\"\n \n rescue StandardError => e\n flash[:alert] = e.record.errors.full_messages.join \", \"\n redirect_to my_friends_path\n end",
"def delete_friend(user, destination_user)\n manage_friend user, destination_user, 'deleted'\n end",
"def friend(friends)\n friends = [\"Ryan\", \"Kieran\", \"Jason\", \"Mark\"]\n friends.select {|friends| put friends if friends.length = 4}\nend",
"def destroy\n @friendship = current_user.friendships.find(params[:id])\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to current_user\n end",
"def destroy\n @friend=Friend.where(\"user_id = ? AND friend_id=?\",params[:user_id],params[:friend_id]).destroy_all\n reload\n\n end",
"def destroy\n other = Friendship.find_by(user: @friendship.friend, friend: @friendship.user)\n other.destroy unless other.nil?\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unfriend!(resource)\n redis.multi do\n redis.hdel(friend_list_key, resource.id)\n redis.hdel(resource.friend_list_key, self.id)\n end\n end",
"def stop_being_friends(user, target)\n return false if user.blank? || target.blank?\n transaction do\n friend = self.find(:first, :conditions => {:inviter_id => target.id, :invited_id => user.id})\n friend.destroy if friend\n friend = self.find(:first, :conditions => {:inviter_id => user.id, :invited_id => target.id})\n friend.destroy if friend\n end\n true\n end",
"def change_to_friends(old_permission)\n # From private:\n # Add to my mutual friends' feeds\n # Add to my FriendStoriesList\n if old_permission == 'private'\n friend_ids = user.mutual_friend_ids\n pushed_user_ids = add_to_friend_feeds(friend_ids)\n\n FriendStoriesList.new(id: user.id).add_message(self)\n\n # From public:\n # Remove from the feeds of my followers who I haven't added back\n # Remove from my NonFriendStoriesList\n elsif old_permission == 'public'\n friend_ids = user.follower_ids - user.friend_ids\n delete_from_friend_feeds(friend_ids)\n\n NonFriendStoriesList.new(id: user.id).message_ids.delete(id)\n\n check_last_public_story\n end\n\n pushed_user_ids\n end",
"def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to :back\n end",
"def destroy_friendship(user, params = {})\n args = [user, params]\n delete path_from_args('friendships/destroy', args), params_from_args(args)\n end",
"def getDirectFriends(name) \n validate_arguments([name])\n matched_friendships = [] \n registered_friends.each do |friendship_instance|\n (matched_friendships << friendship_instance) if (friendship_instance.include?(name))\n end\n friends_list = []\n matched_friendships.each { instance| friends_list << instance.delete(name)}\n direct_friends = friends_list.uniq.flatten\n return direct_friends\n \n end",
"def destroy\n @friendship = @current_user.friendships.find_by(friendship_params)\n @inverse_friendship = @current_user.inverse_friendships.find_by(@friendship.friend_id)\n @friendship.destroy\n @inverse_friendship.destroy\n\n head :no_content\n end",
"def add_friends( whose, conn, friends )\n friends[whose] = true\n links = conn.delete( whose )\n return unless links\n\n # We added the user; now add all of their connections. Tack them on to the\n # end of the list (dropping duplicates) as we run through it, so they will\n # be similarly processed in turn. We must continue to make passes through\n # the list until it stopped growing, at which point we know we've added\n # all the friends and friends of friends of the first user. \n count = 0\n until count == links.size\n count = links.size\n\n links.keys.each do |link|\n sublinks = conn.delete( link )\n links.merge!( sublinks ) if sublinks\n end\n end \n\n # Now that we have the definitive list of this user's connections (and\n # their connections), tag them all as friends of the PM.\n friends.merge!( links )\n end",
"def destroy\n #Deletes the friendship (both ways)\n @user=current_user\n friend=User.find_by_email(params[:email])\n if(friend)\n friendCheck=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(friendCheck)\n @friendship = @user.friendships.find_by_friend_id(friend.id)\n @friendship.destroy\n @friendship = friend.friendships.find_by_friend_id(@user.id)\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'true'}}\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'false'}}\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'false'}}\n end\n end\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friendship_mutual = Friendship.where(:user_id => @friendship.friend_id).first\n @friendship.destroy \n @friendship_mutual.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def remove_no_longer_following(friendings, user,cursor=-1)\n # get all the people this user is following\n begin\n friends = user.twitter.get(\"/friends/ids.json\", 'cursor'=>cursor.to_s)\n puts \"people #{user.login} is following\\n#{friends.size()}\"\n\n friends = friends.to_set\n\n ret_friendings = []\n friendings.each do |friending|\n if friends.include?(friending.follow_id)\n ret_friendings << friending\n end\n end\n\n ret_friendings\n rescue => e\n Rails.logger.error e.message\n end\n\n end",
"def not_my_friend\n # one array of all users\n all_users = User.all\n # one array of just my friends \n all_of_my_freinds = self.friendees\n \n # compare arrays\n not_friends = all_users - all_of_my_freinds\n\n not_friends.select {|user| user != self}\nend",
"def destroy\n @friendrefuse = Friend.find(params[:id])\n @friendrefuse.destroy\n redirect_to hub_path\n end",
"def no_friends(people)\n no_friends = []\n for person in people\n if person[:friends] == []\n no_friends.push(person[:name])\n end\n end\n return no_friends\nend",
"def destroy\n @friendship = current_user.friendships.find(params[:id])\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to posts_path\n end",
"def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship1 = Friendship.where(friend_id: current_user.id, user_id: params[:id]).first\n @friendship2 = Friendship.where(friend_id: params[:id], user_id: current_user.id).first\n @friendship1.destroy\n @friendship2.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to :back\n end",
"def destroy\n @friend.destroy\n render json: {}\n end",
"def destroy\n @friend = Friend.find(params[:id],:conditions=>{:created_by=>current_user.id})\n @friend.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_path, :notice => \"Group #{@friend.group.name} was updated.\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@ignore = Friend.where(:user_id => params[:id])\n\t\t@ignore.destroy\n\t\tredirect_to @user\n\tend",
"def decline_friend\n \tif @user.pending_friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} declined\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n else\n error = \"No friendship request from #{@friend.nick_name}.\"\n format.json{render :json => {:error => error, :status => \"400\"}}\n end\n #redirect_to :back\n end",
"def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end",
"def proposed_friends\n friendships.map{ |fs| fs.friend unless fs.accepted? }.compact\n end",
"def ignore_suggested_friend(_user_id)\n rejected_friend_suggestions.create!(user_id: _user_id)\n friend_suggestions.where(user_id: _user_id).delete_all\n end",
"def delete_all_friendships\n friend_ids.clear\n inverse_friend_ids.clear\n pending_friend_ids.clear\n pending_inverse_friend_ids.clear\n blocked_friend_ids.clear\n blocked_inverse_friend_ids.clear\n blocked_pending_friend_ids.clear\n blocked_pending_inverse_friend_ids.clear\n self.save\n end",
"def find_no_friends(people)\n no_mates = []\n for person in people\n if person[:friends].length == 0\n no_mates.push(person)\n end\n end\n return no_mates\nend",
"def destroy\n @friends_list.destroy\n respond_to do |format|\n format.html { redirect_to friends_lists_url, notice: \"Friend was successfully removed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pending_friend_request.destroy\n respond_to do |format|\n format.html { redirect_to '/profile?id=%s' % [session[:user_id]] }\n format.json { head :no_content }\n end\n end",
"def stop_being_friends(user, target)\n transaction do\n begin\n find_friendship(target, user, ACCEPTED).update_attribute(:status, PENDING)\n find_friendship(user, target, ACCEPTED).destroy\n rescue Exception\n return false\n end\n end\n true\n end",
"def possible_friends\n ids = (friendships.map{ |fs| fs.friend_id } +\n inverse_friendships.map{ |fs| fs.user_id }).compact\n User.where.not(id: ids) - [self]\n end",
"def inverse_friendship\n return if new_user_or_friend?\n\n return unless FriendshipsQuery.new.friends?(user_id: user.id, friend_id: friend.id)\n\n errors.add(:user_id, :already_friends)\n end",
"def select_one_user(users, users_friends_count, total_user_friends)\n users = users.to_a\n selected_user = nil\n rand_number = rand(total_user_friends[0])\n users_friends_count.each_with_index do |friends_count, index|\n if rand_number <= friends_count\n selected_user = users[index]\n # remove this user of the list\n total_user_friends[0] = total_user_friends[0] - friends_count\n users.delete_at(index)\n users_friends_count.delete_at(index)\n break\n else\n rand_number = rand_number - friends_count\n end\n end\n\n return selected_user\n end",
"def destroy\n request = FriendshipRequest.find(params[:id])\n request.destroy\n if request.sender == current_user \n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"Friend request to #{request.recipient.name} cancelled.\") }\n format.json do\n render json: {\n unrequest: {\n id: request.recipient.id,\n name: request.sender.name\n },\n message: \"Friend request to #{request.recipient.name} cancelled.\"\n }\n end\n end\n else\n redirect_back(fallback_location: root_path, notice: \"Friend request from #{request.sender.name} rejected.\")\n end\n end",
"def destroy\n @friendsofuser = Friendsofuser.find(params[:id])\n @friendsofuser.destroy\n\n respond_to do |format|\n format.html { redirect_to(friendsofusers_url) }\n format.xml { head :ok }\n end\n end",
"def void_self_friendship\n if doggo_id == friend_id\n errors.add(:doggo_id, 'cannot friend self you lonely doggo')\n end\n end",
"def destroy\n if @profile.stop_following(@friend)\n ArNotifier.delay.delete_friend(@profile, @friend) if @friend.wants_email_notification?(\"delete_friend\")\n if @friend.wants_message_notification?(\"delete_friend\")\n Profile.admins.first.sent_messages.create(\n :subject => \"[#{SITE_NAME} Notice] Delete friend notice\",\n :body => \"#{@profile.full_name} is Deleted you on #{SITE_NAME}\",\n :receiver => @friend,\n :system_message => true)\n end\n end\n respond_to do |format|\n format.js do\n render :partial => 'friends/friend_status', :locals => {:profile => @friend }\n end\n end\n end",
"def remove_with_notify(swimming_buddy)\n if @user.remove_friendship(swimming_buddy)\n NewsFeed.create_social_feed(\n @user.id,\n swimming_buddy.id,\n I18n.t('newsfeed.remove_title'),\n I18n.t('newsfeed.remove_body').gsub('{SWIMMER_NAME}', swimming_buddy.get_full_name)\n )\n # TODO: Create also achievement row accordingly?\n end\n end",
"def reject_friend_request\n if remove_any_connection_between(params['user_id'], params['friend_id'])\n render_json :entry => {}\n end\n end",
"def destroy\n @friend_request = FriendRequest.find(params[:id])\n @friend_request.destroy\n\n respond_to do |format|\n format.html { redirect_to friend_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n second_friendship = Friendship.find_by(:user1_id => @friendship.user2_id)\n @friendship.destroy\n second_friendship.destroy if second_friendship\n \n respond_to do |format|\n format.html { redirect_to back_page, flash: { :success => 'Friendship was deleted.' } }\n format.json { head :no_content }\n end\n end",
"def leave(person)\n members.delete(person);\n end",
"def remove_entry(p)\n\t\t@person.delete(p)\n\tend",
"def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n\n #log_activity #doesnt work with call backs\n\n redirect_to :back\n end",
"def delete_from_friend_feeds(friend_ids)\n redis.pipelined do\n friend_ids.each do |friend_id|\n feed = FriendFeed.new(id: friend_id)\n feed.message_ids.delete(id)\n end\n end\n end",
"def connection_filter\n if params[:name].present?\n @friends = current_user.friends.by_name(params[:name]) + current_user.inverse_friends.by_name(params[:name])\n @friends.delete(current_user)\n end\n @friends = @friends.paginate(:page => params[:page], :per_page => 10)\n end",
"def unfriendship\n if params[:id]\n current_user.follow_ids.delete(params[:id])\n @user = User.find(params[:id]).del_follower(current_user)\n @user.save\n current_user.save\n end\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n end\n end",
"def drop_friend(user)\n if MuckFriends.configuration.enable_following\n Friend.revert_to_follower(self, user)\n else\n Friend.stop_being_friends(self, user)\n end\n end"
] | [
"0.8279636",
"0.8279636",
"0.825414",
"0.78877383",
"0.7786883",
"0.71954906",
"0.7155082",
"0.68473107",
"0.6845949",
"0.68290174",
"0.6815851",
"0.6774512",
"0.67719716",
"0.67620695",
"0.67279917",
"0.6683872",
"0.66582966",
"0.66195554",
"0.6601869",
"0.6590391",
"0.6512081",
"0.6510359",
"0.6447726",
"0.6441259",
"0.64300525",
"0.6365198",
"0.6331622",
"0.63132566",
"0.6301353",
"0.63000965",
"0.62618965",
"0.62592125",
"0.6229607",
"0.6216436",
"0.61940235",
"0.61616343",
"0.6157366",
"0.6150523",
"0.61448795",
"0.6112491",
"0.60982776",
"0.609476",
"0.60932636",
"0.6086088",
"0.6075819",
"0.60681516",
"0.605896",
"0.60386723",
"0.6035556",
"0.60224867",
"0.6012972",
"0.599783",
"0.5994032",
"0.5980623",
"0.5948232",
"0.5943673",
"0.59412014",
"0.59128827",
"0.5909284",
"0.59081334",
"0.5899692",
"0.5898311",
"0.5892093",
"0.5882127",
"0.5879746",
"0.58771574",
"0.5857604",
"0.58469623",
"0.5838573",
"0.58313656",
"0.5831022",
"0.58184874",
"0.5775517",
"0.577012",
"0.5765698",
"0.5753911",
"0.57517266",
"0.5750622",
"0.5748615",
"0.57344246",
"0.5733011",
"0.5729898",
"0.57268083",
"0.57260984",
"0.57140654",
"0.57102656",
"0.5700573",
"0.569887",
"0.5665078",
"0.5660519",
"0.56588924",
"0.5658636",
"0.56527567",
"0.5651176",
"0.5640779",
"0.5637358",
"0.5636012",
"0.5633519",
"0.5633227",
"0.5632303"
] | 0.7881897 | 4 |
5. Find the total of everyone's money | def total_money(people)
total = 0
for person in people
total += person[:monies]
end
return total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def money_total(people)\n count = 0\n people.each do |person|\n count += person[:monies] \nend\nreturn count\nend",
"def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end",
"def test_sum_money_works\n result = sum_money(@people)\n end",
"def total_everyone_money(people)\n total_money = 0\n for person in people\n total_money += person[:monies]\n end\n return total_money\nend",
"def paid_sum\n paid = Money.new(0, 'USD')\n paid += @paid_splits.inject(Money.new(0, 'USD')){ |memo, split| memo + split.sum } if @paid_splits.present?\n paid\n end",
"def money; end",
"def total_funds\n total = 0\n num_funding_rounds.each do |round| \n total += round.investment\n end\n total\n end",
"def dollar_total\n total / 100.0\n end",
"def add_money\n @total += fee\n end",
"def get_total_expense\n\t\tbills.pluck(:amount).inject(:+) rescue 0\n\tend",
"def total_money( people)\n total_money = 0\n\n for person in people\n total_money += person[:monies]\n end\n return total_money\nend",
"def total_funds\n my_rounds.map{|rounds| rounds.investment}.sum\n end",
"def total_funds\n #binding.pry\n funding_rounds.map{|fr| fr.investment}.sum\n end",
"def money\n end",
"def total(bill)\n sum=0.0\n bill.items.each do |i|\n sum += i.price\n end\n return sum\n end",
"def total\n Money.new(self.expense_entries.sum('unit_cost_pence * qty'))\n end",
"def money_earned_by_driver(driver)\n sum = 0.0\n\n driver.each do |money|\n earned = money[:cost]\n sum += earned.round(2)\n end\n\n return sum\nend",
"def sum_expense(expenses)\n sum = expenses.sum\n return sum\nend",
"def money_for_us(auction)\n total_sale = auction.current_bid * auction.quantity\n if auction.premium_service\n total_sale * 0.1 # ten percent commission\n else\n total_sale * 0.05 # five percent commission\n end\n end",
"def total_amount\n (total * 100).to_i\n end",
"def money_spent\n self.purchases.map { |p| p.price }.sum\n end",
"def total_deposit\n self.group_loan_memberships.sum(\"deposit\")\n end",
"def total\n (amount + fee) if amount\n end",
"def total_payment\r\n checks.inject(0.00){|sum, check| sum += check.check_amount.to_f}\r\n end",
"def owes_amount\n loans=@loans\n net_worth=@net_worth\n @balance = net_worth-loans\n print \"the balance is : \",balance,\"\\n\"\n is_developer_solvent?\n end",
"def total_worth\n find_amount = funding_rounds.map{|funding| funding.investment}\n find_amount.inject{|sum, el| sum + el}\n end",
"def return_sum\n @money = 0\n @transactions.each do |t|\n if t.get_action == 'buy'\n @money = @money + t.get_value\n elsif t.get_action == 'sell'\n @money = @money - t.get_value\n end\n end\n total_value_of_shares - @money\n end",
"def total\n tot = 0\n for card in @cards\n tot += card.value\n end\n if has_ace and tot < 12\n tot2 = tot + 10\n if tot2 > 17\n return tot2\n elsif tot2 == 17\n unless @hit_soft_17\n return tot2\n end\n end\n end\n return tot\n end",
"def min_coins(total)\n result = 0\n result = (total/5).to_i\n total = total % 5\n result += (total/3).to_i\n total = total % 3\n result += total\n\n puts result\nend",
"def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend",
"def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend",
"def pledge_total\n @pledges = Pledge.all\n pledge_total = 0\n @pledges.each do |pledge|\n if pledge.user_id == self.id\n pledge_total = pledge_total + pledge.dollar_amount\n end\n end\n return pledge_total\n end",
"def total_cost\n total = 0\n memberships.each do |membership|\n total += membership.cost\n end\n total\nend",
"def total_paid\n self.user_expenses.reduce(0) { |sum, user_expense| user_expense.paid + sum }\n end",
"def calculate_total\n self.total = total_money(total_gross)\n end",
"def percentage_change\n return_sum / @money * 100\n end",
"def sum_bets() \n\t\t@sum = 0\n\t\t#loop through players array\n\t\tfor i in 0...@num_players\n\t\t\t@sum += @players[i].bet\n\t\tend\n\t\treturn @sum\n\tend",
"def total_raised\n payments.inject(0) { |sum, p| sum + p.amount.to_f }\n end",
"def amount_owed\n total_price - amount_paid\n end",
"def total_cost\n lifter_membership.reduce(0){ |total, pay| \n total + pay.cost}\n end",
"def credit_amount\n sum( credits )\n end",
"def total_amount\n self.tickets.inject(0) do |amount, ticket|\n amount += ticket.price_minus_discount\n end\n end",
"def sum_totals\n @total = Lote.where(:programacion_id => @programacion.first).sum(:precio_t)\n @total = Money.new(\"#{@total}00\", \"USD\").format\n @cantidades = Lote.where(:programacion_id => @programacion.first).sum(:cantidad)\n end",
"def totalamount\n\t\tcopies * 5\n\tend",
"def balance\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n sum = 0\n entries.each do |entry|\n value = entry['value'].gsub(\"$\",\"\")\n\n if entry['value'][0] == '('\n value = value[1..-2]\n sum = sum - value.to_i\n else\n sum = sum + value.to_i\n end\n end\n\n @t.say(\"The balance is $#{sum}\")\nend",
"def total_payments\n total = 0\n payments.each{|payment| total += payment.amount}\n total\n end",
"def total_money(people) #function\n money = 0\n\n for person in people\n money += person[:monies]\n #person[:monies] = 0\n end\n\n return money\n \n\nend",
"def money_total(type)\n transaction_details(type).select do |value|\n value.instance_of? Money\n end.inject(:+) || Money.new\n end",
"def count_money(people)\n total_money = 0\n for person in people\n total_money += person[:monies]\nend\nreturn total_money\nend",
"def current_coin_total\n @coins.map(&:value).reduce { |sum, num| sum += num }\n end",
"def donated_sum\n\t\tdonated.sum(\"amount * (artist_percentage / 100)\").to_f.round(2)\n\tend",
"def total_funds\n self.funding_rounds.sum {|fr| fr.investment}\n end",
"def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end",
"def disbursed_amount\n amount = 0\n loans.each do |project|\n amount += project.disbursed_amount.to_i\n end\n amount\n end",
"def total(rows)\n rows.map { |row| row[\"Money we made\"].to_i }.reduce(:+)\nend",
"def investment\n if buy_price\n num_of_shares * buy_price\n end\n end",
"def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end",
"def pays_players\n self.players.inject(0) {|sum, player| sum += player.pay}\n end",
"def total_fee\n fee + fee2 + fee3 + fee4\n end",
"def calculate_total_money_spent\n return @trips.inject(0.0) { |sum, trip|\n trip.is_in_progress? ? sum + 0 : sum + trip.cost }\n end",
"def total_funds\n self.collect{ |cs| cs.amount.to_f}.inject(0, :+)\n end",
"def actual_income\n outgoing_invoices.where(:status => \"deposited\").inject(0) do |mem, invoice|\n mem += invoice.amount\n end # inject invoice\n end",
"def money_made\n total_crowd * self.ticket_price\n end",
"def total_owned\n self.shares.map{ |share| share.value }.inject(:+)\n end",
"def get_total_payment(team_bono)\n decimal_total_bono_percentage = ((get_individual_bono_percentage + team_bono) / 2) / 100\n discounted_bono = @bono * decimal_total_bono_percentage\n @sueldo_completo = @sueldo + discounted_bono\n end",
"def total\n currency(@total)\n puts @total\n end",
"def donated_sum\n\t\tdonated.sum(:amount).to_f.round(2)\n\tend",
"def calculate_money(silver, gold)\n return nil if silver.is_a?(String) || gold.is_a?(String) || silver < 0 || gold < 0\n silver_price = 1.31 * silver\n gold_price = 20.67 * gold\n total = silver_price + gold_price\n format('%0.2f', total)\n end",
"def tot_deposits_made\n Rails.logger.debug(\"*** tot_deposits_made\")\n # note cannot use database sum because big_deposit is not native to database\n dep_result = 0.0\n EmployeeBenefit.where(\n \"employee_id = ? and eff_month = ? and eff_year = ? and deposited_at IS NOT NULL\",\n self.employee_id.to_s,\n self.eff_month.to_s,\n self.eff_year.to_s\n ).each do |eb|\n dep_result += round_money(eb.deposit)\n end\n Rails.logger.debug(\"*** dep_result: #{dep_result.inspect}\")\n return dep_result\n end",
"def current_total_amount\n\n if calculate_total(session[:player_cards]).to_i == BLACKJACK\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:player_cards]).to_i > BLACKJACK\n session[:player_pot] -= session[:player_bet].to_i\n elsif calculate_total(session[:dealer_cards]).to_i > BLACKJACK\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:dealer_cards]).to_i == BLACKJACK\n session[:player_pot] -= session[:player_bet].to_i\n elsif calculate_total(session[:player_cards]).to_i > calculate_total(session[:dealer_cards]).to_i\n session[:player_pot] += session[:player_bet].to_i \n elsif calculate_total(session[:dealer_cards]).to_i > calculate_total(session[:player_cards]).to_i\n session[:player_pot] -= session[:player_bet].to_i \n else\n session[:player_pot]\n end # ends if statement\n end",
"def budget\n accountings.where(:positive => true).sum :amount\n end",
"def total\n format_money(@total)\n end",
"def total_income\n _result = 0\n budget_items.each do |i|\n _flow = i.charge_account.charge_group.flow rescue 0\n if (_flow == 1 || _flow == 3) && !i.annual.blank?\n _result += i.annual\n end\n end\n _result\n end",
"def check_amount\n checks.inject(0) {|sum, c| sum = sum + c.check_amount.to_f}\n end",
"def total_funds\n sum_funds = 0\n self.funding_rounds.each do |funding_round|\n sum_funds += funding_round.investment\n end \n sum_funds\nend",
"def sum(num, total) => total += num",
"def total_cost\n# Get the total cost of a specific lifter's gym memberships\n membs_cost = memberships.map{|membership|membership.cost}\n cost_total = membs_cost.inject(:+)\n end",
"def total\n return (@listOfItem.inject(0){|sum,e| sum += e.total}).round_to(2)\n end",
"def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end",
"def add_profit(amount)\n amount * 1.005\n end",
"def computeGoldCoinsValue(treasures)\n result = treasures.inject(0){|sum,t| sum += t.goldCoins} / 1000.0\n result\n end",
"def check_amount\n @checks.inject(0) {|sum, c| sum = sum + c.check_amount.to_f}\n end",
"def total_amount(bill_tip)\n\treturn tip_amount(bill_amount) + bill_tip\nend",
"def getMoneySpent(keyboards, drives, b)\n total = -1\n keyboards.each do |k|\n drives.each do |d|\n sum = k + d\n total = max(total, sum) if sum <= b\n end\n end\n\n total\nend",
"def total_cash\n services.select{|i| i[:btype] && i[:btype] == CASH_BILLING}.sum{|s| s[:fee]} rescue 0\n end",
"def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end",
"def total \n\t\t@Total_bill = @bill_amount + @tip_rate_calc\t\n\t \tputs \"The total bill is £#{@Total_bill}\"\n\tend",
"def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end",
"def total_funds\n self.pledges.collect do |pledge|\n pledge.amount\n end.sum\n end",
"def prepaid_liabilities_total\n voucher_groups.inject(Money.new(0)) { |sum, vg| sum + ( vg.cogs * vg.quantity ) }\n end",
"def worth_at_cost\n worth= cost*quantity\n return worth\n end",
"def solve(meal_cost, tip_percent, tax_percent)\n total = meal_cost + (meal_cost * tip_percent)/100 + (meal_cost * tax_percent)/100\n puts total.round() \nend",
"def total_amount(rows)\n rows.each.map { |row|\n row.amount.round(2)\n }.reduce(0, :+)\n end",
"def total_debt\n Money.new(all_debts.sum { |_, debt| debt }, 'PLN')\n end",
"def calculate_total(database, user_id)\n\ttotal = 0\n\titem_costs = database.execute(\n\t\t\"SELECT *\n\t\tFROM purchases\n\t\tWHERE login_id='#{user_id}';\"\n\t\t)\n\t\titem_costs.each do |cost|\n\t\t\ttotal += cost[3]\n\t\tend\n\t\ttotal\nend",
"def extra_cash(db, user_name)\r\n\t# determine extra monies (conditional on + amount)\r\n\tdifference = (current_income(db, user_name) - current_expenses(db, user_name))\r\n\tcache_bonus = difference if difference > 0 || 0\r\nend",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend",
"def total (number)\n sum = 0\n number.each do | x |\n sum += x\n end\n return sum\nend",
"def amounts_equal_total_amount (record)\n amount = 0\n record.you_owe_mes.each do |you_owe_me|\n amount += you_owe_me.amount\n end\n return 1 if amount != record.total_amount\n end"
] | [
"0.7326089",
"0.7257883",
"0.71865255",
"0.71106976",
"0.7099457",
"0.7091431",
"0.7044157",
"0.70200515",
"0.7013855",
"0.6976792",
"0.69635546",
"0.69558024",
"0.69454443",
"0.6941253",
"0.69317925",
"0.69196814",
"0.6913313",
"0.6885583",
"0.68793327",
"0.6865523",
"0.6862351",
"0.68587285",
"0.68476725",
"0.6834063",
"0.68327147",
"0.68165714",
"0.6808575",
"0.67991376",
"0.6791338",
"0.6784742",
"0.6780064",
"0.6772352",
"0.67641664",
"0.67602473",
"0.6757706",
"0.675006",
"0.6748132",
"0.6748094",
"0.67381865",
"0.6728597",
"0.67163736",
"0.6708764",
"0.67084736",
"0.6708262",
"0.67065865",
"0.67058283",
"0.67044234",
"0.6701899",
"0.6693415",
"0.6688078",
"0.6682748",
"0.6676267",
"0.6670873",
"0.66703945",
"0.66700613",
"0.66696167",
"0.66630965",
"0.6661943",
"0.6659629",
"0.6658318",
"0.665612",
"0.6648662",
"0.66437334",
"0.6642375",
"0.6641337",
"0.66404617",
"0.66334033",
"0.66265404",
"0.66240984",
"0.66236997",
"0.66224605",
"0.6622356",
"0.66212165",
"0.66190505",
"0.66116756",
"0.66064227",
"0.6605081",
"0.660015",
"0.6594566",
"0.6593801",
"0.6593796",
"0.6593758",
"0.659123",
"0.6589207",
"0.65839356",
"0.65797377",
"0.6570402",
"0.6565303",
"0.6556456",
"0.65564436",
"0.6549302",
"0.65457505",
"0.6541407",
"0.6539199",
"0.6538539",
"0.6535779",
"0.6533878",
"0.653199",
"0.65209484"
] | 0.7045997 | 7 |
6. For two given people, allow the first person to loan a given value of money to the other | def loan(lender, lendee, amount)
lendee_balance = lendee[:monies] + amount
lender_balance = lender[:monies] - amount
return [lender_balance, lendee_balance]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loan_money(person_lending, person_receiving, loan)\n person_lending[:monies] -= loan\n person_receiving[:monies] += loan\nend",
"def loan_money_to_other(lender, lendee, amount)\n lender[:monies] -= amount\n lendee[:monies] += amount\nend",
"def loan_money(lender, lendee, amount)\nlender[:monies] -= amount\nlendee[:monies] += amount\nend",
"def loan_money(lender, lendee, value)\n for total in lender[:monies]\n total - value\n end\n return total\n for borrowed in lendee[:monies]\n borrowed + value\n end\n return borrowed\nend",
"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 owes_amount\n loans=@loans\n net_worth=@net_worth\n @balance = net_worth-loans\n print \"the balance is : \",balance,\"\\n\"\n is_developer_solvent?\n end",
"def loan(lender, lendee, amount)\n lender[:monies] -= amount\n lendee[:monies] += amount\n return [lender[:monies], lendee[:monies]]\nend",
"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 distribute_money_internal_2(dealer_total, player , hand_index)\n i = hand_index\n dt = dealer_total\n hv = player.get_value(i)\n bet = player.get_bet(i)\n pn = player.player_number\n\n # instead of modifiying amount directly, should use a function call to increment player amount by payoff factor\n if (hv == 21 and (dt > 21 or dt < 21) )\n #player.amount += (bet * 2.5)\n player.modify_account(bet,2.5)\n puts \"Player #{pn} H#{i} #{hv} Blackjack - Dealer #{dt} , Amount= #{player.amount}\"\n elsif (hv < 21 and dt > 21) or (dt <= 21 and hv <= 21 and hv > dt)\n #player.amount += (bet * 2)\n player.modify_account(bet,2)\n puts \"Player #{pn} H#{i} #{hv} - Dealer #{dt} , Amount= #{player.amount}\"\n elsif (dt > 21 and hv > 21) or ((hv == 21) and dt == 21 ) or (hv == dealer_total and dt <= 21 and hv <= 21)\n #player.amount += (bet * 1)\n player.modify_account(bet,1)\n puts \"Player #{pn} H#{i} #{hv} - Dealer #{dt} , Amount= #{player.amount}\"\n else\n puts \"Player #{pn} H#{i} #{hv} - Dealer #{dt} , Amount= #{player.amount}\"\n end\n\n end",
"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 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 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 payment\n loan_amount / 12\n end",
"def receive_cash_from_nama_based_on_loan(loan)\n \t#\n puts \"#{@name} receves cash #{loan.amount*Nama.RETURN_RATIO} from NAMA\"\n \t@losses -= loan.amount * Nama.RETURN_RATIO\n deposit = Deposit.new(loan.amount*Nama.RETURN_RATIO, \"NAMA\",\"NAMA\")\n self.add_cash_deposit(deposit)\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 pay_owner(rental)\n # make credit operation on balanced\n balanced.credit(rental)\n\n # account it on subledger\n subledger.credit(rental)\n end",
"def call!\n account_from.update_balance!(side: :-, amount: amount)\n account_to.update_balance!(side: :+, amount: amount)\n end",
"def lend_money(lender, lendee, amount)\n lender[:monies] -= amount\n lendee[:monies] += amount\nend",
"def pay(amount)\n @bankroll -= amount\n @@bankroll -= amount\n end",
"def money_left(money, gallons_needed, gas_price)\n\t\tmoney - (gallons_needed * gas_price)\n\tend",
"def loan_amt\n (self.buying_price*1000) * (1 - (self.deposit/100))\n end",
"def test_lend_money\n lend_money(@person5, @person1, 10)\n assert_equal(90, @person5[:monies])\n assert_equal(11, @person1[:monies])\nend",
"def pay_amount(user, amount)\r\n if(self.credits>= amount)\r\n self.credits= self.credits-amount\r\n user.receive_credits(amount)\r\n else\r\n return 'suddenly you dont have enough money'\r\n end\r\n end",
"def transfer(amount, other)\n @balance -= amount\n other.balance += amount\n puts \"#{@owner} your balance will be #{@balance} after the transfering to #{other.owner}\"\n end",
"def pay(amount_paid)\n remaining_total = @total - amount_paid\n if remaining_total == remaining_total.abs\n puts \"Your new total is $#{currency(remaining_total)}.\"\n @total -= amount_paid\n else\n change_due = remaining_total.abs\n puts \"Your change is $#{currency(change_due)}.\"\n @total = 0.0\n end\n end",
"def reward\n business.add_to_balance(amount)\n end",
"def ToDonate (pay_amount)\n\tdecimal = pay_amount.modulo(1).round(2)\n\tif decimal < 0.50\n\t\tto_donate = 0.50-decimal\n\telsif decimal < 1.00\n\t\tto_donate = 1.00 - decimal\n\telse \n\t\tto_donate = 0;\n\tend\n\tto_donate = (to_donate).round(2)\nend",
"def your_child_savings_after_retirement(your_age)\n child_age = (your_age / 2)\n child_current_account = (child_age ** 2)\n child_years_to_retire = (65 - child_age)\n child_current_account * child_years_to_retire\nend",
"def allowance(amt.to_f)\r\n save.deposit(amt.to_f * 0.6)\r\n puts \"Save balance = $#{@balance}.\"\r\n spend.deposit(amt.to_f * 0.3)\r\n puts \"Spend balance = $#{@balance}.\"\r\n spare.deposit(amt.to_f * 0.1)\r\n puts \"Spare balance = $#{@balance}.\"\r\nend",
"def pay_workers\r\n\t\t@cash -= (@sellers + @thieves)*10\r\n\tend",
"def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end",
"def pay_employee(employee)\n salary = @salaries[employee.title]\n if @funding >= salary \n employee.pay(salary)\n @funding -= salary\n else\n raise \"not enough funding!\" \n end\n end",
"def way2(amount, base_rur_ask_cost, alt_base_ask_cost, alt_base_ask_vol, alt_rur_bid_cost_n, alt_rur_bid_vol_n, alt, base)\n\n if (amount/base_rur_ask_cost < alt_base_ask_cost*alt_base_ask_vol) && (amount/base_rur_ask_cost/alt_base_ask_cost < alt_rur_bid_vol_n)\n\n if amount/base_rur_ask_cost/alt_base_ask_cost*alt_rur_bid_cost_n > amount*1.01\n\n puts \"\\n yes \\n RUR -> #{base} -> #{alt} -> RUR \\n amount #{amount} \\n base_rur_ask_cost #{base_rur_ask_cost.to_f} \\n alt_base_ask_cost #{alt_base_ask_cost.to_f} \\n alt_base_ask_vol #{alt_base_ask_vol.to_f} \\n alt_rur_bid_cost_n #{alt_rur_bid_cost_n} \\n alt_rur_bid_vol_n #{alt_rur_bid_vol_n} \\n profit #{amount/base_rur_ask_cost/alt_base_ask_cost*alt_rur_bid_cost_n-amount*1.01}\"\n\t\t\t\n end\n end\nend",
"def dispense(amount)\n @balance = @balance - amount\n puts \"hey I gave you #{amount}\"\n end",
"def sell_to(player)\n return if @price > player.balance \n !player.subtract_balance(@price)\n @owner = player.piece\n @owned = true\n end",
"def make_change(amount, denominations)\n\nend",
"def deposit ( person, amount )\r\n\t\tif person.worth >= amount\r\n\t\t@bank_listing[person.id_number][:balance]+=amount\r\n\t\tputs \"#{@bank_name}: Thanks #{person.name}, you deposited #{amount}. Your current balance is $#{@bank_listing[person.id_number][:balance]}.\"\r\n\t\telse\r\n\t\t\tputs \"#{@bank_name}: Sorry, you don't have enough on hand.\"\r\n\t\tend\r\n\tend",
"def get_paid(salary)\n self.bank_account += salary\n self.happiness += 1\n \"all about the benjamins\"\n end",
"def pay_blinds\n @dealer.pay(@game.small_blind)\n @under_the_gun.pay(@game.big_blind)\n end",
"def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end",
"def place_bet(amount)\n @total_money -= amount\n end",
"def deposit\n if admin_use\n 0\n elsif estimated_numbers < 20\n 150\n elsif estimated_numbers < 40\n 300\n else\n 600\n end\n end",
"def put_money(amount, player)\n if amount > player.money\n amount = player.money\n end\n if amount + player.in_pot_current > self.high_bet # if player is new high bet (bets more than current highest)\n self.high_bet = amount + player.in_pot_current\n self.high_better = player.location\n end\n player.money -= amount # puts money in correct places and takes from player's pot\n player.in_pot_current += amount\n player.in_pot_hand += amount\n self.pot += amount\n player.save\n self.save\n end",
"def pay_interest_on(account)\n # first interest is calculated and stored to local variable\n interest = calculate_interest(account)\n # if statement used to check if account is overdrawn\n if account.overdrawn?\n # if it is the interest is subtracted\n account.withdraw interest\n @master.deposit interest\n else\n # else the interest is added\n @master.withdraw interest\n account.deposit interest\n end\n end",
"def award_player(multiplier)\n if session['doubled']\n session['money'] += session['bet'] * multiplier * 2\n session['doubled'] = nil\n else\n session['money'] += session['bet'] * multiplier\n end\n end",
"def update_record!(debtee, debtor, amount)\n raise ActiveRecord::RecordInvalid if amount < 0\n return if amount == 0\n begin\n if self.debtee == debtee && self.debtor == debtor\n # if a loan\n self.update!(amount: self.amount+amount)\n elsif amount < self.amount\n # it's payback and not all payback\n self.update!(amount: self.amount - amount)\n elsif amount > self.amount\n # if it' payback and amount is greater than debt, it will exchange user's position\n self.update!(debtee_id: debtee.id, debtor_id: debtor.id, amount: amount - self.amount)\n else\n # it' payback and exactly payback all\n self.destroy!\n end\n rescue ActiveRecord::RecordInvalid => exception\n raise exception\n end\n end",
"def create_loan\n # helper method to create a loan and return that loan\n options = { holder: test_holder, borrowed: 1000, term: 2, rate: 2 }\n # hash of key value pairs to initialise loan\n Loan.new(options, 5)\n # creates loan and returns it\n end",
"def do_something(pay, troll, toll); end",
"def outstanding_balance\n loan.funded_amount - loan.payments.amount\n end",
"def combat_2ennemi(user_nameP, barret, ennemi1, ennemi2)\n puts ' _________ ________ _____ __________ ________________ '\n puts ' \\_ ___ \\ \\_____ \\ / \\\\______ \\ / _ \\__ ___/ '\n puts ' / \\ \\/ / | \\ / \\ / \\| | _/ / /_\\ \\| | '\n puts ' \\ \\____/ | \\/ Y \\ | \\/ | \\ | '\n puts ' \\______ /\\_______ /\\____|__ /______ /\\____|__ /____| '\n puts ' \\/ \\/ \\/ \\/ \\/ '\n numero_tour = 0\n\n\n while ennemi1.personnage_alive && ennemi2.personnage_alive\n if ennemi1.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi1.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi2.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi1.personnage_hp <= 0 && ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Les ennemis sont morts !\"\n puts \"--------------------------------\"\n total_xp = ennemi1.xp + ennemi2.xp\n puts \"Vous gagnez #{total_xp} points d'XP !\"\n ennemi1.personnage_alive = false\n ennemi2.personnage_alive = false\n\n if ennemi1.loot == '1po'\n $mon_inventaire.addpotion\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1gre'\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1po1gre'\n $mon_inventaire.addpotion\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi2.loot == '1po'\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addpotion\n\n elsif ennemi2.loot == '1gre'\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addgrenade\n end\n\n puts \"\"\n elsif ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n\n numero_tour += 1\n puts \"----------------------------------\"\n puts \"Tour n°#{numero_tour}\"\n puts \"Ennemis : #{ennemi1.name} ET #{ennemi2.name}\"\n puts \"TIRENT A DISTANCE\"\n if ennemi1.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi1.name} #{ennemi1.personnage_hp} HP\"\n end\n if ennemi1.personnage_hp <= 0\n puts \"#{ennemi1.name} : mort.\"\n end\n if ennemi2.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi2.name} #{ennemi2.personnage_hp} HP\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"#{ennemi2.name} : mort.\"\n end\n puts \"\"\n puts \"Que faites-vous ?\"\n puts \"1. Attaquer\"\n puts \"2. Défendre\"\n puts \"3. Utiliser un objet\"\n user_choice_4 = $stdin.gets.chomp\n if user_choice_4 == \"1\"\n puts \"Qui attaquer ?\"\n if ennemi1.personnage_hp > 0\n puts \"1. #{ennemi1.name}\"\n end\n if ennemi2.personnage_hp > 0\n puts \"2. #{ennemi2.name}\"\n end\n print \"> \"\n user_choice_4_fight = $stdin.gets.chomp\n if user_choice_4_fight == \"1\" && ennemi1.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(user_nameP.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n #On fait attaquer Barret\n\n puts \"Barret attaque le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_barret_1 = barret.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(barret.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n if ennemi1.personnage_hp > 0\n\n ennemi1.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi1.name} est mort !\"\n ennemi1.personnage_alive = false\n end\n elsif user_choice_4_fight == \"2\" && ennemi2.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi2.name}.\"\n puts \"Le #{ennemi2.name} réduit les dégats de #{ennemi2.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi2.personnage_defense\n puts \"Le #{ennemi2.name} subit #{(user_nameP.personnage_attaque - ennemi2.personnage_defense)} points de dégats !\"\n if ennemi2.personnage_hp > 0\n\n ennemi2.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi2.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi2.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi2.name} est mort !\"\n ennemi2.personnage_alive = false\n end\n end\n elsif user_choice_4 == \"2\"\n puts \"Vous gagnez de la défense !\"\n puts \"Barret gagne de la défense !\"\n user_nameP.personnage_defense += 3\n barret.personnage_defense += 3\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Le #{ennemi1.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n elsif user_choice_4 ==\"3\"\n if $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"Potions : #{$mon_inventaire.show_potion}\"\n puts \"Grenades : #{$mon_inventaire.show_grenade}\"\n puts \"Que voulez-vous utiliser ?\"\n if $mon_inventaire.show_potion > 0\n puts \"1. Une potion.\"\n puts \"2. Rien finalement.\"\n combat2_potion_simple = $stdin.gets.chomp\n\n if combat2_potion_simple == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur vous-même.\"\n puts \"2. Sur Barret.\"\n user_potion_fight = $stdin.gets.chomp\n\n if user_potion_fight == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Que faites-vous ?\"\n elsif combat2_potion_simple == \"2\"\n numero_tour -= 1\n else\n puts \"Merci d'indiquer un nombre pertinent.\"\n numero_tour -=1\n end\n\n elsif $mon_inventaire.show_grenade > 0\n puts \"1. Une grenade !\"\n puts \"2. Rien finalement.\"\n combat2_grenade_simple = $stdin.gets.chomp\n if combat2_grenade_simple == \"1\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_simple == \"2\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n else\n puts \"1. Une potion.\"\n puts \"2. Une grenade !\"\n puts \"3. Rien finalement.\"\n combat2_grenade_ou_potion = $stdin.gets.chomp\n if combat2_grenade_ou_potion == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur #{user_name}.\"\n puts \"2. Sur Barret.\"\n user_potion_fight1 = $stdin.gets.chomp\n\n if user_potion_fight1 == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight1 ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \" Que faites-vous ?\"\n elsif combat2_grenade_ou_potion == \"2\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_ou_potion == \"3\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n\n\n end\n else\n puts \"Vous n'avez pas d'objet !\"\n numero_tour -= 1\n end\n\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\" && $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"\"\n puts '|' + '-'*20 + '|'\n puts \"|INVENTAIRE |\"\n puts '|' + '-'*20 + '|'\n puts \"|Potions : #{$mon_inventaire.show_potion} |\"\n puts \"|Grenades : #{$mon_inventaire.show_grenade} |\"\n puts '|' + '-'*20+ '|'\n numero_tour -= 1\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\"\n puts \"Vous n'avez pas d'objets dans votre inventaire pour l'instant.\"\n numero_tour -= 1\n else\n puts \"\"\n puts \"Je n'ai pas compris. Que faites-vous ?\"\n puts \"\"\n numero_tour -= 1\n end\n end\n end\n\n def afficher_inventaire\n#à compléter\n\n end\nend",
"def change (cost, quantity) \n\t@total_change = @total - (cost.to_i * quantity.to_i) #subtract cost*quantity to the total money\n\t@new_total = @total_change \n\t#looking for number of bills per denomination\n\tif @total_change >= 1000\n \t\tthousands_change = @total_change / 1000\n \t\t@total_change = @total_change % 1000\n \tend\n \t\n \tif @total_change >= 500\n \t\tfive_hundreds_change = @total_change / 500\n \t\t@total_change = @total_change % 500\n \tend\n \t\n \tif @total_change >= 100\n \t\thundreds_change = @total_change / 100\n \t\t@total_change = @total_change % 100\n \tend\n \t\n \tif @total_change >= 50\n \t\tfifties_change = @total_change / 50\n \t\t@total_change = @total_change % 50\n \tend\n \t\n \tif @total_change >= 20\n \t\ttwenties_change = @total_change / 20\n \t\t@total_change = @total_change % 20\n \tend\n \t\n \tif @total_change >= 10\n \t\ttens_change = @total_change / 10\n \t\t@total_change = @total_change % 10\n \tend\n \t\n \tif @total_change >= 5\n \t\tfives_change = @total_change / 5\n \t\t@total_change = @total_change % 5\n \tend\n \t\n \tif @total_change >= 1\n \t\tones_change = @total_change / 1\n \t\t@total_change = @total_change % 1\n \tend\n \t\n \tchange = {\n \t\t:ones => ones_change.to_i,\n \t\t:fives => fives_change.to_i,\n \t\t:tens => tens_change.to_i,\n \t\t:twenties => twenties_change.to_i,\n \t\t:fifties => fifties_change.to_i,\n \t\t:hundreds => hundreds_change.to_i,\n \t\t:five_hundreds => five_hundreds_change.to_i,\n \t\t:thousands => thousands_change.to_i\n \t}\n \t\n \t\"<br /> #{change[:ones]} Php 1\" \"<br />#{change[:fives]} Php 5\" \"<br />#{change[:tens]} Php 10,\" \"<br />#{change[:twenties]} Php 20\" \"<br />#{change[:fifties]} Php 50\" \"<br />#{change[:hundreds]} Php 100\" \"<br />#{change[:five_hundreds]} Php 500\" \"<br />#{change[:thousands]} Php 1000\"\n end",
"def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end",
"def calc_rent(all_owned)\n if (all_owned && !@doubled)\n @rent *= 2\n @doubled = true\n end\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 buy(amount)\n @bought_amount += amount if amount_remaining >= amount\n end",
"def set_loan\n @loan ||= Loan.find(params[:loan_id] || params[:id])\n @borrower_type ||= :borrower\n\n if @loan.blank?\n @loan = current_user.borrower.loan # or get the co-borrower relationship\n\n if @loan.present?\n @borrower_type = :secondary_borrower\n else\n @loan = InitializeFirstLoanService.new(current_user).call\n end\n end\n # use pundit to authorize user. check LoanPolicy\n authorize @loan, :update?\n end",
"def add_money\n\t\t# get current user's money\n \t@user = current_user\n\t\t@money = @user.money\n\t\t# get refill limit\n\t\t@allowed = @user.money_refill\n\n\t\t# if limit has not been reached, add money to account\n\t\tif @allowed > 0\n\t\t\t@user.money = @money + 1000\n\t\t\t@user.money_refill = @allowed - 1\n\t\t\t@user.save\n\t\t\tgflash :success => \"Money Successfully Transferred to your account!\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\telse\n\t\t\t# otherwise flash pop up regarding depleted money reserve\n\t\t\tgflash :error => \"You have depleted your money reserve.\"\n\t\t\tredirect_to :action => 'profile', :username => @user.login\n\t\tend\n end",
"def overdraft_fee\n @balance -= 30 \n end",
"def net_payments(current_user_id)\n payments = {\"you_are_owed\" => {}, \"you_owe\" => {}}\n # {\"Matt\"=>15.0, \"Sam\"=>10.0, \"Drew\"=>10.0, \"Tristan\"=>22.22} you_are_owed\n # {\"Matt\"=>11.11, \"Kyle\"=>25.22, \"Dega\"=>30.22, \"Drew\"=>30.22} you_owe\n\n you_owe_hash = you_owe(current_user_id)\n you_are_owed_hash = you_are_owed(current_user_id)\n\n\n # Find all the uniq keys of the two hashes, then sum the you_are_owed - you_owe, if value is positive, you are owed that amount, if value is negative you owe that amount\n user_payments = you_owe_hash.keys + you_are_owed_hash.keys\n user_payments = user_payments.uniq\n\n user_payments.each do |user|\n # user is in you_owe_hash and NOT you_are_owed_hash\n if you_owe_hash.has_key?(user) && !you_are_owed_hash.has_key?(user)\n payments[\"you_owe\"][user] = you_owe_hash[user]\n # user is NOT in you_owe_hash and in you_are_owed_hash\n elsif !you_owe_hash.has_key?(user) && you_are_owed_hash.has_key?(user)\n payments[\"you_are_owed\"][user] = you_are_owed_hash[user]\n # user is in both you_owe hash and you_are_owed hash\n else\n amount = (you_are_owed_hash[user] - you_owe_hash[user]).round(2)\n if amount > 0\n # Goes to you are owed\n payments[\"you_are_owed\"][user] = amount\n\n elsif amount < 0\n payments[\"you_owe\"][user] = -amount\n # Goes to you owe\n end\n end\n end\n\n payments\n\n end",
"def realise_loans!\n loan_ids = realised_recoveries.map {|recovery| recovery.loan.id }.uniq\n\n Loan.find(loan_ids).each do |loan|\n loan.realised_money_date = Date.today\n loan.modified_by = creator\n loan.update_state!(Loan::Realised, LoanEvent::RealiseMoney, creator)\n end\n end",
"def bet_attribution(state_of_game)\n if state_of_game === \"lose\"\n @money_current = @money_current - @money_bet\n elsif state_of_game === \"win\"\n @money_current = @money_current + (@money_bet * 0.5)\n @money_current = @money_current.to_i\n end\n @money_bet = 0\nend",
"def debit_player(p)\n p.money -= p.bet\n end",
"def settle_up(settle_from, settle_to, amount)\n\n # You are looking for all of the billsplits where the recipient id is payer (settle_from) because those are the ones you want to now fulfill\n billsplits = Billsplit.joins(:bill).where('author_id = ?', settle_to).where('recipient_id = ?', settle_from).where('recipient_paid = false')\n\n\n # this actually needs to be calculated from net payments\n bill_settle_list = []\n\n\n billsplits.each do |split|\n temp_bill = []\n amount -= split.split_amount\n if amount > 0\n temp_bill.push(split.id)\n temp_bill.push(true)\n temp_bill.push(0)\n bill_settle_list.push(temp_bill)\n\n elsif amount < 0 # if settle up amount is less than a single billsplit amount\n temp_bill.push(split.id)\n temp_bill.push(false)\n temp_bill.push(-amount.round(2)) # settle_from user now still owes settle_to user by negative amount\n bill_settle_list.push(temp_bill)\n break # Do not continue going through billsplits\n\n else\n temp_bill.push(split.id)\n temp_bill.push(true)\n temp_bill.push(0)\n bill_settle_list.push(temp_bill)\n break # Do not continue going through billsplits\n\n end\n end\n\n # If after going through all of the billsplits amount > 0, then an overpayment has been made\n # and a new bill/billsplit needs to be created in the opposite direction.\n if amount > 0\n temp_bill = []\n temp_bill.push(\"new\")\n temp_bill.push(false)\n temp_bill.push(amount.round(2))\n bill_settle_list.push(temp_bill)\n end\n\n bill_settle_list\n\n end",
"def sip(amount=5)\n puts \"Just took a sip\"\n\n if amount < 0\n puts \"Nasty! Rejected!\"\n elsif amount > @drink_amount\n @drink_amount = 0\n else\n @drink_amount -= amount\n end\nend",
"def make_better_change(value, coins)\n\nend",
"def make_better_change(value, coins)\n\nend",
"def make_better_change(value, coins)\n\nend",
"def withdraw(amount)\n raise ArgumentError.new if amount < 0\n\n #check that balance after will exceed 10 + $2 fee\n if @balance - amount - 200 < 1000\n puts \"Sorry, minimum $10 balance.\"\n else\n @balance = @balance - amount - 200\n end\n @balance\n end",
"def deposit(money) #Creating a method called deposit for the 1st user story\n @balance = @balance + money #The instance of 'balance' get recreated everytime the deposit method is called\n end",
"def calculate_bonus(num,pay)\n if pay; return num /2 else return 0 end\nend",
"def extra_cash(db, user_name)\r\n\t# determine extra monies (conditional on + amount)\r\n\tdifference = (current_income(db, user_name) - current_expenses(db, user_name))\r\n\tcache_bonus = difference if difference > 0 || 0\r\nend",
"def give_coins(from_addr, to_addr, coins, acc_balances)\n acc_balances[from_addr] = acc_balances[from_addr].to_i - coins.to_i\n acc_balances[to_addr] = acc_balances[to_addr].to_i + coins.to_i\n\n acc_balances\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 pay(amount, fee, sources, target, change)\n first_one do |api|\n api.pay(amount, fee, sources, target, change)\n end\n end",
"def withdraw(amount, atm, pin, acc_no)\n if @balance >= amount && atm.balance >= amount && @pin == pin && acc_no == @account_no\n atm.dispense(amount)\n @balance = @balance - amount\n puts \"your new balance is #{@balance}\"\n else\n puts \"you are too pov\"\n end\n end",
"def gain_interest\n interest_amount = (@balance * @interest_rate) / 100\n @balance = interest_amount + @balance\n end",
"def modify_wallet(bet)\n $wallet -= bet\n if $wallet < 0\n $wallet += bet\n puts \"Oops! Looks like you do not have enough money for that.\".red\n first_spin\n end\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 gain_interest\n @balance *= (1 + @interest_rate)\n end",
"def changer(amount)\n\n coins = []\n\n [25, 10, 5, 1].each do |denomination|\n coins = amount / denomination\n returned_coins += [denomination] * coins\n amount -= coins * denomination\n end\n returned_coins\nend",
"def deposit(money)\n self.balance = (self.balance + money)\n end",
"def paycheck(hours_actually_editing, paycheck_total, hourly_charge = 50)\n\t(paycheck_total/hours_actually_editing) > hourly_charge\nend",
"def conversar(person_one, person_two)\n person_one.hablar\n person_two.hablar\nend",
"def join_cult(cult)\n # Create a new blood oath that belongs to this follower and the cult we were given\n if age >= cult.minimum_age\n BloodOath.new(initiation_date: Time.now, follower: self, cult: cult)\n else\n diff = cult.minimum_age - self.age\n puts \"Sorry, you're too young to pledge your soul to #{cult.name}! Try again in #{diff} years!\"\n end\n end",
"def deposit(money)\n @balance += money\nend",
"def disbursed_amount\n amount = 0\n loans.each do |project|\n amount += project.disbursed_amount.to_i\n end\n amount\n end",
"def max_money(aid_amount, with_amount, rebel_rate, rebel_limit)\n max_with_amount = 0 \n while rebel_rate < rebel_limit && aid_amount > 0 \n aid_amount -= with_amount\n rebel_rate = rebel_rate * 2 \n max_with_amount += with_amount\n end\n max_with_amount\nend",
"def pay_interest!(entity)\n owed = interest_owed(entity)\n # This is here so that the log message does not get duplicated.\n if corp_has_new_zealand?(entity) && entity.loans.size.positive?\n @log << \"#{entity.name}'s token in Nieuw Zeeland covers one loan's worth of interest\"\n end\n return super unless owed.negative?\n\n # Negative interest -> corporation has New Zealand\n @log << \"#{entity.name} gets $20 for having a token in Nieuw Zeeland and no loans\"\n entity.spend(owed, bank, check_cash: false, check_positive: false)\n nil\n end",
"def price_is_right(bids, actual_retail_price)\n \nend",
"def withd amount\n unless amount > @savings_account_balance\n @savings_account_balance -= amount\n \n else\n end\n end",
"def sell_bonus\n bonus = 0.0\n battle_members.each { |member| bonus += member.sell_bonus }\n bonus\n end",
"def deposit(money_to_deposit)\n @balance += money_to_deposit\n end",
"def test_lend_money_transfers_money\n #Setup\n lender_before =\n lender_after =\n lendee_before =\n lendee_after =\n loan =\n #act\n #assert\n assert_equal(loan, lender_before - lender_after)\n assert_equal(loan, lendee_after- lendee_before)\nend",
"def credit_player(p, blackjack = false)\n if blackjack\n p.money += p.bet*1.5\n else\n p.money += p.bet\n end\n end",
"def sell_to(player, amount = cost)\n\t\t\tamount = amount.to_int\n\t\t\tif player.balance < amount\n\t\t\t\tplayer.game.log '[%s] Unable to buy %s! (short of cash by £%d)' % [ player.name, @name, ( amount - player.balance ) ]\n\t\t\t\tfalse\n\t\t\telse\n\t\t\t\tif @owner\n\t\t\t\t\tTransaction.new(to: @owner, from: player, amount: amount.to_i, reason: 'property trade')\n\t\t\t\t\tplayer.game.log '[%s] Sold %s%s to %s for £%d (new balance: £%d)' % [ @owner.name, @name, (is_mortgaged? ? ' (mortgaged)' : ''), player.name, amount, @owner.balance ]\n\t\t\t\t\t@owner.remove_property(self)\n\t\t\t\telse\n\t\t\t\t\tTransaction.new(to: player.game.bank, from: player, amount: amount.to_i, reason: 'property purchase')\n\t\t\t\t\tplayer.game.log '[%s] Purchased %s%s for £%d (new balance: £%d)' % [ player.name, @name, (is_mortgaged? ? ' (mortgaged)' : ''), amount, player.balance ]\n\t\t\t\tend\n\n\t\t\t\tplayer.add_property(self)\n\t\t\t\t@owner = player\n\t\t\tend\n\t\tend",
"def transfer_logic(receiver_id, amount)\n receiver = User.find(receiver_id)\n sender = current_user\n sender.credits -= amount\n receiver.credits += amount\n sender.save\n receiver.save\n login(sender)\n end",
"def place_offer(proposer, amount)\n\t\t\tif proposer.balance >= amount\n\t\t\t\tsell_to(proposer, amount) if @owner.decide(:consider_proposed_trade, game: @owner.game, player: @owner, proposer: proposer, property: self, amount: amount).is_yes?\n\t\t\tend\n\t\tend",
"def create\n @loan = Loan.new(loan_params)\n @loan.amount = loan_params[:amount].gsub(/,/, '').to_f\n @loan.property_value = loan_params[:property_value].gsub(/,/, '').to_f\n\n if @loan.save\n # conduct first test for loan approval\n if @loan.ltv < 40\n @loan.update_attributes(:accepted => true)\n end\n redirect_to \"/loans/#{@loan.id}\"\n else\n flash[:error_hash] = @loan.errors.messages\n flash[:error] = @loan.errors.full_messages\n flash[:error_list] = @loan.errors.messages.keys\n redirect_to :back\n end\n end",
"def customer_can_afford_pet(custo, new_pet)\n custo[:cash] > new_pet[:price]\nend",
"def can_afford_to_bet?(amount)\n (self.balance >= amount)\n end"
] | [
"0.720353",
"0.7112266",
"0.6799679",
"0.67730445",
"0.6648425",
"0.6536027",
"0.63850546",
"0.6319459",
"0.6268873",
"0.62365645",
"0.61992204",
"0.61785495",
"0.61775845",
"0.6167444",
"0.6129317",
"0.6103868",
"0.6019733",
"0.6013706",
"0.6006992",
"0.5998496",
"0.5981781",
"0.59765565",
"0.5966824",
"0.5938547",
"0.59092814",
"0.5884101",
"0.5862123",
"0.58567137",
"0.58564806",
"0.58351684",
"0.583471",
"0.58148",
"0.58138925",
"0.5804901",
"0.5773252",
"0.5751954",
"0.5738816",
"0.5737102",
"0.57369614",
"0.57327795",
"0.5728733",
"0.57075846",
"0.5706941",
"0.5702467",
"0.5699937",
"0.5689251",
"0.566577",
"0.56630474",
"0.56595373",
"0.5657929",
"0.56572115",
"0.56552285",
"0.56449455",
"0.5633446",
"0.56326985",
"0.5631854",
"0.5631391",
"0.5624025",
"0.5619929",
"0.56185526",
"0.5610421",
"0.55944073",
"0.55817163",
"0.55734164",
"0.5570872",
"0.5570872",
"0.5570872",
"0.5568706",
"0.55663574",
"0.5565407",
"0.5565066",
"0.55644435",
"0.5562633",
"0.55604416",
"0.5556626",
"0.55565894",
"0.5553374",
"0.5549751",
"0.55408853",
"0.55347574",
"0.55321306",
"0.5527783",
"0.5527027",
"0.5509997",
"0.55081594",
"0.5507875",
"0.5506713",
"0.5505997",
"0.5503728",
"0.55031383",
"0.5496725",
"0.5494428",
"0.54940796",
"0.54932445",
"0.5492686",
"0.5491611",
"0.5488194",
"0.54866177",
"0.5486184",
"0.5483369"
] | 0.6720866 | 4 |
7. Find the set of everyone's favourite food joined together | def all_foods(people)
all_foods = []
for person in people
all_foods.concat(person[:favourites][:things_to_eat])
end
return all_foods
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def every_favourite_food(people)\n #Create a empty array to save all the strings\n all_food = \"\"\n #For loop to iterate person in the array people\n for person in people\n #For loop to iterate in snacks in person\n for snacks in person[:favourites][:snacks]\n #adds new items to the array\n p snacks\n all_food += snacks += \" \"\n end\n end\n all_food.chop!\n return all_food\nend",
"def all_fav_foods(people)\n fav_foods = []\n for person in people\n fav_foods.concat(person[:favourites][:things_to_eat])\nend\nreturn fav_foods\nend",
"def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend",
"def find_recipe_by_ingredient\n print(\"What ingredients do you have? (Separate by comma)\")\n user_food = gets.chomp\n\n ingredient_ids = user_food.split(\",\").collect do |ingredient|\n Ingredient.find_by(name: ingredient).id\n end\n meal_arr = Meals.all.select do |meal|\n ingredent_ids.include?(meal.ingredient_id)\n end\n hash = {}\n meal_arr.each do |meal|\n if hash.keys.include?(meal.recipe_id)\n hash[meal.recipe_id] += 1\n else\n hash[meal.recipe_id] = 1\n end\n end\n arr = []\n hash.each do |recipe_id, ingredient_count|\n total_ingredients.to_f = Recipe.find(recipe_id).ingredients.size\n if ingredient_count / total_ingredients > 0.80\n arr << Recipe.find(recipe_id).name\n end\n end\n return arr\nend",
"def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend",
"def food_together(people)\n food = \"\"\n\n for person in people\n snacks_string = person[:favourites][:snacks].join(\", \")\n food << snacks_string + \", \"\n end\n return food.chomp(\", \")\n\nend",
"def get_all_food(people)\n food_array = []\n for person in people\n food_array += person[:favourites][:things_to_eat]\n end\n return food_array\nend",
"def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def favourite_foods(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Hash of avaialble foods and associated counts\n \n pie_qty = 0\n cake_qty = 0 # quantity of the foods equals to 0 \n cookie_qty = 0\n \n has_fave = false # Initializes our has_fave tood to false\n\n my_list.each_key do |key| # iterating over my_list keys to do a comparison \n if key == fav_food # Favorite food comparison\n has_fave = true # confirms fav_food is in the list \n end\n # has_fave = true if key == fav_food\n end\n \n if has_fave == false # my_list does not contain fav_food \n raise ArgumentError.new(\"You can't make that food\") # Raise error if fav_food was not found\n else # Fav_food was in the list\n fav_food_qty = my_list[fav_food] #.values_at(fav_food)[0] # if in the list, return the quantity on hand *** refactor\n if num_of_people % fav_food_qty == 0 # Checks if num_of_people is evenly divisable by the fav_food_qty\n num_of_food = num_of_people / fav_food_qty # returns num_of_food eq to number of people / fav foods \n return \"You need to make #{num_of_food} #{fav_food}(s).\" # Return favorite food along with quantity\n else #num_of_people % fav_food_qty != 0 # num_of_people was not evenly divisable by fav_food_qty\n while num_of_people > 0 # while num_of_people is greater than zero \n if num_of_people / my_list[\"pie\"] > 0 # At least more people than the quantity of pie will feed \n pie_qty = num_of_people / my_list[\"pie\"] # quantity of pie is equal the number of people divided by my_list of pie \n num_of_people = num_of_people % my_list[\"pie\"] # number of people ramaining after distributing pies\n elsif num_of_people / my_list[\"cake\"] > 0 # At least more people than the quantity of cake \n cake_qty = num_of_people / my_list[\"cake\"] # quantity of cake is equal to the number of people divided by qty of people cake will feed\n num_of_people = num_of_people % my_list[\"cake\"] # number of people remaining after distributing cakes \n else # num_of_people is less than both qty that pie and cake will feed\n cookie_qty = num_of_people # cookie quantity is equal to the number of people \n num_of_people = 0 # Set num_of_people to 0 in order to end the loop\n end # Ending if-else conditions\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def global_food(people)\n food_array = []\n for person in people\n food_array.push(person[:favourites][:snacks])\n #food_array.concat(person[:favourites][:snacks])\n # if we want to return only one array\n end\n return food_array\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_array = []\n has_fave = false\n\n my_list.each_key do |k|\n if k == fav_food\n has_fave = true\n end\n end\n raise ArgumentError.new(\"You can't make that food\") if has_fave == false\n fav_food_qty = my_list[fav_food]\n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0\n while num_of_people > 0\n my_list.each do |k, v|\n food_qty = num_of_people / v\n num_of_people = num_of_people % v\n food_array << food_qty\n end\n end\n return \"You need to make #{food_array[0]} pie(s), #{food_array[1]} cake(s), and #{food_array[2]} cookie(s).\"\n end\nend",
"def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend",
"def find_show_buddies(people)\n\n tv_shows = []\n\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n show_buddies = []\n\n for index in same_show\n show_buddies.push(people[index][:name])\n end\n\n return show_buddies\nend",
"def likes_to_eat(person, food)\n food_array = person[:favourites][:snacks]\nreturn food_array.include?food\nend",
"def spiciest_foods(spicy_foods)\n spicy_foods.select { |spicy_food_hash| spicy_food_hash[:heat_level] > 5}\nend",
"def favorite_food_frequency\n all_favorite_foods.each_with_object(Hash.new(0)) do |food, object|\n object[food] += 1\n end\n end",
"def true_for_food(hash, item)\n food= hash[:favourites][:things_to_eat]\n\n for i in hash\n if i == food\n\n return \"Yes I like this food\"\n end\n end\n return \"No I don't like this\"\n end",
"def favorite_list\n favorite_list.unique\n end",
"def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false\n\n my_list.each_key do |k|\n if k == fav_food\n has_fave = true\n fav_food = k\n end\n end\n if has_fave == false\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0]\n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0\n while num_of_people > 0\n if num_of_people / my_list[\"pie\"] > 0\n pie_qty = num_of_people / my_list[\"pie\"]\n num_of_people = num_of_people % my_list[\"pie\"]\n elsif num_of_people / my_list[\"cake\"] > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def bakery_num(num_of_people, fav_food) \n \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n \n has_fave = false \n\n my_list.each_key do |k| \n if k == fav_food\n has_fave = true\n end\n end\n \n if has_fave == false\n raise ArgumentError.new(\"You can't make that food\")#raise error if has_fave is #false will catch items that are not included in program\n \n else fav_food_qty = my_list[fav_food] #setting fav_food_qty equal to value in my_list\n \n if num_of_people % fav_food_qty == 0 #if perfectly divisible...\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else #the scenario where the favorite food is not perfectly divisible\n final_hash = my_list \n my_list.each do |k, v|\n final_hash[k] = num_of_people / v\n num_of_people %= v\n end\n\n stringOut = \"You need to make \"\n stringMod = \"\"\n stringEnd = \"\"\n mod_hash = final_hash.dup.delete_if {|k, v| k == \"cookie\" } #Assumes that cookies always feeds one \n last_hash = final_hash.dup.delete_if {|k, v|k != \"cookie\" } #See above\n\n mod_hash.each do |k,v| \n stringMod += \"#{v}\" + \" \" + \"#{k}(s)\" + \",\" + \" \"\n end\n\n last_hash.each do |k,v|\n stringEnd += \"and #{v}\" + \" \" + \"#{k}(s)\" + \".\"\n end\n end\n end\n return stringOut + stringMod + stringEnd #purpose of this is to return as String\nend",
"def favorite_recipes\n favorites.each do |f|\n f.recipe\n end\n end",
"def pets_by_breed(pet_shop, breed)\n breed_total = []\n for item in pet_shop[:pets]\n if item[:breed] == breed # was returning an array of 6 of the same breed in an array because I accidentally used a single = operator\n breed_total.push(item[:breed])\n end\n end\n return breed_total\nend",
"def get_random_foods(how_many_foods, array)\n random_foods = []\n until random_foods.length == how_many_foods\n random_food_num = rand(0..array.length-1) # get a random number for the food\n food = array[random_food_num]\n while random_foods.include?(food)\n random_food_num = rand(0..array.length-1) # get a random number for the food\n food = array[random_food_num]\n end\n random_foods << food\n end\n return random_foods\nend",
"def find_the_cheese(snacks)\n cheeses = %w(gouda cheddar camembert)\n snacks.find do |maybe_cheese|\n cheeses.include?(maybe_cheese)\n end\nend",
"def yummy(foods)\n delicious_foods = []\n foods.each do |key,value| \n if value == \"delicious\"\n delicious_foods << key\n else \n foods.delete(key)\n end\n end\n the_good_food = delicious_foods.join(\", \")\nend",
"def find_show_buddies(people)\n\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n p tv_shows\n end\n p tv_shows\n\n same_show = []\n count = 0\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n p same_show\n p count\n end\n count += 1\n end\n p same_show\n\n show_buddies = []\n for index in same_show\n show_buddies.push(people[index][:name])\n p show_buddies\n end\n p show_buddies\n\n return show_buddies\nend",
"def list_fav\r\n users = User.all \r\n users.each do |user|\r\n puts \"#{user}\"\r\n user.snacks.each do |snack|\r\n puts \"- #{snack}\"\r\n end\r\n end\r\nend",
"def pets_by_breed(shop, breed_to_count)\n selected_breed = []\n for pet in shop[:pets]\n if pet[:breed] == breed_to_count\n selected_breed << pet[:breed]\n end\n end\n return selected_breed\nend",
"def pets_by_breed(pet_shop,pet_breed)\n breeds = []\n for pet in pet_shop[:pets]\n if pet[:breed].include?(pet_breed)\n breeds.push(pet[:breed])\n end\n end\n return breeds\nend",
"def bakery_num(num_of_people, fav_food) #defines the method and accepts arguments num_of_people and fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0 #declaring variables at 0\n cake_qty = 0 #declaring variables at 0\n cookie_qty = 0 #declaring variables at 0\n \n has_fave = false\n\n my_list.each_key do |k| #iterates through the keys in my_list\n if k == fav_food #checks if passed argument fav_food is in the hash as a key\n has_fave = true #sets boolean has_fave to true\n fav_food = k #re-assigns fav_food to the key in the hash\n end\n end\n \n if has_fave == false #if fav_food is not found in the list\n raise ArgumentError.new(\"You can't make that food\") #raise an error\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #declares a variable that is the quantity of fav food argument and sets it equal to first element in the value\n \n if num_of_people % fav_food_qty == 0 #if number of people is divisable by quantity of fav food\n num_of_food = num_of_people / fav_food_qty #number of food is set to number of people divided by fav food quantity\n return \"You need to make #{num_of_food} #{fav_food}(s).\" #returns string concatenated declaring how much of the food to make\n \n else num_of_people % fav_food_qty != 0 #if num of people is not divisable by fav food qty\n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if number of people divided by number of pies floor is greater than 0 \n pie_qty = num_of_people / my_list[\"pie\"] #sets pie quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"pie\"] #num of people reassigned to remainder \n elsif num_of_people / my_list[\"cake\"] > 0 #if number of people divided by number of cakes floor is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #sets cake quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"cake\"] #num of people reassigned to remainder \n else\n cookie_qty = num_of_people #sets cookie qty to number of people remaining\n num_of_people = 0 #ends the loop if \"cookie else\" is reached\n end\n end\n \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #returns the string, whole combination\n end\n end\nend",
"def same_favourite_tv_show(people)\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n result = []\n for index in same_show\n result.push(people[index][:name])\n end\n return result\nend",
"def bakery_num(num_of_people, fav_food) #Defining a function that takes two parameters\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #Declaring a my_list hash\n pie_qty = 0 # Assigning three other variables \n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false #setting a default value of false \n\n my_list.each_key do |k| #looping through the keys of my_list\n if k == fav_food #An if statement, where the condition is comapred to one of the parameters\n has_fave = true #If true, declaring a has_fave to true \n fav_food = k #Assigning fav_food to that key\n end\n end\n if has_fave == false #If no matec ==> error\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #If match ==> find value from Hash \n if num_of_people % fav_food_qty == 0 #Module of the first function parameter, number of people by fav food quantity\n num_of_food = num_of_people / fav_food_qty #If true, get portions \n return \"You need to make #{num_of_food} #{fav_food}(s).\" #return an order \n else num_of_people % fav_food_qty != 0 #redundant but if not \n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if there are more people than pies\n pie_qty = num_of_people / my_list[\"pie\"] #This gets portions\n num_of_people = num_of_people % my_list[\"pie\"] #this gets amount of people for leftovers \n elsif num_of_people / my_list[\"cake\"] > 0 #If the number of people is not rgeater than pies, we go into cakes\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend",
"def bakery_num(num_of_people, fav_food) # this is defining bakery_num and takes 2 inputs\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # creates hash, keys are baked goods, values are how many you can feed\n pie_qty = 0 # sets pie_qty to zero\n cake_qty = 0\n cookie_qty = 0\n \n has_fav = false # rename?\n\n my_list.each_key do |k| # iterates through each key in my_list\n if k == fav_food # if they key matches fav_food input\n has_fav = true # change has_fav to true\n end\n end\n \n if has_fav == false # If food isn't in stock/ isn't found\n raise ArgumentError.new(\"You can't make that food\")\n \n else\n fav_food_qty = my_list.values_at(fav_food)[0] # quantity of people favorite food can feed\n \n if num_of_people % fav_food_qty == 0 # if num_of_people can be divided evenly by fav_food_qty\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else\n num_of_fav_food = num_of_people / fav_food_qty\n num_of_people = num_of_people % fav_food_qty\n \n while num_of_people > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n if num_of_people % my_list[\"cake\"] > 0\n cookie_qty = num_of_people\n num_of_people = 0\n end \n end\n \n if fav_food == \"pie\"\n pie_qty = num_of_fav_food\n elsif fav_food == \"cake\"\n cake_qty = num_of_fav_food\n else\n cookie_qty = num_of_fav_food\n end\n\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n \n end \n end\nend",
"def fivesSet(s)\n return (s.find_all {|i| i%5 == 0}).to_set\nend",
"def favorited_items\n User.first.favorites.map {|fi| fi.product}\n end",
"def bakery_num(num_of_people, fav_food)\n food_servings = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Initialize the food and the quantity \n fav_food_qty = food_servings[fav_food] \n \n raise ArgumentError.new(\"You can't make that food\") if !food_servings.has_key?(fav_food)\n \n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n food_qty = food_servings.clone\n # First make favorite food\n food_qty[fav_food] = num_of_people / food_servings[fav_food]\n num_of_people %= food_servings[fav_food]\n \tfood_servings.delete(fav_food)\t\t\n \t# Now servings for the rest\n food_servings.each_key do |key| \n break if num_of_people == 0 # this isn't really necessary with 3 keys, but with more it would be.\n food_qty[key] = num_of_people / food_servings[key]\n num_of_people %= food_servings[key]\n end\n return \"You need to make #{food_qty[\"pie\"]} pie(s), #{food_qty[\"cake\"]} cake(s), and #{food_qty[\"cookie\"]} cookie(s).\" # This prints the needed quantities\n end\nend",
"def bakery_num(num_of_people, fav_food) # creating method bakery_num\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #creating hash. value of keys equals servings per person\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n dessert_array = Array.new\n has_fave = false \n\n my_list.each_key do |k| #iterates each key in the hash my_list\n if k == fav_food # making a comparison of each key in hash\n has_fave = true # gives a true value to fave_food\n #fav_food = k #fav_food is set to the value of the key ***** Redundant assignment, line deleted.\n end\n end\n\n if has_fave == false #if has_fave is false\n raise ArgumentError.new(\"You can't make that food\") #makes a new error to say that we cannot make that food because we have the incorrect arguements\n else\n fav_food_qty = my_list[fav_food] #creating a variable that, through the values method, returns an array made up by the value of the key established at fav_food \n if num_of_people % fav_food_qty == 0 #if theres no remainder in num_of_people divided fav_food_quantity\n num_of_food = num_of_people / fav_food_qty #creating num_of_food variable that gives us how many food items we should make\n return \"You need to make #{num_of_food} #{fav_food}(s).\" # returns string \n else #if there is a remainder \n while num_of_people > 0\n #\n my_list.each do |k,v|\n dessert_qty = num_of_people / v\n num_of_people = num_of_people % v\n dessert_array << dessert_qty \n end\n \n #\n # if num_of_people / my_list[\"pie\"] > 0 # if num_of_people divided by number of servings of pie is greather than zero\n # pie_qty = num_of_people / my_list[\"pie\"] # pie_qty equals num_of_people divided by servings of pie\n # num_of_people = num_of_people % my_list[\"pie\"] # num_of_people equals the remainder of num_of_people and servings of pie\n # elsif num_of_people / my_list[\"cake\"] > 0 #repetition of first set of conditions of pie\n # cake_qty = num_of_people / my_list[\"cake\"]\n # num_of_people = num_of_people % my_list[\"cake\"]\n # else\n # cookie_qty = num_of_people / my_list[\"cookie\"] \n # num_of_people = num_of_people % my_list[\"cookie\"] # so we don't have an infinite loop\n # end\n end\n return \"You need to make #{dessert_array[0]} pie(s), #{dessert_array[1]} cake(s), and #{dessert_array[2]} cookie(s).\"\n end\n end\nend",
"def guess_gifts(wishlist, presents)\n\n wishlist.map do |w|\n w[:name] if presents.include? w.reject { |key| key == :name }\n end.compact.uniq\n\nend",
"def get_info_on_club(fixture)\n puts \"See when your favourites are playing:(enter favourite club name)\"\n fav_club = gets.chomp\n all_fav_matches = fixture.map do |game|\n if game[:home_team].downcase.include?(fav_club) || game[:away_team].downcase.include?(fav_club)\n game\n end\n end.compact\n\n if all_fav_matches.empty?\n puts \"Did not match the database!\"\n else\n puts all_fav_matches\n end\nend",
"def like_food?(food, person)\n person[:favourites][:things_to_eat].include?(food)\nend",
"def all_favorited options = {}\n return all_favorites(options).collect{ |f| f.favoritable }\n end",
"def my_friends\n (invited_friends + asked_friendships).compact.uniq\n end",
"def grouped_friends\n friends = {\"Industry Participant\" => [], \"Respected Peer\" => [], \"Kindred Spirit\" => [], \"Purgatory\" => []}\n\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Industry Participant\"].blank?\n friends[\"Industry Participant\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Industry Participant\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Industry Participant\"].blank?\n friends[\"Industry Participant\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Industry Participant\"].map{|friendship| friendship.proposer}\n end\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Respected Peer\"].blank?\n friends[\"Respected Peer\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Respected Peer\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Respected Peer\"].blank?\n friends[\"Respected Peer\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Respected Peer\"].map{|friendship| friendship.proposer}\n end\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Kindred Spirit\"].blank?\n friends[\"Kindred Spirit\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Kindred Spirit\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Kindred Spirit\"].blank?\n friends[\"Kindred Spirit\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Kindred Spirit\"].map{|friendship| friendship.proposer}\n end\n unless self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Purgatory\"].blank?\n friends[\"Purgatory\"] += self.friendships_as_proposer.group_by{|friendship| friendship.proposer_sharing_pref}[\"Purgatory\"].map{|friendship| friendship.proposee}\n end\n unless self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Purgatory\"].blank?\n friends[\"Purgatory\"] += self.friendships_as_proposee.where({confirmed: true}).group_by{|friendship| friendship.proposee_sharing_pref}[\"Purgatory\"].map{|friendship| friendship.proposer}\n end\n friends[\"Industry Participant\"].sort_by!{|user| user.last_name} unless friends[\"Industry Participant\"].blank?\n friends[\"Respected Peer\"].sort_by!{|user| user.last_name} unless friends[\"Respected Peer\"].blank?\n friends[\"Kindred Spirit\"].sort_by!{|user| user.last_name} unless friends[\"Kindred Spirit\"].blank?\n friends[\"Purgatory\"].sort_by!{|user| user.last_name} unless friends[\"Purgatory\"].blank?\n friends\n end",
"def popularity \n array = []\n Meal.all.select do |meal|\n if meal.recipe == self\n array << meal\n end\n end\n puts \"#{self.title} has been made #{array.length} times!\"\n end",
"def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n serving_sizes = { \"pie\" => 8, \"cake\" => 6, \"cookie\" => 1 } # Hash of available foods and associated counts\n food_quantities = { \"fav_food\" => 0, \"pie\" => 0, \"cake\" => 0, \"cookie\" => 0 } # Hash of food quantities\n\n # Raise error if serving sizes doesn't contain food\n raise ArgumentError.new(\"You can't make that food\") if !serving_sizes.has_key? (fav_food)\n\n # Returns the necessary number of food items needed to satisfy each serving if the \n # number of people attending is evenly divisible by the quantity of the passed favorite food.\n return \"You need to make #{num_of_people / serving_sizes[fav_food]} #{fav_food}(s).\" if num_of_people % serving_sizes[fav_food] == 0\n\n # Loop through each key in food_quantities to determine how many of each food item is needed.\n food_quantities.each do |key, value|\n if key == \"fav_food\" \n food_quantities[key] = num_of_people / serving_sizes[fav_food] # Setting \"fav_food\" property for future use in food_quantities\n food_quantities[fav_food] = food_quantities[key]\n num_of_people = num_of_people % serving_sizes[fav_food] # Setting remaining amount of people left after fav_food is determined.\n elsif num_of_people / serving_sizes[key] > 0 # key is not fav_food and number of remaining people divided by the next food item serving size is greater than zero\n food_quantities[key] = num_of_people / serving_sizes[key] # Setting count for additional food items needed for remaining people\n num_of_people = num_of_people % serving_sizes[key] # Setting number of remaining people after the additional food item\n end # Ending conditional\n end # Ending .each loop\n\n return \"You need to make #{food_quantities[\"pie\"]} pie(s), #{food_quantities[\"cake\"]} cake(s), and #{food_quantities[\"cookie\"]} cookie(s).\"\nend",
"def bakery_num(num_of_people, fav_food)\n # Hash to show the serving zise of each food item \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n # Raise an error if fav_food is not one of my_list\n raise ArgumentError.new(\"You can't make that food\") if my_list[fav_food].nil?\n # Initialize each quantity at zero\n supplies = { \"pie\" => 0,\n \"cake\" => 0,\n \"cookie\" => 0}\n \n left_over = num_of_people % my_list[fav_food]\n supplies[fav_food] = num_of_people/my_list[fav_food]\n if left_over == 0\n \"You need to make #{supplies[fav_food]} #{fav_food}(s).\"\n else \n my_list.each do |k, v|\n if left_over >= v \n supplies[k] = left_over / v\n left_over = left_over % v\n end\n end\n return \"You need to make #{supplies['pie']} pie(s), #{supplies['cake']} cake(s), and #{supplies['cookie']} cookie(s).\"\n end\nend",
"def bakery_num(num_of_people, fav_food)\n # Hash to show the serving zise of each food item \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n # Raise an error if fav_food is not one of my_list\n raise ArgumentError.new(\"You can't make that food\") if my_list[fav_food].nil?\n # Initialize each quantity at zero\n supplies = { \"pie\" => 0,\n \t\t\t \"cake\" => 0,\n \t\t\t \"cookie\" => 0 }\n \n left_over = num_of_people % my_list[fav_food]\n supplies[fav_food] = num_of_people/my_list[fav_food]\n if left_over == 0\n \"You need to make #{supplies[fav_food]} #{fav_food}(s).\"\n else \n my_list.each do |k, v|\n if left_over >= v \n supplies[k] = left_over / v\n left_over = left_over % v\n end\n end\n return \"You need to make #{supplies['pie']} pie(s), #{supplies['cake']} cake(s), and #{supplies['cookie']} cookie(s).\"\n end\nend",
"def get_favorite_locations_array\n favorite_locations = StartLocation.all.select do |start_location|\n start_location.favorite == true\n end.map {|favorite_location| favorite_location.name }\n\n EndLocation.all.select do |end_location|\n favorite_locations << end_location.name if end_location.favorite == true\n end\n favorite_locations.uniq\nend",
"def favorite_hashtags\n favorite_stuffs(:hashtags, :text, 3)\n end",
"def found_friends(people)\n friends = []\n people.each do |person|\n if (person == \"Don\")\n friends << \"Don\"\n end\n if (person == \"John\")\n friends << \"John\"\n end\n if (person == \"Kent\")\n friends << \"Kent\"\n end\n end\n return friends\nend",
"def ice_cream_shop(flavors, favorite)\n flavors.select{|word| word == favorite }.empty? == false \nend",
"def find_the_cheese(foods)\n foods.find{ |cheese| cheese == \"cheddar\" || cheese == \"gouda\" || cheese ==\n \"camembert\"}\nend",
"def pets_by_breed(pet_shop, supplied_breed)\n saved_breeds = []\n for pet in pet_shop[:pets]\n saved_breeds.push(pet) if pet[:breed] == supplied_breed\n end\n return saved_breeds\nend",
"def pets_by_breed(pet_shop, breed)\n pets = [] # reminding myself again that the empty array will include the amount it has counted when searched\n for pet in pet_shop[:pets]\n if pet[:breed] == breed \n pets << pet\n end \n end\n #two ends because you are closing out the for and if\n return pets\nend",
"def pets_by_breed(pet_shop_hash, pet_breed)\n breed_count = []\n pet_shop_hash[:pets].select { | pet | breed_count << pet if pet[:breed] == pet_breed}\n return breed_count\nend",
"def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.find do |cheese|\n item == cheese\n end\n end\nend",
"def pets_by_breed(shop_hash, breed)\n pets_found = []\n for pet_hash in shop_hash[:pets]\n if pet_hash[:breed] == breed\n pets_found.push(breed)\n end\n end\n return pets_found\nend",
"def list\n # @restaurants = Restaurant.joins(:foods).select(\"categories.*, COUNT(issues.id) AS issues_count\").group('categories.id')\n @user = User.find(current_user.id);\n @foods = @user.foods\n @count = @foods.group(:restaurant).count\n @restaurants = @count.keys\n @favorites = @count.values\n end",
"def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end",
"def bakery_num(num_of_people, fav_food) \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n\n fav_food_qty = my_list[fav_food] \n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n while num_of_people > 0\t\n pie_qty = num_of_people / my_list[\"pie\"] unless fav_food == \"cake\"\n num_of_people = num_of_people % my_list[\"pie\"] unless fav_food == \"cake\"\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\nend",
"def bakery_num(num_of_people, fav_food) #defining method bakery_num, which takes 2 arguments\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1, \"pudding\" => 2, \"bunt cake\" => 4, \"mega-cupcakes\" => 3} #creates hash my_list, key is food, value is number\n pie_qty = cake_qty = cookie_qty = has_fave = 0 \n \n\n my_list.each_key do |k| #iterating through array my_list\n if k == fav_food #tests if each item in array my_list = fav_food\n has_fave = 1 #if test above passes, set has_fave to true\n # fav_food = k #if test above passes, set fav_food to k\n end\n end\n \n if has_fave == 0 #if fav_food is not a key, end program\n raise ArgumentError.new(\"You can't make that food\")\n else #if fav_food is a key\n fav_food_qty = my_list.values_at(fav_food)[0] #set fav_food_qty equal to the value of fav_food\n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty #if num_of_people is evenly divisible by fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n #num_of_food = num_of_people / fav_food_qty #then perform division by integer\n #return \"You need to make #{num_of_food} #{fav_food}(s).\" #return \"You need to make (num_of_food) (fav_food)s\"\n else num_of_people % fav_food_qty != 0 #redundant else\n while num_of_people > 0 #while num_of_people is greater than 0\n if num_of_people / my_list[\"pie\"] > 0 #if num_of_people divided by value of pie is greater than 0\n pie_qty = num_of_people / my_list[\"pie\"] #set pie_qty equal to num_of_people divided by value of pie in hash\n num_of_people = num_of_people % my_list[\"pie\"] #set num_of_people equal to the remainder of num_of_people divided by value of pie in hash\n elsif num_of_people / my_list[\"cake\"] > 0 #if num_of_people divided by hash value of cake is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #set cake_qty equal to num_of_people divided by hash value of cake\n num_of_people = num_of_people % my_list[\"cake\"] #set num_of_people equal to the remainder of num_of_people divided by value of cake in hash\n else\n cookie_qty = num_of_people #set cookie_qty equal to num_of_people\n num_of_people = 0 #set num_of_people equal to 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #print out\n end\n end\n \nend",
"def wine_type_by_food\n wine_array = self.wines\n wine_types = wine_array.map do |wine|\n wine.varietal\n end\n wine_types.uniq!\n end",
"def favourite_heroes()\n sql = \"\n SELECT DISTINCT h.id, h.name FROM players p\n INNER JOIN favourites f\n ON f.player_id = p.id\n INNER JOIN heroes h\n ON h.id = f.hero_id\n WHERE player_id = #{@id};\n \"\n return Hero.get_many( sql )\n end",
"def allergens\n allergy_for_this_recipe = Allergy.all.select do |allergy|\n ingredients.include?(allergy.ingredient)\n end\n allergy_for_this_recipe.map do |allergy|\n allergy.ingredient\n end.uniq\n end",
"def pets_by_breed(pets, pet_breed)\n result = []\n for breed in pets[:pets]\n if breed[:breed] == pet_breed\n result.push(breed)\n end\n end\n return result\nend",
"def spicy_foods \n [\n { name: 'Green Curry', cuisine: 'Thai', heat_level: 9 },\n { name: 'Buffalo Wings', cuisine: 'American', heat_level: 3 },\n { name: 'Mapo Tofu', cuisine: 'Sichuan', heat_level: 6 }\n ]\nend",
"def pets_by_breed(pet_shop, breed)\n # breeds = []\n # for pet in @pet_shop[:pets]\n # if breed == pet[:breed]\n # breeds.push(pet)\n # end\n # end\n # return breeds\n #need to refactor this tonight\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n \n#Determine whether fav_food is a key in my_list\n# if you type in a food that isn't on the list, it raises an argument error\n\nunless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\nend\n\n# takes the value of the favorite food\n fav_food_qty = my_list[fav_food]\n#checks whether the number of people is divisible by that value \n if num_of_people % fav_food_qty == 0\n \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n#if there is a remainder...\n else num_of_people % fav_food_qty != 0\n food_quantity[fav_food] = num_of_people / fav_food_qty\n remaining_people=num_of_people%fav_food_qty\n my_list.each do |k,v|\n if remaining_people / my_list[k] > 0\n food_quantity[k] += remaining_people / my_list[k]\n remaining_people = remaining_people % my_list[k]\n end\n end\n # returns the number of pies, cakes, and cookie that can be made\n return \"You need to make #{food_quantity['pie']} pie(s), #{food_quantity['cake']} cake(s), and #{food_quantity['cookie']} cookie(s).\"\n end\n end",
"def bakery_num(num_of_people, fav_food)\n \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n unless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\n else\n\treturn \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n \n if fav_food == \"pie\"\n \tpie_qty = num_of_people/my_list[\"pie\"]\n \tnum_of_people = num_of_people % my_list[\"pie\"]\n \tcake_qty = num_of_people / my_list[\"cake\"]\n \tnum_of_people = num_of_people % my_list[\"cake\"]\n else \n \tcake_qty = num_of_people/my_list[\"cake\"]\n \tnum_of_people = num_of_people % my_list[\"cake\"]\n \tpie_qty = num_of_people / my_list[\"pie\"]\n \tnum_of_people = num_of_people % my_list[\"pie\"]\n end\n \n cookie_qty = num_of_people\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n end\nend",
"def pets_by_breed(pet_shop,breed)\n breed_array = Array.new\n for pet in pet_shop[:pets]\n pet[:breed] == breed ? breed_array << pet[:breed] : false\n end\n return breed_array\nend",
"def pets_by_breed(shop, breed)\n count = []\n for pet in shop[:pets]\n if pet[:breed] == breed\n then count << pet\n end\n end\n return count\nend",
"def view_all_favorites(customer)\n customer_favs = customer.favorites # get favorites from customer\n\n get_res_id = customer_favs.map do |fav_res| # get restaurant IDs from favorites\n fav_res.restaurant_id\n end\n\n get_res = Restaurant.all.select do |res| # get restaurants from their IDs\n get_res_id.include?(res.id)\n end\n\n res_names = get_res.map do |res| # get names from restaurants\n res.name\n end\n\n new_res = res_names.each_with_index do |fav_res_name, index|\n puts \"#{index + 1}. #{fav_res_name}\"\n end\n # favorite_restaurants = Restaurant.where(id: customer.favorites.map(&:restaurant_id))\n # puts favorite_restaurants.map(&:name)\n main_menu($customer)\nend",
"def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.include?(item)\n end\n end",
"def food_list\n\tlist = Hash.new \n\tlist [\"carrots\"] = 0\n\tlist [\"apples\"] = 0\n\tlist [\"pizza\"] = 0\n\tlist [\"cereal\"] = 0\n\tlist\nend",
"def find_mached_recipe(fridge)\r\n system \"clear\"\r\nrecipes_you_can_make = []\r\nrecipe_count = 1\r\n fridge.recipes.each do |recipe|\r\n if recipe.ingredients & fridge.what_you_have.map(&:name) == recipe.ingredients\r\n recipes_you_can_make << recipe\r\n recipe_count += 1\r\n end #if end\r\n end # fridge.recipes.each end\r\n if recipe_count ==1\r\n puts \"Nothing! You better go out and get some food.\"\r\n sleep 2\r\n abort\r\n else\r\n puts \"Thank you! You can make these Japanese food\"\r\n end # if end\r\n recipes_you_can_make\r\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # create hash\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n\n fav_food_qty = my_list.values_at(fav_food)[0] #create variable and set it to the my_list hash's value as an array\n\n if num_of_people % fav_food_qty == 0 #if num of people divides evenly by fav food quantity\n num_of_food = num_of_people / fav_food_qty #create new variable that is set to num of people divided by fav food qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0 # if not evenly divided\n case fav_food\n when \"pie\"\n pie_qty = num_of_people / my_list[\"pie\"] # pie qty = 5\n num_of_people = num_of_people % my_list[\"pie\"] # num of people = 1\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n when \"cake\"\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n when \"cookie\"\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n raise ArgumentError.new(\"You can't make that food\") unless my_list.include?(fav_food)\n\n quantity[fav_food] = num_of_people / my_list[fav_food]\n remainder = num_of_people % my_list[fav_food]\n return \"You need to make #{quantity[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n \n my_list.each do |k,v|\n next if remainder < v\n quantity[k] = (remainder / v)\n remainder = remainder % v\n end \n\n \"You need to make #{quantity[\"pie\"]} pie(s), #{quantity[\"cake\"]} cake(s), and #{quantity[\"cookie\"]} cookie(s).\"\nend",
"def allergens\n self.ingredients.map do |ingredient|\n Allergen.all.map do |allergen|\n ingredient if allergen.ingredient_O == ingredient\n end.compact\n end.flatten.uniq\n end",
"def my_friends_subways\n Subway.joins(:restaurant_subways).includes(restaurants: :recommendations).where(recommendations: {user_id: self.my_visible_friends_ids + [self.id]}).uniq\n end",
"def user_favorite_moves\n FavoriteMove.all.select do |fav|\n fav.user == self \n end \n end",
"def bakery_num(num_of_people, fav_food) #defining a method bakery_number. Takes number of people and favorite food as parameters \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #hash- my_list that has type of food as a key and amount of food as a value\n pie_qty = 0 # set default quantity to zero \n cake_qty = 0 # set default quantity to zero \n cookie_qty = 0 # set default quantity to zero \n \n ##has_fave = false # setting has_fave to false ##\n\n #my_list.each_key do |k| # we are iterating over my_list key values \n #if k == fav_food # if one of the keys matches fav_food, then...\n #has_fave = true # has_fave is set to true \n ##fav_food = k ##not necessary \n #closed out if statement \n if my_list.has_key?(fav_food) \n fav_food_qty = my_list.values_at(fav_food)[0] \n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty \n return \"You need to make #{num_of_food} #{fav_food}(s).\" \n else \n case fav_food\n when \"pie\"\n if num_of_people / my_list[\"pie\"] > 0 \n pie_qty = num_of_people / my_list[\"pie\"] \n num_of_people = num_of_people % my_list[\"pie\"] \n elsif num_of_people / my_list[\"cake\"] > 0 \n cake_qty = num_of_people / my_list[\"cake\"] \n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n when \"cake\"\n if num_of_people / my_list[\"cake\"] > 0 \n cake_qty = num_of_people / my_list[\"cake\"] \n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n when \"cookie\"\n cookie_qty = num_of_people\n num_of_people = 0\n else\n \"You need to pick pie, cake, or cookie\"\n end \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end \n end \n else \n raise ArgumentError.new(\"You can't make that food\") # raise argument using a string \n end",
"def one_week_wonders(songs)\n array = []\n songs.each do |song|\n array << song if no_repeats?(song, songs) && array.include?(song) == false\n end\n array\nend",
"def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n \n return \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n return \"You need to make 0 pie(s), 0 cake(s), and #{num_of_people} cookie(s).\" if fav_food == \"cookie\"\n return \"You need to make #{num_of_people / my_list[fav_food]} pie(s), 0 cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"pie\"\n return \"You need to make 0 pie(s), #{num_of_people / my_list[fav_food]} cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"cake\"\n \nend",
"def get_spicy_food_by_cuisine(spicy_foods, cuisine)\n spicy_foods.find { |spicy_food_hash| spicy_food_hash[:cuisine] == cuisine}\nend",
"def pets_by_breed(petshop,breed)\n pets=[]\n petshop[:pets].each do\n |pet| \n if pet[:breed] == breed\n pets.push(breed) \n end\n end\n return pets\n end",
"def get_favorites\n @user = User.find(self.id)\n return Shop.where(id: \n { :$in => @user.favorite_places })\n .each { |shop| pp \"#{shop.picture}, #{shop.name}, #{shop.email}, #{shop.city}, #{shop.location}\"}\n end",
"def food_list\n list = Hash.new\n list [\"carrots\"] = 0\n list [\"apples\"] = 0\n list [\"pizza\"] = 0\n list [\"cereal\"] = 0\n list\nend",
"def favorite_ids\n @favorite_ids ||= user_favorites.pluck(:job_id).to_set\n end",
"def look_for_food(fish)\n fish.stop_turn\n food_range = fish.food_perception\n food = food_around(fish.position, food_range)\n if food.size > 0 && !(fish.status==Escaping)\n food_found = food[0]\n if fish.position.distance(food_found.position) <= EatingAndMatingRange\n fish.consume(food_found)\n @food.delete(food_found)\n @food.compact!\n else\n fish.spot_food(food_found)\n end\n end\n end",
"def describe_favorites(games)\n for game in games\n puts \"Favorite Game: #{game}\"\n end\nend",
"def favorite_for(user)\n favs.find_by(user_id: user)\n end",
"def favorite_artworks\n artworks.where(favorite: true)\n end",
"def find_frequently_reviewed_restaurants(topic, reviewer)\n restaurants = reviewer.subscribed_restaurants.by_topic(topic.id)\n frequency_with_restaurants = {}\n restaurants.each do |restaurant|\n frequency_with_restaurants[restaurant] ||= 0\n frequency_with_restaurants[restaurant] += 1\n end\n\n sorted = frequency_with_restaurants.sort{|v1, v2| v2.last <=> v1.last}\n\n # Take top 5 restaurants\n sorted[0..5]\n end",
"def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n if flavors[0] == favorite && flavors.length == 1\n return true\n else\n pick_one_flavors = flavors.sample\n flavors.delete(pick_one_flavors) unless pick_one_flavors == favorite\n ice_cream_shop(flavors, favorite)\n end\nend",
"def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end",
"def wishlisted\n wishlisted = self.visits.select { |visit| visit.visited == false }\n wishlisted.map { |museum| museum.user }\n end",
"def food_list(list)\r\n\tfood_hash = {}\r\n\tfood_array = list.split(' ')\r\n\tfood_array.each do |food_item| \r\n\t\tfood_hash[food_item] = 1\r\n\tend\r\n\tfood_hash\r\nend",
"def pets_by_breed(shop, breed)\n pet_breed = []\n pets = shop[:pets]\n for pet in pets\n if pet[:breed] == breed\n pet_breed.push(pet)\n end\n end\n return pet_breed\nend"
] | [
"0.68981284",
"0.68822867",
"0.6614809",
"0.6601522",
"0.6590655",
"0.6584551",
"0.65645766",
"0.65544635",
"0.64366883",
"0.64355934",
"0.63708866",
"0.63336664",
"0.6217467",
"0.6215299",
"0.62020653",
"0.6173818",
"0.6133609",
"0.6123532",
"0.6097411",
"0.6075723",
"0.6061181",
"0.6048941",
"0.6043704",
"0.6042267",
"0.60079354",
"0.6006246",
"0.60041785",
"0.6002631",
"0.59897226",
"0.59844995",
"0.59818715",
"0.59758914",
"0.5963655",
"0.59474874",
"0.5932734",
"0.5931414",
"0.5929066",
"0.5921358",
"0.59206975",
"0.5914668",
"0.5901495",
"0.58953243",
"0.5865687",
"0.58564585",
"0.5847916",
"0.58443546",
"0.5830978",
"0.58159",
"0.5813416",
"0.5812671",
"0.5811497",
"0.58066344",
"0.5806264",
"0.57948005",
"0.5769489",
"0.57678527",
"0.5767848",
"0.5763649",
"0.57511955",
"0.5737077",
"0.5733131",
"0.572897",
"0.57264274",
"0.5724206",
"0.57229716",
"0.5720532",
"0.5681926",
"0.5679243",
"0.5669034",
"0.56538755",
"0.565186",
"0.56499153",
"0.56467915",
"0.5629601",
"0.5620797",
"0.5602084",
"0.55987775",
"0.5596601",
"0.5594446",
"0.5589672",
"0.5585797",
"0.55808",
"0.5579745",
"0.557489",
"0.55746865",
"0.5569107",
"0.556491",
"0.5557886",
"0.5549663",
"0.55356133",
"0.55340356",
"0.553351",
"0.5531341",
"0.55266076",
"0.55229574",
"0.5520919",
"0.55164623",
"0.5512906",
"0.5512855",
"0.5504031"
] | 0.68072504 | 2 |
8. Find people with no friends .empty? is perhaps better to use? | def no_friends(people)
no_friends = []
for person in people
if person[:friends] == []
no_friends.push(person[:name])
end
end
return no_friends
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_no_friends(people)\n no_mates = []\n for person in people\n if person[:friends].length == 0\n no_mates.push(person)\n end\n end\n return no_mates\nend",
"def find_people_with_no_friends(people)\n no_friends_array = []\n for person in people\n if person[:friends].length() == 0\n no_friends_array << person[:name]\n end\n end\n return no_friends_array\nend",
"def no_friends(people)\n result = []\n for person in people\n result << person if person[:friends].empty?\nend\nreturn result\nend",
"def not_friends\n #TODO - get a better implementation of this\n not_me = User.all.includes(:friends).where.not(id: self.id).limit(50)\n not_my_friends = not_me.select{|user| !self.friends.exists?(user.id)}\n not_my_friends\n end",
"def is_friend?(all_friends, friend_name)\n # loop over each friend in friend array\n # get friend's name\n # if friend's name == friend_name,\n # return true\n # at end of loop, if friend name not found\n # return false\n\nend",
"def get_non_friends\n\n userFriends = self.all_friends\n userNotFriends = User.all_except(userFriends)\n\n #user is not friend of himself, next line break do this\n userNotFriends = userNotFriends.all_except(self)\n\n return userNotFriends\n end",
"def not_friends_with?(friend_id)\n\n friendships.where(friend_id: friend_id).count < 1\n\n end",
"def userless_people\n people.select{|p| p.user.nil?}\n end",
"def not_my_friend\n # one array of all users\n all_users = User.all\n # one array of just my friends \n all_of_my_freinds = self.friendees\n \n # compare arrays\n not_friends = all_users - all_of_my_freinds\n\n not_friends.select {|user| user != self}\nend",
"def friends\n @friends ||= neighbours.count{|sq| sq.alive?}\n end",
"def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end",
"def app_friends\n Friend.where(\"user_id_giver = ?\", user_id).includes(:friend).find_all do |f|\n # logger.debug2 \"user_id_receiver = #{f.user_id_receiver}, api_friend = #{f.api_friend}, app_friend = #{f.app_friend}\"\n if f.app_friend == 'Y'\n true\n elsif f.app_friend == nil and f.api_friend == 'Y'\n true\n else\n false\n end\n end # find all\n end",
"def app_friends\n Friend.where(\"user_id_giver = ?\", user_id).includes(:friend).find_all do |f|\n # logger.debug2 \"user_id_receiver = #{f.user_id_receiver}, api_friend = #{f.api_friend}, app_friend = #{f.app_friend}\"\n if f.app_friend == 'Y'\n true\n elsif f.app_friend == nil and f.api_friend == 'Y'\n true\n else\n false\n end\n end # find all\n end",
"def friends?(id)\n !(self.friends.index { |f| f.id == id }).nil?\n end",
"def my_friends\n (invited_friends + asked_friendships).compact.uniq\n end",
"def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"def pending_friends\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"def friendable_users\n User.all.where.not('id IN (?)', [id] + friends.ids +\n friend_requests_sent.pending.pluck(:receiver_id) + friend_requests_received.pending.pluck(:sender_id))\n end",
"def is_pending_friends_with?(friend)\n \t pending_friends.include?(friend)\n \t end",
"def friends\n return friendships_confirmed + inverse_friendships_confirmed\n end",
"def proposed_friends\n friendships.map{ |fs| fs.friend unless fs.accepted? }.compact\n end",
"def not_friends_with?(id_of_friend)\n # look at the Users friends and if the id if the friend passed in does not exist then return true.\n !friends.where(id: id_of_friend).exists?\n end",
"def all_friends\n User.where ['external_user_id IN (?) OR id IN (?)', facebook_friends_ids, email_friends_ids]\n end",
"def test_friends_for_and_by\n assert_equal [], users(:quentin).friends_for_me\n assert_equal [users(:quentin)], users(:user_20).friends_for_me\n assert_equal 50, users(:quentin).friends_by_me.size\n end",
"def friends?(other_user)\n friends.include?(other_user)\n end",
"def friends?(other_user)\n if Friendship.where(\"asker_id = #{self.id} AND receiver_id = #{other_user.id}\") != []\n return true\n else\n return false\n end\n end",
"def is_friends_or_pending_with?(friend)\n \t pending_or_accepted_friends.include?(friend)\n \t end",
"def pending_friends\n @user_fr.friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"def pending_friends\n friendships.map{|friendship| friendship.friend if !friendship.confirmed}.compact\n end",
"def empty?\n @json_data['family_members'].empty?\n end",
"def fellow_fans\n teams = self.teams\n users = User.all.find_all { |user|\n user.teams.any? { |team|\n teams.include?(team)\n }\n }\n users.select{|user| user != self}\n end",
"def friends\n @user ||= auth_user\n friends = ::User.search_users_in_circle(@user).results\n following_user_ids = ::Stores::Following.where(user_id: @user.id).collect(&:follower_user_id) # others following user\n followings = ::Stores::Following.where(follower_user_id: @user.id).includes(:user).order('last_traded_at desc, id desc') # user following others, already ordered newest to oldest\n followed_user_ids = Set.new # for excluding the non-followers\n both_side_followers = []\n one_side_followers = []\n bound = :circle\n user_ids_to_exclude = []\n auth_user.boundaries.group_by(&:type).each do|btype, blist|\n case btype\n when 'Users::ChildCircleOption'\n case blist.first.content_keyword\n when 'GRADE_ONLY'\n bound = :grade\n when 'CLASS_ONLY'\n bound = :class\n end\n when 'Users::UserBlock'\n user_ids_to_exclude = user_ids_to_exclude + ::Users::Boundary.extract_content_values_from_list(blist)\n end\n end\n followings.each do|following|\n user = following.user\n is_mutual = following_user_ids.include?(following.user_id) # y is also following user\n user.is_follower = true\n user.is_mutual_friend = is_mutual\n if is_mutual\n both_side_followers << user.as_more_json({}, auth_user.id)\n else\n if bound.eql? :circle and ::Schools::SchoolGroup.grades_around(auth_user.grade).include?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :grade and auth_user.grade.eql?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :class and auth_user.teacher.eql? user.teacher\n one_side_followers << user.as_more_json({}, auth_user.id)\n end\n end\n logger.debug \" | %20s | %1s | %10d\" % [user.user_name, is_mutual ? 'B' : 's', following.id]\n followed_user_ids << following.user_id\n end\n non_followers = friends.find_all {|friend| !followed_user_ids.include?(friend.id) }.sort{|x,y| y.id <=> x.id } # newest registered friends\n logger.debug \"-------- #{both_side_followers.size} both side, #{one_side_followers.size} one side, #{non_followers.size} non-followers\"\n @friends = both_side_followers + one_side_followers + non_followers.as_json\n #if they're blocked, remove them regardless.\n result = @friends.map do |friend|\n if not user_ids_to_exclude.include?(friend['id'])\n friend\n else\n nil\n end\n end\n result = result.compact\n respond_to do|format|\n format.json { render json:{ success: true, users: result} }\n format.html\n end\n end",
"def friends_suggestion(friends_of_friends = false)\n\t\t#sql query for the requested and accepted friendships ID's using the user id\n\t\tactive_ids = \"SELECT friend_pasive_id FROM relationships WHERE friend_active_id = :user_id AND accepted = true\"\n\t\t#sql query for the received and accepted friendships ID's using the user id\n\t\tpasive_ids = \"SELECT friend_active_id FROM relationships WHERE friend_pasive_id = :user_id AND accepted = true\"\n\t\t#not answered friendship request\n\t\tfriend_requests_ids = \"SELECT friend_active_id FROM relationships WHERE friend_pasive_id = :user_id AND accepted = false\"\n\t\t#sql query for the id's of the pasive friends from the user's id friends\n\t\tfriends_pasive_friends_ids =\"SELECT friend_pasive_id FROM relationships WHERE friend_active_id IN (#{active_ids}) OR friend_active_id IN (#{pasive_ids})\"\n\t\t#sql query for the id's of the active friends from the user's id friends\n\t\tfriends_active_friends_ids =\"SELECT friend_active_id FROM relationships WHERE friend_pasive_id IN (#{active_ids}) OR friend_pasive_id IN (#{pasive_ids})\"\t\t\n\t\t\n\t\tif friends_of_friends\n\t\t\tusers_query = \"NOT (id IN (#{active_ids}) OR id IN (#{pasive_ids})) AND (id IN (#{friends_pasive_friends_ids}) OR id IN (#{friends_active_friends_ids}) ) AND (id <> :user_id ) \"\n\t\t\t\n\t\telse\n\t\t\tusers_query = \"NOT (id IN (#{active_ids}) OR id IN (#{pasive_ids}) OR id IN (#{friend_requests_ids})) AND NOT (id IN (#{friends_pasive_friends_ids}) OR id IN (#{friends_active_friends_ids}) ) AND (id <> :user_id ) \"\n\t\t\n\t\tend\n\t\treturn User.where(\"#{users_query}\", user_id: self.id).distinct.includes( avatar_attachment: :blob)\n\tend",
"def pending_friends\n \tself.passive_relationships.where(status_flag: 0)\n end",
"def test_NoRestrictionsBeingMyOwnFriend\n this_user_found = false;\n user = User.new(\n :first_name=>'forest',\n :last_name=>'gump',\n :username=>'forest',\n :password=>\"gump123\",\n :email=>\"fgump@uiuc.edu\",\n :start_year=>'2009',\n :start_sem=>'FA',\n :birthday=>'1990-10-29',\n :college => College.find(:first),\n :major => Major.find(:first)\n )\n assert_nothing_raised { user.save! }\n user.friends.concat user\n user.friends.each do |eUser |\n if(eUser.id == user.id)\n this_user_found = true\n end\n end\n assert this_user_found\n end",
"def get_all_friends\n friends = []\n self.friends_ids.each do |id|\n unless Person.find_by_twitter_id(id).nil?\n friends << Person.find_by_twitter_id(id)\n end \n end\n return friends\n end",
"def friends_with?(other_user)\n friends.include?(other_user)\n end",
"def is_partial?\n not raw_user.include?('friends_count')\n end",
"def friends\n friend_ids = active_friendships.where(confirmed: true).pluck(:recipient_id) + passive_friendships.where(confirmed: true).pluck(:initiator_id)\n User.where(id: friend_ids)\n end",
"def only_followers\n followers.where.not(id: friends)\n end",
"def pending_friends\n inverse_friendships.map{ |fs| fs.user unless fs.accepted? }.compact\n end",
"def friends?(other_user)\n\t\tself.friends.include?(other_user)\n\tend",
"def all_friends\n requested_friends + accepted_friends\n end",
"def possible_friends\n ids = (friendships.map{ |fs| fs.friend_id } +\n inverse_friendships.map{ |fs| fs.user_id }).compact\n User.where.not(id: ids) - [self]\n end",
"def friends_with? popular_model\n friendships.where( friend: popular_model ).any?\n end",
"def possible_friends\n User.all - self.requesters - self.requestees-self.friends-User.where(id:self.id)\n end",
"def friend_suggestions\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n if self_node\n recommendations = self_node.both(:friends).order(\"breadth first\").uniqueness(\"node global\").filter(\"position.length() == 2;\").depth(2)\n all_recommendations = recommendations.map{|n| \n begin\n n.object_type.safe_constantize.find(n[:object_id])\n # n.object_type.safe_constantize.find(n[\"object_id\"])\n rescue Exception\n end\n }\n else\n false\n end\n end",
"def fetch_facebook_friends(facebook_user)\n #facebook_user.friends.collect(&:id).each do |friend_id|\n # unless self.facebook_friends.collect(&:facebook_id).include?(friend_id.to_s)\n # self.facebook_friends.create!(:facebook_id => friend_id)\n # end\n #end\n end",
"def friend?(user)\n friends.include?(user)\n end",
"def all_friends\n friends | inverse_friends \n end",
"def filter_friends\n inname = DATA_DIR.join('unpacked', 'all-friends-ids.csv')\n rows = open(inname, 'r'){|i| i.readlines }\n hsh = rows.inject(Hash.new{|h, k| h[k] = 0}) do |h, row|\n uname, friend_id = row.strip.split(',')\n h[friend_id] += 1\n h\n end\n\n fhsh = hsh.select{|k, v| v >= MIN_FRIEND_COUNT }\n end",
"def friend_with?(user)\n friends.include?(user)\n end",
"def pending_friends\n Relationship.find_all_by_friend_id_and_approved(self,false)\n end",
"def is_friend?\n @friended\n end",
"def friends\n friendships.where(accepted: true).map(&:friend)\n end",
"def get_friends\n if current_user.friends.count == 0\n\t return\n\t end\n\t if session[:selected_category] == \"all\"\n\t @friends = current_user.friends\n\t else\n category = Category.includes(:users).find(session[:selected_category])\n @friends = category.users.where(\"users.id IN (?)\", current_user.friends)\n end\n end",
"def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"def all_friends\n (friends.all + inverse_friends.all).uniq\n end",
"def is_friends_with?(friend)\n self.friends.include?(friend)\n end",
"def friends_only\n friends = @photo.author.friends\n\n unless @photo.author == current_user ||\n friends.include?(current_user)\n flash[:danger] = \"Friends Only!\"\n redirect_to root_path\n end\n end",
"def friends\n friendships = Friendship.where('(user_id = ? OR friend_id = ?) AND confirmed = ?', self.id, self.id, true)\n users = []\n friendships.each do |friendship|\n if friendship.user_id == self.id\n users.push User.find friendship.friend_id\n else\n users.push User.find friendship.user_id\n end\n end\n\n users\n end",
"def confirmed?\n\t\tUser.find(user_id).friends.include?(User.find(friend_id)) && User.find(friend_id).friends.include?(User.find(user_id)) \n\tend",
"def empty?\n find_users.empty?\n end",
"def found_friends(people)\n friends = []\n people.each do |person|\n if (person == \"Don\")\n friends << \"Don\"\n end\n if (person == \"John\")\n friends << \"John\"\n end\n if (person == \"Kent\")\n friends << \"Kent\"\n end\n end\n return friends\nend",
"def friend?\r\n infoxml = get_info\r\n \r\n if friend = infoxml['friend']\r\n return friend == '1'\r\n end\r\n \r\n return false\r\n end",
"def not_friends\n @requested = User.find(params[:friend_id])\n if current_user.friend?(@requested)\n flash[:success] = \"You're already friends!\"\n redirect_to @requested\n end\n end",
"def friend_of?(user)\n friends.include?(user)\n end",
"def friends\n active_friends + passive_friends\n end",
"def friends\n all_friends = [];\n self.friendships.each do |ship|\n if ship.status == 'approved'\n friend_id = get_friend_id_from_friendship(ship)\n friend = User.find(friend_id)\n all_friends << friend\n end\n end\n all_friends\n end",
"def friend? (login_users)\n # logger.debug2 \"login_users.class = #{login_users.class}\"\n return 8 unless [Array, ActiveRecord::Relation::ActiveRecord_Relation_User].index(login_users.class) # not logged in\n # logger.debug2 \"login_users.size = #{login_users.size}\"\n return 8 if login_users.size == 0 # not logged in\n return 8 if login_users.first.dummy_user?\n login_user = login_users.find { |user| user.provider == self.provider }\n return 8 unless login_user\n if !login_user.friends_hash\n logger.warn2 \"no friends cache was found for login user #{login_user.debug_info}\"\n return 8\n end\n return login_user.friends_hash[user_id] || 8\n end",
"def friend? (login_users)\n # logger.debug2 \"login_users.class = #{login_users.class}\"\n return 8 unless [Array, ActiveRecord::Relation::ActiveRecord_Relation_User].index(login_users.class) # not logged in\n # logger.debug2 \"login_users.size = #{login_users.size}\"\n return 8 if login_users.size == 0 # not logged in\n return 8 if login_users.first.dummy_user?\n login_user = login_users.find { |user| user.provider == self.provider }\n return 8 unless login_user\n if !login_user.friends_hash\n logger.warn2 \"no friends cache was found for login user #{login_user.debug_info}\"\n return 8\n end\n return login_user.friends_hash[user_id] || 8\n end",
"def fetch_facebook_friends\n\t\treturn fetch_facebook_friends_or_subscribers_or_subscribedto(\"friends\")\n\tend",
"def friendships_pending\n friendships_pending = []\n friendships.where(confirmed: false).each { |fs| friendships_pending << User.find(fs.friend_id) }\n friendships_pending\n end",
"def friend_requests\n @user_fr.inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"def friends\n Fql.query(\"SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=#{self.fb_id}) AND has_added_app = 1\")\n end",
"def friend(friends)\n friends.select do |friend|\n friend.length == 4\n end\nend",
"def check_if_already_friends\n unless Friendship.find_friendship(requester_id, requestee_id).nil?\n errors.add(:base, \"You are already friends with this user\")\n end\n end",
"def friends(fships = friendships_confirmed)\n users = Array.new\n fships.each{ |f| users += f.users.select { |u| u.id != self.id } }\n users\n end",
"def all_friends\n friends + inverse_friends\n end",
"def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end",
"def friend(friends)\n friends = [\"Ryan\", \"Kieran\", \"Jason\", \"Mark\"]\n friends.select {|friends| put friends if friends.length = 4}\nend",
"def is_friend\n friend_request_exists? && @friend.accepted?\n end",
"def worlize_friends\n User.where(:guid => self.worlize_friend_guids)\n end",
"def friends(cookie)\n Person.find_kassi_users_by_ids(get_friend_ids(cookie))\n end",
"def friends\n User.where(:guid => self.friend_guids)\n end",
"def user_already_friend(friend_id)\n @friend = Friendship.where('friend_id = ' + friend_id.to_s + \" AND user_id = \"+id.to_s)[0]\n return !@friend.blank?\n end",
"def total_friends\n self.invited(false).count + self.invited_by(false).count\n end",
"def all_friends\n Skype.find_users_of_type \"ALL_FRIENDS\"\n end",
"def friends\n @_friends ||=\n Rails.cache.fetch(\"accounts/#{self.id}/friends\", expires_in: Settings.cache.friends) do\n Set.new client.friend_ids\n end\n end",
"def all_friends\n return self.users\n end",
"def friends\n self.friended_users + self.users_friended_by\n end",
"def all_friends\n friends friendships\n end",
"def friend_candidates(for_channels)\n User.all.keep_if { |other|\n (for_channels == other.channel?) && # Select for channels or regular users\n User.public?(other.id) && # Exclude invisible users\n (other.channel? || (other.sign_in_count && (other.sign_in_count > 0))) && # Excluded unconfirmed invites\n (other.id != id) # Don't include this user\n }\n end",
"def friends\n friend_uids = []\n friend_uids = friend_uids + self.sent_friends.pluck(:reciever_uid)\n friend_uids = friend_uids + self.received_friends.pluck(:sender_uid)\n return User.where(:uid => friend_uids)\n end",
"def friend_request?(id)\n inverse_friendships.where(user_id: id).any?\n end",
"def friends\n # receivers = Friendship.where(:receiver_id => self.id).map(&:requester_id)\n # requesters = Friendship.where(:requester_id => self.id).map(&:receiver_id)\n # friends = receivers + requesters\n # User.where(:id => friends.uniq)\n friendship_ids = Friendship.where(\"receiver_id = :id or requester_id = :id\", id: id).pluck(:requester_id, :receiver_id).flatten.uniq\n # binding.pry\n User.except(id).where(:id => friendship_ids)\n # User.joins(:friendships).where(friendships: {:receiver_id => id})\n end",
"def fellow_cult_members\n friends = cults.map {|cult| cult.followers}.flatten.uniq\n friends.delete(self)\n friends\n end",
"def active_friends\n\t# friends I requested + friends that requested my friendship\n # map to get the exact list of friends\n\t self.friendships.where(state: \"active\").map(&:friend) + self.inverse_friendships.where(state: \"active\").map(&:user)\n end",
"def is_pending_friends_with?(friend)\n self.pending_friends.include?(friend)\n end"
] | [
"0.7859189",
"0.7844656",
"0.7781487",
"0.7568054",
"0.68728745",
"0.68686306",
"0.6855461",
"0.6831718",
"0.6800421",
"0.6783305",
"0.6769409",
"0.6767883",
"0.6767883",
"0.6694006",
"0.66837823",
"0.6677382",
"0.6677382",
"0.6631069",
"0.6629533",
"0.66094846",
"0.6600293",
"0.65921885",
"0.6577044",
"0.65610015",
"0.65327305",
"0.65313536",
"0.6516153",
"0.6512791",
"0.6490341",
"0.64701706",
"0.646269",
"0.6428414",
"0.64278734",
"0.64037263",
"0.63978857",
"0.6396705",
"0.63953197",
"0.639424",
"0.6392801",
"0.6386046",
"0.6380834",
"0.6348787",
"0.6342704",
"0.6342032",
"0.63283277",
"0.6321375",
"0.6320866",
"0.6318004",
"0.62921584",
"0.628173",
"0.62760335",
"0.6273105",
"0.62681085",
"0.62533844",
"0.625189",
"0.62509024",
"0.6250412",
"0.6250412",
"0.62467504",
"0.62438625",
"0.62424195",
"0.6235671",
"0.62344086",
"0.6230554",
"0.62207943",
"0.6215426",
"0.6213781",
"0.6212641",
"0.6211905",
"0.62050396",
"0.6204841",
"0.6204841",
"0.620373",
"0.62033385",
"0.61987275",
"0.6197532",
"0.6190522",
"0.6176648",
"0.6174284",
"0.61740416",
"0.6169154",
"0.6164653",
"0.616261",
"0.6161372",
"0.61606413",
"0.6156187",
"0.6154694",
"0.61494154",
"0.6146908",
"0.6145056",
"0.6138788",
"0.6131112",
"0.6113479",
"0.6110852",
"0.610817",
"0.61016035",
"0.6091339",
"0.60826963",
"0.6078398",
"0.6075164"
] | 0.7611207 | 3 |
INSANE Find the people who have the same favourite tv show | def same_tv_show(people)
people_and_their_shows = []
for person in people
people_and_their_shows.push({
person[:favourites][:tv_show]=> person[:name]
})
end
# The next line of code was made possible by glenn mcdonald's answer here:
# http://stackoverflow.com/questions/5490952/merge-array-of-hashes-to-get-hash-of-arrays-of-values?rq=1
merged_people_and_shows = people_and_their_shows.reduce({}) {|h,pairs| pairs.each {|k,v| (h[k] ||= []) << v}; h}
# binding.pry
merged_people_and_shows.each do |key, value|
# binding.pry
if value.length < 2
merged_people_and_shows.delete(key)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_favourite_tv_show(people)\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n result = []\n for index in same_show\n result.push(people[index][:name])\n end\n return result\nend",
"def same_tv_show(people)\n tv_shows = {}\n same_tv_shows = {}\n\n for person in people\n show = person[:favourites][:tv_show]\n if tv_shows[show] != nil\n tv_shows[show] << person[:name]\n else\n tv_shows[show] = [person[:name]]\n end\n end\n\n for show_name in tv_shows.keys\n if tv_shows[show_name].length > 1\n same_tv_shows[show_name] = tv_shows[show_name]\n end\n end\n return same_tv_shows\nend",
"def find_show_buddies(people)\n\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n p tv_shows\n end\n p tv_shows\n\n same_show = []\n count = 0\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n p same_show\n p count\n end\n count += 1\n end\n p same_show\n\n show_buddies = []\n for index in same_show\n show_buddies.push(people[index][:name])\n p show_buddies\n end\n p show_buddies\n\n return show_buddies\nend",
"def find_show_buddies(people)\n\n tv_shows = []\n\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n show_buddies = []\n\n for index in same_show\n show_buddies.push(people[index][:name])\n end\n\n return show_buddies\nend",
"def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end",
"def viewers(m, set=@trainingSet)\n (set.data.select {|item| item[@MOVIE_ID].to_i == m}).collect {|item| item[@USER_ID].to_i}\n end",
"def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end",
"def user_favorite_moves\n FavoriteMove.all.select do |fav|\n fav.user == self \n end \n end",
"def favourite_heroes()\n sql = \"\n SELECT DISTINCT h.id, h.name FROM players p\n INNER JOIN favourites f\n ON f.player_id = p.id\n INNER JOIN heroes h\n ON h.id = f.hero_id\n WHERE player_id = #{@id};\n \"\n return Hero.get_many( sql )\n end",
"def favorite_list\n favorite_list.unique\n end",
"def favorite(category, user)\n shows_by_category = user.shows.group_by({|show| show.send(category.downcase + \"_id\")})\n category_count = shows_by_category.each { |k,v| shows_by_category[k] = v.count}\n if category_count.empty?\n \"None.\"\n else\n Object.const_get(category).find(category_count.max_by{|k,v| v}[0]).name\n end\nend",
"def favorite(client)\n\tensemble = client.search(\"#bonjour_monde\", result_type: \"recent\").take(25)\n#\tensemble.each do |tweet|\n\t\tclient.favorite(ensemble)\n#\tend\nend",
"def get_recent_fav\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => 2).order('interests.created_at DESC').limit(5)\n return shows.all\n end",
"def fellow_fans\n teams = self.teams\n users = User.all.find_all { |user|\n user.teams.any? { |team|\n teams.include?(team)\n }\n }\n users.select{|user| user != self}\n end",
"def fans n = 0\n\t\tself.favorites.collect(&:person).reject { |p| p.hidden }\n\tend",
"def showings\n Showing.all.select do |showing|\n showing.theater == self\n end\n end",
"def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end",
"def find_matches \n @current_user = User.find(session[:user_id])\n @user = @current_user\n\n @title = \"Suggested matches for #{@current_user.name}\"\n\n # don't include the current user or existing matches in the possible matches \n @users = (User.all - [@current_user]) - @current_user.matches\n\n # associate each user with the number of shared interests they have with the current user\n users_shared_interests = {}\n @users.each do |user|\n users_shared_interests[user.id] = @current_user.shared_interests(user).size\n end\n\n\n suggested_matches = []\n users_shared_interests.sort_by { |user, count| count }.each do |date|\n suggested_matches << date.first\n end\n suggested_matches = suggested_matches.last(10).shuffle.first(3)\n\n @suggested_matches = []\n suggested_matches.each {|sm| @suggested_matches << User.find(sm) }\n end",
"def favorite_players(fan)\n Fan.find_by(name: fan).players\nend",
"def watching_episodes\n shows = ::TvShow.watching\n @episodes = episodes.each_with_object([]) do |episode, object|\n show = shows.find{|sh| sh.imdb_id == episode.show.ids.imdb}\n next if show.blank?\n object << episode\n end.uniq{|episode| episode.show.title}\n self\n end",
"def likes\n people = []\n query = Activity.joins { verb }.where { activity_object_id.eq(my { id }) }\n\n activities_likes = query.where { verb.name.eq('like') }\n activities_likes.each do |activity|\n people.push activity.actor\n end\n\n activities_unlikes = query.where { verb.name.eq('unlike') }\n activities_unlikes.each do |activity|\n people.delete_at people.index(activity.actor)\n end\n\n people\n end",
"def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend",
"def show\n\n @favoritepet_exists = Favoritepet.where(petprofile: @petprofile, user: current_user) == [] ? false : true\n end",
"def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend",
"def has_favorite?(vanue_or_venue_id)\n v_id = (vanue_or_venue_id.kind_of?(Venue)) ? vanue_or_venue_id.id : vanue_or_venue_id\n self.favorites.select {|f| f.favorite_id == v_id }.size > 0\n end",
"def person_cheers_song(pl, favourite_song)\n \n for tune in pl\n if tune == favourite_song\n return \"yaaay!\"\n else \n return \"didn't find my favourite\" \n end \n end \n end",
"def expiring_providers(expiring_favorites)\n providers = []\n expiring_shows = expiring_favorites.map {|favorite| favorite.show}\n shows_by_provider.each do |provider, show_array|\n shows_in_common = show_array.select do |show|\n expiring_shows.include?(show)\n end\n if !shows_in_common.empty?\n providers << provider \n end \n end \n providers\n end",
"def on_the_big_screen\n movie_list = Movie.list_movies\n Show.all.select { |show| movie_list.include?(show.name) }\n end",
"def favorite\n\t\t@venues = []\n\n\t\tuser = User.find(current_user.id)\n\t\tuser_fav = user.favorite_venue_ids\n\t\t\tuser_fav.each do |venue_id|\n\t\t\t\tvenue = Venue.find(venue_id)\n\t\t\t\t@venues << venue\n\t\t\tend\n\n\tend",
"def guess_gifts(wishlist, presents)\n\n wishlist.map do |w|\n w[:name] if presents.include? w.reject { |key| key == :name }\n end.compact.uniq\n\nend",
"def popular\n act = self.listings.map {|l| l.activity_id}\n activities = act.map {|a| Activity.find(a)}\n counts = Hash.new 0\n act.each do |id|\n counts[id] += 1\n end\n popular = 0\n appearances = 0\n counts.each do |id, value|\n if value > appearances \n appearances = value\n popular = id\n end\n end\n Activity.find(popular)\n end",
"def find\n @fruits = params[:fruits].split(',')\n @veggies = params[:veggies].split(',')\n\n\n @herbs = [ ]\n @fruits.each do |fruit|\n @herbs += Herb.where(\"companions like ?\", \"%#{fruit}%\")\n end\n\n @veggies.each do |veggie|\n @herbs += Herb.where(\"companions like ?\", \"%#{veggie}%\")\n end\n\n\n @herbs.uniq!\n\n render json: @herbs\n\n # ***WHAT IF THERE ARE NO MATCHES?\n\n end",
"def fellow_cult_members\n fellow_followers = []\n\n Bloodoath.all.each do |bloodoath|\n self.my_cults.each do |cult_ele|\n if bloodoath.cult == cult_ele && bloodoath.follower != self\n fellow_followers << bloodoath.follower\n end\n end\n end\n fellow_followers.uniq\n end",
"def tv_show(person)\n tv_show = person[:favourites][:tv_show]\n return tv_show\nend",
"def favorite_for(user)\n favs.find_by(user_id: user)\n end",
"def get_info_on_club(fixture)\n puts \"See when your favourites are playing:(enter favourite club name)\"\n fav_club = gets.chomp\n all_fav_matches = fixture.map do |game|\n if game[:home_team].downcase.include?(fav_club) || game[:away_team].downcase.include?(fav_club)\n game\n end\n end.compact\n\n if all_fav_matches.empty?\n puts \"Did not match the database!\"\n else\n puts all_fav_matches\n end\nend",
"def match\n users_that_match = []\n User.collect_users_and_interests.each do |user, interests_array|\n total_match = count_common_interests(interests_array, self)\n if (is_a_match(total_match) == true) && (user.id != self.id) && (user.location_id == self.location_id)\n users_that_match << user\n end\n end\n users_that_match\n end",
"def favorite_check user, img\n user.favorites.each do |fav|\n if fav.image_id == img.id\n return true\n end\n end\n\n return false\n end",
"def find_common_movies(user1,user2)\n @cache_2 = reviews_hash[user2.to_i].transpose\n @cache_1 = reviews_hash[user1.to_i].transpose\n return cache_1[0] & cache_2[0]\n end",
"def is_watching\n faved_favorites = favorites.streams\n profile_ids = faved_favorites.collect { |favorite| favorite.favable.profile_id }.uniq\n watches = []\n profile_ids.each do |profile_id|\n fave = faved_favorites.find { |favorite| profile_id == favorite.favable.profile_id }\n watches << Watch.new(profile: fave.profile, created_at: fave.created_at, watched_profile: fave.favable.profile)\n end\n return watches\n end",
"def show\n @favorite_exists = Favorite.where(post: @post, user: current_user) == [] ? false : true\n\n end",
"def viewers(m)\n\t\tviewer_list = []\n\t\ttraining_set.each do |row|\n\t\t\tif row[\"movie_id\"] == m\n\t\t\t\tviewer_list.push({\"user_id\"=>row[\"user_id\"],\"rating\"=>row[\"rating\"]})\n\t\t\tend\n\t\tend\n\t\treturn viewer_list\n\tend",
"def favorited\r\n Favorite.find(:all, :conditions => {:favorable_type => self.class.to_s, :favorable_id => self.id})\r\n end",
"def test_favourite_tv_show\n result = favourite_tv_show(@person5)\n assert_equal(\"Scrubs\", result)\n end",
"def favorite_check\n @check = @fav_list.include?(@selected_activity.last)\n \n end",
"def favourite_for(user)\n favourites.find_by_user_id user\n end",
"def list_fav\r\n users = User.all \r\n users.each do |user|\r\n puts \"#{user}\"\r\n user.snacks.each do |snack|\r\n puts \"- #{snack}\"\r\n end\r\n end\r\nend",
"def favorites\n @favorites ||= Favorite.by_tweet_id.key(id)\n end",
"def one_week_wonders(songs)\n uniq_songs = songs.uniq\n uniq_songs.select do |song|\n no_repeats?(song, songs)\n end\nend",
"def showtimes(movie)\n self.showings.select do |showing|\n showing.movie == movie\n end\n end",
"def find\n @veggies = params[:veggies].split(',')\n\n\n @fruits = [ ]\n @veggies.each do |veggie|\n @fruits += Fruit.where(\"companions like ?\", \"%#{veggie}%\")\n end\n\n @fruits.uniq!\n\n render json: @fruits\n # ***WHAT IF THERE ARE NO MATCHES?****\n\n\n end",
"def photographs_taken_by_artist_from(country)\n photos_by_country = []\n @photographs.each do |photo|\n @artists.each do |artist|\n if photo[:artist_id] == artist[:id] && artist[:country] == country\n photos_by_country << photo\n end\n end\n end\n photos_by_country\n end",
"def favorite_artworks\n artworks.where(favorite: true)\n end",
"def all_fav_foods(people)\n fav_foods = []\n for person in people\n fav_foods.concat(person[:favourites][:things_to_eat])\nend\nreturn fav_foods\nend",
"def photographs_taken_by_artist_from(country)\n artists_match_country = @artists.find_all do |artist|\n artist.country == country\n end\n photos = []\n @photographs.each do |photo|\n artists_match_country.each do |artist|\n if photo.artist_id == artist.id\n photos << photo\n end\n end\n end\n photos\n end",
"def photographs_taken_by_artists_from(country)\n country_by_artist = @artists.find_all do |artist|\n artists.first[:country] == country\n end\n @photographs.find_all do |photos|\n photos[:id] == country_by_artist[:id]\n end\n # require 'pry'; binding.pry\n end",
"def test_favourite_tv_show\n result = person_favourite_tv_show(@person5)\n assert_equal(\"Scrubs\",result)\n end",
"def has_faved?(favable)\n if favable.is_a?(Journal)\n return favorites.journals.pluck(:favable_id).include?(favable.id)\n elsif favable.is_a?(Submission)\n return favorites.submissions.pluck(:favable_id).include?(favable.id)\n elsif favable.is_a?(Stream)\n return favorites.streams.pluck(:favable_id).include?(favable.id)\n end\n end",
"def favoring?(article)\n favorites.include?(article)\n end",
"def wishlisted\n wishlisted = self.visits.select { |visit| visit.visited == false }\n wishlisted.map { |museum| museum.user }\n end",
"def tv_show(person)\n return person[:favourites][:tv_show]\nend",
"def favorited_by?(user)\n Favorite.where('object_id = ? AND object_type = ? AND user_id = ?', self.id, self.class.to_s, user.id).count > 0\n end",
"def favorited?(user, coffeeshop)\n coffeeshop.users.each do |coffeeshop_user|\n return true if coffeeshop_user == user\n end\n return false\n end",
"def movies(user)\n movies_he_watched = []\n @training_set.each do |record|\n if record.user == user.to_i\n movies_he_watched.push(record.movie)\n end\n end\n return movies_he_watched\n end",
"def recommend\n recs = []\n User.all.each do |user|\n if user.hotspots.include?(self)\n user.hotspots.each do |hs|\n recs << hs\n end#user.hotspots end\n end#if include? end\n return recs.uniq\n end#users.each end\n end",
"def show\n episodes = @trainee.episodes\n @apprenticeships = Hash.new\n sched = episodes.reject(&:past?)\n happened = (episodes - sched)\n .reject {|e| e.shadowed == false}\n .sort_by(&:beginning)\n @apprenticeships[:stage_two_training] = happened.empty? ? [] : [happened.shift]\n @apprenticeships[:freeform_apprenticeships] = happened\n .select{ |ep| ep.show.is_a? FreeformShow }\n @apprenticeships[:specialty_apprenticeships] = happened.select{ |ep| ep.show.is_a? SpecialtyShow }\n @apprenticeships[:scheduled_apprenticeships] = sched # this is last for order in the view\n end",
"def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend",
"def most_similar(u_id,m_id=nil,count=25) \n #get all users watched movie m_id\n users=data.viewers(m_id) - [u_id]\n result=users.map {|u2| [u2,similarity(u_id,u2)]}.sort_by! { |x| -x[1]}\n count.nil? ? result : result.take(count)\n end",
"def similar artist\n url = \"http://developer.echonest.com/api/v4/artist/similar?api_key=#{ECHONEST_API_KEY}&bucket=years_active&name=#{artist}&format=json&start=0&results=#{RESULTS}\"\n parseURL url\n #also get their hotness?\nend",
"def visitors\n visited = self.visits.select { |visit| visit.visited == true }\n visited.map { |museum| museum.user }\n end",
"def one_week_wonders(songs)\n songs.select{ |song| no_repeats?(song, songs)}.uniq\nend",
"def similar_movie\n apikey = ENV['MOVIE_API_KEY']\n\n # pick random sample from list of liked movies\n seed = self.movies_liked.sample\n \n # collect movie JSON object of similar movies list\n similar_url = \"http://api.rottentomatoes.com/api/public/v1.0/movies/#{seed}/similar.json?limit=5&apikey=#{apikey}\"\n response = HTTParty.get(similar_url)\n json = JSON.parse(response.body)\n\n if json[\"movies\"].nil?\n #if the movies part of json is nil, return nil\n nil\n else\n # this function returns the first movie object whose id is neither not already in either the liked or disliked lists\n # it automatically returns 'nil' is no unique movie is found\n json[\"movies\"].detect { |m|\n !(self.movies_liked.include?(m[\"id\"])) and !(self.movies_disliked.include?(m[\"id\"]))\n }\n end\n\n end",
"def get_favorites\n @user = User.find(self.id)\n return Shop.where(id: \n { :$in => @user.favorite_places })\n .each { |shop| pp \"#{shop.picture}, #{shop.name}, #{shop.email}, #{shop.city}, #{shop.location}\"}\n end",
"def fav_tv_show(person)\n return person[:favourites][:tv_show]\nend",
"def one_week_wonders(songs)\n songs.uniq.select {|song|no_repeats?(song,songs)}\n\nend",
"def matches\n #puts(@@instance_collector.inspect)\n hobby_collection = []\n @@instance_collector.each{ |other_person|\n if !(other_person.equal?self)\n hobby_collection.push(other_person.match_hobbies(self).insert(0 , other_person.name + \": \"))\n end\n }\n\n hobby_collection.sort_by{ |entry| entry.length }.reverse!\n \n end",
"def movies_in_common(user1_id, user2_id)\n @movies.select { |_, movie| movie.user_rated?(user1_id, user2_id) }.values\n end",
"def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend",
"def my_followers\n cult_blood_oaths = BloodOath.all.select {|b_o_instance| b_o_instance.cult == self}\n cult_followers = cult_blood_oaths.map {|b_o_instance| b_o_instance.follower}\n cult_followers.uniq\n end",
"def show\n @favorites = Favorite.all\n end",
"def one_week_wonders(songs)\n songs.uniq.select { |song| no_repeats?(song, songs) }\nend",
"def one_week_wonders(songs)\n songs.uniq.select { |song| no_repeats?(song, songs) }\nend",
"def favorite?(movie)\n favorite = favorites.find_by(movie_id: movie.id)\n if favorite.nil?\n return false\n else\n return true\n end\n #favorites.include?(movie)\n end",
"def fellow_cult_members\n friends = cults.map {|cult| cult.followers}.flatten.uniq\n friends.delete(self)\n friends\n end",
"def artists_with_multiple_photographs\n artists = []\n @artists.each do |artist|\n @photographs.each do |photo|\n if artist[:id] == photo[:artist_id]\n artists << artist\n end\n end\n end\n artists\n end",
"def my_friends\n (invited_friends + asked_friendships).compact.uniq\n end",
"def viewers m\n \tusers = @userdata.keys\n \tmovie_viewers = []\n \tusers.each do |user|\n \t\tif rating(user, m) != 0\n \t\t\tmovie_viewers.push(user)\n \t\tend\n\n \tend\n \treturn movie_viewers\n end",
"def expiring_favorites(month, day)\n favorite_hash = self.favorites_by_month.select do |favorite, month_array|\n Favorite.month_to_number(month_array.last) == month \n end\n favorite_hash.keys\n end",
"def has_fav?(game_id)\n\t FavouriteGame.where(:user_id => self.id, :game_id => game_id).empty?\n end",
"def tv_show(hash)\n return hash[:favourites][:tv_show]\nend",
"def similarity(user1, user2)\n similar_movies_avg = []\n\n #fill in user1_data and user2_data\n #find similar watched movies, remove differences in both lists\n $unique_user_data[user1.to_i - 1].each_key {|movieId, rating|\n if $unique_user_data[user2.to_i - 1].has_key?(movieId)\n similar_movies_avg.push((rating.to_i - $unique_user_data[user2.to_i - 1][movieId].to_i).abs)\n end\n }\n #find average\n return similar_movies_avg.inject{ |sum, el| sum + el }.to_f / similar_movies_avg.size\n end",
"def is_extinct_animal(animal)\n extinct_animals = {\n \"Tasmanian Tiger\" => 1936,\n \"Eastern Hare Wallaby\" => 1890,\n \"Dodo\" => 1662,\n \"Pyrenean Ibex\" => 2000,\n \"Passenger Pigeon\" => 1914,\n \"West African Black Rhinoceros\" => 2011,\n \"Laysan Crake\" => 1923\n }\n in_list = false\n extinct_animal_names = []\n\n extinct_animals.each do | extinct_animal, year |\n extinct_animal_names << extinct_animal\n end\n\n i = 0\n while i < extinct_animal_names.length\n if animal == extinct_animal_names[i]\n in_list = true\n i = extinct_animal_names.length\n else\n i += 1\n end\n end\n\n puts \"#{animal} is included in the extinct_animals.\" if in_list == true\n puts \"#{animal} is not included in the extinct_animals.\" if in_list == false\nend",
"def favorite_a_show(show_id)\n previous_clicks = Interest.where('user_id' => self.id,\n 'show_id' => show_id).all\n #Favoriting a show is most important, so update old connection\n if (previous_clicks != [])\n for elt in previous_clicks\n elt.click = 2\n elt.save\n end\n else\n fav = Interest.new(:show_id => show_id, :user_id => self.id, :click => 2)\n fav.save\n end\n end",
"def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend",
"def favorite_track_ids\n\n # Recompute them if not present or out of date\n Smoothie::PlaylistSyncer.new('id' => @user.id).async_run\n\n # Cache and return them\n @favorite_track_ids ||= @user.track_ids.members \n end",
"def all_on(very_nice_person)\n @members_tabs.each do |member_name, each_pre_tax|\n if member_name == very_nice_person\n @members_share[member_name] = 1\n else\n @members_share[member_name] = 0\n end\n end\n @split = :yes\n return @members_share\n end",
"def tweets\n # cannot write this yet because I can't even test it\n # 1. they keep track of their tweets => []\n # 2. they figure it out\n Tweet.all.select do |tweet| # Tweet instance\n # I am the user asking for my tweets\n # I want to know which tweets are ME (I, my, myself, self)\n tweet.user == self\n # comapre it to the information being held in the tweet\n # specifically, the reference they are holding\n end\n\n # so efficiency => don't think about it\n # refactor, indexes\n end",
"def display\n @employer = Employer.find(params[:id])\n qry = Opening.find_by_sql([\n \"SELECT employers.id FROM employers\n LEFT OUTER JOIN favoriteds ON favoriteds.employer_id = employers.id\n WHERE favoriteds.member_id = ?\",\n current_user.role_id\n ])\n @selected_favoriteds = qry.collect(&:id)\n end",
"def visible_families\n # right now the count is the number of species\n TaxonName.find_by_sql(\n \"SELECT p.*, count(*) as count FROM \n (SELECT * FROM taxon_names t WHERE t.iczn_group = 'family' AND RIGHT(t.name,4) = 'idae') AS p\n LEFT JOIN \n (SELECT id, l, r FROM taxon_names t2 WHERE #{self.sql_for_taxon_names('t2', :public)} AND iczn_group = 'species') AS c \n ON p.l < c.l AND p.r > c.r\n WHERE c.id IS NOT NULL \n GROUP BY p.id ORDER BY name\") \n end",
"def show\n @userID = (current_user.blank?) ? 0 : current_user.id\n @isUserFavourite = Favourite.where(user_id: @userID, movie_id: @movie.id).count > 0 ? true : false\n end"
] | [
"0.7872839",
"0.7553552",
"0.73653543",
"0.73603415",
"0.63575584",
"0.6047088",
"0.6034171",
"0.6013636",
"0.5986206",
"0.5981018",
"0.59420466",
"0.5892891",
"0.5871625",
"0.58704853",
"0.58329",
"0.580362",
"0.57606626",
"0.5753612",
"0.5713719",
"0.56944746",
"0.56551397",
"0.5642656",
"0.5620058",
"0.55998856",
"0.5580745",
"0.55804265",
"0.5580086",
"0.5561785",
"0.5556264",
"0.55470705",
"0.5541058",
"0.55346835",
"0.5528813",
"0.551481",
"0.550181",
"0.55005854",
"0.54826164",
"0.5481889",
"0.5472892",
"0.5464483",
"0.5463057",
"0.5462685",
"0.54608005",
"0.5457899",
"0.5455139",
"0.5434535",
"0.542883",
"0.54201835",
"0.54192704",
"0.5414126",
"0.5412",
"0.5410176",
"0.5407962",
"0.5403452",
"0.54032075",
"0.53995365",
"0.53981715",
"0.5394167",
"0.53886855",
"0.5385135",
"0.5376775",
"0.53750515",
"0.53709614",
"0.53709066",
"0.5370218",
"0.53695303",
"0.5368863",
"0.5367687",
"0.5360234",
"0.53539276",
"0.53451216",
"0.5343493",
"0.5339529",
"0.53246737",
"0.5312727",
"0.530822",
"0.5298298",
"0.5297133",
"0.5292742",
"0.5292106",
"0.52917373",
"0.52917373",
"0.5283367",
"0.5281018",
"0.5268755",
"0.5265278",
"0.5262677",
"0.5258112",
"0.5255002",
"0.5251855",
"0.5250509",
"0.5250102",
"0.5249638",
"0.52482295",
"0.5245031",
"0.5241769",
"0.52414614",
"0.52384335",
"0.5231551",
"0.5228941"
] | 0.6425702 | 4 |
def bin_decision_backup(past_yield, desired_yield) if(past_yield <= desired_yield) bin = 1 else bin = rand(2..10) end return bin end | def bin_decision(threshold)
tmp = rand(1..100)
if(tmp <= threshold)
bin = 1
else
bin = rand(2..10)
end
return bin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand_gen\n rand100 = rand(1..100)\n if (0..50).cover?(rand100)\n output_val = 1\n elsif (51..75).cover?(rand100)\n output_val = 2\n elsif (76..90).cover?(rand100)\n output_val = 3\n elsif (91..95).cover?(rand100)\n output_val = 4\n elsif (96..100).cover?(rand100)\n output_val = 5\n end\n handle_output(output_val)\n end",
"def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend",
"def gen\n (x=rand)>0.5 ? x : (x < rand/2.0) ? 1.0 - x : x\nend",
"def should_invent?\n rand(100) < @probability * 100\n end",
"def rand\n num = SecureRandom.random_number(@n)\n @bins.each do |k, freq|\n num -= freq\n return k if num < 0\n end\n end",
"def pbRockSmashRandomEncounter\n if rand(100)<25\n pbEncounter(EncounterTypes::RockSmash)\n end\nend",
"def probability\n rand(1..100)\n end",
"def chance(c)\n return rand < c\nend",
"def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend",
"def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend",
"def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend",
"def random_fibonacci\r\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\r\nend",
"def binsearch arr, target\n return if arr.blank?\n low = 0\n high = arr.count\n loop do\n choice = (low + high) / 2\n bin_lower = arr[choice]\n bin_lower = yield(bin_lower) if block_given?\n bin_upper = arr[choice + 1]\n bin_upper = yield(bin_upper) if bin_upper and block_given?\n if target >= bin_lower\n return choice if !bin_upper || (bin_upper > target)\n # puts \"Rejected #{arr[choice]}->#{arr[choice+1]}: too low\"\n low = choice + 1\n else\n # puts \"Rejected #{arr[choice]}->#{arr[choice+1]}: too high\"\n return nil if high == choice\n high = choice\n end\n end\nend",
"def generate_harder_value(rnd_obj, _)\n # generate from the top 70% upwards\n min, max = fetch_min_max_values\n diff = max-min\n top_seventy_percent = 0.7 * diff\n @value = rnd_obj.rand(Integer(top_seventy_percent)..max)\n end",
"def generate_fake_binary_sequence\n s = \"\"\n 1500.times{|i| s << kernel.rand(1) }\n s\n end",
"def random_fibonacci\n [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946].sample\nend",
"def gen_num\n rand(1..100)\nend",
"def bi_rand(v)\n rand(2) > 1 ? v : nil\n end",
"def sample(value)\n (@bins[value] || 0).to_f / @n.to_f\n end",
"def biased_random_number(prob_arr)\n # http://stackoverflow.com/questions/479236/how-do-i-simulate-biased-die-in-python\n rand_roll = rand()\n sum = 0 \n result = 0\n prob_arr.each do |i|\n sum += i\n if rand_roll < sum\n return result\n end\n result += 1\n end\n # puts \"prob_arry:\" + prob_arr.to_s\n # puts \"rand_roll: \" + rand_roll.to_s\n # puts prob_arr.join(\" \")\n return result - 1\n end",
"def getBin\n case @binDataType\n when 'B'\n bin = Bin.new('information', BytesValue.new(randString(@binDataSize)))\n when 'S'\n bin = Bin.new('information', StringValue.new(randString(@binDataSize)))\n else\n bin = Bin.new('information', IntegerValue.new(2**63))\n end\n\n bin\nend",
"def create_random_bignum(bits, range = nil)\n if range.nil?\n middle = (1..bits-3).map{rand()>0.5 ? '1':'0'}.join\n else\n middle = (range).map { rand()>0.5 ? '1':'0' }.join\n end\n str = \"11\" + middle + \"1\"\n str.to_i(2)\nend",
"def with_prob probability, action = \"\"\n if rand < probability\n if block_given?\n yield\n else\n act action\n end\n true\n else\n false\n end\n end",
"def fake_bin(s)\n nums = s.split('')\n outcome = nums.map do |num|\n if num.to_i >= 5\n num = 1\n else\n num = 0\n end\n end\n outcome.join()\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def compute_damage\n \treturn rand(1..6)\n end",
"def compute_damage\n return rand(1..6)\n end",
"def compute_damage\n return rand(1..6)\n end",
"def pick\n float = BigDecimal.new(@rnd.uniform.to_s)\n from = to = BigDecimal.new(\"0.0\")\n value = nil\n @distribution.each do |value, probabillity|\n to += probabillity\n if float >= from && float < to\n return value\n end\n from = to\n end\n\n throw \"probabillity sum not 1.0, was #{to} for #{@distribution}\" if to < 0.999\n return value\n end",
"def compute_damage\r\n return rand(1..6)\r\n end",
"def compute_damage\n rand(1..6)\n end",
"def subset(gen, zerosbst)\n main = case (zerosbst)\n when zerosbst == true\n rslt = ui_pow(2, gen) - 1\n return rslt\n when zerosbst == false\n rslt = ui_pow(2, gen)\n return rslt\n end\n return main\nend",
"def biased_random(n)\n # For the time being, we make the bias hard-coded. Maybe it could\n # become a user property one day.\n # The bias is represented by a constant bias_prob, which is a number\n # greater than 0 and less than 100 (think of it as probability given\n # as a percentage value). bias_prob > 50 gives preference\n # to lower numbers (which is what we want to have), and the larger\n # it is, the stronger is the preference for lower numbers. For\n # bias_prob == 50, all numbers in the range would have, in theory,\n # equal chance, but due to the sloppy implementation of this function,\n # this is only correct if n is a power of 2.\n bias_prob=75\n low=0\n high=n-1\n # A recursive solution would be most elegant, but we have no control\n # over the size of n.\n while low<high\n split = (high+low) / 2 # rounded down!\n if rand(100) < bias_prob\n high=split\n else\n low=split\n end\n end\n low\n end",
"def randbinary(problem)\n s = \"\"; 1500.times{|i| s << rand(2).to_s }; s\n end",
"def my_bet\n case @play\n when 1 then return @min_bet\n when 2 then \n if @stack > 10 * @min_bet\n @min_bet\n end\n when 3 then\n if @stack > 5 * @min_bet\n @min_bet\n end\n when 4 then @min_bet + ((1/2) * @min_bet)\n when 5 then @min_bet + ( 2 * @min_bet)\n when 6 then @stack\n end\n end",
"def compute_damage\n return rand(1..6)\n end",
"def generator_rand(max)\n return nil if max < 0\n\n result = rand(max + 1)\n result\n end",
"def generate_random_number_except_55\n x=rand(100)\n throw :finish if x==55\nend",
"def add_wrong(high_bit, input_array)\n\tnum = (2..high_bit).to_a.sample # rand(2..high_bit)\n\tuntil good_wrong?(num, input_array)\n\t\tnum = (2..high_bit).to_a.sample #rand(2..high_bit)\n\tend\n\treturn num\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend",
"def compute_damage\n return rand(1..6)\n end",
"def bid\n return starting_bid unless prev_bid\n if prev_bid.total >= all_dice_count/(2*expected_prob) && prev_bid.total > dice_count_of_bid\n puts comment\n LiarsDice::BS.new\n elsif prev_bid.total < magic_number && magic_number < all_dice_count\n LiarsDice::Bid.new(magic_number, prev_bid.face_value)\n else\n if prev_bid.face_value == 6 && (prev_bid.total+1) < all_dice_count/(2*expected_prob)\n LiarsDice::Bid.new(prev_bid.total+1, most_bid)\n elsif prev_bid.face_value < 6 && (prev_bid.total+1) < all_dice_count/(2*expected_prob)\n LiarsDice::Bid.new(prev_bid.total, prev_bid.face_value+1)\n else\n LiarsDice::BS.new\n end\n end\n end",
"def prompt(current_bet)\n action = [false, current_bet, current_bet+7].sample\n if !action\n @folded = true\n elsif action == current_bet\n @bet = action\n elsif action > current_bet\n @bet = action\n raised = true\n end\n action\n end",
"def generateFirepower()\n return (rand(2.0..4.0))\nend",
"def spin \n accumulator, prn = 0, rand\n\n @normalized.each_pair do |chromosome, probability| \n if prn <= probability + accumulator\n @logger.debug \"Choosing #{chromosome} with probability #{probability}\"\n return chromosome \n end\n\n accumulator += probability\n end\n end",
"def rand(max)\n max-1\nend",
"def generateBrilliant\r\n @brilliant = true\r\n # 2- 6 max IVs\r\n maxIVs = @iv.keys.sample(2 + (rand(@iv.keys.length) - 2))\r\n maxIVs.each { |s| @iv[s] = Pokemon::IV_STAT_LIMIT }\r\n # Higher Avg Level\r\n @level += (2 + rand(5))\r\n # Knows Egg Move\r\n babyspecies = species_data.get_baby_species\r\n eggmoves = GameData::Species.get_species_form(babyspecies,form_simple).egg_moves\r\n move = eggmoves.sample\r\n learn_move(move); add_first_move(move)\r\n # Has a chance to be shiny\r\n shinyBoost = $Trainer.pokedex.number_battled_brilliant_shiny(@species)\r\n random = rand(65536)\r\n shinyChance = Settings::SHINY_POKEMON_CHANCE * shinyBoost\r\n echoln \"#{random}, #{shinyChance}\"\r\n if random < shinyChance\r\n @shiny = true\r\n self.square_shiny = true if random < (shinyChance/16)\r\n end\r\n end",
"def operand\n rand(1..20)\n end",
"def generate_secret_number(range_array)\n\t\trange_array.sample\n\tend",
"def flip_coin # This block of code, from def to end, is the method definition\n coin = ['heads', 'tails']\n return coin.sample\nend",
"def nostalgia; return rand end",
"def initialize\n @number = rand(0..100)\n @answer = false\n end",
"def generate_one_random_number()\r\n @l = @total_no_of_bits + 1\r\n bit_string = @total_sequence.join('')\r\n numerator = bit_string.to_i(2)\r\n random_number = numerator *1.0 / 2**@l\r\n\r\n return random_number\r\n end",
"def binary_tournament(population)\n i = rand(population.size)\n j = rand(population.size - 1)\n j += 1 if j >= i\n\n select_fittest(population[i], population[j])\n end",
"def initialize\n @@count += 1\n @id = @@count\n @awake_percentage = rand(1..100) #range makes random number include first and last number\n end",
"def binary(digits: 4)\n bin = ''\n digits.times { bin += rand(2).to_s(2) }\n bin\n end",
"def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"def whaXen(bottom, range, vol, channel)\n playXen(Pitches[bottom], vol.volume, @t.w, channel)\n hesitate\n (3..@its+3).each do |i|\n hesitated?\n r = rand(range)\n if r == 0 or r > Pitches.size\n if brnd\n sleep @t.q\n elsif brnd\n playXen(Pitches[bottom + rand(range)], vol.walk!, @t.q, channel)\n else\n playXen(Pitches[bottom], vol.walk!, @t.q, channel)\n end\n else\n playXen(Pitches[bottom+r], vol.walk!, @t.q, channel)\n end\n end\n playXen(Pitches[bottom], vol.volume, @t.w, channel)\n hesitate\n end",
"def random(range)\n return rand(range + 1)\nend",
"def fake_bin(s)\ns = s.split(\"\")\ns = s.map {|x| x.to_i }\ns.collect! {|e| (e<5) ? 0 : e || (e>5) ? 1 : e}\ns.join\nend",
"def generate_B xverifier\n v = xverifier.to_i(16)\n @b ||= random_bignum\n @B = SRP.calc_B(@b, @k, v, @N, @g.hex).to_hex_string\n end",
"def pick(target)\n res = count = 0\n @N.each_with_index do |n, i|\n next unless n == target\n\n count += 1\n res = i if rand(1..10**9) % count == 0\n end\n res\n end",
"def create_random_prime(bits,range = nil)\n while true\n val = create_random_bignum(bits, range)\n return val if val.prime?\n end\nend",
"def generate_B xverifier\n v = xverifier.to_i(16)\n @b ||= random_bignum\n @B = \"%x\" % SRP.calc_B(@b, k, v, @N, @g)\n end",
"def number_generator\n rand(1..20)\n end",
"def available_balance(cur)\n 1000\n end",
"def belllcurve(y)\n x = 0\n y.times do\n x += rand(0..1)\n end\n x\nend",
"def belllcurve(y)\n x = 0\n y.times do\n x += rand(0..1)\n end\n x\nend",
"def roll_if_value_is_nil\n self.value = (rand(6) + 1) if not self.value\n end",
"def random_status_number_generator\n Random.rand(1..10)\n end",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 100\r\n return randomNo = 1 + rand($maxChallengeRange)\r\n \r\n end",
"def age\n n = rand(55..120)\nend",
"def generate(total = 500, max = 999)\n Array.new(total) { rand(0...max) }\nend",
"def flip(chance = 0.5)\n rand < chance\n end",
"def roll\n rand(1...7)\nend",
"def random_gen(num, gain = 1)\n r = Random.new\n nums = []\n num.times do \n nums << r.rand * gain\n end\n return nums\nend",
"def get_wheel_reward\r\n\t\t\t\t\t\t\t\treturn rand(@wheel.length)\r\n\t\t\t\t\t\tend",
"def random_bits(random_generator:, n_bits:)\n bits = 0\n random_generator.call(((n_bits - 1) / 8) + 1).unpack('C*').each_with_index { |byte, i| bits |= byte << (8 * i) }\n bits & ((1 << n_bits) - 1) # throw away the bits we do not need\n end",
"def roll\n return rand(1..6)\nend",
"def random_resilience_generator\n self.resilience = 10.times.sum{ Random.rand(1..13) } \n end",
"def boundedRand(rand, lowerBound, upperBound)\n proc {\n begin\n\tr=rand.call()\n end until (r>lowerBound) and (r<upperBound)\n r\n }\nend",
"def random_value_between(low, andValue: high)\n rand * (high - low) + low\n end",
"def generate_random_number\n (1..10).to_a.sample\nend",
"def generate\n (0..30).sort{ rand() } .take(@conf)\n end",
"def next_state\n STATES.find do |_, state|\n state[:probability] && state[:probability] > rand\n end\n end",
"def rand(max=0) end",
"def value_anneal\n value_anneal_iteration(@iteration)\n end",
"def roll\n return rand 1..6\nend",
"def mine_fake(random)\n if @max_fake.zero?\n 0\n else\n fake = random.rand(@max_fake + 1)\n fake\n end\n end",
"def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend",
"def altern(boul, prob, n)\n som = 0\n u = rand\n (1..n).to_a.each do |i|\n som += prob[i]\n # puts \"som is #{som}\"\n # puts \"u is #{u}\"\n # another typo, the paper says u >= som which will always return either\n # boul[1] or boul[10]\n if som >= u\n return boul[i]\n end\n end\n return boul[n]\n end",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def find_rubies\r\n # Add 1 to max_rubies to make maximum inclusive\r\n @random.rand(@max_rubies + 1)\r\n end",
"def random\n 1 + (10 * rand(0))\n end",
"def bunny(n)\n return 0 if n == 0\n\n return (2 + (2 * (n - 1)))\nend",
"def random_number( bits )\n m = (1..bits-2).map{ rand() > 0.5 ? '1' : '0' }.join\n s = \"1\" + m + \"1\"\n s.to_i( 2 )\n end"
] | [
"0.6501454",
"0.64549047",
"0.64001167",
"0.63501245",
"0.63500243",
"0.6141074",
"0.6114508",
"0.60487866",
"0.59814036",
"0.59814036",
"0.59814036",
"0.5966036",
"0.59596086",
"0.5950158",
"0.59330815",
"0.5932772",
"0.5895907",
"0.5883795",
"0.583623",
"0.5817098",
"0.5809222",
"0.57662135",
"0.5732972",
"0.57228893",
"0.5713189",
"0.5713189",
"0.56945103",
"0.5689689",
"0.5689689",
"0.5689075",
"0.56861734",
"0.5677906",
"0.5673",
"0.56678396",
"0.56604964",
"0.5650691",
"0.561725",
"0.56054467",
"0.56018066",
"0.5598563",
"0.5583173",
"0.5583173",
"0.55752885",
"0.55540025",
"0.5536968",
"0.5536602",
"0.5532493",
"0.55218923",
"0.550667",
"0.5505751",
"0.55033654",
"0.54893845",
"0.5483064",
"0.54817355",
"0.54770803",
"0.5477008",
"0.54744494",
"0.5471904",
"0.5465439",
"0.5464542",
"0.5460599",
"0.5453043",
"0.54530054",
"0.5441045",
"0.54345334",
"0.5432811",
"0.542779",
"0.5422419",
"0.54149026",
"0.54149026",
"0.54091716",
"0.540621",
"0.5401606",
"0.5395752",
"0.539003",
"0.53869975",
"0.5379646",
"0.5376379",
"0.5374273",
"0.5361325",
"0.5360178",
"0.53465176",
"0.53428906",
"0.5339803",
"0.5335262",
"0.53198296",
"0.5316096",
"0.53150505",
"0.5312016",
"0.5308207",
"0.5305635",
"0.5305319",
"0.5304861",
"0.5301743",
"0.5301743",
"0.5301743",
"0.5301235",
"0.5297452",
"0.5283423",
"0.5282569"
] | 0.79586697 | 0 |
Only allow a trusted parameter "white list" through. | def professor_params
params.require(:professor).permit(:name, :professor_id, :email, :admin, :password, :password_confirmation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\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",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] | 0.0 | -1 |
This should be passed either: 1: A name or ID for the things to retrieve from the server 2: A preretrieved blob of JSON. | def initialize(blob,*rest)
case
when blob.is_a?(String) || blob.is_a?(Integer)
@blob,res = REST.get("#{self.class.path}/#{blob}")
raise("Failed to get #{self.class.name} object named #{name}") if res != 200
when blob.is_a?(Hash) && blob["id"]
@blob = blob
else
raise("Cannot cast #{blob.inspect} into a #{name}}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta\n blob = ActiveStorage::Blob.find_signed(params[:id])\n\n render json: { blob: blob, url: rails_blob_url(blob) }\n end",
"def blob(id)\n head \"/blobs/#{id}\"\n end",
"def get_object(id)\n return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id))\n deserialize(obj)\n end",
"def blob_response(key, query, *args)\n url = File.join(properties.primary_endpoints.blob, *args) + \"?#{query}\"\n headers = build_headers(url, key, 'blob')\n\n ArmrestService.send(\n :rest_get,\n :url => url,\n :headers => headers,\n :proxy => proxy,\n :ssl_version => ssl_version,\n :ssl_verify => ssl_verify,\n )\n end",
"def get_from_storage(id)\n\t\traise \"[FATAL] Storage directory not set\" if Repository.data_dir.nil?\n\n\t\t# Aquire raw JSON\n\t\traw = aquire_raw(id)\n\n\t\t# Escape if object not found\n\t\treturn nil if raw.nil?\n\n\t\t# Create object\n\t\tobj = JSON::parse(raw)\n\n\t\t# Grab needed objects, args => self\n\t\tobj.cache_collect\n\n\t\t# return\n\t\treturn obj\n\tend",
"def retrieve!(file_identifier)\n client.object(file_identifier)\n end",
"def load_poke url\n output = JSON.parse(RestClient.get(url))\n if Poke.find_by(id: output['id'])\n Poke.update(output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n else\n Poke.create(id: output['id'],\n name: output['name'],\n weight: output['weight'],\n order: output['order'])\n end\n print 'p' + output['id'].to_s + ' ' if VERBOSE==1\nend",
"def fetch(name); end",
"def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end",
"def object!\n connection.get(\"/#{URI.escape(@key)}\", @bucket_name)\n end",
"def gitget(obj)\n data = gitrepo.read(obj[:oid]).data\n begin\n v = JSON.load(data)\n v = obj[:name] if v.nil?\n v\n rescue JSON::ParserError\n # parser errors are not fatal\n # this just indicates a string entry rather than a hash\n data.empty? ? obj[:name] : data\n end\n end",
"def get(username, password, ids)\n Asset.find(ids).map do |asset|\n WebServiceStructs::AssetStruct.new(\n :id => asset.id,\n :filename => asset.filename,\n :content_type => asset.content_type,\n :content => asset.data,\n :size => asset.size,\n :description => asset.description,\n :created_on => asset.created_on,\n :updated_on => asset.updated_on\n )\n end\n end",
"def read(uid)\n object = bucket.objects[uid]\n data = object.read\n meta = Serializer.json_decode(object.metadata[:json])\n [\n data, # can be a String, File, Pathname, Tempfile\n meta # the same meta Hash that was stored with write\n ]\n end",
"def fetch\n response = RestClient.get \"http://pokeapi.co/#{resource_uri}\"\n update(resource_data: JSON.parse(response))\n end",
"def get( id )\n resource = begin # this is just in case the developer has already escaped the name\n CouchDB.get( \"#{database.uri}/#{CGI.escape(id)}\" )\n rescue\n CouchDB.get( \"#{database.uri}/#{id}\" ) \n end\n new( resource ) \n end",
"def read\n client[\"/vaults/#{vault_id}/blobs/#{blob_id}\"].get\n end",
"def meta_for_blob(blob)\n {\n \"name\" => blob.filename,\n \"size\" => blob.byte_size,\n \"mimeType\" => blob.content_type,\n \"url\" => blob.service_url(disposition: :inline, expires_in: 1.hour),\n }.as_json\n end",
"def remote_data\n render :json => build_remote_data( params[:document_id] )\n end",
"def omdb_pull(search_key, search_val)\n\n result = Typhoeus.get(\"http://www.omdbapi.com/\", :params => {search_key => search_val})\n result = JSON.parse(result.body)\n result\n\nend",
"def fetch_id\n return unless @name\n\n begin\n response = Inventory.request[\"assets/#{@name}\"].get :content_type => :json, :accept => :json \n asset = JSON.parse(response)\n asset['id']\n rescue RestClient::ResourceNotFound\n nil\n rescue => exception\n puts exception.message\n puts exception.response\n exit 1\n end\n end",
"def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"def show\n # base url of the remote data\n # append the 'id' to this to generate the remote url\n baseUrl = 'https://api.gojimo.net/api/v4/'\n\n # request the meta data from the remote server and\n # extract the time its data was last updated\n meta = open(\"#{baseUrl}#{params[:id]}\").meta\n update_at = meta[\"last-modified\"].to_date\n\n # request new data when the local data timestamp pre dates the remote data\n requires_refresh = params[:update_at].blank? || update_at > params[:update_at].to_date\n\n # request the remote data if it is newer than the local copy\n data = open(\"#{baseUrl}#{params[:id]}\").read if requires_refresh\n # parse any data since we are going to add the data to an object which is then converted to json\n data = JSON.parse(data) unless data.blank?\n\n # return any data together with timestamps and a flag to show whetjer new data was retrieved\n render json: {new_data: requires_refresh, data: data, update_at: update_at.strftime('%a %d %b %Y'), check_at: Time.now.strftime('%H:%M %a %d %b %Y')}\n\n end",
"def get_record(identifier)\n doc = client.get!(CGI.escape(identifier)).body.to_json\n @record_class.build(mint_id(identifier), doc, 'application/json')\n end",
"def data\n construct_url\n JSON.parse(response)\n end",
"def fetch\n end",
"def retrieve(id)\n instance = self.new(id)\n url = instance.url\n requestor = Requestor.new\n response = requestor.request(:get, url)\n instance.load_from(response)\n instance\n end",
"def fetch; end",
"def fetch; end",
"def request_blob_json(container_type, data_type, custom_data_type, suffix)\n data_type_id = data_type\n if !custom_data_type.nil?\n data_type_id = \"#{data_type}.#{custom_data_type}\"\n end\n\n url_suffix = eval(url_suffix_template)\n\n data = {\n \"ContainerType\" => container_type,\n \"DataTypeId\" => data_type_id,\n \"ExpiryDuration\" => blob_uri_expiry,\n \"Suffix\" => url_suffix,\n \"SkipScanningQueue\" => true,\n \"SupportWriteOnlyBlob\" => true\n }\n\n req = OMS::Common.create_ods_request(OMS::Configuration.get_blob_ods_endpoint.path, data, compress=false)\n\n ods_http = OMS::Common.create_ods_http(OMS::Configuration.get_blob_ods_endpoint, @proxy_config)\n body = OMS::Common.start_request(req, ods_http)\n\n # remove the BOM (Byte Order Marker)\n clean_body = body.encode(Encoding::UTF_8, :invalid => :replace, :undef => :replace, :replace => \"\")\n return JSON.parse(clean_body)\n end",
"def blob\n generate\n storage.get(path).body\n end",
"def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend",
"def fetch(id)\n build_resource(raw.fetch(id))\n end",
"def fetch_data\n parse_data(self.organization.find_data(self.data_path, \n :include => [:url, :name, :description, :picture]))\n end",
"def getData(data_of, id)\n url_data = stringGetUrlPath(data_of)\n url_request = \"#{url_data}/#{id}\"\n response_data = readData(url_request)\n return response_data\n end",
"def load objid\n DataObj.new @repo, self, objid\n end",
"def get(id, file = nil, options = {})\n start_time = Time.now\n logger.debug(\"getting '#{id}' start: #{start_time}\")\n\n if file\n get_file(id, file)\n file.flush\n else\n result = nil\n temp_path do |path|\n File.open(path, 'w') { |f| get_file(id, f) }\n result = File.open(path, 'r') { |f| f.read }\n end\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n result\n end\n rescue BlobstoreError => e\n raise e\n rescue Exception => e\n raise BlobstoreError,\n sprintf('Failed to fetch object, underlying error: %s %s', e.inspect, e.backtrace.join(\"\\n\"))\n ensure\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n end",
"def retrieve\n end",
"def merritt_object_info\n repo = APP_CONFIG[:repository]\n collection = repo.endpoint.match(%r{[^/]+$}).to_s\n enc_doi = ERB::Util.url_encode(to_s)\n resp = HTTP.basic_auth(user: repo.username, pass: repo.password)\n .headers(accept: 'application/json')\n .get(\"#{repo.domain}/api/#{collection}/local_id_search?terms=#{enc_doi}\")\n return resp.parse if resp.headers['content-type'].start_with?('application/json')\n\n {}\n rescue HTTP::Error, JSON::ParserError\n {}\n end",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def get_entity(entity_name)\n uri = URI(@config[:server] + \"/#{entity_name}\")\n uri.query = URI.encode_www_form({:filter => @config[:filter]})\n \n result = Net::HTTP.get_response(uri)\n raise Exception(\"The request to #{uri} failed.\") unless result.is_a?(Net::HTTPSuccess)\n \n JSON.parse(result.body)\n \n rescue\n @logger.error(\"Unable to retrieve entity:\\n#{$!}\")\n []\n end",
"def object(object_id, opts = {})\n response = fetch_object(Array(object_id).join(':'), opts)\n response.body\n end",
"def blob; end",
"def blob; end",
"def blob(id, commit_sha=nil, path=nil)\n blob = self.lookup(id); blob_entry={}\n if commit_sha && path\n commit = self.lookup(commit_sha)\n unless commit\n root_tree = commit.tree\n blob_entry = Gitlab::Git::Blob.find_entry_by_path(self, root_tree.oid, path)\n end\n end\n if blob\n Gitlab::Git::Blob.new(\n id: blob.oid,\n name: blob_entry[:name],\n size: blob.size,\n data: blob.content,\n mode: blob_entry[:mode],\n path: path,\n commit_id: commit_sha,\n )\n end\n end",
"def get(context, names = nil)\n res = context.transport.get_request(context, 'blobstores')\n\n context.err(res.body) unless res.success?\n\n Puppet::Util::Json.load(res.body).map { |blobstore|\n next unless names.include?(blobstore['name'])\n\n type = blobstore['type'].downcase # API returns 'File' instead of 'file'\n res = context.transport.get_request(context, \"blobstores/#{type}/#{blobstore['name']}\")\n\n next unless res.success? # skip unsupported blobstore types\n\n attributes = Puppet::Util::Json.load(res.body)\n {\n name: blobstore['name'],\n ensure: 'present',\n type: type,\n attributes: attributes\n }\n }.compact\n end",
"def name\n blob.name\n end",
"def initialize(object)\n @id = object[\"id\"]\n @data = object[\"data\"]\n end",
"def set_blob\n @blob = Blob.find(params[:id])\n end",
"def get(handle)\n json = @http_client.get('/handles/' + handle)\n Record.new.from_json(json)\n end",
"def bird_specification\n @bird = Bird.find(params[:id])\n if @bird\n @bird = JSON.parse(@bird.to_json)\n @bird[\"id\"]=params[:id]\n render json: @bird.except(\"_id\"), status: :ok\n else\n render :nothing => true, status: :not_found\n end\n end",
"def get_artist(id)\n @connection.get \"artists/#{id}\"\n end",
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def load_query_response\n load_file('sample_query_response.json')\nend",
"def set_blob\n @blob = Blob.find(params[:id])\n end",
"def get(id)\n server.get(\"#{name}/#{CGI.escape(id)}\")\n end",
"def fetch_data\n return @data if @data[\"/type/reflect/any_master\"]\n @data = Ken.session.mqlread(FETCH_DATA_QUERY.merge!(:id => id))\n end",
"def save2blob()\n url = URI.parse(getUrl)\n h = Net::HTTP.start(url.host, url.port) do |http|\n resp, data = http.get(url.path + '?' + url.query)\n return data\n end\n end",
"def load(id)\n #find connction by identifier from .gift\n end",
"def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end",
"def getAuctionJSON\n\n\t\tbegin\n\t\t\tjson = open(@dataURL).read\n\n\t\t\tif !json.include? \"ownerRealm\"\n\t\t\t\n\t\t\t\traise \"Recieved something unexpected: \\n #{json} \\n of class: #{json.class}\"\n\n\t\t\tend\n\n\t\t\treturn json\n\n\t\trescue => e\n\t\t\t\n\t\t\tputs \"Failed to download the Auction JSON data.\\n #{e}\"\n\t\t\t@log.error \"Failed to download the Auction JSON data.\\n #{e}\"\n\n\t\t\treturn false\n\n\t\tend\n\n\tend",
"def get_info(id)\n url = \"http://www.omdbapi.com/?i=#{id}&y=&plot=short&r=json\"\n return_result(url)\n end",
"def id\n data[:id]\n end",
"def load_object(robject, data)\n robject.raw_data = data[:value]\n robject.content_type = data[:content_type]\n robject.links = data[:links]\n robject.indexes = data[:indexes]\n robject.meta = data[:meta]\n robject.etag = data[:etag]\n robject.last_modified = data[:last_modified]\n robject.vclock = data[:vclock]\n robject\n end",
"def getstubjson(title_number)\n uri = URI.parse($STUBJSON)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new('/' + title_number)\n request.basic_auth $http_auth_name, $http_auth_password\n response = http.request(request)\n if (response.code != '200') then\n raise \"Error in getting JSON for: \" + title_number\n end\n return response.body\nend",
"def get_bike(bikeID, userID)\n user = User.find_by(id: userID)\n authorize_time_check(user)\n response = RestClient.get('https://www.strava.com/api/v3/gear/'+bikeID, {Authorization: 'Bearer ' + user.access_token})\n bike = JSON.parse(response)\n end",
"def get_thing(query_hash)\n query = {\"type\" => \"/type/edition\"}.merge(query_hash)\n response = open(@api_url + \"/things?query=\" + CGI.escape(query.to_json) ).read\n JSON.parse(response)\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def find_blob_data(sha, path)\n commit = barerepo.lookup sha\n tree = barerepo.lookup commit.tree_id\n blob = tree.path path\n blobdata = barerepo.read(blob[:oid]).data\n image = {\n name: blob[:name],\n data: blobdata\n }\n [image , commit]\n end",
"def request_raw_pantheons_data\n return unless authenticated?\n\n response = RestClient.get(\n \"https://godvillegame.com/fbh/feed?a=#{@pantheons_guid}\",\n cookies: @cookies, content_type: :json, accept: :json\n )\n JSON.parse(response)\n end",
"def get_object(objectID, attributes_to_retrieve = nil, request_options = {})\n attributes_to_retrieve = attributes_to_retrieve.join(',') if attributes_to_retrieve.is_a?(Array)\n if attributes_to_retrieve.nil?\n client.get(Protocol.object_uri(name, objectID, nil), :read, request_options)\n else\n client.get(Protocol.object_uri(name, objectID, { :attributes => attributes_to_retrieve }), :read, request_options)\n end\n end",
"def get_attachment(name)\n\n unless (model.properties.has_property?(:attachments) &&\n model.properties[:attachments].type == DataMapper::Types::JsonObject &&\n model.properties[:attachments].field == :_attachments)\n raise ArgumentError, \"Attachments require ' property :attachments, JsonObject, :field => :_attachments'\"\n end\n\n unless self.id && self.attachments && self.attachments[name]\n nil\n else\n http = Net::HTTP.new(repository.adapter.uri.host, repository.adapter.uri.port)\n uri = attachment_path(name)\n response, data = http.get(uri, { 'Content-Type' => self.attachments[name]['content_type'] })\n\n unless response.kind_of?(Net::HTTPSuccess)\n nil\n else\n data\n end\n end\n\n end",
"def champs\n conn = Faraday.new(url, request: {open_timeout: 5, timeout: 5}) do |c|\n c.response :json, :content_type => /\\bjson$/\n c.use Faraday::Response::Logger # log request & response to STDOUT\n c.adapter Faraday.default_adapter\n end\n response = conn.get url\n #@hash = response.body['data']\n response.body['data']\n end",
"def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end",
"def retrieve_attachment(name)\n { :file => RestClient.get(\"#{ uri }/#{ CGI.escape(name) }\"),\n :content_type => JSON.parse(RestClient.get(uri))['_attachments']['name'] }\n end",
"def id\n @json['id']\n end",
"def data\n retrieve_data\n end",
"def get_details(id)\n if((results = $redis.get(id)).nil?)\n details = get_details_item(id)\n $redis.set(id,details.to_json)\n return details.to_json\n else\n return results\n end\n end",
"def get(type, id)\n case type.to_sym\n when :blob then grit.blob(id)\n when :tree then grit.tree(id)\n when :commit then grit.commit(id)\n when :tag\n \n object = grit.git.ruby_git.get_object_by_sha1(id)\n if object.type == :tag \n Grit::Tag.new(object.tag, grit.commit(object.object))\n else\n nil\n end\n \n else raise \"unknown type: #{type}\"\n end\n end",
"def file(name)\n begin\n @name=name\n @content=get_rest(\"extra/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end",
"def blob_params\n params.require(:blob).permit(:blob_url, :datum, datum_attributes: [:title, :description, :price, :id])\n end",
"def get_cr_json_object(cr_doi)\n crr = nil\n doi_file = '../json_files/' + cr_doi.gsub('/','_').downcase() + '.json'\n if !File.exists?(doi_file)\n crr = CrApiWrapper::CrRecord.find(cr_doi)\n File.open(doi_file,\"w\") do |f|\n f.write(JSON.pretty_generate(crr))\n end\n else\n File.open(doi_file,\"r\") do |f|\n crr = JSON.parse(f.read)\n end\n end\n # verify that the recoverd object matches the schema\n if verify_with_schema(doi_file)\n return crr\n else\n return nil\n end\nend",
"def show\n @phile = File.read(params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/'))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {content: @phile} }\n end\n end",
"def show\n # placeholder code\n jsonapi_render_errors status: :unprocessable_entity\n # original code\n # @entry = retrieve_service.execute(name: params[:id])\n # return not_found unless @entry\n # jsonapi_render json: @entry\n end",
"def blob\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n params[:action] = \"blob\"\n\n @blob = @repository.get_blob(@branch, @path)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end",
"def fetch(rid)\n do_rpc({:id=>1,\n :procedure=>:info,\n :arguments=>[rid, {}],\n })\n end",
"def buy_food(id,food_units)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{food_units}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\nend",
"def fetch_serving_object(item)\n servings = item['servings']['serving']\n return servings unless servings.class == Array\n servings[0]\n end",
"def microservice_i(id)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{0}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\n\r\n if id == 4\r\n food_units = gets.strip.to_i\r\n buy_food(7,food_units)\r\n end\r\nend",
"def icndb_joke\n\n url = \"http://api.icndb.com/jokes/random\"\n begin\n joke = open(url).read()\n hash = JSON.parse joke\n joke_string = hash['value']['joke']\n rescue\n joke_string=''\n end\n end",
"def from_json_one( json, session_id )\n image = upper_hash_to_lower_hash( json )\n image.merge!(\n :image_id => image[\"id\"],\n :album_key => image[\"album\"][\"key\"],\n :album_id => image[\"album\"][\"id\"]\n )\n image.delete( 'album' )\n\n p = Smile::Photo.new( image )\n p.session_id = session_id\n p\n end",
"def dbpedia_json\n return @dbpedia_json if defined? @dbpedia_json\n\n @dbpedia_json = nil\n return @dbpedia_json if dbpedia_uri.blank?\n\n begin\n api = \"#{dbpedia_uri.gsub('resource', 'data')}.json\"\n response = URI.parse(api).open\n resp = response.read\n @dbpedia_json = JSON.parse(resp)\n rescue\n end\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def get(id)\n json = self.http_client.get_content \"#{self.base_url}#{self.service_base_path}/#{id}.json\", :api_key => self.access_token\n ne = new_entity\n ne.from_hash(JSON.parse(trata_erro(json)))\n ne\n end",
"def get(id)\n json = self.http_client.get_content \"#{self.base_url}#{self.service_base_path}/#{id}.json\", :api_key => self.access_token\n ne = new_entity\n ne.from_hash(JSON.parse(trata_erro(json)))\n ne\n end",
"def data; @data ||= fetch; end",
"def get_user_data(user_name)\n puts \"Please wait was your profile data is retrieved\"\n response = Net::HTTP.get_response(\"teamtreehouse.com\", \"/#{user_name}.json\")\n user_data = JSON.parse(response.body)\n puts \"Data retrieved!\"\n return user_data\nend",
"def get(id)\n raise ArgumentError, 'Invalid id given' if !(String === id)\n\n if id =~ SHA_PATTERN\n raise ArgumentError, \"Sha too short: #{id}\" if id.length < 5\n\n trie = @objects.find(id)\n raise NotFound, \"Sha is ambiguous: #{id}\" if trie.size > 1\n return trie.value if !trie.empty?\n elsif id =~ REVISION_PATTERN\n list = git_rev_parse(id).split(\"\\n\") rescue nil\n raise NotFound, \"Revision not found: #{id}\" if !list || list.empty?\n raise NotFound, \"Revision is ambiguous: #{id}\" if list.size > 1\n id = list.first\n\n trie = @objects.find(id)\n raise NotFound, \"Sha is ambiguous: #{id}\" if trie.size > 1\n return trie.value if !trie.empty?\n else\n raise ArgumentError, \"Invalid id given: #{id}\"\n end\n\n @logger.debug \"gitrb: Loading #{id}\"\n\n path = object_path(id)\n if File.exists?(path) || (glob = Dir.glob(path + '*')).size >= 1\n if glob\n raise NotFound, \"Sha is ambiguous: #{id}\" if glob.size > 1\n path = glob.first\n id = path[-41..-40] + path[-38..-1]\n end\n\n buf = File.open(path, 'rb') { |f| f.read }\n\n raise NotFound, \"Not a loose object: #{id}\" if !legacy_loose_object?(buf)\n\n header, content = Zlib::Inflate.inflate(buf).split(\"\\0\", 2)\n type, size = header.split(' ', 2)\n\n raise NotFound, \"Bad object: #{id}\" if content.length != size.to_i\n else\n trie = @packs.find(id)\n\traise NotFound, \"Object not found: #{id}\" if trie.empty?\n\traise NotFound, \"Sha is ambiguous: #{id}\" if trie.size > 1\n id = trie.key\n pack, offset = trie.value\n content, type = pack.get_object(offset)\n end\n\n @logger.debug \"gitrb: Loaded #{type} #{id}\"\n\n set_encoding(id)\n object = GitObject.factory(type, :repository => self, :id => id, :data => content)\n @objects.insert(id, object)\n object\n end",
"def read(qbo_object, id)\n url = \"#{qbo_object}/#{id}\"\n api_get(url).body\n end",
"def fetch(*args)\n raise NotImplementedError, 'Implement a method to fetch the resource.'\n end",
"def find encrypted_id\n DynamicModel.new perform_request api_url \"summoners/#{encrypted_id}\"\n end"
] | [
"0.60337645",
"0.5984096",
"0.586606",
"0.58217174",
"0.5819593",
"0.56618345",
"0.5627939",
"0.5559886",
"0.55071396",
"0.548059",
"0.5458331",
"0.5437207",
"0.5394814",
"0.53879803",
"0.53598005",
"0.5349231",
"0.5328785",
"0.5321275",
"0.53176373",
"0.5315606",
"0.53079975",
"0.5307994",
"0.5306755",
"0.5301573",
"0.53004175",
"0.5298524",
"0.5280719",
"0.5280719",
"0.52773565",
"0.5266271",
"0.5266053",
"0.52638745",
"0.52617705",
"0.52610767",
"0.5254137",
"0.52536637",
"0.5245452",
"0.5223004",
"0.5221508",
"0.5219599",
"0.5210909",
"0.5210534",
"0.5210534",
"0.520731",
"0.52009046",
"0.5194078",
"0.5189914",
"0.51880777",
"0.51877",
"0.518377",
"0.51822776",
"0.51787114",
"0.517706",
"0.5168046",
"0.5166997",
"0.51658",
"0.5156878",
"0.51527005",
"0.51512015",
"0.5150605",
"0.5144977",
"0.51401484",
"0.513307",
"0.513062",
"0.5130322",
"0.5125862",
"0.5125443",
"0.51216286",
"0.5117748",
"0.51121646",
"0.5108751",
"0.51017994",
"0.51011056",
"0.50975615",
"0.50914156",
"0.50843894",
"0.50829667",
"0.5081898",
"0.5081523",
"0.5078982",
"0.50755346",
"0.5075456",
"0.506089",
"0.5058244",
"0.50561124",
"0.50512564",
"0.5049825",
"0.50443065",
"0.50418794",
"0.50414544",
"0.50409067",
"0.5035988",
"0.50318116",
"0.50318116",
"0.5026281",
"0.5024452",
"0.502073",
"0.50153875",
"0.50097287",
"0.50068134"
] | 0.5668355 | 5 |
sequence is Array of Sequence object (or Enumerator) | def process_sequence(sequence)
@current_node = @init_node
sequence.each do |instance|
next_label = instance.label
next_node = @label_to_node[next_label]
if !next_node
next_node = Node.new
next_node.label = next_label
next_node.output = instance.output
@label_to_node[next_label] = next_node
end
@labels.add next_label
@outputs.add instance.output
@current_node.add_obj(instance, @seq_n)
@graph.add_edge(@current_node, next_node)
@current_node = next_node
end
@graph.add_edge(@current_node, @end_node)
@seq_n += 1;
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence()\n if !defined?(@sequence) or @sequence.nil? then\n @sequence = []\n each_sequence_member() {|member| @sequence << member }\n end\n \n return @sequence\n end",
"def sequence()\n if !defined?(@sequence) or @sequence.nil? then\n @sequence = []\n each_sequence_member() {|member| @sequence << member }\n end\n \n return @sequence\n end",
"def initialize\n @sequence = []\n end",
"def start; @sequence[0]; end",
"def initialize(sequence:)\n @sequence = sequence\n end",
"def sequence\n @sequence\n end",
"def sequence\n return @sequence\n end",
"def visit_Sequence(o)\n what, qty = accept_by_children(o)\n { \"type\" => \"sequence\", \"element-type\" => what, \"length\" => qty }\n end",
"def setSequence(sequence) \r\n\t\t\t\t\t@sequence = sequence\r\n\t\t\t\tend",
"def sequence=(value)\n @sequence = value\n end",
"def qseq; @seq1.seq; end",
"def sequence_to_array_objects\n @sequence = Array.new if @sequence.nil?\n\n array = []\n if !@sequence.empty?\n @sequence.each { |element|\n downcaseElement = element.downcase\n if instance_attribute_defined?(downcaseElement)\n object = get(downcaseElement)\n if object.kind_of?(Array)\n array.concat object\n else\n array << object\n end\n end\n }\n else\n if !@objects.nil?\n @objects.each { |o|\n array << o\n }\n end\n end\n return array;\n end",
"def seq &blk\r\n build_piece Sequence, blk\r\n end",
"def getSequence\r\n\t\t\t\t\treturn @sequence\r\n\t\t\t\tend",
"def sequence=(sequence)\n assert_unloaded\n raise ArgumentError, \"you have already set sequence\" if @sequence\n @sequence = sequence\n end",
"def hseq; @seq2.seq; end",
"def sequence(count, start)\n return [] if count == 0 \n sequence_array = []\n iterator = 1\n count.times do\n sequence_array << start * iterator \n iterator += 1 \n end \n sequence_array\nend",
"def seq?\n expr.is_a?(Array) && expr.first == :seq\n end",
"def [](i)\n seq[i]\n end",
"def each\n i = 0\n until i == @sequence.size\n yield(@sequence[i])\n i += 1\n end\n end",
"def sequence(length, step)\n Array.new(length) { |idx| (idx + 1) * step }\nend",
"def aa_frames seq\n res = []\n # remove white space\n seq = seq.gsub(/\\s/,'')\n ajpseq = Biolib::Emboss.ajSeqNewNameC(seq,\"Test sequence\")\n [1,2,3,-1,-2,-3].each do | frame |\n ajpseqt = Biolib::Emboss.ajTrnSeqOrig(@trn_table,ajpseq,frame)\n aa = Biolib::Emboss.ajSeqGetSeqCopyC(ajpseqt)\n res.push({:frame => frame, :sequence => aa})\n end\n res\n end",
"def seq\n if @seq.nil?\n @seq = ''\n self.exons.each do |exon|\n @seq += exon.seq\n end\n end\n return @seq\n end",
"def to_seq\n nil\n end",
"def seq\n return self.slice.seq\n end",
"def test_each\n # codecite examples\n evens = Sequence.new(5, 2) {|a| a.last + 2} \n odds = Sequence.new(5, 1) {|a| a.last + 2}\n fibs = Sequence.new(5, 1, 1) {|a| a[-2] + a[-1]}\n # codecite examples\n \n assert_equal [2,4,6,8,10], evens.to_a\n assert_equal [1,3,5,7,9], odds.to_a\n assert_equal [1,1,2,3,5], fibs.to_a\n end",
"def test_multiple_dependencies\n collection = JobsCollection.new({'a'=>nil, 'b'=>'c', 'c'=>'f', 'd'=>'a', 'e'=>'b', 'f'=>nil})\n sequence = collection.get_sequence()\n\n assert(['a','d','f','c','b','e'] == sequence ||\n ['a','f','d','c','b','e'] == sequence ||\n ['a','f','c','d','b','e'] == sequence ||\n ['a','f','c','b','d','e'] == sequence ||\n ['a','f','c','b','e','d'] == sequence ||\n\n ['f','a','d','c','b','e'] == sequence ||\n ['f','a','c','d','b','e'] == sequence ||\n ['f','a','c','b','d','e'] == sequence ||\n ['f','a','c','b','e','d'] == sequence ||\n\n ['f','c','a','d','b','e'] == sequence ||\n ['f','c','a','b','d','e'] == sequence ||\n ['f','c','a','b','e','d'] == sequence ||\n\n ['f','c','b','a','d','e'] == sequence ||\n ['f','c','b','a','e','d'] == sequence ||\n\n ['f','c','b','e','a','d'] == sequence)\n end",
"def sequence(num)\n (1..num).to_a\nend",
"def sequence(num)\n (1..num).to_a\nend",
"def sequence(num)\n (1..num).to_a\nend",
"def sequence(input)\n out5 RENDERER.sequence(input)\nend",
"def sequence(number)\n (1..number).to_a\nend",
"def sequence(number)\n (1..number).to_a\nend",
"def valid_sequence?\n sequence.is_a?(Array) && sequence.all? do |e|\n (e.is_a? Numeric) && (e != 0)\n end\n end",
"def seq\n Sequence::NA.new( fetch('').gsub(/ /,'').gsub(/\\d+/,'') )\n end",
"def lengthOfSequence(element)\n\nend",
"def sequence(s)\n clone(:sequence=>s)\n end",
"def read_sequence (seq)\n g = 0\n a = 0\n t = 0\n c = 0\n # testen, ob uebergebenes Objekt einzelne Zeichen zurueckgeben kann\n if not seq.respond_to?(\"each_char\")\n return nil\n end\n # iteration ueber alle Symbole (in Großschreibweise) und Ermittlung\n # der absoluten Haeufigkeit der Basen\n seq.each_char do |base|\n base.upcase!\n if base == \"G\"\n g += 1\n elsif base == \"A\"\n a += 1\n elsif base == \"T\"\n t += 1\n elsif base == \"C\"\n c += 1\n else\n return nil\n end\n end\n return g,a,t,c\nend",
"def sequence(num)\n 1.downto(num).to_a\nend",
"def [](index)\n\t\t@sequence[index]\n\tend",
"def test_no_dependencies\n collection = JobsCollection.new({'a'=>nil, 'b'=>nil, 'c'=>nil})\n sequence = collection.get_sequence()\n\n assert(sequence.is_a?(Array) && ['a','b','c'] == sequence.sort)\n end",
"def sequence(num)\n return [] if num < 1\n (1..num).to_a\nend",
"def ref_seq\n\n _ref_seq || set_ref_seq\n\n rescue => e\n\n warn \"-\"*30\n warn self.inspect\n warn e.inspect\n warn \"-\"*30\n return Insectdb::Sequence.new([])\n\n end",
"def sequence(num)\n sequence_arr = []\n 1.upto(num) { |n| sequence_arr << n }\n sequence_arr\nend",
"def sequence(num)\n num > 0 ? (1..num).to_a : (num..1).to_a\nend",
"def each_exon_seq\n each_exon do | id, reclist, component |\n if component\n sequence = @sequencelist[component.seqname]\n if sequence\n seq = assemble(sequence,component.start,reclist)\n yield description(id,component,reclist), seq\n else \n warn \"No sequence information for\",id\n end\n end\n end\n end",
"def sequence(num)\n Array.new(num) { |i| i+1 }\nend",
"def qseq; @mrna.seq; end",
"def emit_seq\n @em.emit_seq do | part, index, tag, seq |\n # p [part, seq]\n # case part do\n # when :head\n # when :mid\n # when :tail\n # end\n emit_forward(part, index, tag, seq) { |*x| yield(*x) }\n emit_reverse(part, index, tag, seq) { |*x| yield(*x) }\n end\n end",
"def sequence\n if !sequence?\n raise NotImplementedException, \"Attempted to get the sequence of a velvet node that is too short, such that the sequence info is not fully present in the node object\"\n end\n kmer_length = @parent_graph.hash_length\n\n # Sequence is the reverse complement of the ends_of_kmers_of_twin_node,\n # Then the ends_of_kmers_of_node after removing the first kmer_length - 1\n # nucleotides\n length_to_get_from_fwd = corresponding_contig_length - @ends_of_kmers_of_twin_node.length\n fwd_length = @ends_of_kmers_of_node.length\n raise \"Programming error\" if length_to_get_from_fwd > fwd_length\n revcom(@ends_of_kmers_of_twin_node)+\n @ends_of_kmers_of_node[-length_to_get_from_fwd...fwd_length]\n end",
"def sequence(number)\n result = []\n 1.upto(number) {|e| result << e}\n result\nend",
"def test_single\n collection = JobsCollection.new({'a'=>nil})\n sequence = collection.get_sequence()\n\n assert_equal ['a'], sequence\n end",
"def sequence3(number)\n array = []\n 1.upto(number) { |num| array << num }\n array\nend",
"def test_get_element_nil_if_done\n s = Sequence.new(2, 1) {}\n assert_nil s[2]\n end",
"def lucas_sequence(len)\nend",
"def sequence( elem, context = XSDContext.new )\n #log(:info, \"IN sequence\")\n \n parent = SequenceComposer.create(:asset => @asset)\n # TODO add composer_type\n if( parent )\n parent.move_to_child_of(context.parent) if context.parent\n\n next_context = XSDContext.new(parent)\n else\n puts parent.errors.inspect\n raise \"DB SAVE ERRORS\"\n end\n\n descend_tree( elem, next_context )\n\n end",
"def find_it(seq)\r\n\r\nend",
"def sequence(num)\n arr = []\n \n 1.upto(num) do |i|\n arr << i\n end\n\n arr\nend",
"def sequence(number)\n array_of_numbers = []\n \n 1.upto(number) do |num|\n array_of_numbers << num\n end\n \n array_of_numbers\n \nend",
"def sequence(integer1, integer2)\n sequence_array = []\n current_value = integer2\n integer1.times do\n sequence_array << current_value\n current_value += integer2\n end\n sequence_array\nend",
"def sequence(integer)\n (1..integer).to_a\nend",
"def sequence(integer)\n (1..integer).to_a\nend",
"def triple_sequence(start, length)\n\n new_arr = []\n new_arr << start\n start = start * 3\n new_arr << start \n start = start * 3\n new_arr << start \n start = start * 3 \n new_arr << start \n\n return new_arr\n\nend",
"def sequence(count, startnum)\n sequence_array = []\n multiple = 1\n \n until count == 0\n sequence_array << startnum * multiple\n count -= 1\n multiple += 1\n end\n \n sequence_array\nend",
"def seq(*params)\n dtype = params.last.is_a?(Symbol) ? params.pop : nil\n dim = params.first\n \n unless dim.is_a?(Integer)\n raise ArgumentError, \"NVector::seq() only accepts integers as \\\ndimension.\"\n end\n \n values = (0 .. (dim - 1)).to_a\n \n NVector.new(dim, values, dtype)\n end",
"def sequence(count, first)\n (1..count).map { |idx| idx * first }\nend",
"def create_sequence( *elements )\n return Util::ExpressionForms::Sequence.new( *elements )\n end",
"def possible_sequences(state, turn)\n board = JSON.parse(state)\n sequences = []\n\n board.each_with_index do |row, i|\n board[i].each_with_index do |col, j|\n if board[i][j].downcase == turn\n sequences.concat self.move_sequences_for_piece(board, [i, j])\n end\n end\n end\n\n # remove single sequences if there are bigger\n # ones available\n sequences_copy = Marshal.load(Marshal.dump(sequences))\n jump_found = false\n \n sequences_copy.each_with_index do |sequence, i|\n if sequence[0].length > 1\n jump_found = true\n break\n elsif sequence[0].length == 1\n src, dst = sequence[0]\n\n if (src[0] - dst[0]).abs == 2 && (src[1] - dst[1]).abs == 2\n jump_found = true \n end\n end\n end\n\n if jump_found\n sequences_copy.each_with_index do |sequence, i|\n if sequence[0].length == 1\n src, dst = sequence[0]\n\n if (src[0] - dst[0]).abs == 1 && (src[1] - dst[1]).abs == 1\n sequences.delete(sequence)\n end\n end\n end\n end\n\n return sequences \n end",
"def initialize(sequences)\n if sequences.respond_to?(:split)\n @sequences = sequences.split.map { |s| Sequence.new(s) }\n elsif sequences.respond_to?(\"[]\")\n @sequences = sequences.map { |s| s.is_a?(Sequence) ? s : Sequence.new(s) }\n else\n raise TypeError, \"Expected a String or a list of Sequences: #{sequences}\"\n end\n end",
"def sequence(num)\r\n new_arr = []\r\n (1..num).step(1) { |n| new_arr << n }\r\n new_arr\r\nend",
"def sequence(count, start)\n sequence = []\n current = start\n\n count.times do\n sequence << current\n current += start\n end\n\n sequence\nend",
"def sequence\n return self.dna.sequence\n end",
"def sequence(int)\n array = []\n 1.upto(int) do |num|\n array << num\n end\n array\nend",
"def hello(array)\n i = 0\n collection = []\n while i < array.length\n collection << yield(array[i])\n i += 1\n end\n collection\nend",
"def hello(array)\n i = 0\n collection = []\n while i < array.length\n collection << yield(array[i])\n i += 1\n end\n collection\nend",
"def hello(array)\n i = 0\n collection = []\n while i < array.length\n collection << yield(array[i])\n i += 1\n end\n collection\nend",
"def deps(sequence)\n return [] unless checker.valid? # Exit early if it's bad data\n all = [] # Start collecting the list.\n CeleryScript::TreeClimber.travel(tree, ->(n) {\n # Iterate over each node, looking for \"args of interest\".\n # Tools, sub sequences, etc.\n ARGS_OF_INTEREST.map do |arg, klass|\n id = n&.args&.fetch(arg, nil)&.value\n all.push(klass.find(id)) if id\n end\n })\n\n # Filter out the target sequence to prevent runaway recursion.\n # It would be impossible to delete recursive sequences otherwise.\n all.select! { |d| !(d.is_a?(Sequence) && (d.id == sequence.id)) }\n\n # Finally, output the data in a format that can directly be used by\n # SequenceDependency#create!().\n return all.uniq.map do |d|\n { sequence: sequence, dependency_type: d.class, dependency_id: d.id }\n end\n end",
"def destutter2(seq)\n result = [] #result will be a new array\n last = nil #keep track of last thing\n\n seq.each do |item|\n if item != last\n result.push(item)\n #result << item\n end\n last = item\n end\n result\nend",
"def test_one_dependency\n collection = JobsCollection.new({'a'=>nil, 'b'=>'c', 'c'=>nil})\n sequence = collection.get_sequence()\n\n assert(['a','c','b'] == sequence || ['c','b','a'] == sequence || ['c','a','b'] == sequence)\n end",
"def [](loc)\n sequence[loc]\n end",
"def array\n @array\n end",
"def >>(parslet)\n Parslet::Atoms::Sequence.new(self, parslet)\n end",
"def sequence(num)\n num > 0 ? (1..num).to_a : (num..1).to_a.reverse\nend",
"def sequence(num)\n num > 0 ? (1..num).to_a : (num..1).to_a.reverse\nend",
"def sequence(count, start)\n final_arr = []\n 1.upto(count) do |num|\n final_arr << num * start\n end\n final_arr\nend",
"def populate\n (0...@quantity).each do |i|\n @result[i] = sequence(i)\n end\n end",
"def make_sequence\n 4.times do\n self.sequence << COLORS.sample\n end\n end",
"def sequence(num)\n sequence = []\n for nums in 1..num\n sequence << nums\n end\n sequence\nend",
"def sequence(count, integer)\n new_arr = []\n times = 1\n count.times do \n new_arr << integer * times\n times += 1\n end\n p new_arr\nend",
"def sequence(name)\n Sequence.new(name)\n end",
"def sequence(num)\n\tarr = []\n\t1.upto(num) {|num| arr << num }\n\tarr\nend",
"def generate_aasequences\n (0..self.sequence.length-1).each do |i|\n AAsequence.create(:seq_id=> self.seq_id,\n :amino_acid=>self.sequence[i],\n :original_position=>i)\n end\n end",
"def sequence(count, number)\n sequence_arr = []\n 1.upto(count) do |n|\n sequence_arr << number * n\n end\n sequence_arr\nend",
"def sequence(num)\n result = []\n num.times{|i| result << i + 1}\n result\nend",
"def sequence(num)\n (1..num).to_a unless num < 1\nend",
"def sequence(num)\n (1..num).to_a unless num < 1\nend",
"def prepare_sequence(sequence)\n nv = remove_non_amino_acids(sequence)\n split_sequence(nv)\n end",
"def sequence(num)\n return [0] if num == 0\n num > 0 ? (1..num).to_a : (num..0)\nend",
"def sequence_hunter(head)\n\tarr_arrs = []\n\t\n\tarr_values = []\n\tarr_values.push(node.value)\n\n\t#nope, giving up after an hour\n\t#basically we need to generate an array of each level\n\t#but good fucking luck\nend",
"def sequence(value)\n write(BrotherEscp::Sequence.sequence(value))\n end"
] | [
"0.69599664",
"0.69599664",
"0.6674463",
"0.6637912",
"0.64463955",
"0.6435159",
"0.6418211",
"0.63987774",
"0.6295161",
"0.6254222",
"0.61786944",
"0.6177585",
"0.6150648",
"0.614309",
"0.60671854",
"0.6046162",
"0.6017982",
"0.594593",
"0.5925508",
"0.5923922",
"0.5875866",
"0.5857135",
"0.5827689",
"0.5823762",
"0.58089083",
"0.5794895",
"0.5787359",
"0.57626987",
"0.57626987",
"0.57626987",
"0.57383955",
"0.57069457",
"0.57069457",
"0.5703054",
"0.5697728",
"0.5692722",
"0.56880313",
"0.5684756",
"0.5684221",
"0.56803447",
"0.56799966",
"0.56694984",
"0.5640919",
"0.5640028",
"0.56318295",
"0.56282616",
"0.56026375",
"0.55914474",
"0.55753875",
"0.5567132",
"0.55479366",
"0.5521942",
"0.5520115",
"0.5517832",
"0.55161566",
"0.5513746",
"0.5512907",
"0.5511519",
"0.5510108",
"0.5503856",
"0.5480776",
"0.5480776",
"0.5477254",
"0.5472269",
"0.54598284",
"0.54549897",
"0.5454242",
"0.545046",
"0.5448945",
"0.54480344",
"0.54476273",
"0.5440321",
"0.54305965",
"0.5408377",
"0.5408377",
"0.5408377",
"0.5407851",
"0.5403642",
"0.5402133",
"0.5394875",
"0.53913933",
"0.5390454",
"0.5388854",
"0.5388854",
"0.5371843",
"0.53677005",
"0.5365801",
"0.5362522",
"0.53562737",
"0.5354353",
"0.53378445",
"0.5334927",
"0.5333756",
"0.5331573",
"0.5329459",
"0.5329459",
"0.5329318",
"0.53262824",
"0.5325862",
"0.5314808"
] | 0.5620055 | 46 |
ask the given question and get the proper answer from a user | def get_user_input(question, range = nil)
print "\n#{question} : "
user_response = gets.chomp
if range === nil then
# check whether the user input is empty
while user_response.empty? do
print "\nError! You entered a wrong input!" +
"\n#{question} : "
user_response = gets.chomp
end
else
# check whether the user input is an integer and also it is within the given range
unless user_response.to_i.is_a?(Integer) && user_response.to_i.between?(0, range - 1)
print "\nError! You entered a wrong input!" +
"\n#{question} : "
user_response = gets.chomp
end
end
user_response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_question_and_check_answer\n question = MathGame::Question.new\n puts \"#{@turn}: #{question.display_question}\"\n question.obtain_answer\n question.display_message_on_answer\n question.correct?\n end",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply || 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\t\tend\n\tend\n\n\tanswer #this is what is returned\nend",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == \"yes\" || reply == \"no\")\n\t\t\tif reply == \"yes\"\n\t\t\t\tanswer = true\n\t\t\telse\n\t\t\t\tanswer = false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs \"Please answer 'yes' or 'no'.\"\n\t\tend\n\tend\n\n\tanswer # this will return (true or false).\nend",
"def ask\n\t\tbegin\n\t\t\tputs self\n\t\t\tprint \"Su respuesta: \" \n\t\t\tanswerno = gets.to_i - 1\n\t\tend while (answerno < 0 or answerno >= @answers.length)\n\t\t#Comprobamos si es correcta la respuesta\n\t\t@answers[answerno].is_right? \n\tend",
"def get_answer_to(question)\n puts question\n answer = gets.chomp\nend",
"def ask(question)\n answer = 'n'\n answer = 'y' if agree(\"#{question} (y/n) \")\n answer\n end",
"def ask\n @question = params[:question]\n end",
"def ask question \n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\tif (reply == 'yes' || reply == 'no')\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true \t\t\t #I like to state return values explictly\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\t\tbreak\n\t\telse\n\t\t\tputs 'Please answer \"yes\" or \"no\"'\n\t\tend\n\tend\nend",
"def get_response_for question\nprint question + \": \"\ngets.chomp\nend",
"def get_answer_to(question)\n puts question\n answer = gets.chomp\n return answer\nend",
"def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end",
"def ask(question, expected_answer)\n answer = ''\n until answer.match?(expected_answer)\n answer = Readline.readline(question, true)\n end\n\n answer\n end",
"def ask_question(question)\n\tprint question\n\t\n\tgets.chomp # what gets returned from the function\nend",
"def ask_question\n\n end",
"def query_ask\n # NOTE: This trailing space at the end of the String obliquely instructs\n # Highline to keep the prompt on the same line as the question. If the\n # String did not end with a space or tab, Highline would move the input\n # prompt to the next line (which, for our purposes, looks confusing)\n value = ask( \"<%= color('#{@key}', WHITE, BOLD) %>: \",\n highline_question_type ) do |q|\n q.default = default_value unless default_value.to_s.empty?\n\n # validate input via the validate() method\n q.validate = lambda{ |x| validate( x )}\n\n # if the answer is not valid, construct a reply:\n q.responses[:not_valid] = \"<%= color( %q{Invalid answer!}, RED ) %>\\n\"\n q.responses[:not_valid] += \"<%= color( %q{#{ (not_valid_message || description) }}, YELLOW) %>\\n\"\n q.responses[:not_valid] += \"#{q.question} |#{q.default}|\"\n\n query_extras q\n end\n value\n end",
"def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n\t\t\n\t\t\tif reply == 'yes'\n\t\t\t\treturn true\n\t\t\tend\n\n\t\t if reply == 'no'\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\n\tend\nend",
"def ask question\n\twhile true\n\tputs question\n\treply = gets.chomp.downcase\n\tif reply == 'yes'\n\t\treturn true\n\tend\n\tif reply == 'no'\n\t\treturn false\n\tend\n\tputs 'Please answer \"yes\" or \"no\".'\n\tend\nend",
"def new_question\n new_question = Question.new\n new_question.ask_question(name)\n #awaits user answer\n print 'Answer: '\n @choice = STDIN.gets.chomp\n #performs validation on answer\n if new_question.check_answer(@choice.to_i)\n puts \"Yes! You got it!\"\n else\n puts \"Back to the drawing board with you...\"\n wrong_answer\n end\n end",
"def ask(question)\n ui.ask question\n end",
"def ask(question, *options)\n if options[0].class == Optionset\n opts = options[0]\n else\n opts = Optionset.new(*options)\n end\n output.print \"#{question} #{opts.display}\"\n answer = input.gets.chomp\n output.flush\n opts.validate(question, answer)\n end",
"def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend",
"def get_user_input\n puts\n puts \"Type your question below or select from the following:\"\n puts\n puts \"1) Type Q to exit program\"\n puts\n puts \"2) Type P to print all answers\"\n puts\n puts \"3) Type R to reset answers to originals\"\n puts\n puts \"4) Type A to add your own answers to the originals\"\n puts\n question = gets.strip.to_s.downcase\n puts\n handle_user_input(question)\n end",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n \n answer # This is what we return (true or false).\nend",
"def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end",
"def query_ask\n # NOTE: The trailing space at the end of the ask() parameter\n # obliquely instructs HighLine to remain on the prompt line when\n # gathering user input. If the String did not end with a space\n # or tab, HighLine would move to the next line (which, for our\n # purposes, looks confusing).\n\n# FIXME: When the more-intelligible, string color methods are\n# used here instead of the ERB template, the unit tests that examine\n# HighLine output fail because of missing <CR>s that are not in the\n# output StringIO, even though they appear in the console output, when\n# run manually.\n# value = ask( \"#{query_prompt.white.bold}: \",\n#\n # gsub is to escape any single quotes in the prompt\n value = ask( \"<%= color('#{query_prompt.gsub(\"'\",\"\\\\\\\\'\")}', WHITE, BOLD) %>: \",\n highline_question_type ) do |q|\n q.default = default_value unless default_value.to_s.empty?\n\n # validate input via the validate() method\n q.validate = lambda{ |x| validate( x )}\n\n # do this before constructing reply to invalid response, to allow\n # any specializations to q parameters to be made (e.g., q.default)\n query_extras q\n\n # if the answer is not valid, construct a reply:\n q.responses[:not_valid] = 'Invalid answer!'.red + \"\\n\"\n err_msg = not_valid_message || description\n q.responses[:not_valid] += \"#{err_msg}\".red\n q.responses[:ask_on_error] = :question\n q\n end\n value\n end",
"def ask_question\n puts \"#{@current_player.name} what is the answer to: #{@a} #{@operator} #{@b} = ?\"\n end",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer by either \"yes\" or \"no\".'\n end\n end\n\n answer # this is what we return (true or false)\nend",
"def asks_question(question)\n puts question\n gets.chomp\nend",
"def answer(question)\n puts question\n answer = gets.chomp\nend",
"def answer_prompt(answer)\n\tputs \"The answer to your problem is: #{answer}\"\nend",
"def answer\n @question = params[:questions]\n # we need to get the value from params in order to store the question.\n if @question.eql? 'I am going to work'\n @answer = 'Great!'\n elsif @question.end_with?('?')\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = \"I don't care, get dressed and go to work!\"\n # we create @ = instance variable in order to use outside of the method.\n end\n end",
"def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend",
"def general_q(question)\n p question\n gets.chomp\nend",
"def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend",
"def give_answer(question)\n if question.downcase == 'i am going to work'\n 'Great!'\n elsif question.chars[-1] == '?'\n 'Silly question, get dressed and go to work!'\n else\n 'I don\\'t care, get dressed and go to work!'\n end\n end",
"def ask_question(question, options)\n say nil, \"*\" * 50\n say nil, question\n say nil, \"Options: #{options}\"\n gets.chomp.downcase # canonicalization\n end",
"def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend",
"def ASK question\n while true\n puts question\n reply = gets.chomp.downcase\n if reply == \"yes\"\n return true\n end\n if reply == \"no\"\n return false\n end\n puts \"Please answer yes or no !\"\n end\nend",
"def get_answer\n @user_answer = gets.chomp.to_i\n end",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n\n if (reply == 'yes' || reply == 'no')\n if reply == 'yes'\n answer = true\n else\n answer = false\n end\n break\n else\n puts 'Please answer \"yes\" or \"no\".'\n end\n end\n\n answer\nend",
"def question\n\n puts \"What is the best song in the world?\"\n answer= gets.chomp.downcase\n\nend",
"def ask\n gets.strip\n end",
"def ask_question\n @game_id = params[:game_id]\n @current_game = Game.find(@game_id)\n @bonus = params[:bonus]\n unless @current_game.players_turn?(current_user.id)\n back_to_index and return\n end\n\n if @current_game.normal_round?\n subject_title = params[:subject]\n @subject = subject_title\n @questions = Question.questions_by_user_experience(current_user.experience_level, @subject)\n @question = @questions.sample\n elsif @current_game.challenge_round?\n @challenge = Challenge::get_ongoing_challenge_by_game(@current_game.id)\n if @challenge\n @question = Question.find(@challenge.get_question_id_by_counter)\n @subject = @question.subject_title\n elsif @challenge.nil?\n wager = params[:wager]\n prize = params[:prize]\n if wager && prize\n @challenge = Challenge.create_challenge(@current_game.id, current_user.id, @current_game.opponent_id(current_user.id), wager, prize)\n else\n redirect_to game_challenge_path(:game_id => @current_game.id)\n end\n end\n end\n if @question\n respond_to do |format|\n format.html\n format.xml { render :xml => @question }\n end\n end\n end",
"def q(question,answer)\n puts \"\"\n puts question\n print \"Type: \"\n gets.chomp()\n puts \"Answer: #{answer}\"\nend",
"def ask_question(question, options)\n\tputs question, options\n\tgets.chomp.downcase\nend",
"def get_answer\n answer = gets.chomp.downcase.strip\n raise InvalidInputError, \"Please enter 'a' or 'b' to answer, or '-q' or '--quit' to exit\".red unless self.validate_answer(answer)\n answer\n end",
"def ask questions\n\twhile true\n\t\tputs questions\n\t\treply = gets.chomp.downcase\n\t\tif reply == \"yes\"\n\t\t\treturn true\n\t\tend\n\t\tif reply == \"no\"\n\t\t\treturn false\n\t\tend\n\t\tputs \"plans answer with yes or no\"\n\tend\nend",
"def ask_the_question(question, valid_response)\n loop do\n answer = ask(question + \"? [Y/N] \") { |yn| yn.limit = 1, yn.validate = /[yn]/i }\n return answer if answer.downcase == valid_response.downcase || valid_response == ''\n end\nend",
"def ask_q\n @current_ans = generate_q\n end",
"def ask_questionaire\n alert_reserved_and_exit if git.reserved_branch?\n announce\n ask_title\n ask_label\n ask_pivotal_ids if config.use_pivotal_tracker\n ask_jira_ids if config.use_jira\n end",
"def ask_user(question, default = nil, answers = nil, force = false)\n ans = \" (#{answers.join(' / ')})\" unless answers.nil?\n dft = \" [#{default}]\" unless default.nil?\n print \"#{question}#{ans}#{dft} > \"\n if self[:auto] && !force\n puts ''\n else\n y = gets.chomp\n end\n y = default.to_s if y.nil? or y.empty?\n unless answers.nil? or answers.map(&:to_s).include?(y)\n warn \"Answer not recognized: '#{y}'\"\n return ask_user(question, default, answers, force)\n end\n y\n end",
"def get_answer\n @player_answer = STDIN.gets.chomp.to_i\n if @player_answer == @answer\n puts \"#{@current_player}: Yes! You got it!\"\n else\n puts \"#{@current_player.name}: Wrongo\"\n @current_player.lose_life\n end\n end",
"def rules_knowledge_question(name)\n puts \"\\n\\n#{name} do you know the rules of rock, paper, scissors? \\n\\n\"\n answer = gets.chomp.downcase\n return answer\nend",
"def ask(question)\n return nil if not tty?\n\n @outs.print(question + \" \")\n @outs.flush\n\n result = @ins.gets\n result.chomp! if result\n result\n end",
"def ask(question, filter = nil)\n if filter\n match = false\n answer = nil\n while match == false\n print UI_ARROW.red + question.light_white + \" \"\n answer = gets.chomp\n if answer.match(filter)\n return answer\n else\n print \"Sorry, please try again.\".red\n new_line\n new_line\n end\n end\n else\n print \"\\u2712 \".red + question.light_white + \" \"\n return gets.chomp\n end\n end",
"def quiz(question, type: :bool)\n answer = shell.ask(\"#{question.strip}? \", :magenta)\n case type\n when :bool\n if answer =~ /y|ye|yes|yeah|ofc/i\n true\n elsif answer =~ /n|no|fuck|fuck\\s+you|fuck\\s+off/i\n false\n else\n tell(\"Answer misunderstood\", :yellow)\n quiz(question, type: type)\n end\n when :string\n if answer.empty?\n warning(\"Empty answer\", ask_continue: false)\n quiz(question, type: type)\n else\n answer\n end\n else error(\"Unhandled question type: `#{type}`.\")\n end\n end",
"def ask question\n while true\n puts question\n reply = gets.chomp.downcase\n return true if reply == 'yes'\n return false if reply == 'no'\n puts 'Please answer \"yes\" or \"no\".'\n end\nend",
"def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end",
"def question\n @question = params[:question]\n @answer = %w[yes no].sample\n end",
"def get_question\r\n\t\t\r\n\t\treply = \"\"\r\n\t\t\r\n\t\t#loop until player enters something\r\n\t\tuntil reply != \"\"\r\n\t\t\tConsole_Screen.cls #clear the display area\r\n\t\t\tquestion = \"Type your question and press the Enter key. \\n\\n: \"\r\n\t\t\tprint question\r\n\t\t\treply = STDIN.gets #collect player input\r\n\t\t\treply.chop! #remove extra chars\r\n\t\tend \r\n\tend",
"def ask_play \n\tputs \" - Bon, tu joues quoi #{@name} ? je n'est pas que ca a faire !!! (Donne les coordonnees, ex : a1, b3, c2, etc.) \"\n\t@answer_play = gets.chomp \t\n end",
"def get_input(question)\n\t# ask question \n \t# check to make sure something has been entered:\n \tanswer = \"\"\n\twhile answer.empty?\n\t\tputs question\n\t\t#get input and remove NewLine character\n\t\tanswer = gets.delete(\"\\n\")\n\tend\n\tanswer\nend",
"def ask_question(question, kind=\"String\")\n print question + \" \"\n answer = gets.chomp\n answer.to_i if kind == \"number\"\n return answer\nend",
"def ask(question)\n puts question\n gets.chomp\nend",
"def answer(question)\n response = []\n begin\n\ttexto = QUERY_TEMPLATE.sub(/%command%/, question)\n\tprint texto \n\tquery = QueryFactory.create(texto)\n\t# qexec = SparqlDLExecutionFactory.create(query, storage.inferred)\n\tqexec = QueryExecutionFactory.create(query, storage.inferred); #qexec = QueryExecutionFactory.create(query, storage.model);\n results = qexec.execSelect\n response = parse_results(results)\n ensure\n qexec.close if qexec\n end\n response\n end",
"def ask\n puts \"do you have everything? (y/n)\"\n @answer = gets.chomp\nend",
"def ask_for_answer(curr_question, answer_hash, correct, colorized_ans = nil)\n fifty = $game_session.fifty_fifty == 0 ? \"#{$game_session.fifty_fifty}\".colorize(:red) : \"#{$game_session.fifty_fifty}\"\n phone = $game_session.phone_a_friend == 0 ? \"#{$game_session.phone_a_friend}\".colorize(:red) : \"#{$game_session.phone_a_friend}\"\n puts \" Current bear-bucks: #{$game_session.current_total_score} 50/50: #{fifty} Phone-a-friend: #{phone}\"\n puts\n print \"Enter your answer: \"\n # user_input = gets.chomp\n user_input = get_answer(curr_question)\n\n # Check for use of gameshow helpers\n if (user_input.downcase.start_with?(\"fifty\") || user_input.start_with?(\"50\"))\n if $game_session.fifty_fifty == 0\n no_helper_usage(\"fifty-fifty\", curr_question, answer_hash, correct, colorized_ans)\n else\n colorized_ans = fifty_fifty(answer_hash, correct)\n print_question(curr_question)\n puts colorized_ans\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n elsif (user_input.downcase.start_with?(\"phone\"))\n if $game_session.phone_a_friend == 0\n no_helper_usage(\"phone-a-friend\", curr_question, answer_hash, correct, colorized_ans)\n else\n phone_a_friend(curr_question, answer_hash, colorized_ans)\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n # Else check answer for correctness\n else\n check_answer(curr_question, answer_hash, user_input)\n sleep(3) if !$TEST_MODE\n system \"clear\"\n end\nend",
"def ask(question, options={})\n print \"#{question} [default: #{options[:default]}] \"\n reply = STDIN.readline.chomp\n if reply.empty?\n options[:default]\n else\n reply\n end\n end",
"def get_response\r\n response = ''\r\n until response == 'yes' || response == 'no'\r\n puts \"please answer yes or no.\"\r\n response = gets.chomp\r\n end\r\n response\r\n end",
"def ask_question(num = @trivia[:cur_quest])\n self.say \"\\0036 #{@questions[num][:question]}\"\n STDOUT.puts \"\\n :#{@questions[@trivia[:cur_quest]][:answer]}: \\n\"\n end",
"def ask(question, answer_type = String, non_interactive_value = nil, &continuation)\n if interactive?\n interaction_highline.ask(question, answer_type, &continuation)\n else\n nil\n end\n end",
"def ask(question)\n\tputs question\n\tgets.chomp.to_i\nend",
"def get_question\r\n\r\n reply = \"\"\r\n\r\n #loop until the player enters something\r\n until reply != \"\"\r\n Console_Screen.cls #Clear the display area\r\n\r\n question = \"Type your question and press the Enter key. \\n\\n: \"\r\n print question\r\n\r\n reply = STDIN.gets #Collect the player's questions\r\n reply.chop! #Remove any extra characters\r\n end\r\n\r\n end",
"def ask question\r\n\twhile true\r\n\t\tputs question\r\n\t\treply = gets.chomp.downcase\r\n\t\tif reply == 'yes'\r\n\t\t\t\treturn true\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\tif reply == 'no'\r\n\t\t\t\treturn false\r\n\t\t\t\tbreak\r\n\t\tend\r\n\t\t#else - I had an \"else\" in here, which doesn't belong. Need to remove and just 'Puts' if neither of the two above are included.\r\n\r\n\t\t\tputs 'Please answer \"yes\" or \"no\".'\r\n\t\tend\r\n\t\r\nend",
"def prompt_player_for_answer(question)\n\n puts \"\"\n puts question.text_of_question\n puts \"\"\n\n question.answer = gets.chomp.to_f.round(2)\n\nend",
"def player_response\n\n if compare_answer\n return puts \"#{@current_asker.name}: YES! You are correct.\"\n end\n\n puts \"#{@current_asker.name}: Seriously? No!\"\n\n end",
"def ask(question)\n print question + \" \"\n gets\nend",
"def check_answer_input(range) #this method both prints and checks the answer\r\n\r\n\tequation = new_equation(range)\r\n\tanswer = false\r\n\r\n\twhile answer == false\r\n\t\tputs equation\r\n\t\tresult = eval equation\r\n\t\tputs \"{answer: #{result}}\"\r\n\t\tanswer_user = gets.chomp\r\n\r\n\t\tif answer_user.downcase == \"q\" #make a new method for if ??? - yes, I would make a new method\r\n\t\t\texit\r\n\t\telsif answer_user.to_i == result\r\n\t\t\tputs \"Correct!\"\r\n\t\t\tcheck_answer_input(range)\r\n\t\telse\r\n\t\t\tputs \"Try again\"\r\n\t\tend\r\n\tend\r\nend",
"def ask\n \"@all Question '#{@question}'\"\n end",
"def ask_user\n\tmessages = [\"You will get it!\", \"Sorry it won't happen\", \"You bet\", \"No way\", \"Maybe\", \"It depends on you\", \"I believe in you\", \"The odds are against you\"]\n\tquestion = puts \"This is magic 8-Ball. Do you want to shake the eight ball? Y/N\"\n\tuser_response = gets.chomp.capitalize\n\twhile(true)\n\t\tif user_response == \"Y\" || user_response == \"Yes\"\n\t\t\tputs messages[rand(0..7)]\n\t\t\task_user\n\t\t\tbreak\n\t\telsif user_response == \"N\" || user_response == \"No\"\n\t\t\tputs \"Bye!\"\n\t\t\tbreak\n\t\telse\n\t puts \"Type Y/N please\"\n\t ask_user\n\t\t\tbreak\n\t\tend\n\tend\nend",
"def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n return answer\nend",
"def ask_boolean(question)\n yes? ask(question, true, ['y/n'])\n end",
"def get_question\n\t\tquestion = \"Type your question and press the Enter key. \\n\\n: \"\n\t\tprint question\n\tend",
"def ask(question, default: nil, **opts)\n CLI::UI.ask(question, default: default, **opts)\n end",
"def user_answer\n $stdout.print('>> ')\n $stdin.gets.chomp\nend",
"def ask question\n # Throw an exception labeled \"That is not a question\" unless\n # it is a valid question.\n raise \"That is not a question!\" unless question_valid question\n\n # ALL methods in Ruby return a value. If there is no explicit\n # \"return\", the result of the last statement is returned as the\n # result of the method.\n # This will return a random result from the elements in ANSWERS\n # array. Imagine how many lines of code this would be in Java!\n ANSWERS.sample\n end",
"def interpret(question)\n #\n # accept everything:\n # no statement interpretation here, just ok\n #\n answer = nil\n\n reply answer_o(answer)\n end",
"def ask question\n while question != \" \"\n puts question\n reply = gets.chomp.downcase\n if reply == \"yes\"\n return true\n elsif reply == \"no\"\n return false\n end\n puts \"Please put 'yes' or 'no'.\"\n end\nend",
"def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n return gets.chomp\n end",
"def evaluate_answer\n print \"Your answer please: \"\n ans = $stdin.gets.chomp\n if ans.to_i == @current_ans.to_i\n return true\n puts 'True'\n else\n return false\n puts 'False'\n end\n end",
"def yes_or_no(question)\n loop do\n print \"#{question}\\nyes(y), no(n), quit(q): \"\n $stdout.flush # Clear buffer\n response = gets.chomp\n case response.downcase\n when 'y', 'yes' then return true\n when 'n', 'no' then return false\n when 'q', 'quit' then exit\n else $stderr.puts \"Please answer \\\"yes\\\", \\\"no\\\", or \\\"quit\\\".\"\n end\n end\nend",
"def asks(question: 'some default message', test: false)\n print question unless test\n test || gets.chomp\n end",
"def find_answer(options={})\n\toptions[:answer]\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 ask( question, visiable=true )\n begin\n `stty echo`\n print question\n `stty -echo` unless visiable\n gets.chomp\n ensure\n `stty echo`\n end\n end",
"def disp_q(question, q_A, q_B, q_C, q_D, answer)\r\n \r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Format the display of the quiz question\r\n puts question + \"\\n\\n\"\r\n puts q_A\r\n puts q_B\r\n puts q_C\r\n puts q_D\r\n print \"\\nType the letter representing your answer: \"\r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line marker\r\n \r\n #Analyze the player's input to determine if it is correct\r\n if answer == reply then\r\n \r\n #Keep track of the number of correctly answered questions\r\n $noRight += 1 \r\n \r\n end\r\n \r\n #Analyze the answer to determine if it was valid\r\n if reply == \"a\" or reply == \"b\" or reply == \"c\" or reply == \"d\" then\r\n \r\n break #Terminate the execution of the loop\r\n \r\n end\r\n \r\n end\r\n \r\n end",
"def prompt(question)\n puts question\n gets.chomp\nend",
"def verify_user_answer(user_answer)\n until user_answer == \"1\" || user_answer == \"2\" || user_answer == \"3\"\n puts \"That's not a valid answer. Please enter 1, 2, or 3\"\n user_answer = gets.chomp.to_s\n end\n return user_answer\n end",
"def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend",
"def disp_q(question, q_A, q_B, q_C, q_D, answer)\r\n\r\n #Loop until the player inputs a valid answer\r\n loop do\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Format the display of the quiz question\r\n puts question + \"\\n\\n\"\r\n puts q_A\r\n puts q_B\r\n puts q_C\r\n puts q_D\r\n print \"\\nType the letter representing your answer: \"\r\n \r\n reply = STDIN.gets #Collect the player's answer\r\n reply.chop! #Remove the end of line marker\r\n \r\n #Analyze the player's input to determine if it is correct\r\n if answer == reply then\r\n \r\n #Keep track of the number of correctly answered questions\r\n $noRight += 1 \r\n \r\n end\r\n \r\n #Analyze the answer to determine if it was valid\r\n if reply == \"a\" or reply == \"b\" or reply == \"c\" or reply == \"d\" then\r\n \r\n break #Terminate the execution of the loop\r\n \r\n end\r\n \r\n end\r\n\r\n end",
"def check_answer(question, answer_hash, user_input)\n #track points in game_session. store correctness?\n correctness = answer_hash[user_input.upcase] == question.correct || user_input.downcase == question.correct.downcase\n system \"clear\"\n bear_mode = correctness ? \"5\" : \"4\"\n print_question(question, bear_mode)\n print_colorized_answers(answer_hash, user_input.upcase, question.correct)\n puts\n\n correct_msg = [\n \"Pawesome!\",\n \"Beary good!\",\n \"More money for your honey!\"\n ]\n wrong_msg = [\n \"Bearly missed it.\",\n \"I hate to be the bearer of bad news...\",\n \"Not this time, Goldilocks.\",\n \"You can still claw your way back.\"\n ]\n\n if correctness\n print correct_msg.sample.colorize(:green)\n else\n print wrong_msg.sample.colorize(:red)\n end\n\n UserGuess.create(\n question_id: question.id,\n game_session_id: $game_session.id,\n correctness: correctness\n )\nend"
] | [
"0.77588826",
"0.7662557",
"0.76444864",
"0.7618604",
"0.75639653",
"0.74911684",
"0.7469871",
"0.7467118",
"0.7465404",
"0.7462833",
"0.7462138",
"0.7448371",
"0.7425379",
"0.73847806",
"0.73479426",
"0.73365515",
"0.73293495",
"0.73152524",
"0.72799134",
"0.72641975",
"0.7257815",
"0.72472036",
"0.7246178",
"0.7236052",
"0.72321254",
"0.7226258",
"0.72188455",
"0.7195717",
"0.7159353",
"0.7155804",
"0.71530664",
"0.71485245",
"0.71223015",
"0.71002877",
"0.7094266",
"0.70914966",
"0.7082873",
"0.70805514",
"0.7070073",
"0.70695776",
"0.7065228",
"0.7042413",
"0.703456",
"0.70320845",
"0.7017833",
"0.70056254",
"0.7005517",
"0.70016307",
"0.69848156",
"0.6977244",
"0.69695455",
"0.6966971",
"0.69669366",
"0.6956674",
"0.6950493",
"0.6947692",
"0.6942911",
"0.69395673",
"0.6936251",
"0.6907089",
"0.6901144",
"0.6899382",
"0.68939245",
"0.68820775",
"0.68786544",
"0.6877994",
"0.6869072",
"0.6866502",
"0.68597823",
"0.68580955",
"0.6854045",
"0.685384",
"0.6838034",
"0.68364626",
"0.6832098",
"0.6824599",
"0.6803382",
"0.6796843",
"0.6796609",
"0.67736983",
"0.67711854",
"0.67566866",
"0.675279",
"0.67380846",
"0.6734836",
"0.67329776",
"0.6729934",
"0.6717912",
"0.6714945",
"0.6694154",
"0.6683147",
"0.6681501",
"0.66680676",
"0.66674894",
"0.66664547",
"0.66559553",
"0.66468734",
"0.6646851",
"0.6643435",
"0.6629091",
"0.66289234"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def access_request_params
params.require(:access_request).permit(
:contact_email,
:requested_by,
:service_name,
:reason,
:environment_id,
:client_pub_key_file,
:client_pub_key
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\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",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] | 0.0 | -1 |
GET /sugerencia GET /sugerencia.json | def index
@sugerencia = Sugerencium.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def show\n @suplente = Suplente.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @suplente }\n end\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\r\n# @asistencias = Asistencia.all\r\n seccion = params[:seccion_id]\r\n if params[:seccion_id].nil?\r\n fecha = Date.current\r\n else\r\n fecha = params[:fecha].to_date\r\n end\r\n \r\n @asistencias = Asistencia.por_seccion_fecha(anio_escolar.id, seccion, fecha).salida\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @asistencias }\r\n end\r\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end",
"def show\n render json: @tutorado, status: :ok\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def show\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selecao }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show \n est = @establecimiento\n respond_to do |format|\n format.html\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n render :json => {:nombre => @establecimiento.nombre, direccion: @establecimiento.direccion, :latitud => @establecimiento.latitud,\n :longitud => @establecimiento.longitud, :descripcion => @establecimiento.descripcion, :imagen => @establecimiento.foto.url(:small),\n :comentarios => @establecimiento.EstComentarios.map { |comentario| { :descripcion => comentario.descripcion, :usuario => comentario.usuario.nombre } } } \n\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n }\n end\n #No tiene restricciones, queda abierto para el API\n end",
"def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end",
"def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end",
"def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end",
"def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end",
"def show\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sezione }\n end\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def show\n render json: @grupoassunto\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end",
"def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @safra_produto = SafraProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_produto }\n end\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def expiracion\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sistema }\n end\n end",
"def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end",
"def show\n @empresa_servicio = EmpresaServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa_servicio }\n end\n end",
"def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end",
"def show\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimo_grado_de_estudio }\n end\n end",
"def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def show\n @espacio_deportivo = EspacioDeportivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @espacio_deportivo }\n end\n end",
"def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end",
"def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end",
"def show\n render json: @departamento\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def index\n @status_de_la_inscripcions = StatusDeLaInscripcion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_inscripcions }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end",
"def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def show\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end",
"def show\n @etudiant = Etudiant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etudiant }\n end\n end",
"def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end",
"def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def index\n @cuenta = Cuentum.all\n @usercuenta=0\n #@stats = Asiento.informe_hasta_dia\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cuenta }\n end\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @conta = Conta.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @conta, :include => {\n :movimentos => {\n :include => [:nota, :pessoa],\n :methods => [:favorecido],\n :except => [:created_at, :updated_at]\n }\n },\n :methods => [:saldo]\n }\n end\n end"
] | [
"0.72761774",
"0.68169713",
"0.6796274",
"0.6682284",
"0.66280377",
"0.6622965",
"0.6590006",
"0.65612096",
"0.6553834",
"0.6518124",
"0.6517491",
"0.64905596",
"0.6483023",
"0.6475718",
"0.6470056",
"0.6467829",
"0.64613914",
"0.6451942",
"0.64466673",
"0.6444898",
"0.6444898",
"0.6432885",
"0.6421696",
"0.6403964",
"0.63934785",
"0.6391332",
"0.6381111",
"0.6378319",
"0.6371036",
"0.63613105",
"0.6359791",
"0.6341264",
"0.63267696",
"0.63267696",
"0.6326108",
"0.6326108",
"0.6320807",
"0.6319653",
"0.6317651",
"0.62855834",
"0.6284803",
"0.628475",
"0.628475",
"0.6282022",
"0.627405",
"0.6269871",
"0.6268046",
"0.6250164",
"0.6247389",
"0.62468696",
"0.6246508",
"0.62449116",
"0.62442786",
"0.62430423",
"0.6241222",
"0.62368387",
"0.6236037",
"0.623074",
"0.6225881",
"0.6221432",
"0.62164485",
"0.6210052",
"0.6207668",
"0.6207668",
"0.6204914",
"0.6204914",
"0.62010276",
"0.62006295",
"0.61956906",
"0.61941034",
"0.6193708",
"0.6193426",
"0.6192514",
"0.6190519",
"0.6190519",
"0.6185083",
"0.618119",
"0.617722",
"0.6171689",
"0.61710536",
"0.61702955",
"0.61684823",
"0.6162134",
"0.6161896",
"0.6157489",
"0.6154981",
"0.615203",
"0.61421996",
"0.61421126",
"0.6140867",
"0.6139351",
"0.6138731",
"0.61381173",
"0.61373377",
"0.61358064",
"0.61354125",
"0.6135057",
"0.6134571",
"0.61331123",
"0.61317307",
"0.6129134"
] | 0.0 | -1 |
GET /sugerencia/1 GET /sugerencia/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def show\n @suplente = Suplente.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @suplente }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sezione }\n end\n end",
"def show\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selecao }\n end\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end",
"def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @safra_produto = SafraProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_produto }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def index\r\n# @asistencias = Asistencia.all\r\n seccion = params[:seccion_id]\r\n if params[:seccion_id].nil?\r\n fecha = Date.current\r\n else\r\n fecha = params[:fecha].to_date\r\n end\r\n \r\n @asistencias = Asistencia.por_seccion_fecha(anio_escolar.id, seccion, fecha).salida\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @asistencias }\r\n end\r\n end",
"def show\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sistema }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end",
"def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end",
"def show\n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimo_grado_de_estudio }\n end\n end",
"def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end",
"def expiracion\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end",
"def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end",
"def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def show\n @empresa_servicio = EmpresaServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa_servicio }\n end\n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caixa }\n end\n end",
"def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def show\n @etudiant = Etudiant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etudiant }\n end\n end",
"def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end\n end",
"def show\n render json: @grupoassunto\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end",
"def show\n render json: @tutorado, status: :ok\n end",
"def show\n @integrante = Integrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @integrante }\n end\n end",
"def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end",
"def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end",
"def show\n @encuestum = Encuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @encuestum }\n end\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def show \n est = @establecimiento\n respond_to do |format|\n format.html\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n render :json => {:nombre => @establecimiento.nombre, direccion: @establecimiento.direccion, :latitud => @establecimiento.latitud,\n :longitud => @establecimiento.longitud, :descripcion => @establecimiento.descripcion, :imagen => @establecimiento.foto.url(:small),\n :comentarios => @establecimiento.EstComentarios.map { |comentario| { :descripcion => comentario.descripcion, :usuario => comentario.usuario.nombre } } } \n\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n }\n end\n #No tiene restricciones, queda abierto para el API\n end",
"def show\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end",
"def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end",
"def show\n pessoa = Pessoa.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded pessoa', data:pessoa},status: :ok\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def show\n @usuario = Usuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario }\n end\n end",
"def show\n @humanidades2 = Humanidades2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades2 }\n end\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def show\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @concedente = Concedente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concedente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def show\n @contratacao = Contratacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contratacao }\n end\n end",
"def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def show\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @current_cliente=obtener_cliente(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retroalimentacion }\n end\n end"
] | [
"0.7381647",
"0.69704837",
"0.6916371",
"0.68250835",
"0.6704583",
"0.66801",
"0.66680247",
"0.66345376",
"0.66262823",
"0.6625202",
"0.6597829",
"0.6547812",
"0.6535372",
"0.65298617",
"0.6510568",
"0.65046555",
"0.6483818",
"0.6475019",
"0.6472873",
"0.64684963",
"0.6464164",
"0.6457541",
"0.64516133",
"0.64516133",
"0.64502406",
"0.6441134",
"0.6437428",
"0.6437428",
"0.642903",
"0.642903",
"0.6414476",
"0.6408996",
"0.64019233",
"0.639739",
"0.6394322",
"0.639066",
"0.63860446",
"0.63819283",
"0.63742554",
"0.6372331",
"0.6371498",
"0.6359332",
"0.63545513",
"0.63545513",
"0.63502127",
"0.63489425",
"0.63412476",
"0.63402385",
"0.6331038",
"0.63228446",
"0.63228405",
"0.63216007",
"0.6318348",
"0.63177294",
"0.6310096",
"0.63080597",
"0.6307808",
"0.63016135",
"0.62986004",
"0.6288147",
"0.6284525",
"0.62812775",
"0.62812775",
"0.6270248",
"0.6265371",
"0.6264983",
"0.6264933",
"0.62616223",
"0.62580794",
"0.6255562",
"0.62531847",
"0.6252985",
"0.625191",
"0.62491125",
"0.6248812",
"0.62475836",
"0.6247446",
"0.6245989",
"0.623937",
"0.62378865",
"0.62378085",
"0.62378085",
"0.6237799",
"0.62282735",
"0.6227333",
"0.622679",
"0.6226344",
"0.6224839",
"0.6222893",
"0.62227416",
"0.62227416",
"0.62227416",
"0.62225384",
"0.6218461",
"0.6217092",
"0.62148935",
"0.62087",
"0.62087",
"0.61927146",
"0.61925215",
"0.6188626"
] | 0.0 | -1 |
POST /sugerencia POST /sugerencia.json | def create
@sugerencium = Sugerencium.new(sugerencium_params)
respond_to do |format|
if @sugerencium.save
format.html { redirect_to @sugerencium, notice: 'Sugerencium was successfully created.' }
format.json { render :show, status: :created, location: @sugerencium }
else
format.html { render :new }
format.json { render json: @sugerencium.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def create\n @saida_produto = SaidaProduto.new(saida_produto_params)\n\n respond_to do |format|\n if @saida_produto.save\n format.html { redirect_to @saida_produto, notice: 'Saida produto was successfully created.' }\n format.json { render :show, status: :created, location: @saida_produto }\n else\n format.html { render :new }\n format.json { render json: @saida_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sucursale = Sucursale.new(sucursale_params)\n @sucursale.usuarios_id = current_usuario.id\n respond_to do |format|\n if @sucursale.save\n format.html { redirect_to @sucursale, notice: 'Sucursal creada con exito!' }\n format.json { render :show, status: :created, location: @sucursale }\n else\n format.html { render :new }\n format.json { render json: @sucursale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sintoma = Sintoma.new(sintoma_params)\n\n respond_to do |format|\n if @sintoma.save\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully created.' }\n format.json { render :show, status: :created, location: @sintoma }\n else\n format.html { render :new }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sugestao = Sugestao.new(sugestao_params)\n\n respond_to do |format|\n if @sugestao.save\n format.html { redirect_to @sugestao, notice: 'Sugestão salva com sucesso.' }\n format.json { render :show, status: :created, location: @sugestao }\n else\n format.html { render :new }\n format.json { render json: @sugestao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @soatseguro = Soatseguro.new(soatseguro_params)\n\n respond_to do |format|\n if @soatseguro.save\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully created.' }\n format.json { render :show, status: :created, location: @soatseguro }\n else\n format.html { render :new }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n pessoa = Pessoa.new(pessoa_params) \n \n if pessoa.save\n render json: {status: 'SUCCESSO', message:'Usuário cadastrado com sucesso!', data:pessoa},status: :ok\n else\n render json: {status: 'ERRO', message:'Usuário não pode ser cadastrado. Tente novamente mais tarde.', data:pessoa.errors},status: :unprocessable_entity\n end\n end",
"def sugerencium_params\n params.require(:sugerencium).permit(:fecha, :titulo, :detalle)\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ventas_seguimiento = Ventas::Seguimiento.new(params[:ventas_seguimiento])\n @ventas_seguimiento.usuario = current_user.name\n @ventas_seguimiento.user = current_user\n\n respond_to do |format|\n if @ventas_seguimiento.save\n format.html { redirect_to @ventas_seguimiento, notice: 'Seguimiento was successfully created.' }\n format.json { render json: @ventas_seguimiento, status: :created, location: @ventas_seguimiento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ventas_seguimiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitante = Solicitante.new(solicitante_params)\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to @solicitante, notice: 'Solicitante was successfully created.' }\n format.json { render :show, status: :created, location: @solicitante }\n else\n format.html { render :new }\n format.json { render json: @solicitante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @suplente = Suplente.new(params[:suplente])\n\n respond_to do |format|\n if @suplente.save\n format.html { redirect_to @suplente, notice: 'Lista acuerdo was successfully created.' }\n format.json { render json: @suplente, status: :created, location: @suplente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @suplente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @substancia = Substancia.new(substancia_params)\n\n respond_to do |format|\n if @substancia.save\n format.html { redirect_to @substancia, notice: 'Substancia was successfully created.' }\n format.json { render :show, status: :created, location: @substancia }\n else\n format.html { render :new }\n format.json { render json: @substancia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transacao_saida = TransacaoSaida.new(transacao_saida_params)\n\n respond_to do |format|\n if @transacao_saida.save\n format.html { redirect_to @transacao_saida, notice: 'Transação de saida criada com sucesso.' }\n format.json { render :show, status: :created, location: @transacao_saida }\n else\n format.html { render :new }\n format.json { render json: @transacao_saida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @seguro = Seguro.new(params[:seguro])\n\n respond_to do |format|\n if @seguro.save\n format.html { redirect_to @seguro, notice: 'Seguro was successfully created.' }\n format.json { render json: @seguro, status: :created, location: @seguro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n puts request.body.string\n\n if request.body.string.include? %q[\"id\"]\n render json: %q[{\"error\": \"No se puede crear usuario con id\"}], status: 400\n else\n @usuario = Usuario.new(usuario_params)\n #Tuve que hacerlo asi, pq por alguna razon no me dejaba de la forma tradicional!\n #@usuario = Usuario.new\n #@usuario.usuario = params[:usuario]\n #@usuario.nombre = params[:nombre]\n #@usuario.apellido = params[:apellido]\n #@usuario.twitter = params[:twitter]\n\n\n respond_to do |format|\n if @usuario.save\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n #format.html { render :new }\n format.json { render json: @usuario.errors, status: 404}# status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: \"Solicitud was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario = Usuario.new(usuario_params)\n\n if @usuario.save\n render json: @usuario, status: :created, location: @usuario\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end",
"def create\n @selecao = Selecao.new(params[:selecao])\n\n respond_to do |format|\n if @selecao.save\n format.html { redirect_to @selecao, notice: 'Selecao was successfully created.' }\n format.json { render json: @selecao, status: :created, location: @selecao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if usuario_do_setor_principal\n @aquisicao = Aquisicao.new(\n params.require(:aquisicao).permit(:produto_id, :quantidade)\n )\n @aquisicao.setor = Setor.principal\n @aquisicao.usuario = current_usuario\n\n if @aquisicao.save\n format.html { redirect_to @aquisicao, notice: 'Aquisição registrada com sucesso.' }\n format.json { render :show, status: :created, location: @aquisicao }\n else\n set_produtos\n format.html { render :new }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n else\n @aquisicao.errors.add :base, aviso_apenas_usuario_do_setor_principal\n format.html { render :new, notice: @aquisicao.errors }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end",
"def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully created.' }\n format.json { render json: @asignatura, status: :created, location: @asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud_servicio = SolicitudServicio.new(params[:solicitud_servicio])\n\n respond_to do |format|\n if @solicitud_servicio.save\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully created.' }\n format.json { render json: @solicitud_servicio, status: :created, location: @solicitud_servicio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @datos_estudiante = DatosEstudiante.new(datos_estudiante_params)\n\n respond_to do |format|\n if @datos_estudiante.save\n format.html { redirect_to @datos_estudiante, notice: 'Datos estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @datos_estudiante }\n else\n format.html { render :new }\n format.json { render json: @datos_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio_entrega = SitioEntrega.new(params[:sitio_entrega])\n\n respond_to do |format|\n if @sitio_entrega.save\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully created.' }\n format.json { render json: @sitio_entrega, status: :created, location: @sitio_entrega }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario_seguidor = UsuarioSeguidor.new(usuario_seguidor_params)\n\n respond_to do |format|\n if @usuario_seguidor.save\n format.html { redirect_to @usuario_seguidor, notice: 'Usuario seguidor was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_seguidor }\n else\n format.html { render :new }\n format.json { render json: @usuario_seguidor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @despesa = Despesa.new(despesa_params)\n @despesa.user_id = current_user.id\n #@despesa.valor = format_valor\n\n respond_to do |format|\n if @despesa.save\n format.html { redirect_to condominio_despesas_path(condominio_id: @despesa.condominio_id), notice: 'Despesa was successfully created.' }\n format.json { render :show, status: :created, location: @despesa }\n else\n format.html { render :new }\n format.json { render json: @despesa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n respond_to do |format|\n if @especialidad.save\n format.html { redirect_to @especialidad, notice: 'Servicio creado exitosamente.' }\n format.json { render :show, status: :created, location: @especialidad }\n else\n format.html { render :new }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @seguimiento = Seguimiento.new(seguimiento_params)\n\n respond_to do |format|\n if @seguimiento.save\n format.html { redirect_to @seguimiento.caso, notice: \"Seguimiento creado.\" }\n format.json { render :show, status: :created, location: @seguimiento }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seguimiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serie_detalle = SerieDetalle.new(serie_detalle_params)\n\n respond_to do |format|\n if @serie_detalle.save\n format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully created.' }\n format.json { render :show, status: :created, location: @serie_detalle }\n else\n format.html { render :new }\n format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ajudante = current_usuario.ajudantes.build(ajudante_params)\n\n respond_to do |format|\n if @ajudante.save\n format.html { redirect_to @ajudante, notice: \"Ajudante foi criado com sucesso.\" }\n format.json { render :show, status: :created, location: @ajudante }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @ajudante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suceso_perro = SucesoPerro.new(suceso_perro_params)\n\n respond_to do |format|\n if @suceso_perro.save\n format.html { redirect_to @suceso_perro, notice: 'Suceso perro was successfully created.' }\n format.json { render :show, status: :created, location: @suceso_perro }\n else\n format.html { render :new }\n format.json { render json: @suceso_perro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @anteproyecto_estudiante = AnteproyectoEstudiante.new(anteproyecto_estudiante_params)\n\n respond_to do |format|\n if @anteproyecto_estudiante.save\n format.html { redirect_to @anteproyecto_estudiante, notice: 'Anteproyecto estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @anteproyecto_estudiante }\n else\n format.html { render :new }\n format.json { render json: @anteproyecto_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end",
"def create\n @seguridad_usuario = Seguridad::Usuario.new(params[:seguridad_usuario])\n\n respond_to do |format|\n if @seguridad_usuario.save\n format.html { redirect_to edit_seguridad_usuario_path(@seguridad_usuario), notice: 'Guardado Correctamente.' }\n format.json { render json: @seguridad_usuario, status: :created, location: @seguridad_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seguridad_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entrega = Entrega.new(entrega_params)\n\n respond_to do |format|\n if @entrega.save\n format.html { redirect_to @entrega, notice: 'Entrega creada con éxito.' }\n format.json { render :show, status: :created, location: @entrega }\n else\n format.html { render :new }\n format.json { render json: @entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sumario = Sumario.new(sumario_params)\n\n respond_to do |format|\n if @sumario.save\n format.html { redirect_to @sumario, notice: 'Sumario was successfully created.' }\n format.json { render :show, status: :created, location: @sumario }\n else\n format.html { render :new }\n format.json { render json: @sumario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit(:intituleSondage, :descriptionSondage, :categorie_id, :administrateur_id)\n ajout = SondageService.instance.creerNouveauSondage(params[:intituleSondage], params[:descriptionSondage], params[:categorie_id], params[:administrateur_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\nend",
"def create\n @solicitacao = Solicitacao.new(solicitacao_params)\n\n respond_to do |format|\n if @solicitacao.save\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully created.' }\n format.json { render :show, status: :created, location: @solicitacao }\n else\n format.html { render :new }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitud }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:futbolada][:usuario_id] = current_usuario.id\n @futbolada = Futbolada.new(params[:futbolada])\n\n respond_to do |format|\n if @futbolada.save\n @futbolada.numero = \"#{Time.zone.now.strftime('%Y%m%d%H%M%S')}-#{@futbolada.id}F\"\n @futbolada.save\n StatusServicioSolicitado.servicio_email(current_usuario,@futbolada).deliver\n session[:exito] = \"si\"\n session[:modulo] = \"futbolada\"\n format.html { redirect_to index_url }\n format.json { render json: @futbolada, status: :created, location: @futbolada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @futbolada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida was successfully created.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitador = Solicitador.new(solicitador_params)\n\n respond_to do |format|\n if @solicitador.save\n format.html { redirect_to @solicitador, notice: 'Solicitador was successfully created.' }\n format.json { render :show, status: :created, location: @solicitador }\n else\n format.html { render :new }\n format.json { render json: @solicitador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @souscripteur = Souscripteur.new(souscripteur_params)\n\n respond_to do |format|\n if @souscripteur.save\n format.html { redirect_to @souscripteur, notice: 'Souscripteur was successfully created.' }\n format.json { render :show, status: :created, location: @souscripteur }\n else\n format.html { render :new }\n format.json { render json: @souscripteur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transakcje_jaskula = TransakcjeJaskula.new(transakcje_jaskula_params)\n\n respond_to do |format|\n if @transakcje_jaskula.save\n format.html { redirect_to @transakcje_jaskula, notice: 'Transakcje jaskula was successfully created.' }\n format.json { render :show, status: :created, location: @transakcje_jaskula }\n else\n format.html { render :new }\n format.json { render json: @transakcje_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.new(params[:competency_pertenece_asignatura])\n\n respond_to do |format|\n if @competency_pertenece_asignatura.save\n format.html { redirect_to @competency_pertenece_asignatura, notice: 'Competency pertenece asignatura was successfully created.' }\n format.json { render json: @competency_pertenece_asignatura, status: :created, location: @competency_pertenece_asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency_pertenece_asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pagos_servicio = PagosServicio.new(pagos_servicio_params)\n respond_to do |format|\n if @pagos_servicio.save\n @caja = Caja.where(estado: 0).last\n @mov_caja = MovCaja.create!(caja_id: @caja.id, concepto: @pagos_servicio.servicio, ingreso: 0, egreso: @pagos_servicio.monto, saldo: @caja.cierre.to_i - @pagos_servicio.monto.to_i)\n @caja.update(cierre: @caja.cierre.to_i - @pagos_servicio.monto.to_i, salida: @caja.salida.to_i + @pagos_servicio.monto.to_i)\n format.html { redirect_to @pagos_servicio, notice: 'Se ha registrado el pago correctamente.' }\n format.json { render :show, status: :created, location: @pagos_servicio }\n else\n format.html { render :new }\n format.json { render json: @pagos_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit(:id_groupe, :id_question)\n ajout = GroupeService.instance.ajouterQuestion(params[:id_groupe], params[:id_question])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end",
"def create\n retorno = {erro: \"107\", body: \" \"}\n @usuario = Usuario.new(valid_request?)\n @usuario.status = 1\n if @usuario.mac.blank? \n @usuario.nivel = \"usuario_adm\"\n @usuario.status = 0\n usuario = Usuario.select(:mac).where(\"nivel = 1\").last\n @usuario.mac = (usuario.mac.to_i + 1).to_s\n end\n\n if @usuario.valid?\n if @usuario.save\n retorno = {erro: \"000\", body: {usuario_id: @usuario.id, usuario_nome: @usuario.nome, status: true}}\n end\n end\n #verifica erros na inserção no banco\n if @usuario.errors.any?\n retorno = Usuario.verifica_erro(@usuario.errors.messages)\n end\n render json: retorno.to_json\n end",
"def create\n @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @estadia = Estadia.new(estadia_params)\n\n #Quando cria uma estadia nova, seta a data como a hora corrente\n @estadia.data_entrada = Time.now\n #ocupa a vaga\n @estadia.vaga.ocupada = true\n\n respond_to do |format|\n if @estadia.vaga.save && @estadia.save\n format.html { redirect_to @estadia, notice: 'Estadia was successfully created.' }\n format.json { render :show, status: :created, location: @estadia }\n else\n format.html { render :new }\n format.json { render json: @estadia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plan_quirurgico = PlanQuirurgico.new(plan_quirurgico_params)\n @plan_quirurgico.servicios = params[:servicios]\n @plan_quirurgico.estatus = \"En Proceso\"\n puts params\n puts @plan_quirurgico.examen \n respond_to do |format|\n if @plan_quirurgico.save\n format.html { redirect_to @plan_quirurgico, notice: 'El plan quirurgico fue registrado exitosamente.' }\n format.json { render :show, status: :created, location: @plan_quirurgico }\n else\n format.html { render :new }\n format.json { render json: @plan_quirurgico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra_produto = SafraProduto.new(params[:safra_produto])\n\n respond_to do |format|\n if @safra_produto.save\n format.html { redirect_to \"/safras/#{@safra_produto.safra_id}\"}\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)\n\n respond_to do |format|\n if @solicitacao_tipo.save\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end",
"def create\n @oferta = Oferta.new(params[:oferta])\n\n respond_to do |format|\n if @oferta.save\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @oferta, :status => :created, :location => @oferta }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @transferencia = Transferencia.new(transferencia_params)\n\n respond_to do |format|\n if @transferencia.save\n format.html { redirect_to @transferencia, notice: 'Transferencia was successfully created.' }\n format.json { render :show, status: :created, location: @transferencia }\n else\n format.html { render :new }\n format.json { render json: @transferencia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create_almacen,Sigesp::Solicitud \n unidad = session['unidad'] \n return render json: { unidad: \"Esta Unidad Administrativa no tiene Numero de Control \" }, status: :unprocessable_entity if Sigesp::CtrlRequisicion.control_compra(unidad).nil?\n\n @solicitudes = Sigesp::Solicitud.crear_solicitudes_almacen(sigesp_solicitud_alamcen_params)\n @grupoSolicitud = SolicitudGrupo.new\n @solicitudes.each do |solicitud|\n @grupoSolicitud.solicitudes << solicitud \n end\n if @grupoSolicitud.valid? \n @grupoSolicitud.guardar(unidad,current_usuario)\n return render json: { url: sigesp_solicitudsalmacen_path(@grupoSolicitud.solicitudes[0])} \n else\n return render json:@grupoSolicitud.errors ,status: :unprocessable_entity\n end \n end",
"def create\n @sejour = current_user.sejours.build(sejour_params)\n\n respond_to do |format|\n if @sejour.save\n format.html { redirect_to @sejour, notice: 'Le sejour a bien ete cree.' }\n format.json { render :show, status: :created, location: @sejour }\n else\n format.html { render :new }\n format.json { render json: @sejour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @movimentacao_de_estoque = MovimentacaoDeEstoque.new(params[:movimentacao_de_estoque])\n\n respond_to do |format|\n if @movimentacao_de_estoque.save\n format.html { redirect_to @movimentacao_de_estoque, notice: 'Movimentacao de estoque was successfully created.' }\n format.json { render json: @movimentacao_de_estoque, status: :created, location: @movimentacao_de_estoque }\n else\n format.html { render action: \"new\" }\n format.json { render json: @movimentacao_de_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @usuario = Usuario.new(params[:usuario])\n\n respond_to do |format|\n if @usuario.save\n format.html { redirect_to @usuario, notice: 'Usuario fue creado satisfactoriamente' }\n format.json { render json: @usuario, status: :created, location: @usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uni_aso = UniAso.new(uni_aso_params)\n\n respond_to do |format|\n if @uni_aso.save\n format.html { redirect_to @uni_aso, notice: 'Uni aso was successfully created.' }\n format.json { render :show, status: :created, location: @uni_aso }\n else\n format.html { render :new }\n format.json { render json: @uni_aso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.new(payment_params)\n url = 'http://localhost/servicio/Despachador.php'\n parametros = {params: {\n \"servicio\" => 8,\n \"numtarjeta\" => payment_params[:card_number],\n \"cedtitular\" => \"V#{payment_params[:identification]}\",\n \"mesexpiracion\" => payment_params[:expiration_month],\n \"annoexpiracion\" => payment_params[:expiration_year],\n \"codseguridad\" => payment_params[:security_code],\n \"monto\" => payment_params[:amount]\n }}\n\n # \"servicio\" => 4,\n # \"numtarjeta\" => 1234567898765432,\n # \"cedtitular\" => 20296530,\n # \"mesexpiracion\" => 8,\n # \"annoexpiracion\" => 17,\n # \"codseguridad\" => 301,\n # \"monto\" => 3000\n # }}\n resultado = ActiveSupport::JSON.decode(RestClient.get(url, parametros))\n respond_to do |format|\n if resultado[\"exito\"] == \"true\"\n\n if @payment.save\n puts \"entro al save\"\n format.html { redirect_to new_organization_path, notice: 'Su pago ha sido procesado satisfactoriamente' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n\n else\n format.html { render :new , notice: 'Hubo un problema con su solicitud, consulte a su banco para mas informacion'}\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_despesa = TipoDespesa.new(tipo_despesa_params)\n\n respond_to do |format|\n if @tipo_despesa.save\n format.html { redirect_to tenant_tipo_despesas_path(tenant_id: @tenant.id), notice: 'Tipo despesa was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_despesa }\n else\n format.html { render :new }\n format.json { render json: @tipo_despesa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @traslado = Traslado.new(traslado_params)\n\n respond_to do |format|\n if @traslado.save\n format.html { redirect_to @traslado, notice: 'Traslado was successfully created.' }\n format.json { render :show, status: :created, location: @traslado }\n else\n format.html { render :new }\n format.json { render json: @traslado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servicio = Servicio.new(params[:servicio])\n\n respond_to do |format|\n if @servicio.save\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully created.' }\n format.json { render :json => @servicio, :status => :created, :location => @servicio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def transacao_saida_params\n params.require(:transacao_saida).permit(:valor, :data_saida, :justifica_saida, :img_comprov, :created_at, :updated_at)\n end",
"def create\n @status_de_la_inscripcion = StatusDeLaInscripcion.new(params[:status_de_la_inscripcion])\n\n respond_to do |format|\n if @status_de_la_inscripcion.save\n format.html { redirect_to @status_de_la_inscripcion, notice: 'Status de la inscripcion was successfully created.' }\n format.json { render json: @status_de_la_inscripcion, status: :created, location: @status_de_la_inscripcion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_de_la_inscripcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @juntum_usuario = JuntumUsuario.new(juntum_usuario_params)\n\n respond_to do |format|\n if @juntum_usuario.save\n format.html { redirect_to @juntum_usuario, notice: 'Juntum usuario was successfully created.' }\n format.json { render :show, status: :created, location: @juntum_usuario }\n else\n format.html { render :new }\n format.json { render json: @juntum_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao_enviada = SolicitacaoEnviada.new(solicitacao_enviada_params)\n\n respond_to do |format|\n if @solicitacao_enviada.save\n format.html { redirect_to @solicitacao_enviada, notice: 'Solicitacao enviada was successfully created.' }\n format.json { render :show, status: :created, location: @solicitacao_enviada }\n else\n format.html { render :new }\n format.json { render json: @solicitacao_enviada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @sivic_celula = SivicCelula.new(sivic_celula_params)\r\n\r\n respond_to do |format|\r\n if @sivic_celula.save\r\n format.html { redirect_to @sivic_celula, notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_celula }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @datos_usuario = DatosUsuario.new(datos_usuario_params)\n\n respond_to do |format|\n if @datos_usuario.save\n format.html { redirect_to \"/inicio/success\", success: 'Datos usuario was successfully created.' }\n \n else\n format.html { render action: 'new' }\n format.json { render json: @datos_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_usuario = TipoUsuario.new(params[:tipo_usuario])\n\n respond_to do |format|\n if @tipo_usuario.save\n format.html { redirect_to tipo_usuarios_path, notice: 'Tipo usuario fue creado exitosamente.' }\n format.json { render json: @tipo_usuario, status: :created, location: @tipo_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @serv_adicionale = ServAdicionale.new(params[:serv_adicionale])\n\n respond_to do |format|\n if @serv_adicionale.save\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully created.' }\n format.json { render json: @serv_adicionale, status: :created, location: @serv_adicionale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aviso = Aviso.new(aviso_params)\n \n @aviso.dataDeInsercao = Time.now\n @aviso.inseridoPor = \"Gustavo Soares\" #adicionar gem devise\n\n @aviso.atualizadoPor = \"Gustavo Soares\" #adicionar gem devise\n @aviso.dataDeAtualizacao = Time.now\n\n respond_to do |format|\n if @aviso.save\n format.html { redirect_to @aviso, notice: 'Aviso was successfully created.' }\n format.json { render :show, status: :created, location: @aviso }\n else\n format.html { render :new }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(params[:estacionamiento])\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render json: @estacionamiento, status: :created, location: @estacionamiento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fertilizante = Fertilizante.new(fertilizante_params)\n\n respond_to do |format|\n if @fertilizante.save\n format.html { redirect_to @fertilizante, notice: 'Fertilizante was successfully created.' }\n format.json { render :show, status: :created, location: @fertilizante }\n else\n format.html { render :new }\n format.json { render json: @fertilizante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra_verdoso = SafraVerdoso.new(params[:safra_verdoso])\n\n respond_to do |format|\n if @safra_verdoso.save\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { render json: @safra_verdoso, status: :created, location: @safra_verdoso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n obtener_datos()\n @ventum = current_user.ventum.new(cliente:@cliente, clave:@clave, fecha:@fecha, iva:@iva, subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal, distribuidor: @distribuidor, status: \"En proceso\")\n respond_to do |format|\n if(@ventum.save)\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta almacenada exitosamente!.' }\n else\n format.html { redirect_to eventos_path, notice: 'Fallo el almacenamiento de la venta.' }\n end\n \n end\n end",
"def create\n params[:estacionamiento][:id_proveedor]=session['user']['id']\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movimentode_estoque = MovimentodeEstoque.new(movimentode_estoque_params)\n\n respond_to do |format|\n if @movimentode_estoque.save\n format.html { redirect_to @movimentode_estoque, notice: 'Movimentode estoque was successfully created.' }\n format.json { render :show, status: :created, location: @movimentode_estoque }\n else\n format.html { render :new }\n format.json { render json: @movimentode_estoque.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pessoacondominio = Pessoacondominio.new(pessoacondominio_params)\n\n respond_to do |format|\n if @pessoacondominio.save\n format.html { redirect_to @pessoacondominio, notice: 'Pessoa cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @pessoacondominio }\n else\n format.html { render :new }\n format.json { render json: @pessoacondominio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Solicitud\n @solicitante=Solicitante.find(params[:solicitante_id])\n @beneficiario=Beneficiario.find(params[:beneficiario_id])\n @solicitud = Solicitud.create(solicitud_params)\n @solicitud.solicitante_id=@solicitante.id\n @solicitud.beneficiario_id=@beneficiario.id\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to solicitante_beneficiario_path(@solicitante, @beneficiario), notice: 'Solicitud creada exitosamente.' }\n format.json { render :show, status: :created, location: solicitante_beneficiario_path(@solicitante, @beneficiario) }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sabre_de_luz = SabreDeLuz.new(sabre_de_luz_params)\n\n respond_to do |format|\n if @sabre_de_luz.save\n format.html { redirect_to @sabre_de_luz, notice: 'Sabre de luz was successfully created.' }\n format.json { render :show, status: :created, location: @sabre_de_luz }\n else\n format.html { render :new }\n format.json { render json: @sabre_de_luz.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74463266",
"0.66418415",
"0.6555439",
"0.65478534",
"0.6546365",
"0.6544737",
"0.6540366",
"0.6524748",
"0.65196496",
"0.6501394",
"0.64934564",
"0.6486315",
"0.6480253",
"0.64797366",
"0.6476122",
"0.6452414",
"0.6436965",
"0.6433962",
"0.6425439",
"0.6423424",
"0.6416652",
"0.6410178",
"0.6399938",
"0.63949126",
"0.6391412",
"0.6388739",
"0.6382545",
"0.63792115",
"0.637843",
"0.6352806",
"0.6335652",
"0.6331939",
"0.62979454",
"0.62977123",
"0.6296746",
"0.62891537",
"0.62883806",
"0.6279406",
"0.6273801",
"0.6267504",
"0.62671596",
"0.6266731",
"0.6265561",
"0.62640345",
"0.6263064",
"0.6261317",
"0.6260504",
"0.6258589",
"0.62481135",
"0.6240468",
"0.62354606",
"0.62343955",
"0.62319225",
"0.6225083",
"0.62189364",
"0.6218742",
"0.62159395",
"0.62144405",
"0.6212911",
"0.62125385",
"0.62091804",
"0.6207867",
"0.6200257",
"0.6196641",
"0.6192291",
"0.6191684",
"0.61864763",
"0.6186207",
"0.6185365",
"0.6180729",
"0.6177706",
"0.6176994",
"0.61691755",
"0.6165536",
"0.6164935",
"0.61568606",
"0.6153456",
"0.61501914",
"0.61493444",
"0.6146073",
"0.6142044",
"0.61418027",
"0.6138318",
"0.6137534",
"0.6134654",
"0.61320627",
"0.6129018",
"0.61252564",
"0.6124751",
"0.6122599",
"0.61215127",
"0.61171937",
"0.6116853",
"0.61155105",
"0.6111695",
"0.61097056",
"0.6109632",
"0.61069494",
"0.6102041",
"0.61007804"
] | 0.62373537 | 50 |
PATCH/PUT /sugerencia/1 PATCH/PUT /sugerencia/1.json | def update
respond_to do |format|
if @sugerencium.update(sugerencium_params)
format.html { redirect_to @sugerencium, notice: 'Sugerencium was successfully updated.' }
format.json { render :show, status: :ok, location: @sugerencium }
else
format.html { render :edit }
format.json { render json: @sugerencium.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n if @sugerencia.update_attributes(params[:sugerencia])\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\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 retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n if @seguro.update_attributes(params[:seguro])\n format.html { redirect_to @seguro, notice: 'Seguro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.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 update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @suplente = Suplente.find(params[:id])\n\n respond_to do |format|\n if @suplente.update_attributes(params[:suplente])\n format.html { redirect_to @suplente, notice: 'Lista acuerdo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suplente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @palabra = Palabra.find(params[:id])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.update_attributes(params[:palabra])\n format.html { redirect_to @palabra, notice: 'La Palabra fue actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @asistencia.update_attributes(params[:asistencia])\r\n format.html { redirect_to @asistencia, notice: 'Asistencia 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: @asistencia.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @entrega.update(entrega_params)\n format.html { redirect_to @entrega, notice: 'Entrega editada con éxito.' }\n format.json { render :show, status: :ok, location: @entrega }\n else\n format.html { render :edit }\n format.json { render json: @entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao.update(solicitacao_params)\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao_tipo.update(solicitacao_tipo_params)\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n\n #render :json => {:error => \"id no es modificable\"}.to_json, :status => 400\n else\n if usuario_params.count==1\n respond_to do |format|\n # format.json { render json: usuario_params.count}\n if @usuario.update(usuario_params)\n #format.json { render json: @usuario}\n\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #el segundo\n format.json { render :show, status: :ok, location: @usuario }\n end\n end\n elsif usuario_params.count==0\n # JSON.parse(usuario_params)\n respond_to do |format|\n format.json { render :json => {:error => \"id no es modificable\"}.to_json, :status => 400 }\n end\n else\n respond_to do |format|\n format.json { render :json => {:error => \"La modificación ha fallado\"}.to_json, :status => 500 }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_entregavel.update(os_entregavel_params)\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Os entregavel foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_entregavel, notice: 'Os entregavel foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_entregavel }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitante.update(solicitante_params)\n format.html { redirect_to @solicitante, notice: 'Solicitante was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitante }\n else\n format.html { render :edit }\n format.json { render json: @solicitante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @usuario = Usuario.find(params[:id])\n\n if @usuario.update(usuario_params)\n head :no_content\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @soatseguro.update(soatseguro_params)\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully updated.' }\n format.json { render :show, status: :ok, location: @soatseguro }\n else\n format.html { render :edit }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ejemplo.update(ejemplo_params)\n format.html { redirect_to @ejemplo, notice: 'Ejemplo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ejemplo }\n else\n format.html { render :edit }\n format.json { render json: @ejemplo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n obtener_datos()\n @status = params[:statusproyect]\n @cliente = params[:cliente] + \" \" +params[:cliente_apellido]\n respond_to do |format|\n if @ventum.update(cliente: @cliente, clave:@clave, fecha:@fecha, iva:@iva,subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal , distribuidor: @distribuidor, status: @status)\n @detail.each do |x|\n x.destroy\n end\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @produto.update(produto_params)\n respond_with @produto\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n format.html { render :json => ( (@cliente.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @cliente.errors.empty?\n end\n end\n end",
"def update\n respond_to do |format|\n if @comentariu_licenta.update(comentariu_licenta_params)\n format.html { redirect_to @comentariu_licenta, notice: 'Comentariu licenta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comentariu_licenta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resa.update(resa_params)\n format.html { redirect_to edit_resa_path(@resa), notice: 'Resa was successfully updated.' }\n format.json { render json: @resa, status: :accepted }\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_contcelula.update(sivic_contcelula_params)\r\n format.html { redirect_to @sivic_contcelula, notice: 'Sivic contcelula 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: @sivic_contcelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario fue actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @forma_entrega = FormaEntrega.find(params[:id])\n\n respond_to do |format|\n if @forma_entrega.update_attributes(params[:forma_entrega])\n format.html { redirect_to @forma_entrega, notice: 'Forma entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forma_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @productos = Car.where(:pedidoID => params[:id])\n respond_to do |format| \n if @pedido.update(pedido_params)\n \n format.html { redirect_to \"/\", notice: 'Pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido }\n RestClient.post \"https://api:key-e7d79c66e74391fdf48b657624f23ddc\"\\\n \"@api.mailgun.net/v3/sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org/messages\",\n :from => \"Sistema de Pedidos <mailgun@sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org>\",\n #:to => \"proteina@sinergroup.com.mx\",\n :to => \"proteina@sinergroup.com.mx\",\n :subject => \"Solicitud de Pedido\",\n :html => (render_to_string(template: \"../views/pedidos/email\")).to_str\n else\n format.html { render :edit }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consulta = Consulta.find(params[:id])\n\n if @consulta.update(params[:consulta])\n head :no_content\n else\n render json: @consulta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @tipo_compra.update(tipo_compra_params)\n format.html { redirect_to @tipo_compra, notice: 'Tipo compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_compra }\n else\n format.html { render :edit }\n format.json { render json: @tipo_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: \"Solicitud was successfully updated.\" }\n format.json { render :show, status: :ok, location: @solicitud }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { render :show, status: :ok, location: @solicitud }\n else\n format.html { render :edit }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @telefono.update(telefono_params)\n format.html { redirect_to @telefono, notice: 'Telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefono }\n else\n format.html { render :edit }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(cliente_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if !Usuario.exists?(params[:id])\n render json: %q[{\"error\": \"Usuario no encontrado\"}], status: 404\n elsif request.body.string.include? %q[\"id\"] # id is set\n render json: %q[{\"error\": \"id no es modificable\"}], status: 400\n\n\n\n\n\n\n else\n @usuario = Usuario.find(params[:id])\n respond_to do |format|\n if @usuario.update(usuario_params)\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #format.json { render :show, status: :ok, location: @usuario}\n format.json {render json: @usuario}\n else\n #format.html { render :edit }\n format.json { render json: @usuario.errors, status: :unprocessable_entity }\n end\n end\n\n end\n end",
"def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_pessoa.update(sivic_pessoa_params)\r\n format.html { redirect_to @sivic_pessoa, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_pessoa.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @caixa.update(caixa_params)\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { render :show, status: :ok, location: @caixa }\n else\n format.html { render :edit }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n if @asignatura.update_attributes(params[:asignatura])\n format.html { redirect_to @asignatura, notice: 'Asignatura was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @datos_usuario.update(datos_usuario_params)\n format.html { redirect_to root_path, notice: 'Datos usuario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @datos_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \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\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @voluntario.update(voluntario_params) and @voluntario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @voluntario, notice: 'Voluntario was successfully updated.' }\n format.json { render :show, status: :ok, location: @voluntario }\n else\n format.html { render :edit }\n format.json { render json: @voluntario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6919478",
"0.65822756",
"0.65767914",
"0.6546006",
"0.6529974",
"0.6464133",
"0.64206266",
"0.6409226",
"0.6391428",
"0.63783514",
"0.63776445",
"0.6371563",
"0.6363634",
"0.6347548",
"0.63392264",
"0.63351893",
"0.6311469",
"0.6307112",
"0.63061196",
"0.6297077",
"0.6295807",
"0.62941885",
"0.62813866",
"0.62813866",
"0.6280951",
"0.62782747",
"0.6272875",
"0.6272213",
"0.62652266",
"0.6262261",
"0.6260133",
"0.6252557",
"0.62499326",
"0.62449193",
"0.62376213",
"0.6232296",
"0.6231542",
"0.62306696",
"0.6224318",
"0.62230307",
"0.62162644",
"0.6207577",
"0.62010384",
"0.61876065",
"0.61876065",
"0.6185678",
"0.6184552",
"0.6184024",
"0.61673224",
"0.61666656",
"0.6165498",
"0.6164236",
"0.6157715",
"0.6157404",
"0.615163",
"0.61495155",
"0.6144829",
"0.6143975",
"0.6140102",
"0.6138817",
"0.6136951",
"0.6133631",
"0.613165",
"0.61289656",
"0.6127331",
"0.61245596",
"0.6121503",
"0.6120221",
"0.6118898",
"0.6115837",
"0.611449",
"0.6109801",
"0.6109136",
"0.6106798",
"0.6106149",
"0.6106149",
"0.6106049",
"0.61022496",
"0.61007506",
"0.6099059",
"0.6098557",
"0.60914296",
"0.60908955",
"0.6089639",
"0.60864615",
"0.6085908",
"0.6082592",
"0.6080672",
"0.60782105",
"0.6078145",
"0.6076918",
"0.6076039",
"0.607537",
"0.60751474",
"0.6071892",
"0.60680026",
"0.6066683",
"0.60660255",
"0.60657847",
"0.6064992",
"0.60647804"
] | 0.0 | -1 |
DELETE /sugerencia/1 DELETE /sugerencia/1.json | def destroy
@sugerencium.destroy
respond_to do |format|
format.html { redirect_to sugerencia_url, notice: 'Sugerencium was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sugerencia = Sugerencia.find(params[:id])\n @sugerencia.destroy\n\n respond_to do |format|\n format.html { redirect_to sugerencias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suplente = Suplente.find(params[:id])\n @suplente.destroy\n\n respond_to do |format|\n format.html { redirect_to suplentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguro = Seguro.find(params[:id])\n @seguro.destroy\n\n respond_to do |format|\n format.html { redirect_to seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n contrato = @fatura.contrato\n @fatura.destroy\n respond_to do |format|\n format.html { redirect_to contrato, notice: 'Fatura excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selecao = Selecao.find(params[:id])\n @selecao.destroy\n\n respond_to do |format|\n format.html { redirect_to selecaos_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitante.destroy\n respond_to do |format|\n format.html { redirect_to solicitantes_url, notice: 'Solicitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_usuario.destroy\n respond_to do |format|\n format.html { redirect_to datos_usuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gestacao.destroy\n respond_to do |format|\n format.html { redirect_to gestacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sumario.destroy\n respond_to do |format|\n format.html { redirect_to sumarios_url, notice: 'Sumario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @encuesta1.destroy\n respond_to do |format|\n format.html { redirect_to encuesta1s_url, notice: 'Encuesta1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saida.destroy\n respond_to do |format|\n format.html { redirect_to saidas_url, notice: 'Saida foi apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contcelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @sintoma.destroy\n respond_to do |format|\n format.html { redirect_to sintomas_url, notice: 'Sintoma was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soatseguro.destroy\n respond_to do |format|\n format.html { redirect_to soatseguros_url, notice: 'Soatseguro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concedente.destroy\n respond_to do |format|\n format.html { redirect_to concedentes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sezione = Sezione.find(params[:id])\n @sezione.destroy\n\n respond_to do |format|\n format.html { redirect_to sezioni_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transferencia.destroy\n respond_to do |format|\n format.html { redirect_to transferencias_url, notice: 'Transferencia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rescate.destroy\n respond_to do |format|\n format.html { redirect_to rescates_url, notice: 'Rescate fue eleminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reentrada.destroy\n respond_to do |format|\n format.html { redirect_to reentradas_url, notice: 'Reentrada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transacao_saida.destroy\n respond_to do |format|\n format.html { redirect_to transacao_saidas_url, notice: 'Transacao de saida deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @conta.destroy\n params[:id] = nil\n respond_to do |format|\n format.html { redirect_to contas_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anteproyecto_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_estudiantes_url, notice: 'Anteproyecto estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @comentariu_licenta.destroy\n respond_to do |format|\n format.html { redirect_to comentariu_licentas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @suceso_perro.destroy\n respond_to do |format|\n format.html { redirect_to suceso_perros_url, notice: 'Suceso perro was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donante.destroy\n respond_to do |format|\n format.html { redirect_to donantes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @encuestum = Encuestum.find(params[:id])\n @encuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to encuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_documento_de_compra.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Linea eliminada' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trabajador_seccion.destroy\n respond_to do |format|\n format.html { redirect_to trabajador_seccions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consulta_viaje.destroy\n respond_to do |format|\n format.html { redirect_to consulta_viajes_url, notice: 'Consulta viaje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cantante.destroy\n respond_to do |format|\n format.html { redirect_to cantantes_url, notice: 'Cantante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def destroy\n @caixa.destroy\n respond_to do |format|\n format.html { redirect_to caixas_url, notice: 'Caixa foi excluído(a) com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contador.destroy\n respond_to do |format|\n format.html { redirect_to contadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sindicato.destroy\n respond_to do |format|\n format.html { redirect_to sindicatos_url, notice: 'Sindicato fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enquete.destroy\n respond_to do |format|\n format.html { redirect_to enquetes_url, notice: 'Enquete removida com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to asiento_de_servicios_url, notice: 'Asiento de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_relatorioscelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_relatorioscelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end"
] | [
"0.7420884",
"0.72901267",
"0.71937525",
"0.70629305",
"0.70629305",
"0.7038623",
"0.7030972",
"0.70097893",
"0.700909",
"0.70057106",
"0.70035386",
"0.6988629",
"0.6980195",
"0.6967367",
"0.69510376",
"0.6941451",
"0.6938542",
"0.6938299",
"0.6933731",
"0.6920838",
"0.6920121",
"0.6907404",
"0.690665",
"0.69029313",
"0.68968946",
"0.6890011",
"0.6889008",
"0.6884441",
"0.6883544",
"0.6883258",
"0.6882761",
"0.6881792",
"0.6877963",
"0.6877755",
"0.68761957",
"0.6874718",
"0.68713033",
"0.68711835",
"0.6868363",
"0.6867121",
"0.6861648",
"0.68614864",
"0.6860722",
"0.6860722",
"0.6860722",
"0.6858177",
"0.68562055",
"0.68546295",
"0.6853389",
"0.6853178",
"0.6852237",
"0.68521106",
"0.6849376",
"0.68476135",
"0.68475044",
"0.68470514",
"0.68466",
"0.68461806",
"0.6845445",
"0.68452966",
"0.6835494",
"0.6833029",
"0.6830099",
"0.6829935",
"0.68289346",
"0.6821925",
"0.6821483",
"0.68196815",
"0.6818775",
"0.6816116",
"0.68120414",
"0.6811915",
"0.68074423",
"0.6805836",
"0.6805476",
"0.6805179",
"0.680451",
"0.67994803",
"0.6797656",
"0.679764",
"0.6796866",
"0.67955583",
"0.6795056",
"0.67945063",
"0.6792223",
"0.67917705",
"0.6789919",
"0.67894226",
"0.67891276",
"0.67870355",
"0.6782134",
"0.6780571",
"0.6779841",
"0.6777785",
"0.6774839",
"0.6774563",
"0.67735374",
"0.67725486",
"0.6772491",
"0.6772273"
] | 0.7091897 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_sugerencium
@sugerencium = Sugerencium.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 setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\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 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 workflow\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 default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.5332605",
"0.5312215",
"0.5296594",
"0.52965283",
"0.52957606",
"0.5259903",
"0.52443177",
"0.523896",
"0.523896",
"0.523896",
"0.523896",
"0.523896",
"0.52329034",
"0.52322394",
"0.5227445",
"0.5222394",
"0.5220348",
"0.5212759",
"0.5207747",
"0.5205933",
"0.5176468",
"0.5173833",
"0.5171983",
"0.51663405",
"0.5159596",
"0.5158247",
"0.51526845",
"0.5152398",
"0.5151361",
"0.5145775",
"0.5140135",
"0.51338995",
"0.51127726",
"0.5112607",
"0.5112607",
"0.5110613",
"0.51067513",
"0.5092337",
"0.508788",
"0.5081578",
"0.5080434",
"0.50679874",
"0.50567716",
"0.5051213",
"0.5048352",
"0.5048352",
"0.5035347",
"0.5026666",
"0.5023127",
"0.5016081",
"0.50129867",
"0.5000684",
"0.4999752",
"0.49979812",
"0.499026",
"0.499026",
"0.49866846",
"0.49800366",
"0.49795717",
"0.49771172",
"0.4968475",
"0.4965813",
"0.4958072",
"0.49561292",
"0.4954901",
"0.49536785",
"0.4953058",
"0.49468648",
"0.49424478",
"0.4932989",
"0.49291888",
"0.49273813",
"0.49271655",
"0.4925948",
"0.49236968",
"0.49203572",
"0.49181753",
"0.49173692",
"0.4916862",
"0.49161318",
"0.49155986"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def sugerencium_params
params.require(:sugerencium).permit(:fecha, :titulo, :detalle)
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 valid_params_request?; 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 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 safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\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 parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\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"
] | [
"0.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",
"0.6290449",
"0.6282986",
"0.6241265",
"0.62392694",
"0.62192893",
"0.621427",
"0.62099457",
"0.6195319",
"0.61785376",
"0.61747766",
"0.6172739",
"0.6162921",
"0.6152228",
"0.6152062",
"0.6148811",
"0.6122391",
"0.6117956",
"0.61083806",
"0.6106195",
"0.609274",
"0.60815483",
"0.60710186",
"0.6064253",
"0.60213476",
"0.6018128",
"0.60146624",
"0.601063",
"0.60068774",
"0.60068774",
"0.60026145",
"0.6000521",
"0.59987193",
"0.5992379",
"0.59922844",
"0.5991889",
"0.59803206",
"0.5966244",
"0.5959778",
"0.5959708",
"0.59588563",
"0.5956974",
"0.5953329",
"0.59528023",
"0.59439695",
"0.59413165",
"0.59397036",
"0.59397036",
"0.5933782",
"0.59323835",
"0.59258395",
"0.59253365",
"0.5917244",
"0.59111005",
"0.59093463",
"0.5907942",
"0.59047514",
"0.58979666",
"0.58971125",
"0.589613",
"0.5895083",
"0.5893643",
"0.5892825",
"0.5887658",
"0.5883417",
"0.5878839",
"0.5874345",
"0.5869008",
"0.5868205",
"0.58672875",
"0.5867031",
"0.58662426",
"0.5864551",
"0.5863614",
"0.5862626",
"0.5861952",
"0.58596134",
"0.5855716",
"0.58536863",
"0.5851665",
"0.5850823"
] | 0.0 | -1 |
when safari submits a form where no file has been selected, it does not transmit a contenttype and the result is an empty string "" | def test_no_file_uploaded_with_safari
e = Resource.new
assert_nothing_raised { e.file = "" }
assert_equal nil, e.file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enctype; end",
"def enctype=(_arg0); end",
"def content_mime_type; end",
"def content_type\n nil\n end",
"def enctype_multipart\n enctype('multipart/form-data')\n end",
"def mime_type\n return content_type\nend",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def parse_web_form_request\n if !params[:file].blank?\n return [params[:file], 'file']\n elsif !params[:freetext].blank?\n return [params[:freetext], 'text']\n elsif !params[:url].blank?\n return [params[:url], 'url']\n elsif !params[:example_url].blank?\n return [params[:example_url], 'url']\n end \nend",
"def content_type\n @content_type ||= begin\n if attachment?\n \"multipart/mixed; boundary = #{boundary}\"\n else\n \"text/html\"\n end\n end\nend",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type(media_type: T.unsafe(nil)); end",
"def multipart?; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type\n self.file_content_type\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def guess_content_type\n ua = request.user_agent\n if ua.include? \"WebKit\"\n if ua.include?(\"iPhone\") && !ua.include?(\"Safari\")\n :webkit_native\n else\n :webkit\n end\n else\n :html\n end\n end",
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def content_type\n return @content_type unless @content_type.blank?\n if has_attachments?\n return \"multipart/mixed\"\n elsif !body(:plain).blank? && !body(:html).blank?\n return \"multipart/alternative\"\n elsif body(:html)\n return \"text/html\"\n else\n return \"text/plain\"\n end\n end",
"def detect\n empty_file? ? EMPTY_CONTENT_TYPE : content_type_from_file_command\n end",
"def mime_type=(_); end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def content_type\n @content_type || file.content_type\n end",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : original_file.mime_type\n end",
"def multipart_content_type(env)\n requested_content_type = env['CONTENT_TYPE']\n if requested_content_type.start_with?('multipart/')\n requested_content_type\n else\n 'multipart/form-data'\n end\n end",
"def content_type\n @mime_type\n end",
"def mime_type\n super || Mime::Type.lookup(DEFAULT_CONTENT_TYPE)\n end",
"def mime_type\n has_content_type? ? header[:content_type].string : nil rescue nil\n end",
"def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend",
"def mime_type\n term = format_controlled_vocabulary.all.find { |x| x.definition == info_service.driver }\n term ? term.value : primary_file.mime_type\n end",
"def mimetype\n process_upload\n return @file.file.file.content_type\n end",
"def content_type\n file.try(:content_type)\n end",
"def form_type\n ''\n end",
"def content_type\n @mime_type || @heads['content-type']\n end",
"def in_form attrs = nil\n attrs ||= Hash.new\n attrs.merge!( method: 'POST' ) unless attrs.has_key?(:method)\n attrs.merge!( 'accept-charset' => \"UTF-8\") unless attrs.has_key?('accept-charset')\n if attrs.has_key?( :file ) && attrs.delete(:file) == true\n attrs.merge!(:enctype => 'multipart/form-data')\n end\n html_balise 'form', attrs\n end",
"def form_type\n return '<form accept-charset=\"UTF-8\" action=\"/jobs\" class=\"new_job\" enctype=\"multipart/form-data\" id=\"job_form\" method=\"post\">'\n end",
"def default_mime_type=(value); end",
"def content_type\n ::MIME::Types.type_for(name).first.try(:content_type) || 'text/html'\n end",
"def new\n @upload = Upload.new\n @upload.tmp_content_type = params[:content_type]\n\n upload_type = [\"image\",\"document\"].delete(params[:type])\n \n\n respond_to do |format|\n format.html { \n layout = true\n layout = \"ajax\" if request.xhr?\n layout = params[:layout].to_s.strip==\"false\" ? false : params[:layout] if [\"false\",\"ajax\",\"dialog\"].include?(params[:layout].to_s.strip)\n if upload_type\n render :action => \"new_\"+upload_type,:layout=>layout \n else\n render :layout => layout\n end\n } # new.html.erb\n format.xml { render :xml => @upload }\n end\n end",
"def new\n @upload = Upload.new\n @upload.tmp_content_type = params[:content_type]\n\n upload_type = [\"image\",\"document\"].delete(params[:type])\n \n\n respond_to do |format|\n format.html { \n layout = true\n layout = \"ajax\" if request.xhr?\n layout = params[:layout].to_s.strip==\"false\" ? false : params[:layout] if [\"false\",\"ajax\",\"dialog\"].include?(params[:layout].to_s.strip)\n if upload_type\n render :action => \"new_\"+upload_type,:layout=>layout \n else\n render :layout => layout\n end\n } # new.html.erb\n format.xml { render :xml => @upload }\n end\n end",
"def negotiate_mime(order); end",
"def content_type(ext)\n case ext\n when \"gif\": \"image/gif\"\n when \"jpg\": \"image/jpeg\"\n when \"png\": \"image/png\"\n else \"application/octet-stream\"\n end\nend",
"def mime_type(mt=nil)\n @_mime_type = mt unless mt.nil?\n @_mime_type\n end",
"def handle_non_xhr\n file_upload = params['X-Requested-With'] == 'IFrame'\n export = params[:view_request] && request.put? && !request.xhr?\n export ||= params[:export_data_id] || request.post?\n skip = params[:xhr] == 'true'\n unless export || request.xhr? || file_upload || skip\n if request.path != root_path\n path = current_user ? corrected_path : root_path\n redirect_to root_url, flash: { initial_path: path }\n else\n render 'blank', layout: 'application'\n end\n end\n if skip\n headers['Content-Type'] = 'text/plain'\n end\n end",
"def mime_type\n\t\tsuffix_without_dot = extname ? extname.sub(/\\A\\./){''}.downcase : nil\n\n\t\tMechanize::Util::DefaultMimeTypes[suffix_without_dot]\n\tend",
"def validate_content_type!\n if request.headers['Content-Type'] =~ /multipart\\/form-data/\n head 406 unless request.headers['Content-Length'].present? &&\n request.headers['Accept'] === 'application/json'\n else\n head 406 unless request.headers['Accept'] === 'application/json'\n end\n end",
"def mime_type\n _mime_type ? _mime_type.to_s : 'text/plain'\n end",
"def mime_type\n \"text/plain\"\n end",
"def ftype\n :file\n end",
"def content_type!(ext)\n case ext.downcase\n when 'haml'; t = 'text/html'\n when 'erb'; t = 'text/html'\n# I believe all the rest are determined accurately by the Rack::Mime.mime_type call in the else clause below.\n# when 'html'; t = 'text/html'\n# when 'js'; t = 'text/javascript'\n# when 'css'; t = 'text/css'\n# when 'png'; t = 'image/png'\n# when 'gif'; t = 'image/gif'\n# when 'jpg'; t = 'image/jpeg'\n# when 'jpeg'; t = 'image/jpeg'\n else t = Rack::Mime.mime_type('.' + ext, 'text/plain')\n end\n #puts(\"----#{ext}:\" + t.inspect) # dbg\n (self.response[:headers]['Content-Type'] = t) if t\n end",
"def multipart; end",
"def extract_content_type\n if data_content_type == \"application/octet-stream\" && !data_file_name.blank?\n content_types = MIME::Types.type_for(data_file_name)\n self.data_content_type = content_types.first.to_s unless content_types.empty?\n end\n end",
"def content_type\n @content_type ||= request.content_type\n end",
"def content_type\n self[\"Content-Type\"]\n end",
"def notest_should_remove_blank_char_from_filename\n\n document_field = CGI.new( :multipart => true )\n puts document_field.inspect\n document = Document.new(document_field)\n \n puts document.inspect\n \n \n end",
"def attachment_content_type_for(joint)\n case File.extname(joint).downcase\n when '.txt' then 'text/plain'\n when '.html' then 'plain/html'\n when '.pdf' then 'application/octet-stream' #'application/x-pdf'\n when '.jpg', '.jpeg' then 'image/jpeg'\n when '.png' then 'image/png'\n when '.gif' then 'image/gif'\n when '.doc', '.docx' then 'application/msword'\n else \n 'plain/text' # par défaut\n end\nend",
"def _mime_type\n if defined? @_mime_type\n @_mime_type\n else\n guesses = ::MIME::Types.type_for(extname.to_s)\n\n # Prefer text mime types over binary\n @_mime_type = guesses.detect { |type| type.ascii? } || guesses.first\n end\n end",
"def file_type\r\n\t\t@file_type\r\n\tend",
"def acceptable_content_type?\n content_type.blank? || Mime::HTML == content_type\n end",
"def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end",
"def file_specification\n file_name = File.basename (\"#{fax_params[\"file_path\"]}\").downcase\n file_extension = File.extname (file_name).downcase\n\n if file_extension == \".pdf\"\n return \"application/PDF\",file_name\n elsif file_extension == \".txt\"\n return \"application/TXT\",file_name\n elsif file_extension == \".doc\"\n return \"application/DOC\",file_name\n elsif file_extension == \".docx\"\n return \"application/DOCX\",file_name\n elsif file_extension == \".tif\"\n return \"application/TIF\",file_name\n else\n return false\n end\n end",
"def file_upload(criteria = T.unsafe(nil)); end",
"def mime_type\n return @mime_type\n end",
"def content_type\n 'application/octet-stream'\n end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def mime_type_of(f)\n MIME::Types.of(f).last || default_mime_type\n end",
"def content_type\n 'text/plain'\n end",
"def select_mime(request, ext = nil)\n if ext\n @mime = MIME::EXTENSION_TO_MIME[ext]\n else\n # TODO: also consider the HTTP Accept heade\n @mime = MIME::EXTENSION_TO_MIME[\"html\"]\n request.path_info << \".html\" # FIXME: NOOO!!!\n end\n\n set_content_type(@mime.content_type) if @mime\n return @mime\n end",
"def expected_content_type_unmet\n ect = test_case.expected_content_type\n return nil unless ect\n got = response.content_type\n got = got.mime_type if got.respond_to?(:mime_type)\n if ect.nil?\n got.nil? ? nil : \"[content type] #{ect} != #{got}\"\n else\n got.to_s.start_with?(ect.to_s) ? nil : \"[content type] #{ect} != #{got}\"\n end\n end",
"def safe_content_type\n if safe_content_types.include?(content_type)\n content_type\n else\n \"image/jpeg\"\n end\n end",
"def media_type; end",
"def media_type; end",
"def upload_form(key,content)\n return \"Content-Disposition: form-data; name=\\\"#{CGI::escape(key)}\\\"\\r\\n\" +\n \"\\r\\n\" +\n \"#{content}\\r\\n\"\nend",
"def content_type\n content_type = String(headers[\"Content-Type\"] || headers[\"type\"]).split(\";\")[0]\n content_type.blank? ? nil : content_type\n end",
"def show\n @archivo = Archivo.find(params[:id])\n @var = @archivo.uploaded_file.path\n @var2 = @var.gsub(@archivo.uploaded_file_file_name, '');\n\n if @archivo.uploaded_file_content_type == 'application/pdf'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/pdf\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/zip'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/zip\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'image/jpeg' or @archivo.uploaded_file_content_type == 'image/jpg' or @archivo.uploaded_file_content_type == 'image/png' or @archivo.uploaded_file_content_type == 'image/gif'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"image/jpeg\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/doc'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/doc\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'text/plain'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"text/plain\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/msword'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/msword\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/vnd.ms-excel'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/vnd.ms-excel\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'text/csv'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"text/csv\", :x_sendfile=>true\n end\n\n end",
"def update_content_type\n if file.present? && file_changed?\n self.content_type = file.file.content_type\n end\n end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def content_mime_type\n fetch_header(\"action_dispatch.request.content_type\") do |k|\n v = if get_header(\"CONTENT_TYPE\") =~ /^([^,;]*)/\n Mime::Type.lookup($1.strip.downcase)\n else\n nil\n end\n set_header k, v\n rescue ::Mime::Type::InvalidMimeType => e\n raise InvalidType, e.message\n end\n end",
"def extract_mime_type(io)\n if io.respond_to?(:mime_type)\n io.mime_type\n elsif io.respond_to?(:content_type)\n io.content_type\n end\n end",
"def content_type\n type, *parameters = content_type_parse\n type || 'application/octet-stream'\n end",
"def content_type\n end",
"def mime_type\n type = MIME::Types.type_for(self.filename)\n type.empty? ? nil : type.first\n end",
"def ensure_upload_is_file\n return if params.require(:file).respond_to?(:tempfile)\n\n render(\n json: {\n errors: ['\"file\" was not a valid multipart/form-data file'],\n error_keys: [:not_multipart_form_data]\n },\n status: 422\n )\n end",
"def ensure_upload_is_file\n return if params.require(:file).respond_to?(:tempfile)\n\n render(\n json: {\n errors: ['\"file\" was not a valid multipart/form-data file'],\n error_keys: [:not_multipart_form_data]\n },\n status: 422\n )\n end",
"def verify_mime_type\n if is_raw_file?\n self.mime_type = \"image/x-adobe-dng\"\n end\n end",
"def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end",
"def mime_type\n raise NotImplementedError.new 'This is only a function body for documentation'\n end"
] | [
"0.7112963",
"0.696698",
"0.66016024",
"0.64809066",
"0.64719623",
"0.6380976",
"0.63598716",
"0.63598716",
"0.63598716",
"0.63598716",
"0.6342857",
"0.63284516",
"0.6280066",
"0.6280066",
"0.6280066",
"0.6275984",
"0.62507224",
"0.6236363",
"0.6236363",
"0.6236363",
"0.6236363",
"0.6236363",
"0.6236363",
"0.6236363",
"0.6236363",
"0.62058014",
"0.61825985",
"0.61745024",
"0.61498326",
"0.6140683",
"0.61150485",
"0.61136526",
"0.60714257",
"0.6056034",
"0.6053642",
"0.6038774",
"0.60082084",
"0.6006337",
"0.5968812",
"0.5968562",
"0.5967127",
"0.5962282",
"0.59607565",
"0.59595436",
"0.59582555",
"0.5925513",
"0.5888311",
"0.58882284",
"0.5885626",
"0.58777523",
"0.58777523",
"0.5873079",
"0.5872593",
"0.5867404",
"0.58528507",
"0.5850902",
"0.58420396",
"0.58346546",
"0.58235425",
"0.57974225",
"0.57921034",
"0.57853895",
"0.57674134",
"0.5766571",
"0.5763258",
"0.5759865",
"0.5756376",
"0.57544285",
"0.57524884",
"0.5744554",
"0.57254714",
"0.5702553",
"0.5701287",
"0.56950116",
"0.5685108",
"0.56826955",
"0.56803596",
"0.56798536",
"0.5675018",
"0.5672491",
"0.5671243",
"0.56690687",
"0.56690687",
"0.56667674",
"0.5659809",
"0.5646884",
"0.56403774",
"0.5639866",
"0.5639866",
"0.5639866",
"0.5636542",
"0.5635934",
"0.56357074",
"0.5631777",
"0.5623855",
"0.5617904",
"0.5617904",
"0.56065476",
"0.56046695",
"0.5602368"
] | 0.59024924 | 46 |
Find a move number of a possible fork: | def move_number_fork
current = @game.current_player
if current == :O
@count_spots.last if @game.fork?.size > 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_fork(wins, forker, forkee)\n position_counts = count_positions(wins, forker, forkee)\n forking_moves = []\n position_counts.each do |position, count|\n forking_moves.push(position) if count > 1\n end\n forking_moves = (forking_moves - (forking_moves & forker))\n forking_moves.empty? ? [] : forking_moves\n end",
"def forks_number\n number = fork? ? fork.forks_count : forks_count\n number ||= 0\n end",
"def fork_check(wins, player, opponent)\n block_fork = find_fork(wins, opponent, player)\n get_fork = find_fork(wins, player, opponent)\n if get_fork.size > 0 # if possible to create fork, do it\n move = get_fork.sample\n elsif block_fork.size > 1 # if opponent can create multiple forks, force block\n move = get_adj(wins, player, opponent)\n elsif block_fork.size == 1 # otherwise if opponent can create fork, block it\n move = block_fork[0]\n else\n get_cen(player, opponent) # otherwise see if center is available\n end\n end",
"def find_forks(player)\n forks = []\n open_spaces = {}\n count_squares_and_moves(player) do |squares, moves|\n if squares == 1 && moves.length == 2\n moves.each do |move|\n forks << move if open_spaces[move]\n open_spaces[move] = true\n end\n end\n end\n forks\n end",
"def blockPoint(forks)\n # this keeps track of the tiles that each fork has in common\n # the most frequent and unoccupied index will be returned\n commonIndicies = forks[0] # initializing\n # intersect each of the forks to find a the tile they all depend on\n for i in 1 ... forks.size\n commonIndicies &= forks[i]\n end\n validPositions = commonIndicies.select {|i| !position_taken?(i)}\n # finds the most frequent index\n return validPositions.max_by {|i| validPositions.count(i)}\n end",
"def block_fork(board)\n if board.cells[0] == opponent_token && board.cells[8] == opponent_token\n return 2\n end\n if board.cells[2] == opponent_token && board.cells[6] == opponent_token\n return 2\n end\n if board.cells[5] == opponent_token && board.cells[7] == opponent_token\n return 3\n end\n end",
"def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend",
"def\tblock_fork()\n\t\tposition = 1\n\t\treturn position\n\tend",
"def fork_count\n ENV['OPAL_PREFORK_THREADS']&.to_i || (Etc.nprocessors * 3 / 4.0).ceil\n end",
"def fork_possible?(player)\n fork_index = nil\n existing_indexes = game.board.cells.each_index.select{ |i| game.board.cells[i] == player.token}\n empty_indexes = $empty_positions.to_a.map!{|i| i - 1}\n empty_indexes.detect{|test_index|\n existing_indexes << test_index\n winning_indexes = two_in_a_row?(player)\n existing_indexes.pop\n if winning_indexes.count >= 2\n fork_index = test_index\n return true\n end\n }\n return fork_index\n end",
"def check_for_fork\n @game.game.free_positions.each do |position|\n possible_game = @game.clone\n possible_game.game = @game.game.clone\n possible_game.game.board = @game.game.board.clone\n possible_game.game.set_position!(position,marker)\n return position if possible_fork?(possible_game)\n end\n false\n end",
"def forks\n repositories.map do |r|\n octokit.repository(r)['forks_count']\n end.inject(&:+)\n end",
"def get_fork_count(repo_id)\n forks_count = client.repository(repo_id).forks_count\n rescue Octokit::NotFound\n nil\n end",
"def discover_fork(ctoken, spaces, board)\n open_spaces = compile_open_spaces(spaces)\n\n # Cycle through open_spaces; temporarily add a token to spaces;\n # then determine if there are two instances of two computer tokens\n # in a row.\n avail = [] # array of fork-creating spaces, to maximize randomness of play\n open_spaces.each do |space|\n # assigns computer token to this empty space\n spaces[space] = ctoken\n # check if spaces now contains a fork!\n afork, length = are_there_two_computer_tokens_in_a_row(ctoken, spaces, board)\n spaces[space] = \" \"\n avail << space if length && length > 1 # add this space to array of fork-creating spaces\n end\n if ! avail.empty? # do this if there ARE available fork-creating spaces\n corners = avail.select {|x| [0, 2, 6, 8].include?(x)}\n return corners.sample if ! corners.empty? # gimme any corner blocker first\n return avail.sample # then other kinds of blockers\n end\n return false # if no forks were found\nend",
"def number_of_paths(n)\n return 0 if n < 0\n return 1 if n == 1 || n == 0\n number_of_paths(n - 1) + number_of_paths(n - 2) + number_of_paths(n - 3)\nend",
"def block_fork\n forks = find_forks(@opponent_mark)\n if forks.length == 1\n forks.first\n elsif forks.length > 1\n # We look at the center to determine which case this is\n if @board.square(1,1) == @computer_mark\n side\n else\n corner\n end\n else\n nil\n end\n end",
"def getStepCount(input1,input2,input3,input4)\n\tways = possible_moves(input1,input2,input3,input4)\n\tfound = true\n\tcount = 1\n\n\twhile found do\n\t temp = []\n\t\tways.each do |way|\n\t\t\tmoves = possible_moves(way.first,way.last,input3,input4)\n\t\t\tif moves.include?([input3,input4])\n\t\t\t\tfound = false\n\t\t\tend\n\t\t\tmoves.each {|arr| temp.push(arr) }\n\t\tend\n\t\tcount += 1\n\t\tways = temp\n\tend\n\tcount\nend",
"def fork\n find_forks(@computer_mark).first\n end",
"def parent(i); (i-1)/2; end",
"def number_of_parent_work(login=nil)\n count_by_frbr(login, :is_part_of, :how_many_works?) \n end",
"def num_steps(n)\n return 1 if n <= 1\n num_steps(n-1) + num_steps(n-2)\nend",
"def coast_guard_rank; end",
"def forking_moves(board, key)\n forking_moves =[]\n\n (0..2).each do |y|\n (0..2).each do |x|\n if board[y][x] == :_\n mutated_board = Marshal.load(Marshal.dump(board))\n mutated_board[y][x] = key\n mutated_winning_moves = winning_moves(mutated_board, key).uniq\n if mutated_winning_moves.count > 1\n forking_moves << mutated_winning_moves\n end\n end\n end\n end\n\n forking_moves.flatten\n \n end",
"def move count\n dir = count <0 ? 'in' : 'out' \n r= db.execute { \"select from ( traverse #{dir}(\\\"tg_grid_of\\\") from #{rrid} while $depth <= #{count.abs}) where $depth = #{count.abs} \" } \n if r.size == 1\n r.first\n else\n nil\n end\n end",
"def next_pid(tid)\n if(tid == THREAD_CNT)\n return 1\n else\n return tid+1\n end\nend",
"def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend",
"def process(n)\n foundpart = 0\n parts = []\n for i in 0..n-1 do # init participants ary\n parts.push 1\n end\n infolog {\"Starting, num-parts=#{n}\"}\n round = 0\n finished = false\n while !finished and round < @maxrounds\n round += 1\n numparts = parts.select{|it| it>0}.size\n infolog {\"ROUND ##{round}: num-parts=#{numparts}\"}\n deblog {\" parts=#{parts}\"}\n for i in 0..n-1 do\n if parts[i] > 0 and !finished\n for j in i+1..i+n do\n k = j % n\n #tracelog {\"k=#{k}\"}\n if parts[k] > 0\n parts[i] += parts[k]\n deblog {\"part##{i} steals from part#{k}: #{parts[k]} => #{parts[i]}\"}\n parts[k] = 0\n if parts[i] == n\n infolog {\"FINISHED at round##{round}, participant=#{i+1}\"}\n foundpart = i+1\n finished = true\n end\n break\n end\n end\n else\n tracelog {\"part##{i} has nothing, is skipped.\"} unless finished\n end\n end\n end\n foundpart\nend",
"def solve( n = 100 )\n n.partition_sieve[-1] - 1\n end",
"def determine_possible_num_moves(gm, rd, md)\n # puts \"Determining possible total moves...\" #NICE TO HAVE\n min = [ md[:max_val], rd[:num_regions] * 2 - 1 ].max\n max = gm[:x] * gm[:y]\n poss_ms = []\n for i in min..max do\n if i % rd[:num_regions] == 0 or (i + 1) % rd[:num_regions] == 0\n poss_ms.push(i)\n end\n end\n # puts \"poss_ms = \" + poss_ms.to_s #NICE TO HAVE\n return poss_ms\nend",
"def procession_position\n procession.index(self).to_i + 1\n end",
"def procession_position\n procession.index(self).to_i + 1\n end",
"def determine_possible_num_moves(gm, rd, md)\n puts \"Determining possible total moves...\"\n min = [ md[:max_val], rd[:num_regions] * 2 - 1 ].max\n max = gm[:x] * gm[:y]\n poss_ms = []\n for i in min..max do\n if i % rd[:num_regions] == 0 or (i + 1) % rd[:num_regions] == 0\n poss_ms.push(i)\n end\n end\n puts \"poss_ms = \" + poss_ms.to_s\n return poss_ms\nend",
"def minimum_jumps(arr)\n # two arrays. One to keep track of minimum number of jumps needed to reach\n # the position. The other to keep track of which index was needed to reach\n # a given index position.\n num_jumps = [0]\n jump_idx = [nil]\n # use two pointers, one being the destination index and the other\n # being which index to jump from to reach it.\n destination_idx = 1\n while destination_idx < arr.length\n current_idx = find_starting_idx(destination_idx, jump_idx)\n p [current_idx, destination_idx]\n # break the inner while loop once we find an answer\n while current_idx < destination_idx && num_jumps[destination_idx].nil?\n if can_jump?(arr, current_idx, destination_idx)\n num_jumps[destination_idx] = num_jumps[current_idx] + 1\n jump_idx[destination_idx] = current_idx\n end\n current_idx += 1\n end\n destination_idx += 1\n end\n p jump_idx\n num_jumps.last\nend",
"def position_result\n hurdle_match.rank.index(self) + 1\n end",
"def turn_count()\n count = 0\n index = 0\n loop do\n if position_taken?(index)\n count += 1\n end\n index += 1\n if index > 9 \n break\n end\n end\n return count\n end",
"def num_steps(n)\n # if n = 1\n # 1\n # elsif n = 2\n # 2\n # elsif n = 3\n # num_steps(1) + num_steps(2)\n # elsif n = 4\n # num_steps(2) + num_steps(3)\n # end\n if n < 3\n n\n else\n num_steps(n-2) + num_steps(n-1)\n end\nend",
"def num_steps(n)\n if n < 4\n initial = [1,2,4]\n return initial[n-1]\n else\n num_steps(n-1) + num_steps(n-2) + num_steps(n-3)\n end\nend",
"def pick(n,history)\n i = -1\n j = 0\n while j < (n + 1)\n i += 1\n j += 1 if history[i] == nil\n \n end\n \n return i\nend",
"def find_celebrity(n)\n current = 0\n while true\n next_person = (current + 1) % n\n while next_person != current && !knows(current, next_person)\n next_person = (next_person + 1) % n\n end\n if next_person == current\n 0.upto(n - 1) do |other|\n next if other == current\n return -1 unless knows(other, current)\n end\n return current\n end\n break if current == n - 1\n if next_person > current\n current = next_person \n else\n current += 1\n end \n end\n -1\nend",
"def n_steps(stairs)\n return 1 if stairs <= 1 \n count = 0\n count += n_steps(stairs - 1) + n_steps(stairs - 2)\nend",
"def paths(n)\n return nCr(2*(n-1),n)\nend",
"def possible_fork?(game_state)\n possible_wins = 0\n Game::LINES.each do |winning_line|\n markers = winning_line.group_by {|position|game_state.game.board[position]}\n if markers[marker] and markers[marker].length == 2 and markers.keys.include?(nil)\n possible_wins += 1\n end\n return true if possible_wins == 2\n end\n\n false\n end",
"def step_number visit_path, dst, limits, condition=nil\n return route(visit_path, dst, limits, UNTIL).first.nodes.length - 1\n end",
"def problem_76\n return 100.partitions - 1\nend",
"def numberOfSteps(steps, m)\n ((steps/2 + steps%2)..steps).find{ |n| n%m==0 } || -1\nend",
"def get_next_moves\n children = Array.new()\n new_move = @moves + 1\n @code.length.times do |i|\n move_up = Combination.new(next_code(i, :up), self, new_move)\n move_down = Combination.new(next_code(i, :down), self, new_move)\n children.push(move_down, move_up)\n end\n children\n end",
"def problem(nth = 6,i = 13)\n while nth < 10001\n i += 2\n nth += 1 if i.prime?\n end\n i\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def number_of_steps\n case current_instruction.opcode\n when 3, 4\n 2\n else\n 4\n end\n end",
"def nst_prime(n)\n\ti , count = 1, 0\n\tloop do\n\t\ti += 1\n\t\tcount += 1 if is_prime?(i)\n\t\tcount == n and return i\n\tend\nend",
"def minimumBribes(q)\r\n moves = 0\r\n r = (0..q.size-1).to_a\r\n\r\n until q == (1..q.size).to_a do\r\n q.map { |a| a - 1 }\r\n .reverse_each.with_index do |person, i|\r\n i = q.size - i - 1\r\n if person - i > 2\r\n puts \"Too chaotic\"\r\n return\r\n end\r\n\r\n if person > r[i] && person > q[person] -1\r\n moves += person - r[i]\r\n q = q - [person + 1]\r\n q.insert(person, person + 1)\r\n end\r\n end\r\n end\r\n\r\n puts moves\r\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def min_ops(n)\n\n # Step 1:\n # Create a table containing the minimum operations\n # needed to reach n given our permitted operators.\n all_parents = Array.new\n all_min_ops = [0] + [nil] * n\n\n (1..n+1).each do |k|\n curr_parent = k - 1\n curr_min_ops = all_min_ops[curr_parent] + 1\n [2, 3].each do |i|\n if k % i == 0\n parent = k / i\n num_ops = all_min_ops[parent] + 1\n if num_ops < curr_min_ops\n curr_parent, curr_min_ops = parent, num_ops\n end\n end\n end\n all_parents[k], all_min_ops[k] = curr_parent, curr_min_ops\n end\n\n # Step 2: Trace back to find the optimal choices\n # made in the previous step.\n numbers = Array.new\n k = n\n while k > 0\n numbers << k\n k = all_parents[k]\n end\n puts numbers.size - 1\n numbers.reverse\nend",
"def stepPerms(n)\n return 0 if n < 0\n return 1 if n == 0\n \n stepPerms(n - 1) + stepPerms(n - 2) + stepPerms(n - 3)\nend",
"def calculate_programs_move(stones)\r\n\t\tmodulus = stones % 3\r\n\t\treturn 2 if modulus == 0\r\n\t\treturn 1 if modulus != 0\r\n\tend",
"def next_child_index (returning_fei)\n\n next_id = if returning_fei.is_a?(Integer)\n returning_fei + 1\n elsif returning_fei == self.fei\n 0\n else\n returning_fei.child_id.to_i + 1\n end\n\n loop do\n\n break if next_id > raw_children.length\n\n raw_child = raw_children[next_id]\n\n return next_id \\\n if raw_child.is_a?(Array) or raw_child.is_a?(FlowExpressionId)\n\n next_id += 1\n end\n\n nil\n end",
"def transform_root_forks(forks, moves)\n fork_stack = [{ 'te' => 0, 'moves' => moves }]\n forks.each do |f|\n now_fork = f\n fork = fork_stack.pop\n fork = fork_stack.pop while fork['te'] > now_fork['te']\n move = fork['moves'][now_fork['te'] - fork['te']]\n move['forks'] ||= []\n move['forks'] << now_fork['moves']\n fork_stack << fork\n fork_stack << now_fork\n end\n end",
"def select_computer_move\n data_of_matched_nodes = []\n\n #\n # identify children nodes where @score value equals parent node @score value\n # identical values = best next move\n #\n @children.each do |n|\n if n.score == @score\n data_of_matched_nodes << n.data[1]\n end\n end\n\n\n #\n # randomly select next move data\n # Identical min/max scores could exist\n #\n next_move_data = randomly_select(data_of_matched_nodes)\n \n\n #\n # return next move value\n # @data[1] represents current data of parent node\n # next_move_data represents child node data\n # subtract the two to get next move value\n #\n return next_move_data - @data[1]\n end",
"def num_chains(lattice, diagram)\n chain_count = 0\n for x in lattice do\n if lattice.upper_covers[x].count == 1 then\n parent_x = lattice.upper_covers[x].first\n for child_x in lattice.lower_covers[x] do\n if lattice.upper_covers[child_x].count == 1 then\n parent_point = diagram.points[parent_x]\n x_point = diagram.points[x]\n child_point = diagram.points[child_x]\n dv = x_point - parent_point\n du = child_point - x_point\n if dv.x == du.x && dv.y == du.y then\n chain_count += 1\n end\n end\n end\n end\n end\n return chain_count\nend",
"def toh(n, source, destination, intermediate, count = 1)\n if n == 1\n puts \"(#{count} move) #{source} to #{destination}\"\n count = count + 1\n elsif n > 1\n count = toh(n-1, source, destination, intermediate, count)\n count = toh(1, source, intermediate, destination, count)\n count = toh(n-1, intermediate, destination, source, count)\n end\nend",
"def count_matches( n )\n i = 1\n p = n\n while p.to_s.size == i\n p *= n\n i += 1\n end\n i - 1\n end",
"def solution(n)\n siblings = n.to_s.chars.each_slice(1).to_a\n siblings.sort {|x,y| -(x <=> y)}.join.to_i\nend",
"def comb_select()\r\n\tmin_runner = 10\r\n\tmax_runner = 100\r\n\tgreater_than = 1000000\r\n\tcounter = 0\r\n\t\r\n\tfor runner in (min_runner..max_runner)\r\n\t\trun_f = factorial(runner)\r\n\t\tmin_select = (runner/4).to_i\r\n\t\tfor selection in (2..runner-1)\r\n\t\t\tdivider = factorial(selection) * factorial(runner - selection)\r\n\t\t\tcounter += 1 if run_f / divider > greater_than\r\n\t\tend\r\n\tend\r\n\treturn counter\r\nend",
"def total_node_number_cps(tree)\n callcc{|cc|\n helper_2(tree.root, cc, 0)\n }\nend",
"def segment_count\n children.map(&:segment_count).inject(:+).to_i + 2\n end",
"def idx_children(parent_i)\n [parent_i * 2 + 1, parent_i * 2 + 2]\n end",
"def pos_nth_prime(ele, n)\n i = ele \n counter = 0\n\n while counter < n\n i += 1\n if is_prime?(i)\n counter += 1\n end\n # if counter == n\n # return i\n # end\n end\n\n return i\nend",
"def count_clumps(*args)\n count = 0\n 1.upto(args.length - 1) do |i|\n current = args[i]\n left = args[i - 1]\n i == args.length - 1 ? right = nil : right = args[i + 1]\n count += 1 if (current == left) and (right != left)\n end\n count\nend",
"def handle_forks!\n fork_found = false\n @possibilities.each_with_index do |row, i|\n break if fork_found\n row.each_with_index do |cell, j|\n break if fork_found\n if @possibilities[i][j].length > 1\n fork_found = true\n solutions = @possibilities[i][j].map do |possibility|\n new_board = @board.map(&:clone)\n new_board[i][j] = possibility\n sudoku = Sudoku.new(new_board)\n sudoku.solve!\n @solutions += sudoku.solutions unless sudoku.status == :impossible\n end\n end\n end\n end\n end",
"def goldbach(n)\n a = (2..n-1).primes.find { |a| is_prime(n - a) }\n [a, n - a]\nend",
"def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end",
"def cantidadPrimosRango(rangoInicial, rangoFinal)\n contador = 0\n x = rangoInicial\n y = rangoFinal\n if x >= 4\n z = x - 1\n else\n z = x\n end\n for i in z..y\n if y % i == 0\n contador = contador + 1\n end\n end\n return contador\nend",
"def fork(board, sym = @symbol)\n\t\tfake_board = board\n\t\t(0..2).each do |i|\n\t\t\trow = [fake_board[i * 3], fake_board[(i * 3) + 1], fake_board[(i * 3) + 2]]\n\t\t\tif only_one_mark?(sym, row)\n\t\t\t\t# delete mark from board so that it doesn't get counted again in columns\n\t\t\t\tk = row.find_index(sym.to_s)\n\t\t\t\tdel = board_pos(i, k)\n\t\t\t\t(0..2).each do |j|\n\t\t\t\t\tcolumn = [fake_board[j], fake_board[j + 3], fake_board[j + 6]]\n\t\t\t\t\tif only_one_mark?(sym, column)\n\t\t\t\t\t\tmove = board_pos(i, j)\n\t\t\t\t\t\treturn move if board[move] == \" \" && move != del\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def number( gm )\n num = nil\n gm.players.each_with_index{|pl, i| num = i if (pl == self) }\n (num + 1) if num.is_a? Integer\n end",
"def count_ways_up_stairs(steps)\n return 0 if steps < 0\n return steps if steps <= 2\n\n paths = []\n paths[0] = 1\n paths[1] = 1\n paths[2] = 2\n\n (3...steps).each do |i|\n count = paths[0] + paths[1] + paths[2]\n paths[0] = paths[1]\n paths[1] = paths[2]\n paths[2] = count\n end\n\n paths[2]\nend",
"def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"def get_closest_prime(num, n)\n count = n.abs\n i = 1\n if n < 0\n i = -i\n end\n candidate = num + i\n\n while count > 0\n if prime?(candidate)\n count -= 1\n prime = candidate\n candidate += i\n else\n candidate += i\n return nil if candidate < 2\n end\n end\n # return nil if prime < 2\n prime\nend",
"def find(parent, n)\n return n if n == parent[n]\n\n parent[n] = find(parent, parent[n])\n parent[n]\nend",
"def climb_stairs(n)\n prev_count = curr_count = 1\n (n - 1).times do\n temp = curr_count\n curr_count += prev_count\n prev_count = temp\n end\n curr_count\nend",
"def children\n potential_moves = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |ele, j|\n pos = [i, j]\n potential_moves << pos if @board.empty?(pos)\n end\n end\n \n new_mark = self.switch_mark\n potential_moves.map! do |pos|\n new_board = @board.dup \n new_board[pos] = next_mover_mark\n self.class.new(new_board, new_mark, pos)\n end\n \n return potential_moves\n end",
"def findPrime(n)\n i = 1\n count = 0\n while count < n\n if isPrime(i)\n count += 1\n if count == n\n return i\n end\n end\n i += 1\n end\n return -1\nend",
"def find_nb(m)\n sum = 0\n x = 1\n while true\n sum += x ** 3\n if sum == m\n return x\n elsif sum > m\n return -1\n end\n x += 1\n end\nend",
"def spawn_sleepers(exp, cookie)\n Thread.new { system \"ruby test/fork_tree.rb -- #{exp} 100 #{cookie}\" }\n on_windows = RUBY_PLATFORM =~ /win/ && RUBY_PLATFORM !~ /darwin/\n sleep on_windows ? 0.5 : 0.1\n pid_file = \"#{cookie}.pid\"\n @pid_files ||= []\n @pid_files << pid_file\n pid = File.read(pid_file).to_i\n sleep on_windows ? 0.4 : 0.5\n return pid\n end",
"def path_count(steps, current=0)\n if current == steps\n 1\n elsif current > steps\n 0\n else\n path_count(steps, current + 1) +\n path_count(steps, current + 2) +\n path_count(steps, current + 3)\n end\nend",
"def find_nb(m)\nindex=sum=0\n while sum < m\n sum+=index**3\n return index if sum == m\n index+=1\n end\n-1\nend",
"def min_child_group list_of_children_age\r\n\tt1 = Time.now\r\n\tgroups = []\r\n\tindex_chk = 0\r\n\tsub_group = []\r\n\tlist_of_children_age.each_with_index do |arr, index|\r\n\t\tif list_of_children_age[index] - list_of_children_age[index_chk] < 1 \r\n\t\t\tsub_group << list_of_children_age[index]\r\n\t\t\tif (list_of_children_age.length - 1) == index\r\n\t\t\t\tgroups << sub_group\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tgroups << sub_group\r\n \t\tsub_group = [list_of_children_age[index]]\r\n\t\t\tindex_chk = index\r\n\t\tend\r\n\tend\r\n\tt2 = Time.now\r\n\tp \"Numbers of group : #{groups.length}\"\r\n\tp \"Time taken : #{t2 -t1} \"\r\nend",
"def calc_child_rank (child_node)\n if child_node.successor\n child_node.successor.rank - 1\n else\n 0\n end\n end",
"def brute_resolve(num)\n while num != 1 && num != 89 do\n num = shrink num\n end\n num\nend",
"def calculate_g(neighbor)\n total_g = 0\n branching_dup = dup_hash(@branching_paths)\n loop do\n parent = branching_dup[neighbor]\n if diagonal_move?(parent, neighbor)\n total_g += 14\n else\n total_g += 10\n end\n break if neighbor == @maze.find_start\n neighbor = parent\n end\n total_g\n end",
"def nchooser(n, r)\n\n (1..n).reduce(:*) / ( (1..r).reduce(:*) * (1..(n-r)).reduce(:*) )\n\nend",
"def number_counting_seq(n)\r\n\r\nend",
"def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @original_state.size && @second_index + 1 >= @original_state.size\n @operation = :nop\n end\n else\n if @first_index + 1 < @original_state.size\n @first_index += 1\n else\n @first_index = 0\n @operation = @operation == :fill ? :empty : :pour\n end\n end\n end",
"def findPrincessPosition(n, grid)\n return calculate_position_coordinates(n, grid, 'p')\nend",
"def fork_positions\n board = @board.clone\n positions = []\n\n board.blanks.each do |blank_position|\n board.place_move(blank_position, @play_symbol)\n\n if win_positions(board).size >= 2\n positions << blank_position\n end\n\n board.undo_move(blank_position)\n end\n\n positions\n end",
"def problem_77\n primes = Primes.upto(120)\n\n # num is the value we want and\n # off is the index in primes to use next\n hits = 0\n solve = lambda do |num, off|\n return 1 if num == 0\n return 0 if num == 1\n ret = 0\n p = primes[off]\n ret += 1 if num % p == 0 # Add if a multiple\n ret += solve.call(num,off-1) if off > 0 \n n = num / p\n if n > 0 # Do each multiple\n 1.upto(n) do |i|\n left = num - i*p\n ret += solve.call(left,off-1) if off > 0 && left > 1\n end\n end\n ret\n end\n\n #(2..100).each do |num|\n num = 0\n (2..100).each do |num|\n off = primes.index {|i| i > num } - 1\n hits = solve.call(num,off)\n puts \"#{num} => #{hits}\"\n return num if hits >= 5000\n end\nend",
"def parent(index)\n (index.to_f / 2).ceil - 1\n end",
"def block_fork(board)\n\t\treturn fork(board, opponent_symbol(@symbol))\n\tend",
"def fork_repo(src)\n response = HTTParty.post(\n GIT_BASE_URL + 'projects/fork/' + src.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => self.git_token\n }\n )\n Rails.logger.info \"Git server response (fork repo): #{response}\"\n if response.has_key? 'id'\n return response['id']\n end\n -1\n end",
"def next_step position, tabu_list\n paths = get_all_paths_from position, tabu_list\n probabilities = paths.map {|path| probability(path.first, path.last, 0, tabu_list)}\n path_probabilities = paths.zip probabilities\n picked_number = rand\n\t path_probabilities.each { |pair|\n\t path = pair.first\n\t prob = pair.last\n\t\t picked_number -= prob\n\t\t return path.last if picked_number <= 0.0\r\n\t }\n end"
] | [
"0.7214283",
"0.67108524",
"0.6621591",
"0.65560275",
"0.6528573",
"0.635649",
"0.6356065",
"0.6356065",
"0.6188072",
"0.60513544",
"0.6030303",
"0.5945687",
"0.5834187",
"0.5826054",
"0.57539535",
"0.572253",
"0.5696886",
"0.56904507",
"0.5681871",
"0.562731",
"0.55833095",
"0.55613",
"0.55566055",
"0.5534004",
"0.55265725",
"0.5520624",
"0.55021405",
"0.5492689",
"0.5492284",
"0.54842216",
"0.54842216",
"0.54734063",
"0.5468213",
"0.54669064",
"0.5457889",
"0.5433862",
"0.542917",
"0.5419609",
"0.53797364",
"0.5379111",
"0.5378691",
"0.53733647",
"0.5355034",
"0.5349648",
"0.5342558",
"0.5335666",
"0.5331548",
"0.53164804",
"0.53164804",
"0.53164804",
"0.5315665",
"0.5311498",
"0.5295981",
"0.5280391",
"0.5276753",
"0.5276426",
"0.5259713",
"0.5257583",
"0.5252436",
"0.52465487",
"0.5243239",
"0.52422607",
"0.52378315",
"0.52275014",
"0.5225315",
"0.52205956",
"0.5219489",
"0.52104634",
"0.5203717",
"0.52025825",
"0.5199364",
"0.51749307",
"0.5164266",
"0.51629627",
"0.5158526",
"0.5143982",
"0.5142031",
"0.51356745",
"0.513445",
"0.5129424",
"0.5129328",
"0.5122445",
"0.5120904",
"0.51199454",
"0.51194715",
"0.5118277",
"0.5113443",
"0.51105064",
"0.5096586",
"0.50839216",
"0.50767213",
"0.5074288",
"0.50721097",
"0.5065738",
"0.5061599",
"0.5057878",
"0.505674",
"0.505575",
"0.5053221",
"0.50505555"
] | 0.72230446 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_health19
@health19 = Health19.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 setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\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 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 workflow\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 default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.5332605",
"0.5312215",
"0.5296594",
"0.52965283",
"0.52957606",
"0.5259903",
"0.52443177",
"0.523896",
"0.523896",
"0.523896",
"0.523896",
"0.523896",
"0.52329034",
"0.52322394",
"0.5227445",
"0.5222394",
"0.5220348",
"0.5212759",
"0.5207747",
"0.5205933",
"0.5176468",
"0.5173833",
"0.5171983",
"0.51663405",
"0.5159596",
"0.5158247",
"0.51526845",
"0.5152398",
"0.5151361",
"0.5145775",
"0.5140135",
"0.51338995",
"0.51127726",
"0.5112607",
"0.5112607",
"0.5110613",
"0.51067513",
"0.5092337",
"0.508788",
"0.5081578",
"0.5080434",
"0.50679874",
"0.50567716",
"0.5051213",
"0.5048352",
"0.5048352",
"0.5035347",
"0.5026666",
"0.5023127",
"0.5016081",
"0.50129867",
"0.5000684",
"0.4999752",
"0.49979812",
"0.499026",
"0.499026",
"0.49866846",
"0.49800366",
"0.49795717",
"0.49771172",
"0.4968475",
"0.4965813",
"0.4958072",
"0.49561292",
"0.4954901",
"0.49536785",
"0.4953058",
"0.49468648",
"0.49424478",
"0.4932989",
"0.49291888",
"0.49273813",
"0.49271655",
"0.4925948",
"0.49236968",
"0.49203572",
"0.49181753",
"0.49173692",
"0.4916862",
"0.49161318",
"0.49155986"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def health19_params
params.require(:health19).permit(:Districts, :Target, :Selection, :Year)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\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",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\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 params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def parameters\n nil\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] | [
"0.7120904",
"0.70538116",
"0.69469863",
"0.6901261",
"0.67348766",
"0.6717708",
"0.66874576",
"0.6676195",
"0.66601187",
"0.65563625",
"0.6525127",
"0.64565873",
"0.64494514",
"0.644928",
"0.64452374",
"0.6433947",
"0.6412815",
"0.6412815",
"0.6391939",
"0.63792473",
"0.63792473",
"0.63738",
"0.6360176",
"0.6354222",
"0.6284756",
"0.6277987",
"0.6245304",
"0.62259704",
"0.62243503",
"0.6223834",
"0.62104595",
"0.62081766",
"0.61759263",
"0.61721593",
"0.6168236",
"0.61587787",
"0.6143901",
"0.6135065",
"0.61204714",
"0.61065775",
"0.60983306",
"0.6073666",
"0.6051939",
"0.6040974",
"0.6036216",
"0.60291374",
"0.6020614",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.60180086",
"0.6017416",
"0.60161096",
"0.6006702",
"0.6002367",
"0.600212",
"0.5996321",
"0.59943277",
"0.59942585",
"0.59858114",
"0.5982845",
"0.59766084",
"0.5973769",
"0.5968758",
"0.59653395",
"0.5964966",
"0.5964966",
"0.5957481",
"0.59511584",
"0.5951042",
"0.5948871",
"0.59427315",
"0.5930573",
"0.5930121",
"0.5926885",
"0.5923959",
"0.59182686",
"0.5916637",
"0.5913613",
"0.5912174",
"0.5906678",
"0.59059656",
"0.5904252",
"0.5901623",
"0.58983696",
"0.58962476",
"0.589576",
"0.5893608"
] | 0.0 | -1 |
GET /job_applications GET /job_applications.json | def index
if current_user.admin?
@new = JobApplication.where(state: @state)
@vacancies = Vacancy.all
else
@job_assignments = JobAssignment.where(manager_id: current_user.id, reviewed: false)
end
respond_to do |format|
format.html # show.html.erb
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @job_applications = JobApplication.all\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def applications_list\n get \"applications\"\n end",
"def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end",
"def index\n @job_applications = @job_applications_active\n end",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end",
"def index\n @job_site_applications = JobSiteApplication.all\n end",
"def show\n @application = Application.find(params[:id])\n \n if @application.nil? or @application.job.nil?\n redirect_to \"/\", :alert=>\"You do not have access to this page\"\n return false\n end\n\n return unless appAccess?(@application.job.id)\n\n @job = @application.job\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end",
"def index\n if current_user.admin?\n @job_applications = JobApplication.all\n else\n @job_applications = JobApplication.where(job: Job.where(user: current_user.company.users))\n end\n @job_applications = @job_applications.where(status: params[:status]) if params[:status].present?\n @job_applications = @job_applications.where(response_status: params[:response_status]) if params[:response_status].present?\n @job_applications = @job_applications.where(job: Job.find(params[:job])) if params[:job].present?\n end",
"def index\n @user=current_user\n @jobapplications = @user.jobapplications\n end",
"def index\n jobs = current_user.hr.jobs\n @applications = Array.new\n jobs.each do |job|\n job_faculties_map = Hash.new\n job_faculties_map[job] = Array.new\n if job.faculties.length > 0\n job.faculties.each do |faculty|\n job_faculties_map[job] << faculty\n end\n @applications << job_faculties_map\n end\n end\n @applications\n end",
"def index\n if current_user.role == 'employee'\n @job_applications_made = current_user.employee.job_applications\n else\n @job_applications = JobApplication.all\n end\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end",
"def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend",
"def index\n @job_applications = JobApplication.for_status params[:status_type]\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end",
"def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def get_applications\n http_get_request(Scalarium.applications_url)\n end",
"def get_applications_of_project\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:project_id => Project.find_by_id(param[:id]))\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end",
"def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end",
"def get_applications_of_user\n respond_to do |format|\n format.json {\n @project_applications = ProjectApplication.where(:user_id => @current_user.id)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend",
"def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index # testing purposes only\n applications = Application.includes(:user).all\n\n render json: applications\n end",
"def index\n respond_with @applications = Application.all\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end",
"def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end",
"def index\n @jobs = Job.all\n if current_role == :admin\n @applications = Application.all\n elsif current_role == :recruiter\n @applications = Application.all.select{|n| @jobs.exists?(n.job_id) && @jobs.find(n.job_id).company_id == current_user.company_id}\n else\n @applications = Application.all.select{|n| n.user_id==current_user.id}\n end\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"def show\n @other_job_applications = @job_application.user.job_applications.where.not(id: @job_application.id)\n render layout: request.xhr? ? false : \"admin/simple\"\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end",
"def show\n @job_applications = @job_offer.job_applications.group_by(&:state)\n end",
"def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend",
"def index\n @user_apps = UserApp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_apps }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end",
"def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end",
"def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def applications\n get(PLURAL_PATH, RESOURCE)\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def application(job,params={})\n if (@application[extract_job(job)] && !params[:force])\n return @application[extract_job(job)]\n end\n @application[extract_job(job)] = get_application(job)\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def index\n @applications = Application.all\n end",
"def show\n \n @job = Job.find(params[:id])\n @application = Application.find(:first,:conditions=>['job_id=? and user_id=?',@job.id,current_user.id]) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end",
"def show\n # @applicant_job_history = ApplicantJobHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant_job_history }\n end\n end",
"def index\n @client_applications = ClientApplication.all\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @job_applications = JobApplication.all\n @posts = Post.all\n end",
"def create\n @jobapp = Jobapp.new(jobapp_params)\n\n if @jobapp.save\n flash[:success] = \"Jobapp was successfully created.\"\n redirect_to action: \"index\"\n else\n @jobapps = Jobapp.all\n\n render :new, locals: {jobapp: @jobapp,jobapps: @jobapps}\n end\n end",
"def create\n @job_application = JobApplication.new(params[:job_application])\n @users = User.find :all\n @job_postings = JobPosting.find :all\n \n respond_to do |format|\n if @job_application.save\n flash[:notice] = 'JobApplication was successfully created.'\n format.html { redirect_to(@job_application) }\n format.xml { render :xml => @job_application, :status => :created, :location => @job_application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def index\n @applicant_jobs = ApplicantJob.all\n end",
"def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if current_user.admin\n @planning_applications = PlanningApplication.all\n else\n @planning_applications = current_user.planning_applications\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @planning_applications }\n end\n end",
"def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.html.erb\n format.json { render json: @application }\n end\n end",
"def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end",
"def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end",
"def index\n $lmc_left_menu = \"lmw_all_jobs\"\n $lmc_subleft_menu = \"lmw_job_applications\"\n @user = current_user\n @job_applications_ids = current_user.job_applications.pluck(:job_id)\n @job_applications = Job.where(id: @job_applications_ids).text_search(params[:query], params[:town], params[:status])\n end",
"def show\n @vacancy = Vacancy.find(params[:id])\n @new = JobApplication.where(state: \"send\", vacancy_id: @vacancy.id).includes(:user)\n @forwarded = JobApplication.where(state: \"manager_review\", vacancy_id: @vacancy.id).includes(:user)\n @reviewed = JobApplication.where(state: \"manager_review_listed\", vacancy_id: @vacancy.id).includes(:user)\n @employed = JobApplication.where(state: \"employed\", vacancy_id: @vacancy.id).includes(:user)\n @rejected = JobApplication.where(state: \"rejected\", vacancy_id: @vacancy.id).includes(:user)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def find_kapp_webhook_jobs(kapp_slug, params={}, headers=default_headers)\n @logger.info(\"Finding webhook jobs in the \\\"#{kapp_slug}\\\" Kapp\")\n get(\"#{@api_url}/kapps/#{kapp_slug}/webhookJobs\", params, headers)\n end",
"def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end",
"def show\n @application = Application.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end",
"def show\n render json: @job\n end",
"def show\n render json: @job\n end",
"def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end"
] | [
"0.7649894",
"0.764502",
"0.7387177",
"0.73761916",
"0.7342064",
"0.7204362",
"0.7185809",
"0.7047377",
"0.7020832",
"0.70059836",
"0.6856699",
"0.68265283",
"0.68219966",
"0.6801303",
"0.6795594",
"0.6754994",
"0.67336607",
"0.67336607",
"0.672512",
"0.67169476",
"0.67136806",
"0.6697716",
"0.6677746",
"0.6669978",
"0.6618118",
"0.6612568",
"0.66002053",
"0.65791374",
"0.6574756",
"0.6509809",
"0.6483647",
"0.6470174",
"0.64592236",
"0.6447486",
"0.6426561",
"0.64246017",
"0.64227676",
"0.64222014",
"0.6399091",
"0.63741344",
"0.6360185",
"0.6360185",
"0.6360185",
"0.6360185",
"0.6360185",
"0.6360185",
"0.6360185",
"0.6355318",
"0.6353967",
"0.6353967",
"0.63410056",
"0.63360125",
"0.6332732",
"0.6297739",
"0.6294547",
"0.6291352",
"0.62875706",
"0.62869674",
"0.6276377",
"0.6264377",
"0.62528515",
"0.6245957",
"0.6242815",
"0.6238095",
"0.6238095",
"0.6238095",
"0.6238095",
"0.62100667",
"0.6199919",
"0.619839",
"0.61905",
"0.61896265",
"0.61795616",
"0.6147307",
"0.6139489",
"0.61387336",
"0.61322206",
"0.6121927",
"0.61142814",
"0.6104679",
"0.6102175",
"0.6100711",
"0.6091134",
"0.60733855",
"0.60733855",
"0.6068806",
"0.6067896",
"0.60648894",
"0.6060771",
"0.60550916",
"0.60519403",
"0.6050781",
"0.6050699",
"0.60434586",
"0.60433775",
"0.6042249",
"0.6042249",
"0.6037681",
"0.60324806",
"0.60324806",
"0.6024677"
] | 0.0 | -1 |
GET /job_applications/1 GET /job_applications/1.json | def show
@vacancy = Vacancy.find(params[:id])
@new = JobApplication.where(state: "send", vacancy_id: @vacancy.id).includes(:user)
@forwarded = JobApplication.where(state: "manager_review", vacancy_id: @vacancy.id).includes(:user)
@reviewed = JobApplication.where(state: "manager_review_listed", vacancy_id: @vacancy.id).includes(:user)
@employed = JobApplication.where(state: "employed", vacancy_id: @vacancy.id).includes(:user)
@rejected = JobApplication.where(state: "rejected", vacancy_id: @vacancy.id).includes(:user)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @job_application }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @job_applications = JobApplication.all\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end",
"def index\n @job_applications = @job_applications_active\n end",
"def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end",
"def show\n @application = Application.find(params[:id])\n \n if @application.nil? or @application.job.nil?\n redirect_to \"/\", :alert=>\"You do not have access to this page\"\n return false\n end\n\n return unless appAccess?(@application.job.id)\n\n @job = @application.job\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application }\n end\n end",
"def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def show\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def index\n @job_site_applications = JobSiteApplication.all\n end",
"def index\n @job_applications = JobApplication.for_status params[:status_type]\n end",
"def index\n @user=current_user\n @jobapplications = @user.jobapplications\n end",
"def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end",
"def index\n if current_user.admin?\n @job_applications = JobApplication.all\n else\n @job_applications = JobApplication.where(job: Job.where(user: current_user.company.users))\n end\n @job_applications = @job_applications.where(status: params[:status]) if params[:status].present?\n @job_applications = @job_applications.where(response_status: params[:response_status]) if params[:response_status].present?\n @job_applications = @job_applications.where(job: Job.find(params[:job])) if params[:job].present?\n end",
"def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end",
"def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end",
"def applications_list\n get \"applications\"\n end",
"def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def getApplications(ak)\n uri='https://api.newrelic.com/v2/applications.json'\n parseUrl=URI.parse(uri)\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend",
"def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def get_applications_of_project\n respond_to do |format|\n param = params[:payload]\n format.json {\n @project_applications = ProjectApplication.where(:project_id => Project.find_by_id(param[:id]))\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end",
"def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end",
"def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end",
"def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applications }\n end\n end",
"def index\n if current_user.role == 'employee'\n @job_applications_made = current_user.employee.job_applications\n else\n @job_applications = JobApplication.all\n end\n end",
"def index\n jobs = current_user.hr.jobs\n @applications = Array.new\n jobs.each do |job|\n job_faculties_map = Hash.new\n job_faculties_map[job] = Array.new\n if job.faculties.length > 0\n job.faculties.each do |faculty|\n job_faculties_map[job] << faculty\n end\n @applications << job_faculties_map\n end\n end\n @applications\n end",
"def show\n # @applicant_job_history = ApplicantJobHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant_job_history }\n end\n end",
"def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n \n @job = Job.find(params[:id])\n @application = Application.find(:first,:conditions=>['job_id=? and user_id=?',@job.id,current_user.id]) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.html.erb\n format.json { render json: @application }\n end\n end",
"def show\n @program_app = ProgramApp.find(params[:id])\n\n respond_to do |format|\n format.json do\n render json: @program_app\n end\n end\n end",
"def show\n @applications_application = ApplicationsApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applications_application }\n end\n end",
"def show\n @other_job_applications = @job_application.user.job_applications.where.not(id: @job_application.id)\n render layout: request.xhr? ? false : \"admin/simple\"\n end",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end",
"def find_job(job_id)\n response = HTTParty.get(\"#{@host}/api/jobs/#{job_id}\")\n\n return response['job']\n end",
"def get_applications_of_user\n respond_to do |format|\n format.json {\n @project_applications = ProjectApplication.where(:user_id => @current_user.id)\n if @project_applications\n render :json => @project_applications\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end",
"def get_job_status id\n response = get \"http://#{@host}/loadbalancers/tenant/#{@tenant}/jobs/#{id}\"\n raise LBModelException.new \"Expected HTTP 200 but got #{response.code} instead\" unless response.code == 200\n\n JSON.parse(response)\n end",
"def show\n render json: @job\n end",
"def show\n render json: @job\n end",
"def show\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_active_job }\n end\n end",
"def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end",
"def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def job_get(organization, jobid)\n uri = server_uri(\"/organizations/#{organization}/jobs/#{jobid}\")\n res_data = api_get(uri)\n @logger.debug res_data\n\n return res_data\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def show\n @device = Device.find(params[:device_id])\n @job = @device.jobs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end",
"def index\n @jobs = Job.all\n if current_role == :admin\n @applications = Application.all\n elsif current_role == :recruiter\n @applications = Application.all.select{|n| @jobs.exists?(n.job_id) && @jobs.find(n.job_id).company_id == current_user.company_id}\n else\n @applications = Application.all.select{|n| n.user_id==current_user.id}\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_compact }\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_job_info(page)\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs?page=#{page}&per_page=#{PER_PAGE}\"\n begin\n response = RestClient::Request.new(\n :method => :get,\n :url => job_api,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n response.headers\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"jobs info error: #{err.response}\"\n return nil\n end\nend",
"def application(job,params={})\n if (@application[extract_job(job)] && !params[:force])\n return @application[extract_job(job)]\n end\n @application[extract_job(job)] = get_application(job)\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end",
"def show\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_job }\n end\n end",
"def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end",
"def create\n @jobapp = Jobapp.new(jobapp_params)\n\n if @jobapp.save\n flash[:success] = \"Jobapp was successfully created.\"\n redirect_to action: \"index\"\n else\n @jobapps = Jobapp.all\n\n render :new, locals: {jobapp: @jobapp,jobapps: @jobapps}\n end\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n add_breadcrumb @job_application, @job_application\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def create\n @application = Application.new(params[:application])\n @application.job = Job.find(params[:id])\n respond_to do |format|\n if @application.save\n format.html { redirect_to '/', notice: 'Application was received.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if current_user.is_admin\n @applications = Application.all\n puts @applications\n elsif current_user.is_seeker\n @applications = Application.where(jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id)\n elsif current_user.is_biz\n @applications = Application.where(job_id: Job.where(bizowner_id: Bizowner.find_by(user_id: current_user.id).id))\n end\n end",
"def index\n @applicant_jobs = ApplicantJob.all\n end",
"def show\n @job_applications = @job_offer.job_applications.group_by(&:state)\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to job_applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to job_applications_url }\n format.json { head :no_content }\n end\n end",
"def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def create\n @job = Job.find(params[:job_id])\n @application = Application.new(application_params)\n @application.job = @job\n @application.user = current_user\n\n if @application.save\n redirect_to developers_applications_path\n else\n redirect_to job_path(@job)\n end\n end",
"def applications\n Application.from session.get 'operations/application', API_V1\n end"
] | [
"0.73992616",
"0.7387969",
"0.7181728",
"0.716288",
"0.70688754",
"0.705798",
"0.6846004",
"0.6846004",
"0.6843619",
"0.6792671",
"0.67818606",
"0.67695767",
"0.67623425",
"0.6675928",
"0.6674146",
"0.66518587",
"0.66145766",
"0.6613072",
"0.6604981",
"0.6604981",
"0.6604981",
"0.6604981",
"0.6604981",
"0.6604981",
"0.6604981",
"0.65901273",
"0.6583199",
"0.65771806",
"0.65771806",
"0.655531",
"0.65489894",
"0.6488651",
"0.64790004",
"0.645973",
"0.64572877",
"0.64530987",
"0.6452256",
"0.64513624",
"0.6446107",
"0.64457756",
"0.6437843",
"0.64320064",
"0.6426409",
"0.64031804",
"0.63951266",
"0.63908976",
"0.63536763",
"0.63515157",
"0.6346517",
"0.63399965",
"0.6335482",
"0.6334381",
"0.6327126",
"0.6316358",
"0.6314962",
"0.63098705",
"0.630984",
"0.630984",
"0.630984",
"0.630984",
"0.630984",
"0.63004047",
"0.62810034",
"0.62699074",
"0.62699074",
"0.6250924",
"0.6249985",
"0.62486225",
"0.62430066",
"0.62382793",
"0.6229881",
"0.6228599",
"0.62180567",
"0.6218007",
"0.6210132",
"0.620425",
"0.6199619",
"0.6195246",
"0.61903554",
"0.61903554",
"0.61862034",
"0.61661774",
"0.61542",
"0.6143459",
"0.61285275",
"0.6118332",
"0.6105681",
"0.6100516",
"0.60974354",
"0.60970455",
"0.6091213",
"0.60894614",
"0.60837954",
"0.607737",
"0.6076722",
"0.60713714",
"0.60556453",
"0.60556453",
"0.6051072",
"0.6050064",
"0.60477734"
] | 0.0 | -1 |
GET /job_applications/new GET /job_applications/new.json | def new
@vacancy = Vacancy.find_by_id(params[:vacancy_id])
@job_application = JobApplication.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @job_application }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.html.erb\n format.json { render json: @application }\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(params[:application])\n @application.job = Job.find(params[:id])\n respond_to do |format|\n if @application.save\n format.html { redirect_to '/', notice: 'Application was received.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job_application = JobApplication.new\n @users = User.find :all\n @job_postings = JobPosting.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.find(params[:job_id])\n @application = Application.new(application_params)\n @application.job = @job\n @application.user = current_user\n\n if @application.save\n redirect_to developers_applications_path\n else\n redirect_to job_path(@job)\n end\n end",
"def create\n @jobapp = Jobapp.new(jobapp_params)\n\n if @jobapp.save\n flash[:success] = \"Jobapp was successfully created.\"\n redirect_to action: \"index\"\n else\n @jobapps = Jobapp.all\n\n render :new, locals: {jobapp: @jobapp,jobapps: @jobapps}\n end\n end",
"def new\n @job_list = JobList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_list }\n end\n end",
"def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end",
"def new\n\t\t@job = Job.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend",
"def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(params[:job_application])\n @users = User.find :all\n @job_postings = JobPosting.find :all\n \n respond_to do |format|\n if @job_application.save\n flash[:notice] = 'JobApplication was successfully created.'\n format.html { redirect_to(@job_application) }\n format.xml { render :xml => @job_application, :status => :created, :location => @job_application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n # @applicant_job_history = ApplicantJobHistory.new(:applicant_id=>params[:applicant_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant_job_history }\n end\n end",
"def create\n job = Job.create(job_params)\n render json: job\n end",
"def create\n if current_user.job_applications.where(job_id: params[:job_application][:job_id]).count > 0\n respond_to do |format|\n format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_error') }\n end\n else\n @job_application = current_user.job_applications.new(job_application_params)\n #Create EQ Answers\n if params.has_key?(\"answer\")\n Answer.create(eq_answer_params(params[\"answer\"]))\n else\n params[\"answers\"].each do |answer|\n Answer.create(eq_answer_params(answer))\n end\n end\n #Create EQ Answers end\n respond_to do |format|\n if @job_application.save\n @job = @job_application.job\n @job_owner = @job_application.job.users.first\n @applicant = current_user\n UserMailer.new_job_applicant_email(@job, @job_owner, @applicant ).deliver_now\n format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_success') }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n if @job_application.save\n flash[:notice] = \"Your application has been made successfully\"\n redirect_to jobs_path\n else\n flash[:error] = \"Error saving your application\"\n redirect_to jobs_path\n end\n end",
"def new\n @emp_job = EmpJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emp_job }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @application = Application.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @saved_job = SavedJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @saved_job }\n end\n end",
"def new\n @job_item = @job.job_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_item }\n end\n end",
"def new\n @training_active_job = Training::ActiveJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_active_job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n format.json { render :json => @job }\n end\n end",
"def new\n @jobtype = Jobtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render_json @jobtype }\n end\n end",
"def new\n @device = Device.find(params[:device_id]) \n @job = @device.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @planning_application = PlanningApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planning_application }\n end\n end",
"def new\n @construction_job = Construction::Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_job }\n end\n end",
"def new\n @job_category = JobCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_category }\n end\n end",
"def new\n createJobWithDefaults\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job_compact = JobCompact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_compact }\n end\n end",
"def new\n @application = Application.new\n #@application.bids.build\n #@bid = Bid.new\n @job = Job.find_by_id(params[:job_id])\n\n @application.job_id = @job.id\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @application }\n end\n end",
"def new\n @job_title = JobTitle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_title }\n end\n end",
"def new\n @job_application_attachment = JobApplicationAttachment.new\n @job_applications = JobApplication.find :all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application_attachment }\n end\n end",
"def new\n @jobs = Job.new(params[:accepted_jobs])\n\n @jobs.user_id = current_user.id\n\n pp @jobs\n\n # respond_to do |format|\n # if @jobs.save\n # format.html { redirect_to home_path, notice: 'Request was successfully created.' }\n # format.json { render json: @jobs, status: :created, location: home_path }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @jobs.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def new\n @job_notification = JobNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_notification }\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end",
"def create\n @user=current_user\n @job=Job.find(session[:job_id])\n @jobapplication = @user.jobapplications.build(job:@job)\n @jobapplication.name=jobapplication_params[:name]\n @jobapplication.phone=jobapplication_params[:phone]\n @jobapplication.major=jobapplication_params[:major]\n @jobapplication.coverletter=jobapplication_params[:coverletter]\n @jobapplication.status=\"Pending\"\n @jobapplication.job_name=@job.name\n @jobapplication.email=current_user.email\n @jobapplication.job_id=@job.id\n JobNotifier.received(@jobapplication).deliver\n respond_to do |format|\n if @jobapplication.save(jobapplication_params)\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }\n format.json { render :show, status: :created, location: @jobapplication }\n else\n format.html { render :new }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @applicant_job = ApplicantJob.new(applicant_job_params)\n\n respond_to do |format|\n if @applicant_job.save\n format.html { redirect_to @applicant_job, notice: 'Applicant job was successfully created.' }\n format.json { render :show, status: :created, location: @applicant_job }\n else\n format.html { render :new }\n format.json { render json: @applicant_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sfjob = Sfjob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sfjob }\n end\n end",
"def create\n @jobapplication = Jobapplication.new(jobapplication_params)\n\n respond_to do |format|\n if @jobapplication.save\n @foundjob = Job.find(@jobapplication.job_id)\n @foundemployerid = @foundjob.employer_id.to_i\n @foundemployer = Employer.find(@foundemployerid)\n UserNotifier.jobapplication_submitted_email(@foundemployer).deliver\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }\n format.json { render :show, status: :created, location: @jobapplication }\n else\n format.html { render :new }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def create\n\t\t@job = Job.new(params[:job])\n\n\t\trespond_to do |format|\n\t\t\tif @job.save\n\t\t\t\tformat.html { redirect_to @job, notice: 'Job was successfully created.' }\n\t\t\t\tformat.json { render json: @job, status: :created, location: @job }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @job.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n @application_status = ApplicationStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_status }\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @job }\n else\n format.html { render action: 'new' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job_application_status_type = JobApplicationStatusType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job_application_status_type }\n end\n end",
"def new\n #@job_application = JobApplication.new\n @job_application = JobApplication.new(params[:job_application])\n @job_posting = JobPosting.find(params[:job_application][:job_posting_id])\n #@job_application.job_posting_id = @job_posting.id\n #@job_application.job_posting_id = params[:job_application][:job_posting_id]\n #@job_application.job_posting_id = @job_posting.id\n #@job_application = JobApplication.find(params[:job_posting_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end",
"def new\n @jobber = Jobber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobber }\n end\n end",
"def create\n @job = current_company.jobs.build(params[:job])\n respond_to do |format|\n if @job.save\n format.html { redirect_to root_path, notice: 'Vaga criada com sucesso' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(params[:application])\n #@application.bids.build\n # @bid = Bid.new(params[:bid])\n #check_bid = @bid.valid?\n @job = Job.find_by_id(@application.job_id)\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n flash[:notice] = 'Application was successfully created.'\n format.html { redirect_to(applications_url) }\n format.xml { render :xml => @application, :status => :created, :location => @application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @job = Job.new_default(params[:job])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @candidate_app = CandidateApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @candidate_app }\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @create_job = CreateJob.new(create_job_params)\n\n respond_to do |format|\n if @create_job.save\n format.html { redirect_to @create_job, notice: 'Create job was successfully created.' }\n format.json { render :show, status: :created, location: @create_job }\n else\n format.html { render :new }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @program = Program.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end",
"def new\n @program = Program.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @program }\n end\n end",
"def create\n @job = @user.jobs.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job_offer = JobOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_offer }\n end\n end",
"def create\n @emp_job = EmpJob.new(params[:emp_job])\n\n respond_to do |format|\n if @emp_job.save\n format.html { redirect_to @emp_job, notice: 'Emp job was successfully created.' }\n format.json { render json: @emp_job, status: :created, location: @emp_job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @emp_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job_folio = JobFolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_folio }\n end\n end",
"def new\n @photo_job = PhotoJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo_job }\n end\n end",
"def create\n @launched_job = LaunchedJob.new(launched_job_params)\n\n respond_to do |format|\n if @launched_job.save\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully created.' }\n format.json { render json: @launched_job, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(params[:job_application])\n @vacancy = Vacancy.find_by_id(params[:vacancy_id]);\n if user_signed_in? && !current_user.admin?\n applicant = Applicant.find_by_id(current_user.id)\n @job_application.applicant_id = current_user.id\n @job_application.vacancy_id = @vacancy.id\n end\n \n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @vacancy, notice: 'Job application was successfully created.' }\n format.json { render json: @job_application, status: :created, location: [applicant, @job_application] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\n end",
"def new\n @title = t('view.print_job_types.new_title')\n @print_job_type = PrintJobType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @print_job_type }\n end\n end",
"def new\n\n #申請は誰でもできる\n @application = Application.new\n user = User.find_by_user(@login_user)\n puts user\n\n @application['user_id'] = user.id\n @application['user'] = user\n\n @instances = get_all_instances\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application }\n end\n end",
"def new\n @user_app = UserApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_app }\n end\n end",
"def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_application(application)\n load_resources(application)\n @title = 'New Job Applicant'\n mail( subject: 'New Applicant', to: company_administrators, track_opens: 'true' )\n end",
"def create\n @job = @user.jobs.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to :dashboard, notice: \"Job was successfully created.\" }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newaplication = Newaplication.new(newaplication_params)\n\n respond_to do |format|\n if @newaplication.save\n format.html { redirect_to @newaplication, notice: 'Newaplication was successfully created.' }\n format.json { render :show, status: :created, location: @newaplication }\n else\n format.html { render :new }\n format.json { render json: @newaplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.new(params[:job])\n @job.status = 'listed'\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.78769815",
"0.76448405",
"0.7611983",
"0.76089746",
"0.75255907",
"0.748417",
"0.7333698",
"0.73262423",
"0.732238",
"0.7320585",
"0.729584",
"0.729584",
"0.729584",
"0.729584",
"0.7282727",
"0.7282727",
"0.72255003",
"0.72139555",
"0.7210812",
"0.7123395",
"0.71162766",
"0.7107506",
"0.70545506",
"0.7053684",
"0.70413965",
"0.69741005",
"0.695772",
"0.6954363",
"0.6951293",
"0.69321406",
"0.69321406",
"0.69321406",
"0.6927051",
"0.6913471",
"0.68757653",
"0.68683726",
"0.68500805",
"0.68321973",
"0.6817641",
"0.6817641",
"0.6817641",
"0.6817641",
"0.6811458",
"0.6809009",
"0.67885053",
"0.6784268",
"0.67807245",
"0.6778994",
"0.6771643",
"0.6769435",
"0.67537016",
"0.67527395",
"0.67451453",
"0.67277205",
"0.6723431",
"0.6698285",
"0.6686778",
"0.6659463",
"0.6655731",
"0.6618638",
"0.6610846",
"0.6603187",
"0.66015303",
"0.6574356",
"0.6573215",
"0.6571068",
"0.6541834",
"0.65415466",
"0.65340066",
"0.65278697",
"0.6524456",
"0.6524456",
"0.6524456",
"0.65231365",
"0.65189564",
"0.65189564",
"0.6512324",
"0.6507908",
"0.65045494",
"0.65033925",
"0.65032136",
"0.65008795",
"0.64869475",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6465677",
"0.6459179",
"0.64574504",
"0.6455765",
"0.6453716",
"0.645145",
"0.64444995",
"0.6423534",
"0.64207023"
] | 0.7592338 | 4 |
POST /job_applications POST /job_applications.json | def create
@job_application = JobApplication.new(params[:job_application])
@vacancy = Vacancy.find_by_id(params[:vacancy_id]);
if user_signed_in? && !current_user.admin?
applicant = Applicant.find_by_id(current_user.id)
@job_application.applicant_id = current_user.id
@job_application.vacancy_id = @vacancy.id
end
respond_to do |format|
if @job_application.save
format.html { redirect_to @vacancy, notice: 'Job application was successfully created.' }
format.json { render json: @job_application, status: :created, location: [applicant, @job_application] }
else
format.html { render action: "new" }
format.json { render json: @job_application.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job = Job.find(params[:job_id])\n @application = Application.new(application_params)\n @application.job = @job\n @application.user = current_user\n\n if @application.save\n redirect_to developers_applications_path\n else\n redirect_to job_path(@job)\n end\n end",
"def create\n if current_user.job_applications.where(job_id: params[:job_application][:job_id]).count > 0\n respond_to do |format|\n format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_error') }\n end\n else\n @job_application = current_user.job_applications.new(job_application_params)\n #Create EQ Answers\n if params.has_key?(\"answer\")\n Answer.create(eq_answer_params(params[\"answer\"]))\n else\n params[\"answers\"].each do |answer|\n Answer.create(eq_answer_params(answer))\n end\n end\n #Create EQ Answers end\n respond_to do |format|\n if @job_application.save\n @job = @job_application.job\n @job_owner = @job_application.job.users.first\n @applicant = current_user\n UserMailer.new_job_applicant_email(@job, @job_owner, @applicant ).deliver_now\n format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_success') }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n if @job_application.save\n flash[:notice] = \"Your application has been made successfully\"\n redirect_to jobs_path\n else\n flash[:error] = \"Error saving your application\"\n redirect_to jobs_path\n end\n end",
"def create\n @job_application = JobApplication.new(params[:job_application])\n @users = User.find :all\n @job_postings = JobPosting.find :all\n \n respond_to do |format|\n if @job_application.save\n flash[:notice] = 'JobApplication was successfully created.'\n format.html { redirect_to(@job_application) }\n format.xml { render :xml => @job_application, :status => :created, :location => @job_application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @jobapp = Jobapp.new(jobapp_params)\n\n if @jobapp.save\n flash[:success] = \"Jobapp was successfully created.\"\n redirect_to action: \"index\"\n else\n @jobapps = Jobapp.all\n\n render :new, locals: {jobapp: @jobapp,jobapps: @jobapps}\n end\n end",
"def create\n @application = Application.new(params[:application])\n @application.job = Job.find(params[:id])\n respond_to do |format|\n if @application.save\n format.html { redirect_to '/', notice: 'Application was received.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user=current_user\n @job=Job.find(session[:job_id])\n @jobapplication = @user.jobapplications.build(job:@job)\n @jobapplication.name=jobapplication_params[:name]\n @jobapplication.phone=jobapplication_params[:phone]\n @jobapplication.major=jobapplication_params[:major]\n @jobapplication.coverletter=jobapplication_params[:coverletter]\n @jobapplication.status=\"Pending\"\n @jobapplication.job_name=@job.name\n @jobapplication.email=current_user.email\n @jobapplication.job_id=@job.id\n JobNotifier.received(@jobapplication).deliver\n respond_to do |format|\n if @jobapplication.save(jobapplication_params)\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }\n format.json { render :show, status: :created, location: @jobapplication }\n else\n format.html { render :new }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jobapplication = Jobapplication.new(jobapplication_params)\n\n respond_to do |format|\n if @jobapplication.save\n @foundjob = Job.find(@jobapplication.job_id)\n @foundemployerid = @foundjob.employer_id.to_i\n @foundemployer = Employer.find(@foundemployerid)\n UserNotifier.jobapplication_submitted_email(@foundemployer).deliver\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully created.' }\n format.json { render :show, status: :created, location: @jobapplication }\n else\n format.html { render :new }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"def jobapplication_params\n params.require(:jobapplication).permit(:name, :email, :job_name, :phone, :status, :user_id, :job_id, :coverletter, :major)\n end",
"def jobapplication_params\n params.require(:jobapplication).permit(:job_id, :jobseeker_id, :coverletter, :status)\n end",
"def create\n @job_application = JobApplication.new(params[:job_application])\n @job_application.activation_key = ActiveSupport::SecureRandom.hex(4)\n \n respond_to do |format|\n if @job_application.save\n JobApplicationMailer.deliver_job_application_confirmation(@job_application)\n flash[:notice] = 'You have successfully applied for teh job.'\n format.html { render :action => \"job_application_success\" }\n format.xml { render :xml => @job_application, :status => :created, :location => @job_application }\n else\n format.html { render :action => \"error\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def application_params\n params.fetch(:application, {}).permit(:job_id)\n end",
"def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"def create\n @application = Application.new(params[:application])\n #@application.bids.build\n # @bid = Bid.new(params[:bid])\n #check_bid = @bid.valid?\n @job = Job.find_by_id(@application.job_id)\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n flash[:notice] = 'Application was successfully created.'\n format.html { redirect_to(applications_url) }\n format.xml { render :xml => @application, :status => :created, :location => @application }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to \"/applications/#{@application.id}/step2\", notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.status = \"pending review\"\n @job_application.job_seeker_id = current_user.id\n @job = Job.find_by_id(@job_id)\n @job_application.job_id = flash[:job_id].to_i\n @job_application.application_deadline = Job.find_by_id(flash[:job_id].to_i).application_deadline\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end",
"def job_application_params\n params.require(\n :job_application\n ).permit(\n :resume,\n :job_ad_id,\n :job_seeker_id,\n :recruiter_id\n )\n end",
"def submission\n if @job.status?\n @application = Application.new(application_params)\n email_api = Email_api.new\n if email_api.email(@application)\n render json: @application, status: :OK\n else\n render json: @application.errors, status: :bad_request\n end\n else\n render plain: job_not_active, status: :unprocessable_entity\n end\n end",
"def application_params\n params.require(:application).permit(:job_id, :id, :current_company, :linkedin_url, :portfolio_url, :add_info,\n :gender, :race, :veteran, :disability, :resume, :application_status)\n end",
"def index\n @jobapplications = Jobapplication.all\n end",
"def create\n @applicant_job = ApplicantJob.new(applicant_job_params)\n\n respond_to do |format|\n if @applicant_job.save\n format.html { redirect_to @applicant_job, notice: 'Applicant job was successfully created.' }\n format.json { render :show, status: :created, location: @applicant_job }\n else\n format.html { render :new }\n format.json { render json: @applicant_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end",
"def index\n @job_applications = JobApplication.all\n end",
"def job_application_params\n params.require(:job_application).permit(:apply_job_info, :price_per_hour, :job_id, :user_id)\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @jobapps = Jobapp.all\n @jobapp = Jobapp.new\n end",
"def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end",
"def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end",
"def create\n @client_application = ClientApplication.new(client_application_params)\n\n respond_to do |format|\n if @client_application.save\n format.html { redirect_to @client_application, notice: 'Client application was successfully created.' }\n format.json { render :show, status: :created, location: @client_application }\n else\n format.html { render :new }\n format.json { render json: @client_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end",
"def create\n @application = Application.new(params[:application])\n\n respond_to do |format|\n if @application.save\n format.html {\n flash[:success] = 'Application ' + @application.name + ' was successfully created.'\n redirect_to [:admin, @application]\n }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html {\n flash[:error] = 'Failed to update application.'\n render action: \"new\"\n }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jenkins_app_config = JenkinsAppConfig.new(jenkins_app_config_params)\n\n respond_to do |format|\n if @jenkins_app_config.save\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully created.' }\n format.json { render :show, status: :created, location: @jenkins_app_config }\n else\n format.html { render :new }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(optional_params = {})\n response = Network.post(['Applications'], optional_params)\n Application.new(response)\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n current_user.application = @application\n current_user.save\n format.html { redirect_to @application, notice: 'Application successfully sent in.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activate_app\n key = Key.new\n key.host = params[:data][:host]\n key.app_dataset_id = params[:data][:app_dataset_id]\n key.api_key = params[:data][:api_key]\n key.app_name = params[:controller]\n\n existing_job_board = JobBoard.find_by(app_dataset_id: params[:data][:app_dataset_id])\n unless existing_job_board.present?\n JobBoard.create(app_dataset_id: params[:data][:app_dataset_id])\n end\n\n respond_to do |format|\n format.json { render json: { success: key.save }}\n end\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_application = TaskApplication.new(task_application_params)\n\n respond_to do |format|\n if @task_application.save\n format.html { redirect_to @task_application, notice: 'Task application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @task_application }\n else\n format.html { render action: 'new' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_application = UserApplication.new(user_application_params)\n\n respond_to do |format|\n if @user_application.save\n format.html { redirect_to @user_application, notice: 'User application was successfully created.' }\n format.json { render :show, status: :created, location: @user_application }\n else\n format.html { render :new }\n format.json { render json: @user_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def jobapp_params\n params.require(:jobapp).permit(:designation_id, :number_of_post, :job_type, :experience, :age, :job_location, :salary, :post_date, :last_date_to_apply, :close_date, :status, :short_description, :description)\n end",
"def job_application_params\n params.require(:job_application).permit(:candidate_id, :open_job_id, :red, :yellow, :green)\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def application_params\n params.require(:application).permit(:j_id, :job_id, :user_id, :gender, :additional_info, :portfolio_url, :linkedin_url, :current_company, :disability_status, :veteran_status, :race, :status, :resume)\n end",
"def create\n job = Job.create(job_params)\n render json: job\n end",
"def job_application_params\n params.require(:job_application).permit(:candidate_id, :job_id, :rejection_reason)\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity_application = @meetup_event.activity_applications.new(activity_application_params_for_create)\n\n respond_to do |format|\n if @activity_application.save\n format.html {redirect_to [@meetup_event, @activity_application], notice: 'Activity application was successfully created.'}\n format.json {render :show, status: :created, location: meetup_event_activity_application_path(@meetup_event, @activity_application)}\n else\n format.html {render :new}\n format.json {render json: @activity_application.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @employment_application = EmploymentApplication.new(employment_application_params)\n\n respond_to do |format|\n if @employment_application.save\n # alert the appropriate person at MWC\n ApplicationMailer.new_employment_application(@employment_application.id).deliver!\n\n # destroy their resume to save space on the machine\n @employment_application.resume.destroy\n @employment_application.resume.clear\n @employment_application.save\n\n format.html { redirect_to \"/\", notice: 'Your employment application was received. We will contact you shortly if we choose to proceed with your application.' }\n format.json { render :show, status: :created, location: @employment_application }\n else\n format.html { render :new, alert: 'There was an error while processing your application. Please try again.' }\n format.json { render json: @employment_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_job(job:, params: {})\n response = HTTParty.post(\"#{@host}/api/jobs\", body: {job: job, api_key: @api_key}.merge(params))\n \n return response\n end",
"def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end",
"def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_job(json_payload)\n conn = @client.post do |req|\n req.url '/api/v2/job/create'\n req.headers[\"Authorization\"] = @token\n req.body = json_payload\n end\n conn.body\n end",
"def job_application_params\n params.require(:job_application).permit(:job_offer_id, :user_id, :first_name, :last_name, :current_position, :phone, :address_1, :address_2, :postal_code, :city, :country, :website_url)\n end",
"def job_application_params\n params.require(:job_application).permit(:coverletter, :job_id, :employee_id, :status, :review_employee, :rating_employee, :rating_employer, :review_employer)\n end",
"def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end",
"def apply(application, params={})\n response = @http.post(\"/application/submit\", application.to_xml)\n check_status(response)\n response_application_parser.parse(response.body).first\n end",
"def create\n @project_application = ProjectApplication.new(project_application_params)\n\n respond_to do |format|\n if @project_application.save\n format.html { redirect_to @project_application, notice: 'Project application was successfully created.' }\n format.json { render :show, status: :created, location: @project_application }\n else\n format.html { render :new }\n format.json { render json: @project_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.create(params[:application])\n\n unless @application.new_record?\n flash[:notice] = 'Application was successfully created.'\n end\n\n respond_with @application\n end",
"def create\n megam_rest.post_appreq(to_hash)\n end",
"def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @job_applications = @job_applications_active\n end",
"def create\n #@job_application = JobApplication.new(params[:job_application])\n @job_application = current_user.job_applications.new(params[:job_application])\n #@job_application.job_posting_id = JobPostings.find(params[:job_posting_id]) # job_posting.id \n #@job_posting = JobPosting.find(params[:job_posting_id])\n #@job_application.job_posting_id = @job_posting.id\n #@job_application.job_posting_id = params[:job_application][:job_posting_id]\n\n respond_to do |format|\n if @job_application.save\n # send email to HR person who posted the job\n @job_posting = JobPosting.find(@job_application.job_posting_id)\n @HR_person = User.find(@job_posting.user_id)\n RecieveApplicationMailer.recieve_application_email(@HR_person, @job_application).deliver\n\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render json: @job_application, status: :created, location: @job_application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @appman = Appman.new(appman_params)\n @appman.user_id = session[:user_id]\n respond_to do |format|\n if @appman.save\n UpdateStackStatusJob.perform_later(@appman) \n format.html { redirect_to @appman, notice: 'Appman was successfully created.' }\n format.json { render :show, status: :created, location: @appman }\n else\n format.html { render :new }\n format.json { render json: @appman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @vacancy = Vacancy.find_by_id(params[:vacancy_id])\n @job_application = JobApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_application }\n end\n end",
"def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end",
"def create\n @app = App.new(app_params)\n IO.popen([\"mail\", \"-s\", \"New Application request\", \"jon@railsclass.com\"], \"w\") {|f|\n f.puts @app.name;\n f.puts @app.email;\n f.puts @app.phone;\n f.puts @app.date;\n f.puts @app.employment;\n f.puts @app.currently;\n f.puts @app.looking_for;\n f.puts @app.experience;\n f.puts @app.ideas;\n f.puts @app.linkedin;\n f.puts @app.heard_from;\n f.close_write;\n }\n\n gb = Gibbon::API.new\n \n name_array = app_params[:name].split\n first_name = app_params[:name]\n last_name = \"\"\n if name_array.length > 1 && name_array[0].length > 0 && name_array[1].length > 0\n first_name = name_array[0]\n last_name = name_array[1]\n end\n puts \"subscribing new user to list\"\n \n gb.lists.subscribe({:id => \"75aba6bef3\", :email => {:email => app_params[:email]}, :merge_vars => {:FNAME => first_name, :LNAME => last_name}, :double_optin => true})\n\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to root_path, notice: \"A lovely application! We'll be in touch soon!\" }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(params[:application])\n p @params\n user = User.find_by_user(params['requester'])\n puts user\n\n @application['user_id'] = user.id\n @application['status'] = 0\n @application['apply_date'] = Time.now\n\n\n @application['to'] = params[:application]['to'].join(\",\")\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to :action => \"index\", notice: 'Application was successfully created.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7440632",
"0.74280643",
"0.74198717",
"0.7308676",
"0.72082317",
"0.70518476",
"0.70083183",
"0.6915704",
"0.6885722",
"0.6787565",
"0.67020357",
"0.6698185",
"0.6562608",
"0.64944416",
"0.64358145",
"0.6430998",
"0.6424024",
"0.6364738",
"0.6354386",
"0.6348297",
"0.63115656",
"0.62900525",
"0.62807935",
"0.62566704",
"0.6231134",
"0.6205463",
"0.61826646",
"0.6145251",
"0.6144433",
"0.6139078",
"0.61291766",
"0.6127523",
"0.6114088",
"0.61003983",
"0.6096488",
"0.6089846",
"0.60887855",
"0.60800046",
"0.60751075",
"0.6072667",
"0.60694355",
"0.6061623",
"0.6055391",
"0.60487044",
"0.6013419",
"0.6012979",
"0.6012979",
"0.6012979",
"0.6012979",
"0.6012979",
"0.6012979",
"0.6012979",
"0.60080063",
"0.6003157",
"0.60015696",
"0.60015696",
"0.5993281",
"0.59857655",
"0.59716225",
"0.5968468",
"0.59621304",
"0.59543115",
"0.5945559",
"0.5939315",
"0.5932852",
"0.59217745",
"0.59217745",
"0.59182906",
"0.59084326",
"0.59053004",
"0.5896588",
"0.5893867",
"0.5891305",
"0.5883551",
"0.58832085",
"0.5873146",
"0.58681333",
"0.58530504",
"0.58506554",
"0.5822528",
"0.58165383",
"0.58165383",
"0.5806062",
"0.5798222",
"0.5795897",
"0.57952666",
"0.5790609",
"0.5789361",
"0.57891047",
"0.57871175",
"0.57770455",
"0.5775035",
"0.57717115",
"0.57570714",
"0.57566",
"0.5756002",
"0.5748063",
"0.57452404",
"0.57235914",
"0.57146007"
] | 0.6225921 | 25 |
PUT /job_applications/1 PUT /job_applications/1.json | def update
@job_application = JobApplication.find(params[:id])
respond_to do |format|
if @job_application.update_attributes(params[:job_application])
format.html { redirect_to vacancy_path(@job_application.vacancy_id), notice: 'Job application was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @job_application.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n format.html { render :edit }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to @job_application, notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to [:admin, @job_application], notice: 'Job application was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@jobapp = Jobapp.find(params[:id])\n\n respond_to do |format|\n if @jobapp.update_attributes(params[:jobapp])\n format.html { redirect_to @jobapp, notice: 'Jobapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n flash[:notice] = 'JobApplication was successfully updated.'\n format.html { redirect_to(@job_application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @job_application = JobApplication.find(params[:id])\n\n respond_to do |format|\n if @job_application.update_attributes(params[:job_application])\n flash[:notice] = 'JobApplication was successfully updated.'\n format.html { redirect_to(@job_application) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job_application.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def set_jobapplication\n @jobapplication = Jobapplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def set_jobapp\n @jobapp = Jobapp.find(params[:id])\n end",
"def set_job_application\n @job_application = JobApplication.find(params[:id])\n end",
"def update\n if @jobapp.update(jobapp_params)\n flash[:success] = \"Jobapp was successfully updated.\"\n redirect_to action: \"index\"\n else\n render \"edit\" \n end\n end",
"def create\n @application = current_user.applications.new(application_params)\n jb_id = params[:j_id]\n @application.status = 'Application Submitted'\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n @j_id = @application.job_id\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to jobs_path, notice: 'Your review has been submitted' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user=current_user\n @job=Job.find(session[:job_id])\n @jobapplication.job_name=@job.name\n @jobapplication.email=current_user.email\n respond_to do |format|\n if @jobapplication.update(jobapplication_params)\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobapplication }\n else\n format.html { render :edit }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n @job_application.user_id = current_user.id\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_site_application.update(job_site_application_params)\n format.html { redirect_to @job_site_application, notice: 'Job site application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_site_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend",
"def update_job(job:)\n response = HTTParty.put(\"#{@host}/api/jobs/#{job[:id]}\", body: {job: job, api_key: @api_key})\n \n return response.success?\n end",
"def create\n @job = Job.find(params[:job_id])\n @application = Application.new(application_params)\n @application.job = @job\n @application.user = current_user\n\n if @application.save\n redirect_to developers_applications_path\n else\n redirect_to job_path(@job)\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(application_params)\n # @application.job_id = params[:id]\n @application.user_id = current_user.id\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully created.' }\n format.json { render :show, status: :created, location: @job_application }\n else\n format.html { render :new }\n format.json { render json: @job_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n #@job = Job.find(params[:job_id])\n @jobapps = @job.jobapps\n @jobapp = @jobapps.new\n #@jobapp.user = current_user\n #@user = current_user\n #@jobapp.user.update_attributes(params[:user])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobapp }\n end\n end",
"def application_params\n params.fetch(:application, {}).permit(:job_id)\n end",
"def update\n respond_to do |format|\n if @applicant_job.update(applicant_job_params)\n format.html { redirect_to @applicant_job, notice: 'Applicant job was successfully updated.' }\n format.json { render :show, status: :ok, location: @applicant_job }\n else\n format.html { render :edit }\n format.json { render json: @applicant_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_app data={}\n put '/app', data\n end",
"def jobapplication_params\n params.require(:jobapplication).permit(:name, :email, :job_name, :phone, :status, :user_id, :job_id, :coverletter, :major)\n end",
"def update\n if @job.update(job_params)\n @job.update(category: @category)\n @job.update(keywords: @keywords)\n render json: @job, status: :accepted\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end",
"def jobapplication_params\n params.require(:jobapplication).permit(:job_id, :jobseeker_id, :coverletter, :status)\n end",
"def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single camp_application based on the id\n camp_application = CampApplication.find_by(id: the_id)\n\n # update it\n if camp_application.update!(\n camp_id: params[:camp_id],\n application_id: params[:application_id]\n )\n render json: camp_application.as_json\n else\n render json: {errors: camp_application.errors.full_messages}\n end\n end",
"def update\n if @application.update(application_params)\n render json: @application, status: :ok, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"def update\n begin\n @job_request = job_requests.find( params[ :id ] )\n rescue ActiveRecord::RecordNotFound\n @job_request = nil\n end\n\n respond_to do |format|\n if @job_request && @job_request.update_attributes( params[ :job_request ] )\n format.html { redirect_to root_path, notice: \"Job Requests Updated Successfully\"}\n format.json { head :no_content }\n else\n format.html { redirect_to root_path, notice: \"Update Failed\" }\n format.json { render json: @job_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_job_application\n @job_application = current_user.job_applications.find(params[:job_application_id] || params[:id])\n @job_offer = @job_application.job_offer\n end",
"def update\n @application = Application.find(params[:id])\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to root_path, notice: 'Application was successfully submitted.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application = Application.new(params[:application])\n @application.job = Job.find(params[:id])\n respond_to do |format|\n if @application.save\n format.html { redirect_to '/', notice: 'Application was received.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @create_job.update(create_job_params)\n format.html { redirect_to @create_job, notice: 'job was successfully updated.' }\n format.json { render :show, status: :ok, location: @create_job }\n else\n format.html { render :edit }\n format.json { render json: @create_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n\n if @app.update(app_params)\n head :no_content\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"def update\n @training_active_job = Training::ActiveJob.find(params[:id])\n\n respond_to do |format|\n if @training_active_job.update_attributes(params[:training_active_job])\n format.html { redirect_to @training_active_job, notice: 'Active job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @training_active_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @launched_job.update(launched_job_params)\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_job_site_application\n @job_site_application = JobSiteApplication.find(params[:id])\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n @job = Job.find(params[:id])\n if @job.update_attributes(params[:job])\n response_message = {:message => \"Job updated successfully.\", :job => @job}\n else\n response_message = {:message => \"Job updation failed. Please try again!\"}\n end\n\n respond_to do |format|\n format.xml { render :xml => response_message }\n format.json { render :json => response_message }\n end\n end",
"def update\n #@job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to root_path, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @employment_application.update(employment_application_params)\n format.html { redirect_to @employment_application, notice: 'Employment application was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment_application }\n else\n format.html { render :edit }\n format.json { render json: @employment_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jobapplication.update(jobapplication_params)\n if((cookies[:employerID]!=\"\") && (!cookies[:employerID].is_a?NilClass))\n @foundjobseeker = Jobseeker.find(@jobapplication.jobseeker_id)\n UserNotifier.jobapplication_status_update_email(@foundjobseeker).deliver\n end\n format.html { redirect_to @jobapplication, notice: 'Jobapplication was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobapplication }\n else\n format.html { render :edit }\n format.json { render json: @jobapplication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(id, job)\n connection.put do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end",
"def update\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n if @job_item.update_attributes(params[:job_item])\n format.html { redirect_to [@job, @job_item], notice: 'Job item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_sauce_job_status(json_data = {})\n host = \"http://#{settings.sl_user}:#{settings.sl_api_key}@saucelabs.com\"\n path = \"/rest/v1/#{settings.sl_user}/jobs/#{session_id}\"\n url = \"#{host}#{path}\"\n ::RestClient.put url, json_data.to_json, content_type: :json, accept: :json\n end",
"def job_application_params\n params.require(\n :job_application\n ).permit(\n :resume,\n :job_ad_id,\n :job_seeker_id,\n :recruiter_id\n )\n end",
"def update\n @job = Job.find(params[:id])\n @job.update({\n name: params[:job][:name],\n description: params[:job][:description],\n origin: params[:job][:origin],\n destination: params[:job][:destination],\n cost: params[:job][:cost],\n containers_needed: params[:job][:containers_needed]\n })\n\n if (@job)\n redirect_to url_for(:controller => :jobs, :action => :index)\n else\n redirect_to url_for(:controller => :jobs, :action => :edit)\n end\n end",
"def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_kapp_webhook_job(kapp_slug, job_id, job_properties={}, headers=default_headers)\n @logger.info(\"Updating the webhook job #{job_id} in the \\\"#{kapp_slug}\\\" Kapp\")\n put(\"#{@api_url}/kapps/#{kapp_slug}/webhookJobs/#{job_id}\", job_properties, headers)\n end",
"def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@application.job.id)\n id = @application.job.id\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to show_apps_path(:id=>id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to job_applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to job_applications_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @task_application.update(task_application_params)\n format.html { redirect_to @task_application, notice: 'Task application was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @task_application }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def job_application_params\n params.require(:job_application).permit(:apply_job_info, :price_per_hour, :job_id, :user_id)\n end",
"def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @act_job.update(act_job_params)\n format.html { redirect_to @act_job, notice: 'Act job was successfully updated.' }\n format.json { render :show, status: :ok, location: @act_job }\n else\n format.html { render :edit }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n if @emp_job.update_attributes(params[:emp_job])\n format.html { redirect_to @emp_job, notice: 'Emp job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emp_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to jobs_path, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, success: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job.update(job_params)\n record_activity :update, @job\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n else\n format.html { render :edit }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.74310696",
"0.7420781",
"0.7347127",
"0.729786",
"0.72329706",
"0.72329706",
"0.7201282",
"0.7197836",
"0.71683437",
"0.6954095",
"0.6954095",
"0.6900336",
"0.6900336",
"0.68689764",
"0.68689764",
"0.68689764",
"0.68689764",
"0.68689764",
"0.68689764",
"0.68689764",
"0.68426806",
"0.68243134",
"0.6800952",
"0.6789195",
"0.6720388",
"0.6695895",
"0.6670589",
"0.66588897",
"0.6639679",
"0.6582855",
"0.6544701",
"0.6544701",
"0.6544701",
"0.6536484",
"0.64956164",
"0.6455659",
"0.64504206",
"0.6440302",
"0.64155376",
"0.63395745",
"0.63146037",
"0.6308098",
"0.62414306",
"0.62267476",
"0.621064",
"0.619587",
"0.61920124",
"0.6187175",
"0.6138994",
"0.6132874",
"0.6129305",
"0.6126881",
"0.61212003",
"0.6108709",
"0.6101234",
"0.6080259",
"0.60783505",
"0.60648525",
"0.60648525",
"0.6062616",
"0.60462856",
"0.60449404",
"0.6040763",
"0.60280424",
"0.60183877",
"0.6007223",
"0.6004959",
"0.6003556",
"0.6000336",
"0.59995705",
"0.599364",
"0.5986708",
"0.5982418",
"0.5977853",
"0.59737086",
"0.59737086",
"0.5971192",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59683084",
"0.59676844",
"0.59665996",
"0.59627444",
"0.5956591",
"0.5954277",
"0.5952178",
"0.59452325",
"0.5941009",
"0.59384656"
] | 0.70274913 | 9 |
DELETE /job_applications/1 DELETE /job_applications/1.json | def destroy
@job_application = JobApplication.find(params[:id])
@job_application.destroy
respond_to do |format|
format.html { redirect_to job_applications_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @application = Application.find(params[:id])\n return unless appAccess?(@application.job.id)\n id = @application.job.id\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to show_apps_path(:id=>id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application.delete\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'Job application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: t('job_applications_controller.job_applications_delete_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'Job application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'Job application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_applications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job_application = JobApplication.find(params[:id])\n @job_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(job_applications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job_site_application.destroy\n respond_to do |format|\n format.html { redirect_to job_site_applications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to job_applications_url, notice: 'JobApplication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jobapplication.destroy\n respond_to do |format|\n format.html { redirect_to jobapplications_url, notice: 'Jobapplication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @launched_job.destroy\n respond_to do |format|\n format.html { redirect_to launched_jobs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n job_resource.delete\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to app_jobs_path, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_item = @job.job_items.find(params[:id])\n @job_item.destroy\n\n respond_to do |format|\n format.html { redirect_to [@job] }\n format.json { head :ok }\n end\n end",
"def destroy\n @applicant_job.destroy\n respond_to do |format|\n format.html { redirect_to applicant_jobs_url, notice: 'Applicant job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to client_path(@job.client), notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def remove_jobs(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/erase\"\n\n begin\n response = RestClient::Request.new(\n :method => :post,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job #{id} => success\"\n else\n puts \"delete job #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n\n end\n\nend",
"def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @db_job.destroy\n respond_to do |format|\n format.html { redirect_to db_jobs_url, notice: 'Db job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jobapp.destroy\n flash[:success] = \"Jobapp was successfully destroyed\"\n redirect_to action: \"index\"\n end",
"def destroy \n @job = Mugen::Job.delete(params[:id])\n \n respond_to do |format|\n format.html { redirect_to(mygengo_jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if UbiquoJobs.manager.delete(params[:id])\n flash[:notice] = t(\"ubiquo.jobs.job_removed\")\n else\n flash[:error] = t(\"ubiquo.jobs.cant_remove\")\n end\n\n respond_to do |format|\n format.html { redirect_to(ubiquo.jobs_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize!(@job)\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with Job.find(params[:id]).delete\n end",
"def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: \"Job was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to :dashboard, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_active_job = Training::ActiveJob.find(params[:id])\n @training_active_job.destroy\n\n respond_to do |format|\n format.html { redirect_to training_active_jobs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @emp_job = EmpJob.find(params[:id])\n @emp_job.destroy\n\n respond_to do |format|\n format.html { redirect_to emp_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_compact = JobCompact.find(params[:id])\n @job_compact.destroy\n\n respond_to do |format|\n format.html { redirect_to job_compacts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end",
"def destroy\n @saved_job = SavedJob.find(params[:id])\n @saved_job.destroy\n\n respond_to do |format|\n format.html { redirect_to saved_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = current_member.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_scope_addition = JobScopeAddition.find(params[:id])\n jid = @job_scope_addition.jobs_id\n jsa_id = params[:id]\n recs = AdditionTaskRecord.find_all_by_jobs_id(jsa_id)\n delete_records(recs)\n @job_scope_addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"#{job_scope_additions_url}?jid=#{jid}\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n Job.destroy(params[:id])\n end",
"def destroy\n @job.destroy\n redirect_to root_url\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to mentor_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @act_job.destroy\n respond_to do |format|\n format.html { redirect_to act_jobs_url, notice: 'Act job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = @user.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n ensure_authenticated!\n job = OAR::Job.find(params[:id])\n authorize!(job.user)\n\n url = uri_to(\n site_path(\n params[:site_id]\n )+\"/internal/oarapi/jobs/#{params[:id]}.json\",\n :out\n )\n http = EM::HttpRequest.new(url).delete(\n :timeout => 5,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Accept' => media_type(:json)\n }\n )\n\n continue_if!(http, :is => [200,202,204,404])\n\n if http.response_header.status == 404\n raise NotFound, \"Cannot find job##{params[:id]} on the OAR server\"\n else\n response.headers['X-Oar-Info'] = (\n JSON.parse(http.response)['oardel_output'] || \"\"\n ).split(\"\\n\").join(\" \") rescue \"-\"\n\n location_uri = uri_to(\n resource_path(params[:id]),\n :in, :absolute\n )\n\n render :text => \"\",\n :head => :ok,\n :location => location_uri,\n :status => 202\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @applied_job.destroy\n respond_to do |format|\n format.html { redirect_to applied_jobs_url, notice: 'Applied job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_job.destroy\n respond_to do |format|\n format.html { redirect_to saved_jobs_url, notice: t('saved_jobs_controller.saved_jobs_delete_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to @job, notice: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n flash[:success] = \"Job successfully destroyed\"\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job_list = JobList.find(params[:id])\n @job_list.destroy\n\n respond_to do |format|\n format.html { redirect_to job_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myjob.destroy\n respond_to do |format|\n format.html { redirect_to myjobs_url, notice: 'Myjob was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job = Job.find_by_job_number(params[:id])\n if admin?\n @job.destroy\n end\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, success: 'Job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sfjob = Sfjob.find(params[:id])\n @sfjob.destroy\n\n respond_to do |format|\n format.html { redirect_to sfjobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @worker_job.destroy\n respond_to do |format|\n format.html { redirect_to worker_jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_detail.destroy\n respond_to do |format|\n format.html { redirect_to job_job_details_url, notice: 'Job detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_applicant\n @job_user = JobUser.find(params[:id])\n @job = @job_user.job\n @job_user.delete\n redirect_to job_path(@job)\n end",
"def remove_artifacts(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/artifacts\"\n\n begin\n response = RestClient::Request.new(\n :method => :delete,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job artifacts #{id} => success\"\n else\n puts \"delete job artifacts #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n end\n\nend",
"def destroy\n @job = Job.destroy(params[:id])\n redirect_to jobs_path\n end",
"def destroy\n @create_job.destroy\n respond_to do |format|\n format.html { redirect_to create_jobs_url, notice: 'Create job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @db_job_status\n @db_job_status.destroy\n respond_to do |format|\n format.html { redirect_to db_job_statuses_url, notice: 'Db job status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_status = JobStatus.find(params[:id])\n @job_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_job_statuses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @job.destroy\n respond_to do |format|\n format.html { redirect_to jobs_url, notice: \"Job was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job = current_user.posted_jobs.find(params[:id])\n @job.try(:destroy)\n render json: {}\n end",
"def destroy\n @job_notification = JobNotification.find(params[:id])\n @job_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to job_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pending_job.destroy\n respond_to do |format|\n format.html { redirect_to pending_jobs_url, notice: 'Pending job was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @job_category = JobCategory.find(params[:id])\n @job_category.destroy\n\n respond_to do |format|\n format.html { redirect_to job_categories_url }\n format.json { head :no_content }\n end\n end",
"def jobs_del\r\n job_profile_id = params[:job_profile_id]\r\n job_profile = JobProfile.find(job_profile_id, :select => \"id, account_id\")\r\n \r\n return jump_to(\"/errors/forbidden\") unless job_profile.account_id == session[:account_id]\r\n \r\n JobProfile.delete(job_profile_id)\r\n @job_profile_entry_id = \"job_profile_#{job_profile_id}\"\r\n end",
"def destroy\n @import_job.destroy\n respond_to do |format|\n format.html { redirect_to import_jobs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.77907234",
"0.76370245",
"0.76344377",
"0.759618",
"0.7492192",
"0.7373139",
"0.7373139",
"0.73712915",
"0.73712915",
"0.732129",
"0.7297743",
"0.72826266",
"0.72216356",
"0.7197681",
"0.71140724",
"0.7089768",
"0.70889133",
"0.70451796",
"0.70451796",
"0.70451796",
"0.70451796",
"0.7044888",
"0.70429826",
"0.7040951",
"0.69947",
"0.6988797",
"0.6976976",
"0.6948422",
"0.694615",
"0.694361",
"0.6932523",
"0.6931958",
"0.69316185",
"0.69263124",
"0.69238085",
"0.69195974",
"0.6909332",
"0.6894571",
"0.6890273",
"0.6888686",
"0.68883467",
"0.68847525",
"0.6876609",
"0.68640494",
"0.68623495",
"0.6860609",
"0.685314",
"0.6848008",
"0.6841853",
"0.6823072",
"0.6798828",
"0.6783732",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6777949",
"0.6773757",
"0.67600507",
"0.67552054",
"0.67425793",
"0.6741799",
"0.6731175",
"0.6731175",
"0.6731175",
"0.6731175",
"0.6731175",
"0.6731175",
"0.6731175",
"0.6731175",
"0.67227215",
"0.6719936",
"0.67163944",
"0.6709035",
"0.6704964",
"0.66951156",
"0.6680932",
"0.66795105",
"0.667231",
"0.6667669",
"0.6661895",
"0.6660624",
"0.66410816",
"0.66348284",
"0.66202754",
"0.661789",
"0.66100866",
"0.6610055",
"0.6608697",
"0.66079664",
"0.66032237"
] | 0.7635535 | 3 |
Return an array of primary region replicas tableName table to return regions for | def getPrimaryRegionEncodedNames(tableName)
c = HBaseConfiguration.new()
tableNameObj = TableName.valueOf(tableName)
t = HTable.new(c, tableNameObj)
regions = t.getRegionsInRange(t.getStartKeys[0],
t.getEndKeys[t.getEndKeys.size-1])
priRegions = Array.new
regions.each do |r|
if (r.getRegionInfo().getReplicaId() == 0)
priRegions << r.getRegionInfo().getEncodedName()
end
end
priRegions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_regions(name, start_row = nil, end_row = nil)\n raise NotImplementedError, \"Getting the table regions is not supported yet\"\n end",
"def getPrimaryDistribution(tableName)\n c = HBaseConfiguration.new()\n tableNameObj = TableName.valueOf(tableName)\n t = HTable.new(c, tableNameObj)\n regions = t.getRegionsInRange(t.getStartKeys[0],\n t.getEndKeys[t.getEndKeys.size-1])\n\n count = Hash.new(0)\n regions.each do |r|\n #puts r.getRegionInfo().getRegionNameAsString()+\" id \"+r.getRegionInfo().getReplicaId().to_s()+\" enc name \"+r.getRegionInfo().getEncodedName()+\" server name \"+r.getServerName().getHostname()\n z = count[r.getServerName().getHostname()]\n count[r.getServerName().getHostname()]=z+1\n end\n count.each do |r,c|\n puts r.to_s()+\" \"+c.to_s()\n end\nend",
"def regions(for_select = true)\n fetch_array_for $regions, for_select\n end",
"def all\n # return an array of all the regions\n return NAMES\n end",
"def all\n partitions.group_by { |row| row['table_name'] }.map(&method(:to_tablature_table))\n end",
"def preferred_regions(ingredient, provider_id)\n resource_region_codes = filtered_resources(provider_id).map(&:region_code)\n region_areas = ingredient.region_constraints\n regions = Array.new\n region_areas.each do |region_area|\n preferred_region_codes = Set.new(Resource.region_codes(region_area))\n regions.push(resource_region_codes.map { |rrc| preferred_region_codes.member?(rrc) })\n end\n regions.flatten\n end",
"def squares_by_region(region_id)\n @region_mapper[region_id] || []\n end",
"def distributePrimaryRegions(priRegions)\n c = HBaseConfiguration.new()\n admin = HBaseAdmin.new(c)\n servers = Array.new()\n dServers = Array.new()\n dServers = admin.getClusterStatus.getDeadServerNames()\n serv = admin.getClusterStatus.getServers()\n serv.each do |s|\n if (!dServers.include?(s))\n servers << s.getServerName()\n end\n end\n count=0\n totRS = servers.size()\n priRegions.each do |r|\n puts r+\" will move to \"+servers[count%totRS]\n move r,servers[count%totRS]\n count+=1\n end\n puts priRegions.size().to_s() + \"primary regions moved\"\nend",
"def getRegions(config, servername)\n connection = HConnectionManager::getConnection(config);\n return ProtobufUtil::getOnlineRegions(connection.getAdmin(ServerName.valueOf(servername)));\nend",
"def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end",
"def regions\n @root\n end",
"def tables\n []\n end",
"def regions\n AWS.regions.map(&:name)\n end",
"def parsed_region_ids\n\t region_id = self.area.split(\":\").last.to_i if self.area\n\t return [nil,nil,nil] if region_id == 0 || new_record?\n\t region = Ecstore::Region.find_by_region_id(region_id)\n\t region.region_path.split(',').select{ |x| x.present? }\n \tend",
"def tables\n [\n ]\n end",
"def partitioned_tables\n PartitionedTables.new(connection).all\n end",
"def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend",
"def region_opts\n res = $store.select(RegionTable, \n \"reg_affiliate=? order by reg_name\",\n @data_object.aff_id)\n\n regions = { Affiliate::NONE => \"unassigned\" } \n\n res.each {|r| regions[r.reg_id] = r.reg_name}\n \n regions\n end",
"def get_all_replicas(id, options = GetAllReplicasOptions.new) end",
"def fetch_curr_table\n Array.new\n end",
"def table_array\r\n @table_array\r\n end",
"def set_regions\n return (\n [\n 'Horizontal Region',\n 'Vertical Region',\n 'Horizontal Region',\n 'Vertical Region',\n 'Horizontal Region'\n ]\n )\n end",
"def primary_index_segments\n table.get_index(primary_index[:name]).segments.inject({}) do |h, s|\n v = read_attribute(s.field_name)\n h[s.field_name] = v unless v.nil?\n h\n end\n end",
"def primary_key(_table_name)\n []\n end",
"def regions\n @attributes[:regions]\n end",
"def parsed_region_ids(area_name = \"ship_area\")\n\t\t area_val = self.send(area_name)\n\t\t region_id =area_val.split(\":\").last if area_val\n\t\t return [nil,nil,nil] if region_id.blank? || self.new_record?\n\t\t region = Ecstore::Region.find_by_region_id(region_id)\n\t\t region.region_path.split(',').select{ |x| x.present? }\n\t \tend",
"def select_region\n\n origin_labs = Strain.find_by_sql(\"select origin_lab from strains group by origin_lab\")\n @lab_menu = []\n origin_labs.each do |lab|\n @lab_menu << lab.origin_lab if (lab.origin_lab != nil && lab.origin_lab != '')\n end\n\n origin_country = Strain.find_by_sql(\"select origin from strains group by origin\")\n @country_menu = []\n origin_country.each do |country|\n @country_menu << country.origin if (country.origin != nil && country.origin != '')\n end\n\n chromosomes = MapPosition.find_by_sql(\"select chromosome_label from map_positions where map_id = 1 group by chromosome_label order by chromosome_number asc\")\n @chromosome_menu = []\n chromosomes.each do |chr|\n @chromosome_menu << chr.chromosome_label\n end\n\n @strains = Strain.find(:all, :conditions => ['taxon_id = ?',10116], :order => \"symbol ASC\")\n\n end",
"def current_region(default: [])\n return default unless params[:region]\n icao_starts = params[:region].split(/[\\-,]/)\n icao_starts.compact!\n icao_starts.uniq!\n icao_starts.map!{|s| s.upcase.tr(\"^A-Z\",\"\")}\n return icao_starts\n end",
"def primary_keys(table)\n pks = query(<<-end_sql, 'SCHEMA')\n SELECT DISTINCT attr.attname\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey)\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n pks.present? ? pks[0] : pks\n end",
"def as_array\n row_names = []\n rows = [] \n if @db == @@sdb\n @@sdb.select('select * from `' + @table_name + '`')[:items].each do |row| \n row.each do |row_name, row_data| \n row_names << row_name\n rows << reassemble_sdb_items(row_data)\n end\n end\n elsif @db == @@google_storage\n row_names = as_name_array\n rows = get_rows_from_names(row_names)\n end\n return row_names, rows\n end",
"def index\n @user_regions = UserRegion.all\n end",
"def primary_keys(table)\n row = exec_query(<<-end_sql, 'SCHEMA').rows.map do |row|\n SELECT DISTINCT(attr.attname)\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1]\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n row && row.first\n end\n end",
"def index\n @regional_data_records = @region.regional_data_records.all\n end",
"def rows\n @pz.group_by.each_with_index { |val, n| row_id(n) }\n end",
"def regions\n client.get_stats('/stats/regions')\n end",
"def convert_regions_to_hash\n regions = Region.all.map do |region|\n [region.id, region.name.gsub(/'/, \"''\")]\n end\n regions.to_h\n end",
"def region() ; info[:region] ; end",
"def region() ; info[:region] ; end",
"def subkeys\n return self.class.none unless primary?\n\n self.class.where(primary_key_grip: grip)\n end",
"def tables\n table_names.map { |tn| table(tn) }\n end",
"def index\n @regions = Region.where('active_status=? and del_status=?', true, false)\n end",
"def index\n @gce_regions = GceRegion.all\n end",
"def index\n @regions = Region.all\n end",
"def generate_compaction_plan(table, include_zero)\n # find all primary regions' servers\n t = HTable.new(@CONF, TableName.valueOf(table))\n primary_regions = t.getRegionLocator().getAllRegionLocations().to_a\n primary_regions.reject! { |region_locator| region_locator.getRegionInfo().replicaId != 0 }\n # make primary_region_names a set for faster include? look-ups elsewhere\n primary_region_names = Set.new(primary_regions.map { |rl| rl.getRegionInfo().getRegionNameAsString() })\n servers = primary_regions.map { |region_locator| region_locator.getServerName() }\n servers.uniq!\n \n regions_to_compact = Hash.new\n \n # compute the compaction weight for all servers this table is hosted on\n servers.each do |sn|\n region_loads = @CS.getLoad(sn).getRegionsLoad()\n regions = Hash.new\n region_loads.each do |name, rl|\n next unless primary_region_names.include?(rl.getNameAsString())\n\n weight = compaction_weight(rl)\n (next if weight <= 0) unless include_zero\n regions[weight] = regions.fetch(weight, Array.new).push(rl.getName())\n end\n regions_to_compact[sn] = regions\n end\n\n regions_to_compact\nend",
"def fetch_databag_tenants\n db_tenants = Array.new\n chef_api_connect.search.query(:foundation, '*:*', start: 0).rows.each do |tenant|\n db_tenants << tenant['raw_data']['id']\n end\n return db_tenants\nend",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end",
"def get_objects(target_class, table_name, inclusive = false)\r\n answer = Array.new\r\n\r\n \r\n # Get all the coord_systems with this type of features on them\r\n coord_system_ids_with_features = MetaCoord.find_all_by_table_name(table_name).collect{|mc| mc.coord_system_id}\r\n\r\n # Get the features of the original slice\r\n if coord_system_ids_with_features.include?(self.seq_region.coord_system_id)\r\n sql = ''\r\n if inclusive\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{self.seq_region.id.to_s}\r\nAND (( seq_region_start BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\r\nOR ( seq_region_end BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\r\nOR ( seq_region_start <= #{self.start.to_s} AND seq_region_end >= #{self.stop.to_s} )\r\n )\r\nSQL\r\n else\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{self.seq_region.id.to_s}\r\nAND seq_region_start >= #{self.start.to_s}\r\nAND seq_region_end <= #{self.stop.to_s} \r\nSQL\r\n end\r\n answer.push(target_class.find_by_sql(sql))\r\n coord_system_ids_with_features.delete(self.seq_region.coord_system_id)\r\n end\r\n\r\n # Transform the original slice to other coord systems and get those\r\n # features as well. At the moment, only 'direct' projections can be made.\r\n # Later, I'm hoping to add functionality for following a path from one\r\n # coord_system to another if they're not directly linked in the assembly\r\n # table.\r\n coord_system_ids_with_features.each do |target_coord_system_id|\r\n target_slices = self.project(CoordSystem.find(target_coord_system_id).name)\r\n target_slices.each do |slice|\r\n if slice.class == Slice\r\n if inclusive\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\r\nAND (( seq_region_start BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\r\nOR ( seq_region_end BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\r\nOR ( seq_region_start <= #{slice.start.to_s} AND seq_region_end >= #{slice.stop.to_s} )\r\n )\r\nSQL\r\n else\r\n sql = <<SQL\r\nSELECT * FROM #{table_name}\r\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\r\nAND seq_region_start >= #{slice.start.to_s}\r\nAND seq_region_end <= #{slice.stop.to_s} \r\nSQL\r\n end \r\n answer.push(target_class.find_by_sql(sql))\r\n end\r\n end\r\n end\r\n\r\n answer.flatten!\r\n answer.uniq!\r\n\r\n return answer\r\n end",
"def read_replica_db_cluster_identifiers\n data[:read_replica_db_cluster_identifiers]\n end",
"def get_tables\n tables\n end",
"def all_data_zone_identifiers; end",
"def all_data_zone_identifiers; end",
"def getRegionServers\n @admin.getClusterMetrics.getLiveServerMetrics.keySet.map { |server_name| server_name }\n end",
"def province_ids\n @world.provinces.keys\n end",
"def index\n @regions = Region.all\n end",
"def index\n @regions = Region.all\n end",
"def vaults\n @mapped_vaults ||= Basecamp3::Vault.all(bucket.id, id)\n end",
"def table\n Airmodel.client.table base_config[:base_id], base_config[:table_name]\n end",
"def replicas; end",
"def alignments\n @alignment_table.indexes.keys\n end",
"def omim_ids\n @table.keys\n end",
"def tables\n tables = []\n @a.keys.each{|e| if !e.match(/_base$/) then tables.push(e) end}\n tables\n end",
"def get_objects(target_class, table_name, inclusive = false)\n answer = Array.new\n\n coord_system_ids_with_features = nil\n # Get all the coord_systems with this type of features on them\n if Collection.check\n coord_system_ids_with_features = Collection.find_all_coord_by_table_name(table_name,self.seq_region.coord_system.species_id).collect{|mc| mc.coord_system_id}\n else\n coord_system_ids_with_features = MetaCoord.find_all_by_table_name(table_name).collect{|mc| mc.coord_system_id}\n end \n # Get the features of the original slice\n if coord_system_ids_with_features.include?(self.seq_region.coord_system_id)\n sql = ''\n if inclusive\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{self.seq_region.id.to_s}\nAND (( seq_region_start BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\nOR ( seq_region_end BETWEEN #{self.start.to_s} AND #{self.stop.to_s} )\nOR ( seq_region_start <= #{self.start.to_s} AND seq_region_end >= #{self.stop.to_s} )\n )\nSQL\n else\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{self.seq_region.id.to_s}\nAND seq_region_start >= #{self.start.to_s}\nAND seq_region_end <= #{self.stop.to_s} \nSQL\n end\n answer.push(target_class.find_by_sql(sql))\n coord_system_ids_with_features.delete(self.seq_region.coord_system_id)\n end\n\n # Transform the original slice to other coord systems and get those\n # features as well. At the moment, only 'direct' projections can be made.\n # Later, I'm hoping to add functionality for following a path from one\n # coord_system to another if they're not directly linked in the assembly\n # table.\n coord_system_ids_with_features.each do |target_coord_system_id|\n target_slices = self.project(CoordSystem.find(target_coord_system_id).name)\n target_slices.each do |slice|\n if slice.class == Slice\n if inclusive\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\nAND (( seq_region_start BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\nOR ( seq_region_end BETWEEN #{slice.start.to_s} AND #{slice.stop.to_s} )\nOR ( seq_region_start <= #{slice.start.to_s} AND seq_region_end >= #{slice.stop.to_s} )\n )\nSQL\n else\n sql = <<SQL\nSELECT * FROM #{table_name}\nWHERE seq_region_id = #{slice.seq_region.id.to_s}\nAND seq_region_start >= #{slice.start.to_s}\nAND seq_region_end <= #{slice.stop.to_s} \nSQL\n end \n answer.push(target_class.find_by_sql(sql))\n end\n end\n end\n\n answer.flatten!\n answer.uniq!\n\n return answer\n end",
"def get_tables\n get_schemas.keys\n end",
"def get_regions()\n\t\t{\"include_regions\"=>@include_regions,\"exclude_regions\"=>@exclude_regions}\n\tend",
"def fetch_region(up = 5000, down = 5000)\n sr = core_connection(self.seq_region_id)\n slice = Ensembl::Core::Slice.fetch_by_region(Ensembl::Core::CoordSystem.find(sr.coord_system_id).name,sr.name,self.seq_region_start-up,self.seq_region_end+down)\n return slice\n end",
"def index\n @regionenvironments = Regionenvironment.all\n end",
"def table_name(*partition_key_values)\n return collect_first(*partition_key_values, &:table_name)\n end",
"def as_name_array\n if @db == @@sdb\n as_array[0]\n elsif @db == @@google_storage\n objects = Hash.from_xml(@db.get_bucket(@table_name))[\"ListBucketResult\"][\"Contents\"]\n if objects.nil? #there is no contents node, meaning there are no tables in the database\n []\n else\n objects = [objects] unless objects.is_a?(Array)\n objects.map! {|object| object[\"Key\"]}\n end\n end\n end",
"def loadRegions(options, hostname, port)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config) \n filename = getFilename(options, hostname, port)\n regions = readFile(filename)\n return if regions.isEmpty()\n servername = nil\n # Wait till server is up\n maxWaitInSeconds = admin.getConfiguration.getInt(\"hbase.serverstart.wait.max\", 180)\n maxWait = Time.now + maxWaitInSeconds\n while Time.now < maxWait\n servers = getServers(admin)\n begin\n servername = getServerName(servers, hostname, port)\n rescue ArgumentError => e\n $LOG.info(\"hostname=\" + hostname.to_s + \":\" + port.to_s + \" is not up yet, waiting\");\n end\n break if servername\n sleep 0.5\n end\n $LOG.info(\"Moving \" + regions.size().to_s + \" regions to \" + servername)\n # sleep 20s to make sure the rs finished initialization.\n sleep 20\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n while counter < regions.length do\n r = regions[counter]\n exists = false\n begin\n isSuccessfulScan(admin, r)\n exists = true\n rescue org.apache.hadoop.hbase.NotServingRegionException => e\n $LOG.info(\"Failed scan of \" + e.message)\n end\n next unless exists\n currentServer = getServerNameForRegion(admin, r)\n if currentServer and currentServer == servername\n $LOG.info(\"Region \" + r.getRegionNameAsString() + \" (\" + counter.to_s +\n \" of \" + regions.length.to_s + \") already on target server=\" + servername)\n counter = counter + 1\n next\n end\n pool.launch(r,currentServer,counter) do |_r,_currentServer,_counter|\n $LOG.info(\"Moving region \" + _r.getRegionNameAsString() + \" (\" + (_counter + 1).to_s +\n \" of \" + regions.length.to_s + \") from \" + _currentServer.to_s + \" to server=\" +\n servername); \n move(admin, _r, servername, _currentServer)\n end\n counter = counter + 1\n end\n pool.stop\nend",
"def rows\r\n assert_exists\r\n arr_rows = get_rows\r\n table_rows = Array.new(arr_rows.length)\r\n for i in 0..arr_rows.length - 1 do\r\n table_rows[i] = TableRow.new(@container, :jssh_name, arr_rows[i])\r\n end\r\n return table_rows\r\n end",
"def get_ids_from(table_name)\n DB::Queries.get_ids_from(table: table_name)\nend",
"def region; end",
"def address_regions(address)\n return [] unless address\n \n if address.new_record? && address.country_id\n Region.find_all_by_country_id(address.country_id)\n elsif address.region\n address.regions\n else\n []\n end\n end",
"def load_data\n @regions = Region.find(:all, :order => \"name\")\n end",
"def index\n @regionals = Regional.where(:id=>current_user.parent_id)\n end",
"def index\n @regionais = Regional.all\n end",
"def mksegments(table)\n disjoint, = table.basis(table.instructions)\n remaining = Set.new(table.instructions)\n segment_id = table.instructions.head.segment_use.id\n segments = []\n\n # Scan each interesting element location\n disjoint.each do |(m, n), map|\n if remaining.empty?\n # We've already generated results for each possible instruction\n break\n end\n\n # Likely many values are mapped to only a few unique keys; in this\n # case, `instructions` is a singleton array (that's what makes the\n # value non-ambiguous, there's only one possible instruction)\n map.each do |value, instructions|\n op, = instructions\n repeatable = op.segment_use.definition.element_uses.at(m).repeatable?\n elements = Array.new(m)\n elements[m] =\n if n.nil?\n if repeatable\n repeated(value)\n else\n value\n end\n else\n components = Array.new(n)\n components[n] = value\n\n if repeatable\n repeated(composite(components))\n else\n composite(components)\n end\n end\n\n if remaining.member?(op)\n remaining.delete(op)\n segments.push([op, mksegment_tok(@reader.segment_dict, segment_id, elements, nil)])\n end\n end\n end\n\n segments\n end",
"def read_replica_identifiers\n data[:read_replica_identifiers]\n end",
"def region\n RightScaleAPI::CLOUD_REGIONS.find{|k,v|v == cloud_id}.first\n end",
"def bases_in_region(opts={})\n opts[:region] = opts[:region].to_s if opts[:region] .class == Bio::DB::Fasta::Region \n region = opts[:region]\n calculate_stats_from_pile(opts) if @cached_regions == nil or @cached_regions[region] == nil\n @cached_regions[region].bases \n end",
"def airports_out_of_region\n return Array.new\n end",
"def index\n # Rails.cache.delete('region_list')\n @regions = Rails.cache.fetch(\"region_list\", :expires_in => 1.week) do\n global = Region.find_by_name(\"Global\")\n united_states = Region.find_by_name(\"United States\")\n other_regions = Region.where(\"name != ? AND name != ?\", \"United States\", \"Global\").order(:name)\n \n regions_array = []\n regions_array << global << united_states\n other_regions.each do |region|\n regions_array << region\n end\n regions_array\n end\n\n \n end",
"def glue_tables(client, databases, deployment_id)\n tables = []\n databases.each do |db|\n client.get_tables(database_name: db).each do |resp|\n resp.table_list.each do |table|\n if table.parameters.key?('convergdb_deployment_id')\n if table.parameters['convergdb_deployment_id'] == deployment_id\n tables << {\n name: \"#{db}.#{table.name}\",\n this_deployment: true\n }\n else\n tables << {\n name: \"#{db}.#{table.name}\",\n this_deployment: false\n }\n end\n else\n tables << {\n name: \"#{db}.#{table.name}\",\n this_deployment: false\n }\n end\n end\n end\n end\n tables\n end",
"def rcp_table(row,column); det.table(:id, 'rcpTable')[row][column];end",
"def region_patterns\n @@region_patterns\n end",
"def regionals\n @regionals ||= is_primary? ?\n Locale.where(\"code LIKE ?\", \"#{code}-%\").where.not(id: self.id) :\n nil\n end",
"def index\n @regions = Region.eager_load(:areas).order(:rank)\n end",
"def replication_slots\n typed_exec(<<-SQL)\n SELECT\n slot_name::TEXT,\n plugin::TEXT,\n slot_type::TEXT,\n database::TEXT,\n temporary,\n active\n FROM pg_replication_slots\n SQL\n end",
"def base_route_segments\n table_name.to_s\n end",
"def ancestor_ids\n read_attribute(self.base_class.structure_column).to_s.split(%r|[,/]|).uniq.map { |id| cast_primary_key(id) }\n end",
"def read_replica_db_instance_identifiers\n data[:read_replica_db_instance_identifiers]\n end",
"def regions(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_regions,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/regions\",\n Authorization: auth\n )\n end",
"def index\n @especies_regiones = EspecieRegion.all\n end",
"def region_base_ami_map\n @region_base_ami_map ||= {\n 'us-east-1' => { # US East (Virginia)\n '64-bit' => 'ami-d05e75b8'\n },\n 'us-east-2' => { # US East (Ohio)\n '64-bit' => 'ami-8b92b4ee'\n },\n 'us-west-1' => { # US West (N. California)\n '64-bit' => 'ami-df6a8b9b'\n },\n 'us-west-2' => { # US West (Oregon)\n '64-bit' => 'ami-5189a661'\n },\n 'ca-central-1' => { # Canada (Central)\n '64-bit' => 'ami-b3d965d7'\n },\n 'eu-west-1' => { # EU (Ireland)\n '64-bit' => 'ami-47a23a30'\n },\n 'eu-central-1' => { # EU (Frankfurt)\n '64-bit' => 'ami-accff2b1'\n },\n 'eu-west-2' => { # EU (London)\n '64-bit' => 'ami-cc7066a8'\n },\n 'ap-northeast-1' => { # Asia Pacific (Tokyo)\n '64-bit' => 'ami-785c491f'\n },\n 'ap-southeast-1' => { # Asia Pacific (Singapore)\n '64-bit' => 'ami-2378f540'\n },\n 'ap-southeast-2' => { # Asia Pacific (Sydney)\n '64-bit' => 'ami-e94e5e8a'\n },\n 'ap-northeast-2' => { # Asia Pacific (Seoul)\n '64-bit' => 'ami-94d20dfa'\n },\n 'ap-south-1' => { # Asia Pacific (Mumbai)\n '64-bit' => 'ami-49e59a26'\n },\n 'sa-east-1' => { # South America (Sao Paulo)\n '64-bit' => 'ami-34afc458'\n }\n }\n end",
"def fetch_mapping(storage, arch)\n versions = fetch_versions\n versions.select { |r| r.root_storage == storage && r.arch == arch }\n .group_by(&:region)\n .map { |k, v| [k, v.map { |i| [i.virtualization, i.ami] }.to_h] }.to_h\n .with_indifferent_access\n end",
"def region\n return @region\n end",
"def ids(table)\n res = connection.query(\"SELECT id FROM #{table} GROUP BY id\")\n id_list = []\n res.each { |i| id_list << i[0].to_i }\n return id_list\n end",
"def get_tables\n\t\t@@tables\n\tend",
"def get_aws_ips()\n content = open(\"https://ip-ranges.amazonaws.com/ip-ranges.json\").read\n resp = JSON.parse(content)['prefixes']\n ips = []\n resp.each do |prefix|\n ips << IPAddr.new(prefix['ip_prefix'])\n end\n return ips\nend"
] | [
"0.6588477",
"0.6113635",
"0.5896268",
"0.58489084",
"0.5829196",
"0.58112407",
"0.57174903",
"0.5666384",
"0.5639907",
"0.56119996",
"0.55950606",
"0.55498254",
"0.5516848",
"0.5445279",
"0.543753",
"0.5359669",
"0.5347066",
"0.5328389",
"0.5319675",
"0.53120387",
"0.53077644",
"0.52764684",
"0.52634174",
"0.52622503",
"0.5255783",
"0.52243024",
"0.52033854",
"0.51916355",
"0.5175772",
"0.5157105",
"0.5147459",
"0.5147147",
"0.51353365",
"0.5131549",
"0.51204467",
"0.50963426",
"0.5090497",
"0.5090497",
"0.50896394",
"0.50697154",
"0.50612235",
"0.5054877",
"0.5050459",
"0.5045342",
"0.5042024",
"0.5038765",
"0.5038765",
"0.5038738",
"0.50302255",
"0.50277674",
"0.5020307",
"0.5020307",
"0.50193226",
"0.50135225",
"0.5012486",
"0.5012486",
"0.5003939",
"0.50032175",
"0.50013226",
"0.49975365",
"0.4995453",
"0.49939933",
"0.4967178",
"0.49592492",
"0.49533287",
"0.495257",
"0.49506631",
"0.4939621",
"0.49391472",
"0.49315536",
"0.49303663",
"0.49297485",
"0.4929338",
"0.49199823",
"0.4917422",
"0.49150768",
"0.49052918",
"0.49041075",
"0.49018723",
"0.48857152",
"0.48782068",
"0.4871301",
"0.4862921",
"0.48627645",
"0.48598683",
"0.48594475",
"0.48547494",
"0.48449993",
"0.48444182",
"0.48411453",
"0.48403946",
"0.48402798",
"0.48258764",
"0.48250306",
"0.48169792",
"0.48136613",
"0.4810964",
"0.48088592",
"0.480512",
"0.4798661"
] | 0.7482731 | 0 |
Distribute the regions in the array passed uniformly across the server array provided | def distributePrimaryRegions(priRegions)
c = HBaseConfiguration.new()
admin = HBaseAdmin.new(c)
servers = Array.new()
dServers = Array.new()
dServers = admin.getClusterStatus.getDeadServerNames()
serv = admin.getClusterStatus.getServers()
serv.each do |s|
if (!dServers.include?(s))
servers << s.getServerName()
end
end
count=0
totRS = servers.size()
priRegions.each do |r|
puts r+" will move to "+servers[count%totRS]
move r,servers[count%totRS]
count+=1
end
puts priRegions.size().to_s() + "primary regions moved"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_individually(array_with_number_of_addresses)\n possible_ranges = []\n num = self.to_num()\n bits_to_move = 32 - @bits\n remaining_addresses = self.free\n array_with_number_of_addresses.each() {|number_of_addresses_for_subnet|\n if (2 ** bits_to_move) < number_of_addresses_for_subnet\n puts \"WARNING: could not allocate #{number_of_addresses_for_subnet} anymore (max #{(2 ** bits_to_move)})\"\n next\n end \n bits_to_move = [(Math.log(number_of_addresses_for_subnet+1)/Math.log(2)).to_i, bits_to_move].min \n possible_range = IpMask.create_from_num(num, 32 - bits_to_move)\n unless self.are_all_in_range?(possible_range)\n puts \"WARNING: the selected range '#{possible_range}' is outside the base range\"\n next\n end\n num += number_of_addresses_for_subnet\n puts \"[alloc #{number_of_addresses_for_subnet}] \\tpossible range: #{possible_range}\"\n possible_ranges << possible_range\n remaining_addresses -= (2 ** bits_to_move)\n #puts \"[to allocate = #{number_of_addresses_for_subnet}] => free = #{possible_range.free}\"\n }\n possible_ranges\n end",
"def elements_in_same_block(region_size = 3)\n row_del = @row_idx % region_size\n col_del = @column_idx % region_size\n\n region_shift = region_size -1\n\n start_row_idx = @row_idx - row_del\n start_col_idx = @column_idx - col_del\n\n block_elements = []\n (start_row_idx..start_row_idx+region_shift).each do |row_idx|\n (start_col_idx..start_col_idx+region_shift).each do |col_idx|\n block_elements << @map.element_at(row_idx, col_idx)\n end\n end\n block_elements\n end",
"def move_regions(server)\n if server.class == String\n server = region_servers.find { |a| a.get_server_name.include? server }\n end\n #puts \"moving regions on RS:#{server.to_s}\"\n max_try = 10\n\n r_count = region_count(server)\n while (r_count !=0 && max_try > 0) do\n\n get_regions(server).each { |region|\n move_region(region, @previous_region_server)\n }\n\n sleep 1\n current_count = region_count server\n\n while (r_count > current_count)\n r_count= current_count\n sleep(3)\n end\n end\n @previous_region_server = Bytes.toBytes(server.getServerName())\n\n return max_try > 0\n end",
"def setup_region_tile_mapping\n @region_tile_mapping = {}\n (0..63).each {|i| @region_tile_mapping[i] = []}\n for x in 0..data.xsize\n for y in 0..data.ysize\n @region_tile_mapping[region_id(x, y)] << [x,y]\n end\n end\n end",
"def pick_done_regions\n\t\t$logger.info \"entered\"\n\n\t\tlist = []\n\t\t(0...ai.rows).each do |row|\n\t\t\t(0...ai.cols).each do |col|\n\t\t\t\tsq = ai.map[row][col]\n\t\t\t\tlist << sq if sq.done_region\n\t\t\tend\n\t\tend\n\n\t\tindexes = []\n\t\twhile indexes.length < 10 and indexes.length < list.length\n\t\t\tn = rand( list.length )\n\t\t\tindexes << n unless indexes.include? n\n\t\tend\n\n\t\tout = []\n\t\tindexes.each {|i| out << list[i] }\n\n\t\tout\n\tend",
"def distribute_gels\n show do\n title \"Equally distribute melted gel slices between tubes\"\n note \"Please equally distribute the volume of the following tubes each between two 1.5 mL tubes:\"\n table operations.select{ |op| op.temporary[:is_divided]}.start_table\n .input_item(INPUT)\n .end_table\n note \"Label the new tubes accordingly, and discard the old 1.5 mL tubes.\"\n end if operations.any? { |op| op.temporary[:is_divided] }\n end",
"def squares_by_region(region_id)\n @region_mapper[region_id] || []\n end",
"def normalize_regions(regions)\n regions = regions.sort_by { |r| r.start_time }\n filtered_regions = Array.new\n last_region = regions.shift\n regions.each do |r|\n if r.start_time < last_region.end_time\n last_region.end_time = [last_region.end_time, r.end_time].max\n else\n filtered_regions << last_region\n last_region = r\n end\n end\n if last_region\n filtered_regions << last_region\n end\n filtered_regions\n end",
"def build_distribution\n dist = Array.new(NUM_DICE * SIDES + 1, 0)\n (1..SIDES).each do |i|\n (1..SIDES).each do |j|\n dist[i+j] += 1\n end\n end\n\n # normalize to a probability\n (NUM_DICE..NUM_DICE * SIDES).each do |k|\n dist[k] = dist[k].to_f / 36.to_f\n end\n dist\nend",
"def unloadRegions(options, hostname, port)\n # Clean up any old files.\n filename = getFilename(options, hostname, port)\n deleteFile(filename)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config)\n servers = getServers(admin)\n # Remove the server we are unloading from from list of servers.\n # Side-effect is the servername that matches this hostname \n servername = stripServer(servers, hostname, port)\n\n # Remove the servers in our exclude list from list of servers.\n servers = stripExcludes(servers, options[:excludesFile])\n puts \"Valid region move targets: \", servers\n if servers.length == 0\n puts \"No regions were moved - there was no server available\"\n exit 4\n end\n movedRegions = java.util.Collections.synchronizedList(java.util.ArrayList.new())\n while true\n rs = getRegions(config, servername)\n # Remove those already tried to move\n rs.removeAll(movedRegions)\n break if rs.length == 0\n $LOG.info(\"Moving \" + rs.length.to_s + \" region(s) from \" + servername +\n \" on \" + servers.length.to_s + \" servers using \" + options[:maxthreads].to_s + \" threads.\")\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n server_index = 0\n while counter < rs.length do\n pool.launch(rs,counter,server_index) do |_rs,_counter,_server_index|\n $LOG.info(\"Moving region \" + _rs[_counter].getEncodedName() + \" (\" + (_counter + 1).to_s +\n \" of \" + _rs.length.to_s + \") to server=\" + servers[_server_index] + \" for \" + servername)\n # Assert we can scan region in its current location\n isSuccessfulScan(admin, _rs[_counter])\n # Now move it.\n move(admin, _rs[_counter], servers[_server_index], servername)\n movedRegions.add(_rs[_counter])\n end \n counter += 1\n server_index = (server_index + 1) % servers.length\n end\n $LOG.info(\"Waiting for the pool to complete\")\n pool.stop\n $LOG.info(\"Pool completed\")\n end\n if movedRegions.size() > 0 \n # Write out file of regions moved\n writeFile(filename, movedRegions)\n $LOG.info(\"Wrote list of moved regions to \" + filename)\n end\nend",
"def random_square(region_id)\n reg = @region_mapper[region_id] || []\n reg.sample\n end",
"def adjust_security_groups\n\n all_regions.each do |region|\n c = connection(region)\n g = c.security_groups.get(primary_group)\n \n g.authorize_port_range(1024..65535, :cidr_ip => \"#{master.public_ip_address}/32\")\n nodes.each do |node|\n g.authorize_port_range(1024..65535, :cidr_ip => \"#{node.public_ip_address}/32\")\n end\n end\n end",
"def new_groups(array)\n new_group = []\n array.shuffle.each_slice(4){|acc| new_group << acc}\n if new_group.length > 1 && new_group.last.length <= 2\n (new_group.last.length).times do |i|\n new_group[i].push(new_group.last.pop)\n new_group.pop\n end\n end\n new_group\nend",
"def create_obstacles(array, semester)\n array.map { |hash| create_obstacle(hash, semester) }\n end",
"def scan_regions(regions=[])\n regions_to_scan = regions || REGIONS\n regions_to_scan.each do |region|\n @@path = \"#{BASE_DIR}/#{region}\"\n these_locations = process_directory(@@path)\n out = \"#{@@path}/out/#{Time.now.strftime(\"%Y|%m|%d|%H|%M|%S_\")}#{region}.txt\"\n begin \n File.open(out, 'w+') { |f| \n f.write(these_locations.to_json)\n }\n rescue Exception => e\n puts \"scan_regions ex #{e.message}\"\n rescue => e\n puts \"scan_regions #{e.message}\"\n end\n end\n end",
"def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend",
"def create_group(array)\n \n new_array = array.shuffle\n return new_array.each_slice(4).to_a\nend",
"def create_group(array)\nunit1=array.shuffle!.each_slice(4).to_a\nunit2=array.shuffle!.each_slice(4).to_a\nunit3=array.shuffle!.each_slice(4).to_a\nputs \"Unit1: #{unit1.to_s} Unit2: #{unit2.to_s} Unit3: #{unit3.to_s}\"\nend",
"def calc_root_partition(r, m)\n total_per_r = ((m * (m + 1)) / 2) / r\n root_partition = Array.new(m, -1)\n region_totals = Array.new(r, 0)\n i = m\n while i > 0 do\n for j in 0..r-1 do\n if (region_totals[j] + i <= total_per_r)\n region_totals[j] += i\n root_partition[i-1] = j\n break\n end\n end\n i = (i - 1)\n end\n return root_partition\nend",
"def weighted_random_index(array)\n\nend",
"def cross_individuals(selected_indexes, select_method: :roulette)\n if select_method == :roulette\n m = selected_indexes.size\n (0...m).each do\n x = selected_indexes.sample\n y = selected_indexes.sample\n new_chrom_x, new_chrom_y =\n crossover @chromosomes[x].clone, @chromosomes[y].clone\n evaluate_chromosome new_chrom_x\n evaluate_chromosome new_chrom_y\n @chromosomes << new_chrom_x << new_chrom_y\n end\n elsif select_method == :tournament\n m = selected_indexes.size - 1\n (0...m).each do\n x = selected_indexes.sample\n y = selected_indexes.sample\n new_chrom_x, new_chrom_y =\n crossover @chromosomes[x].clone, @chromosomes[y].clone\n evaluate_chromosome new_chrom_x\n evaluate_chromosome new_chrom_y\n end\n end\n end",
"def extend mult\n self.length = @len*mult\n dist.branches.times do |i|\n hits = self[i].hits\n self[i].clear_hits\n mult.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/mult)\n new_hits + (j.to_f / mult)\n self[i] << new_hits\n end\n end\n end",
"def mutate_matingpool\n (0...@mating_pool.size).each do |i|\n j = rand 0...@num_genes\n chromosome = @mating_pool[i].clone\n gene = chromosome[j]\n gene = gene.zero? ? 1 : 0\n chromosome[j] = gene\n @new_generation << chromosome\n end\n end",
"def construct_ms_per_r(gm, rd, md)\n ms_per_r = Array.new(rd[:num_regions]) {|e| e = Array.new}\n for y in 0...gm[:y] do\n for x in 0...gm[:x] do\n if md[:moves][y][x] != 0\n r = rd[:regions][y][x]\n ms_per_r[r].push(md[:moves][y][x])\n end\n end\n end\n puts \"ms_per_r = \" + ms_per_r.to_s\n return ms_per_r\nend",
"def loadRegions(options, hostname, port)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config) \n filename = getFilename(options, hostname, port)\n regions = readFile(filename)\n return if regions.isEmpty()\n servername = nil\n # Wait till server is up\n maxWaitInSeconds = admin.getConfiguration.getInt(\"hbase.serverstart.wait.max\", 180)\n maxWait = Time.now + maxWaitInSeconds\n while Time.now < maxWait\n servers = getServers(admin)\n begin\n servername = getServerName(servers, hostname, port)\n rescue ArgumentError => e\n $LOG.info(\"hostname=\" + hostname.to_s + \":\" + port.to_s + \" is not up yet, waiting\");\n end\n break if servername\n sleep 0.5\n end\n $LOG.info(\"Moving \" + regions.size().to_s + \" regions to \" + servername)\n # sleep 20s to make sure the rs finished initialization.\n sleep 20\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n while counter < regions.length do\n r = regions[counter]\n exists = false\n begin\n isSuccessfulScan(admin, r)\n exists = true\n rescue org.apache.hadoop.hbase.NotServingRegionException => e\n $LOG.info(\"Failed scan of \" + e.message)\n end\n next unless exists\n currentServer = getServerNameForRegion(admin, r)\n if currentServer and currentServer == servername\n $LOG.info(\"Region \" + r.getRegionNameAsString() + \" (\" + counter.to_s +\n \" of \" + regions.length.to_s + \") already on target server=\" + servername)\n counter = counter + 1\n next\n end\n pool.launch(r,currentServer,counter) do |_r,_currentServer,_counter|\n $LOG.info(\"Moving region \" + _r.getRegionNameAsString() + \" (\" + (_counter + 1).to_s +\n \" of \" + regions.length.to_s + \") from \" + _currentServer.to_s + \" to server=\" +\n servername); \n move(admin, _r, servername, _currentServer)\n end\n counter = counter + 1\n end\n pool.stop\nend",
"def generate_blocks(blocks_array)\r\n size=rand(1..3)\r\n index=0\r\n while blocks_array.length<size\r\n case rand(4)\r\n when 0\r\n blocks_array[index]=Obstacle.new(\"media/man.png\", :man)\r\n when 1\r\n blocks_array[index]=Obstacle.new(\"media/tree.png\", :tree)\r\n when 2\r\n blocks_array[index]=Obstacle.new(\"media/bird.png\", :bird)\r\n when 3\r\n blocks_array[index]=Obstacle.new(\"media/bird2.png\", :bird2)\r\n end\r\n\r\n index+=1\r\n end\r\n end",
"def test_example_part_two\n input = ['1, 1', '1, 6', '8, 3', '3, 4', '5, 5', '8, 9'].join(\"\\n\")\n grid = Grid.new(input, true, 32)\n\n assert_equal 16, grid.region_size\n end",
"def distribute(m, n)\n arr=[]\n return arr if n<=0\n \n if m <=0\n \ta = 0\n \tb = 0\n else \n \ta = m/n\n \tb = m%n\n\tend \n\n n.times {|i| arr[i] = a}\n b.times {|i| arr[i] += 1}\n \n return arr\nend",
"def grid(n, m)\n Array.new(n) { Array.new(n) } # If you attempted to write this as Array.new(n, Array.new(m)) the contents would be repeated for each array rather\nend",
"def expand(*regions)\n regions = normalize_territories(regions.flatten)\n expanded_set(regions).to_a\n end",
"def accountability_groups(name_array, min_members)\n name_array = name_array.clone\n num_groups = name_array.length/min_members\n group_counter = 0\n group_array = Array.new(num_groups) { [] }\n\n while name_array.length > 0\n\ngroup_array[group_counter].push(name_array.delete_at(rand(0...name_array.length)))\n if group_counter == num_groups - 1\n group_counter = 0\n else\n group_counter += 1\n end\n end\n\n return group_array\n\nend",
"def acct_groups(array)\n if array.length % 5 != 0\n num_groups = array.length/5 + 1\n end\n \n cohort = array.shuffle\n groups = Array.new(num_groups) {[]}\n \n groups.each do |group|\n 5.times do \n group << cohort.pop\n end\n end\n \n return groups\nend",
"def accountability_group(dbcCohort_array)\n array_output = dbcCohort_array.shuffle.each_slice(4).to_a\n if array_output.length % 4 == 0 \n return array_output \n else \n remainder_people = array_output.pop \n for i in 0...array_output.length \n array_output[i].push(remainder_people[i])\n end\n return array_output\n end \nend",
"def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end",
"def find_limit(universe, subset)\n \n large_number = 10_000_000_000\n resource = universe + 1\n my_array = Array.new\n \n (0...universe).each do |value|\n my_array\n .push([value+1, value, 0])\n .push([value, value +1, 1])\n end\n p my_array if $PRINT_ARRAY\n \n (0...universe+1).each do |value|\n my_array.push([resource, value, 0])\n end\n p my_array if $PRINT_ARRAY\n \n subset.each do |value|\n my_array\n .push([value[0]-1,value[1], value[2]])\n .push([value[1],value[0]-1, -value[2]])\n end\n p my_array if $PRINT_ARRAY\n \n distribution = [large_number]*(universe+2)\n distribution[resource] = 0\n \n (0...universe+1).each do |value|\n my_array.each do |value|\n distribution[value[1]] = [distribution[value[1]], distribution[value[0]]+value[2]].min\n end\n end\n distribution[universe]-distribution[0]\nend",
"def generate_tile_heights(map_size)\n # USE SUPER SIMPLIFIED VERSION FOR NOW\n return Array.new(map_size, 1)\n\n # STUFF BELOW FOR MORE COMPLEX IMPLEMENTATION IN THE FUTURE\n # I RAN OUT OF TIME :(\n tiles = [\n Array.new((map_size*0.5).floor, 1), \n Array.new((map_size*0.4).floor, 2), \n Array.new((map_size*0.1).floor, 3) \n ].flatten\n\n # Compensate for imperfect percentage rounding \n (map_size - tiles.size).times do |i|\n tiles.push([1, 2, 3].sample)\n end\n\n # Shuffle the tiles to randomly assign them\n tiles = tiles.shuffle\n\n return tiles\n end",
"def construct_ms_per_r(gm, rd, md)\n ms_per_r = Array.new(rd[:num_regions]) {|e| e = Array.new}\n for y in 0...gm[:y] do\n for x in 0...gm[:x] do\n if md[:moves][y][x] != 0\n r = rd[:regions][y][x]\n ms_per_r[r].push(md[:moves][y][x])\n end\n end\n end\n # puts \"ms_per_r = \" + ms_per_r.to_s #NICE TO HAVE\n return ms_per_r\nend",
"def parallels(slave_instance_type, instance_count)\n reduce_slots = Hash.new(1)\n reduce_slots['m1.small'] = 1\n reduce_slots['m1.large'] = 2\n reduce_slots['m1.xlarge'] = 4\n reduce_slots['c1.medium'] = 2\n reduce_slots['c1.xlarge'] = 4\n ((instance_count - 1).to_f * reduce_slots[slave_instance_type].to_f * 0.9).ceil\n end",
"def random_input_array(base, size)\r\n (1..size).map { |i| base**(1+rand(15)) }\r\nend",
"def sharpen ary\n edge_extend(ary).each_cons(3)\n .map {|l,m,r| [0, (-1.0*l + 5.0*m + -1.0*r)].max }\nend",
"def run_race(horses_array)\n horses_array.sample\nend",
"def redistribute_to_segments(seg_one, scpos_one, seg_two, scpos_two, remaining_cluster)\n #scpos is short for 'segment center position'\n sc1x, sc1y = scpos_one[0], scpos_one[1]\n sc2x, sc2y = scpos_two[0], scpos_two[1]\n\n first_seg = seg_one\n second_seg = seg_two\n remaining_cluster.each do |x,y|\n s1_xdiff_sq = (sc1x - x) ** 2\n s1_ydiff_sq = (sc1y - y) ** 2\n s1_sq_sum = s1_xdiff_sq + s1_ydiff_sq\n s1_distance = s1_sq_sum ** 0.5\n\n s2_xdiff_sq = (sc2x - x) ** 2\n s2_ydiff_sq = (sc2y - y) ** 2\n s2_sq_sum = s2_xdiff_sq + s2_ydiff_sq\n s2_distance = s2_sq_sum ** 0.5\n \n if s1_distance < s2_distance\n first_seg << [x,y]\n elsif s2_distance < s1_distance\n \tsecond_seg << [x,y]\n else #if their distances are equal, send to the smaller of the two segments\n \tif first_seg.length < second_seg.length \n \t first_seg << [x,y]\n \telse\n \t second_seg << [x,y]\n \tend\n end\n end\n segments = [first_seg, second_seg]\n return segments \t\n end",
"def addrandomcars(lat0,lon0,lat1,lon1, count )\n Fiber.new do\n count.times do\n lat = (lat1-lat0) * rand() + lat0\n lon = (lon1-lon0) * rand() + lon0\n @pgconn.query(\"insert into cars(lat,lon,avail) values(#{lat},#{lon}, true)\")\n end\n end.resume\n end",
"def generate_vectors size_range, int_range = (0..20)\n\tvector_array = []\n\tsize_range.each do |i|\n\t\tvector_array << Vector.new(rand(int_range), rand(int_range))\n\tend\n\treturn vector_array\nend",
"def blocks_to_vector(blocks)\n target_vectors = 16.times.reduce(Array.new) do |acc, block_index|\n acc << blocks.map { |block| Array(block)[block_index] }\n end\nend",
"def randomized_partition(arr, p, r, ord)\n\ti = rand(p...r)\n\ttemp = arr[i]\n\tarr[i] = arr[r]\n\tarr[r] = temp\n\tpartition(arr, p, r, ord)\nend",
"def mutate_individuals\n m = @chromosomes.size\n (0...m).each do |x|\n r = rand(0.0..1.0)\n next if r > @mut_rate\n\n new_chrom = mutate @chromosomes[x].clone\n evaluate_chromosome new_chrom\n @chromosomes << new_chrom\n end\n end",
"def star_cluster; end",
"def common_subsets(array_one, array_two)\n\nend",
"def random_input_array(base, size)\n\t(1..size).map { |i| base**(1+rand(15)) }\nend",
"def random_input_array(base, size)\n (1..size).map { |i| base**(1+rand(15)) }\nend",
"def random_input_array(base, size)\n (1..size).map { |i| base**(1+rand(15)) }\nend",
"def random_input_array(base, size)\n (1..size).map { |i| base**(1+rand(15)) }\nend",
"def random_input_array(base, size)\n (1..size).map { |i| base**(1+rand(15)) }\nend",
"def random_input_array(base, size)\n (1..size).map { |i| base**(1+rand(15)) }\nend",
"def validate_partition_regions(partition, r_num_cells)\n r_num_cells_sorted = r_num_cells.sort\n p_num_cells = Array.new(r_num_cells.length, 0)\n for i in 0...partition.length do\n p_num_cells[partition[i]] += 1\n end\n p_num_cells_sorted = p_num_cells.sort\n for i in 0...p_num_cells_sorted.length do\n if r_num_cells_sorted[i] < p_num_cells_sorted[i]\n return false\n end\n end\n return true\nend",
"def regions(for_select = true)\n fetch_array_for $regions, for_select\n end",
"def coordinateRegionForItems(items, itemsCount)\n r = MKMapRectNull\n (0..itemsCount).each do |i|\n p = MKMapPointForCoordinate(items[i].coordinate)\n r = MKMapRectUnion(r, MKMapRectMake(p.x, p.y, 0.0, 0.0))\n end\n region = MKCoordinateRegionForMapRect(r)\n\n puts region \n\n region.span.latitudeDelta = region.span.latitudeDelta + region.span.latitudeDelta * 0.5\n region.span.longitudeDelta = region.span.longitudeDelta + region.span.longitudeDelta * 0.8\n\n puts region.span.latitudeDelta \n puts region.span.longitudeDelta\n region\n end",
"def bucket_array( array , from , to )\n rb_tick = (@days * 24 * 60 * 60).to_i\n js_tick = rb_tick * 1000\n from = (from.to_i / rb_tick) * js_tick\n to = (to.to_i / rb_tick)* js_tick\n ret = {}\n while from <= to\n ret[from] = 0\n from += js_tick\n end\n array.each do |item|\n value = item.send(@price_or)\n index = (item.created_at.to_i / rb_tick)*js_tick\n if ret[index] == nil\n puts \"No index #{index} in array (for bucketing) #{ret.to_json}\" if Rails.env == \"development\"\n ret[index] = 0 \n end\n ret[index] = ret[index] + value\n end\n ret.sort\n end",
"def index!(division = 10)\n\t\t@grid_division = division\n\t\t@grid_size = env_max.zip(env_min).map{|x| (x[0] - x[1]).abs}.max / division\n\t\t@db = Hash.new\n\t\tself.each do |e|\n\t\t\th = hash(e.location)\n\t\t\t@db[h] ||= Array.new\n\t\t\t@db[h] << e\n\t\tend\n\t\treturn self\n\tend",
"def generate_grid x = @x, y = @y\n new_grid = []\n\n y.times { new_grid << [] }\n new_grid.each do |array|\n x.times do\n array << []\n end\n end\n end",
"def define_locations_weights(entities)\n locations = []\n locations_weights = {}\n is_areas = false\n is_populations = false\n\n max_population = 0\n max_population_location = nil\n\n ru_locations = []\n\n entities.each do |entity|\n entity.locations.each do |location|\n locations << location\n locations_weights[location] = 0.5\n\n if location.category == COUNTRY\n locations_weights[location] = 0.75\n else\n if location.category == RUSSIA\n unless ru_locations.include?(location)\n ru_locations << location\n end\n elsif not is_areas and location.fclass != POPULATION_CLASS\n is_areas = true\n end\n\n if location.category != WORLD_POPULATION and location.fclass == POPULATION_CLASS\n is_populations = true\n if location.population > max_population\n max_population = location.population\n max_population_location = location\n end\n end\n end\n end\n end\n\n # delete Russia from location if there are russian areas or towns in locations\n if ru_locations.present? and (is_areas or is_populations)\n ru_locations.each do |ru_loc|\n locations_weights.delete(ru_loc)\n locations.delete(ru_loc)\n end\n end\n\n unless max_population_location.nil?\n locations_weights[max_population_location] = 0.9\n end\n\n if locations.count == 1\n locations_weights[locations.first] = 0.95\n else\n locations.each do |location|\n if locations.count(location) > 1\n locations_weights[location] = 0.8\n end\n\n if location.fclass == POPULATION_CLASS\n flag = false\n\n # remove areas which contain this population\n locations.each do |l|\n if l.acode == location.acode and l.fclass != POPULATION_CLASS\n locations_weights[location] = 0.9\n locations_weights.delete(l)\n locations.delete(l)\n\n flag = true\n end\n end\n\n if flag\n # save only population which belongs to some area\n # and delete other populations with that name\n locations.each do |loc|\n if loc.name == location.name and loc.geonameid != location.geonameid\n locations_weights.delete(loc)\n locations.delete(loc)\n end\n end\n end\n\n if not flag and not is_areas and locations_weights[location] < 0.7\n locations_weights[location] = 0.7\n end\n end\n end\n end\n\n deleted = []\n\n # if there are populations with same names\n # save only one with max population\n locations.each_with_index do |loc, index|\n if deleted.include?(loc)\n next\n end\n\n (index + 1).upto(locations.count - 1) do |index2|\n loc2 = locations[index2]\n\n if deleted.include?(loc2)\n next\n end\n\n if loc.name == loc2.name and loc != loc2\n if loc.fclass == ADMINISTRATIVE_CLASS and loc2.fclass == POPULATION_CLASS\n deleted << loc2\n next\n end\n\n # global toponyms have more priority than russian\n if loc2.category == COUNTRY\n deleted << loc\n else\n if loc.population >= loc2.population\n deleted << loc2\n else\n deleted << loc\n end\n end\n end\n\n # delete similar locations with different names\n if loc.geonameid == loc2.geonameid and loc.name != loc2.name\n deleted << loc2\n end\n end\n end\n\n deleted.each do |d|\n locations_weights.delete(d)\n end\n\n locations_weights.sort_by {|k,v| v}.reverse[0...3]\n end",
"def create_cluster(num_servers)\n cluster = []\n (1..num_servers).to_a.each do |num|\n cluster << \"127.0.0.1:#{54320+num}\"\n end\n return cluster\n end",
"def shuffle_cities(array)\n @array_of_city_arrangements = []\n while @array_of_city_arrangements.size < factorial(array.size) \n x = array.shuffle\n if !(@array_of_city_arrangements.include?(x))\n @array_of_city_arrangements.push(x)\n\n end\n end \n #array of array of two element arrays\n @array_of_city_arrangements\n end",
"def fully_extend_all reps=nil\n dist.branches.times do |i|\n hits = mapee(i).hits\n len = mapee(i).length\n mapee(i).clear_hits\n reps = (@len.to_f / len).round if reps.nil?\n mapee(i).length = @len\n reps.times do |j|\n new_hits = HitSq.new\n new_hits << hits\n new_hits * (1.0/reps)\n new_hits + (j.to_f / reps)\n# puts new_hits.hits.inspect\n mapee(i) << new_hits\n end\n# puts mapee(i).hits.hits.inspect\n end\n end",
"def map_servos(servos)\n quadrants = [[], [], [], []]\n servos.each do |servo|\n QuadrantMappings.each_with_index do |mapping, index|\n if mapping.keys.include? servo\n # +1 handles the boards prefered indexing\n quadrants[index] << mapping[servo] + 1\n end\n end\n end\n quadrants\n end",
"def greedy1_initial!(remaining_partitions)\n # Initialize\n site_list = remaining_partitions.sites\n site_index = 0\n partition_index = 0\n total_sites_remaining = remaining_partitions.total_sites\n\n\n total_free_space = self.total_free_space\n\n # Fill each bin starting with the least filled\n self.each_with_index do |bin, bin_index|\n\n # How many sites need to go into the current bin\n sites_for_bin = ((@operations_lower_bound - bin.size).to_f / total_free_space * total_sites_remaining).floor\n\n # Pick (random) site of partition, add to bin and drop from \"remaining_partitions\"\n dropped_partition = remaining_partitions.list.values[partition_index].drop_random_site!\n bin.add!([dropped_partition])\n\n # Do we need to fill two partitions in this bin?\n if site_list[site_index].values.first != site_list[site_index + sites_for_bin - 1].values.first\n partition_index += 1\n\n # Pick (random) site of partition, add to bin and drop from \"remaining_partitions\"\n dropped_partition = remaining_partitions.list.values[partition_index].drop_random_site!\n bin.add!([dropped_partition])\n\n elsif bin_index < @list.size - 1 # Prevent index out of bound\n # Is there a partition switch directly at the beginning of the next bin?\n if site_list[site_index + sites_for_bin - 1].values.first != site_list[site_index + sites_for_bin].values.first\n partition_index += 1\n end\n end\n\n site_index += sites_for_bin\n end\n\n remaining_partitions\n end",
"def redistribute(entries)\n capacity = @capacity\n\n # Rather than using __setup__, initialize the specific values we need to\n # change so we don't eg overwrite @state.\n if @size > @max_entries\n @capacity = capacity * 2\n @max_entries = @max_entries * 2\n @min_entries = @min_entries * 2\n else\n @capacity = capacity / 2\n @max_entries = @max_entries / 2\n @min_entries = @min_entries / 2\n end\n\n @entries = Entries.new @capacity\n @mask = @capacity - 1\n\n i = -1\n while (i += 1) < capacity\n if item = entries[i]\n next if item.deleted\n index = key_index item.key_hash\n index = (1 + index) % @capacity while @entries[index] \n @entries[index] = item\n end\n end\n end",
"def rand_population(n)\r\n\t\treturn Array.new(n) { Snek.new(@start_x,@start_y, Array.new(@nb_heuristic) { @random.rand(-5.0..5.0) }) }\r\n\tend",
"def validate_regions(regions)\n raise 'Invalid regions' unless regions.instance_of? Array\n regions = REGIONS if regions.length.zero?\n regions\n end",
"def map_transfer(transfer_array)\n Systemd::Helpers.map_array(transfer_array, TRANSFER_INDICES)\n end",
"def compute_weighted_center_of_mass(map, pieces)\n #cx = (x0*w0 + x1*w1 + ... + xn*wn) / (w0 + w1 + ... wn)\n total_weight = 0\n cx = 0\n cy = 0\n pieces.each do |loc|\n site = map.site(loc)\n total_weight += site.strength\n cx += loc.x*site.strength\n cy += loc.y*site.strength\n end\n return [cx / total_weight, cy / total_weight]\nend",
"def assign_arrays_to_tenant(args = {}) \n body_put(\"/tenants.json/#{args[:tenantId]}/arrays\", args[:array_of_ids])\nend",
"def henon_map n, x, y, &blk\n xn = [x,y]\n n.times{ yield xn = henon(*xn) }\nend",
"def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend",
"def chunk(array, n)\n\nend",
"def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\nend",
"def slice_fill!(remaining_partitions)\n # Total number of sites that need to be distributed\n total_sites_remaining = remaining_partitions.total_sites\n total_free_space = self.total_free_space\n\n # Fill each bin starting with the least filled\n self.each do |bin|\n\n # How many sites need to go into the current bin\n number_of_sites = ((@operations_lower_bound - bin.size).to_f / total_free_space * total_sites_remaining).ceil # FIXME: It's probably better to round down and save overflow in last bin\n\n # Fill \"number_of_sites\" sites taken from \"remaining_partitions\" into the bin. The rest stays in \"remaining_partitions\"\n dropped_partitions = remaining_partitions.drop_sites!(number_of_sites)\n bin.add!(dropped_partitions)\n end\n end",
"def set_regions\n return (\n [\n 'Horizontal Region',\n 'Vertical Region',\n 'Horizontal Region',\n 'Vertical Region',\n 'Horizontal Region'\n ]\n )\n end",
"def stretch(array)\n\n stretched_array = []\n\n for element in array\n if element % 2 == 0\n stretched_array << element/2\n stretched_array << element/2\n else\n stretched_array << element/2 + 1\n stretched_array << element/2\n end\n end\n\n return stretched_array\n\nend",
"def gen_arr(n, min = 0, max = 999999999)\n n.times.map do |x|\n rand(min..max)\n end\nend",
"def preferred_regions(ingredient, provider_id)\n resource_region_codes = filtered_resources(provider_id).map(&:region_code)\n region_areas = ingredient.region_constraints\n regions = Array.new\n region_areas.each do |region_area|\n preferred_region_codes = Set.new(Resource.region_codes(region_area))\n regions.push(resource_region_codes.map { |rrc| preferred_region_codes.member?(rrc) })\n end\n regions.flatten\n end",
"def ship_deployer(board)\n ship_deploy = [1,2]\n until ship_deploy == []\n sel2 = board.sample\n sel1 = sel2.sample\n if (sel2.index sel1) < 5\n count = 1\n 5.times do\n x = (board.index sel2).to_i\n y = ((sel2.index sel1).to_i + count)\n board[x][y] = ship_deploy[0]\n count += 1\n end\n ship_deploy.slice!(0)\n end\n end\nend",
"def initialize_regions\n @initialized_regions ||= []\n\n # The goal here is get all included and extended modules.\n modules = self.class.included_modules + (class << self; self end).included_modules\n modules.uniq!\n\n # Then each of those modules can be initialized.\n modules.each do |m|\n # First a check is made the that constructor is defined and that it has\n # not been called before.\n next if @initialized_regions.include?(m) || !m.instance_methods.include?(:initialize_region)\n\n m.instance_method(:initialize_region).bind(self).call\n\n @initialized_regions << m\n end\n end",
"def each_dist\n count.times do |i|\n yield( self[i])\n end\n end",
"def create_grid(board_array)\n\t# split into triplets\n\ttriplets_array = []\n board_array.each { |array| triplets_array << array.each_slice(3).to_a }\n\n # shuffle the triplets\n shuffle_container = [[], [], []]\n 9.times do |row|\n 3.times do |column|\n current_array = triplets_array[row][column]\n shuffle_container[column] << current_array\n end\n end\n\n # flatten and re-split\n final_array = []\n shuffle_container.flatten.each_slice(9) { |array| final_array << array }\n\n return final_array\nend",
"def make_groups(array)\n groups=Hash.new\n counter = 1\n while array.length > 3\n selection = array.sample(4)\n groups[counter] = selection\n selection.each {|x| array.delete(x)}\n counter += 1\n end\n while array.length != 0\n counter -= 1\n groups[counter] << array.pop\n end\n groups\nend",
"def space_edition(input_array)\n lowest_range = 1\n highest_range = input_array.length - 1\n \n while (lowest_range < highest_range)\n \n mid = (lowest_range + highest_range) /2\n \n first_half_lowest_range = lowest_range\n first_half_highest_range = mid\n \n second_half_lowest_range = mid + 1\n second_half_highest_range = highest_range\n \n number_of_elements_in_first_half = 0\n input_array.each do |number|\n if number >= first_half_lowest_range && number <= first_half_highest_range \n number_of_elements_in_first_half += 1\n end\n \n number_of_unique_possibilities_in_first_half = first_half_highest_range - first_half_lowest_range + 1\n \n if number_of_elements_in_first_half > number_of_unique_possibilities_in_first_half\n lowest_range, highest_range = first_half_lowest_range, first_half_highest_range\n else\n lowest_range, highest_range = second_half_lowest_range, second_half_highest_range\n end\n end\n \n end\n\n return lowest_range\nend",
"def distribute\n raise NotImplementedError, 'You must be implement\"dist\" method.'\n end",
"def mix mixed_ammount = 0.25\n last_start = 0.0\n dist.branches.times do |i|\n self[i].clear_hits\n self[i] << last_start\n last_start = last_start + (1.0 - mixed_ammount) * (1.0/dist.branches)\n end\n end",
"def group\n students = (1...59).to_a\n students.shuffle.each_slice(5).to_a\nend",
"def whitelisted_filters_for_regions\n requested_parameters = as_array(@params[:regions])\n if requested_parameters.empty?\n []\n else\n regions = []\n requested_parameters.each do |slug|\n region = region_by_slug(slug)\n regions.push(region) if region.present?\n end\n regions\n end\n end",
"def create_map\n Array.new(32) do |x|\n Array.new(32) do |y|\n yield(x, y)\n end\n end\n end",
"def chunk(array, n)\nend",
"def halvsies(array)\n array1 = []\n array2 = []\n n = 0\n array.size.odd? ? m = 1 : m = 0\n\n (array.size / 2 + m).times do\n array1 << array[n]\n n += 1\n end\n\n (array.size / 2).times do\n array2 << array[n]\n n += 1\n end\n\n [array1, array2]\nend",
"def generate_secret_number(range_array)\n\t\trange_array.sample\n\tend",
"def multi_map(arr, n=1, &prc)\n new_arr = []\n\n arr.each do |ele|\n new_ele = ele\n n.times do\n new_ele = prc.call(new_ele)\n end\n\n new_arr << new_ele\n end\n new_arr\n\nend",
"def greedy1_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n # Test each site ...\n src_partition.sites.each do |site|\n\n simulation_result_below_bound = {}\n simulation_result_above_bound = {}\n # ... in each bin ...\n self.each_with_index do |bin, bin_index|\n target_partition = bin.list[src_partition.name]\n if target_partition.nil?\n # Creating a new partition is more costly than the worst case\n operations = @operations_worst_case + 1\n else\n # Simulate insertion of site into existing partition of current bin\n operations = target_partition.incr_add_sites!([site], simulate = true)\n end\n # Check if bin.size is smaller than lower_bound. Save simulation_result accordingly to prefer addition below lower_bound.\n if bin.update_size!.size < @operations_lower_bound\n simulation_result_below_bound.merge!({operations => bin_index})\n else\n simulation_result_above_bound.merge!({operations => bin_index})\n end\n\n end\n\n # Insert at lowest operation cost\n best = if simulation_result_below_bound.empty?\n simulation_result_above_bound.min_by { |operations, bin_index| operations }\n else\n simulation_result_below_bound.min_by { |operations, bin_index| operations }\n end\n target_partition = @list[best[1]].list[src_partition.name]\n if target_partition.nil?\n @list[best[1]].add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end",
"def build(map)\n\t\tnumber_of_players = @players.length\n\t\tregions = case number_of_players\n\t\twhen 2, 3 then 3\n\t\twhen 4 then 4\n\t\twhen 5, 6 then 5\n\t\tend\n\t\tputs C + \"Since you only have #{number_of_players} players, you can only\\nuse #{regions} of the regions. The only requirement is that all the\\nchosen regions need to be connected in some way, no islands.\"\n\t\tif map == :US\n\t\t\tputs \"The colors are connected like this... Purple: Blue, Yellow, and Pink\\nBlue: Purple and Pink -- Pink: Blue, Purple, Pink, Yellow, and Green\\nYellow: Purple, Pink, Green, and Brown -- Brown: Yellow and Green\\nGreen: Brown, Yellow, and Pink\"\n\t\telsif map == :G\n\t\t\tputs \"The colors are connected like this... Green: Pink, Yellow, and Purple\\nPurple: Yellow and Green -- Pink: Blue, Yellow, and Green\\nYellow: Every color -- Blue: Brown, Yellow, and Pink\\nBrown: Blue and Yellow\"\n\t\tend\n\t\tif regions == 3 && map == :US\n\t\t\tacceptable_regions = [[:blue, :pink, :purple], [:blue, :pink, :yellow], [:blue, :pink, :green], [:blue, :purple, :yellow], [:purple, :yellow, :brown], [:purple, :yellow, :green], [:purple, :yellow, :pink], [:purple, :pink, :green], [:brown, :yellow, :green], [:brown, :yellow, :pink], [:brown, :green, :pink], [:green, :yellow, :pink]]\n\t\telsif regions == 3 && map == :G\n\t\t\tacceptable_regions = [[:blue, :brown, :yellow], [:blue, :yellow, :pink], [:blue, :yellow, :green], [:blue, :yellow, :purple], [:blue, :pink, :green], [:brown, :blue, :pink], [:brown, :yellow, :pink], [:brown, :yellow, :green], [:brown, :yellow, :purple], [:purple, :yellow, :pink], [:purple, :yellow, :green], [:purple, :green, :pink], [:green, :yellow, :pink]]\n\t\telsif regions == 4 && map == :US\n\t\t\tunacceptable_regions = [[:green, :yellow], [:pink, :yellow], [:purple, :pink]]\n\t\telsif regions == 4 && map == :G\n\t\t\tunacceptable_regions = [[:blue, :yellow], [:green, :yellow], [:pink, :yellow]]\n\t\tend\n\t\tregions_requested = [\"empty\"]\n\t\tif regions == 3\n\t\t\tuntil acceptable_regions.any? {|combo| combo.all? {|x| regions_requested.include?(x)}}\n\t\t\t\tregions_requested = get_regions(regions)\n\t\t\t\tputs \"\\nThat was not an acceptable combination!\" if not (acceptable_regions.any? {|combo| combo.all? {|x| regions_requested.include?(x)}})\n\t\t\tend\n\t\telsif regions == 4\n\t\t\tuntil unacceptable_regions.all? {|combo| combo.any? {|x| regions_requested.include?(x)}}\n\t\t\t\tregions_requested = get_regions(regions)\n\t\t\t\tputs \"\\nThat was not an acceptable combination!\" if not (unacceptable_regions.all? {|combo| combo.any? {|x| regions_requested.include?(x)}})\n\t\t\tend\n\t\telse\n\t\t\tuntil regions_requested.uniq.length == regions\n\t\t\t\tregions_requested = get_regions(regions)\n\t\t\t\tputs \"\\nNo duplicates allowed!\" if not (regions_requested.uniq.length == regions)\n\t\t\tend\n\t\tend\n\t\t@game_board = case map\n\t\twhen :US then USmap.new.generate(regions_requested, @players)\n\t\twhen :G then Gmap.new.generate(regions_requested, @players)\n\t\tend\n\tend",
"def rawtransforms(nsamples)\n size = 1.0\n nsplit = nsamples - 1\n rsize = size - nsplit * @mindiff\n if rsize < 0.0\n raise(\"RandomFilter rawtransforms error: nsamples #{nsamples} mindiff #{@mindiff} are incompatible\")\n end\n \n mindiffs = Array.new( nsplit, @mindiff )\n \n # compute now nsplit values whose sum is <= to rsize\n randarray = [0.0]\n subarray = (0.0..rsize).rand( nsplit-1 )\n if not subarray.is_a? Array\n subarray = [subarray]\n end\n randarray += subarray\n randarray.push( rsize )\n randarray.sort!\n\n rsizes = Array.new\n randarray.each_cons(2) { |min, max| rsizes.push( (0.0..max-min).rand ) }\n\n rsum = rsizes.sum\n root = (0.0..(rsize-rsum)).rand\n\n # Trace(\"mindiffs #{mindiffs.inspect} rsizes #{rsizes.inspect} rsize #{rsize} rsum #{rsum} root #{root}\")\n\n preresult = []\n mindiffs.zip( rsizes ) {|mindiff, rsize| preresult.push( mindiff + rsize )}\n\n result = [root]\n preresult.each {|v| newv = result[-1] + v; result << newv }\n\n return result\n end"
] | [
"0.5648439",
"0.5311164",
"0.5304631",
"0.51253974",
"0.50617677",
"0.5017626",
"0.49934906",
"0.48969123",
"0.48899093",
"0.4840798",
"0.4821756",
"0.47919583",
"0.47817144",
"0.47581056",
"0.47357437",
"0.47319466",
"0.47319466",
"0.4725475",
"0.47095367",
"0.47092828",
"0.4691971",
"0.46814752",
"0.46765864",
"0.4666943",
"0.46669284",
"0.46552077",
"0.46548057",
"0.46525735",
"0.46428254",
"0.46373773",
"0.46317905",
"0.46299475",
"0.46229887",
"0.46160764",
"0.46070528",
"0.46005395",
"0.4599269",
"0.4592372",
"0.45900327",
"0.45897946",
"0.4588896",
"0.45870912",
"0.45786703",
"0.45718798",
"0.45679966",
"0.4567611",
"0.45571116",
"0.45524034",
"0.4536803",
"0.45363533",
"0.45331728",
"0.45331728",
"0.45331728",
"0.45331728",
"0.45331728",
"0.4525726",
"0.45213816",
"0.45173004",
"0.45130065",
"0.45082748",
"0.4503911",
"0.45021075",
"0.44886628",
"0.44856596",
"0.44827065",
"0.44799176",
"0.4473361",
"0.4466867",
"0.44650546",
"0.4463594",
"0.44632483",
"0.4462192",
"0.4453971",
"0.44427896",
"0.4438781",
"0.44359046",
"0.44353035",
"0.44351777",
"0.44294158",
"0.44292778",
"0.44288722",
"0.44275805",
"0.44209826",
"0.44206417",
"0.44206315",
"0.44203696",
"0.44186553",
"0.44178197",
"0.44145948",
"0.4410222",
"0.4407767",
"0.44058347",
"0.44026282",
"0.4399315",
"0.4394348",
"0.43865016",
"0.43854564",
"0.43847254",
"0.43805578",
"0.43783906"
] | 0.62527525 | 0 |
Check the allocations of primary region replication in the region servers in the cluster | def getPrimaryDistribution(tableName)
c = HBaseConfiguration.new()
tableNameObj = TableName.valueOf(tableName)
t = HTable.new(c, tableNameObj)
regions = t.getRegionsInRange(t.getStartKeys[0],
t.getEndKeys[t.getEndKeys.size-1])
count = Hash.new(0)
regions.each do |r|
#puts r.getRegionInfo().getRegionNameAsString()+" id "+r.getRegionInfo().getReplicaId().to_s()+" enc name "+r.getRegionInfo().getEncodedName()+" server name "+r.getServerName().getHostname()
z = count[r.getServerName().getHostname()]
count[r.getServerName().getHostname()]=z+1
end
count.each do |r,c|
puts r.to_s()+" "+c.to_s()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distributePrimaryRegions(priRegions)\n c = HBaseConfiguration.new()\n admin = HBaseAdmin.new(c)\n servers = Array.new()\n dServers = Array.new()\n dServers = admin.getClusterStatus.getDeadServerNames()\n serv = admin.getClusterStatus.getServers()\n serv.each do |s|\n if (!dServers.include?(s))\n servers << s.getServerName()\n end\n end\n count=0\n totRS = servers.size()\n priRegions.each do |r|\n puts r+\" will move to \"+servers[count%totRS]\n move r,servers[count%totRS]\n count+=1\n end\n puts priRegions.size().to_s() + \"primary regions moved\"\nend",
"def loadRegions(options, hostname, port)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config) \n filename = getFilename(options, hostname, port)\n regions = readFile(filename)\n return if regions.isEmpty()\n servername = nil\n # Wait till server is up\n maxWaitInSeconds = admin.getConfiguration.getInt(\"hbase.serverstart.wait.max\", 180)\n maxWait = Time.now + maxWaitInSeconds\n while Time.now < maxWait\n servers = getServers(admin)\n begin\n servername = getServerName(servers, hostname, port)\n rescue ArgumentError => e\n $LOG.info(\"hostname=\" + hostname.to_s + \":\" + port.to_s + \" is not up yet, waiting\");\n end\n break if servername\n sleep 0.5\n end\n $LOG.info(\"Moving \" + regions.size().to_s + \" regions to \" + servername)\n # sleep 20s to make sure the rs finished initialization.\n sleep 20\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n while counter < regions.length do\n r = regions[counter]\n exists = false\n begin\n isSuccessfulScan(admin, r)\n exists = true\n rescue org.apache.hadoop.hbase.NotServingRegionException => e\n $LOG.info(\"Failed scan of \" + e.message)\n end\n next unless exists\n currentServer = getServerNameForRegion(admin, r)\n if currentServer and currentServer == servername\n $LOG.info(\"Region \" + r.getRegionNameAsString() + \" (\" + counter.to_s +\n \" of \" + regions.length.to_s + \") already on target server=\" + servername)\n counter = counter + 1\n next\n end\n pool.launch(r,currentServer,counter) do |_r,_currentServer,_counter|\n $LOG.info(\"Moving region \" + _r.getRegionNameAsString() + \" (\" + (_counter + 1).to_s +\n \" of \" + regions.length.to_s + \") from \" + _currentServer.to_s + \" to server=\" +\n servername); \n move(admin, _r, servername, _currentServer)\n end\n counter = counter + 1\n end\n pool.stop\nend",
"def unloadRegions(options, hostname, port)\n # Clean up any old files.\n filename = getFilename(options, hostname, port)\n deleteFile(filename)\n # Get configuration\n config = getConfiguration()\n # Get an admin instance\n admin = HBaseAdmin.new(config)\n servers = getServers(admin)\n # Remove the server we are unloading from from list of servers.\n # Side-effect is the servername that matches this hostname \n servername = stripServer(servers, hostname, port)\n\n # Remove the servers in our exclude list from list of servers.\n servers = stripExcludes(servers, options[:excludesFile])\n puts \"Valid region move targets: \", servers\n if servers.length == 0\n puts \"No regions were moved - there was no server available\"\n exit 4\n end\n movedRegions = java.util.Collections.synchronizedList(java.util.ArrayList.new())\n while true\n rs = getRegions(config, servername)\n # Remove those already tried to move\n rs.removeAll(movedRegions)\n break if rs.length == 0\n $LOG.info(\"Moving \" + rs.length.to_s + \" region(s) from \" + servername +\n \" on \" + servers.length.to_s + \" servers using \" + options[:maxthreads].to_s + \" threads.\")\n counter = 0\n pool = ThreadPool.new(options[:maxthreads])\n server_index = 0\n while counter < rs.length do\n pool.launch(rs,counter,server_index) do |_rs,_counter,_server_index|\n $LOG.info(\"Moving region \" + _rs[_counter].getEncodedName() + \" (\" + (_counter + 1).to_s +\n \" of \" + _rs.length.to_s + \") to server=\" + servers[_server_index] + \" for \" + servername)\n # Assert we can scan region in its current location\n isSuccessfulScan(admin, _rs[_counter])\n # Now move it.\n move(admin, _rs[_counter], servers[_server_index], servername)\n movedRegions.add(_rs[_counter])\n end \n counter += 1\n server_index = (server_index + 1) % servers.length\n end\n $LOG.info(\"Waiting for the pool to complete\")\n pool.stop\n $LOG.info(\"Pool completed\")\n end\n if movedRegions.size() > 0 \n # Write out file of regions moved\n writeFile(filename, movedRegions)\n $LOG.info(\"Wrote list of moved regions to \" + filename)\n end\nend",
"def replicas; end",
"def calc_gpus_unallocated\n @gpus_unallocated = 0\n #if @cluster_title.eql?('Owens')\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node|\n # !node.include?(\"dedicated_threads = 28\") && node.include?(\"Unallocated\") }.size\n # elsif @cluster_title.eql?('Pitzer')\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node| !node.include?(\"dedicated_threads = 40\") }.to_s.scan(/gpu_state=Unallocated/).size\n # else @cluster_title.eql?('Ruby')\n # # See line 62. Excluding the two debug nodes from the calculation.\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"Unallocated\") && !node.include?(\"dedicated_threads = 20\") && node.include?(\"np = 20\") }.size\n # @oodClustersAdapter.info_all_each { |job| p job}\n #end\n end",
"def calc_full_nodes_avail\n @full_nodes_available = 0\n #if @cluster_title.eql?(\"Ruby\")\n # # See line 62\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"np = 20\") && node.include?(\"gpu_state=Unallocated\")}.size\n #else\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"gpu_state=Unallocated\") }.size\n #end\n end",
"def retain_replicas_on_node(old_node_ip)\n \n Chef::Log.info( \"***Old node IP : #{old_node_ip}\")\n new_ip = node['ipaddress']\n Chef::Log.info( \"***New node IP : #{new_ip}\")\n \n #get host ip other than the replaced node as old(replaced) ip has already gone from cluster\n computes = node.workorder.payLoad.has_key?(\"RequiresComputes\") ? node.workorder.payLoad.RequiresComputes : node.workorder.payLoad.computes\n other_computes = computes.select { |compute| compute['ciAttributes']['private_ip'] != old_node_ip}\n host = other_computes[0][\"ciAttributes\"][\"private_ip\"]\n port = (node[\"solr_version\"].start_with? \"4.\")?\"8080\":node['port_no']\n \n solrCollectionUrl = \"http://#{host}:#{port}/solr/admin/collections?\"\n \n #Get cluster state to fetch all collection & its details\n params = {:action => \"CLUSTERSTATUS\"}\n cluster_state_resp = solr_collection_api(host, port, params)\n Chef::Log.info(\"cluster_state_resp = #{cluster_state_resp.to_json}\")\n cluster_status_collections = cluster_state_resp[\"cluster\"][\"collections\"]\n \n #Get list of all existing collection names\n collection_names = []\n if !cluster_status_collections.nil? && !cluster_status_collections.empty?\n collection_names = cluster_status_collections.keys\n end\n \n #For each collection->shard->replica, delete replica and add it back if it was hosted on replaced node\n collection_names.each do |collection_name|\n \n #Process next collection if no shards found\n next if cluster_status_collections[collection_name][\"shards\"].nil? || cluster_status_collections[collection_name][\"shards\"].empty?\n \n shard_names = cluster_status_collections[collection_name][\"shards\"].keys\n shards = cluster_status_collections[collection_name][\"shards\"]\n \n #Process each shard to delete and add replica if it was hosted on replaced(old_ip) then delete first and add it back again\n shard_names.each do |shard_name|\n Chef::Log.info( \"*** Processing shard '#{shard_name}' for collection '#{collection_name}'\")\n \n #Process next shard if no replica found\n next if shards[shard_name][\"replicas\"].nil? || shards[shard_name][\"replicas\"].empty?\n \n replica_names = shards[shard_name][\"replicas\"].keys\n replicas = shards[shard_name][\"replicas\"]\n Chef::Log.info( \"*** Replica names for shard #{shard_name} : #{replica_names}\")\n Chef::Log.info( \"*** Replicas for for shard #{shard_name} : #{replicas.to_json}\")\n new_ip_exist = 0\n old_ip_exist = 0\n \n #Process each replica to and if it was hosted on replaced(old_ip) then delete first and add it back again\n replica_names.each do |replica_name|\n Chef::Log.info( \"*** Replica is : #{replica_name}\")\n if (replicas.has_key?replica_name) && (replicas[replica_name][\"base_url\"].include? old_node_ip)\n old_ip_exist += 1\n Chef::Log.info(\"Deleting old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n delete_replica_url = \"#{solrCollectionUrl}action=DELETEREPLICA&collection=#{collection_name}&shard=#{shard_name}&replica=#{replica_name}\"\n Chef::Log.info(\"DELETEREPLICA : #{delete_replica_url}\")\n delete_replica_resp_obj = run_solr_action_api(delete_replica_url)\n Chef::Log.info(\"Deleted old Replica : #{old_node_ip}, for collection = #{collection_name} & shard = #{shard_name} & replica=#{replica_name}\")\n \n #Refresh the collection/shard state to reflect the DELETEREPLICA change\n replicas = get_replicas_by_shard(host, port, collection_name, shard_name)\n Chef::Log.info(\"replicas for collection #{collection_name} & shard #{shard_name} after deleted replica=#{replica_name}\")\n \n else\n Chef::Log.info(\"Skipping Delete Replica for the replica #{replica_name} as no replica found on node #{old_node_ip}\")\n end\n \n # before adding the replica check if the new node ip is part of any collection in the cluster state, if so then don't do it\n # new-IP exists and old-IP too exists - Deletes the replica and sets old_ip_exist = 1, sets new_ip_exist = 1 => No add replica\n # new-IP exists and old-IP does not - doesn't delete replica, old_ip_exist = 0, sets new_ip_exist = 1 => No add replica\n # new-IP does not exist and old IP does - Deletes the replica and sets old_ip_exist = 1, new_ip_exist = 0 => Satisfies the condition for add replica\n Chef::Log.info(\"replicas before checking new_ip = #{replicas.to_json}\")\n Chef::Log.info(\"replicas[replica] before checking new_ip #{new_ip} = #{replicas[replica_name].to_json}\")\n #Check if for shard, any replica is using the new_ip\n if replica_exists_on_ip?(replicas, new_ip)\n Chef::Log.info(\"New IP #{new_ip} is found in the Replica for collection = #{collection_name} & shard = #{shard_name}\")\n new_ip_exist += 1\n else\n Chef::Log.info(\"New IP #{new_ip} is not found in replicas of collection = #{collection_name} & shard = #{shard_name}\")\n end\n end # next replica\n \n #Add replica on new ip if it was deleted from old ip. i.e. if old IP existed and new IP is not shown\n if (old_ip_exist > 0 && new_ip_exist == 0)\n add_replica_url = \"#{solrCollectionUrl}action=ADDREPLICA&collection=#{collection_name}&shard=#{shard_name}&node=#{new_ip}:#{port}_solr\"\n Chef::Log.info(\"ADDREPLICA: #{add_replica_url}\")\n add_replica_resp_obj = run_solr_action_api(add_replica_url)\n Chef::Log.info(\"Added new Replica : #{new_ip}, for collection = #{collection_name} & shard = #{shard_name}\")\n else\n Chef::Log.info(\"Skipping Add Replica for collection = #{collection_name} & shard = #{shard_name}, since value of old_ip_exist=#{old_ip_exist} and value of new_ip_exist=#{new_ip_exist}\")\n end\n end # next shard\n end # next collection\n end",
"def checkNodes(deployed_containers,nova_ip,quantum_ip,token)\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n deployed_containers.each do |deployed_container|\n logger.info \"Checking nodes for deployed container:\" + deployed_container.id.to_s\n # Check all VMs in the container\n deployed_container.deployed_vms.each do |vm|\n begin\n # Ask openstack for the server details\n server = nova.servers(vm.openstack_id)\n logger.info \"Server \" + vm.openstack_id + \" is up.\"\n rescue\n # If openstack returns an error, delete the vm\n logger.info \"Server \" + vm.openstack_id + \" is down. Deleting from deployed container.\"\n vm.destroy()\n end\n end\n\n # Check all networks in the container\n deployed_container.deployed_networks.each do |network|\n begin\n # Ask openstack for the network details\n net = quantum.networks(network.openstack_id)\n logger.info \"Network \" + network.openstack_id + \" is up.\"\n rescue\n # If openstack returns an error, delete the network\n logger.info \"Network \" + network.openstack_id + \" is down. Deleting from deployed container.\"\n network.destroy()\n end\n end\n\n # Check all routers in the container\n deployed_container.deployed_routers.each do |router|\n begin\n # Ask openstack for the router details\n r = quantum.routers(router.openstack_id)\n logger.info \"Router \" + router.openstack_id + \" is up.\"\n rescue\n # If openstack returns an error, delete the router\n logger.info \"Router \" + router.openstack_id + \" is down. Deleting from deployed container.\"\n router.destroy()\n end\n end\n end\n end",
"def get_cluster_ips\n node_ips get_nodes\nend",
"def test_connection\n result = []\n ec2_client = @aws[:Ec2Client]\n ec2_client.describe_regions.regions.each do |region|\n result.push(\"Region #{region.region_name} (#{region.endpoint})\")\n end\n !result.empty?\n end",
"def getRegionServers\n @admin.getClusterMetrics.getLiveServerMetrics.keySet.map { |server_name| server_name }\n end",
"def multiple_clusters_available?\n false\n end",
"def vms_in_host?(host_id)\n\n host = OpenNebula::Host.new_with_id(host_id,get_one_client)\n\n rc = host.info\n\n if OpenNebula::is_error?(rc)\n puts rc.message\n exit -1\n end\n \n host['host_share/running_vms'].to_i\n\nend",
"def grab_scannable_instances(address_blob, active_addresses)\n # list to hold all addresses of a region\n ec2_addresses_list = []\n address_blob.each do |address|\n # gathers all ip addresses for a region and pushes all of them to ec2_addresses_list\n # if they are still active in the account\n ec2_addresses_list.push(address['public_ip_address']) if active_addresses.include?(address['public_ip_address'])\n end\n ec2_addresses_list\nend",
"def getRegions(config, servername)\n connection = HConnectionManager::getConnection(config);\n return ProtobufUtil::getOnlineRegions(connection.getAdmin(ServerName.valueOf(servername)));\nend",
"def check\n refresh\n primary_status = self.primary_status\n secondary_status = self.secondary_status\n mark_message \"Connected to #{session.cluster.nodes.count} nodes in mongodb replica set '#{primary_status['set']}'\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\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 check_cluster\n hostname = \"botha1.cs.ualberta.ca\"\n username = \"prion\"\n keys = ['/apps/phaster/.ssh/botha', '~/.ssh/id_rsa'] # private keys to test (not all the files need to exist)\n\n # Can we connect?\n begin\n ssh = Net::SSH.start(hostname, username, :keys => keys, :auth_methods => ['publickey']) # Only try public key authentication.\n rescue\n #puts \"Unable to connect to #{hostname} using #{username}\"\n return('Unable to connect to the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n # Can qsub command be found?\n res = ssh.exec!('which qsub')\n if res =~ /no qsub in/\n return('A problem was detected on the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n # Are there any cluster child nodes that are alive?\n res = ssh.exec!('alive')\n c = 0\n res.split(\"\\n\").each { |line|\n c += 1\n }\n #puts \"#{c} child nodes available\"\n if c == 0\n return('A problem was detected on the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n ssh.close\n return('')\n end",
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end",
"def replica_set?; true; end",
"def primary_status\n session.cluster.with_primary do |primary|\n primary.command(:admin, replSetGetStatus: 1)\n end\n rescue => e\n raise ConnectionFailed, e\n end",
"def adjust_security_groups\n\n all_regions.each do |region|\n c = connection(region)\n g = c.security_groups.get(primary_group)\n \n g.authorize_port_range(1024..65535, :cidr_ip => \"#{master.public_ip_address}/32\")\n nodes.each do |node|\n g.authorize_port_range(1024..65535, :cidr_ip => \"#{node.public_ip_address}/32\")\n end\n end\n end",
"def query_couchbase_servers\n\n couchbase_servers = Hash.new\n \n r=rightscale_server_collection 'couchbase_cluster_nodes' do\n tags [\"couchbase:cluster_ip=#{cluster_ip}\"]\n secondary_tags [\"server:uuid=*\", \"couchbase:listen_ip=*\"]\n action :nothing\n end\n r.run_action(:load)\n \n node[:server_collection]['couchbase_cluster_nodes'].to_hash.values.each do |tags|\n uuid = RightScale::Utils::Helper.get_tag_value('server:uuid', tags)\n ip = RightScale::Utils::Helper.get_tag_value('couchbase:listen_ip', tags)\n couchbase_servers[uuid] = {}\n couchbase_servers[uuid][:ip] = ip\n end\n \n couchbase_servers\n \n end",
"def region_requested_smaller_than_allowed?\n coordinates = params[\"region\"].split(',')\n xsize = coordinates[2]\n ysize = coordinates[3]\n return true if xsize.to_i < IiifController.min_tile_size_for_low_res\n return true if ysize.to_i < IiifController.min_tile_size_for_low_res\n false\n rescue\n true\n end",
"def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend",
"def monitor_all_vms\n totalmemory = 0\n totalcpu = 0\n\n # Get last cloudwatch monitoring time\n host_obj = OpenNebula::Host.new_with_id(@host_id,\n OpenNebula::Client.new)\n host_obj.info\n cw_mon_time = host_obj[\"/HOST/TEMPLATE/CWMONTIME\"]\n capacity = host_obj.to_hash[\"HOST\"][\"TEMPLATE\"][\"CAPACITY\"]\n if !capacity.nil? && Hash === capacity\n capacity.each{ |name, value|\n name = parse_inst_type(name)\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * value.to_i\n totalcpu += cpu * value.to_i\n }\n else\n raise \"you must define CAPACITY section properly! check the template\"\n end\n\n host_info = \"HYPERVISOR=ec2\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host}\\\"\\n\"\n\n vms_info = \"VM_POLL=YES\\n\"\n\n #\n # Add information for running VMs (running and pending).\n #\n usedcpu = 0\n usedmemory = 0\n\n # Build an array of VMs and last_polls for monitoring\n vpool = OpenNebula::VirtualMachinePool.new(OpenNebula::Client.new,\n OpenNebula::VirtualMachinePool::INFO_ALL_VM)\n vpool.info\n onevm_info = {}\n\n\n if !cw_mon_time\n cw_mon_time = Time.now.to_i\n else\n cw_mon_time = cw_mon_time.to_i\n end\n\n do_cw = (Time.now.to_i - cw_mon_time) >= 360\n vpool.each{\n |vm| onevm_info[vm.deploy_id] = vm\n }\n\n\n work_q = Queue.new\n @ec2.instances.each{|i| work_q.push i }\n\t\tworkers = (0...20).map do\n Thread.new do\n begin\n while i = work_q.pop(true)\n next if i.state.name != 'pending' && i.state.name != 'running'\n one_id = i.tags.find {|t| t.key == 'ONE_ID' }\n one_id = one_id.value if one_id\n poll_data=parse_poll(i, onevm_info[i.id], do_cw, cw_mon_time)\n vm_template_to_one = vm_to_one(i)\n vm_template_to_one = Base64.encode64(vm_template_to_one).gsub(\"\\n\",\"\")\n vms_info << \"VM=[\\n\"\n vms_info << \" ID=#{one_id || -1},\\n\"\n vms_info << \" DEPLOY_ID=#{i.instance_id},\\n\"\n vms_info << \" VM_NAME=#{i.instance_id},\\n\"\n vms_info << \" IMPORT_TEMPLATE=\\\"#{vm_template_to_one}\\\",\\n\"\n vms_info << \" POLL=\\\"#{poll_data}\\\" ]\\n\"\n if one_id\n name = i.instance_type\n cpu, mem = instance_type_capacity(name)\n usedcpu += cpu\n usedmemory += mem\n end\n end\n rescue Exception => e\n end\n end\n end; \"ok\"\n workers.map(&:join); \"ok\"\n\n host_info << \"USEDMEMORY=#{usedmemory.round}\\n\"\n host_info << \"USEDCPU=#{usedcpu.round}\\n\"\n host_info << \"FREEMEMORY=#{(totalmemory - usedmemory).round}\\n\"\n host_info << \"FREECPU=#{(totalcpu - usedcpu).round}\\n\"\n\n if do_cw\n host_info << \"CWMONTIME=#{Time.now.to_i}\"\n else\n host_info << \"CWMONTIME=#{cw_mon_time}\"\n end\n\n puts host_info\n puts vms_info\n end",
"def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end",
"def replica_set?; false; end",
"def validate_partition_regions(partition, r_num_cells)\n r_num_cells_sorted = r_num_cells.sort\n p_num_cells = Array.new(r_num_cells.length, 0)\n for i in 0...partition.length do\n p_num_cells[partition[i]] += 1\n end\n p_num_cells_sorted = p_num_cells.sort\n for i in 0...p_num_cells_sorted.length do\n if r_num_cells_sorted[i] < p_num_cells_sorted[i]\n return false\n end\n end\n return true\nend",
"def requires_monitoring?\n has_next_region = !application.next_region(current_region).nil?\n has_next_region && current_region.requires_monitoring?\n end",
"def which_region_has?(addr, opts={})\r\n refresh opts\r\n @memlist.each_with_index do |r, i|\r\n return i if (r[0]..r[0]+r[1]).member? addr\r\n end\r\n return nil\r\n end",
"def manage_cluster\n @nodes = Node.find(:all)\n end",
"def computeReplicaStats(solrPortNo, cores, failedCores)\n activeReplicas = 0\n recoveringReplicas = 0\n downReplicas = 0\n\n clusterStatusUrl = \"/solr/admin/collections?action=CLUSTERSTATUS&wt=json\"\n\n\n clusterStatusResp = solr_rest_api_get_auth(\"127.0.0.1\", solrPortNo, clusterStatusUrl)\n\n if(clusterStatusResp.code == '200')\n if !clusterStatusResp.body.empty?\n clusterStatusRespObj = JSON.parse(clusterStatusResp.body)\n\n clusterStatusCollections = clusterStatusRespObj[\"cluster\"][\"collections\"]\n collections = clusterStatusCollections.keys\n collections.each do |collection|\n collectionInfo = clusterStatusCollections[collection]\n shards = collectionInfo[\"shards\"].keys\n\n activeNodes, recoveringNodes, downNodes = parseShardListObject(shards, collectionInfo, cores)\n activeReplicas = activeReplicas + activeNodes\n recoveringReplicas = recoveringReplicas + recoveringNodes\n downReplicas = downReplicas + downNodes\n end\n\n failedCoresSize = failedCores.length\n totalCores = cores.length + failedCores.length\n if totalCores != 0\n pctgActiveReplicas = activeReplicas / totalCores * 100\n pctgRecoveringReplicas = recoveringReplicas / totalCores * 100\n pctgDownReplicas = downReplicas / totalCores * 100\n pctgFailedReplicas = failedCoresSize / totalCores * 100\n end\n end\n else\n raise \"Node is in down state.\"\n end\n puts \"pctgActiveReplicas = #{pctgActiveReplicas}, pctgRecoveringReplicas = #{pctgRecoveringReplicas}, pctgDownReplicas = #{pctgDownReplicas}, pctgFailedReplicas = #{pctgFailedReplicas}\"\n return pctgActiveReplicas, pctgRecoveringReplicas, pctgDownReplicas, pctgFailedReplicas\nend",
"def replica_has_node_for_agent?(replica_nodes, agent)\n replica_nodes.each { |replica_node| return true if replica_node['certname'] == agent.hostname }\n host.logger.warn(\"replica doesn't have any nodes for certname '#{agent.hostname}'\")\n false\n end",
"def data_availability(node_size, replica_count, healthy_nodes, failover_nodes)\n\n logger.info \"data_availability:start: node_size = #{node_size}, replica_count = #{replica_count},\n healthy_nodes = #{healthy_nodes}, failover_nodes = #{failover_nodes}\"\n\n data_percent_per_node = 1.0 / node_size\n replica_data_percent_per_node = data_percent_per_node * replica_count\n replica_data_percent_per_node_with_failover = 0\n availability = 0\n\n if (0 < failover_nodes)\n replica_data_percent_per_node_with_failover = replica_data_percent_per_node / (node_size - failover_nodes)\n end\n\n availability = (data_percent_per_node + replica_data_percent_per_node_with_failover) * healthy_nodes\n\n if (availability > 1)\n availability = 1\n end\n return_value = \"#{'%.2f' % (availability * 100)}\"\n\n logger.info \"data_availability:end: return_value = #{return_value}\"\n\n return return_value\n\n end",
"def restart_cluster\n #stop balancing hbase tables in order to restart nodes\n run_balancer(false)\n\n region_servers.each { |region_server|\n unless move_regions(region_server) then\n raise \"unable to move regions #{region_server}\"\n end\n\n unless restart_region_server(region_server) then\n raise \"unable to restart RS #{region_server}\"\n end\n }\n\n run_balancer(true)\n end",
"def move_regions(server)\n if server.class == String\n server = region_servers.find { |a| a.get_server_name.include? server }\n end\n #puts \"moving regions on RS:#{server.to_s}\"\n max_try = 10\n\n r_count = region_count(server)\n while (r_count !=0 && max_try > 0) do\n\n get_regions(server).each { |region|\n move_region(region, @previous_region_server)\n }\n\n sleep 1\n current_count = region_count server\n\n while (r_count > current_count)\n r_count= current_count\n sleep(3)\n end\n end\n @previous_region_server = Bytes.toBytes(server.getServerName())\n\n return max_try > 0\n end",
"def show_summary(compute_ip_to_cloud_domain_map, clusterstatus_resp_obj)\n if (@cloud_provider != \"azure\")\n cloud_ip_cores = Hash.new\n @zone_to_compute_ip_map.each { |cloud_name, computes|\n cloud_ip_cores[cloud_name] = Hash.new\n computes.each { |ip|\n cloud_ip_cores[cloud_name][ip] = Array.new\n }\n }\n collections = clusterstatus_resp_obj[\"cluster\"][\"collections\"]\n collections.each { |coll_name, coll_info|\n shards = coll_info[\"shards\"]\n shards.each { |shard_name, shard_info|\n replicas = shard_info[\"replicas\"]\n replicas.each { |replica_name, replica_info|\n node_name = replica_info[\"node_name\"]\n ip = node_name.slice(0, node_name.index(':'))\n cloud_domain = compute_ip_to_cloud_domain_map[ip]\n cloud_id = cloud_domain.split('___')[0]\n cloud_name = @cloud_id_to_name_map[cloud_id]\n cloud_ip_cores[cloud_name][ip].push(coll_name + \", \" + shard_name + \", \" + replica_name)\n }\n }\n }\n cloud_numcores_map = Hash.new\n cluster_cores = 0\n cloud_ip_cores.each { |cloud_name, cloud_info|\n core_per_cloud = 0\n cloud_info.each { |ip, cores|\n core_per_cloud = core_per_cloud + cores.length\n }\n cluster_cores = cluster_cores + core_per_cloud\n cloud_numcores_map[cloud_name] = core_per_cloud\n }\n # Show both the summary and the detailed information as both are helpful for verification.\n # Ex: Verify cloud_numcores_map => {\"prod-cdc6\":3,\"prod-cdc5\":3}\n Chef::Log.info(\"Verify cloud_numcores_map => #{cloud_numcores_map.to_json}\")\n # Ex: Verify cloud_ip_cores => {\"prod-cdc5\":{\"ip_11\":[\"qw, shard1, core_node3\"],\"ip_22\":[\"qw, shard2, core_node6\"],\"ip_33\":[qw, shard2, core_node5]},\n # \"prod-cdc6\":{\"ip21\":[\"qw, shard1, core_node1\"],\"ip22\":[\"qw, shard1, core_node2\"],\"ip23\":[\"qw, shard2, core_node4\"]}\n Chef::Log.info(\"Verify cloud_ip_cores => #{cloud_ip_cores.to_json}\")\n\n else\n Chef::Log.info(\"Show summary API is not implemented for Azure Cloud Provider yet.\")\n end\n end",
"def generate_lvs_nodes(c)\n dcnut = Datacenter.find_by_name(\"nut\")\n svc = c.cluster_nodes.map do |cn|\n if cn.node.is_server? and cn.node.datacenter == dcnut then\n [ip(cn.ip_address), ip(cn.node.mgmt_ip_address), dec2ip(cn.cluster.fw_mark), cn.node.hostname ] \n else\n nil\n end\n end.compact\n#########################################################33\nend",
"def check_pipeline_overlap(pipeline_range)\n @active_servers = ServerNode.where(state: 'running')\n @active_servers.each do |s|\n if s.pipeline_end.to_i >= pipeline_range[0] or s.pipeline_start.to_i <= pipeline_range[1]\n else\n return false\n end\n end\n return true\n end",
"def restricted_server_identities\n restricted_nodes = []\n if !Rails.configuration.openshift[:allow_multiple_haproxy_on_node] and self.application.scalable and self.component_instances.select { |ci| ci.is_web_proxy? }.present?\n self.group_instance.gears.each do |gear|\n # skip if this is the current gear itself or if its node hasn't been determined yet\n next if gear.uuid == self.uuid or gear.server_identity.nil?\n restricted_nodes << gear.server_identity if gear.component_instances.select { |ci| ci.is_web_proxy? }.present?\n end\n end\n restricted_nodes\n end",
"def read_replica_db_cluster_identifiers\n data[:read_replica_db_cluster_identifiers]\n end",
"def slots_available\r\n begin\r\n serverinfo = $ts.command('serverinfo')\r\n res_slots = serverinfo['virtualserver_reserved_slots']\r\n max_clients = serverinfo['virtualserver_maxclients']\r\n clients_online = serverinfo['virtualserver_clientsonline']\r\n max_clients - (res_slots + clients_online)\r\n rescue\r\n puts '[ERROR] problem getting available slots'\r\n raise 'slots_available'\r\n end\r\nend",
"def ceph_chef_mon_addresses\n mon_ips = ceph_chef_mon_nodes_ip(ceph_chef_mon_nodes)\n mon_ips.reject(&:nil?).uniq\nend",
"def confirm_resize!\n # If the resize bug gets figured out, should put a check here to make sure that it's in the proper state for this.\n data = JSON.generate(:confirmResize => nil)\n response = @compute.connection.csreq(\"POST\",@svrmgmthost,\"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action\",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)\n OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n self.populate\n true\n end",
"def determine_region\n `curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | grep -Po \"(us|sa|eu|ap)-(north|south)?(east|west)?-[0-9]+\"`.strip\n rescue\n new_resource.region\n end",
"def check_for_registry_leaks\n expected = @players.size + @npcs.size\n actual = @registry.size\n if expected != actual\n raise \"We have #{expected} game entities, #{actual} in registry (delta: #{actual - expected})\"\n end\n end",
"def delete_all_cluster_ips\n super\n end",
"def ready?\n return false unless exists?\n instance_arns = ecs_client.list_container_instances(cluster: name).container_instance_arns\n return false if instance_arns.nil? or instance_arns.empty?\n res = ecs_client.describe_container_instances(\n cluster: name,\n container_instances: instance_arns\n )\n # unless res.respond_to?(\"container_instances\") or\n # res.container_instances.nil?\n # return false\n # end\n res.container_instances.all? {|i| i.status == \"ACTIVE\" }\n end",
"def allocated(server=:default)\n @allocated[server]\n end",
"def master_has_node?(replica_node, master_nodes)\n master_nodes.each { |master_node| return true if replica_node['certname'] == master_node['certname'] }\n host.logger.warn(\"master doesn't have node with certname '#{replica_node['certname']}', which is on replica\")\n false\n end",
"def replica_set?\n type == Mongo::Cluster::Topology::ReplicaSetNoPrimary ||\n type == Mongo::Cluster::Topology::ReplicaSetWithPrimary\n end",
"def check_allocation\n if marked_for_destruction? and !candidates.count.zero?\n errors.add(:base, \"CANNOT DELETE BATCH\")\n end\n end",
"def get_region()\n status, stdout, stderr = xenstore_command(\"read\", \"vm-data/provider_data/region\")\n if status == 0\n stdout.strip\n else\n Ohai::Log.debug(\"could not read region information for Rackspace cloud from xen-store\")\n nil\n end\nend",
"def available_addresses\n @subnet.hosts(range: allocation_range, exclude: reserved_addresses)\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 isSameServer(admin, r, original)\n server = getServerNameForRegion(admin, r)\n return false unless server and original\n return server == original\nend",
"def check_server_status\n @server_status_array = Array.new(@lpar_id_array)\n until @server_status_array.empty?\n @server_status_array.each do |lpar|\n lpar_name_index = @server_status_array.find_index(lpar)\n @lpar_name_deployed = @lpar_name_array[lpar_name_index]\n puts \"Checking status of #{@lpar_name_deployed}\"\n get_url('compute')\n @server_status = rest_get(\"#{@resource_url}/servers/#{lpar}\", @token_id)\n @server_id_status = JSON.parse(@server_status)['server']['status']\n puts \"Status of #{@lpar_name_deployed} is #{@server_id_status}\"\n if @server_id_status =~ /ACTIVE/ || @server_id_status =~ /ERROR/\n @server_status_array.delete(lpar)\n else\n puts 'Waiting for 20 seconds'\n sleep 20\n end\n end\n end\n puts 'All LPARs have been deployed, proceed to login to the LPARs.'\n end",
"def master?\n state = get_es_resource(\"/_cluster/state?filter_routing_table=true&filter_metadata=true&filter_indices=true&filter_blocks=true&filter_nodes=true\")\n local = get_es_resource('/_nodes/_local')\n local['nodes'].keys.first == state['master_node']\n end",
"def reconcile\n \n #First sync instances \n Instance.sync_with_ec2\n \n #then make sure this farm is operating withing limits... start and stop based on limits\n #now lets go through our configs and sync what is running with what is configured to run\n\n num_stop = 0\n num_start = 0\n\n logger.info \"Reconciling farm #{ami_id}...\"\n EventLog.info \"Reconciling farm #{ami_id}...\"\n \n ia = instances.select{ |i| i.running?} \n if ia.size < min\n num_start = min.to_i - ia.size\n # need to start some of them\n logger.info \"Attempting to start #{num_start} #{ami_id} instances... may take a few moments.\"\n EventLog.info \"Attempting to start #{num_start} #{ami_id} instances... may take a few moments.\"\n start_and_create_instances(num_start)\n\n elsif ia.size > max\n # need to stop some of the instances, if they are either 'IDLE' or 'LAUNCHED' state or \"ERROR\"\n num_stop = ia.size - max.to_i\n count = 0\n ia.each do |ri|\n break if count >= num_stop\n if ri.available? || ri.error?\n #shut it down!\n logger.info \"Shutting down instance #{ami_id} -- #{ri.instance_id}...\"\n EventLog.info \"Shutting down instance #{ami_id} -- #{ri.instance_id}...\"\n ri.terminate\n count += 1\n end \n end\n end\n \n # shutdown what we can from idle\n \n num_stop += scale_down\n \n #########################\n #\n # now that we scaled down, lets recycle those compute nodes that have not checked in for a while (15 mins)\n # we're looking for those that are available or busy and are compute nodes\n #\n \n ia = instances.select{ |i| i.running?} \n \n ia.each do |ri|\n if (ri.available? || ri.state.eql?('busy')) && ri.farm.farm_type.eql?('compute') && ri.silent_since?(NODE_TIMEOUT)\n #shut down silent nodes\n logger.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive.\"\n EventLog.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive.\"\n ri.terminate\n \n #recycle if not heard from in a while\n # if ri.cycle_count < NODE_CYCLE_MAX\n # logger.info \"Recycling instance #{ri.farm.ami_id} -- #{ri.instance_id}...\"\n # EventLog.info \"Recycling instance #{ri.farm.ami_id} -- #{ri.instance_id}...\"\n # ri.recycle\n # else\n # logger.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive and exceeded max recycle tries.\"\n # EventLog.info \"Shutting down instance #{ri.farm.ami_id} -- #{ri.instance_id} because it was unresponsive and exceeded max recycle tries.\"\n # ri.terminate \n # end\n end \n end\n \n \n return {:farm_name => name, :message => 'Finished reconciling', :num_shutdown => num_stop, :num_started => num_start}\n \n end",
"def vm_instances\n @conn.vminstances\n end",
"def regions\n client.get_stats('/stats/regions')\n end",
"def listNodes\n nodes = []\n me = MU::Cloud::AWS::ServerPool.find(cloud_id: cloud_id).values.first\n if me and me.instances\n me.instances.each { |instance|\n found = MU::MommaCat.findStray(\"AWS\", \"server\", cloud_id: instance.instance_id, region: @region, dummy_ok: true)\n nodes.concat(found)\n }\n end\n nodes\n end",
"def check_pool()\n\n machines_up = []\n machines_down = []\n machines = @resource[:pool]\n machines.each do |machine|\n if alive?(machine)\n machines_up << machine\n else\n machines_down << machine\n end\n end\n return machines_up, machines_down\n \n end",
"def createXRegionReadRep(instId, sourceDbInstId, subnetGrp)\n puts \"Creating cross region replica #{instId} from source DB #{sourceDbInstId} with subnet group #{subnetGrp}\"\n\n begin\n opts = Hash.new\n opts[:db_instance_identifier] = instId\n opts[:source_db_instance_identifier] = sourceDbInstId\n opts[:db_subnet_group_name] = subnetGrp\n @rds.create_db_instance_read_replica(opts)\n rescue Exception => e\n puts \"KSRdsUtil>>createXRegionReadRep: error \" + e.message\n end\n\n end",
"def replica_set\n return nil if @machine.config.mongodb.nil?\n\n @machine.config.mongodb.replsets.find do |rs|\n rs.members.find do |member|\n member[:host] == @machine.name\n end\n end\n end",
"def after_probe_master\n unless @running\n if collins_secondary_role == 'master'\n @master = false\n else\n pool = Jetpants.topology.pool(collins_pool)\n @master = pool.master if pool\n end\n end\n\n # We completely ignore cross-data-center master unless inter_dc_mode is enabled.\n # This may change in a future Jetpants release, once we support tiered replication more cleanly.\n if @master && @master.in_remote_datacenter? && !Jetpants::Plugin::JetCollins.inter_dc_mode?\n @remote_master = @master # keep track of it, in case we need to know later\n @master = false\n elsif !@master\n in_remote_datacenter? # just calling to cache for current node, before we probe its slaves, so that its slaves don't need to query Collins\n end\n end",
"def checkSolrNodeStatus(solrPortNo)\n activeReplicas = 0\n recoveringReplicas = 0\n downReplicas = 0\n\n if(checkSolrProcessIsRunning(solrPortNo))\n coreListUrl = \"/solr/admin/cores?action=STATUS&wt=json\"\n\n coreApiResponse = solr_rest_api_get_auth(\"127.0.0.1\", solrPortNo, coreListUrl)\n\n if(coreApiResponse.code == '200')\n if !coreApiResponse.body.empty?\n coreApiJsonResponse = JSON.parse(coreApiResponse.body)\n coreNames = coreApiJsonResponse[\"status\"].keys\n failedCores = coreApiJsonResponse[\"initFailures\"].keys\n activeReplicas, recoveringReplicas, downReplicas, failedReplicas = computeReplicaStats(solrPortNo, coreNames, failedCores)\n end\n else\n raise \"Node is in down state.\"\n end\n else\n raise \"Node is in down state.\"\n end\n return activeReplicas, recoveringReplicas, downReplicas, failedReplicas\nend",
"def check_workload\n successors.get_workload\n end",
"def notify\n ### TO DO: Flatten the replication group deployment metadata structure. It is probably waaaaaaay too nested.\n if @config[\"create_replication_group\"]\n repl_group = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @region, credentials: @credentials)\n # DNS records for the \"real\" zone should always be registered as late as possible so override_existing only overwrites the records after the resource is ready to use.\n if @config['dns_records']\n @config['dns_records'].each { |dnsrec|\n dnsrec['name'] = repl_group.node_groups.first.primary_endpoint.address.downcase if !dnsrec.has_key?('name')\n dnsrec['name'] = \"#{dnsrec['name']}.#{MU.environment.downcase}\" if dnsrec[\"append_environment_name\"] && !dnsrec['name'].match(/\\.#{MU.environment.downcase}$/)\n }\n end\n # XXX this should be a call to @deploy.nameKitten\n MU::Cloud.resourceClass(\"AWS\", \"DNSZone\").createRecordsFromConfig(@config['dns_records'], target: repl_group.node_groups.first.primary_endpoint.address)\n\n deploy_struct = {\n \"identifier\" => repl_group.replication_group_id,\n \"create_style\" => @config[\"create_style\"],\n \"region\" => @region,\n \"members\" => repl_group.member_clusters,\n \"automatic_failover\" => repl_group.automatic_failover,\n \"snapshotting_cluster_id\" => repl_group.snapshotting_cluster_id,\n \"primary_endpoint\" => repl_group.node_groups.first.primary_endpoint.address,\n \"primary_port\" => repl_group.node_groups.first.primary_endpoint.port\n }\n\n repl_group.member_clusters.each { |id|\n cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(id, region: @region)\n\n vpc_sg_ids = []\n cluster.security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.security_group_id\n }\n\n cache_sg_ids = []\n unless cluster.cache_security_groups.empty?\n cluster.cache_security_groups.each { |cache_sg|\n cache_sg_ids << cache_sg.security_group_id\n }\n end\n\n deploy_struct[id] = {\n \"configuration_endpoint\" => cluster.configuration_endpoint,\n \"cache_node_type\" => cluster.cache_node_type,\n \"engine\" => cluster.engine,\n \"engine_version\" => cluster.engine_version,\n \"num_cache_nodes\" => cluster.num_cache_nodes,\n \"preferred_maintenance_window\" => cluster.preferred_maintenance_window,\n \"notification_configuration\" => cluster.notification_configuration,\n \"cache_security_groups\" => cache_sg_ids,\n \"cache_parameter_group\" => cluster.cache_parameter_group.cache_parameter_group_name,\n \"cache_subnet_group_name\" => cluster.cache_subnet_group_name,\n \"cache_nodes\" => cluster.cache_nodes,\n \"auto_minor_version_upgrade\" => cluster.auto_minor_version_upgrade,\n \"vpc_security_groups\" => vpc_sg_ids,\n \"replication_group_id\" => cluster.replication_group_id,\n \"snapshot_retention_limit\" => cluster.snapshot_retention_limit,\n \"snapshot_window\" => cluster.snapshot_window \n }\n }\n\n repl_group.node_groups.first.node_group_members.each{ |member| \n deploy_struct[member.cache_cluster_id][\"cache_node_id\"] = member.cache_node_id\n deploy_struct[member.cache_cluster_id][\"read_endpoint_address\"] = member.read_endpoint.address\n deploy_struct[member.cache_cluster_id][\"read_endpoint_port\"] = member.read_endpoint.port\n deploy_struct[member.cache_cluster_id][\"current_role\"] = member.current_role\n }\n else\n cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @region, credentials: @credentials)\n\n vpc_sg_ids = []\n cluster.security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.security_group_id\n }\n\n cache_sg_ids = []\n unless cluster.cache_security_groups.empty?\n cluster.cache_security_groups.each { |cache_sg|\n cache_sg_ids << cache_sg.security_group_id\n }\n end\n\n deploy_struct = {\n \"cache_node_type\" => cluster.cache_node_type,\n \"engine\" => cluster.engine,\n \"engine_version\" => cluster.engine_version,\n \"num_cache_nodes\" => cluster.num_cache_nodes,\n \"preferred_maintenance_window\" => cluster.preferred_maintenance_window,\n \"notification_configuration\" => cluster.notification_configuration,\n \"cache_security_groups\" => cache_sg_ids,\n \"cache_parameter_group\" => cluster.cache_parameter_group.cache_parameter_group_name,\n \"cache_subnet_group_name\" => cluster.cache_subnet_group_name,\n \"cache_nodes\" => cluster.cache_nodes,\n \"auto_minor_version_upgrade\" => cluster.auto_minor_version_upgrade,\n \"vpc_security_groups\" => vpc_sg_ids,\n \"replication_group_id\" => cluster.replication_group_id,\n \"snapshot_retention_limit\" => cluster.snapshot_retention_limit,\n \"snapshot_window\" => cluster.snapshot_window \n }\n if !cluster.configuration_endpoint.nil?\n deploy_struct[\"configuration_endpoint_address\"] = cluster.configuration_endpoint.address\n deploy_struct[\"configuration_endpoint_port\"] = cluster.configuration_endpoint.port\n end\n end\n\n return deploy_struct\n end",
"def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end",
"def get_anodes()\n nodes = [] ; 1.upto(32){|i|nodes << \"compute-0-#{i}\"}\n run_cluster(nodes, \"uptime\").map{|e|[e[0], e[1].scan(/\\d\\.\\d\\d/)[0].to_f, e[2]]}.sort_by{|e|e[1]} \nend",
"def getReplicationPeers()\n replAdm = ReplicationAdmin.new(getConfiguration())\n\n repPeers = Array.new()\n repPeers = replAdm.listPeerConfigs\n existingPeerClusters = Array.new\n repPeers.entrySet().each do |e|\n state = replAdm.getPeerState(e.key)\n existingPeerClusters.push([ e.key, e.value.getClusterKey, state ])\n end\n \n replAdm.close()\n\n return existingPeerClusters\nend",
"def available_in?(region)\n available_regions.include?(region)\n end",
"def cluster_status\n report_metric 'Cluster Status/Partitioned', 'nodes', rmq_manager.nodes.count { |n| Array(n['partitions']).any? }\n report_metric 'Cluster Status/Stopped', 'nodes', rmq_manager.nodes.count { |n| !n['running'] }\n end",
"def update_ip_on_mgmt_cluster\n if mgmt_ip_address_changed?\n mgmt_cluster = Cluster.find_mgmt_cluster_by_location(datacenter.name)\n return true if mgmt_cluster.blank?\n cluster_node = cluster_nodes.detect{|cn| cn.cluster == mgmt_cluster}\n return true if cluster_node.blank?\n cluster_node.change_ip(mgmt_ip_address)\n end\n return true\n end",
"def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\n end",
"def servers\n gateway_check\n unavailable_servers_check\n @servers\n end",
"def can_create_cluster?(project)\n project.clusters.empty?\n end",
"def test_get_node_range_no_features\n nodes = @container.get_nodes('1',12,27,0)\n assert_equal(4, nodes.length)\n assert_equal([11,15,0], [nodes[0].start, nodes[0].stop, nodes[0].count])\n assert_equal([16,20,0], [nodes[1].start, nodes[1].stop, nodes[1].count])\n assert_equal([21,25,1], [nodes[2].start, nodes[2].stop, nodes[2].count])\n assert_equal([26,28,0], [nodes[3].start, nodes[3].stop, nodes[3].count])\n end",
"def has_initial_nodes?\n self.host_nodes.where(node_number: {:$lte => self.initial_size}).count == self.initial_size\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 servers\n gateway_check\n @servers\n end",
"def scale_appservers_within_nodes\n if @creds[\"autoscale\"].downcase == \"true\"\n perform_scaling_for_appservers()\n end\n end",
"def show_grid_health(grid, nodes)\n initial_size = grid['initial_size']\n minimum_size = grid['initial_size'] / 2 + 1 # a majority is required for etcd quorum\n\n grid_health = grid_health(grid, nodes)\n initial_nodes = nodes.select{|node| node['initial_member']}\n online_nodes = initial_nodes.select{|node| node['connected']}\n\n # configuration and status\n if initial_nodes.length == 0\n puts \"#{health_icon :error} Grid does not have any initial nodes, and requires at least #{minimum_size} of #{initial_size} initial nodes for operation\"\n elsif online_nodes.empty?\n puts \"#{health_icon :error} Grid does not have any initial nodes online, and requires at least #{minimum_size} of #{initial_size} initial nodes for operation\"\n elsif initial_nodes.length < minimum_size\n puts \"#{health_icon :error} Grid only has #{initial_nodes.length} initial nodes, and requires at least #{minimum_size} of #{initial_size} initial nodes for operation\"\n elsif online_nodes.length < minimum_size\n puts \"#{health_icon :error} Grid only has #{online_nodes.length} initial nodes online, and requires at least #{minimum_size} of #{initial_size} initial nodes for operation\"\n elsif initial_nodes.length < initial_size\n puts \"#{health_icon :warning} Grid only has #{initial_nodes.length} initial nodes of #{initial_size} required for high-availability\"\n elsif online_nodes.length < initial_size\n puts \"#{health_icon :warning} Grid only has #{online_nodes.length} initial nodes online of #{initial_size} required for high-availability\"\n elsif initial_nodes.length == 2\n puts \"#{health_icon :warning} Grid only has #{initial_nodes.length} initial nodes, and is not high-availability\"\n elsif initial_nodes.length == 1\n puts \"#{health_icon :warning} Grid only has #{initial_nodes.length} initial node, and is not high-availability\"\n else\n puts \"#{health_icon :ok} Grid has all #{online_nodes.length} of #{initial_size} initial nodes online\"\n end\n\n nodes.each do |node|\n node_health = node_health(node, grid_health)\n\n if node['connected']\n\n elsif node['initial_member']\n puts \"#{health_icon grid_health} Initial node #{node['name']} is offline\"\n else\n puts \"#{health_icon node_health} Grid node #{node['name']} is offline\"\n end\n end\n\n # operational if we have etcd quorum\n return online_nodes.length >= minimum_size\n end",
"def regions(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_regions,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/regions\",\n Authorization: auth\n )\n end",
"def check_for_existing_chef_objects\n Parallel.map(@bs.nodes, in_threads: @bs.batch_size.to_i) do |node|\n fqdn = node.split('.')\n node_name = fqdn[0] + '.' + fqdn[1]\n cleanup_chef_objects(node_name) if chef_objects_dirty?(node_name)\n end\n end",
"def squares_by_region(region_id)\n @region_mapper[region_id] || []\n end",
"def get_node_ips\n # This uses the kubernetes-provided service token supplied to every container:\n auth_opts = {\n bearer_token: File.read('/var/run/secrets/kubernetes.io/serviceaccount/token')\n }\n\n ssl_opts = {\n verify_ssl: OpenSSL::SSL::VERIFY_NONE\n }\n\n kube_client = Kubeclient::Client.new ENV['KUBE_API_ENDPOINT'], 'v1', ssl_options: ssl_opts, auth_options: auth_opts\n nodes = kube_client.get_nodes\n nodes.map { |n| n.status.addresses.detect { |address| address['type'] == 'InternalIP' }['address'] }\nend",
"def verify_prior_nodes_live(node)\n if node.workorder.has_key?(\"rfcCi\")\n ci = node.workorder.rfcCi\n actionName = node.workorder.rfcCi.rfcAction\n else\n ci = node.workorder.ci\n actionName = node.workorder.actionName\n end\n \n timeout_sec = node['solr_api_timeout_sec'].to_i\n \n #get the map with all cloud's id & deployment order in the form |key,value| => |cloudId, deployment_order|\n #ex {34951930=>\"7\", 35709237=>\"8\", 34951924=>\"4\"}\n cloudIdsWithDpmtOrderMap = cloud_deployment_order(node)\n Chef::Log.info(\"Cloud id & deployment order map : #{cloudIdsWithDpmtOrderMap.to_json}\")\n \n #get array of solrcloud nodes for the action selected\n #get list of all solrcloud nodes which are selected for this action in the deployment\n nodesInAction = get_solrcloud_instances_by_action(node, actionName)\n \n thisNodeCiName = ci[:ciName]\n Chef::Log.info(\"This solrcloud node's ciName : #{thisNodeCiName}\")\n \n #get the node cloud id \"solrcloud-34951924-1\" => \"34951924\"\n thisCloudId = thisNodeCiName.split('-')[1]\n \n #get the deployment order of this node's cloud\n thisNodeCloudDpmtOrder = cloudIdsWithDpmtOrderMap.fetch(thisCloudId.to_i)\n Chef::Log.info(\"This node's cloud deployment order : #{thisNodeCloudDpmtOrder}\")\n \n #get all cloud ids having deployment order <= node_cloud_deployment_order. This is required to make sure that all prior cloud deployment was completed\n #ex From all clouds {34951930=>\"7\", 35709237=>\"8\", 34951924=>\"4\"} for node_cloud_deployment_order = 7 => {34951930=>\"7\", 34951924=>\"4\"}\n #same node_cloud_id is inclusive because there may be multiple nodes in node's cloud.\n #This list is used to make sure that all nodes across this cloud list are deployed first\n cloudIdsTobeDeployedPrior = []\n cloudIdsWithDpmtOrderMap.each do |k, v|\n if v.to_i <= thisNodeCloudDpmtOrder.to_i\n cloudIdsTobeDeployedPrior.push k\n end\n end\n Chef::Log.info(\"Cloud ids to be deployed before : #{cloudIdsTobeDeployedPrior.to_json}\")\n \n #get solrcloud nodes for cloud ids to be deployed prior\n nodeIndexesTobeDeployedPrior = []\n nodesInAction.each do |n|\n ciName = n['ciName']\n cloudId = ciName.split('-')[1]\n index = ciName.split('-', 2)[1]\n if cloudIdsTobeDeployedPrior.include? cloudId.to_i\n # prefx the cloud deployment order to determine the order of solr instace in the deployment\n # User might select the lower cloudId with higher deployment order and vice-versa so deployment order will be useful\n nodeIndexesTobeDeployedPrior.push cloudIdsWithDpmtOrderMap[cloudId.to_i]+\"-\"+index\n end\n end\n \n #sort solrcloud_nodes_tobe_deployed_prior by ciName (cloudId & compute index)\n nodeIndexesTobeDeployedPrior.sort! {|a, b| b <=> a}\n #default sorting is in descending order, we want to process the deployment in the ascending order of compute number\n #so reverse the order\n nodeIndexesTobeDeployedPrior.reverse!\n Chef::Log.info(\"solrclouds to executed before #{nodeIndexesTobeDeployedPrior.to_json}\")\n \n computeCloudIdIpMap = get_compute_number_to_ip_map(node)\n Chef::Log.info(\"compute number to ip map : #{computeCloudIdIpMap.to_json}\")\n # prefx the cloud deployment order to determine the order of solr instace in the deployment\n # User might select the lower cloudId with higher deployment order and vice-versa so deployment order will be useful\n thisNodeIndex = thisNodeCloudDpmtOrder+\"-\"+thisNodeCiName.split('-',2)[1]\n Chef::Log.info(\"This node index : #{thisNodeIndex}\")\n \n # select only the nodes with lower index & this node index\n nodeIndexesTobeDeployedPrior = nodeIndexesTobeDeployedPrior.select {|cloudIdIndex| cloudIdIndex <= thisNodeIndex}\n \n index = nodeIndexesTobeDeployedPrior.index {|id| id == thisNodeIndex}\n Chef::Log.info(\"index = #{index}\")\n \n wait_time = index * 10;\n Chef::Log.info(\"Allowing #{wait_time} seconds for prior nodes to start the deployment before\")\n sleep wait_time\n \n nodeIpsTobeDeployedPrior = []\n nodeIndexesTobeDeployedPrior.each do |nodeIndex|\n if !nodeIndex.eql? thisNodeIndex\n nodeIndexWithoutDpmtOrder = nodeIndex.split('-',2)[1]\n Chef::Log.info(\"nodeIndexWithoutDpmtOrder = #{nodeIndexWithoutDpmtOrder}\")\n nodeIpsTobeDeployedPrior.push computeCloudIdIpMap[nodeIndexWithoutDpmtOrder]\n end\n end\n \n # No need to check for other nodes to confirm those are live before processing this node as there are no prior nodes in the list\n if nodeIpsTobeDeployedPrior.empty?\n return\n end\n \n Chef::Log.info(\"nodeIpsTobeDeployedPrior = #{nodeIpsTobeDeployedPrior.to_json}\")\n host = nodeIpsTobeDeployedPrior[0]\n cluster_state = get_cluster_state(host, node['port_no'], timeout_sec)\n nodes_up_status = nodes_live?(host, node['port_no'], nodeIpsTobeDeployedPrior, timeout_sec)\n Chef::Log.info(\"Node live status : #{nodes_up_status}\")\n if !nodes_up_status \n error = \"Some of the prior nodes from list #{nodeIpsTobeDeployedPrior.to_json} in the deployment are not live.\"\n puts \"***FAULT:FATAL=#{error}\"\n raise error\n end\n end",
"def cluster_stats_includes_underscore_nodes?\n $client.version_support.es_version_5_x?\nend",
"def reconfigure_cloud_when_necessary\n PoolParty.message \"#{number_of_unconfigured_nodes} unconfigured nodes\"\n configure_cloud if number_of_unconfigured_nodes > 0\n end",
"def getserverstatus()\n if not checkRequirements([\"thezone\",\"theserver\"])\n return false\n end\n checkToken(@thezone)\n data = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/zones/#{@theserver.azone.name}/instances/#{@theserver.serial}', :method => 'get', :options => '', :access_token => @thezone.token )\n data ? data[\"status\"] : false\n end",
"def are_too_many_instances_running?\n nodes(:status => \"running\").size > maximum_instances.to_i\n end",
"def gather_zk_ips(cluster)\n zk_ips = ''\n cluster['masters'].each_with_index do |master, i|\n if master['run'].include? 'zookeeper'\n if zk_ips != ''\n zk_ips = zk_ips + \",\"\n end\n zk_ips = zk_ips + cluster['master_ipbase']+\"#{10+i}\"\n end\n end\n return zk_ips\nend",
"def when_all_assigned_ips(&block)\n reset!\n if list_of_nonterminated_instances.select {|a| a.ip == \"not.assigned\" }.empty? \n block.call if block\n else\n vprint \".\"\n wait \"5.seconds\"\n when_all_assigned_ips(&block)\n end\n end",
"def start\n\n cloud = Cloud.new(CloudInfrastructure.new(), CloudLeader.new(), resource,\n method(:err))\n puts \"Starting cloud %s\" % [resource[:name]]\n \n # Check existence\n if !exists?\n # Cloud does not exist => Startup operations\n \n # Check pool of physical machines\n puts \"Checking pool of physical machines...\"\n pm_up, pm_down = cloud.check_pool()\n unless pm_down.empty?\n puts \"Some physical machines are down\"\n pm_down.each do |pm|\n puts \" - #{pm}\"\n end\n end\n \n # Obtain the virtual machines' IPs\n puts \"Obtaining the virtual machines' IPs...\"\n #vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(method(:appscale_yaml_ips),\n # method(:appscale_yaml_images))\n vm_ips, vm_ip_roles, vm_img_roles = obtain_vm_data(cloud.resource)\n \n # Check whether you are one of the virtual machines\n puts \"Checking whether this machine is part of the cloud...\"\n part_of_cloud = vm_ips.include?(MY_IP)\n if part_of_cloud\n puts \"#{MY_IP} is part of the cloud\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up, method(:appscale_monitor))\n else\n cloud.common_start()\n end\n else\n puts \"#{MY_IP} is not part of the cloud\"\n cloud.not_cloud_start(\"appscale\", vm_ips, vm_ip_roles, vm_img_roles,\n pm_up)\n end\n \n else\n \n # Cloud exists => Monitoring operations\n puts \"Cloud already started\"\n \n # Check if you are the leader\n if cloud.leader?()\n cloud.leader_monitoring(method(:appscale_monitor))\n else\n puts \"#{MY_IP} is not the leader\" # Nothing to do\n end\n end\n \n end",
"def auto_discover_nodes!\n @servers = execute(:all_nodes)\n end",
"def available_servers\n authenticate_user!\n @rackspace_servers = Server.rackspace_servers\n end",
"def init_network_lease_counters\n query = 'SELECT oid,body,pid FROM network_pool WHERE pid<>-1'\n\n @db.fetch(query) do |row|\n doc = nokogiri_doc(row[:body])\n\n parent_vnet = doc.root.at_xpath('PARENT_NETWORK_ID').text.to_i\n\n if row[:pid] != parent_vnet\n # TODO\n end\n\n doc.root.xpath('AR_POOL/AR').each do |ar|\n parent_ar_e = ar.at_xpath('PARENT_NETWORK_AR_ID')\n\n next if parent_ar_e.nil? || parent_ar_e.text.empty?\n\n parent_ar = parent_ar_e.text.to_i\n\n if counters[:vnet][parent_vnet][:ar_leases][parent_ar].nil?\n log_error(\"VNet #{row[:oid]} is using parent \" \\\n \"VNet #{parent_vnet}, AR #{parent_ar}, \" \\\n 'but the AR does not exist', false)\n end\n\n # MAC\n first_mac = mac_s_to_i(ar.at_xpath('MAC').text)\n\n # IP\n unless ar.at_xpath('IP').nil?\n first_ip = IPAddr.new(ar.at_xpath('IP').text.strip,\n Socket::AF_INET)\n end\n\n # IP6\n ipv6 = get_ipv6(ar)\n\n addrs = { :mac => first_mac, :ip => first_ip, :ipv6 => ipv6 }\n\n # Parent vnet has a lease for each address of this reservation\n calculate_leases(ar, row[:oid], addrs, parent_vnet, parent_ar)\n end\n end\n end"
] | [
"0.61141026",
"0.58475375",
"0.56714237",
"0.55815756",
"0.5569497",
"0.55681926",
"0.5551988",
"0.54876715",
"0.5474694",
"0.54607695",
"0.5459429",
"0.5452795",
"0.54525924",
"0.5408479",
"0.5386651",
"0.5383213",
"0.5354983",
"0.5354983",
"0.5351252",
"0.53347504",
"0.5324812",
"0.52460074",
"0.52454376",
"0.52448726",
"0.5233147",
"0.5224552",
"0.5204448",
"0.5201057",
"0.5189839",
"0.518693",
"0.5182596",
"0.51705414",
"0.5146449",
"0.5146116",
"0.513603",
"0.51316434",
"0.51266426",
"0.5120305",
"0.5115909",
"0.5115304",
"0.5098588",
"0.50897825",
"0.50864553",
"0.5067761",
"0.5050555",
"0.5049865",
"0.50437886",
"0.50358754",
"0.5027669",
"0.5006889",
"0.49994397",
"0.49949607",
"0.4993938",
"0.49908456",
"0.49895236",
"0.4986969",
"0.49863675",
"0.4985797",
"0.49847057",
"0.49734816",
"0.49683034",
"0.49654064",
"0.49321187",
"0.49272537",
"0.49218005",
"0.4918959",
"0.4913916",
"0.49123445",
"0.49107718",
"0.4901993",
"0.48920393",
"0.48898476",
"0.48897037",
"0.48892593",
"0.48856726",
"0.4883677",
"0.48825637",
"0.48823273",
"0.48815727",
"0.48811126",
"0.48747382",
"0.4868408",
"0.48659834",
"0.4853349",
"0.48449343",
"0.4844307",
"0.48435622",
"0.48404112",
"0.48312768",
"0.4830213",
"0.48297146",
"0.48269877",
"0.48264375",
"0.48238704",
"0.48200244",
"0.48158008",
"0.4814003",
"0.4811892",
"0.48096526",
"0.48080257",
"0.48068905"
] | 0.0 | -1 |
Initializes a new Ban object | def initialize(raw_ban)
@raw_ban = raw_ban
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\r\n @owner = msg.sender\r\n @counter = 0\r\n @bets = Mapping.of( Integer => Bet ) ## type mapping( uint => Bet )\r\n end",
"def initialize(name, bulbs)\n\t\t@name = name\n\t\t@bulbs = bulbs\n\tend",
"def initialize (banco, numero_cuenta, saldo_cuenta = 0)\n @banco = banco\n @numero_cuenta = numero_cuenta\n @saldo_cuenta = saldo_cuenta\n end",
"def ban\n ban = Ban.new\n ban.steamid = params[:id]\n ban.ts = params[:ts]\n ban.sign = params[:sign]\n ban.expiry = DateTime.now.ago(-(params[:len].to_i*60))\n ban.addr = params[:addr]\n ban.reason = params[:reason]\n ban.ban_type = Ban::TYPE_SERVER\n ban.save!\n\n render :text => \"Ok\"\n end",
"def initialize(fighter, bomber)\n create(fighter, bomber)\n end",
"def initialize(bid)\n @bid = bid.to_s.upcase\n raise ArgumentError, \"invalid bid: #{bid}\" unless Bridge.bid?(@bid)\n end",
"def new\n @bet = Bet.new\n end",
"def initialize(user_id, balance)\n # Setting the user_id instance variable to the first value passed in when a bank account is created\n @user_id = user_id\n # Setting the balance instance variable to the second value passed in when a bank account is created\n @balance = balance\n @username = \"\"\n\n # Pushes the newly created instance of bank account into the class variable all\n @@all << self\n end",
"def new\n @bond = Bond.new\n end",
"def initialize()\n @bet = \"user:#{settings.id}:bet\"\n @redis = settings.redis\n @redis_money = \"user:#{settings.id}:money\"\n @redis_chips = \"user:#{settings.id}:chips\"\n @money = @redis.get @redis_money\n @money = @money.to_i\n end",
"def initialize(name)\n # BankAccount BankAccount #initialize initializes with a name\n @name = name\n # BankAccount BankAccount #initialize always initializes with balance of 1000\n @balance = 1000\n # BankAccount BankAccount #initialize always initializes with a status of 'open'\n @status = 'open'\n end",
"def initialize(an, bn, tn, data=nil)\n @bn = bn\n super(an, tn, data)\n end",
"def initialize(balance)\n @balance = balance\n end",
"def initialize(initial_name)\n puts \"I was created\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end",
"def initialize(commodity, bid)\n @commodity = commodity\n @bid = bid\n end",
"def initialize(balance = 0)\n if balance < 0\n raise ArgumentError.new(\"You cannot open an account with a negative amount.\")\n end\n @balance = balance\n @id = Faker::Company.swedish_organisation_number\n # Make sure there are no duplicate ID #s?\n @owner = Bank::Owner.new(account_id: @id, first_name: Faker::Name.first_name, last_name: Faker::Name.last_name, street_address: Faker::Address.street_address, city: Faker::Address.city, state: Faker::Address.state, zip: Faker::Address.zip)\n end",
"def initialize(balance:)\n @balance = balance\n @change = nil\n @product = nil\n end",
"def initialize(name)\n\t\t#when I initialize the bank account I need to do so with my name\n\t\t#always initialize with a balance of 1000\n\t\t@name = name\n\t\t@balance = 1000 \n\t\t@status = \"open\"\n\tend",
"def initialize(b, n, baths)\n @unit = b\n @num_beds = n\n @num_baths = baths\n @tenants = []\n end",
"def set_banco\n @banco = Banco.find(params[:id])\n end",
"def initialize(exisiting_savings) #This gets called when a new instance of a bank account gets created\n # @balance = 0\n @balance = exisiting_savings\n end",
"def initialize(account_id, start_balance, open_date, owner = Owner.new({last_name: \"The_Bank\"}))\n # Check that start_balance argument is a Fixnum & meets minimum balance\n if start_balance.to_i >= self.class::MINIMUM_BALANCE && start_balance.class == Fixnum\n @balance = start_balance\n else\n raise ArgumentError, \"Start balance must be greater than minimum balance: #{ self.class::MINIMUM_BALANCE } cents\"\n end\n\n # Check that owner argument is an Owner object\n if owner.class != Owner\n # If owner argument is a hash, attempt to initialize an Owner from it\n if owner.class == Hash\n owner = Owner.new(owner)\n else\n raise ArgumentError, \"Invalid owner info provided\"\n end\n end\n\n @account_id = account_id\n @open_date = open_date\n @owner = owner\n end",
"def initialize\n\t\t@wallets = Set[ \"0\" ]\n\t\t@uuid = UUID.new\n\n\t\tsuper\n\tend",
"def initialize(apt_no, rent, br, baths)\n\t\t@is_occupied = false\n\t\t@apt_no = apt_no\n\t\t# Note that this then redefines what rent is -- it was actually in place from above, and set to nil\n\t\t@rent = rent\n\n\t\t# Let's set these read-only properties\n\t\t@bedrooms = br\n\t\t@baths = baths\n\tend",
"def initialize(title,author,isbn)\n @title = title\n @author = author\n @isbn = isbn.to_i\n# @borrow = false\n end",
"def initialize\n super\n @bet_amount = 0\n end",
"def initialize(initial_name=nil)\n # what's important to your object\n # upon its creation?\n puts \"I was created!\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end",
"def initialize(holder_name , balance , type)\n @holder_name =holder_name\n @balance = balance\n @type = type\n end",
"def initialize id, balance, open_date, owner = nil\n # error handling for initial negative balance\n if balance >= 0\n @balance = balance\n else\n raise ArgumentError.new \"Inital balance cannot be a negetive value\"\n end\n\n @id = id\n @open_date = DateTime.parse(open_date)\n\n # Assumes that required csv file is accesible\n CSV.read(\"support/account_owners.csv\").each do |line|\n if line[0].to_i == @id\n @owner = Bank::Owner.find(line[1].to_i)\n end\n end\n\n if owner.class == Bank::Owner\n @owner = owner\n else\n # Default instance of the Owner class initialized with empty hash\n @owner = Bank::Owner.new({})\n end\n end",
"def create\n @ban = Ban.new(params[:ban])\n\n respond_to do |format|\n if @ban.save\n flash[:notice] = 'Ban was successfully created.'\n format.html { redirect_to(@ban) }\n format.xml { render :xml => @ban, :status => :created, :location => @ban }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ban.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_banco\n @banco = Banco.find(params[:id])\n end",
"def set_banco\n @banco = Banco.find(params[:id])\n end",
"def set_banco\n @banco = Banco.find(params[:id])\n end",
"def initialize(name, babies, birth_year)\n @name = name \n @babies = babies\n @birth_year = birth_year\n end",
"def initialize(name)\n @name = name #expect(avi).to be_a(BankAccount)\n @balance = 1000\n @status = \"open\"\n @account_total = []\n end",
"def initialize(starting_balance)\n @balance = starting_balance\n end",
"def initialize(name, balance=100)\n @name = name\n @balance = balance\n end",
"def initialize(buyer, price, amount)\n @buyer = buyer\n @bid_price = price\n @desired_amount = amount\n @bought_amount = 0\n end",
"def initialize(climber)\n @climber = climber\n end",
"def initialize(name, balance=100)\n @name = name\n @balance = balance\n end",
"def initialize(name, balance = 100)\n\t\t@name = name\n\t\t@balance = balance\n\tend",
"def initialize(troop_id, member_index, enemy_id = nil)\n super()\n @troop_id = troop_id\n @member_index = member_index\n troop = $data_troops[@troop_id]\n @enemy_id = enemy_id.nil? ? troop.members[@member_index].enemy_id : enemy_id\n enemy = $data_enemies[@enemy_id]\n @battler_name = enemy.battler_name\n @battler_hue = enemy.battler_hue\n @maxhp = maxhp\n @maxsp = maxsp\n @hp = @maxhp\n @sp = @maxsp\n @str = base_str\n @dex = base_dex\n @agi = base_agi\n @int = base_int\n @gold = gold\n @exp = exp\n @hidden = enemy_id.nil? ? troop.members[@member_index].hidden : false\n @immortal = enemy_id.nil? ? troop.members[@member_index].immortal : false\n @steal_items = Enemy_Steal[@enemy_id].to_a\n @steal_attempt = 0\n @moving = @sp_damage = false\n battler_position_setup\n end",
"def initialize(*args)\n @id, @name, @money,\n @bitcoins, @credits,\n @experience, @rank,\n @builders, @x, @y,\n @country, @skin = args\n end",
"def initialize(params = {})\n # set up our initial wallet state\n @messages ||= {}\n # @warning = false\n @cards ||= []\n @errors ||= []\n self.attributes = params\n end",
"def initialize(fan)\n\n @fan = fan\n end",
"def initialize(name, breed)\n @name = name\n @breed = breed\n @action_count = 0\n @laying = false\n end",
"def initialize # utilise la classe player pour demander les infos aux joueurs et la classe baord pour lancer la tipar\n puts \" The Houmous Project présente Morbac\"\n @player_one = Player.new\n @player_one.informations\n @player_two = Player.new\n @player_two.informations\n @boboard = Board.new\n end",
"def initialize(opening_balance, name)\n @opening_balance = opening_balance # We want to know the initial opening balance\n @balance = opening_balance # and set the current balance to the opening balance\n @name = name # We want an account name so we can identify the account and to display the name on the screen.\n @transactions = [] # We want to keep a list of our transactions\n end",
"def initialize\n @shoe = @player_cnt = @dealer = nil\n @num_rounds = @num_shoes = 0\n @num_decks = 1\n @max_players = 4\n @min_bet = 1\n @max_bet = 100\n @bet_increment = 1\n @bankroll = 1000\n @hit_soft_17 = nil\n @even_money_offered = 1 # Hate when casinos don't offer this option\n @players = []\n @broke_players = []\n @io = BlackJackIO.new\n end",
"def initialize(index, enemy_id)\n bosses_initialize(index, enemy_id)\n enemy = $data_enemies[@enemy_id]\n @boss = enemy.boss\n @boss_bars = enemy.boss_bars\n end",
"def initialize(ip)\n\t\t@ip \t\t\t= ip\n\t\t@attempts \t\t= Hash.new\n\t\t@last_attempt \t= Hash.new(Hash.new)\n\t\t@status \t\t= \"VALID\"\n\t\t@last_banned \t= 0\n\t\t@time_to_unban \t= 0\n\tend",
"def initialize(user_id, balance)\n\n # @ is for Instance variables\n @user_id = user_id\n\n @balance = balance\n @username = \"\"\n\n # self is the instance that is being initialized\n # self is only defined in this block\n @@all << self\n end",
"def initialize(bottles)\n\t\tif bottles < 0 then bottles = 0\n\t\telsif bottles > 99 then bottles = 99\n\t\tend\n\t\tself.bottles = bottles\n\tend",
"def initialize(fan)\n @fan = fan\n end",
"def initialize(fan)\n @fan = fan\n end",
"def initialize(name)\n\t\t@name = name\n\t\t@transactions = [ ]\n\t\taddtransaction(\"Beggining balance\", 0.00)\n\tend",
"def initialize\n \n end",
"def initialize(breed, name, age)\n @breed = breed\n @name = name\n @age = age\n @hungry = true\n end",
"def initialize(breed, name, age)\n @breed = breed\n @name = name\n @age = age\n @hungry = true\n end",
"def initialize(player)\n puts \"Welcome to BlackJack!\"\n puts \"#{player.name} you have a balance of: #{player.wallet.amount}\"\n bet(player)\n end",
"def initialize\n create_boss_hp_bar \n bosses_initialize \n end",
"def initialize\n @bets = Array.new()\n end",
"def initialize(name, breed)\n super(name)\n @breed = breed\n end",
"def set_banned\n @banned = Banned.find(params[:id])\n end",
"def initialize\n @ballot = Nps.configuration.ballot_adaptor.new\n end",
"def initialize(name, breed='Mutt')\n @name = name\n @breed = breed\n end",
"def initialize(board)\n @hidden = true\n @flagged = false\n @bomb = false\n @board = board\n end",
"def initialize(balance,account_open_date = Time.now)\n @id = Random.rand(100000..999999)\n @balance\n @account_open_date = account_open_date\n @minimum_balance = 0\n @withdraw_fee = 0\n check_opening_balance(balance)\n show_current_balance\n return @balance\n end",
"def initialize(name)\n @name = name #string\n @balance = 1000 #integer\n @status = \"open\" #string\n end",
"def initialize\n bosses_initialize\n @bhp_frame = Cache.system(\"boss_hp_bar_borders\")\n @bhp_background = Cache.system(\"boss_hp_bar_bcg\")\n @bhp_fill = []\n 5.times { |time|\n @bhp_fill.push(Cache.system(\"boss_hp_bar#{time+1}\"))\n }\n end",
"def set_banesco\n @banesco = Banesco.find(params[:id])\n end",
"def initialize() end",
"def initialize(account_id, balance, opendate)\n super # or super(account_id, balance, opendate); never put super()\n @withdrawal_fee = 2\n end",
"def initialize(name, breed)\n @name = name\n @breed = breed\n end",
"def initialize\n end",
"def initialize(name) # takes in name for account\n @name = name # assigns instance variables\n @balance = 1000 # starting out balance\n @status = \"open\" # sets status to \"open\" when created\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n super\n @height = 1.60\n @weight = 52\n @id_bis = 0\n @type1 = 1\n @type2 = 1\n @base_hp = @base_atk = @base_dfe = @base_spd = @base_ats = @base_dfs = 1\n @ev_hp = @ev_atk = @ev_dfe = @ev_spd = @ev_ats = @ev_dfs = 0\n @move_set = []\n @tech_set = []\n @evolution_level = 0\n @evolution_id = 0\n @special_evolution = nil\n @exp_type = 1\n @base_exp = 100\n @base_loyalty = 0\n @rareness = 0\n @female_rate = 60\n @abilities = [0, 0, 0]\n @breed_groupes = [15, 15]\n @breed_moves = []\n @master_moves = []\n @hatch_step = 1_000_000_000\n @items = [0, 0, 0, 0]\n @baby = 0\n end",
"def initialize(balance, account_holder_name)\n @interest_rate = 1.00001\n @balance = balance\n @account_holder_name = account_holder_name\n end",
"def initialize\n @balance = 0\n end",
"def initialize(abilities)\n @abilities = abilities\n end",
"def initialize(bankname)\n\t\t@bankname = bankname\n\t\t@accounts = {}\n\t\t@cc_limits = {}\n\t\t@cc_balances = {}\n\t\t@cc_holds = {}\n\t\t@cc_rates = {}\n\t\tputs \"#{@bankname} bank was just created.\"\n\tend",
"def ability_initialize(opts)\n ability = data.abilities\n if opts[:ability]\n @ability = opts[:ability]\n else\n ability_chance = rand(100)\n @ability = ability[@ability_index = ABILITY_CHANCES.find_index { |value| value > ability_chance }].to_i\n end\n @ability = GameData::Abilities.find_using_symbol(@ability) unless @ability.is_a?(Integer)\n @ability_current = @ability\n @ability_used = false\n end",
"def initialize()\n end",
"def initialize(name, breed)\n @name = name\n @breed = breed\n @age = 2\n end",
"def initialize\r\n self.credits= 100\r\n self.items = Array.new\r\n end",
"def initialize(br)\n @br = br # get battle result\n @messages_index = 0 # shows the actual mesage of the window\n @messages = [] # array of mesages: exp, gold,e tc\n super(0, 0, 640, (Wep::Lines_to_show * 32) + 32)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.y = 0\n self.back_opacity = 160\n self.visible = false\n generate_messages\n refresh\n end",
"def bans(min=0)\n\t\tb = super\n\n\t\tif min > 0\n\t\t\tb = b.to_a\n\t\t\t(min - b.size).times do\n\t\t\t\tb << ChampionBan.new\n\t\t\tend\n\t\tend\n\n\t\tb\n\tend",
"def new(bot)\n @bot = bot\n end",
"def initialize\n\t\t@cards = []\n\t\t@value = 0\n\t\t@currentBet = 0\n\t\t@hasAce = false\n\t\t@blackjack = false\n\tend",
"def initialize(id, type = :sigmoid, bias = 0, action = :+ )\n\t\t@id = id\n\t\t@type = type\n\t\t@bias = bias\n\t\t@action = action\n\tend",
"def initialize(id, balance, open_date)\n\t\t# ruby dosen't like constants in intialize values, lowercase it\n\t\t\t@id = id\n\t\t\t@balance = balance\n\t\t\t@open_date = open_date\n\t\t\t# pretty_initial_balance = (@initial_balance / 100).to_f\n\t\t\tis_negative # method to determine if transaction would lead to overdraft\n\t\tend",
"def initialize(name)\n @name = name\n @balance = 1000\n @status = \"open\"\n end",
"def initialize(name)\n @name = name\n @balance = 1000\n @status = \"open\"\n end",
"def initialize\n \n @connection_options = Baton.configuration.connection_opts\n\n logger.info \"Connecting to AMQP host: #{@connection_options[:host]}:#{@connection_options[:port]}\"\n\n tries = 10\n seconds_between_tries = 10\n added_seconds_between_tries = 15\n begin\n @session = Bunny.new(@connection_options)\n @session.start\n rescue Exception => e\n tries -= 1\n logger.error(\"#{e.class}: #{e.message}. #{tries} #{tries == 1 ? 'try' : 'tries'} remaining\")\n if tries > 0\n logger.info(\"Trying to connect again in #{seconds_between_tries} seconds\")\n sleep seconds_between_tries\n seconds_between_tries += added_seconds_between_tries\n retry\n else\n exit 1\n end\n end\n \n @channel = @session.channel\n\n # Not everything needs an input exchange; default to the \"\" exchange if there isn't\n # one defined in the config (monitors, for example)\n Baton.configuration.exchange = '' if Baton.configuration.exchange.nil?\n\n # Create the exchanges\n # Input exchange is how baton receives messages\n # Output exchange is how baton returns output\n @exchange_in = channel.direct(Baton.configuration.exchange)\n if Baton.configuration.exchange_out.nil? || Baton.configuration.exchange_out.empty?\n logger.error 'An output exchange must be configured. Exiting.'\n exit 1\n else\n @exchange_out = channel.direct(Baton.configuration.exchange_out)\n end\n\n logger.info 'Connection to AMQP host established'\n end",
"def initialize(id, balance)\n raise ArgumentError.new \"Money Market Accounts must\n have at least $10,000\" if balance < 10000\n super(id, balance)\n @transactions = 6\n end",
"def initialize(sender, receiver, amount)\n @sender = sender\n @receiver = receiver\n @status = \"pending\"\n @amount = amount\n\n end",
"def initialize(*players)\n\t\t@players = players.select{ |p| p.bankroll > 0 }\n\t\t@deck = Deck.new\n\t\t@pot = 0\n\tend",
"def initialize\n print \"Type in your name: \"\n @current_user = gets.strip\n puts \"Hi #{@current_user}, you just joined a chat room! Type your message in and press enter.\"\n\n conn = Bunny.new\n conn.start\n\n @channel = conn.create_channel\n @exchange = @channel.fanout(\"super.chat\")\n\n listen_for_messages\n end"
] | [
"0.68401676",
"0.656826",
"0.65381145",
"0.64578813",
"0.6371757",
"0.6274962",
"0.62144697",
"0.62128013",
"0.6204669",
"0.62019575",
"0.61475253",
"0.6133302",
"0.6085256",
"0.6084247",
"0.60379523",
"0.60094404",
"0.6001493",
"0.59995127",
"0.59748083",
"0.5948451",
"0.59313494",
"0.5924283",
"0.5902989",
"0.5895878",
"0.58781725",
"0.5877789",
"0.58711714",
"0.58586776",
"0.58580846",
"0.58562094",
"0.58543813",
"0.58543813",
"0.58543813",
"0.58537763",
"0.5849606",
"0.5832652",
"0.5830608",
"0.58222747",
"0.5802601",
"0.5791947",
"0.5769917",
"0.5767811",
"0.5764736",
"0.57615715",
"0.5757663",
"0.5753866",
"0.5744589",
"0.57393736",
"0.573275",
"0.57311845",
"0.57116234",
"0.5691736",
"0.5689659",
"0.5688535",
"0.5688535",
"0.5688378",
"0.56828326",
"0.5681143",
"0.5681143",
"0.5680963",
"0.5680305",
"0.5661032",
"0.5659941",
"0.56573945",
"0.5653683",
"0.5649733",
"0.56390095",
"0.5637037",
"0.5636856",
"0.5625526",
"0.5620087",
"0.5607924",
"0.56075525",
"0.5605027",
"0.56049585",
"0.56007904",
"0.5590351",
"0.5590351",
"0.5588488",
"0.55783033",
"0.55745727",
"0.5572956",
"0.55625194",
"0.5550929",
"0.55478585",
"0.55474544",
"0.5544435",
"0.55431944",
"0.55426854",
"0.55362415",
"0.55355424",
"0.5533214",
"0.5532853",
"0.55149543",
"0.55149543",
"0.55135554",
"0.5508722",
"0.5504549",
"0.5498853",
"0.549859"
] | 0.77015656 | 0 |
The player's Steam 64 bit ID | def steam_id
raw_ban['SteamId'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def steam_id\n raw_friend['steamid'].to_i\n end",
"def uid\n id && Base58GMP.encode(id)\n end",
"def tuid\n self.player_id.to_s + self.team_id.to_s\n end",
"def secret_ID(id = nil)\r\n return id ? id >> 16 : @id >> 16\r\n end",
"def identifier\n SecureRandom.hex(16)\n end",
"def unique_id\n object_id.abs.to_s(16)\n end",
"def id(raw = false)\n id = Spotify.image_image_id(@pointer).read_string(20)\n raw ? id : to_hex(id)\n end",
"def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end",
"def get_player_id\n\t\t@player_id\n\tend",
"def hex\n @id.unpack('H*').first\n end",
"def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def uid\n \"#{user_id}-#{team_id}\"\n end",
"def short_id\n Digest::SHA1.hexdigest(hex)[0, 6]\n end",
"def unique_identifier\n Digest::SHA1.hexdigest (\"#{self.screen_name}:#{self.password}\")\n end",
"def unique_identifier\n Digest::MD5.hexdigest(@name.to_s)[0..9]\n end",
"def code\n id ? id.to_s(36) : nil\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{screen_name}:#{password}\")\n end",
"def unique_id\n '%8x%s@%s' % [\n Time.now.to_i,\n Digest::SHA1.hexdigest(\n '%.8f%8x' % [ Time.now.to_f, rand(1 << 32) ]\n )[0, 32],\n Socket.gethostname\n ]\n end",
"def gen_id\n SecureRandom.hex(32)\n end",
"def uid\n @uid ||= (@in['uid_hi'] << 16) | @in['uid_lo']\n end",
"def getPlayerUID _args\n \"getPlayerUID _args;\" \n end",
"def short_id\n @short_id ||= Digest::SHA1.hexdigest(hex)[0, 6]\n end",
"def numId\n id.to_s.slice(-9,9).hex.to_i\n end",
"def encoded_id\n (((id * PRIME) & MAXID) ^ RNDXOR).to_s(16)\n end",
"def short_id(txid)\n hash = SipHash.digest(siphash_key, txid.htb.reverse).to_even_length_hex\n [hash].pack('H*')[2...8].bth.to_i(16)\n end",
"def public_ID(id = nil)\r\n return id ? id & 0xFFFF : @id & 0xFFFF\r\n end",
"def lab_user_id\n plaintext_id = \"#{@view_options[:channel]}:#{user_or_session_id}\"\n Digest::SHA1.base64digest(storage_encrypt(plaintext_id)).tr('=', '')\n end",
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def lock_id\n Integer('0x' + Digest::MD5.hexdigest(name)) % (1 << 63)\n end",
"def generate_sid\n \"%0#{@default_options[:sidbits] / 4}x\" %\n rand(2**@default_options[:sidbits] - 1)\n end",
"def unique_id\n playlist_id[/playlists\\/([^<]+)/, 1]\n end",
"def uuid\n idme_uuid\n end",
"def wsu_id\n \"UsernameToken-#{count}\"\n end",
"def unique_identifier\n Digest::SHA2.hexdigest(\"#{handle}:#{password}\")\n end",
"def uid\n (@in['uid_hi'] << 16) | @in['uid_lo']\n end",
"def unique_identifier\n Digest::SHA1.hexdigest(\"#{login_name}:#{password}\")\n end",
"def state_id\n result = @player\n @field.each do | row | row.each do | cell | result = (result << 2) + (cell ? cell : 2) end end\n result\n end",
"def get_bot_user_id\n 1.freeze\n end",
"def generate_id\n SecureRandom.hex(8)\n end",
"def uuid\n @keystore[:id]\n end",
"def get_swytch_id\n return @m_swytch_id\n end",
"def reveal_id\n ((self.hashed_id.to_i(16) ^ RNDXOR) * PRIME_INVERSE) & MAXID\n end",
"def next_id!\n\t\t\t# Using sequential numbers for the query ID is generally a bad thing because over UDP they can be spoofed. 16-bits isn't hard to guess either, but over UDP we also use a random port, so this makes effectively 32-bits of entropy to guess per request.\n\t\t\tSecureRandom.random_number(2**16)\n\t\tend",
"def generate_id\n SecureRandom.urlsafe_base64 21\n end",
"def meu_id\n id = Integer(self.get_and_give_me_a_json(\"meuid\"))\n id\n end",
"def generate_uid(io)\n SecureRandom.hex(30)\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def random_instance_id # TODO: don't count on this for security; migrate to a proper instance id, in a cookie, at least twice as long, and with verified randomness\n \"%08x\" % rand( 1 << 32 ) + \"%08x\" % rand( 1 << 32 ) # rand has 52 bits of randomness; call twice to get 64 bits\n end",
"def oid\n id(get_oid())\n end",
"def short_code\n id.to_s 36\n end",
"def id\n Digest::SHA2.hexdigest @payload.to_json\n end",
"def get_account_id\n num = rand(111111111..999999999)\n id = sprintf(\"%09d\", num)\n id.to_s\n end",
"def digitool_id\n return nil if @mods.nil?\n return @mods.digitool_ids.first\n end",
"def get_random_identifier\n SecureRandom.hex\n end",
"def obfuscated_id\n Cryptography.obfuscate(self.id)\n end",
"def fusion_name\n SecureRandom.uuid\n end",
"def code\n @code ||= (read_attribute(:code) || (member.id * Time.now.to_i).to_s(36))\n end",
"def hash\n guid.hash\n end",
"def generate_id\n synchronize do\n n = (get_random() % @@MOD_LEN) + @@MOD_LEN\n time_val = Time.now.to_i\n t = ((time_val / 2) % @@MAX_TICKS) + @@MAX_TICKS\n if time_val != @@last_time_val\n @@session_count = 0\n @@last_time_val = time_val\n end\n @@session_count += 1\n \"#{n.to_s(36)[1..-1]}#{t.to_s(36)[1..-1]}#{@@session_count.to_s(36)}\"\n end\n end",
"def token_id\n SecureRandom.random_bytes(16).bytes.to_a\n end",
"def id\n return @playing_girl ? @id_girl : @id_boy\n end",
"def sfa_id()\n self.uuid.to_s\n end",
"def next_uid()\n\t\t\treturn @metadata.attributes[:next_uid].to_i\n\t\tend",
"def steam_id_from_url(url)\n url.slice!('https://store.steampowered.com/app/')\n m = url.match(/(\\d+)\\/?/)\n return nil if m.nil?\n m.captures.first.to_i\nend",
"def unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end",
"def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end",
"def twitter_user_id\n raw['id']\n end",
"def partner_id\n general_info_hash['ID:']\n end",
"def random_uid\n SecureRandom.hex 5\n end",
"def set_player_id(output)\n player_id = output[-3].to_i\n @player_id = player_id\n rescue\n @player_id = 1\n end",
"def sid_algorithm; SecureRandom.hex(@options[:sid_len]); end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def short_uuid\n rand(36**8).to_s(36)\n end",
"def id\n wallet_token\n end",
"def generate_temporary_id\n (Time.now.to_f*1000).to_i.to_s\n end",
"def unique_id(slug)\n Zlib.crc32 slug\n end",
"def get_player_reference\n if @player.nil?\n \"Anonymous\"\n else\n @player\n end\n end",
"def hash_id\n @hid\n end",
"def get_next_game_id\n log_everything(\"Get next game id\")\n # get current registered game id\n retrieved_game_id_number = craft_firebase_command(\"minesweeper/game_id.json\").to_i\n game_id = retrieved_game_id_number + 1\n\n # update game id (increment by 1)\n craft_firebase_command(\"minesweeper/game_id.json\", \"PUT\", game_id)\n\n # return current game id\n game_id\nend",
"def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end",
"def merchant_guid\n hash[\"MerchantGUID\"]\n end",
"def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end",
"def trace_id128\n @trace_id128 ||= \"#{trace_id_upper64 || ZERO_PADDING}#{trace_id}\"\n end",
"def build_hash_code\n\t\tSecureRandom.hex(8) + (Time.now.to_f * 1000).to_i.to_s\n\tend",
"def map_id\n $game_map.map_id\n end",
"def git_id(id)\n\t\t\tid[0...8]\n\t\tend",
"def trainer_id\n return @trainer_id % 100_000\n end",
"def node_id_s\n node_bytes = [ @node_id >> 32, @node_id & 0xFFFF_FFFF].pack(\"NN\")\n elements = node_bytes.unpack(\"CCa6\")\n node = elements[-1].unpack('C*')\n elements[-1] = '%02x%02x%02x%02x%02x%02x' % node\n \"%02x%02x-%s\" % elements\n end",
"def tingyun_externel_guid\n guid = ''\n 16.times do\n guid << (0..15).map{|i| i.to_s(16)}[rand(16)]\n end\n guid\n end",
"def random_id\n \"#{('a'..'z').to_a.sample}-#{SecureRandom.alphanumeric(6)}\"\n end",
"def graphql_id\n Base64.encode64(\"04:#{self.class.name}#{id}\").rstrip\n end",
"def suuid; uuid; end",
"def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id: \" + id)\n return id\n end",
"def goid\n @player\n end",
"def raw_online_id\n @online_id\n end",
"def request_id\n SecureRandom.hex(17)\n end",
"def request_id\n SecureRandom.hex(17)\n end"
] | [
"0.73491544",
"0.67257905",
"0.66229326",
"0.6490911",
"0.6408611",
"0.6287923",
"0.6262609",
"0.6262545",
"0.6260919",
"0.6202612",
"0.62016654",
"0.6170822",
"0.616833",
"0.6164912",
"0.61478496",
"0.6097115",
"0.60859674",
"0.6085555",
"0.6085555",
"0.6082716",
"0.6076983",
"0.6068358",
"0.6044216",
"0.604209",
"0.6030692",
"0.60143083",
"0.6009946",
"0.59986603",
"0.5993718",
"0.5990692",
"0.5990241",
"0.5985213",
"0.59316105",
"0.59311664",
"0.59294814",
"0.5916803",
"0.59076476",
"0.5906595",
"0.5875978",
"0.5875176",
"0.5869594",
"0.5855596",
"0.5852612",
"0.585082",
"0.58445907",
"0.5843309",
"0.5837439",
"0.5829336",
"0.5823154",
"0.5823154",
"0.58221596",
"0.5809504",
"0.58093315",
"0.5801065",
"0.5788048",
"0.577219",
"0.57614505",
"0.576039",
"0.5756668",
"0.5738366",
"0.573045",
"0.5717321",
"0.5710023",
"0.5707756",
"0.5704484",
"0.5693088",
"0.5689027",
"0.5688678",
"0.5687188",
"0.5686705",
"0.56759346",
"0.56715286",
"0.5666398",
"0.56663185",
"0.5663122",
"0.5661887",
"0.5639614",
"0.5637304",
"0.5635826",
"0.56276566",
"0.56220484",
"0.56214017",
"0.5620077",
"0.5619288",
"0.56152207",
"0.5614842",
"0.56133056",
"0.561226",
"0.56101805",
"0.56099284",
"0.5606723",
"0.5606048",
"0.5599405",
"0.5595777",
"0.55946326",
"0.5593078",
"0.5590573",
"0.55840826",
"0.5581838",
"0.5581838"
] | 0.7306445 | 1 |
String containing the player's ban status in the economy. | def economy_banned_status
raw_ban['EconomyBan']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n output = \"\"\n player = @game.player\n output << \"You won!! you have scaped with life from the castle!!! \"\n output << \"WELL DONE!!\"\n end",
"def status()\r\n\t\treturn to_s() + \", #{total_guess_count()} guesses (#{bad_guess_count()} bad), won? #{won?}, lost? #{lost?}\"\r\n\tend",
"def status_str\n case self.status\n when ACTIVE\n \"Active\"\n when INACTIVE\n \"Inactive\"\n when CLOSED\n \"Closed\"\n when NO_STRIPE\n \"No Stripe Account\"\n when UNKNOWN\n \"Unknown\"\n else\n \"Invalid\"\n end\n end",
"def status_to_s\n \tSTATUSES[self.status].humanize\n end",
"def to_s\n @name + \" Level: \" + @level.to_s + \" Combat Level: \" + getCombatLevel.to_s +\n \"\\nMal rollo pendiente: \" + \n ((@pendingBadConsequence==nil||@pendingBadConsequence.isEmpty)?(\"OK\"):(\"\\n\"+@pendingBadConsequence.to_s))\n end",
"def status\n result = \"online\"\n if Current.room.ready? && Current.room.poker_records.find_by(user_id: object.id).present?\n result += \" played\"\n end\n result\n end",
"def status\n puts \"Player #{@playerNo}\".center(60)\n puts \"Name: #{@name}\".center(60)\n puts \"Class: #{@fightClass[:name]}\".center(60)\n puts \"Race: #{@race[:name]}\".center(60)\n puts \"HP: #{@hp}\".center(60)\n puts \"Level: #{@level}\".center(60)\n puts \"Actions: #{@actions.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Attacks: #{@attacks.map(&:unCamelize).join(', ')}\".center(60)\n puts \"Inventory: #{@inventory.join(', ')}\".center(60)\n puts \"\"\n end",
"def get_loss_confirmation()\n return \"#{@player.get_name()} loses with #{@player.get_weapon()}!\"\n end",
"def status_string\n case status\n when APPROVED_STATUS\n \"approved\"\n when REJECTED_STATUS\n \"rejected\"\n when REMOVED_STATUS\n \"removed\"\n when PENDING_STATUS\n \"pending\"\n else\n \"error\"\n end\n end",
"def status_string\n if waiting_confirmation?\n return \"À confirmer\"\n elsif confirmed?\n return \"Confirmé\"\n elsif forgiven?\n return \"Pardonné\"\n else\n return \"Rejeté\"\n end\n end",
"def betting_status\n super || ''\n end",
"def status_message\n if self.deleted_at\n return \"Cancelled\"\n else\n if self.chosen_presenter == nil\n if self.help_required\n return \"Help Required\"\n elsif self.presenters.present?\n return \"Bids Pending\"\n else\n return \"Awaiting Bids\"\n end\n else\n if self.booking_date < Time.now\n return \"Completed\"\n else\n return \"Locked in\"\n end\n end\n end\n end",
"def status_name\n STATUSE.key(@status)\n end",
"def to_s\n return 'inactive' if inactive?\n\n # try to mimics stat behaviour to minimize readings\n result = status_string\n result += ', got TERM' if got_term?\n result += ', want down' if want_down?\n result += ', want up' if want_up?\n result\n end",
"def player_status(player)\n return \"Draw\" if draw?\n player.id == winner_id ? \"Won\" : \"Lost\"\n end",
"def game_status\n puts\n game_status_str = @game_status.join(' ')\n puts game_status_str\n end",
"def get_other_loss_confirmation()\n return \"#{@player.get_other_name()} loses with #{@player.get_other_weapon()}!\"\n end",
"def status_name\n STATUSES[status]\n end",
"def status(player)\n puts player\n linebreak\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end",
"def get_status\n return @player_status\n end",
"def status\n \"#{@name}: #{@lives}/3 \"\n end",
"def cheat_status\n if @revealed\n \" \"\n else\n @bombed ? \"X\" : \"*\"\n end\n end",
"def check_bet\r\n (padding,pronoun) = self.is_a?(User) ? [29,\"You\"] : [32,\"Player ##{player_id+1}\"]\r\n puts \"\\n%#{padding}s\\n\" % \"#{pronoun} checked.\"\r\n end",
"def backup_status_desc\n status = if !confirmed?\n 'Authentication Required'\n elsif active?\n if lb = latest_backup\n lb.successful? ? 'OK' : 'Failed'\n else\n 'OK'\n end\n else\n 'Inactive'\n end\n if (status == 'Failed') && backup_broken?\n status = EternosBackup::BackupSourceError.new(self).short_error\n end\n status\n end",
"def status_text\n case @state\n when 0\n H87Enchant::ST1\n when 1\n H87Enchant::ST2\n when 2\n H87Enchant::STQ\n when 3\n H87Enchant::ST3\n when 4\n H87Enchant::ST4\n when 5\n H87Enchant::ST5\n else\n ; 'ERRORE 01'\n end\n end",
"def status\n status = \"\"\n if points < 4000\n status = \"Baby Seeder\"\n elsif points < 8000\n status = \"Aspiring Gardener\"\n elsif points < 15000\n status = \"Garden Hero\"\n else\n status = \"Plant Wizard\"\n end\n end",
"def battle_outcome()\n if get_battle() == 1\n set_games_won()\n return get_victory_confirmation() + \" \" + get_other_loss_confirmation()\n\n elsif get_battle() == 2\n set_other_games_won()\n return get_loss_confirmation() + \" \" + get_other_victory_confirmation()\n\n else get_battle() == 0\n set_games_tied()\n return get_tie_confirmation()\n end\n end",
"def status\n output = StringIO.new\n output << @game.player.to_s\n output << \"\\n\"\n\n output << \"#{@game.current_room_model.description}\\n\"\n\n treasure = @game.current_room_model.treasure\n output << \"\\nThere is treasure here worth $#{treasure}.\\n\" if treasure && treasure > 0\n\n monster = @game.current_room_model.monster\n if monster\n output << \"\\nDANGER... THERE IS A MONSTER HERE....\\n\\n\"\n output << \"#{@game.current_room_model.monster}\\n\\n\"\n end\n\n if @game.current_room_model.name != \"Exit\"\n output << \"\\nWhat do you want to do? \"\n end\n \n output.string\n end",
"def all_player_status\n linebreak\n @players.each{ |p| puts p; linebreak; }\n puts \"Dealer showing #{@dealer.hand.public_show}\"\n linebreak\n end",
"def to_s\n result = @name\n if self.has_a_hand and not self.is_dealer\n result += \" [\\$#{@bet.to_s}]\"\n end\n result += \" [\\$#{@bankroll.to_s}]\"\n return result\n end",
"def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend",
"def pay_status_to_s\n if self.paid?\n %Q|<span style=\"color:green;\">#{self.bonus.nil? ? \"paid\" : \"bonus (#{self.bonus})\"}</span>|\n elsif self.rejected?\n %Q|<span style=\"color:red;\">rej</span>|\n end\n end",
"def state_text\n EasyLoan::LoanBill::STATE_TEXT.fetch(bill_state.to_sym, \"无状态\")\n end",
"def get_status_name\n\n return Team.status_name(self.status)\n end",
"def current_status\n case status\n when NOT_STARTED\n return 'Game not started yet'.freeze\n when RUNNING\n return 'Game is running'.freeze\n when WIN\n return 'Game is won'.freeze\n when DRAWN\n return 'Game is drawn'.freeze\n when ABANDONED\n return 'Game is abandoned'.freeze\n end\n end",
"def status_name\n STATUS[self.status_id][0]\n end",
"def base_battler_name\n @base_battler_name\n end",
"def get_status_message\n message = \"\"\n\n # if book is checked out and returned\n if (!self[:start].nil? && !self[:end].nil?)\n return message.concat(\"Returned on \").concat(self[:end].to_date.strftime(\"%b-%d-%Y\"))\n end\n\n # if book is checked out\n if (!self[:start].nil? && self[:end].nil?)\n return message.concat(\"Checked out on \")\n .concat(self[:start].to_date.strftime(\"%b-%d-%Y\"))\n .concat(\" - Return Date: \")\n .concat(self.book_return_date)\n end\n\n # if book is pending special approval\n if (self[:special_approval])\n return message.concat(\"Waiting Librarian approval for checkout\")\n end\n\n # if book is set on hold\n if (!self[:hold].nil?)\n return message.concat(\"Book on hold\")\n end\n end",
"def status\n inspect\n end",
"def show_balance\n\t\t\treturn @balance\n\t\tend",
"def like_status_string(user_id)\n\t\t\n\t\tif self.user_can_like(user_id)\n\t\t\treturn 'like'\t\t\t\n\t\tend\n\n\t\treturn 'unlike'\n\tend",
"def account_name_balance\n name + ' (' + current_balance_display + ')'\n end",
"def state\n players.map(&:inspect).join(\"\\n\")\n end",
"def status_in_words\n return \"Champion's Bracket\" if status == 1\n return \"Second Chance Bracket\" if status == 2\n return \"Knocked Out for the season!\"\n end",
"def get_victory_confirmation()\n return \"#{@player.get_name()} wins with #{@player.get_weapon()}!\"\n end",
"def status_text\n t(IMPORTING_STATUS[status])\n end",
"def to_s\n \"Health : #{@cur_health}/#{@max_health}\"\n end",
"def units_balance\n return \"#{@unit} balance\" if @unit.present?\n 'Balance'\n end",
"def status\n if complete?\n \"PAID\"\n else\n \"PENDING\"\n end\n end",
"def show_current_balance\n return \"Balance: $#{sprintf \"%.2f\", @balance}\"\n end",
"def status_description\n\t\treturn case self.status\n\t\t\twhen 'M' then 'modified'\n\t\t\twhen 'A' then 'added'\n\t\t\twhen 'R' then 'removed'\n\t\t\twhen 'C' then 'clean'\n\t\t\twhen '!' then 'missing'\n\t\t\twhen '?' then 'not tracked'\n\t\t\twhen 'I' then 'ignored'\n\t\t\telse\n\t\t\t\traise \"unknown status %p\" % [ self.status ]\n\t\t\tend\n\tend",
"def status\n output = \"\"\n\n output << \"You are dead!!!\"\n output << \"Game Over\"\n end",
"def status_value(status)\n if status\n \"Active\"\n else\n \"Disabled\"\n end\n end",
"def status_message\n @data[:status_message]\n end",
"def status\n \"#{@description} #{@status}\"\n end",
"def pending_balance_display\n number_to_currency(pending_balance)\n end",
"def status(player_id)\n load_data unless @data_loaded\n\n if @player.id == player_id\n YOU\n elsif @alliance_player_ids.include?(player_id)\n ALLY\n elsif @nap_player_ids.include?(player_id)\n NAP\n elsif player_id.nil?\n NPC\n else\n ENEMY\n end\n end",
"def status\n ActiveSupport::StringInquirer.new(self[:status] || \"\")\n end",
"def status\n return 'Appealed' if self.punishment.appealed?\n return 'Closed' if !self.open || self.locked\n return 'Escalated' if self.escalated\n return 'Open'\n end",
"def to_s\n resp = \"\\nNombre: #{name} \\tNivel: #{combat_level}\"\n if(level_change_against_cultist_player != 0)\n resp += \"\\nNivel contra sectarios: \" + get_level_change_against_cultist_player.to_s\n end\n \n resp += \"\\nNiveles que ganas: #{get_levels_gained}\" + \n \"\\tTesoros que ganas: #{get_treasures_gained}\" +\n \"\\nMal rollo: \" + bad_consequence.to_s\n end",
"def status_message\n data.status_message\n end",
"def to_s\n return \"Turn => #{self.current_turn}, Players => #{@players}, \"\n end",
"def pretty_status\r\n status.titleize\r\n end",
"def status_desc\n case self.proposal_status\n when 0\n 'Pending'\n when 1\n 'Accepted'\n when 2\n 'Declined'\n end\n end",
"def current_balance\n \"EUR. #{sprintf('%.2f', bankaccount.reload.balance)}\"\n end",
"def to_s\n\t\t puts \"Bank Account:\\t#{name}\\n\"\n\t\t puts \"Your current balance is:\\t#{sprintf(\"%0.2f\", balance)} USD\" \n\tend",
"def get_bank_name()\n return @RESPONSE_HASH['BANK_NAME']\n end",
"def to_s\n @status_code.to_s\n end",
"def status_string\n case self.entry_status\n when 1: 'Draft'\n when 2: 'Publish'\n when 4: 'Scheduled'\n end\n end",
"def to_s\n \"Name = #{@name}\\nGold Coins = #{@goldCoins}\\nMinimum Bonus = #{@minBonus}\\nMaximum Bonus = #{@maxBonus}\\nKind of the Treasure = #{@kind.upcase}\"\n end",
"def account_status\n overview_table.rows_text[1][3]\n end",
"def status_text\n if skipped?\n 'skipped'\n elsif error?\n 'error'\n else\n 'success'\n end\n end",
"def to_s\n\t\t\"#{@title} has a rank of #{@rank} (#{status})\"\n\tend",
"def report\n (@state.first || NO_ROBOT_PLACED).to_s\n end",
"def display_name\n status\n end",
"def get_status()\n\n puts \"Rounds: #{@rounds}\"\n puts \"Player wins: #{@player_wins}\"\n puts \"Computer wins: #{@computer_wins}\"\n puts \"Ties: #{@ties}\\n\\n\"\n \n\n end",
"def message\n status.last\n end",
"def status\n info['status']\n end",
"def to_s\n \"Name = #{@name}\\nLevel = #{@combatLevel}\\nCultist Change Level = #{@levelChangeAgainstCultistPlayer}\\nPrize = [\" + @prize.to_s + \"] \\nBad Consequence = \" + @badCons.to_s() + \"\\n\"\n end",
"def to_s\n if @value == Enum.market\n return 'market'\n end\n if @value == Enum.limit\n return 'limit'\n end\n if @value == Enum.stop\n return 'stop'\n end\n '<unknown>'\n end",
"def player_lives_status(player, num_lives)\n \"\\n#{player_name(player)} has #{num_lives} lives/life left.\\n\"\nend",
"def player_status(player)\n PlayerPresenter.new(player).to_json\n end",
"def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end",
"def to_s\n result = \"[#{@cards.join(\"|\")}]: \"\n if is_soft\n result += total.join(\" or \")\n else\n result += total.to_s\n end\n if is_bust\n result += \" BUSTED\"\n elsif is_bj\n result += \" BLACKJACK\"\n elsif total_high == 21\n result += \" NICE\"\n end\n return result\n end",
"def get_reaction_name\n return \"\" unless @battler\n return \"\" unless @battler.aggressive_level\n return \":\" + $data_states[PONY::StateID[:aggressive_level][@battler.aggressive_level]].name\n end",
"def status\n monster = @game.current_room_model.monster\n return unless monster\n\n weapons = @game.player.weapons\n\n output = \"Fighting against #{monster.name}\\n\"\n weapons.each_with_index do |weapon, i|\n output << \"#{i + 1} - #{weapon}\\n\"\n end\n\n output\n end",
"def get_other_victory_confirmation()\n return \"#{@player.get_other_name()} wins with #{@player.get_other_weapon()}!\"\n end",
"def correct\n\t\tbet_items = self.bet_items\n\t\tcorrect = \" \"\n\t\tself.bet_items.each do |bet_item|\n\n\t\t\tif bet_item.active?\n\t\t\t\tcorrect = bet_item.name\n\t\t\tend\n\t\tend\n\n\t\treturn correct\n\tend",
"def status\n Status.find(self.status_id).name\n end",
"def state_str\n ZONE_STATES[state]\n end",
"def closed_status\n closed_status_wording || 'Awarded'\n end",
"def status\n @message\n end",
"def status_text\n\t s = Enrollment::STATUS_NAMES[self.enrollment_status]\n\t \n\t if [Enrollment::STATUS_CLOSED,Enrollment::STATUS_FINALIZED].include? self.enrollment_status\n\t s += \"-#{Enrollment::COMPLETION_NAMES[self.completion_status]}\"\n\t end\n\t s\n\tend",
"def status(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n stats = get_stats(secret)\n\n stats_str = <<-STATUS\n Currently using #{stats['cpu']} Percent CPU and #{stats['memory']} Percent Memory\n Hard disk is #{stats['disk']} Percent full\n Is currently: #{stats['roles'].join(', ')}\n Database is at #{stats['db_location']}\n Is in cloud: #{stats['cloud']}\n Current State: #{stats['state']}\n STATUS\n\n if my_node.is_appengine?\n app_names = []\n stats['apps'].each { |k, v|\n app_names << k\n }\n\n stats_str << \" Hosting the following apps: #{app_names.join(', ')}\\n\"\n\n stats['apps'].each { |app_name, is_loaded|\n next if !is_loaded\n next if app_name == \"none\"\n if !@app_info_map[app_name]['appengine'].nil?\n stats_str << \" The number of AppServers for app #{app_name} is: \" +\n \"#{@app_info_map[app_name]['appengine'].length}\\n\"\n end\n }\n end\n \n return stats_str\n end",
"def get_status_name\n case self.status\n when STATUS_NOT_APPLIED\n return I18n.t('workflow.status.not_applied')\n when STATUS_NOT_ISSUED\n return I18n.t('workflow.status.not_issued')\n when STATUS_ACTIVE\n return I18n.t('workflow.status.active')\n when STATUS_ACCEPTED\n return I18n.t('workflow.status.accepted')\n when STATUS_DENIED\n return I18n.t('workflow.status.denied')\n end\n end",
"def status\n info[\"Status\"]\n end",
"def status_message\n (+'').tap do |ret|\n if task.progress\n ret << \"#{(task.progress * 100).to_i}%\"\n ret << ': ' if task.progress_message.present?\n end\n ret << task.progress_message if task.progress_message.present?\n end\n end",
"def to_s\n\t\t puts \"\\nEnding balance:\\nBank Account Name:\\t#{name}\\nBalance:\\t#{balance}\"\n\tend",
"def to_s\n\t\t\t\"We're playing tennis!\"\n\t\tend",
"def blacklisted_value\n 'blacklisted'\n end"
] | [
"0.6465956",
"0.64026785",
"0.6379537",
"0.63592315",
"0.6345788",
"0.6337388",
"0.63297904",
"0.62974423",
"0.619753",
"0.6189802",
"0.61089504",
"0.6094221",
"0.60374403",
"0.60345924",
"0.6032034",
"0.60320145",
"0.6027504",
"0.6008943",
"0.60056204",
"0.59927166",
"0.59750557",
"0.59722733",
"0.59716076",
"0.5915861",
"0.59154165",
"0.5903601",
"0.5899541",
"0.5885949",
"0.5856931",
"0.5841807",
"0.5834214",
"0.5823515",
"0.5808355",
"0.5797915",
"0.57934594",
"0.57774734",
"0.57744557",
"0.57632434",
"0.5760729",
"0.57594",
"0.5750273",
"0.5747479",
"0.5717825",
"0.5713336",
"0.571158",
"0.5708286",
"0.5703841",
"0.5697278",
"0.569613",
"0.56922734",
"0.568003",
"0.56774133",
"0.56765395",
"0.56762856",
"0.5662587",
"0.56478214",
"0.56468254",
"0.564169",
"0.5635192",
"0.5632762",
"0.56246936",
"0.5624529",
"0.5622543",
"0.5613856",
"0.55988896",
"0.5597165",
"0.5590731",
"0.55883753",
"0.5581257",
"0.5581224",
"0.5573195",
"0.5569605",
"0.55690217",
"0.55667",
"0.555246",
"0.5551765",
"0.55465466",
"0.55371416",
"0.5535114",
"0.5534815",
"0.55315435",
"0.5525738",
"0.5524358",
"0.5522756",
"0.55170393",
"0.5516001",
"0.55060565",
"0.55011916",
"0.55001014",
"0.54923636",
"0.5488522",
"0.54768664",
"0.5473802",
"0.5471709",
"0.5470524",
"0.54689753",
"0.5454089",
"0.5447126",
"0.5440817",
"0.54405075"
] | 0.8089339 | 0 |
If a block is passed this method will call the block when the server is up and running. The block should return quickly. | def start(clientHandlerProc)
@socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( @port, @addr )
@socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true)
@socket.bind( sockaddr )
@socket.listen( 5 )
yield if block_given?
while true
break if @exit
sleep 0.1
clientSock = nil
begin
clientSock, client_sockaddr = @socket.accept_nonblock
rescue
# Error, or nothing to accept.
next
end
port, addr = Socket.unpack_sockaddr_in(client_sockaddr)
if @doLog
$logger.info "Server: Got connection from #{addr}:#{port}" if @doLog
end
Thread.new(clientSock, addr, port){ |clientSock, addr, port|
begin
clientHandlerProc.call(clientSock, addr, port)
rescue => e
$logger.error "Server: exception in client handler proc: #{$!}"
$logger.error e.backtrace.join(" ")
end
}
end
@socket.close
$logger.info "Server: exiting" if @doLog
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def when_ready(&block)\n handle :ready, &block\n end",
"def begin!\n start_server\n end",
"def run target, &block\n server = start target, &block\n server.wait_until_stopped\n self\n end",
"def on_ready(&block)\n block_given? ? @_on_ready = block : @_on_ready\n end",
"def loop( &block )\n sanity_check\n @connection.loop(&block)\n end",
"def listen_wait\n\t\t\tif block_given?\n\t\t\t\t@conn.sit { yield }\n\t\t\telse\n\t\t\t\t@conn.sit\n\t\t\tend\n\t\tend",
"def server(&blk); end",
"def server(&blk); end",
"def sit\n\t\twhile connected?\n\t\t\tif block_given?\n\t\t\t\tyield\n\t\t\telse\n\t\t\t\tsleep(0.1)\n\t\t\tend\n\t\tend\n\tend",
"def loop_until_server_online\n\t\tcs_conn=self.cloud_server_init\n\n\t\terror_message=\"Failed to build server.\"\n\n\t\ttimeout=self.server_online_timeout-(Time.now-self.updated_at).to_i\n\t\ttimeout = 120 if timeout < 120\n\n\t\tbegin\n\t\t\tTimeout::timeout(timeout) do\n\n\t\t\t\t# poll the server until progress is 100%\n\t\t\t\tcs=cs_conn.find_server(\"#{self.cloud_server_id_number}\")\n\t\t\t\tuntil cs.progress == 100 and cs.status == \"ACTIVE\" do\n\t\t\t\t\tcs=cs_conn.find_server(\"#{self.cloud_server_id_number}\")\n\t\t\t\t\tsleep 1\n\t\t\t\tend\n\n\t\t\t\terror_message=\"Failed to ssh to the node.\"\t\n\n\t\t\t\tif ! system(%{\n\n\t\t\t\t\t\tCOUNT=0\n\t\t\t\t\t\twhile ! ssh -o \"StrictHostKeyChecking no\" -T -i #{self.server_group.ssh_key_basepath} root@#{cs.addresses[:public][0]} /bin/true > /dev/null 2>&1; do\n\t\t\t\t\t\t\tif (($COUNT > 23)); then\n\t\t\t\t\t\t\t\texit 1\n\t\t\t\t\t\t\tfi\n\t\t\t\t\t\t\t((COUNT++))\n\t\t\t\t\t\t\tsleep 15\n\t\t\t\t\t\tdone\n\t\t\t\t\t\texit 0\n\n\t\t\t\t}) then\n\t\t\t\t\tfail_and_raise error_message\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tfail_and_raise error_message\n\t\tend\n\n\tend",
"def on_ready(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def on_ready(&block)\n block_given? ? @_on_error = block : @_on_error\n end",
"def start\n @virtual_machine_state = 'NOSTATE'\n Profitbricks.request :start_server, server_id: self.id\n return true\n end",
"def run()\n # first see if we should just exit\n if !ec2_user_data('disable', '').empty?\n info \"disable flag is set, so returning...\\n\\n\"\n return\n end\n\n run_pre_scripts\n\n is_monitor = provides.include?('monitor')\n \n # evaluate our actions\n # this is important as it can both notify us of errors early on,\n # and it also allows the actions to perform any initialization code\n actions\n\n if is_monitor\n monitor_thread = monitor()\n ## TODO: don't just leave this thread dangling, \n ## do something if it crashes!\n end\n \n listener_thread = subscribe(subscribes, instance_id, 10)\n\n # even if we're a monitor, we may provide some other services as well.\n avail_thread = broadcast_availability(provides, 3)\n\n sleep 3\n run_post_scripts\n\n # keep listening...\n listener_thread.join if listener_thread\n avail_thread.join if avail_thread\n end",
"def locally(&block)\n server_was, @_current_server = @_current_server, nil\n block.call\n ensure\n @_current_server = server_was\n end",
"def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end",
"def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end",
"def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end",
"def on_worker_boot(&block); end",
"def server(&block)\n @servers << Server.new(self, &block)\n end",
"def bootstrap_server\n bootstrap_config\n\n bootstrap_init\n bootstrap_run\n bootstrap_cleanup\n rescue Hazetug::Exception => e\n ui.error(e.message); 1\n ensure \n knife and knife.ui.stdout.close\n end",
"def on_connection_established(&block)\n @on_connection_established_block = block\n end",
"def on_start(&block)\n @options[:start] = block\n end",
"def on_start(&block)\n @on_start << block\n end",
"def run_server_thread; end",
"def block\n # beware of deadlocks, we can't join our own thread\n ::EM.reactor_thread.join if ::EM.reactor_thread && !::EM::reactor_thread?\n end",
"def on_restart(&block); end",
"def run\n raise 'Server has shutdown.' unless @server\n @server.run_till_terminated\n @server = nil\n end",
"def work(&block)\n Celluloid::Logger.info \"Preparing work...\"\n self.working_code = block if block_given?\n end",
"def run_registration_block(&block)\n instance_exec &block if block_given?\n end",
"def run(&block)\n end",
"def block\n true\n end",
"def on_ready(s, commands)\n create_server_on_master(s)\n \n wait_for_public_ip = get_field('wait_for_public_ip')\n\n start = Time.now\n unless wait_for_public_ip == false\n msg = \"Waiting for server '#{s.name}' #{s.identity} to get a public ip\"\n Maestro.log.debug msg\n write_output(\"#{msg}... \")\n \n begin\n s.wait_for { !public_ip_address.nil? and !public_ip_address.empty? }\n rescue Fog::Errors::TimeoutError => e\n msg = \"Server '#{s.name}' #{s.identity} failed to get a public ip (#{Time.now - start}s)\"\n Maestro.log.warn msg\n write_output(\"failed (#{Time.now - start}s)\\n\")\n return nil\n end\n end\n \n Maestro.log.debug \"Server '#{s.name}' #{s.identity} is now accessible through ssh (#{Time.now - start}s)\"\n write_output(\"done (#{Time.now - start}s)\\n\")\n \n # save some values in the workitem so they are accessible for deprovision and other tasks\n populate_meta([s], 'new')\n save_server_in_context([s])\n \n log_output(\"Server '#{s.name}' #{s.identity} started with public ip '#{s.public_ip_address}' and private ip '#{private_address(s)}'\", :info)\n \n start = Time.now\n msg = \"Initial setup for server '#{s.name}' #{s.identity} on '#{s.public_ip_address}'\"\n Maestro.log.debug msg\n write_output(\"#{msg}...\")\n begin\n setup_server(s)\n Maestro.log.debug \"Finished initial setup for server '#{s.name}' #{s.identity} on '#{s.public_ip_address}' (#{Time.now - start}s)\"\n write_output(\"done (#{Time.now - start}s)\\n\")\n rescue Net::SSH::AuthenticationFailed => e\n log_output(\"Failed to setup server '#{s.name}' #{s.identity} on '#{s.public_ip_address}' (#{Time.now - start}s). Authentication failed for user '#{s.username}'\")\n return nil\n end\n \n # provision through ssh\n start = Time.now\n server_errors = provision_execute(s, commands)\n unless server_errors.empty?\n log_output(\"Server '#{s.name}' #{s.identity} failed to provision\", :info)\n write_output(server_errors.join(\"\\n\"))\n return nil\n end\n log_output(\"Server '#{s.name}' #{s.identity} ssh provisioned in #{Time.now-start}s\", :info)\n \n return s\n end",
"def execute(callback)\n callback.call if unlock(:server)\n yield\n end",
"def run\n start\n jetty.join\n end",
"def run(&block)\n leader_election = KafkaSync::LeaderElection.new(\n zk: zk,\n path: \"/kafka_sync/consumer/#{@topic}/#{@partition}/#{@name}/leader\",\n value: `hostname`,\n logger: @logger\n )\n\n leader_election.as_leader { |status| work(status, &block) }\n leader_election.run\n end",
"def run(&block)\n unless @work = block\n raise ArgumentError, \"Usage: run { while_we_have_the_lock }\"\n end\n @shutdown = false\n @restart = false\n install_plugins\n startup # typically daemonizes the process, can have various implementations\n on_load.call(self) if on_load\n run_loop(&@work)\n on_exit.call(self) if on_exit\n shutdown\n end",
"def service_thread(&block)\n start_service\n Ricer::Thread.execute {\n begin\n yield\n ensure\n stopped_service\n end\n }\n end",
"def run(&block)\n register_cookbooks\n generate_solo_config && generate_node_config\n ssh.exec \"chef-solo --config #{CHEF_VAR_PATH}/solo.rb --json-attributes #{CHEF_VAR_PATH}/node.json #{\"--force-formatter --log_level error --format #{@formatter.first[0]}\" if @formatter && @formatter.any?}\", sudo: true do |ch, stream, data, cmd|\n yield data\n end\n end",
"def serve(function, &block)\n # Establish callback handler\n callback = Proc.new do |connection, function_handle, error|\n function_call = FunctionCall.new(function_handle)\n yield(function_call)\n end\n rc = NWRFCLib.install_server_function(nil, function.desc, callback, @error)\n NWRFC.check_error(@error) if rc > 0\n\n # Server loop\n while (rc==NWRFCLib::RFC_RC[:RFC_OK] || rc==NWRFCLib::RFC_RC[:RFC_RETRY] || rc==NWRFCLib::RFC_RC[:RFC_ABAP_EXCEPTION])\n rc = NWRFCLib.listen_and_dispatch(@handle, TIMEOUT, @error)\n end\n end",
"def run_registration_block(&block)\n instance_exec &block if block_given?\n end",
"def execute\n listen_for_changes\n @block.call\n end",
"def init_server\n box = @boxes[@environment_name]\n if box.nil?\n launch!\n else\n @cloud.connect_to_server(box)\n end\n end",
"def listen(&block)\n loop do\n block.call receive\n end\n end",
"def up\n uri = URI(\"http://#{@host}:#{@port_s}/_cluster/health\")\n req = Net::HTTP::Get.new(uri)\n\n begin\n result = JSON.parse run(uri, req)\n result[\"status\"] == \"yellow\" or\n result[\"status\"] == \"green\"\n rescue\n false\n end\n end",
"def start_placebo\n\t\tGReactor.clear_listeners\n\t\tredis # make sure the redis connection is activated\n\t\tputs \"* Plezi #{Plezi::VERSION} Services will start with no Server...\\n\"\n\t\tstart_async\n\tend",
"def run(&block); end",
"def start(&block) # :yields: options\n handle_errors do\n process_command_line\n block.call self if block\n end\n end",
"def start &block\n raise RuntimeError.new(\"Can't start collectimng unless ready (currently #{@status})\") unless ready?\n @block = block\n raise ArgumentError.new(\"Num, timeout or block must be provided\") unless @options[:num] || @options[:timeout] || @block\n reset\n @status = :collecting\n log_start\n @notifier.add_listener self if @notifier\n end",
"def listen(&block)\n while @_run do\n request = @responder.recv #(ZMQ::NOBLOCK)\n if request\n response = block && block.call(request)\n @responder.send( response )\n end\n end\n end",
"def start\n _connect\n sleep 1\n end",
"def after_worker_boot(&block); end",
"def wait_for_sinatra_to_startup!\n 10.times do\n Net::HTTP.get(URI.parse(\"http://#{@host}:#{@port}/up_and_running\"))\n return\n rescue Errno::ECONNREFUSED => e # rubocop:todo Lint/UselessAssignment\n sleep(1)\n end\n\n raise StandardError, \"Our dummy webservice did not start up in time!\"\n end",
"def when_container_ready(*args)\n call_engines_method(:when_container_ready, *args)\n end",
"def run(host: nil, port: DEFAULT_PORT, &block)\n logger.info \"Listening on port #{port}\"\n\n Socket.udp_server_loop host, port do |msg, sender|\n logger.debug { \"#{sender.remote_address.inspect} -> '#{msg.inspect}'\" }\n handler = @handlers.find { |h| h.handles? msg } || next\n @state_lock.synchronize do\n handle(handler, msg, sender, &block)\n end\n end\n nil\n end",
"def start_server_loop( socket_path, &block )\n # Remove old file\n FileUtils.rm_f socket_path\n FileUtils.mkdir_p File.dirname( socket_path )\n\n UNIXServer.open( socket_path ) do |server|\n loop do\n # Wait for client\n block.call server.accept\n end\n end\n ensure\n # Cleanup\n FileUtils.rm socket_path\n end",
"def ready\n Souffle::Log.info \"#{@node.log_prefix} Is ready for provisioning...\"\n end",
"def run &block\n worker = launch &block\n exit worker.wait\n end",
"def command_thread(&block)\n start_service\n Ricer::Thread.execute {\n begin\n yield\n rescue StandardError => e\n reply_exception(e)\n ensure\n stopped_service\n end\n }\n end",
"def run(&block)\n update_appd_cookbook\n generate_solo_config\n generate_node_config\n @ssh.exec \"chef-solo --config /tmp/solo.rb --json-attributes /tmp/node.json --force-formatter --log_level error --format appd\", sudo: true do |ch, stream, data, cmd|\n yield data\n end\n end",
"def process(wait=nil, &block)\n return true\n end",
"def will_start_up\n end",
"def loop(&block)\n block ||= Proc.new { pending_requests.any? }\n session.loop{Rex::ThreadSafe.sleep(0.5); block.call }\n end",
"def start\n Server.supervise_as :tishadow_server, self, :run_on_connect\n Builder.supervise_as :tishadow_builder, :build_command => @build_command, :verbose => @verbose, :update => @update, :spec => @spec, :app_root => @app_root\n @builder = Celluloid::Actor[:tishadow_builder]\n @server = Celluloid::Actor[:tishadow_server]\n @server.async.start\n end",
"def wait_connection; end",
"def wait_connection; end",
"def configure(&block)\n site.configure &block\n end",
"def run(&block)\n @running_template = block\n end",
"def start\n loop do\n begin\n socket = tcp_server.accept\n\n handle_request(socket)\n ensure\n socket.close\n end\n end\n end",
"def on_status(&block)\n @on_status = block\n end",
"def on_status(&block)\n @on_status = block\n end",
"def start\n puts \"=> Padrino/#{Padrino.version} has taken the stage #{Padrino.env} at http://#{options[:Host]}:#{options[:Port]}\"\n [:INT, :TERM].each { |sig| trap(sig) { exit } }\n super do |server|\n server.threaded = true if server.respond_to?(:threaded=)\n end\n ensure\n puts \"<= Padrino leaves the gun, takes the cannoli\" unless options[:daemonize]\n end",
"def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end",
"def start\n configure\n run\n end",
"def run\n @run_mutex.synchronize do\n fail 'cannot run without registering services' if rpc_descs.size.zero?\n @server.start\n transition_running_state(:running)\n @run_cond.broadcast\n end\n loop_handle_server_calls\n end",
"def start(&blk)\n EM.epoll\n EM.synchrony do\n trap(\"INT\") { stop }\n trap(\"TERM\") { stop }\n\n if RUBY_PLATFORM !~ /mswin|mingw/\n trap(\"HUP\") { load_config(options[:config]) }\n end\n\n load_config(options[:config])\n load_plugins\n\n EM.set_effective_user(options[:user]) if options[:user]\n\n config[Goliath::Constants::GOLIATH_SIGNATURE] = start_server(options) do |conn|\n if options[:ssl]\n conn.start_tls(\n :private_key_file => options[:ssl_key],\n :cert_chain_file => options[:ssl_cert],\n :verify_peer => options[:ssl_verify]\n )\n end\n\n conn.port = port\n conn.app = app\n conn.api = api\n conn.logger = logger\n conn.status = status\n conn.config = config\n conn.options = options\n end\n\n blk.call(self) if blk\n end\n end",
"def start(bootstrap = false)\n set_chef_client_flag(bootstrap, true) unless cloud.name == :static\n\n start_monitor_progess(self)\n task = cloud.fog_connection.start_cluster\n while !task.finished?\n sleep(monitor_interval)\n monitor_start_progress(self, task.get_progress, !bootstrap)\n end\n monitor_start_progress(self, task.get_progress, !bootstrap)\n update_fog_servers(task.get_progress.result.servers)\n\n set_chef_client_flag(bootstrap, false) unless cloud.name == :static\n\n return task.get_result.succeed?\n end",
"def start!(&block)\n init_handlers\n\n world.define(&block)\n world.spin!\n\n while command = interface.get_command(world.possible_commands)\n world.process command\n end\n end",
"def run\n block.call\n end",
"def start!\n update_proc_title(:starting)\n\n server_thread = Thread.new do\n logger.info { \"[gruf] Starting gruf server at #{@hostname}...\" }\n server.run_till_terminated_or_interrupted(KILL_SIGNALS)\n end\n @started = true\n update_proc_title(:serving)\n server_thread.join\n @started = false\n\n update_proc_title(:stopped)\n logger.info { '[gruf] Goodbye!' }\n end",
"def server(*args, &block)\n Vito::Dsl::Server.new(args).instance_eval(&block)\n end",
"def startup_wait!\n begin\n Timeout::timeout(startup_wait) do\n sleep 1 until (Felixwrapper.is_port_in_use? self.port and Felixwrapper.is_responding? self.port)\n end \n rescue Timeout::Error\n logger.warn \"Waited #{startup_wait} seconds for felix to start, but it is not yet listening on port #{self.port}. Continuing anyway.\"\n end\n end",
"def start\n begin\n EventMachine.run do\n \n @config.rabbitmq_hosts.each do |rabbitmq_host|\n if rabbitmq_host[\"enabled\"] == true\n start_worker(rabbitmq_host)\n end\n end\n Signal.trap(\"INT\"){EventMachine.stop}\n Signal.trap(\"QUIT\"){EventMachine.stop}\n Signal.trap(\"TERM\"){EventMachine.stop}\n Signal.trap(\"TSTP\"){EventMachine.stop}\n end\n rescue Exception=>e\n puts \"#{e.message} #{e.backtrace}\"\n end\n end",
"def start\n unless @state == :state_inited\n block_given? and yield Exception.new 'rpc client has started'\n return\n end\n\n @station.start { |err|\n if err\n block_given? and yield err\n return\n end\n @state = :state_started\n block_given? and yield\n }\n end",
"def listen(&block)\n block ||= self.class.for_client\n Supernova.logger.info { \"Server started.\" }\n while run\n next unless IO.select [server], nil, nil, 1\n thread_list << Thread.start(server.accept) do |client|\n Supernova.logger.info { \"Client accepted.\" }\n begin\n protocol = Protocol.new(\n @protocol_options.merge(:type => :server))\n\n @protocols << protocol\n\n protocol.socket = client\n protocol.handshake\n\n block.call(protocol)\n rescue ExitError => e\n Supernova.logger.error { \"Closing while client is connected. Notifying...\" }\n if protocol\n protocol.close(:shutdown)\n else\n client.close unless client.closed?\n end\n rescue RemoteCloseError\n rescue ProtocolError => e\n Supernova.logger.error { \"Client failed: #{e.message} #{e.backtrace.join(\"\\n\")}\" }\n client.close unless client.closed?\n end\n\n thread_list.delete(Thread.current)\n Supernova.logger.info { \"Client disconnected.\" }\n protocol.close(false)\n end\n end\n end",
"def on_host( with_env = {}, &block )\n service = self\n on host do\n with( { debian_frontend: \"noninteractive\" }.merge( with_env ) ) do\n Fastfood::Trampoline::Spring.new( service, self ).bounce &block\n end\n end\n end",
"def run\n loop do\n break unless app_loop\n end\n end",
"def start_server(klass, config={}, &block)\n server = klass.new({\n ServerType: Thread,\n BindAddress: \"127.0.0.1\",\n Port: 0,\n Logger: WEBrick::Log.new([], WEBrick::BasicLog::WARN),\n AccessLog: [],\n }.merge(config))\n\n server_thread = server.start\n\n addr = server.listeners[0].addr\n\n client_thread = Thread.new {\n begin\n block.yield([server, addr[3], addr[1]])\n ensure\n server.shutdown\n end\n }\n\n assert_join_threads([client_thread, server_thread])\nend",
"def start\n Thread.new do\n connect = false\n until connect do\n begin\n call do |server| \n @server = server\n Waves::Logger.info \"#{self.class.basename} started on #{host}:#{port}.\"\n end\n rescue RuntimeError => e\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end\n end",
"def openvz_fog_test_server\n server = openvz_service.servers.find { |s| s.ctid == '104' }\n unless server\n server = openvz_service.servers.create :ctid => '104'\n server.start\n server.reload\n # Wait for the server to come up\n begin\n server.wait_for(120) { server.reload rescue nil; server.ready? }\n rescue Fog::Errors::TimeoutError\n # Server bootstrap took more than 120 secs!\n end\n end\n\n openvz_fog_test_cleanup\n\n server\nend",
"def execute_in_main_thread(&block)\n EventMachine.schedule(&block)\n end",
"def connect(&block)\n\t\t\t@endpoint.connect(&block)\n\t\tend",
"def perform_now(block=nil)\n Thread.current[:name] ||= name\n if defined?(Rails) && defined?(ActiveRecord::Base)\n require 'gb_dispatch/active_record_patch'\n thread_block = ->() do\n if Rails::VERSION::MAJOR < 5\n begin\n ActiveRecord::Base.connection_pool.force_new_connection do\n block ? block.call : yield\n end\n ensure\n ActiveRecord::Base.clear_active_connections!\n end\n else\n Rails.application.executor.wrap do\n ActiveRecord::Base.connection_pool.force_new_connection do\n block ? block.call : yield\n end\n end\n end\n end\n else\n thread_block = block ? block : ->() { yield }\n end\n begin\n Runner.execute thread_block, name: name\n rescue Exception => e\n return e\n end\n end",
"def create_server(options = {})\n begin\n add_custom_attributes(options[:server_def])\n server = connection.servers.create(options[:server_def])\n\n print \"\\nWaiting For Server\"\n server.wait_for(Integer(options[:server_create_timeout])) do\n print '.'\n !locked?\n end\n\n # attach/or create any volumes.\n options[:server_volumes].each do |voldef|\n Chef::Log.debug(\"Volume definition: #{voldef}\")\n if voldef.key?(:size) || voldef.key?(:size_gb)\n # create a new volume\n result = connection.add_volume(server.id, voldef)\n name = (result / 'disk/name').first.text\n elsif voldef.key? :id\n server.attach_volume(voldef)\n name = voldef[:id]\n else\n raise CloudExceptions::ServerCreateError, \"cannot handle volume definition #{voldef}\"\n end\n\n print \"\\nAttached #{name} volume\"\n end\n\n print \"\\nWaiting For Volumes\"\n server.wait_for(Integer(options[:server_create_timeout])) do\n print '.'\n !locked?\n end\n Chef::Log.debug(\"options: #{options}\")\n server.start_with_cloudinit(user_data: options[:cloud_init])\n rescue Excon::Error::BadRequest => e\n response = Chef::JSONCompat.from_json(e.response.body)\n message = if response['badRequest']['code'] == 400\n \"Bad request (400): #{response['badRequest']['message']}\"\n else\n \"Unknown server error (#{response['badRequest']['code']}): #{response['badRequest']['message']}\"\n end\n ui.fatal(message)\n raise CloudExceptions::ServerCreateError, message\n rescue Fog::Errors::Error => e\n raise CloudExceptions::ServerCreateError, e.message\n end\n\n print \"\\n#{ui.color(\"Waiting for server [wait time = #{options[:server_create_timeout]}]\", :magenta)}\"\n\n # wait for it to be ready to do stuff\n server.wait_for(Integer(options[:server_create_timeout])) do\n print '.'\n ready?\n end\n\n puts(\"\\n\")\n server\n end",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def bind(&block)\n\t\t\t@endpoint.bind(&block)\n\t\tend",
"def start\n MU.log \"Starting #{@cloud_id}\"\n MU::Cloud::Google.compute(credentials: @config['credentials']).start_instance(\n @project_id,\n @config['availability_zone'],\n @cloud_id\n )\n begin\n sleep 5\n end while cloud_desc.status != \"RUNNING\"\n end",
"def execute(callback)\n unlock(:server)\n\n runtime_lock.execute(callback) do\n yield\n end\n end",
"def listen\n em_run do\n end\n end"
] | [
"0.6784748",
"0.6515248",
"0.6513337",
"0.6328749",
"0.6220377",
"0.61760056",
"0.6168303",
"0.6168303",
"0.5948911",
"0.59231967",
"0.5921004",
"0.5921004",
"0.590557",
"0.58605283",
"0.58460635",
"0.5815796",
"0.576067",
"0.576067",
"0.57150215",
"0.57049197",
"0.56994814",
"0.5693995",
"0.5685639",
"0.56811374",
"0.56750304",
"0.56711864",
"0.56530845",
"0.56457853",
"0.56364423",
"0.56194466",
"0.5618929",
"0.56030947",
"0.5593091",
"0.55908346",
"0.55873233",
"0.5580465",
"0.5577114",
"0.55742717",
"0.5567667",
"0.556632",
"0.5563702",
"0.55549335",
"0.5550964",
"0.55440795",
"0.5541286",
"0.5537021",
"0.5533756",
"0.55334145",
"0.55242246",
"0.5523043",
"0.5521515",
"0.5513406",
"0.5496352",
"0.54907346",
"0.5488251",
"0.54881626",
"0.54880047",
"0.5486823",
"0.54863185",
"0.548201",
"0.54783416",
"0.54775697",
"0.54690504",
"0.54639274",
"0.54610306",
"0.54610306",
"0.54467523",
"0.54385895",
"0.5429553",
"0.5427823",
"0.5427823",
"0.54208547",
"0.54194164",
"0.5416499",
"0.5413037",
"0.54093385",
"0.5406139",
"0.538854",
"0.5386718",
"0.5382314",
"0.5381889",
"0.5379131",
"0.5373721",
"0.5371797",
"0.5360905",
"0.5356556",
"0.5352059",
"0.5352047",
"0.53492236",
"0.5348533",
"0.5342834",
"0.53351635",
"0.53287697",
"0.5325971",
"0.5318014",
"0.5318014",
"0.5318014",
"0.53145474",
"0.53140867",
"0.5307835",
"0.5303449"
] | 0.0 | -1 |
Due to `if Jets::Stack.has_resources?` check early on in the bootstraping process The code has not been built at that point. So we use a placeholder and will replace the placeholder as part of the cfn template build process after the code has been built and the code_s3_key with md5 is available. | def code_s3_key
"code_s3_key_placeholder"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_s3_key\n if photo && photo.filename && photo.source_id && name\n \"places/#{photo.place_id}/#{photo.source_id}/#{photo.file_parts[:root]}-#{name}.#{photo.file_parts[:extension]}\"\n else\n nil\n end\n end",
"def bucket_name\n 'ios-ksr-builds'\nend",
"def run_hook(_resources)\n setup_code_deploy_s3_buckets\n end",
"def generate_matchfile_content(template: nil)\n return \"s3_bucket(\\\"#{self.s3_bucket}\\\")\"\n end",
"def prod_s3_credentials\n {:bucket => \"alphadelta-pro\", :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET_KEY'] }\n end",
"def copy_initializer\n template 'k8s/tests_job.yaml', \"k8s/#{app_name}_tests_job.yaml\"\n template 'k8s/deployment.yaml', \"k8s/#{app_name}_deployment.yaml\"\n template 'k8s/service.yaml', \"k8s/#{app_name}_service.yaml\"\n template 'k8s/setup_job.yaml', \"k8s/#{app_name}_setup_job.yaml\"\n template 'Jenkinsfile', \"Jenkinsfile\"\n template \"Dockerfile.#{docker_base}\", \"Dockerfile\"\n template \"Dockerfile.test.#{docker_base}\", \"Dockerfile.test\"\n template 'database.yml.prod', \"database.yml.prod\"\n template 'database.yml.test', \"database.yml.test\"\n end",
"def transform_code_uri(lambda_fn_params, code_uri)\n if s3_uri? code_uri\n lambda_fn_params[:code_bucket] = bucket_from_uri code_uri\n lambda_fn_params[:code_key] = object_key_from_uri code_uri\n elsif code_uri.is_a? Hash\n lambda_fn_params[:code_bucket] = code_uri['Bucket']\n lambda_fn_params[:code_key] = code_uri['Key']\n end\n lambda_fn_params\n end",
"def run_me\r\n bucket_name = 'doc-example-bucket'\r\n kms_master_key_id = '9041e78c-7a20-4db3-929e-828abEXAMPLE'\r\n region = 'us-west-2'\r\n s3_client = Aws::S3::Client.new(region: region)\r\n\r\n if default_bucket_encryption_sse_cmk_set?(\r\n s3_client,\r\n bucket_name,\r\n kms_master_key_id\r\n )\r\n puts 'Default encryption state set.'\r\n else\r\n puts 'Default encryption state not set.'\r\n end\r\nend",
"def secret\n 's3cr37'\n end",
"def copy_initializer\n template \"bucket_maker.rb\", \"config/initializers/bucket_maker.rb\"\n end",
"def prime_cache_with_default_image\n s3init\n \n logger.info(\"Priming cache with default image\")\n Rails.cache.fetch(\"bar_image_-1\") { AWS::S3::S3Object.value 'barview.jpg', @bucketname }\n end",
"def execute!\n name_required!\n name = name_args.first\n\n stack_info = \"#{ui.color(\"Name:\", :bold)} #{name}\"\n begin\n stack = provider.stacks.get(name)\n rescue Miasma::Error::ApiError::RequestError\n stack = nil\n end\n\n config[:compile_parameters] ||= Smash.new\n\n if config[:file]\n s_name = [name]\n\n c_setter = lambda do |c_stack|\n if c_stack.outputs\n compile_params = c_stack.outputs.detect do |output|\n output.key == \"CompileState\"\n end\n end\n if compile_params\n compile_params = MultiJson.load(compile_params.value)\n c_current = config[:compile_parameters].fetch(s_name.join(\"__\"), Smash.new)\n config[:compile_parameters][s_name.join(\"__\")] = compile_params.merge(c_current)\n end\n c_stack.nested_stacks(false).each do |n_stack|\n s_name.push(n_stack.data.fetch(:logical_id, n_stack.name))\n c_setter.call(n_stack)\n s_name.pop\n end\n end\n\n if stack\n c_setter.call(stack)\n end\n\n ui.debug \"Compile parameters - #{config[:compile_parameters]}\"\n file = load_template_file(:stack => stack)\n stack_info << \" #{ui.color(\"Path:\", :bold)} #{config[:file]}\"\n else\n file = stack.template.dup if config[:plan]\n end\n\n unless stack\n ui.fatal \"Failed to locate requested stack: #{ui.color(name, :red, :bold)}\"\n raise \"Failed to locate stack: #{name}\"\n end\n\n unless config[:print_only]\n ui.info \"#{ui.color(\"SparkleFormation:\", :bold)} #{ui.color(\"update\", :green)}\"\n end\n\n unless file\n if config[:template]\n file = config[:template]\n stack_info << \" #{ui.color(\"(template provided)\", :green)}\"\n else\n stack_info << \" #{ui.color(\"(no template update)\", :yellow)}\"\n end\n end\n unless config[:print_only]\n ui.info \" -> #{stack_info}\"\n end\n if file\n if config[:print_only]\n ui.puts format_json(parameter_scrub!(template_content(file)))\n return\n end\n\n original_template = stack.template\n original_parameters = stack.parameters\n\n apply_stacks!(stack)\n\n populate_parameters!(file, :current_parameters => stack.root_parameters)\n update_template = stack.template\n\n if config[:plan]\n begin\n stack.template = original_template\n stack.parameters = original_parameters\n plan = build_planner(stack)\n if plan\n result = plan.generate_plan(\n file.respond_to?(:dump) ? file.dump : file,\n config_root_parameters\n )\n display_plan_information(result)\n end\n rescue => e\n unless e.message.include?(\"Confirmation declined\")\n ui.error \"Unexpected error when generating plan information: #{e.class} - #{e}\"\n ui.debug \"#{e.class}: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n ui.confirm \"Continue with stack update?\" unless config[:plan_only]\n else\n raise\n end\n end\n if config[:plan_only]\n ui.info \"Plan only mode requested. Exiting.\"\n return\n end\n end\n stack.parameters = config_root_parameters\n\n if config[:upload_root_template]\n upload_result = store_template(name, file, Smash.new)\n stack.template_url = upload_result[:url]\n else\n stack.template = parameter_scrub!(template_content(file, :scrub))\n end\n else\n apply_stacks!(stack)\n original_parameters = stack.parameters\n populate_parameters!(stack.template, :current_parameters => stack.root_parameters)\n stack.parameters = config_root_parameters\n end\n\n # Set options defined within config into stack instance for update request\n if config[:merge_api_options]\n config.fetch(:options, Smash.new).each_pair do |key, value|\n if stack.respond_to?(\"#{key}=\")\n stack.send(\"#{key}=\", value)\n end\n end\n end\n\n begin\n api_action!(:api_stack => stack) do\n stack.save\n if config[:poll]\n poll_stack(stack.name)\n if stack.reload.state == :update_complete\n ui.info \"Stack update complete: #{ui.color(\"SUCCESS\", :green)}\"\n namespace.const_get(:Describe).new({:outputs => true}, [name]).execute!\n else\n ui.fatal \"Update of stack #{ui.color(name, :bold)}: #{ui.color(\"FAILED\", :red, :bold)}\"\n raise \"Stack did not reach a successful update completion state.\"\n end\n else\n ui.warn \"Stack state polling has been disabled.\"\n ui.info \"Stack update initialized for #{ui.color(name, :green)}\"\n end\n end\n rescue Miasma::Error::ApiError::RequestError => e\n if e.message.downcase.include?(\"no updates\")\n ui.warn \"No updates detected for stack (#{stack.name})\"\n else\n raise\n end\n end\n end",
"def s3_gen_bucket\n s3_gen.bucket(App.aws_bucket,true)\n end",
"def setup_code_deploy_s3_buckets\n @regions.uniq.each do |region|\n client = s3_client(region:)\n name = bucket_name(region)\n bucket = Aws::S3::Bucket.new(\n name,\n client:\n )\n bucket.create unless bucket.exists?\n end\n end",
"def update_from_s3\n begin\n ensure_updated_package\n rescue Aws::S3::Errors::NoSuchKey\n @logger.info 'Package does not exist on S3. If you have made local changes to code-studio, you need to set build_code_studio and use_my_code_studio to true in locals.yml'\n return false\n rescue Exception => e\n @logger.info \"update_from_s3 failed: #{e.message}\"\n return false\n end\n return true\n end",
"def writeVersionCode(file, versionCode)\n s3 = Aws::S3::Client.new(region: 'us-east-1')\n obj = s3.put_object({\n body: versionCode.to_s,\n bucket: \"sportarchive-prod-creds\",\n key: \"android-versioncode/#{file}\"\n })\nend",
"def cloudCode(code, placeholder = \"CLOUDCODEPLACEHOLDER\")\n var_name = code.gsub(/[^a-z0-9]/i, \"_\")\n placeholder = code if placeholder.nil?\n getTail(var_name, value: placeholder, runtimecode: code)\n \"MU::Config.getTail PLACEHOLDER #{var_name} REDLOHECALP\"\n end",
"def bootstrap!\n root_file = Gem::TUF::File.new 'metadata/root.txt',\n Gem::TUF::Serialize.canonical(signed_root)\n\n targets = Gem::TUF::Role::Targets.empty\n targets_file = build_role 'targets', targets\n\n release = Gem::TUF::Role::Release.empty\n release.replace(targets_file)\n release.replace(root_file)\n release_file = build_role 'release', release\n\n timestamp = Gem::TUF::Role::Timestamp.empty\n timestamp.replace(release_file)\n timestamp_file = build_role 'timestamp', timestamp\n\n [root_file, targets_file, release_file].each do |file|\n bucket.create file.path_with_hash, file.body\n end\n bucket.create timestamp_file.path, timestamp_file.body\n end",
"def default_s3_bucket\n \"hydra_uploads\"\n end",
"def url_for(software)\n \"http://#{Config.s3_bucket}.s3.amazonaws.com/#{S3Cache.key_for(software)}\"\n end",
"def add_to(s3)\n s3_template = s3.template\n @instance_name = s3.name\n cloud_front_template = template\n s3.template.deep_merge(cloud_front_template)\n end",
"def tf_vars_aws\n {\n aws_region: provider.region,\n route53_zone_main_name: infra.dns.domain,\n route53_zone_this_name: infra.dns.subdomain,\n ec2_instance_type: provider.instance.type,\n ec2_key_pair: provider.instance.key_pair,\n ec2_tags: provider.instance.tags,\n ec2_ami_distro: provider.instance.ami_distro\n # lambda_filename: infra.lambda_filename\n }\n end",
"def s3_url\n \"https://s3.amazonaws.com/#{ENV['S3_BUCKET']}\"\n end",
"def fle_aws_temp_key\n ENV['CSFLE_AWS_TEMP_ACCESS_KEY_ID']\n end",
"def secret_key_base=(_arg0); end",
"def secret_key_base=(_arg0); end",
"def string_or_url(template)\n # Upload the template to S3 if it's too large to be passed directly.\n if template.length < 51200\n {template_body: template}\n elsif template.length < 460800\n CDO.log.debug 'Uploading template to S3...'\n key = AWS::S3.upload_to_bucket(TEMP_BUCKET, \"#{stack_name}-#{Digest::MD5.hexdigest(template)}-cfn.json\", template, no_random: true)\n {template_url: \"https://s3.amazonaws.com/#{TEMP_BUCKET}/#{key}\"}\n else\n raise 'Template is too large'\n end\n end",
"def aws_instance_S3_files_create\n bucket = aws_call('aws_S3_bucket_get', name: Rails.configuration.x.aws['s3_bucket_name'])\n if not aws_call('aws_obj_exists?', obj: bucket)\n log \"AWS: creating S3 Bucket '#{Rails.configuration.x.aws['s3_bucket_name']}'\"\n bucekt = aws_call('aws_S3_bucket_create', name: Rails.configuration.x.aws['s3_bucket_name'])\n end\n\n aws_instance_S3_object_create(bucket, 'exit_status', :exit_status_page, :write)\n aws_instance_S3_object_create(bucket, 'script_log', :script_log_page, :write)\n aws_instance_S3_object_create(bucket, 'bash_history', :bash_history_page, :write)\n\n obj = aws_instance_S3_object_create(bucket, 'com', :com_page, :write)\n log \"AWS: writing to S3Object '#{obj.key}'\"\n aws_call('aws_S3_object_write', obj: obj, data: 'waiting')\n\n obj = aws_instance_S3_object_create(bucket, 'cookbook', :cookbook_url, :read)\n log \"AWS: writing to S3Object '#{obj.key}'\"\n aws_call('aws_S3_object_write', obj: obj, data: self.generate_cookbook)\n end",
"def get_box(dist, version)\n dist ||= \"trusty\"\n version ||= '20160323'\n \n name = \"govuk_dev_#{dist}64_#{version}\"\n bucket = 'govuk-dev-boxes-test'\n url = \"https://#{bucket}.s3.amazonaws.com/#{name}.box\"\n\n return name, url\nend",
"def s3_start\n\t\t@s3 = AWS::S3.new\n\tend",
"def connect_to_s3\n config = {\n provider: 'AWS',\n aws_access_key_id: ENV['IMAGO_S3_KEY'],\n aws_secret_access_key: ENV['IMAGO_S3_SECRET'],\n path_style: true\n }\n Fog::Storage.new(config)\nend",
"def quick_s3_upload\n end",
"def connect_to_s3()\n\n Aws::S3::Client.new(\n access_key_id: ENV['S3_KEY'],\n secret_access_key: ENV['S3_SECRET'],\n region: ENV['AWS_REGION'],\n force_path_style: ENV['PATH_STYLE']\n )\n \nend",
"def run_create_k3_remote(block_on_compile, k3_cpp_name, k3_path)\n stage \"[3] Remote creating K3 cpp file.\"\n args = { \"compilestage\" => \"cpp\",\n \"workload\" => $options[:skew].to_s}\n args[\"compileargs\"] = $options[:compileargs] if $options[:compileargs]\n\n res = curl($server_url, \"/compile\", file: k3_path, post: true, json: true, args:args)\n uid = res[\"uid\"]\n $options[:uid] = uid\n persist_options()\n\n if block_on_compile\n # get the cpp file\n wait_and_fetch_remote_compile(nil, k3_cpp_name, uid)\n end\n return uid\nend",
"def local_and_s3\n local\n s3\n end",
"def initialize(*args)\n version = Chef::Version.new(Chef::VERSION[/^(\\d+\\.\\d+\\.\\d+)/, 1])\n if version.major < 10 || ( version.major == 11 && version.minor < 6 )\n raise \"sk_s3_file requires at least Chef 11.6.0, you are using #{Chef::VERSION}\"\n end\n super\nend",
"def putAsset(filePath, metadata)\n\n # Calculate the sha256 hash, and use it to form the s3 path\n md5sum = Digest::MD5.file(filePath).hexdigest\n sha256Sum = Digest::SHA256.file(filePath).hexdigest\n s3Path = \"#{$s3Config.prefix}/binaries/#{sha256Sum[0,2]}/#{sha256Sum[2,2]}/#{sha256Sum}\"\n\n # If the S3 file is already correct, don't re-upload it.\n obj = $s3Bucket.object(s3Path)\n if !obj.exists? || obj.etag != \"\\\"#{md5sum}\\\"\"\n #puts \"Uploading #{filePath} to S3.\"\n obj.put(body: File.new(filePath),\n metadata: metadata.merge({\n original_path: filePath.sub(%r{.*/([^/]+/[^/]+)$}, '\\1'), # retain only last directory plus filename\n mime_type: MimeMagic.by_magic(File.open(filePath)).to_s\n }))\n obj.etag == \"\\\"#{md5sum}\\\"\" or raise(\"S3 returned md5 #{resp.etag.inspect} but we expected #{md5sum.inspect}\")\n end\n\n return sha256Sum\nend",
"def bifrost_deployer(lambda_policy_file, lambda_policy_context, s3_policy_file, s3_policy_context)\n project = self.project\n step_name = self.step_name\n s3_bucket_name = self.s3_bucket_name\n\n # Create Step Function\n project.from_template('step', \"#{step_name}_step\", {\n lambda_policy_file: lambda_policy_file,\n lambda_policy_context: lambda_policy_context\n })\n\n s3_context = build_context(s3_policy_context)\n # s3 bucket\n project.resource('aws_s3_bucket', step_name) {\n bucket s3_bucket_name\n\n acl(\"private\")\n\n if s3_policy_file\n _policy_file s3_policy_file, s3_context\n end\n\n tags {\n Name s3_bucket_name\n }\n }\n end",
"def inject_bucket_maker_content\n contents = <<-CONTENT.strip_heredoc\n # Module Inclusion for BucketMaker\n # The options are\n # - BucketMaker::Models::Redisable\n #\n include #{module_name_for_include}\n\n CONTENT\n\n klass_path = if namespaced?\n class_name.to_s.split(\"::\")\n else\n [class_name]\n end\n\n indent_depth = klass_path.size\n contents = contents.split(\"\\n\").map { |line| \" \" * indent_depth + line } .join(\"\\n\") << \"\\n\\n\"\n\n inject_into_class(model_path, klass_path.last, contents) if model_exists?\n\n inject_for_active_recordable if store_in == 'active_record' && active_recordable_exists?\n end",
"def download_s3_file(image_info, *sightings_count)\n\n folder = image_info[0]\n filename = image_info[1]\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{filename}\"\n\n if sightings_count\n sightings_count = sightings_count[0]\n subdirectory = folder.split(\"/\")[1]\n sightings_dir = create_directory(subdirectory, sightings_count)\n swap_file = \"#{sightings_dir}/#{filename}\"\n else\n swap_file = \"./public/swap/#{filename}\" # use when running via app.rb\n # swap_file = \"../public/swap/#{file}\" # use when running locally from /lib/s3_bucket.rb\n end\n\n s3 = connect_to_s3()\n file = File.new(swap_file, 'wb')\n s3.get_object({ bucket:bucket, key:s3_file_path }, target: swap_file)\n file.close if file\n\nend",
"def upload()\n obj = @mgr.s3res.bucket(@mgr[\"Bucket\"]).object(@s3key)\n @mgr.log(:info,\"Uploading cloudformation stack template #{@stackdef}:#{@filename} to s3://#{@mgr[\"Bucket\"]}/#{@s3key}\")\n template = @mgr.load_template(\"s3\", \"cfnput\")\n @mgr.symbol_keys(template)\n @mgr.resolve_vars(template, :api_template)\n params = template[:api_template]\n params[:body] = @raw\n obj.put(params)\n end",
"def run_create_k3_local(k3_cpp_name, k3_cpp_path, k3_path)\n stage \"[3] Creating K3 cpp file locally\"\n compile = File.join($script_path, \"..\", \"run\", \"compile_mosaic.sh\")\n res = run(\"time #{compile} -1 #{k3_path} +RTS -A10M -N -c -s -RTS\", local:true)\n\n src_path = File.join($k3_root_path, \"__build\")\n # copy to work directory\n FileUtils.copy_file(File.join(src_path, k3_cpp_name), k3_cpp_path)\n # write out the result\n File.write(File.join($workdir, \"k3.log\"), res)\nend",
"def publish_s3_bucket(node)\n node['delivery']['config']['build_attributes']['publish']['s3_bucket']\n end",
"def aws_access_key_attribute\n\t\t\"provider_account_#{Digest::MD5.hexdigest(name || 'unknown')}_aws_access_key\"\n\tend",
"def init_provider(payload)\n if(config.get(:init, :chef, :validator) || config.get(:init, :chef, :encrypted_secret))\n bucket = stacks_api.api_for(:storage).buckets.get(config.get(:orchestration, :bucket_name))\n validator_name = name_for(payload, 'validator.pem')\n if(config.get(:init, :chef, :validator) && bucket.files.get(validator_name).nil?)\n file = bucket.files.build(:name => validator_name)\n file.body = OpenSSL::PKey::RSA.new(2048).export\n file.save\n end\n secret_name = name_for(payload, 'encrypted_data_bag_secret')\n if(config.get(:init, :chef, :encrypted_secret) && bucket.files.get(secret_name).nil?)\n file = bucket.files.build(:name => secret_name)\n file.body = SecureRandom.base64(2048)\n file.save\n end\n end\n end",
"def generate_code\n # only need to do this if code not set\n return if code\n ensure_unique_code\n end",
"def run_create_compile_k3_remote(bin_file, block_on_compile, k3_cpp_name, k3_path)\n stage \"[3-4] Remote creating && compiling K3 file to binary\"\n args = { \"compilestage\" => \"both\",\n \"workload\" => $options[:skew].to_s}\n args[\"compileargs\"] = $options[:compileargs] if $options[:compileargs]\n\n res = curl($server_url, \"/compile\", file: k3_path, post: true, json: true, args:args)\n uid = res[\"uid\"]\n $options[:uid] = uid\n persist_options()\n\n if block_on_compile\n wait_and_fetch_remote_compile(bin_file, k3_cpp_name, uid)\n end\n\n return uid\nend",
"def latest_prebuilt_microbosh_ami\n if aws? && settings[\"region_code\"] == \"us-east-1\"\n Net::HTTP.get(\"#{AWS_JENKINS_BUCKET}.s3.amazonaws.com\", \"/last_successful_micro-bosh-stemcell_ami\").strip\n else\n nil\n end\n end",
"def template_path(name)\n \"https://#{@templates_bucket}.s3.amazonaws.com/#{@templates_version}/#{name}.yaml\"\n end",
"def upload_bundle_command( bucket_name)\n super + ' --ec2certificate $EC2_CERT'\n end",
"def asset_host\n @asset_host ||= \"#{bucket_name}.s3.amazonaws.com\" \n end",
"def generate_code\n # only need to do this if code not set\n return if code\n\n ensure_unique_code\n end",
"def key_for_cached\n [ @options[:namespace], MD5.hexdigest(@url) ].join('_')\n end",
"def s3_storage_location(structure)\n a = structure[:streaming_inventory_output_bucket].gsub(\n 'var.admin_bucket',\n 'var.admin_bucket'\n ).gsub(\n 'var.deployment_id',\n 'var.deployment_id'\n )\n \"s3://#{a}\"\n end",
"def fixup_aws_environment_variables\n unless node['aws']['aws_access_key_id'].nil?\n ENV['AWS_ACCESS_KEY_ID'] = node['aws']['aws_access_key_id']\n ENV['AWS_SECRET_ACCESS_KEY'] = node['aws']['aws_secret_access_key']\n end\n ENV['AWS_REGION'] = node['aws']['region'] unless node['aws']['region'].nil?\nend",
"def run_me\n bucket_name = \"doc-example-bucket\"\n object_key = \"my-file.txt\"\n region = \"us-west-2\"\n object_content = File.read(object_key)\n\n # The following call generates a random AES256-GCM key. Alternatively, you can\n # provide a base64-encoded string representation of an existing key that\n # you want to use to encrypt the object. For example:#\n # encryption_key_string = 'XSiKrmzhtDKR9tTwJRSLjgwLhiMA82TC2z3GEXAMPLE='\n # encryption_key = encryption_key_string.unpack('m')[0]\n encryption_key = get_random_aes_256_gcm_key\n\n # Note that in the following call:\n # - key_wrap_schema must be aes_gcm for symmetric keys.\n # - To allow reading and decrypting objects that are encrypted by the\n # Amazon S3 V1 encryption client instead, use :v2_and_legacy instead of :v2.\n s3_encryption_client = Aws::S3::EncryptionV2::Client.new(\n region: region,\n encryption_key: encryption_key,\n key_wrap_schema: :aes_gcm,\n content_encryption_schema: :aes_gcm_no_padding,\n security_profile: :v2\n )\n\n if encrypted_object_uploaded?(\n s3_encryption_client,\n bucket_name,\n object_key,\n object_content\n )\n puts \"Uploaded.\"\n else\n puts \"Not uploaded.\"\n end\nend",
"def ci_config\n {\n \"S3\" => {\n \"access_key_id\" => ENV.fetch('TIRAMISU_S3_KEY'),\n \"secret_access_key\" => ENV.fetch('TIRAMISU_S3_SECRET_KEY'),\n \"bucket\" => ENV.fetch('TIRAMISU_S3_BUCKET')\n },\n \"tootsie\"=>\"localhost\"\n }\n end",
"def bucket_name\n ENV.fetch('S3_AWS_BUCKET', 'S3_AWS_BUCKET')\n end",
"def config\n {\n :APP_NAME => APP_NAME,\n :APP_ENV => APP_ENV,\n :AWS_ACCESS_KEY_ID => AMI_ACCESS_KEY_ID,\n :AWS_SECRET_ACCESS_KEY => AMI_SECRET_ACCESS_KEY\n }\nend",
"def random_bucket_hash name=random_bucket_name\n {\"kind\"=>\"storage#bucket\",\n \"id\"=>name,\n \"selfLink\"=>\"https://www.googleapis.com/storage/v1/b/#{name}\",\n \"projectNumber\"=>\"1234567890\",\n \"name\"=>name,\n \"timeCreated\"=>::Time.now,\n \"metageneration\"=>\"1\",\n \"owner\"=>{\"entity\"=>\"project-owners-1234567890\"},\n \"location\"=>\"US\",\n \"storageClass\"=>\"STANDARD\",\n \"etag\"=>\"CAE=\" }\n end",
"def url\n if @attributes[:filename] =~ /^http:\\/\\//\n @attributes[:filename]\n elsif $cloudfront && $cloudfront[s3_bucket]\n \"#{$cloudfront[s3_bucket]}/#{s3_key}\"\n else\n \"http://#{s3_bucket}.s3.amazonaws.com/#{s3_key}\"\n end\n end",
"def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end",
"def initialize aws_access_key_id, aws_secret_access_key\n require 'right_aws'\n @s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key)\n end",
"def aws_test_bucket_resource\n Aws::S3::Resource.new(\n region: ENV['SHF_AWS_S3_TEST_BACKUP_REGION'],\n credentials: Aws::Credentials.new(ENV['SHF_AWS_S3_BACKUP_KEY_ID'],\n ENV['SHF_AWS_S3_BACKUP_SECRET_ACCESS_KEY']))\n end",
"def bucket; ::AWS::S3.new( { :secure => false } ).buckets[DC::SECRETS['bucket']]; end",
"def initialize(code_bucket, url_bucket = nil)\n @code_bucket = code_bucket\n @url_bucket = url_bucket || @code_bucket\n end",
"def default_key \n Digest::SHA1.hexdigest(\"riaque:#{name}\")\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end",
"def s3=(value)\n self[:s3] = value\n end"
] | [
"0.5726733",
"0.5661511",
"0.5531613",
"0.55142844",
"0.5394334",
"0.5278653",
"0.52558106",
"0.52528733",
"0.51931196",
"0.51488304",
"0.5136274",
"0.51173973",
"0.51095766",
"0.5100951",
"0.5076209",
"0.504742",
"0.5042179",
"0.50356054",
"0.5010599",
"0.5001653",
"0.49781448",
"0.49711",
"0.4965534",
"0.4950725",
"0.49398112",
"0.49398112",
"0.49346033",
"0.49321407",
"0.49311075",
"0.4928101",
"0.49103644",
"0.49033207",
"0.49029428",
"0.48974052",
"0.48866603",
"0.4882642",
"0.48714784",
"0.4855353",
"0.48507565",
"0.48481673",
"0.48374704",
"0.4833016",
"0.48323962",
"0.48321584",
"0.48303166",
"0.4828351",
"0.4807612",
"0.48058692",
"0.48018923",
"0.4799566",
"0.47875306",
"0.47793278",
"0.47776708",
"0.47717416",
"0.47699952",
"0.47669306",
"0.47662088",
"0.4765427",
"0.4757274",
"0.47533542",
"0.47490177",
"0.47405028",
"0.47367275",
"0.47345832",
"0.4727842",
"0.471702",
"0.47148043",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429",
"0.4710429"
] | 0.7231689 | 0 |
DELETE /friendships/1 DELETE /friendships/1.json | def destroy
raise
@friendship = Friendship.all.sample
@friendship.destroy
respond_to do |format|
format.html { redirect_to friendships_path, notice: 'Project was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger.info(\"Delete friend_id 33333\")\n logger.info(\"Delete friend_id #{params[:user_id]}\")\n @friendship.destroy\n if request.format.json?\n render text: \"Delete\"\n else\n @friendship.destroy\n redirect_to friendships_url \n end \n end",
"def destroy\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to friendships_url, notice: \"Friens request denied\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to(friendships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @request_friendship.destroy\n respond_to do |format|\n format.html { redirect_to request_friendships_url, notice: 'La solicitud de amistad fue eliminada con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts 'callin'\n friendship = Friendship.find(params[:id])\n user = friendship.user\n friend = friendship.friend\n reciprocal_friendship = Friendship.find_by(user: friend, friend: user)\n friendship.destroy\n reciprocal_friendship.destroy\n respond_to do |format|\n # format.html do\n # { redirect_back(fallback_location: root_path, notice: \"Friendship with #{friend.name} ended.\") }\n format.json do\n render json: {\n status: 'deleted',\n notice: \"Friendship with #{friend.name} ended.\"\n }\n end\n end\n end",
"def destroy\n # prevent user from deleting a friendship which cannot be found.\n if !(@friendship)\n render json: {error: \"Friendship not found\"}, status: 404\n else\n @friendship.destroy\n render status: 204\n end\n end",
"def destroy\n @friendship = current_user.friendships.find_by_id(params[:id])\n @friendship = current_user.inverse_friendships.find_by_id(params[:id]) unless @friendship.present? \n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to user_friend_url(current_user), notice: 'Friendship was successfully Removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = current_user.friendships.find(params[:id])\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to current_user\n end",
"def delete_friendship\n user = User.find(params[:user_id])\n @friendship = user.friendships.where(friend_id: params[:friend_id]).first ||\n user.inverse_friendships.where(friend_id: params[:user_id]).first\n if @friendship.present? # Can't call exists on a single record\n @friendship.delete\n render status: :ok, json: {\n message: 'Successfully deleted friendship'\n }.to_json\n else\n render status: :bad_request, json: {\n message: 'No friendship to delete'\n }\n end\n end",
"def destroy\n if @friend\n @friend.destroy\n else\n @friendship.destroy\n end\n respond_to do |format|\n format.html { redirect_to friendships_url, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friendship_mutual = Friendship.where(:user_id => @friendship.friend_id).first\n @friendship.destroy \n @friendship_mutual.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 @friendship = @current_user.friendships.find_by(friendship_params)\n @inverse_friendship = @current_user.inverse_friendships.find_by(@friendship.friend_id)\n @friendship.destroy\n @inverse_friendship.destroy\n\n head :no_content\n end",
"def destroy\n other = Friendship.find_by(user: @friendship.friend, friend: @friendship.user)\n other.destroy unless other.nil?\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend = current_user.friendships.find(params[:id])\n @friend.destroy\n flash[:notice] = \"Removed friend.\"\n redirect_to current_user\n end",
"def destroy\n @friendship = Friendship.find(params[:id]).destroy\n redirect_to users_url\n end",
"def destroy\n #Deletes the friendship (both ways)\n @user=current_user\n friend=User.find_by_email(params[:email])\n if(friend)\n friendCheck=Friendship.find_by_user_id_and_friend_id(@user.id, friend.id)\n if(friendCheck)\n @friendship = @user.friendships.find_by_friend_id(friend.id)\n @friendship.destroy\n @friendship = friend.friendships.find_by_friend_id(@user.id)\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'true'}}\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'false'}}\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: {:deleted => 'false'}}\n end\n end\n end",
"def destroy\n second_friendship = Friendship.find_by(:user1_id => @friendship.user2_id)\n @friendship.destroy\n second_friendship.destroy if second_friendship\n \n respond_to do |format|\n format.html { redirect_to back_page, flash: { :success => 'Friendship was deleted.' } }\n format.json { head :no_content }\n end\n end",
"def delete_friend\n \t#friend = User.find(params[:friend_id])\n respond_to do |format|\n \tif @user.friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} deleted!\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n else\n error = \"You aren't friends with #{@friend.nick_name}\"\n format.json { render :json => {:error => error, :status => \"400\"} }\n end\n end\n end",
"def destroy_friendship(user, params = {})\n args = [user, params]\n delete path_from_args('friendships/destroy', args), params_from_args(args)\n end",
"def destroy\n @friendship = current_user.friendships.find(params[:id])\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to posts_path\n end",
"def destroy\n @friendship = @current_user.friendships.find_by_id(params[:id])\n if @friendship.destroy\n flash[:success] = \"This relationship has been deleted\"\n else\n flash[:error] = \"Delete failed, if you really want, please try again\"\n end\n redirect_to(individual_path(@current_user))\n end",
"def destroy\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Friendship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def friendships_destroy(options = {})\n @req.post(\"/1.1/friendships/destroy.json\", options)\n end",
"def destroy\n @friend_request = FriendRequest.find(params[:id])\n @friend_request.destroy\n\n respond_to do |format|\n format.html { redirect_to friend_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @friendrequest = Friendrequest.find(params[:id])\n @friendrequest.destroy\n\n respond_to do |format|\n format.html { redirect_to friendrequests_url }\n format.json { head :no_content }\n end\n end",
"def unfriend\n if relation = @user.friendships.find_by(friend_id: @friend.id)\n relation.destroy\n render json: { success: true }\n else\n render json: {message: relation.errors&.full_messages&.first}, status: 202\n end\n end",
"def destroy\n @friend.destroy\n render json: {}\n end",
"def destroy\n @friendship = Friendship.find(params[:id])\n @friendship.destroy\n \n flash[:notice] = \"Removed friendship.\"\n redirect_to root_path\n end",
"def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to :back\n end",
"def destroy\n @clientship = current_user.clientships.find(params[:id])\n @clientship.destroy\n\n respond_to do |format|\n format.html { redirect_to clientships_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fellowship.destroy\n respond_to do |format|\n format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend = Friend.find(params[:id])\n @friend.destroy\n\n respond_to do |format|\n format.html { redirect_to friends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to friends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friends1.destroy\n respond_to do |format|\n format.html { redirect_to friends1s_url, notice: \"Friend was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend_request.destroy\n respond_to do |format|\n format.html { redirect_to friend_requests_url, notice: 'Friend request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend_request.destroy\n respond_to do |format|\n format.html { redirect_to friend_requests_url, notice: 'Friend request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendrequest.destroy\n respond_to do |format|\n format.html { redirect_to friendrequests_url, notice: 'Friendrequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendslist = Friendslist.find(params[:id])\n @friendslist.destroy\n\n respond_to do |format|\n format.html { redirect_to friendslists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pending_friend_request.destroy\n respond_to do |format|\n format.html { redirect_to '/profile?id=%s' % [session[:user_id]] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"No longer friends.\"\n redirect_to :back\n end",
"def destroy\n @friendship1 = Friendship.where(friend_id: current_user.id, user_id: params[:id]).first\n @friendship2 = Friendship.where(friend_id: params[:id], user_id: current_user.id).first\n @friendship1.destroy\n @friendship2.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to :back\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to friends_url, notice: I18n.t('friend.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @plant = Plant.find(params[:id])\n @friendship = @plant.friendships.find_by_friend_id(params[:friend_id])\n\n if @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to remove friend\"\n redirect_to request.referrer\n end\n end",
"def destroy\n\n @friendship = Friendship.find(params[:id])\n\n if params[:black_ball]\n current_user.black_ball(@friendship.proposer)\n end\n\n @friendship.destroy\n @incoming_friend_requests = Friendship.where({\n proposee_id: current_user.id,\n confirmed: nil\n })\n respond_to do |format|\n format.html { redirect_to friendships_url }\n format.js{}\n format.json { head :no_content }\n end\n end",
"def remove\n\t\tif request.post?\n\t\t\tfriendship = Friendship.where(user_id: params[:user_id], friend_id: params[:friend_id]).first\n\t\t\tunless friendship\n\t\t\t\trender json: {error: \"You are not friends\"} and return\n\t\t\tend\n\t\t\tfriendship.destroy\n\t\t\trender json: {msg: \"Friend deleted\"}\n\t\tend\n\tend",
"def destroy\n current_user.end_friendship!(@relationship.friend)\n respond_to do |format|\n format.html { redirect_to relationships_url }\n end\n end",
"def destroy\n @followship.destroy\n respond_to do |format|\n format.html { redirect_to followships_url, notice: 'Followship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friends_list.destroy\n respond_to do |format|\n format.html { redirect_to friends_lists_url, notice: \"Friend was successfully removed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n @followship.destroy\n respond_to do |format|\n format.html { redirect_to followships_url, notice: 'Followship was successfully unfollowed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to member_friends_path(@member), notice: 'Friend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendlist.destroy\n respond_to do |format|\n format.html { redirect_to friendlists_url, notice: 'Friendlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend_request = FriendRequest.find(params[:id])\n @friend_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(friend_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to friends_url, notice: 'Friend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to friends_url, notice: 'Friend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendsofuser = Friendsofuser.find(params[:id])\n @friendsofuser.destroy\n\n respond_to do |format|\n format.html { redirect_to(friendsofusers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @friend = Friend.find(params[:id])\n @friend.destroy\n respond_with(@friend)\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to friends_url, notice: \"Friend was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to friends_url, notice: \"Friend was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend_request = FriendRequest.find(params[:id])\n @friend_request.destroy\n respond_to do |format|\n format.html { redirect_to(friend_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @manifestship.destroy\n respond_to do |format|\n format.html { redirect_to manifestships_url, notice: 'Manifestship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = Friendship.find_by_user_id_and_friend_id(params[:id],current_user.id)\n @friendship ||= Friendship.find_by_user_id_and_friend_id(current_user.id,params[:id])\n unless @friendship.nil?\n @friendship.destroy\n redirect_to :back, flash: { success: t('.friendships_controller.delete_usr') }\n else\n redirect_to :back, flash: { error: t('.friendships_controller.error_usr') }\n end\n end",
"def destroy\n @memeber_ship = MemeberShip.find(params[:id])\n @memeber_ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(memeber_ships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @discipleship.destroy\n respond_to do |format|\n format.html { redirect_to discipleships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ab_reltionship.destroy\n respond_to do |format|\n format.html { redirect_to ab_reltionships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n # Your friend will first remove you as friend\n your_friend = Friend.where(\"account_id = ? AND friend_account_id = ?\", @friend.friend_account_id, current_account.id).first\n your_friend.destroy\n\n # Now, Remove your friend\n @friend.destroy\n\n respond_to do |format|\n format.html { redirect_to friends_url, notice: 'Friend was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friends_list.destroy\n respond_to do |format|\n format.html { redirect_to friends_lists_url, notice: 'Friends list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @replyship = Replyship.find(params[:id])\n @replyship.destroy\n\n respond_to do |format|\n format.html { redirect_to(replyships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @friend = Friend.find(params[:id])\n @friend.destroy\n\n respond_to do |format|\n format.html { redirect_to(friends_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @friend = Friend.find(params[:id])\n @friend.destroy\n\n respond_to do |format|\n format.html { redirect_to(friends_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite_friend = InviteFriend.find(params[:id])\n @invite_friend.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_friends_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t @friendable = Friendable.where(from_id: [current_user, params[:id]]).where(to_id: [current_user, params[:id]]).last\n\t @friendable.destroy\n\t flash[:notice] = \"Removed friendship.\"\n\t redirect_to :back\n\t end",
"def destroy\n @my_girlfriend.destroy\n respond_to do |format|\n format.html { redirect_to my_girlfriends_url, notice: 'My girlfriend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friend.destroy\n respond_to do |format|\n format.html { redirect_to request.referrer, notice: \"Friend was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to(internships_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @internships_user = InternshipsUser.find(params[:id])\n @internships_user.destroy\n\n respond_to do |format|\n format.html { redirect_to internships_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n if @friendship.accepted\n @other_friendship = Friendship.find_by :requester_id => @friendship.granter_id, :granter_id => @friendship.requester_id\n @other_friendship.destroy\n notice = 'You and ' + Person.find(@friendship.granter_id).name + ' are no longer friends!'\n else\n notice = 'You have cancelled your friend request to ' + Person.find(@friendship.granter_id).name\n end\n @friendship.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: notice }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_your_friend.destroy\n respond_to do |format|\n format.html { redirect_to call_your_friends_url, notice: 'Call your friend was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to(authorships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html { redirect_to spaceships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @friendship = Friendship.where(friend_id: [current_user, params[:id]]).where(user_id: [current_user, params[:id]]).last\n @friendship.destroy\n flash[:notice] = \"Removed friendship.\"\n\n #log_activity #doesnt work with call backs\n\n redirect_to :back\n end",
"def unfriendship\n if params[:id]\n current_user.follow_ids.delete(params[:id])\n @user = User.find(params[:id]).del_follower(current_user)\n @user.save\n current_user.save\n end\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n end\n end",
"def destroy\n user = User.find(params[:id])\n begin\n current_user.friends.delete(user)\n user.friends.delete(current_user)\n rescue\n end\n\n respond_to do |format|\n format.html { redirect_to '/manage/friends' }\n end\n end",
"def destroy\n @authorship = Authorship.find(params[:id])\n @authorship.destroy\n\n respond_to do |format|\n format.html { redirect_to authorships_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t\t@profile.friends.destroy(params[:id])\n\t\trespond_to do |format|\n\t\t\tback_page = profile_friends_path\n\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\tformat.html { redirect_to back_page, notice: 'Friend was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @mentorship = Mentorship.find(params[:id])\n @mentorship.destroy\n\n respond_to do |format|\n format.html { redirect_to mentorships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n\n #this is okay because only one of these EVER exists at a time\n current_user.friends_requested.delete(@user)\n current_user.friend_requesters.delete(@user)\n\n if current_user.save\n flash[:success] = \"Request deleted!\"\n else\n flash[:error] = \"You can't let that person go just yet.\"\n end\n\n redirect_to session.delete(:return_to)\n end",
"def destroy\n @championship = Championship.find(params[:id])\n @championship.destroy\n\n respond_to do |format|\n format.html { redirect_to championships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @township.destroy\n respond_to do |format|\n format.html { redirect_to townships_url, notice: 'Township was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unfriend friend\n friendships.where( friend: friend ).first.destroy\n end"
] | [
"0.8221355",
"0.8084778",
"0.79870325",
"0.7875871",
"0.77671146",
"0.77334946",
"0.7714659",
"0.7688466",
"0.768427",
"0.76728183",
"0.76411515",
"0.7634922",
"0.7602406",
"0.7581604",
"0.75702053",
"0.7564261",
"0.7549776",
"0.749582",
"0.74902916",
"0.748306",
"0.7479315",
"0.74372226",
"0.74199766",
"0.7401836",
"0.7379442",
"0.734346",
"0.7296693",
"0.72939885",
"0.7291189",
"0.7271259",
"0.72377557",
"0.72316134",
"0.72076386",
"0.7194188",
"0.71719265",
"0.7154598",
"0.7144193",
"0.7126112",
"0.7126112",
"0.71159846",
"0.7101974",
"0.7099786",
"0.70933443",
"0.70889455",
"0.70525104",
"0.704091",
"0.703827",
"0.7014724",
"0.69829607",
"0.6972861",
"0.6959961",
"0.6946566",
"0.6937592",
"0.69120455",
"0.6907279",
"0.6900963",
"0.6888599",
"0.6888599",
"0.6885987",
"0.6883878",
"0.6881973",
"0.6881973",
"0.68815756",
"0.6876456",
"0.6871364",
"0.68644434",
"0.6854997",
"0.68486506",
"0.68486506",
"0.68486506",
"0.6848346",
"0.6839253",
"0.6839133",
"0.6824703",
"0.67990106",
"0.67990106",
"0.67697734",
"0.6763649",
"0.6757142",
"0.6746923",
"0.6746879",
"0.6745105",
"0.6741639",
"0.673143",
"0.67211175",
"0.67211175",
"0.6702847",
"0.66907907",
"0.6689164",
"0.6678261",
"0.66769445",
"0.6673766",
"0.6672654",
"0.6668222",
"0.66674906",
"0.6667237",
"0.6666081",
"0.6645737",
"0.6630388",
"0.6611159"
] | 0.726128 | 30 |
Returns +true+ iff the current severity level allows for the printing of +DEBUG+ messages. | def debug?; @level <= DEBUG; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug?\n severity == :DEBUG\n end",
"def debug?\n level <= DEBUG\n end",
"def debug?\n level >= ASL_LEVEL_DEBUG\n end",
"def debug?\n DEBUG == log_level\n end",
"def debug?\n @level <= 0\n end",
"def debug_logging\n log.level == Logger::DEBUG\n end",
"def log_debug?\n @logger.debug?\n end",
"def debug?; @loggers.first.level <= DEBUG; end",
"def debug?\n !!@debug # rubocop:disable Style/DoubleNegation\n end",
"def debug?\n $DEBUG\n end",
"def debug?\n debugging || !ENV['DEBUG'].nil?\n end",
"def debug?\n @loggers.any? { |logger| logger.respond_to?(:debug?) && logger.debug? }\n end",
"def debug?\n self[:debug] == 'true'\n end",
"def debug?\n @@debug\n end",
"def debug?\n !!@debug\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug?\n instance.options[:debug]\n end",
"def debug?\n @@debug\n end",
"def debug_mode?\n @@debug_mode\n end",
"def debugging?\n Options[:debug]\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def debug?\n\t\t!!@debuggable_status\n\tend",
"def debug?\n @debug || to_bool( ENV['LAUNCHY_DEBUG'] )\n end",
"def debugging?\n debugging = ENV[\"DEBUG\"]\n if defined?(Rails) && Rails.respond_to?(:env)\n debugging = true if [\"development\", \"test\"].include? Rails.env\n end\n debugging\n end",
"def debug?\n !!self.debug\n end",
"def debug?\n false\n end",
"def debug?\n !production?\n end",
"def debug?\n @debug || ENV['HATCHET_DEBUG'] || false\n end",
"def debug_mode\n @@debug_mode == 1\n end",
"def debugging?\n\t\t(datastore['DEBUG'] || '') =~ /^(1|t|y)/i\n\tend",
"def debug?; @logger.debug? end",
"def debug? ; $DEBUG ; end",
"def debug?\n return @debug_mode if defined?(@debug_mode)\n @debug_mode = ENV['MOLINILLO_DEBUG']\n end",
"def debug!\n self.severity = :DEBUG\n end",
"def debugging?\n ENV['DEBUG'] && ENV['DEBUG'] != ''\nend",
"def debug_through?\r\n return false\r\n end",
"def debug_msg msg\n puts msg if @options[:debug]\n end",
"def debug message; write DEBUG, message, caller[0] unless level > @level end",
"def debug_stream?\n @debug_stream\n end",
"def debug_stream?\n @debug_stream\n end",
"def http_debug?\n Options[:http_debug]\n end",
"def debugging?\n @debug_style.eql? \"NA_PRINT_DONT_PARSE\"\n end",
"def debug\n Puppet::Util::Log.level = :debug\n end",
"def print_level?(min_level, level)\n printed_levels(min_level).include?(level)\n end",
"def debug\n @@debug ||= false\n end",
"def debug?\n puts \"Debug mode is #{@shell_debug ? 'ON' : 'OFF'}\\n\\n\"\n nil\nend",
"def verbose?\n !!ENV[\"DEBUG\"]\nend",
"def debug_msg( str )\n puts str if @debug == true\n end",
"def debug string\n puts string if $DEBUG\nend",
"def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end",
"def debug(msg=nil)\n log \"DEBUG: #{msg}\" if $debug\n end",
"def debug(message = \"\", level = 5)\n if $config[:global][:verboselevel] and $config[:global][:verboselevel] >= level\n puts message \n\t\t#logger.info(message)\n Syslog.info(message)\n end\nend",
"def debug(message)\n if DEBUG\n log message\n end\nend",
"def debug(*args)\n self.level = DEBUG if $DEBUG\n super\n end",
"def debug_mode\n @configuration[:debug_mode] = true\n end",
"def debug?; end",
"def debug?; end",
"def debug(message)\n puts message if debug?\n end",
"def debug\n logger.add(Logger::DEBUG, nil, facility) { yield } if logger && logger.debug?\n end",
"def getDebugFlag()\n\t\t\treturn @_debug_flag\n\t\tend",
"def debug? ## always include (NOT just insportdb?)\n value = ENV['DEBUG']\n if value && TRUE_VALUES.include?( value.downcase )\n true\n else\n false\n end\nend",
"def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend",
"def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend",
"def log_level\n @log_level ||= :debug\n end",
"def log_level\n @log_level ||= :debug\n end",
"def debug?; run_options[:debug]; end",
"def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end",
"def checkdebug\n begin\n if ENV['FACTER_DEBUG'] == 'true'\n Facter.debugging(true)\n end\n rescue\n end\nend",
"def checkdebug\n begin\n if ENV['FACTER_DEBUG'] == 'true'\n Facter.debugging(true)\n end\n rescue\n end\nend",
"def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end",
"def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end",
"def informational?\n severity == 0\n end",
"def dbgprint? bit\n ($debug & bit) > 0 if $debug\nend",
"def dbgprint? bit\n ($debug & bit) > 0 if $debug\nend",
"def debug(info)\n puts(info) if @debug\n end",
"def debug_on(debug=true)\n ap \"Debugging is ON\"\n @debug = debug\n end",
"def debug(message)\n $stdout.puts \"D #{message}\" if @debug\n end",
"def debug(message)\n $stderr.puts(message) if @options[:debug]\nend",
"def debug msg\n if debug?\n return debug_writer.write msg if debug_writer.respond_to? :write\n return debug_writer.call(msg) if debug_writer.respond_to? :call\n raise \"No debug_writer set!\"\n end\n end",
"def severity_logged? severity\n\n\t\t::Pantheios::Core.severity_logged? severity\n\tend",
"def debug status=true\n\t\t@debuggable_status = !!status\n\tend",
"def level(*_args)\n :debug\n end",
"def say_debug(message)\n puts yellow(message) if self.debug\n end",
"def show_command?\n ENV['DEBUG'] || ENV['SHOW_COMMAND']\n end",
"def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend",
"def dev_log_level\n if value = tag_value(LOG_LEVEL_TAG)\n value = value.downcase.to_sym\n value = nil unless [:debug, :info, :warn, :error, :fatal].include?(value)\n end\n value\n end",
"def debug(log)\n output.puts log if log_level <= DEBUG\n end",
"def session_debug?(controller = nil)\n dev = developer?\n local = not_deployed?\n setting =\n if controller\n session[\"app.#{controller}.debug\"]\n elsif local || dev\n session['app.debug']\n end\n if local && dev || dev_client?\n !false?(setting) # Debugging *on* by default.\n else\n true?(setting) # Debugging *off* by default.\n end\n end",
"def debug(message)\n return unless debugging?\n\n logger.debug(message.to_s)\n nil\n end",
"def tracing?\n\n\t\tseverity_logged? :trace\n\tend",
"def dprint(s)\n print s if $DEBUG\nend",
"def debug?; debug_abilities? || debug_authorize? || debug_authorize_blank?; end",
"def debug! \n $DEBUG = true\n end",
"def debugMsg( msg )\n\treturn unless $DEBUG\n\t$stderr.print \"#{msg}\\n\"\nend",
"def log(msg)\n puts(msg) if @info_values['enable_debug_logging'] == \"Yes\"\n end",
"def debug(message)\n logger.debug(message) if logger\n end",
"def debug_logging=(value)\n if value\n log.level = Logger::DEBUG\n elsif log.is_a?(Datadog::Logger)\n log.level = Logger::WARN\n end\n end",
"def debug(message)\n puts \"#{Time.now.strftime(\"%H:%M:%S.%L\")} - \\t#{message}\" if DEBUG\nend"
] | [
"0.83979154",
"0.8258234",
"0.80911684",
"0.80764467",
"0.7767665",
"0.7196316",
"0.71661764",
"0.71177983",
"0.70868945",
"0.7083942",
"0.7010531",
"0.6979406",
"0.69387895",
"0.6937358",
"0.6934885",
"0.6867599",
"0.6867599",
"0.685835",
"0.68517625",
"0.6842682",
"0.67608356",
"0.67608356",
"0.6727259",
"0.6658578",
"0.66350853",
"0.6629861",
"0.6607331",
"0.6555696",
"0.6505888",
"0.65046287",
"0.6480739",
"0.64365",
"0.63816166",
"0.6359909",
"0.6356258",
"0.6335046",
"0.62946284",
"0.6213549",
"0.62041396",
"0.6202152",
"0.6202152",
"0.61783165",
"0.6055898",
"0.60445696",
"0.60062534",
"0.5988711",
"0.5986663",
"0.59789574",
"0.59568876",
"0.5930776",
"0.590888",
"0.59066683",
"0.5865017",
"0.5863971",
"0.5862875",
"0.5825626",
"0.5812757",
"0.5812757",
"0.5796805",
"0.5794152",
"0.5774059",
"0.5771085",
"0.5758022",
"0.5758022",
"0.57455814",
"0.57455814",
"0.57416975",
"0.5739187",
"0.5732445",
"0.5732445",
"0.573211",
"0.573211",
"0.5714421",
"0.5713757",
"0.5713757",
"0.5697824",
"0.56974477",
"0.568287",
"0.56752586",
"0.566424",
"0.56572783",
"0.5654921",
"0.5645918",
"0.5619347",
"0.56137794",
"0.5606057",
"0.5604701",
"0.55849004",
"0.55793446",
"0.55742145",
"0.5572683",
"0.5569724",
"0.5560564",
"0.5557838",
"0.55527633",
"0.5535645",
"0.5530877",
"0.55252486",
"0.5524456"
] | 0.7382839 | 6 |
Returns +true+ iff the current severity level allows for the printing of +INFO+ messages. | def info?; @level <= INFO; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info?\n severity == :INFO\n end",
"def info?\n level <= INFO\n end",
"def info?\n level >= ASL_LEVEL_INFO\n end",
"def informational?\n severity == 0\n end",
"def info?\n @level <= 1\n end",
"def info?; @loggers.first.level <= INFO; end",
"def info?\n @loggers.any? { |logger| logger.respond_to?(:info?) && logger.info? }\n end",
"def info!\n self.severity = :INFO\n end",
"def notice?\n severity == :NOTICE\n end",
"def info message; write INFO, message, caller[0] unless level > @level end",
"def severity_logged? severity\n\n\t\t::Pantheios::Core.severity_logged? severity\n\tend",
"def info?; @logger.info? end",
"def alert?\n severity == :ALERT\n end",
"def info message\n message = \"INFO: \" + process_message(message)\n output_message message, @info_color if valid_conditions 1\n end",
"def medium?\n severity == 2\n end",
"def info?\n false\n end",
"def status_is_informational?\n\t\treturn self.status_category == 1\n\tend",
"def info?\n raise NotImplementedError.new\n end",
"def info(log)\n output.puts log if log_level <= INFO\n end",
"def print_level?(min_level, level)\n printed_levels(min_level).include?(level)\n end",
"def severity_logged? severity\n\n\t\tcase severity\n\t\twhen ::Integer\n\n\t\t\tv = severity\n\t\telse\n\n\t\t\tv = @value_lookup_map[severity] or warn \"unknown severity level '#{severity}' (#{severity.class})\"\n\t\tend\n\n\t\treturn true if v.nil?\n\n\t\tv <= @threshold_v\n\tend",
"def tracing?\n\n\t\tseverity_logged? :trace\n\tend",
"def warning?\n severity == :WARNING\n end",
"def with_info?\n @options[:with_info].present?\n end",
"def control_infos\n @log.info 'Info control started!'\n return false unless @infos.class == Hash\n\n props = [YEAR, PROP, LESSON, STUDENT, EXAM]\n return false unless props.sort == @infos.keys.sort\n @log.info 'Info control succesful!'\n true\n end",
"def warning?\n level == 1\n end",
"def warn?\n @level <= 2\n end",
"def verbose(max_level = false)\n #logger.unknown \"Rack::Insight::Logging.verbosity: #{Rack::Insight::Logging.verbosity} <= max_level: #{VERBOSITY[max_level]}\" #for debugging the logger\n return false if (!verbosity) # false results in Exactly Zero output!\n return true if (verbosity == true) # Not checking truthy because need to check against max_level...\n # Example: if configured log spam level is high (1) logger should get all messages that are not :debug (0)\n # so, if a log statement has if verbose(:low) (:low is 3)\n # 1 <= 3 # true => Message sent to logger\n # then, if a log statement has if verbose(:debug) (:debug is 0)\n # 1 <= 0 # false => Nothing sent to logger\n return true if verbosity <= (Rack::Insight::Config::VERBOSITY[max_level]) # Integers!\n end",
"def info message\n log Logger::INFO, message\n end",
"def verbose_mode?\n @output_level == :verbose\n end",
"def low?\n severity == 1\n end",
"def high?\n severity == 3\n end",
"def info\n logger.add(Logger::INFO, nil, facility) { yield } if logger && logger.info?\n end",
"def write_message?(level_of_message); end",
"def informational?\n @status.between?(100, 199) if @status\n end",
"def trace message, attention_type = nil\n validate_message_level()\n if (@message_level != MessageLevel::NO_MESSAGES && @message_level != MessageLevel::SOME_MESSAGES)\n log_info(\"## \" + message.to_s, attention_type )\n return true\n end\n return false\n end",
"def info(msg)\n log(msg, level: Level::INFO)\n end",
"def info_ln(message)\n write_message message, 'info', true\n end",
"def log_info(message)\n logger.info(message) if logger && logger.info?\n end",
"def info_only\n if @type == RECORD\n @changed_records.all? { |r| r.type == RecordChange::IGNORED }\n else\n false\n end\n end",
"def info?\n !success?\n end",
"def level=(new_level)\n logger.level = severity_lookup(new_level, :info)\n end",
"def warn?\n level >= ASL_LEVEL_WARNING\n end",
"def log_info(message)\n log(message, DebugType::INFO)\n end",
"def verbose?\n if @@verbose == true\n return \"Verbose output to console has been enabled.\"\n elsif @@verbose == false\n return \"Verbose output to console has not been enabled\"\n end\n\n end",
"def critical?\n severity == 4\n end",
"def print_info(msg)\n tag = '[ INFO ]'\n print_formatted(tag,msg)\n end",
"def log_info(msg)\n logger ? logger.info(msg) : puts(msg)\n end",
"def critical?\n severity == :CRITICAL\n end",
"def log_info(log_entry = \"\")\n entry(Gml::LOG_LEVEL_INFO, log_entry, 1)\n end",
"def isWritten(level)\n Logging::Writer.instance.write?(level)\n end",
"def log_info(message) # :nodoc:\n @logger.info(message) if @logger\n end",
"def log_info(info_message)\n Rails.logger.info(info_message)\n end",
"def log_info(info_message)\n logger.info(info_message)\n end",
"def log_info(info_message)\n logger.info(info_message)\n end",
"def info(message, level=:default)\n $stdout.puts colorize(message, level)\n end",
"def notice_message?\n true if message[:notice]\n end",
"def warn?\n level <= WARN\n end",
"def info(msg)\n Souschef::Print.info(msg) if @opts[:verbose]\n end",
"def display_info(info)\n puts \"\\e[34;1m[INFO]\\e[0m #{info}\"\n end",
"def info(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_INFO, message)\n end",
"def info(message)\n logger.info(message) if logger\n end",
"def verbose_info(message, color: :blue)\n info(message, color: color) if AIPP.options.verbose\n end",
"def info(msg)\n log.info msg\n end",
"def trap_info\n return unless Signal.list['INFO']\n\n trap 'INFO' do\n @statistics.show_basic\n end\n end",
"def verbose?\n @verbose_output\n end",
"def info(*args)\n log(:info, *args)\n end",
"def fatal?\n level >= ASL_LEVEL_CRIT\n end",
"def info(message)\n write_message message, 'info'\n end",
"def info(m)\n log_handler.info msg(m)\n end",
"def write_message?(level_of_message)\n LOG_LEVELS.fetch(level) <= LOG_LEVELS.fetch(level_of_message)\n end",
"def debug?\n severity == :DEBUG\n end",
"def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend",
"def info(message)\n log.info(message.to_s.blue)\n end",
"def levels?\n @levels\n end",
"def default?\n severity == :DEFAULT\n end",
"def logging_enabled?\n !!logging_enabled\n end",
"def info(msg)\r\n prelog\r\n logger.info(msg)\r\n end",
"def info(*args, &block)\n add_with_options(INFO, *args, &block)\n end",
"def info( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tGemserver.logger.add( Logger::INFO, msg, @classname, &block )\n\t\t\tend",
"def inspect?\n @inspect_mode.nil? or @inspect_mode\n end",
"def info msg\n logger.info msg\n end",
"def info(*args)\n @logger.send(:info, *args)\n end",
"def puts_info(msg)\n $stdout.puts \"\\e[32m[INFO] #{msg}\\e[0m\" if Calamum::Config[:debug]\nend",
"def informational?\n (100...200).include?(@status_code)\n end",
"def info(*args, &block)\n environment.logger.info(*args, &block)\n end",
"def debug?\n @level <= 0\n end",
"def verbose?\n ENV['VERBOSE']\n end",
"def informational?\n 100 <= code && code < 200\n end",
"def info(msg)\n @logProvider.info(msg)\n end",
"def info(msg)\n @logger.info(msg)\n end",
"def info_checks\n checks.select { |ctx| ctx.respond_to?(:info) }\n end",
"def info(msg)\n $ibm_cloud_log.info(format_message(msg))\n end",
"def _level? level\n\t\terror L[:'your level is too low'] if _user[:level].to_i < level.to_i\n\tend",
"def info(message)\n puts(stdout, message)\n end",
"def parse_ok?\n return false if @severity.nil? || @severity.length != 1\n return false if @fields.nil? || @fields.length < ChainLog::Formatter::NUM_FIELDS\n true\n end",
"def info(msg)\n puts msg\n end",
"def info(msg); @logger.info(msg); end",
"def info(context, options = nil)\n options = options.merge(level: 'info')\n log(context, options)\n end"
] | [
"0.83859193",
"0.8089953",
"0.7860342",
"0.73901504",
"0.71243024",
"0.6739494",
"0.66157424",
"0.64953405",
"0.6285898",
"0.6283893",
"0.6129055",
"0.6063748",
"0.5954058",
"0.5951774",
"0.59431934",
"0.5858298",
"0.5844786",
"0.57633334",
"0.57496476",
"0.5749371",
"0.56526536",
"0.562198",
"0.56011623",
"0.5586879",
"0.55689484",
"0.5552648",
"0.55394524",
"0.5539169",
"0.5534705",
"0.5520445",
"0.5504851",
"0.549538",
"0.5474848",
"0.54662645",
"0.5458613",
"0.5426383",
"0.5423674",
"0.5383836",
"0.537634",
"0.53580457",
"0.53408474",
"0.53274405",
"0.5325985",
"0.53134423",
"0.5309253",
"0.5293878",
"0.5284232",
"0.5279478",
"0.5276357",
"0.5275159",
"0.5267553",
"0.5259755",
"0.5256093",
"0.5255369",
"0.5255369",
"0.52401465",
"0.52302694",
"0.5211042",
"0.51883847",
"0.5182594",
"0.51811045",
"0.5167132",
"0.5146657",
"0.51337075",
"0.51333016",
"0.5109742",
"0.51002854",
"0.5095455",
"0.50878984",
"0.50521463",
"0.50482816",
"0.50448465",
"0.5044228",
"0.5032052",
"0.502925",
"0.50188935",
"0.49938107",
"0.49921784",
"0.4953541",
"0.49472815",
"0.49382338",
"0.4936554",
"0.4919945",
"0.49115068",
"0.4909638",
"0.48996845",
"0.48963332",
"0.4878789",
"0.4877939",
"0.48772565",
"0.48701063",
"0.48622748",
"0.4849495",
"0.4842681",
"0.48396367",
"0.4839416",
"0.48356646",
"0.48335907",
"0.48328194"
] | 0.71250546 | 5 |
Returns +true+ iff the current severity level allows for the printing of +WARN+ messages. | def warn?; @level <= WARN; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warn?\n level <= WARN\n end",
"def warn?\n level >= ASL_LEVEL_WARNING\n end",
"def warn?\n @level <= 2\n end",
"def warning?\n severity == :WARNING\n end",
"def warning?\n level == 1\n end",
"def warn?; @loggers.first.level <= WARN; end",
"def warnings?\n @warning_count > 0\n end",
"def warn?\n @loggers.any? { |logger| logger.respond_to?(:warn?) && logger.warn? }\n end",
"def warnings?\n !warnings.empty?\n end",
"def warnings?\n @statistics[:warning] != 0\n end",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def warning?\n check_warnings\n end",
"def warning?\n false\n end",
"def log_level\n @log_level ||= WARN\n end",
"def warn message\n message = \"WARN: \" + process_message(message)\n output_message message, @warn_color if valid_conditions 2\n end",
"def warnings_found?\n warnings.size > 0\n end",
"def warning?\n @result.retval == 1\n end",
"def medium?\n severity == 2\n end",
"def has_warnings?\n @has_warnings ||= false\n end",
"def warning?\n messages && messages.length > 0\n end",
"def level\n @level ||= :warn\n end",
"def ignore?(diagnostic)\n @ignore_warnings &&\n diagnostic.level == :warning\n end",
"def informational?\n severity == 0\n end",
"def loglevel\n @loglevel ||= ::Logger::WARN\n end",
"def warn message\n log Logger::WARN, message\n end",
"def warn?; @logger.warn?; end",
"def notice?\n severity == :NOTICE\n end",
"def low?\n severity == 1\n end",
"def warn(log)\n output.puts log if log_level <= WARN\n end",
"def any_warnings?\n @warnings.any?\n end",
"def set_warn_level!(level = 2)\n warn_levels = ['0','1','2','no']\n return unless warn_levels.include?(level.to_s.downcase)\n\n @options[:warning] = level\n end",
"def hide_warnings?(work)\n current_user.is_a?(User) && current_user.preference && current_user.preference.hide_warnings? && !current_user.is_author_of?(work)\n end",
"def high?\n severity == 3\n end",
"def lwarn\n logger.add(Logger::WARN, nil, facility) { yield } if logger && logger.warn?\n end",
"def warn message\n super message if @verbosity > 1\n end",
"def warn message\n @options.warn make_message message\n end",
"def warn(message)\n output[:warnings] << message\n end",
"def off?\n @level >= ::Logging::LEVELS.length\n end",
"def warn(*args, &block)\n add_with_options(WARN, *args, &block)\n end",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def warn(msg)\n log(msg, level: Level::WARN)\n end",
"def critical?\n severity == 4\n end",
"def alert?\n severity == :ALERT\n end",
"def warn?\n raise NotImplementedError.new\n end",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tGemserver.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def silence_mode?\n @output_level == :silence\n end",
"def isWritten(level)\n Logging::Writer.instance.write?(level)\n end",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tMongrel2.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def severity_logged? severity\n\n\t\tcase severity\n\t\twhen ::Integer\n\n\t\t\tv = severity\n\t\telse\n\n\t\t\tv = @value_lookup_map[severity] or warn \"unknown severity level '#{severity}' (#{severity.class})\"\n\t\tend\n\n\t\treturn true if v.nil?\n\n\t\tv <= @threshold_v\n\tend",
"def warning!\n self.severity = :WARNING\n end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def write_message?(level_of_message)\n LOG_LEVELS.fetch(level) <= LOG_LEVELS.fetch(level_of_message)\n end",
"def severity_logged? severity\n\n\t\t::Pantheios::Core.severity_logged? severity\n\tend",
"def warn(*msgs, uplevel: nil)\n __builtin_rb_warn_m(msgs, uplevel)\n end",
"def disabled_warnings\n Dynamic[:disabled_warnings]\n end",
"def critical?\n severity == :CRITICAL\n end",
"def write_message?(level_of_message); end",
"def warn\n\n end",
"def warn(msg); @logger.warn(msg); end",
"def warnings\n @diagnostics.select {|d| d.severity == :warning || d.severity == :deprecation }\n end",
"def warn(message = nil, progname = nil, &block)\n add(WARN, message, progname, &block)\n end",
"def warn(message)\n self.warnings << message\n puts \"warn #{message}\"\n end",
"def warn(message)\n log(\"#{color(\"WARNING:\", :yellow, :bold)} #{message}\")\n end",
"def warnings\n @warnings ||= failed.select { |rule| rule.severity == \"Warning\" }\n end",
"def warn=(value) @warn = true; end",
"def warn(check)\n update_check_status(check, 'warn')\n end",
"def warnings?\n !gem?(\"shelly-dependencies\") || gem?(\"shelly\")\n end",
"def threshold_disabled?\n !@enable_threshold\n end",
"def warnings?\n !gem?(\"shelly-dependencies\")\n end",
"def warn(msg)\n Chef::Log.warn(msg)\n end",
"def failed_whitelist_log_status?\n GlobalConstant::KycWhitelistLog.failed_status == @kyc_whitelist_log.status ||\n @kyc_whitelist_log.failed_reason != GlobalConstant::KycWhitelistLog.not_failed\n end",
"def should_report? issue\n diagnose = self[issue]\n diagnose == :error || diagnose == :warning || diagnose == :deprecation\n end",
"def errors_or_warnings?\n errors? || warnings?\n end",
"def warn(*args)\n self.warned = true\n super\n end",
"def fatal?\n level >= ASL_LEVEL_CRIT\n end",
"def val_warn (message1, value1 = false, message2 = false, value2 = false,\n message3 = false)\n message = \"#{message1}\" +\n (value1 == false ? \"\" : \" (#{value1.to_s.gsub(/[\\\"\\[\\]]/,\"\")})\") +\n (message2 == false ? \"\" : \" #{message2}\") +\n (value2 == false ? \"\" : \" (#{value2.to_s})\") +\n (message3 == false ? \"\" : \" #{message3}\")\n self.warnings.push(message)\n false\n end",
"def strict?\n compliance_level == STRICT\n end",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def show_red_warning?(max_absences, current_absences)\n return true if current_absences >= max_absences\n\n false\n end",
"def webs_disabled?\n fw_sig_permission_level == Webs::PermissionLevel[:disabled].to_s\n end",
"def log_warn(message)\n logger.warn(message) if logger && logger.warn?\n end",
"def report_warn(type, message)\n @report.warn(type, message)\n end",
"def warn(msg)\n log.warn msg\n end",
"def filtered_warnings\n @tracker.filtered_warnings\n end",
"def ShowPartitionWarning\n message = GetPartitionWarning()\n if Ops.greater_than(Builtins.size(message), 0)\n Builtins.y2warning(\"Warning: %1\", message)\n Report.Message(Builtins.mergestring(message, \"\\n\"))\n return true\n else\n return false\n end\n end",
"def warning\n return @warning\n end",
"def info?\n severity == :INFO\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def disabled_warnings; end",
"def emergency?\n severity == :EMERGENCY\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warn(*args, &block)\n method_missing(\"warn\", *args, &block)\n end",
"def is_denied?\n level == Membership::LEVELS[:denied]\n end",
"def warn(*args)\n log(:warn *args)\n end",
"def warn(msg)\r\n logger.warn(msg)\r\n end",
"def warn(msg)\n $ibm_cloud_log.warn(format_message(msg))\n end",
"def warn(topic, message = nil, &block)\n write(:warn, topic, message, &block)\n end"
] | [
"0.8223114",
"0.7938514",
"0.7714942",
"0.7605091",
"0.7263491",
"0.71076566",
"0.6793042",
"0.6791345",
"0.67360073",
"0.67079717",
"0.6662894",
"0.6534598",
"0.63765335",
"0.6294013",
"0.62064004",
"0.61641854",
"0.6117844",
"0.60956347",
"0.60843235",
"0.6075789",
"0.6061994",
"0.60032976",
"0.59975284",
"0.5993964",
"0.59591335",
"0.5927666",
"0.59209514",
"0.5846294",
"0.58457285",
"0.5802035",
"0.57529616",
"0.5725802",
"0.57083774",
"0.5699061",
"0.56429094",
"0.5632452",
"0.5607858",
"0.55778456",
"0.5571258",
"0.55627596",
"0.55476314",
"0.5524751",
"0.54940283",
"0.54682404",
"0.54659766",
"0.54577446",
"0.5444091",
"0.5431184",
"0.54105616",
"0.54043305",
"0.5399704",
"0.5374432",
"0.5372983",
"0.5371124",
"0.5357064",
"0.5340699",
"0.53405166",
"0.5339679",
"0.5330943",
"0.53161764",
"0.530023",
"0.52888274",
"0.52851844",
"0.5271146",
"0.52638906",
"0.52609456",
"0.52528465",
"0.5244152",
"0.52419955",
"0.5228078",
"0.52252704",
"0.52246433",
"0.5224452",
"0.5217001",
"0.5213014",
"0.521032",
"0.52066386",
"0.52053213",
"0.52053046",
"0.51985574",
"0.5196337",
"0.51885045",
"0.5188197",
"0.51797825",
"0.5150639",
"0.5144551",
"0.5135446",
"0.5132278",
"0.5132106",
"0.513036",
"0.5129467",
"0.5129467",
"0.5129467",
"0.5126911",
"0.51201695",
"0.5120054",
"0.51152045",
"0.51140904",
"0.5110033"
] | 0.7296957 | 5 |
Returns +true+ iff the current severity level allows for the printing of +ERROR+ messages. | def error?; @level <= ERROR; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error?\n severity == :ERROR\n end",
"def error?\n level <= ERROR\n end",
"def error?\n level >= ASL_LEVEL_ERR\n end",
"def error?\n @level <= 3\n end",
"def error?\n level == 2\n end",
"def error?; @loggers.first.level <= ERROR; end",
"def error?\n @status == ERROR_FLAG\n end",
"def error_log?\n @status.exitstatus & (1 << 6) != 0\n end",
"def error?\n status == STATUS_ERROR\n end",
"def error_message?\n true if message[:error]\n end",
"def error?\n type == :error\n end",
"def error?\n outcome == ERROR\n end",
"def error?\n error.to_bool\n end",
"def error?\n self.type == :error\n end",
"def error?\n self.type == :error\n end",
"def print_config_errors\n config_errors = @config.validation_errors\n if config_errors.length > 0\n reporter.error\n reporter.error(config_errors.first)\n true\n else\n false\n end\n end",
"def error?\n return true if errors.count > 0\n\n false\n end",
"def error?\n @loggers.any? { |logger| logger.respond_to?(:error?) && logger.error? }\n end",
"def error_log?\n @status.exitstatus & (1 << 6) != 0\n end",
"def informational?\n severity == 0\n end",
"def error?\n error_state?(peek_current_state)\n end",
"def include_errors?\n !!self.__options[:include_errors]\n end",
"def fatal_errors?\n errors_by_status? :fatal\n end",
"def error?\n !! @error\n end",
"def error?\n return false if error_text.nil? or error_text.empty?\n return true\n end",
"def requires_error_alert?\n active? && \n (self.error_notifications_sent < max_notification_alerts) &&\n backup_broken?\n end",
"def error?\n logger.debug { sign_message(\"Error state : #{@error}\") }\n if @error\n true\n else\n false\n end\n end",
"def error?\n status[:error] || false\n end",
"def raise_errors?\n @raise_errors != false\n end",
"def error?\n not @error.nil?\n end",
"def error?\n !!@error\n end",
"def fatal?\n level >= ASL_LEVEL_CRIT\n end",
"def error?\n !error.blank?\n end",
"def error?\n @error\n end",
"def error?\n @error\n end",
"def errors?\n @error_count > 0\n end",
"def error?\n respond_to? :error\n end",
"def has_error?\n status == ERROR \n end",
"def raise?(diagnostic)\n (@all_errors_are_fatal &&\n diagnostic.level == :error) ||\n diagnostic.level == :fatal\n end",
"def error?\n true\n end",
"def error?\n false\n end",
"def fatal_error?\n fatal_error_state?(peek_current_state)\n end",
"def fatal?\n level == 3\n end",
"def error?\n message.fields[0] == 'WE'\n end",
"def error_level\n @error_level\n end",
"def error_check?\n !@error_rules.empty?\n end",
"def error?\n false\n end",
"def error?\n false\n end",
"def stderr?\n @stderr_handler.output?\n end",
"def error?\n attributes['error'] != 0\n end",
"def error?\n last_error.present?\n end",
"def low?\n severity == 1\n end",
"def alert?\n severity == :ALERT\n end",
"def error?\n error\n end",
"def error?(name = nil, type = nil)\n return 0 < errors(name, type).size\n end",
"def errors?\n @statistics[:error] != 0\n end",
"def error?\n !error.nil?\n end",
"def error?\n !error.nil?\n end",
"def severity_logged? severity\n\n\t\t::Pantheios::Core.severity_logged? severity\n\tend",
"def error?\n self.error || false\n end",
"def error?\n !@error.equal?(NOT_SET)\n end",
"def error?\n false\n end",
"def error?\n !error.nil?\n end",
"def medium?\n severity == 2\n end",
"def fatal?\n @level <= 4\n end",
"def error?\n !!(status.to_s =~ /[4|5]\\d\\d/)\n end",
"def error?\n get_last_error['err'] != nil\n end",
"def error?\n get_last_error['err'] != nil\n end",
"def severity\n :error\n end",
"def raise_on_error?\n !!@raise_on_error\n end",
"def error_state?(state)\n STATES[state] >= ERROR_STATE_THRESHOLD\n end",
"def runtime_error?\n state = self.peek_current_state\n error_state?(state) &&\n !exception_state?(state) &&\n !fatal_error_state?(state)\n end",
"def error?\n resources.error.count > 0\n end",
"def error?\n resources.error.count > 0\n end",
"def puppet_detailed_exit_code_indicates_error?(ec)\n return (ec == 4 or ec == 6 or ec == 1)\n end",
"def is_error?\n return (self.status == HostResult::STATUS_ERROR)\n end",
"def severity_logged? severity\n\n\t\tcase severity\n\t\twhen ::Integer\n\n\t\t\tv = severity\n\t\telse\n\n\t\t\tv = @value_lookup_map[severity] or warn \"unknown severity level '#{severity}' (#{severity.class})\"\n\t\tend\n\n\t\treturn true if v.nil?\n\n\t\tv <= @threshold_v\n\tend",
"def print_level?(min_level, level)\n printed_levels(min_level).include?(level)\n end",
"def error?\n self.body.keys.include?(:err_code)\n end",
"def errors?\n @errors.size > 0\n end",
"def error?\n !!@error\n end",
"def error?\n !!@error\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def stderr_displayed?\n log_device = stderr_device\n log_device == $stderr || log_device == $stdout || log_device.is_a?(ProgressBarLogDevice)\n end",
"def errors?\n @errors.size > 0\n end",
"def error?\n self.State == P2::DS_STATE_ERROR\n end",
"def has_on_error?\n defined? @on_error\n end",
"def import_errors?\n self.import_errors == true\n end",
"def has_errors?\n @has_errors == true\n end",
"def fatal?\n level <= FATAL\n end",
"def error?\n error = (self[:error_upgrade] & 0b1111111)\n return error != 0\n end",
"def status_error?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_ERROR)\n return false\n end",
"def error!\n self.severity = :ERROR\n end",
"def high?\n severity == 3\n end",
"def error_page?\n popup_msg = get_el(doc.css('div#outsidecontainer'))\n return false if popup_msg.nil?\n return false if popup_msg.css('@style').to_s.match('display: none')\n return true if popup_msg.to_s.match(/error/i)\n return false\n end",
"def error?\n converter_results[:errors] && converter_results[:errors].any?\n end",
"def status_error?()\n return true if (@status == TAC_PLUS_ACCT_STATUS_ERROR)\n return false\n end",
"def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end",
"def error?\n return if @resource.is_a?(Array)\n @resource.key?(\"error\")\n end"
] | [
"0.77304804",
"0.7616635",
"0.73450714",
"0.6940619",
"0.686765",
"0.64692503",
"0.623947",
"0.6180464",
"0.61753416",
"0.61362493",
"0.6051478",
"0.60292786",
"0.6011104",
"0.60038245",
"0.60038245",
"0.596217",
"0.5952178",
"0.59461826",
"0.59132355",
"0.58931124",
"0.5879912",
"0.5867578",
"0.5863931",
"0.58582157",
"0.58569324",
"0.58439296",
"0.58323556",
"0.5831809",
"0.58311605",
"0.581377",
"0.579923",
"0.5784549",
"0.5769041",
"0.5763664",
"0.5763664",
"0.57572055",
"0.57560337",
"0.57422286",
"0.5736817",
"0.5732902",
"0.57251954",
"0.57135755",
"0.5698516",
"0.56885195",
"0.5678752",
"0.567565",
"0.5664037",
"0.5664037",
"0.56630564",
"0.56606436",
"0.56582814",
"0.56484497",
"0.56307054",
"0.56303096",
"0.5618997",
"0.5618228",
"0.5616674",
"0.5616674",
"0.5615978",
"0.5588087",
"0.55878186",
"0.557737",
"0.557644",
"0.5575954",
"0.55728084",
"0.55724305",
"0.55416375",
"0.55416375",
"0.55319905",
"0.55232203",
"0.5516411",
"0.5513049",
"0.5512805",
"0.5512805",
"0.55083025",
"0.5489586",
"0.54866403",
"0.54830587",
"0.547913",
"0.54634345",
"0.5463001",
"0.5463001",
"0.54602706",
"0.54458547",
"0.5443263",
"0.54375523",
"0.54339683",
"0.5429821",
"0.54194695",
"0.54141045",
"0.53997624",
"0.53924364",
"0.5378674",
"0.5376585",
"0.5371527",
"0.5367875",
"0.5357217",
"0.53454727",
"0.53385025"
] | 0.6369211 | 7 |
Returns +true+ iff the current severity level allows for the printing of +FATAL+ messages. | def fatal?; @level <= FATAL; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fatal?\n level <= FATAL\n end",
"def fatal?\n level == 3\n end",
"def fatal?\n level >= ASL_LEVEL_CRIT\n end",
"def fatal?\n @level <= 4\n end",
"def fatal?; @loggers.first.level <= FATAL; end",
"def fatal?\n @loggers.any? { |logger| logger.respond_to?(:fatal?) && logger.fatal? }\n end",
"def fatal_errors?\n errors_by_status? :fatal\n end",
"def informational?\n severity == 0\n end",
"def fatal message; write FATAL, message, caller[0] unless level > @level end",
"def fatal?\n exception.fatal?\n end",
"def notice?\n severity == :NOTICE\n end",
"def fatal_error?\n fatal_error_state?(peek_current_state)\n end",
"def fatal?\n false\n end",
"def low?\n severity == 1\n end",
"def severity_logged? severity\n\n\t\t::Pantheios::Core.severity_logged? severity\n\tend",
"def critical?\n severity == 4\n end",
"def fatal?; @logger.fatal? end",
"def critical?\n severity == :CRITICAL\n end",
"def fatal\n logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal?\n end",
"def medium?\n severity == 2\n end",
"def high?\n severity == 3\n end",
"def severity_logged? severity\n\n\t\tcase severity\n\t\twhen ::Integer\n\n\t\t\tv = severity\n\t\telse\n\n\t\t\tv = @value_lookup_map[severity] or warn \"unknown severity level '#{severity}' (#{severity.class})\"\n\t\tend\n\n\t\treturn true if v.nil?\n\n\t\tv <= @threshold_v\n\tend",
"def alert?\n severity == :ALERT\n end",
"def fatal(&prc)\n @@fatal = prc unless prc.nil?\n return @@fatal\n end",
"def raise?(diagnostic)\n (@all_errors_are_fatal &&\n diagnostic.level == :error) ||\n diagnostic.level == :fatal\n end",
"def fatal(*args, &block)\n add_with_options(FATAL, *args, &block)\n end",
"def print_level?(min_level, level)\n printed_levels(min_level).include?(level)\n end",
"def fatal(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"FATAL\".red.bold + \"] \" + \"#{input.red.bold}\"\n end",
"def warning?\n severity == :WARNING\n end",
"def warning?\n level == 1\n end",
"def error?\n severity == :ERROR\n end",
"def default?\n severity == :DEFAULT\n end",
"def fatal\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_CRIT, message)\n end",
"def error?\n @level <= 3\n end",
"def off?\n @level >= ::Logging::LEVELS.length\n end",
"def emergency?\n severity == :EMERGENCY\n end",
"def fatal(message)\n log(\"#{color(\"FATAL:\", :red, :bold)} #{message}\")\n end",
"def quiet?\n return false if verbose?\n \n quiet = ENV['QUIET']\n quiet.nil? || quiet =~ /^true$/i ? true : false\n end",
"def fatal(msg)\n log(msg, level: Level::FATAL)\n end",
"def fatal(message)\n err(\"#{color('FATAL:', :red, :bold)} #{message}\")\n end",
"def quiet\n @verbosity.zero?\n end",
"def quiet\n @verbosity.zero?\n end",
"def quiet?\n false\n end",
"def quiet\n true\n end",
"def has_at_exit_report?\n return true if ENV['DEPRECATABLE_HAS_AT_EXIT_REPORT'] == \"true\"\n return @has_at_exit_report\n end",
"def error?\n level <= ERROR\n end",
"def quiet?\n @quiet\n end",
"def quiet_mode?\n @@quiet_mode\n end",
"def info?\n severity == :INFO\n end",
"def quiet?\n return @quiet\n end",
"def parse_ok?\n return false if @severity.nil? || @severity.length != 1\n return false if @fields.nil? || @fields.length < ChainLog::Formatter::NUM_FIELDS\n true\n end",
"def fatal(message = nil, progname = nil, &block)\n add(FATAL, message, progname, &block)\n end",
"def debug?\n @level <= 0\n end",
"def fatal_error?(_error, _payload, _metadata)\n false\n end",
"def error?; @loggers.first.level <= ERROR; end",
"def fatal(*args)\n log(:fatal, *args)\n end",
"def fatal(progname = nil, &block)\n add(FATAL, nil, progname, &block)\n end",
"def fatal?; end",
"def fatal?; end",
"def notice_message?\n true if message[:notice]\n end",
"def warn?\n @level <= 2\n end",
"def fatal(message)\n log(4, message)\n end",
"def fatal(msg) log(FATAL, \"FATAL \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def fatal( msg=nil, &block )\n\t\t\t\tGemserver.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def log_fatal(message)\n logger.fatal(message) if logger && logger.fatal?\n end",
"def should_print?\n !@suppress_output\n end",
"def fatal!(message)\n # Not using safe_each in case that caused an error.\n safely { $stdout.reopen(@stdout, 'a+'); $stdout.puts message }\n safely { $stderr.reopen(@stderr, 'a+'); $stderr.puts message }\n exit 1\n end",
"def quiet?\n options[:quiet]\n end",
"def fatal(msg); @logger.fatal(msg); end",
"def fatal( msg=nil, &block )\n\t\t\t\tMongrel2.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def _level? level\n\t\terror L[:'your level is too low'] if _user[:level].to_i < level.to_i\n\tend",
"def none?\n level == 0\n end",
"def levels?\n @levels\n end",
"def has_abnormal_reports?\n\t\tself.reports.select{|c|\n\t\t\tc.has_abnormal_tests?\n\t\t}.size > 0\n\tend",
"def is_no_level?(levels)\n levels = Access::Validate.levels(levels)\n level = highest(levels)\n level.nil?\n end",
"def error?\n level >= ASL_LEVEL_ERR\n end",
"def fatal(m)\n log_handler.fatal msg(m)\n end",
"def quiet?\n config.quiet\n end",
"def fatal(str)\n @stdout_log.fatal(str) if @vars[:log_stdout]\n @log.fatal(str)\n send_mail(str) if @vars[:log_send_mail]\n end",
"def fatal(msg)\r\n prelog\r\n logger.fatal(msg)\r\n end",
"def filter_logging_level level\n level.downcase!\n case level\n when 'fatal'\n Logger::FATAL\n when 'error'\n Logger::ERROR\n when 'warn'\n Logger::WARN\n when 'debug'\n Logger::DEBUG\n when 'info'\n Logger::INFO\n when 'unknown'\n Logger::UNKNOWN\n else\n raise RuntimeError, \"Error: Unknown logging level #{level} in config file.\"\n end\n end",
"def fatal(msg)\n log.fatal msg\n end",
"def warning?\n messages && messages.length > 0\n end",
"def warn?\n level <= WARN\n end",
"def strict?\n compliance_level == STRICT\n end",
"def silence_mode?\n @output_level == :silence\n end",
"def info?\n @level <= 1\n end",
"def debug?\n severity == :DEBUG\n end",
"def fatal(msg = nil)\n if block_given?\n add(FATAL, msg) { yield }\n else\n add(FATAL, msg)\n end\n end",
"def warnings?\n @warning_count > 0\n end",
"def warning?\n false\n end",
"def logging_enabled?\n !!logging_enabled\n end",
"def fatal_error_state?(sym); @fatal_states.include?(sym) end",
"def warnings?\n !warnings.empty?\n end",
"def error?\n level == 2\n end",
"def severity\n @severity || SEVERITY_LEVELS.first\n end",
"def self_log?\n @status.exitstatus & (1 << 7) != 0\n end",
"def any?\n messages.count.positive?\n end",
"def suppressed? heading\n return false unless @omit_headings_below\n\n heading.level > @omit_headings_below\n end"
] | [
"0.77756155",
"0.7150207",
"0.7125422",
"0.69832444",
"0.6974065",
"0.6700929",
"0.6686336",
"0.64078915",
"0.6388756",
"0.6341685",
"0.6206407",
"0.6029912",
"0.60012996",
"0.59957343",
"0.589634",
"0.58779365",
"0.58617437",
"0.58332825",
"0.5798257",
"0.5685233",
"0.5669042",
"0.5598002",
"0.55601186",
"0.5531016",
"0.55176544",
"0.5424813",
"0.5390848",
"0.53795844",
"0.5368754",
"0.53656524",
"0.5349653",
"0.53392917",
"0.53387696",
"0.53094625",
"0.5283149",
"0.52825224",
"0.5266261",
"0.5221239",
"0.5184049",
"0.51518434",
"0.51208085",
"0.51208085",
"0.50885624",
"0.5086085",
"0.5069022",
"0.50546473",
"0.5048124",
"0.50447875",
"0.5044126",
"0.50309205",
"0.50089353",
"0.49871117",
"0.4981459",
"0.4976888",
"0.49756625",
"0.49685508",
"0.49201035",
"0.4911105",
"0.4911105",
"0.49084944",
"0.4901111",
"0.4898184",
"0.48979136",
"0.48905784",
"0.48905498",
"0.4887603",
"0.48785305",
"0.48433876",
"0.48227897",
"0.4816946",
"0.48103464",
"0.48102576",
"0.48063534",
"0.4803731",
"0.47682962",
"0.475658",
"0.47372302",
"0.47328693",
"0.47321844",
"0.47321555",
"0.4722889",
"0.4721564",
"0.47192082",
"0.4715412",
"0.47075692",
"0.4697798",
"0.46894988",
"0.4683418",
"0.46794802",
"0.46717307",
"0.46671435",
"0.46668798",
"0.46667257",
"0.46611872",
"0.46563223",
"0.46516675",
"0.46376124",
"0.46375605",
"0.4631943"
] | 0.66925335 | 7 |
=== Synopsis Logger.new(name) Logger.new(name) === Args +logdev+:: The log device. This is a filename (String) or IO object (typically +STDOUT+, +STDERR+, or an open file). === Description Create an instance. | def initialize(logdev)
@progname = nil
@level = DEBUG
@default_formatter = Formatter.new
@formatter = nil
@logdev = nil
if logdev
@logdev = LogDevice.new(logdev)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_logger(name, logdev, loglvl)\n logdev = [ global_logdev(name), logdev, $stderr ].find { |e| e }\n loglvl = [ global_loglvl(name), loglvl, Logger::INFO ].find { |e| e }\n logger = Logger.new(logdev)\n logger.level = loglvl\n logger.formatter = proc { |sev, datetime, progname, msg|\n \"#{name}: #{msg}\\n\"\n }\n children[name] = { logdev: logdev, loglvl: loglvl }\n logger\n end",
"def create(name = nil)\n logger_name = name || caller(1..1).first[/`(.+)'/, 1]\n Logger.new(logger_name)\n end",
"def initialize(logdev, shift_age=0, shift_size=1048576)\n @log = (logdev.kind_of?(::Logger) ? logdev : ::Logger.new(logdev, shift_age, shift_size))\n @name = nil\n end",
"def open(dev=nil, opts=nil)\n if open? then\n raise RuntimeError.new(\"The logger has already opened the log#{' file ' + @dev if String === @dev}\")\n end\n dev, opts = nil, dev if Hash === dev\n dev ||= default_log_file(Options.get(:app, opts)) \n FileUtils.mkdir_p(File.dirname(dev)) if String === dev\n # default is 4-file rotation @ 16MB each\n shift_age = Options.get(:shift_age, opts, 4)\n shift_size = Options.get(:shift_size, opts, 16 * 1048576)\n @logger = MultilineLogger.new(dev, shift_age, shift_size)\n @logger.level = Options.get(:debug, opts) ? Logger::DEBUG : Logger::INFO\n @logger.formatter = lambda do |severity, time, progname, msg|\n FORMAT % [\n progname || 'I',\n DateTime.now.strftime(\"%d/%b/%Y %H:%M:%S\"),\n severity,\n msg]\n end\n @dev = dev\n @logger\n end",
"def initialize(logdev, shift_age=0, shift_size=0)\n @default_shift_age = shift_age\n @default_shift_size = shift_size\n target = ::Logger.new(logdev, shift_age, shift_size)\n target.formatter = DEFAULT_FORMATTER\n @targets = [target]\n end",
"def new_instance_logger(suite, platform, index)\n name = instance_name(suite, platform)\n log_location = File.join(log_root, \"#{name}.log\").to_s\n Logger.new(\n stdout: STDOUT,\n color: Color::COLORS[index % Color::COLORS.size].to_sym,\n logdev: log_location,\n level: Util.to_logger_level(log_level),\n log_overwrite: log_overwrite,\n progname: name,\n colorize: @colorize\n )\n end",
"def initialize(logdev, opts = {})\n @level = opts[:level] || DEBUG\n @progname = opts[:progname]\n @default_formatter = Formatter.new\n @datetime_format = opts[:datetime_format]\n @formatter = opts[:formatter]\n @logdev = logdev ? LogDevice.new(logdev) : nil\n end",
"def set_log(logdev, shift_age = 0, shift_size = 1024000)\n @log = Logger.new(logdev, shift_age, shift_size)\n @log.progname = @appname\n @log.level = @level\n end",
"def logger(name = self.class.name)\n Logger.new(name)\n end",
"def initialize(log_dir = VidazingLogger::LOG_DIR, name:)\n @name = name\n @log_dir = log_dir\n\n create_log_dir\n end",
"def logger log_name, resource, labels = {}\n Logger.new self, log_name, resource, labels\n end",
"def create(name, level = ::Logger::INFO)\n dir = \"#{Bitcoin.base_dir}/log\"\n FileUtils.mkdir_p(dir)\n logger = ::Logger.new(dir + \"/#{name}.log\", 10)\n logger.level = level\n logger.formatter = proc do |severity, datetime, progname, msg|\n Format % [severity[0..0], format_datetime(datetime), $$,\n Thread.current.object_id, severity, progname, msg2str(msg)]\n end\n logger\n end",
"def initialize(appname = nil)\n @appname = appname\n @log = Logger.new(STDERR)\n @log.progname = @appname\n @level = @log.level\n end",
"def named(name)\n new_name = self.progname.to_s.dup\n new_name << \".\" unless new_name.empty?\n new_name << name\n new_logger = Logger.new(*@base_args)\n [:level, :formatter, :datetime_format].each do |m|\n new_logger.send(\"#{m}=\", self.send(m))\n end\n new_logger.progname = new_name\n new_logger\n end",
"def logdev_logger(filepath_or_logdev)\n Omnitest::Core::LogdevLogger.new(resolve_logdev(filepath_or_logdev))\n end",
"def new_logger(path)\n if path.is_a? String\n FileUtils.touch path # prevent autocreate messages in log\n Logger.new path\n elsif path.is_a? Array\n log_file, logs_files_to_keep, log_files_max_size, * = path\n FileUtils.touch log_file # prevent autocreate messages in log\n Logger.new(log_file, logs_files_to_keep, log_files_max_size)\n end\n end",
"def configure_logger_for(name)\n logger = Logger.new(@logdev, @shift_age, @shift_size)\n logger.level = @level\n logger.progname = name\n logger.formatter = formatter\n logger\n end",
"def create_logger\n l = self['logger']\n\n if l == true or l.nil?\n ::Logger.new(production? ? project_path('production.log') : STDOUT)\n elsif l.is_a?(Class)\n l.new(production? ? project_path('production.log') : STDOUT)\n elsif l.is_a?(Proc)\n l.call\n elsif l\n raise 'bad logger configure, should be: `true` / `false` / Class / Proc'\n end\n end",
"def create_logger(conf)\n name = self.class.to_s\n @logger = Patriot::Util::Logger::Factory.create_logger(name, conf)\n end",
"def initialize device = STDOUT, level = INFO\n self.level = level\n @logformat = '%d{%Y-%m-%d %H:%M:%S}%t%L%t%m %s %e'\n @placeholder = {\n 'n' => \"\\n\",\n 'p' => $$,\n 't' => \"\\t\",\n 'x' => File.basename($0),\n 'X' => File.expand_path($0)\n }\n\n @filename = nil\n if device.kind_of? IO then\n raise \"log destination already closed #{ device }\" if device.closed?\n @device = device\n @fileformat = nil\n else\n @device = nil\n @fileformat = device.to_s\n reopen\n end\n\n @sign = @mark = false\n end",
"def new\n @log = Log.new\n end",
"def initialize(log_dev, log_prefix = '[onesnooper-server]')\n if log_dev.kind_of? ::Logger\n @logger = log_dev\n else\n @logger = ::Logger.new(log_dev)\n end\n\n @log_prefix = log_prefix.blank? ? '' : log_prefix.strip\n\n # subscribe to log messages and send to logger\n @log_subscriber = ActiveSupport::Notifications.subscribe(self.class::SUBSCRIPTION_HANDLE) do |name, start, finish, id, payload|\n @logger.log(payload[:level], \"#{@log_prefix} #{payload[:message]}\") if @logger\n end\n end",
"def initialize_logger\n return if @logger.blank?\n log = @logger\n log = log.to_s if log.is_a?(Pathname)\n if log.is_a?(String)\n log = File.join(TMP_ROOT_DIR, log) unless log.start_with?('/')\n @logger =\n Logger.new(log).tap { |l| l.level = Logger.const_get(@log_level) }\n end\n unless @logger.is_a?(Logger)\n raise \"expected String, got #{log.class} #{log.inspect}\"\n end\n end",
"def create_logger path\n #path = File.join(ENV[\"LOGDIR\"] || \"./\" ,\"canis14.log\")\n _path = File.open(path, File::WRONLY|File::TRUNC|File::CREAT) \n logg = Logger.new(_path)\n raise \"Could not create logger: #{path}\" unless logg\n # if not set, will default to 0 which is debug. Other values are 1 - info, 2 - warn\n logg.level = ENV[\"CANIS_LOG_LEVEL\"].to_i\n colors = Ncurses.COLORS\n logg.info \"START #{colors} colors -- #{$0} win: #{@window} : log level: #{logg.level}. To change log level, increase CANIS_LOG_LEVEL in your environment to 1 or 2 or 3.\"\n return logg\n end",
"def logger_for(name)\n loggers[name] ||= DefaultLogger.new(name, level)\n end",
"def with_prefix (string)\n Logger.send(:new, string)\n end",
"def build_logger\n path = Hanami.root.join(\"log\", [\"emergency_log.\", Hanami.env].join)\n Logger.new(path)\n end",
"def initialize_log(log)\n close if @log # be sure that we don't leave open files laying around.\n\n if log.respond_to?(:write)\n @log = log\n elsif File.exist?(log)\n @log = open(log, (File::WRONLY | File::APPEND))\n @log.sync = true\n else\n FileUtils.mkdir_p(File.dirname(log)) unless File.directory?(File.dirname(log))\n @log = open(log, (File::WRONLY | File::APPEND | File::CREAT))\n @log.sync = true\n @log.write(\"#{Time.now.httpdate} #{delimiter} info #{delimiter} Logfile created\\n\")\n end\n end",
"def initialize_log(log_target = STDOUT)\n oldlogger ||= nil\n @logger = Logger.new(log_target)\n @logger.level = Logger::INFO\n oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging\n @logger\n end",
"def set clazz, *args\n @logger = clazz.send(:new, *args)\n end",
"def initialize(program_name = 'rails')\n @level = Logger::DEBUG\n\n return if defined? SYSLOG\n self.class.const_set :SYSLOG, Syslog.open(program_name)\n end",
"def initialize(filename, level, rotation=10, max_size=1024000)\n # create the directory for the log if it doesn't exist\n if !File.exist? File.dirname(filename)\n FileUtils.mkdir_p File.dirname(filename)\n end\n\n @log ||= Logger.new(filename, rotation, max_size)\n @log.level = level\n @log\n end",
"def initialize\n @logger = Logger.new('cf_flattener.log')\n end",
"def logger\n Logger.new(files[:logfile], 10, 1024000)\n end",
"def create_logger\n raise \"You should create your own `create_logger` method\"\n end",
"def create_logger\n raise \"You should create your own `create_logger` method\"\n end",
"def initialize(logdevs = {}, progname = nil, shift_age = 0, shift_size = 1_048_576)\n super(nil, shift_age, shift_size)\n @progname = progname\n @shift_age = shift_age\n @shift_size = shift_size\n @lowest_level = DEFAULT_LEVEL\n configure_logs(logdevs)\n end",
"def setup_logger(log_name)\n date = Time.new.localtime.strftime('%F %H.%M.%S%L')\n logger = Logger.new(\"#{$VALUE}/test_logs/#{log_name}_#{date}.log\")\n logger.formatter = proc do |severity, datetime, _progname, msg|\n date_format = datetime.strftime('%Y-%m-%d %H:%M:%S%L')\n if (severity == 'INFO') || (severity == 'WARN')\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n else\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n end\n end\n logger\nend",
"def initialize(name)\n @name = name.is_a?(Module) ? SLF4J.to_log_name(name) : name\n @logger = org.slf4j.LoggerFactory.getLogger(@name)\n @level = ::Logger::Severity::INFO\n end",
"def initialize(*, verbose: '1', log_file: STDERR, **)\n v = (verbose =~ /\\d+/) ? verbose.to_i : verbose.to_sym\n self.logger = Logger.new(log_file, v)\n end",
"def logger\n return @local_logger if @local_logger\n FileUtils.mkdir_p(File.dirname(log_path)) unless File.exists?(File.dirname(log_path))\n\n if API_KEYS[\"logentries\"]\n token = API_KEYS[\"logentries\"][Rails.env][\"nsc\"]\n @local_logger = Le.new(token, :debug => false, :local => log_path, :ssl => true, :tag => true)\n else\n @local_logger = Logger.new(log_path)\n end\n @local_logger\n end",
"def initialize(tag_suffix = nil)\n return if defined? SYSLOG\n\n if tag_suffix.nil?\n if defined?(Rails)\n tag_suffix = 'rails'\n else\n tag_suffix = 'logger'\n end\n end\n\n @level = PsdLogger::INFO\n self.class.const_set :SYSLOG, Syslog.open(\"psd_#{tag_suffix}\")\n self.debug(\"PsdLogger.initialize()\")\n end",
"def initialize(name, cloud, &block)\n super()\n raise StandardError, \"Node name cannot contain spaces: #{name}\" if name.is_a?(String) && !name.index(/\\s/).nil?\n @name = name\n @cloud = cloud\n @logger = Log4r::Logger.new(Regexp::quote(@name.to_s))\n outputter = Log4r::StdoutOutputter.new(\"#{@name.to_s}-stdout\")\n outputter.formatter = ConsoleFormatter.new\n @logger.add(outputter)\n init_logs\n instance_eval(&block) if block_given?\n end",
"def initialize\n @log = Logging::Logger[self]\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end",
"def configure_logger_for(classname)\n # handle case in which log path does not exists\n begin\n logger = Logger.new(@log_path)\n rescue Errno::ENOENT\n FileUtils.mkdir_p File.dirname @log_path\n retry\n end\n\n logger.progname = classname\n logger.level = @level\n logger.formatter = proc { |severity, datetime, progname, msg|\n case severity\n when 'DEBUG'\n spaciator = \" *\"\n after_space = \"\"\n when 'INFO'\n spaciator = \" **\"\n after_space = \" \"\n when 'WARN'\n spaciator = \" ***\"\n after_space = \" \"\n when 'ERROR'\n spaciator = \" ****\"\n after_space = \"\"\n when 'FATAL'\n spaciator = \"*****\"\n after_space = \"\"\n else\n spaciator = \" \"\n after_space = \"\"\n end\n\n formatted_output = \" #{spaciator} [#{severity}]#{after_space} [#{datetime}] -- #{msg} { #{progname} }\\n\"\n formatted_output\n }\n logger\n end",
"def initialize( name, *args )\n case name\n when String\n raise(ArgumentError, \"logger must have a name\") if name.empty?\n else raise(ArgumentError, \"logger name must be a String\") end\n\n repo = ::Logging::Repository.instance\n opts = args.last.instance_of?(Hash) ? args.pop : {}\n _setup(name, opts.merge({:parent => repo.parent(name)}))\n end",
"def initialize\n @logProvider = DefaultLogger.new\n end",
"def initialize(out = STDOUT, progname = '')\n @logger = Logger.new(out, progname: progname)\n @@LAST_TIME = Time.current\n @logger.formatter = proc do |severity, _datetime, progname, msg|\n severity = \"\\e[31mWARN\\e[0m\" if severity == 'WARN'\n severity = \"\\e[31mERROR\\e[0m\" if severity == 'ERROR'\n t = Time.current.strftime(\"%Y-%m-%d %T\")\n preamble = '%-40s' % \"[#{severity} #{t} #{progname}]\"\n \"#{preamble} #{msg}\\n\"\n end\n @warning_dir = './tmp/vhp-build-warnings'\n end",
"def logger\n dir = File.dirname(\"#{Rails.root}/log/#{self.id}/game.log\")\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n @logger ||= Logger.new(\"#{Rails.root}/log/#{self.id}/game.log\")\n end",
"def log_create(p_args)\n Logging::create_log(p_args)\n end",
"def log_file_creation()\n\tcurrent_path = File.dirname(File.realpath(__FILE__))\n\t$csv_path = \"#{current_path}/Attachments.csv\"\n\tif !File.directory?(\"#{current_path}/logs\")\n\t\tFileUtils.mkdir_p \"#{current_path}/logs\"\n\tend\n\t$log_path = \"#{current_path}/logs/jira-attachment-upload.txt\"\n\t$log = Logger.new(\"#{current_path}/logs/jira-attachment-upload.txt\", 'daily')\nend",
"def initialize\n @logger = Logging::Logger[self]\n end",
"def logger(logger_name = :default)\n # Coerce the logger_name if needed.\n logger_name = ::Af::Application.singleton.af_name if logger_name == :default\n # Check with Log4r to see if there is a logger by this name.\n # If Log4r doesn't have a logger by this name, make one with Af defaults.\n return Log4r::Logger[logger_name] || Log4r::Logger.new(logger_name)\n end",
"def initialize( logger, format=DEFAULT_FORMAT, debug=DEFAULT_DEBUG_FORMAT ) # :notnew:\n\t\t\t@logger = logger\n\t\t\t@format = format\n\t\t\t@debug_format = debug\n\n\t\t\tsuper()\n\t\tend",
"def initialize(name:)\n # Create a logger before any appenders\n # Avoids a situation where Filters::Normal levels are nil\n #\n # Logging::Filters::Level.new bug:\n # @filter has nil levels set on the first invocation\n @logger = Logging.logger[name]\n end",
"def logger( name )\n return default_logger if name.nil?\n @hash.fetch(name, default_logger)\n end",
"def make_log_entry\n le = LogEntry.new(:description => \"Desc ##{sn}\")\n le end",
"def initialize_logger(logging_directory, log_file_name, logging_level)\n logger = Logger.new(\"#{logging_directory}/#{log_file_name}\", 100, 1048576) # Keep last 100 log files, rotating them when they reach 1MB in size.\n logger.level = filter_logging_level logging_level\n # Suppress the default logging chatter.\n logger.formatter = proc do |severity, datetime, progname, msg|\n \"#{msg}\\n\"\n end\n\n logger\n end",
"def create_logger(outputter=STDOUT, level=Logger::INFO)\n LOGGER.set_logger(Logger.new(outputter, level))\n end",
"def logger\n\t\t\tunless CLILogging.class_variable_defined?(:@@logger)\n\t\t\t\t@@logger = CLILogger.new\n\t\t\t\t@@logger.progname=$0\n\t\t\tend\n\t\t\t@@logger\n\t\tend",
"def logger\n\t\t\tunless CLILogging.class_variable_defined?(:@@logger)\n\t\t\t\t@@logger = CLILogger.new\n\t\t\t\t@@logger.progname=$0\n\t\t\tend\n\t\t\t@@logger\n\t\tend",
"def make_own_logger(new_progname = nil, new_level = nil)\n new_logger = @logger || self.logger.dup\n if new_progname\n new_logger.progname = new_progname\n end\n if new_level\n new_logger.level = new_level\n end\n self.logger = new_logger\n end",
"def new\n @log_entry = LogEntry.new\n end",
"def create_logfile(filename)\n begin\n logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))\n logdev.flock(File::LOCK_EX)\n logdev.sync = true\n add_log_header(logdev)\n logdev.flock(File::LOCK_UN)\n rescue Errno::EEXIST\n # file is created by another process\n logdev = open_logfile(filename)\n logdev.sync = true\n end\n logdev\n end",
"def open(log, options = {})\n Log.open(log, options)\n end",
"def __prep_logger__(name, logger = nil)\n if name.is_a?(String) && ! logger.nil?\n [name, logger.class <= Logger ? logger : Logger.new(logger)]\n elsif name.class <= Logger && logger.nil?\n [name, name]\n else\n [name, Logger.new(name)]\n end\n end",
"def init_logger \n if not Object.const_defined?(get_rails_default_logger_name)\n Logger.new(STDOUT)\n else\n eval(get_rails_default_logger_name)\n end \n end",
"def initialize(options = {})\n color = options[:color]\n\n @loggers = []\n @loggers << @logdev = logdev_logger(options[:logdev]) if options[:logdev]\n @loggers << stdout_logger(options[:stdout], color) if options[:stdout]\n @loggers << stdout_logger($stdout, color) if @loggers.empty?\n\n self.progname = options[:progname] || 'Omnitest'\n self.level = options[:level] || default_log_level\n end",
"def setupLog(fileName)\n\t# Setting up logging feature\n\tlogFile = File.open(fileName, 'w')\n\tlog = Logger.new(logFile)\n\tlog.formatter = proc do |severity, datetime, progname, msg|\n\t Time.now.asctime + \":: #{msg}\\n\"\n\tend\n\treturn log\nend",
"def initialize(*io_devices_and_loggers)\n if io_devices_and_loggers.size == 0\n raise ArgumentError.new(\"At least one IO device or Logger must be provided when \" +\n \"instantiating a Timber::Logger. Ex: Timber::Logger.new(STDOUT).\")\n end\n\n @extra_loggers = io_devices_and_loggers[1..-1].collect do |obj|\n if is_a_logger?(obj)\n obj\n else\n self.class.new(obj)\n end\n end\n\n io_device = io_devices_and_loggers[0]\n\n super(io_device)\n\n # Ensure we sync STDOUT to avoid buffering\n if io_device.respond_to?(:\"sync=\")\n io_device.sync = true\n end\n\n # Set the default formatter. The formatter cannot be set during\n # initialization, and can be changed with #formatter=.\n if io_device.is_a?(LogDevices::HTTP)\n self.formatter = PassThroughFormatter.new\n elsif Config.instance.development? || Config.instance.test?\n self.formatter = MessageOnlyFormatter.new\n else\n self.formatter = JSONFormatter.new\n end\n\n self.level = environment_level\n\n Timber::Config.instance.debug { \"Timber::Logger instantiated, level: #{level}, formatter: #{formatter.class}\" }\n\n @initialized = true\n end",
"def initialize(logger = T.unsafe(nil)); end",
"def add_log(name, destination, level, shift_age = 0, shift_size = 1_048_576)\n dev = LogDevice.new(destination, :shift_age => shift_age, :shift_size => shift_size)\n\n @logdevs[name] = {dev: dev, level: level}\n @lowest_level = level if !@lowest_level || level < @lowest_level\n end",
"def setup_log(type=:memory)\n case type\n when :memory\n @log_content = StringIO.new\n @logger = Logger.new(@log_content)\n else\n unless defined?(@@log_file_base_name)\n @@log_file_base_name = File.normalize_path(File.join(Dir.tmpdir, \"#{File.basename(__FILE__, '.rb')}_#{Time.now.strftime(\"%Y-%m-%d-%H%M%S\")}\"))\n @@log_file_index = 0\n end\n @@log_file_index += 1\n @log_file_name = \"#{@@log_file_base_name}_#{@@log_file_index}.log\"\n @log_file = File.open(@log_file_name, 'w')\n @logger = Logger.new(@log_file)\n end\n\n @logger.level = is_debug? ? Logger::DEBUG : Logger::INFO\n return @logger\n end",
"def logger\n @_logger ||= ::Logger.new(log_file)\n end",
"def add_logger(arg)\n key = nil\n logger = nil\n io = nil\n if arg.is_a? String\n # We have a filename\n key = File.basename(arg)\n\n # Try to create the logger.\n io = File.new(arg, File::WRONLY | File::APPEND | File::CREAT)\n logger = Logger.new(io)\n\n # Initialize logger\n io.write \"Logging to '#{arg}' initialized with level #{string_level(@default_level)}.\\n\"\n logger.level = convert_level(@default_level)\n else\n # We have some other object - let's hope it's an IO object\n key = nil\n case arg\n when STDOUT\n key = 'STDOUT'\n when STDERR\n key = 'STDERR'\n else\n key = arg.to_s\n end\n\n # Try to create the logger.\n io = arg\n logger = Logger.new(io)\n\n # Initialize logger\n io.write \"Logging to #{key} initialized with level #{string_level(@default_level)}.\\n\"\n logger.level = convert_level(@default_level)\n end\n\n # Set the logger formatter\n logger.formatter = @formatter\n\n # Extend logger instances with extra functionality\n logger.extend(::TeeLogger::LoggerExtensions)\n logger.teelogger_io = io\n logger.flush_interval = DEFAULT_FLUSH_INTERVAL\n\n # Flush the \"Logging to...\" line\n logger.flush\n\n if not key.nil? and not logger.nil? and not io.nil?\n @loggers[key] = logger\n @ios[key] = io\n end\n end",
"def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end",
"def define_logger(logger)\n return logger if logger.kind_of?(Logger)\n\n Logger.new(logger)\n end",
"def new_file(filename = nil)\n\t name = filename || \"#{basename}.#{@io.size}.log\"\n\t io = File.new(name, 'w')\n\t Logfiles.write_prologue(io)\n\t @io << io\n\t streams.each_with_index do |s, i|\n\t\twrite_stream_declaration(i, s.name, s.type.name, registry.to_xml)\n\t end\n\tend",
"def configure_logs(logdevs = {})\n # Remove all exsiting logs\n @logdevs.each { |name, ld| remove_log(name) } if @logdevs\n\n # Parse logdevs hash options\n @logdevs = {}\n logdevs = [logdevs] if logdevs.is_a? Hash\n\n # If the user provides a device then set up a single log as :log\n unless logdevs.is_a? Array\n @logdevs[:default] = {dev: logdevs, level: DEFAULT_LEVEL}\n @lowest_level = @logdevs[:default][:level]\n return\n end\n\n # If the user provides a hash, check each arg\n logdevs.each do |ld|\n name = ld[:name] ||= :default\n dev = ld[:dev] ||= $stdout\n level = ld[:level] ||= DEFAULT_LEVEL\n shift_age = ld[:shift_age] ||= @shift_age\n shift_size = ld[:shift_size] ||= @shift_size\n level = MultiLog.string_to_level(level) unless level.is_a? Fixnum\n\n # Add to the name deely.\n add_log(name, dev, level, shift_age, shift_size)\n end\n end",
"def logger\n @logger ||= Logger.new(@log_file_name)\n\n @logger.formatter = proc do |severity, datetime, progname, msg|\n \"%s, [%s #%d] (%s) %5s -- %s: %s\\n\" % [severity[0..0], datetime, $$, Conf.global_conf[:hostname], severity, progname, msg]\n end\n\n if Conf.global_conf[:debug]\n @logger.level = Logger::DEBUG\n else\n @logger.level = Logger::INFO\n end\n @logger\n end",
"def initialize(*logger_args)\n if logger_args.empty?\n logger_args = [$stderr]\n end\n @base_args = logger_args\n @logger = ::Logger.new(*@base_args)\n @logger.level = :fatal\n @lock = Mutex.new\n end",
"def logger(filename = nil)\n logger = Logger.new(filename || STDOUT)\n logger.level = verbose? ? Logger::DEBUG : Logger::INFO\n logger.formatter = proc do |severity, datetime, _prog_name, msg|\n time_s = severity == 'DEBUG' ? LOG_SPACE : datetime.strftime(LOG_TIME)\n \"#{time_s}#{msg}\"\n end\n logger\n end",
"def initialize(log_level = 'debug')\n @logger = Logger.new(STDOUT, level: log_level)\n end",
"def devlog\n @@devlog ||= Logger.new(Rails.root.join(\"log/alipay-customers-webhook-#{Time.now.strftime('%Y-%m-%d')}.log\"))\n end",
"def logger\n classname = self.class.name\n methodname = caller[0][/`([^']*)'/, 1]\n\n @_logger ||= ProjectHanlon::Logging.logger_for(classname, methodname)\n @_logger.progname = \"#{caller[0]}>>#{classname}\\##{methodname}\"\n @_logger\n end",
"def initialize(options={})\n @root = File.expand_path('../../../../../', __FILE__)\n \n if @log.nil?\n # @logdir = @root + \"/log/worker\"\n # FileUtils.mkdir_p @logdir\n # @logfile = @logdir + \"/#{self.class.to_s.downcase}.log\"\n # FileUtils.touch @logfile\n \n @log = Logger.new(STDOUT) #MultiDelegator.delegate(:write, :close).to(STDOUT, File.open(@logfile,'a'))\n @log.level = Logger::WARN # TODO Only log if development environment\n \n @log.formatter = proc do |severity, datetime, progname, msg|\n \"[#{severity}] - #{datetime}: #{msg}\\n\"\n end\n \n @log.info(\"Started logging in: #{@logfile}\")\n end\n \n return self\n end",
"def initialize(res, logfile = nil)\n raise RuntimeError, 'Output objects are nil' if res.nil?\n @logfile = File.new(logfile, 'a') unless logfile.nil?\n @responses = [res]\n @m = Mutex.new\n self.write('BuilderLogDevice is initialized')\n end",
"def newlog(name, accesscode, status)\n @log = Log.new\n @log.name = name\n @log.accesscode = accesscode\n @log.status = status\n @log.gid = Guest.where(:name => name).first.try(:id)\n @log.save\n end",
"def new(name)\n ARGV.shift\n #@log.debug \"command 'new' with arguments: #{ARGV.join(', ')}\"\n Generator::Application.start ARGV\n end",
"def initLogger(debugOn = false)\r\n\t$logger = Logger.new(STDOUT)\r\n\tif debugOn\r\n\t\t$logger.level = Logger::DEBUG\r\n\telse\r\n\t\t$logger.level = Logger::INFO\r\n\tend\r\n\treturn $logger\r\nend",
"def initialize(log)\n @log = log\n end",
"def logfile=(dev)\n @logfile = dev\n @logger = nil\n end",
"def create_logfile\n LibLog.create_logfile(ClientConfig::LOGGING,\n ClientConfig::LOG_LOCATION,\n ClientConfig::LOG_FILENAME)\n end",
"def create_logger(job_id)\n log_file_path = File.join(JOB_LOG_DIR, \"job_#{job_id}.log\")\n logger = Logger.new(log_file_path)\n logger.formatter = proc do |severity, datetime, progname, msg|\n \"#{datetime.strftime(\"%Y-%m-%d %H:%M:%S\")} : #{severity} : #{msg}\\n\"\n end\n return logger\n end",
"def initialize( name, opts = {} )\n ::Logging.init unless ::Logging.initialized?\n\n @name = name.to_s\n @closed = false\n @filters = []\n @mutex = ReentrantMutex.new\n\n self.layout = opts.fetch(:layout, ::Logging::Layouts::Basic.new)\n self.level = opts.fetch(:level, nil)\n self.encoding = opts.fetch(:encoding, self.encoding)\n self.filters = opts.fetch(:filters, nil)\n\n if opts.fetch(:header, true)\n header = @layout.header\n\n unless header.nil? || header.empty?\n begin\n write(header)\n rescue StandardError => err\n ::Logging.log_internal_error(err)\n end\n end\n end\n\n ::Logging::Appenders[@name] = self\n end",
"def initialize(options={})\n @options = options.dup\n\n Logger.set(*@options[:log_to])\n end",
"def initialize( logger, format=HTML_LOG_FORMAT ) # :notnew:\n\t\t\t@logger = logger\n\t\t\t@format = format\n\t\t\tsuper()\n\t\tend"
] | [
"0.7649776",
"0.73470795",
"0.7044453",
"0.6760448",
"0.6678281",
"0.66355383",
"0.6634606",
"0.64760494",
"0.645018",
"0.6426587",
"0.64182603",
"0.6361228",
"0.6234812",
"0.6170884",
"0.6144222",
"0.613529",
"0.6068744",
"0.6063894",
"0.60565615",
"0.59112936",
"0.58935755",
"0.58244556",
"0.5806447",
"0.5797371",
"0.57737684",
"0.5766136",
"0.5743468",
"0.5727988",
"0.57194215",
"0.5709031",
"0.5701787",
"0.5687708",
"0.567146",
"0.5671363",
"0.5633285",
"0.5633285",
"0.56328297",
"0.56307524",
"0.5629419",
"0.5606319",
"0.5594863",
"0.5581457",
"0.5567153",
"0.55289006",
"0.5527346",
"0.5527346",
"0.5527346",
"0.5519433",
"0.550913",
"0.54830164",
"0.54760534",
"0.546944",
"0.5466184",
"0.54619634",
"0.54444325",
"0.5442999",
"0.54361117",
"0.5434901",
"0.5426201",
"0.540647",
"0.5399441",
"0.5390465",
"0.53754544",
"0.53754544",
"0.5364643",
"0.53567594",
"0.5354237",
"0.5353526",
"0.5346884",
"0.534616",
"0.5326152",
"0.5321651",
"0.5320172",
"0.53181815",
"0.53155696",
"0.52991384",
"0.5282443",
"0.5277553",
"0.5268048",
"0.5268048",
"0.5260575",
"0.5259033",
"0.5243178",
"0.5229955",
"0.5218223",
"0.52111167",
"0.52058095",
"0.5203985",
"0.51927894",
"0.5192685",
"0.5190704",
"0.5187168",
"0.51856464",
"0.5183123",
"0.51703906",
"0.51680315",
"0.5162817",
"0.515444",
"0.51540875",
"0.5149987"
] | 0.721984 | 2 |
Dump given message to the log device without any formatting. If no log device exists, return +nil+. | def <<(msg)
unless @logdev.nil?
@logdev.write(msg)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(message)\n return unless debugging?\n\n logger.debug(message.to_s)\n nil\n end",
"def output(message)\n return if disabled\n if Device.simulator?\n puts(message)\n else\n NSLog(message)\n end\n message\n end",
"def debugonce(message)\n logger.debugonce(message)\n nil\n end",
"def log_capture_device\n @log_capture_device ||= STDOUT\n end",
"def warn(message)\n logger.warn(message.to_s)\n nil\n end",
"def <<(msg)\n @logdev.write(msg) if @logdev\n end",
"def log(message, level)\n if SEVERITY[@log_level] <= SEVERITY[level]\n message = \"#{level}: #{message}\"\n if @output==:file\n File.open('debug.log', 'ab') {|f| f.puts message }\n elsif @output==:stdout\n puts message\n end\n return message \n end\n return nil\n end",
"def log_debug(message)\n return message\n end",
"def debug(message)\n logger.debug(message) if logger\n end",
"def write( event )\n pri = SyslogProtocol::SEVERITIES['debug']\n message = if event.instance_of?(::Logging::LogEvent)\n pri = @map[event.level]\n @layout.format(event)\n else\n event.to_s\n end\n return if message.empty?\n\n udp_sender = RemoteSyslogLogger::UdpSender.new(\n @syslog_server,\n @port,\n :facility => @facility,\n :severity => pri,\n :program => @ident\n )\n\n udp_sender.write(prepare_message(message))\n\n self\n end",
"def log_debug(message) # :nodoc:\n @logger.debug(message) if @logger\n end",
"def debug_message(message)\n logger.debug \"**** - #{message}\"\n end",
"def debug(message)\n log(0, message)\n end",
"def log(msg)\n return if logger.nil?\n logger.debug(msg)\n end",
"def log_output(color: false)\n return unless defined? @log_device\n if color\n @log_device.string\n else\n ANSI.unansi(@log_device.string)\n end\n end",
"def log(message)\n SystemdMon::Logger.puts \"#{me}: #{message}\"\n end",
"def format_log_entry(message, dump = nil)\n if Rails.application.config.colorize_logging\n if @@row_even\n @@row_even = false\n message_color, dump_color = \"4;36;1\", \"0;1\"\n else\n @@row_even = true\n message_color, dump_color = \"4;35;1\", \"0\"\n end\n\n log_entry = \" \\e[#{message_color}m#{message}\\e[0m \"\n log_entry << \"\\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\\e[0m\" % dump if dump\n log_entry\n else\n \"%s %s\" % [message, dump]\n end\n end",
"def debug_message message\n if @quiet\n # noop\n \":\"\n else\n \">&2 echo #{DEBUG_HEADER} #{message}\"\n end\n end",
"def log_this(message)\n Vedeu::Log.logger.debug(message)\n end",
"def debug(message = nil)\n log(:debug, message) unless message.nil?\n end",
"def log_message(message)\n @log.info(message) if @options[:logging_enabled]\n end",
"def log_message(message)\n @log.info(message) if @options[:logging_enabled]\n end",
"def log_message(message)\n @log.info(message) if @options[:logging_enabled]\n end",
"def log(message)\n if Typescript::Monkey.configuration.logger\n Typescript::Monkey.configuration.logger.debug(message)\n end\n end",
"def debug(message)\n logger.debug(PROG_NAME) { message }\n end",
"def message(message)\n log.info(message.to_s)\n end",
"def debug message; write DEBUG, message, caller[0] unless level > @level end",
"def write(message)\n logger.info message unless message == \"\\n\"\n end",
"def log(message)\n @collector.sending_stream.puts pack(:log, message)\n end",
"def debug(message)\n ostream.puts message if $DEBUG\n end",
"def debug(msg=nil)\n return unless msg\n (@logger ||= OMF::Base::LObject.new(self.class)).debug(msg)\n end",
"def debug msg\n if debug?\n return debug_writer.write msg if debug_writer.respond_to? :write\n return debug_writer.call(msg) if debug_writer.respond_to? :call\n raise \"No debug_writer set!\"\n end\n end",
"def write_single(log)\n nil\n end",
"def debug(msg=nil)\n return unless msg\n (@logger ||= OMF::Common::LObject.new(self.class)).debug(msg)\n end",
"def _debug_log(topic, message = nil)\r\n return unless @debug\r\n\r\n message = message.to_s\r\n topic = \"#{topic.ljust(24)}: \" unless message.empty?\r\n puts LOG_KEY + topic + message\r\n end",
"def out(message = '')\n @out_sections = [] unless defined?(@out_sections)\n message = \"#{' ' * @out_sections.size}#{message}\"\n # log_debug \"<Output> - #{message}\"\n message = \"#{message}\\n\" unless message.end_with?(\"\\n\")\n @logger << message\n end",
"def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend",
"def write(level, message)\n if Boxlet.debug?\n if message.is_a? String\n puts message\n else\n pp message\n end\n else\n if level == :info\n pp message\n end\n @log.call(level, message)\n end\n end",
"def logDebug(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.debug(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def debug(message)\n puts message if debug?\n end",
"def log(msg)\n puts(msg) if @info_values['enable_debug_logging'] == \"Yes\"\n end",
"def log_message(message)\r\n @log.log_message(message)\r\n end",
"def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end",
"def puts(msg)\n msg = msg.to_s\n @logger.unknown(msg)\n msg\n end",
"def stdout_device\n # TODO: Find a more elegant way to access the internal log device\n @logger.instance_variable_get(:@logdev).dev\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def write(message)\n @m.synchronize do\n @logfile.write(message) unless @logfile.nil?\n @responses.each{|res| res.send_event(\"build_log\", strip_control_chars(message)) }\n end\n end",
"def dump_to_logger(logger)\n messages.each { |severity, message| logger.log(severity, message) }\n messages.clear!\n end",
"def log message\n logger.info(\"[paperclip] #{message}\") if logging?\n end",
"def debug(message)\n $stdout.puts \"D #{message}\" if @debug\n end",
"def log_message(message)\n\t\tputs(message)\n\tend",
"def debug(message) ; @log.debug(message) ; end",
"def log(message)\n @@logger.debug(message) unless Rails.env.test?\n end",
"def out(msg)\n io.print(msg) if io\n end",
"def log(msg)\n @logger.write(msg) if @logger\n end",
"def log_message(message, options = {})\n app_logger.send(options.fetch(:log_method, 'debug'), message)\n end",
"def log(message)\n\t\t\t\t@shell.write_object ['log', message]\n\t\t\tend",
"def debug(msg); @logger.debug(msg); end",
"def log_debug(message)\n Rails.logger.debug message\n puts message\n end",
"def plain message\n reopen unless @filename == nil\n\n @device.print message + \"\\n\"\n end",
"def print message=nil\n log(:info, message) unless Qcmd.silent?\n end",
"def write(message_payload)\n debug_me{[ :message_payload ]}\n raise ::SmartMessage::Errors::NotImplemented\n end",
"def log(message)\n puts message\n Syslog.open('volume_testing', Syslog::LOG_PID | Syslog::LOG_CONS) { |s| s.warning message }\nend",
"def logNormal(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.normal(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def output(message)\n set_auto_output(message) if !!message === message # check for boolean\n unless message.nil?\n @state.outputs.each { |output| output.puts(message) }\n end\n message\n end",
"def log( msg, condition_for_logging, logging_method_sym = :debug )\n return unless condition_for_logging\n if defined?(logger) &&\n ( logger.instance_of?(StringLogger) || logger.respond_to?(logging_method_sym) )\n logger.send( logging_method_sym, msg.to_s )\n else\n puts( msg.to_s )\n end\n end",
"def debug_msg(msg=\"\")\n if(@config.debug)\n puts(\"Debug: #{msg}\")\n @file.puts(\"Debug: #{msg}\")\n end\n end",
"def save_to_file(message)\n # Encode message for correct Unix encoding\n message = message.force_encoding('utf-8')\n debug_path = \"#{Dir.pwd}/log\"\n Dir.mkdir(debug_path, 0o775) unless File.exist? debug_path\n filename = \"#{Time.now.strftime('%Y%m%d')}.log\"\n File.open(\"#{debug_path}/#{filename}\", 'a+') { |f| f << \"#{message}\\r\\n\" }\n end",
"def debug(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_DEBUG, message)\n end",
"def write(message = nil)\n info('MultiLogger#write') { message }\n end",
"def trace(msg=nil)\n return unless msg \n (@logger ||= OMF::Base::LObject.new(self.class)).debug(msg)\n end",
"def debug(msg)\n STDERR.puts msg if @debug\n end",
"def log(message)\n File.open(@log_file, 'a') do |file|\n file.puts message\n end\n end",
"def debug(topic, message = T.unsafe(nil), &block); end",
"def log!(message)\n log message if very_verbose\n end",
"def log!(message)\n log message if very_verbose\n end",
"def print(level, message)\n rc = Native.sd_journal_print(level, message.to_s.gsub('%', '%%'))\n raise JournalError, rc if rc < 0\n end",
"def initialize device = STDOUT, level = INFO\n self.level = level\n @logformat = '%d{%Y-%m-%d %H:%M:%S}%t%L%t%m %s %e'\n @placeholder = {\n 'n' => \"\\n\",\n 'p' => $$,\n 't' => \"\\t\",\n 'x' => File.basename($0),\n 'X' => File.expand_path($0)\n }\n\n @filename = nil\n if device.kind_of? IO then\n raise \"log destination already closed #{ device }\" if device.closed?\n @device = device\n @fileformat = nil\n else\n @device = nil\n @fileformat = device.to_s\n reopen\n end\n\n @sign = @mark = false\n end",
"def log(message, data=nil)\n if data.is_a? String\n puts \"#{message.yellow}:\\n#{data.dump.cyan}\"\n elsif data.nil?\n puts \"#{message.yellow}\"\n else\n begin\n puts \"#{message.yellow}:\\n#{JSON.pretty_generate(data).cyan}\"\n rescue\n puts \"#{message.yellow}:\\n#{data.inspect.cyan}\"\n end\n end\n puts\nend",
"def log_write(msg)\n puts msg\n end",
"def _dump(level)\n \"\"\n end",
"def _dump(level)\n \"\"\n end",
"def log(message)\n Rails.logger.info(\"FfcrmVend: #{message}\") if config.use_logger?\n end",
"def debug(message)\n if DEBUG\n log message\n end\nend",
"def dump(message)\n\t\t\t\t\tbuffer = String.new\n\t\t\t\t\t\n\t\t\t\t\tmessage.each do |key, value|\n\t\t\t\t\t\t# Conversions required by NOTIFY_SOCKET specifications:\n\t\t\t\t\t\tif value == true\n\t\t\t\t\t\t\tvalue = 1\n\t\t\t\t\t\telsif value == false\n\t\t\t\t\t\t\tvalue = 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\tbuffer << \"#{key.to_s.upcase}=#{value}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn buffer\n\t\t\t\tend",
"def log(message)\n warn \"dm-visualizer: #{message}\"\n end",
"def log\n @log || MPDClient.log\n end",
"def log(msg)\n if ENV['LAUNCHY_DEBUG'] == 'true' then\n $stderr.puts \"LAUNCHY_DEBUG: #{msg}\"\n end\n end",
"def write( message )\n\t\t\tApache.request.server.log_debug( message )\n\t\tend",
"def write(severity, message)\n message = \"[#{tag}] #{message}\" if tag\n SYSLOG.send LEVEL_LOGGER_MAP[severity], clean(message)\n end",
"def log_capture_device=(value)\n @log_capture_device = value\n end",
"def LogDiag(logMessage, tag=DEFAULT_TAG, ipname=DEFAULT_IPNAME, properties=nil)\n return unless IsDiagSupported()\n\n # Process default values for tag and ipname if they are passed as nil\n tag ||= DEFAULT_TAG\n ipname ||= DEFAULT_IPNAME\n\n dataitem = Hash.new\n\n # Adding parameterized properties\n dataitem.merge!(properties) if properties.is_a?(Hash)\n\n # Adding mandatory properties\n dataitem[DI_KEY_LOGMESSAGE] = logMessage\n dataitem[DI_KEY_IPNAME] = ipname\n dataitem[DI_KEY_TIME] = GetCurrentFormattedTimeForDiagLogs()\n\n # Following are expected to be taken care of further processing of dataitem\n # by out_oms_diag\n # 1. Removal of DI_KEY_IPNAME key value pair from dataitem\n # 2. Addition of DI_KEY_AGENTGUID key value pair to dataitem\n # 3. Addition of DI_KEY_TYPE key value pair to dataitem\n\n # Emitting the record\n Fluent::Engine.emit(tag, Fluent::Engine.now, dataitem)\n end",
"def maybe_print(message)\n is_status = message[\"payload\"].try(:[], \"message_type\") == \"read_status\"\n STDOUT.puts \"\\n#{message.to_yaml}\\n\" unless is_status\n end",
"def debug(error)\n return if @debug.nil? or @debug.empty?\n begin\n File.open(@debug, \"a\"){|f| f.puts(error)}\n rescue\n warn(\"Error: debug: Failed to open #{@debug} for logging.\")\n end\n nil \n end",
"def debug(msg)\n log.debug msg\n end",
"def message(string)\n to_console loggify(string, :message, :green)\n to_file loggify(string, :message)\n end",
"def debug(msg)\n STDERR.puts msg if options.key? :debug\n end",
"def debug(message)\n return if quiet?\n say('[DEBUG] ' + message, :yellow) if $DEBUG\n end"
] | [
"0.60039926",
"0.58382386",
"0.56024206",
"0.55666196",
"0.55440235",
"0.55388784",
"0.55302936",
"0.5462529",
"0.54331875",
"0.53947324",
"0.5375474",
"0.53453916",
"0.5311871",
"0.5254254",
"0.5251005",
"0.5231307",
"0.5220675",
"0.52088624",
"0.5199539",
"0.5190324",
"0.51876825",
"0.51876825",
"0.51876825",
"0.5164762",
"0.51606387",
"0.5154101",
"0.51480156",
"0.5143733",
"0.5135533",
"0.51239175",
"0.51155424",
"0.5113827",
"0.5072978",
"0.50663483",
"0.50658876",
"0.50566465",
"0.5048308",
"0.50427884",
"0.5004636",
"0.49985453",
"0.49792752",
"0.4975126",
"0.49743658",
"0.49684665",
"0.4959266",
"0.49472275",
"0.49472275",
"0.49472275",
"0.49305353",
"0.4923091",
"0.491575",
"0.48845267",
"0.4884413",
"0.48785275",
"0.48758194",
"0.4866642",
"0.48642716",
"0.48490575",
"0.4843269",
"0.48360342",
"0.4834455",
"0.48328504",
"0.48241264",
"0.4799301",
"0.47900745",
"0.4786611",
"0.47810254",
"0.4773809",
"0.47617868",
"0.47588536",
"0.4757899",
"0.47559804",
"0.47502962",
"0.47495502",
"0.4749033",
"0.4729195",
"0.47258234",
"0.47258234",
"0.4714601",
"0.47104418",
"0.47098207",
"0.47075665",
"0.4703925",
"0.4703925",
"0.47038785",
"0.47016835",
"0.46952802",
"0.46925107",
"0.4691735",
"0.4685672",
"0.46838093",
"0.46728295",
"0.4671712",
"0.4665645",
"0.46637768",
"0.4656379",
"0.46544686",
"0.46492276",
"0.4649194",
"0.4648225"
] | 0.5844435 | 1 |
Log a +DEBUG+ message. See info for more information. | def debug(progname = nil, &block)
add(DEBUG, nil, progname, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(message)\n log(0, message)\n end",
"def debug(message)\n puts message if debug?\n end",
"def debug(message)\n if DEBUG\n log message\n end\nend",
"def debug(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_DEBUG, message)\n end",
"def debug(msg)\n log(msg, level: Level::DEBUG)\n end",
"def debug(message)\n logger.debug(message) if logger\n end",
"def debug(message)\n $stdout.puts \"D #{message}\" if @debug\n end",
"def debug(msg=nil)\n log \"DEBUG: #{msg}\" if $debug\n end",
"def log_debug(debug_message)\n logger.debug(debug_message)\n end",
"def log_debug(debug_message)\n logger.debug(debug_message)\n end",
"def debug(message)\n ostream.puts message if $DEBUG\n end",
"def debug(msg)\n log.debug msg\n end",
"def log_debug(message) # :nodoc:\n @logger.debug(message) if @logger\n end",
"def debug(message)\n stdout.print(\"#{message}\\n\") if ENV['DEBUG']\n end",
"def debug(info)\n puts(info) if @debug\n end",
"def debug(message = nil)\n log(:debug, message) unless message.nil?\n end",
"def debug(msg)\r\n prelog\r\n logger.debug(msg)\r\n end",
"def debug(msg); @logger.debug(msg); end",
"def debug(message)\n puts \"#{Time.now.strftime(\"%H:%M:%S.%L\")} - \\t#{message}\" if DEBUG\nend",
"def debug(msg)\n STDERR.puts msg if options.key? :debug\n end",
"def debug(msg)\n STDERR.puts msg if @debug\n end",
"def debug(message)\n logger.debug(PROG_NAME) { message }\n end",
"def debug(msg) log(7, msg); end",
"def debug(msg) #:doc:\r\n if have_hook?(:on_debug)\r\n sync { self.class.debug msg }\r\n end\r\n end",
"def debug(message) ; @log.debug(message) ; end",
"def debug(msg)\n @logger.debug(msg)\n end",
"def debug(msg)\n @logger.debug(msg)\n end",
"def debug_msg msg\n puts msg if @options[:debug]\n end",
"def log_debug(log_entry = \"\")\n entry(Gml::LOG_LEVEL_DEBUG, log_entry, 1)\n end",
"def debug(*msg, &block)\n log(:debug, *msg, &block)\n end",
"def debug(*args)\n log(:debug, *args)\n end",
"def debug(message)\n return if quiet?\n say('[DEBUG] ' + message, :yellow) if $DEBUG\n end",
"def debug(message)\n Manager::Base.debug(message)\n end",
"def say_debug(message)\n puts yellow(message) if self.debug\n end",
"def log_debug(message)\n Rails.logger.debug message\n puts message\n end",
"def debug message; write DEBUG, message, caller[0] unless level > @level end",
"def debug(message)\n Edurange.logger.debug message\n end",
"def debug(message)\n return unless debugging?\n\n logger.debug(message.to_s)\n nil\n end",
"def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend",
"def debug_message(message)\n logger.debug \"**** - #{message}\"\n end",
"def debug(message = nil, progname = nil, &block)\n add(DEBUG, message, progname, &block)\n end",
"def debug(msg)\n @logProvider.debug(msg)\n end",
"def debug(msg)\n end",
"def debug_msg(msg=\"\")\n if(@config.debug)\n puts(\"Debug: #{msg}\")\n @file.puts(\"Debug: #{msg}\")\n end\n end",
"def debug(*info)\n puts(info) if debug_mode?\n end",
"def debug(msg)\n $ibm_cloud_log.debug(format_message(msg))\n end",
"def debug(msg)\n puts \"[watchr debug] #{msg}\" if options.debug\n end",
"def debug(s) if $DEBUG then $stderr.print(\"#{s}\\n\") end end",
"def log(msg)\n puts(msg) if @info_values['enable_debug_logging'] == \"Yes\"\n end",
"def debug(msg)\n #puts msg\n end",
"def debug message, opts = {}, &block\n log message, opts.merge(:debug => !opts[:log]), &block\n end",
"def debug(message, important = false)\n puts \"[DEBUG : #{Thread.current[:discordrb_name]} @ #{Time.now.strftime(LOG_TIMESTAMP_FORMAT)}] #{message}\" if @debug || important\n end",
"def debug!\n self.severity = :DEBUG\n end",
"def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end",
"def puts_debug(msg)\r\n if (self.debug) \r\n puts msg\r\n end # end debug\r\n end",
"def debug(message)\n @progress = Time.now.to_f\n buffer_checkpoint(\"debug: #{message}\")\n end",
"def debug(log)\n output.puts log if log_level <= DEBUG\n end",
"def debug(*args)\n log&.debug(*args)\n end",
"def print_debug(msg)\n puts msg if (@debug) \n STDOUT.flush\n end",
"def debug(message = \"\", level = 5)\n if $config[:global][:verboselevel] and $config[:global][:verboselevel] >= level\n puts message \n\t\t#logger.info(message)\n Syslog.info(message)\n end\nend",
"def log_debug(message)\n return message\n end",
"def debug(message)\n warn \"==== VLO DEBUG: \" + message if ENV[\"VLO_DEBUG\"] == 'true'\nend",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def dmsg(msg)\n if $DEBUG\n case msg\n when String\n puts msg\n else\n puts msg.inspect\n end\n end\n end",
"def debug( msg=nil, &block )\n\t\t\t\tGemserver.logger.add( Logger::DEBUG, msg, @classname, &block )\n\t\t\tend",
"def debug(message)\n $stderr.puts(message) if @options[:debug]\nend",
"def debug(s)\n\t#puts \"DEBUG: #{s}\"\nend",
"def debug\n logger.add(Logger::DEBUG, nil, facility) { yield } if logger && logger.debug?\n end",
"def logDebug(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.debug(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend",
"def debug(*args, &block)\n add_with_options(DEBUG, *args, &block)\n end",
"def debug\n Puppet::Util::Log.level = :debug\n end",
"def debug(msg) log(DEBUG, \"DEBUG \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def debug(msg=nil)\n return unless msg\n (@logger ||= OMF::Common::LObject.new(self.class)).debug(msg)\n end",
"def debug_msg( str )\n puts str if @debug == true\n end",
"def debug(message, options = { })\n unless ENV['GUARD_ENV'] == 'test'\n reset_line if options[:reset]\n STDERR.puts color(\"DEBUG (#{Time.now.strftime('%T')}): \", :yellow) + message if ::Guard.options && ::Guard.options[:debug]\n end\n end",
"def debug string\n puts string if $DEBUG\nend",
"def debug(msg=nil)\n return unless msg\n (@logger ||= OMF::Base::LObject.new(self.class)).debug(msg)\n end",
"def debug(topic, message = nil, &block)\n write(:debug, topic, message, &block)\n end",
"def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend",
"def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend",
"def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend",
"def debug(*text)\n if configuration.debug\n channel.write(\"command\" => \"debug\", \"text\" => text.join, \"on\" => on)\n end\n end",
"def debug msg\n if debug?\n return debug_writer.write msg if debug_writer.respond_to? :write\n return debug_writer.call(msg) if debug_writer.respond_to? :call\n raise \"No debug_writer set!\"\n end\n end",
"def debug( msg=nil, &block )\n\t\t\t\tMongrel2.logger.add( Logger::DEBUG, msg, @classname, &block )\n\t\t\tend",
"def debug(message, options = { })\n ::Guard::UI.debug(message, options)\n end",
"def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend",
"def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend",
"def debug! \n $DEBUG = true\n end",
"def debug(*args, &block)\n logger_instance.debug(args, &block)\n end",
"def debug( msg )\n puts Time.now.strftime(\"- %I:%M%p: \") + msg if @debug\nend",
"def debug(component, message, service_id = nil)\n if service_id\n add(Logger::DEBUG, component, message, service_id)\n else\n @@logger.debug(format(CLOUD_LOGGER_MSG, component, message))\n end\n end",
"def debugMsg( msg )\n\treturn unless $DEBUG\n\t$stderr.print \"#{msg}\\n\"\nend",
"def debug(msg)\n return unless debugging?\n\n if msg.nil? || msg.empty?\n invoker = caller(1..1).first.slice(/.*:\\d+/)\n self.warn \"#{self.class}#debug invoked with invalid message #{msg.inspect}:#{msg.class} at #{invoker}\"\n elsif @@message_callback\n @@message_callback.call(:debug, msg)\n else\n puts GREEN + msg + RESET\n end\n end",
"def debug(stuff)\n puts \"DEBUG: #{stuff}\"\nend",
"def log_debug(*debug_infos)\r\n options = debug_infos.extract_options!\r\n options[:development_only] ||= true\r\n\r\n if options[:development_only]\r\n if Rails.env != 'production'\r\n infos = create_info_log_string debug_infos\r\n end\r\n else\r\n infos = create_info_log debug_infos\r\n end\r\n\r\n if options[:write_to] && options[:write_to].to_sym == :error\r\n $log.error infos.join(\"\\n\")\r\n else\r\n $arb_log.info infos.join(\"\\n\")\r\n end\r\nend",
"def debug(msg = nil)\n if block_given?\n add(DEBUG, msg) { yield }\n else\n add(DEBUG, msg)\n end\n end",
"def debug(string)\n Celluloid.logger.debug(string) if Celluloid.logger\n end",
"def dprint(s)\n print s if $DEBUG\nend",
"def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend"
] | [
"0.81238574",
"0.8037817",
"0.7993771",
"0.79338396",
"0.79313105",
"0.79120904",
"0.78907484",
"0.78665197",
"0.7861358",
"0.7861358",
"0.7839613",
"0.78286034",
"0.7825766",
"0.7813897",
"0.779124",
"0.77861345",
"0.773199",
"0.7707478",
"0.76958734",
"0.7694209",
"0.76779157",
"0.76650506",
"0.7657899",
"0.76552564",
"0.762892",
"0.76234454",
"0.76234454",
"0.7587168",
"0.7577076",
"0.7572127",
"0.7547909",
"0.75401753",
"0.7535943",
"0.75327456",
"0.7525585",
"0.7521727",
"0.7514414",
"0.74965906",
"0.7423109",
"0.7416886",
"0.7411218",
"0.74068433",
"0.7388789",
"0.7321123",
"0.73148036",
"0.727099",
"0.7255137",
"0.7238067",
"0.72184485",
"0.7217386",
"0.72121316",
"0.7192935",
"0.71580714",
"0.7148246",
"0.7148246",
"0.71082515",
"0.7101889",
"0.7101717",
"0.7097052",
"0.70849204",
"0.70845413",
"0.7079177",
"0.7075492",
"0.7075492",
"0.7075492",
"0.70738906",
"0.7059723",
"0.7056361",
"0.703938",
"0.7034637",
"0.70340633",
"0.703194",
"0.7017889",
"0.7017246",
"0.70109165",
"0.70086974",
"0.6999767",
"0.6996278",
"0.6990946",
"0.69873375",
"0.6933736",
"0.6933736",
"0.6933736",
"0.6931465",
"0.691736",
"0.6908057",
"0.69023687",
"0.6901603",
"0.6901603",
"0.6870868",
"0.6859179",
"0.68434036",
"0.6833646",
"0.68242705",
"0.68108964",
"0.678876",
"0.678641",
"0.67859095",
"0.67693955",
"0.6752234",
"0.6744797"
] | 0.0 | -1 |
Log a +WARN+ message. See info for more information. | def warn(progname = nil, &block)
add(WARN, nil, progname, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warn message\n log Logger::WARN, message\n end",
"def warn(msg)\n log.warn msg\n end",
"def warn(msg)\n log(msg, level: Level::WARN)\n end",
"def warn(msg); @logger.warn(msg); end",
"def warn message; write WARN, message, caller[0] unless level > @level end",
"def log_warn(warn_message)\n logger.warn(warn_message)\n end",
"def warn(msg)\r\n logger.warn(msg)\r\n end",
"def warn message\n message = \"WARN: \" + process_message(message)\n output_message message, @warn_color if valid_conditions 2\n end",
"def warn(message)\n log(2, message)\n end",
"def warn(message)\n output[:warnings] << message\n end",
"def warn(msg)\n @logger.warn(msg)\n end",
"def warn(msg)\n Chef::Log.warn(msg)\n end",
"def warn(msg)\n puts \"WARNING: #{msg}\"\n end",
"def log_warn(message)\n logger.warn(message) if logger && logger.warn?\n end",
"def warn( msg )\n Kernel.warn( msg )\n end",
"def warn(message = nil, progname = nil, &block)\n add(WARN, message, progname, &block)\n end",
"def warn(*args)\n log(:warn *args)\n end",
"def warn(message)\n self.warnings << message\n puts \"warn #{message}\"\n end",
"def warn(*args, &block)\n add_with_options(WARN, *args, &block)\n end",
"def warn(message)\n log(\"#{color(\"WARNING:\", :yellow, :bold)} #{message}\")\n end",
"def warn(m)\n log_handler.warn msg(m)\n end",
"def lwarn\n logger.add(Logger::WARN, nil, facility) { yield } if logger && logger.warn?\n end",
"def warn(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_WARNING, message)\n end",
"def warn(log)\n output.puts log if log_level <= WARN\n end",
"def warn(msg)\n $ibm_cloud_log.warn(format_message(msg))\n end",
"def warn(*msg, &block)\n log(:warn, *msg, &block)\n end",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tMongrel2.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def warn( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tGemserver.logger.add( Logger::WARN, msg, @classname, &block )\n\t\t\tend",
"def warn(msg)\n stderr \"warning: #{msg}\"\n end",
"def log_warn message, opts = {}, &block\n log message, opts.merge(:as => :warning), &block\n end",
"def warn(msg)\n @logProvider.warn(msg)\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def log_warning(message)\n log(message, DebugType::WARNING)\n end",
"def warning(msg) log(4, msg); end",
"def warning(message)\n log.warn(message.to_s.yellow)\n end",
"def warn?; @level <= WARN; end",
"def warn?; @level <= WARN; end",
"def warn(message)\n logger.warn(message) if logger\n end",
"def warning(message)\n write_message message, 'warning'\n end",
"def warn(message)\n logger.warn(PROG_NAME) { message }\n end",
"def warn message\n @options.warn make_message message\n end",
"def warn?\n level <= WARN\n end",
"def report_warn(type, message)\n @report.warn(type, message)\n end",
"def warn(message)\n err(\"#{color('WARNING:', :yellow, :bold)} #{message}\")\n end",
"def warn(topic, message = nil, &block)\n write(:warn, topic, message, &block)\n end",
"def warn(msg) log(WARN, \"WARN \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def warn\n\n end",
"def log_warn(str)\n @log.warn(str)\n end",
"def warn(check)\n update_check_status(check, 'warn')\n end",
"def warn(message)\n logger.warn(message.to_s)\n nil\n end",
"def warn(*args, &block)\n method_missing(\"warn\", *args, &block)\n end",
"def warn(*args, &block)\n logger_instance.warn(args, &block)\n end",
"def warning(text)\n GitPusshuTen::Log.warning(text)\n end",
"def warn?; @logger.warn?; end",
"def warn?; @loggers.first.level <= WARN; end",
"def warn(msg)\n $warnings << msg if $warnings\nend",
"def warn(msg = nil)\n if block_given?\n add(WARN, msg) { yield }\n else\n add(WARN, msg)\n end\n end",
"def warn!(message) #:doc:\n # TODO: log\n nil\n end",
"def warn( msg )\n @stringio.puts msg\n end",
"def warn(string)\n @logger.warn(string)\n end",
"def warn?\n level >= ASL_LEVEL_WARNING\n end",
"def warning_ln(message)\n write_message message, 'warning', true\n end",
"def warn(*args); end",
"def warn(*args); end",
"def warning(msg)\n @warnings << msg\n owarn @warnings.last\n end",
"def warn(progname = nil, &block)\n add(WARN, nil, progname.yellow, &block)\n end",
"def logWarning(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.warning(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def warn(*msgs, uplevel: nil)\n __builtin_rb_warn_m(msgs, uplevel)\n end",
"def warning(msg)\n banner(\"Warning: #{msg}\", YELLOW)\n end",
"def parse_warn(msg); say :warn, msg; end",
"def report_warn(type, message)\n @report.warn(type, message)\n Salus::PluginManager.send_event(:report_warn, { type: type, message: message })\n if @builds\n scanner = @report.scanner_name\n message = \"#{scanner} warning: #{type}, #{message}, build: #{@builds}\"\n end\n bugsnag_notify(message)\n end",
"def lwarn; end",
"def warn message\n super message if @verbosity > 1\n end",
"def warn *args\n @invoked = { name: :warn, args: args }\n end",
"def warning(context, options = nil)\n options = options.merge(level: 'warning')\n log(context, options)\n end",
"def warn(fmt, *args)\n end",
"def warn(string)\n @has_warnings = true\n to_console loggify(string, :warning, :yellow), true\n to_file loggify(string, :warning)\n end",
"def print_warning(msg)\n tag = '[ WARNING ]'\n print_formatted(tag,msg)\n end",
"def warn(topic, message = T.unsafe(nil), &block); end",
"def warn(str)\n @stdout_log.warn(str) if @vars[:log_stdout]\n @log.warn(str)\n end",
"def licensing_warning(message)\n log.warn(log_key) { message }\n end",
"def warn string\n $log.warn string\n Ncurses.beep\n end",
"def warn(*args)\n `#{@native}.warn.apply(#{@native}, args)`\n end",
"def silence_warnings\n UnionStationHooks::Log.warn_callback = lambda { |_message| }\n end",
"def warn=(value) @warn = true; end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def warning(msg) $stderr.puts(\"Warning: #{msg}\") end",
"def notify_warning(error, context_message = nil)\n log(error, level: :warn) do\n @config.warn_notifiers&.map { |notifier| notifier.call(error, context_message) }\n end\n end",
"def octokit_warn(*message)\n unless ENV['OCTOKIT_SILENT']\n warn message\n end\n end",
"def warning!\n self.severity = :WARNING\n end",
"def log_level\n @log_level ||= WARN\n end",
"def warn(string)\n Celluloid.logger.warn(string) if Celluloid.logger\n end",
"def gocdkit_warn(*message)\n unless ENV['GOCDKIT_SILENT']\n warn message\n end\n end",
"def warning(text)\n STDERR.puts yellow_term_text(text)\n end",
"def warning(warning)\n end",
"def warning(*args); end",
"def warn(message)\n $stderr.puts(\"roll: #{message}\") if $DEBUG || $VERBOSE\n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end"
] | [
"0.84723234",
"0.805111",
"0.8026166",
"0.80017537",
"0.79737777",
"0.79291064",
"0.7920227",
"0.78929764",
"0.784341",
"0.7820772",
"0.7762179",
"0.77461296",
"0.77437407",
"0.7740863",
"0.7720108",
"0.7701571",
"0.7698247",
"0.7688204",
"0.7669562",
"0.7648691",
"0.7569844",
"0.75571656",
"0.7556147",
"0.7553046",
"0.7548679",
"0.7530818",
"0.7512989",
"0.75014675",
"0.7493909",
"0.74773604",
"0.747496",
"0.7417861",
"0.7411572",
"0.74011505",
"0.7394073",
"0.7378838",
"0.7378838",
"0.7374516",
"0.73673356",
"0.73322904",
"0.7313069",
"0.7299378",
"0.72786117",
"0.72571385",
"0.725671",
"0.72375387",
"0.72202164",
"0.7190144",
"0.71804434",
"0.7167689",
"0.71607417",
"0.71226656",
"0.710892",
"0.71063805",
"0.7086547",
"0.70776814",
"0.7044321",
"0.70270175",
"0.70066464",
"0.69923687",
"0.69772804",
"0.6963034",
"0.6936752",
"0.6936752",
"0.6902341",
"0.6859588",
"0.6841618",
"0.6827584",
"0.68202144",
"0.6817214",
"0.67607385",
"0.6747927",
"0.6722083",
"0.67041904",
"0.6687877",
"0.66811967",
"0.66786414",
"0.6667361",
"0.6644629",
"0.6625718",
"0.66249573",
"0.6617942",
"0.66176796",
"0.6606899",
"0.6605232",
"0.66003615",
"0.66003615",
"0.66003615",
"0.6580922",
"0.65558016",
"0.65382344",
"0.6525214",
"0.6521563",
"0.65180886",
"0.6516915",
"0.65019834",
"0.64487606",
"0.64464056",
"0.6427854",
"0.6427854"
] | 0.70628035 | 56 |
Log an +ERROR+ message. See info for more information. | def error(progname = nil, &block)
add(ERROR, nil, progname, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(message)\n log(\"#{color(\"ERROR:\", :red, :bold)} #{message}\")\n end",
"def error(msg)\n log.error msg\n end",
"def error(message)\n logger.error(PROG_NAME) { message }\n end",
"def error(message)\n # note, we always log error messages\n add(:error, message)\n end",
"def error(message)\n # note, we always log error messages\n add(:error, message)\n end",
"def error(msg); @logger.error(msg); end",
"def error(msg)\n log(msg, level: Level::ERROR)\n end",
"def error(log)\n output.puts log if log_level <= ERROR\n end",
"def error(message)\n log.error(message.to_s.red)\n end",
"def error(msg)\r\n prelog\r\n logger.error(msg)\r\n end",
"def error(msg)\n @logger.error(msg)\n end",
"def error(message)\n write_message message, 'error'\n end",
"def log_error(message)\n Rails.logger.error message\n puts message\n end",
"def error(*args)\n log(:error, *args)\n end",
"def error\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_ERR, message)\n end",
"def error(message)\n @module_manager.bot.log s prefix + \"\\e[31m\" + message + \"\\e[0m\"\n end",
"def error(m)\n log_handler.error msg(m)\n end",
"def error(text)\n GitPusshuTen::Log.error(text)\n end",
"def error(message)\n $stderr.puts message\n end",
"def err(e)\n @logger.error(e)\n end",
"def error_ln(message)\n write_message message, 'error', true\n end",
"def log_error(message)\n logger.error(message) if logger && logger.error?\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def error(msg)\n stderr(\"error: #{msg}\")\n end",
"def error(message)\n print(1, message)\n end",
"def error(msg)\n @logProvider.error(msg)\n end",
"def error(*args)\n log(*args)\n fail\n end",
"def error(msg)\n $ibm_cloud_log.error(format_message(msg))\n end",
"def error(message)\n output[:errors] << message\n end",
"def log_error(err)\n\t\tprint_error(err)\n\n\t\twlog(err)\n\n\t\t# If it's a syntax error, log the call stack that it originated from.\n\t\tdlog(\"Call stack:\\n#{$@.join(\"\\n\")}\", 'core', LEV_1)\n\tend",
"def log(message, error=false)\n full_message = \"\"\n full_message += \"ERROR: \" if error\n full_message += message\n puts full_message\n end",
"def error(message)\n output[:errors] << message\n end",
"def error(*msg, &block)\n log(:error, *msg, &block)\n end",
"def log_error(error)\n @logger.error \"* [JOB] #{name} failed with #{error.class.name}: #{error.message}\"\n @logger.error error.backtrace.inspect\n end",
"def log_error(msg)\n print_error(msg)\n\n elog(msg, 'hwbridge', error: $!)\n end",
"def error(message)\n err(\"#{color('ERROR:', :red, :bold)} #{message}\")\n end",
"def log_error(msg)\n logger ? logger.error(msg) : $stderr.puts(msg)\n end",
"def error(message)\n raw \"ERROR :#{message}\\r\\n\"\n end",
"def print_error(msg)\n tag = '[ ERROR ]'\n print_formatted(tag,msg)\n end",
"def error(message)\n STDERR.puts red(message)\n end",
"def error(*args, &block)\n logger_instance.error(args, &block)\n end",
"def report_error(error)\n @io.puts \"ERROR: #{error.message}\"\n end",
"def log_error message, opts = {}, &block\n log message, opts.merge(:as => :error), &block\n end",
"def error(msg) log(ERROR, \"ERROR \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def meow(error)\n logger = Logger.new('QuestiongLog.log')\n\n if error\n logger.error('🚧 Error: ' + error + ' 🚧')\n else\n logger.error('🚧 Error occurred!! 🚧')\n end\n end",
"def error(message)\n $stderr.puts colorize(message, :error)\n end",
"def error_log\n end",
"def error_log\n end",
"def error_log\n end",
"def log_error(e = $!)\n (@logger ||= OMF::Base::LObject.new(self.class)).error(e)\n end",
"def error( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tGemserver.logger.add( Logger::ERROR, msg, @classname, &block )\n\t\t\tend",
"def error message\n message = \"ERROR: \" + process_message(message)\n output_message message, @error_color if valid_conditions 3\n end",
"def log_error(error)\n error_msg = error\n if current_user == nil\n error_msg += \" User: nil\"\n else\n error_msg += \" User: #{current_user.username}\"\n end\n Rails.logger.error(error_msg)\n end",
"def error(string)\n @logger.error(string)\n end",
"def print_error(msg = '')\n $stderr.puts \"[ERROR] #{msg}\"\n end",
"def error(msg = '')\n\t\toutput.print_error(msg)\n\tend",
"def err(message)\n stderr.puts message\n end",
"def error(msg)\n puts \"\\n#{@red}[Error] #{msg}!#{@ncl}\\n\"\n end",
"def write_error(message)\n STDERR.puts(message)\n end",
"def log_error(*error_messages)\r\n options = custom_infos.extract_options!\r\n\r\n infos = []\r\n infos << \"Non-Exception Error raised when executing #{request.method} #{request.fullpath}\" if defined? request\r\n error_messages.each do |e_message|\r\n infos << \"\\t#{e_message}\"\r\n end\r\n infos << \"Error trace:\"\r\n include_trace_to info\r\n infos << \"\\n\"\r\n\r\n if options[:write_to] && options[:write_to].to_sym == :info\r\n $arb_log.error infos.join(\"\\n\")\r\n else\r\n $log.error infos.join(\"\\n\")\r\n end\r\nend",
"def error(*args, &block)\n add_with_options(ERROR, *args, &block)\n end",
"def print_error_message(msg)\n print \"<< ERROR: #{msg.to_s} !!\\n\"\n end",
"def logError(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.error(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\nend",
"def error(message)\n STDERR.puts message\nend",
"def error_message(msg)\n STDERR.puts msg\n end",
"def error(msg) $stderr.puts(\"Error: #{msg}\") end",
"def log_error(err)\n backtrace = Array(err.backtrace).flatten.compact\n\n backtrace =\n if backtrace.empty?\n ''\n else\n prefix = \"\\n \"\n prefix + backtrace.join(prefix)\n end\n\n message = \"#{err.class}: #{err.message}#{backtrace}\"\n Fluffle.logger.error message\n end",
"def error(exception)\n log \"#{exception.message}\\n#{exception.backtrace.join(\"\\n\")}\", :error\n end",
"def error_and_log(message)\n @ui.error(message)\n @logger.error(message)\n end",
"def error(message, line, column)\n puts \"*-*-* error at #{line}:#{column}: #{message}\"\n end",
"def log_error(msg, e=nil)\n #log_msg = msg + \": #{e}\\n\\t\" + e.backtrace.join(\"\\n\\t\") + \"\\n\" if e\n #Logging.log_msg(log_msg, Logger::ERROR)\n (@logger ||= OMF::Common::LObject.new(self.class)).error(msg, \"\\n\", e, \"\\n\", e.backtrace.join(\"\\n\\t\"))\n end",
"def log_stderr(type: :info, message:)\n $stderr.puts log_entry(type, message)\n end",
"def error\n logger.add(Logger::ERROR, nil, facility) { yield } if logger && logger.error?\n end",
"def on_error(error)\n STDOUT << \"on_error\" << \"\\n\"\n \" error \" << error << \"\\n\"\n STDOUT.flush\n end",
"def error(message = nil, progname = nil, &block)\n add(ERROR, message, progname, &block)\n end",
"def log_error(msg)\n\t\tprint_error(msg)\n\n\t\telog(msg, 'meterpreter')\n\n\t\tdlog(\"Call stack:\\n#{$@.join(\"\\n\")}\", 'meterpreter')\n\tend",
"def error(exception)\n logger.info \"execution failed: #{exception}\"\n end",
"def error( msg=nil, &block )\n\t\t\t\treturn self.debug( msg, &block ) if @force_debug\n\t\t\t\tMongrel2.logger.add( Logger::ERROR, msg, @classname, &block )\n\t\t\tend",
"def error!\n self.severity = :ERROR\n end",
"def error(message, severity = Logger::ERROR)\n red_bright \"ERROR: #{message}\"\n log_message(\"ERROR:| #{self.class} | #{__method__} | #{message}\", MessageType::NOTE, severity)\n end",
"def on_error(error)\n @result << \"error: #{error}\"\n end",
"def error(text = nil)\n estream.puts text\n end",
"def error(text)\n STDERR.puts red_term_text(text)\n end",
"def print_error\n puts @error_text if @error_text\n print_usage\n end",
"def push_error_message(msg)\n push_message(:error, msg)\n end",
"def push_error_message(msg)\n push_message(:error, msg)\n end",
"def log_error(exception); end",
"def error(exception)\n logger.error(exception)\n end",
"def error(string)\n Celluloid.logger.error(string) if Celluloid.logger\n end",
"def error(message, color = :red)\n Strainer.log.error(message)\n\n return if quiet?\n message = set_color(message, *color) if color\n super(message)\n end",
"def err(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"ERROR\".red + \"] \" + \"#{input.red}\"\n end",
"def log_error(filename, line_number, message)\n numbered_message = \"#{filename}:#{line_number} - #{message}\"\n if Command.abort_on_error?\n abort \"ABORTING - #{numbered_message}\"\n else\n STDERR.puts numbered_message\n end\n end",
"def log_error(method, file, error)\n time = ''\n # Only add time for development log because production already outputs timestamp\n if Rails.env == 'development'\n time = Time.now.strftime('[%d/%m/%Y %H:%M:%S] ').to_s\n end\n logger.error \"#{time}EXCEPTION IN #{file}, method='#{method}' [#{error}]\"\nend",
"def log_request_error(error, url, error_code)\n Rails.logger.error(\"#{__FILE__} tried to access #{url} got: #{error.message} #{error.backtrace}\")\n log.puts \"#{error_code} #{error.message}\"\n end",
"def error(msg)\n puts red(bold(\"[!] #{msg}\"))\n end",
"def error(message, options = {})\n options[:prefix] ||= \" - \"\n options[:color] ||= :red\n output message, options\n end",
"def err(message)\n warn \" > #{message}\"\nend",
"def error(string)\n to_console loggify(string, :error, :red), true\n to_file loggify(string, :error)\n end",
"def log(msg)\n STDERR.puts msg\n end",
"def error_and_log_error(error)\n error_and_log(error.message)\n error_and_log(error.backtrace.reverse.join(\"\\n\"))\n end",
"def error_and_log(message, log, logger)\n log.error(message)\n logger.error(message)\n end"
] | [
"0.7665498",
"0.75884163",
"0.7553211",
"0.75189656",
"0.75189656",
"0.7481797",
"0.7467938",
"0.7434785",
"0.7417396",
"0.7389026",
"0.7310417",
"0.73073065",
"0.729017",
"0.7257062",
"0.71727955",
"0.71401644",
"0.71396303",
"0.7083497",
"0.70831794",
"0.7051143",
"0.7043892",
"0.7036828",
"0.6943914",
"0.69429165",
"0.69410396",
"0.69404984",
"0.6929038",
"0.69148815",
"0.68976283",
"0.68839544",
"0.6866078",
"0.68408436",
"0.68404174",
"0.68286645",
"0.68150425",
"0.6799122",
"0.6779023",
"0.6771682",
"0.6769973",
"0.67397434",
"0.6732361",
"0.6722552",
"0.671811",
"0.6716873",
"0.67038906",
"0.66759473",
"0.66735935",
"0.66735935",
"0.66735935",
"0.6663912",
"0.6662338",
"0.6639651",
"0.663521",
"0.6635167",
"0.6609642",
"0.6604432",
"0.65891504",
"0.65877986",
"0.6584523",
"0.658001",
"0.6576628",
"0.65620786",
"0.654847",
"0.65472734",
"0.6533496",
"0.65319884",
"0.6497963",
"0.6490531",
"0.6477001",
"0.6474721",
"0.6463209",
"0.6448191",
"0.6447208",
"0.6436909",
"0.6422952",
"0.64135855",
"0.64083207",
"0.6403358",
"0.63955295",
"0.63915646",
"0.6384856",
"0.6383418",
"0.6381618",
"0.63728243",
"0.6367264",
"0.6367264",
"0.6358272",
"0.63510585",
"0.63490695",
"0.6318572",
"0.6305972",
"0.6288876",
"0.6274541",
"0.6271896",
"0.6270697",
"0.6264925",
"0.62632096",
"0.62618434",
"0.625942",
"0.6257683",
"0.6246087"
] | 0.0 | -1 |
Log a +FATAL+ message. See info for more information. | def fatal(progname = nil, &block)
add(FATAL, nil, progname, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fatal message; write FATAL, message, caller[0] unless level > @level end",
"def fatal(message)\n log(\"#{color(\"FATAL:\", :red, :bold)} #{message}\")\n end",
"def fatal(message)\n log(4, message)\n end",
"def fatal(msg)\n log(msg, level: Level::FATAL)\n end",
"def fatal(*args)\n log(:fatal, *args)\n end",
"def fatal(msg) log(FATAL, \"FATAL \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def fatal(message)\n err(\"#{color('FATAL:', :red, :bold)} #{message}\")\n end",
"def fatal(msg); @logger.fatal(msg); end",
"def fatal(*args, &block)\n add_with_options(FATAL, *args, &block)\n end",
"def fatal(msg)\n log.fatal msg\n end",
"def fatal(message = nil, progname = nil, &block)\n add(FATAL, message, progname, &block)\n end",
"def fatal\n logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal?\n end",
"def fatal\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_CRIT, message)\n end",
"def fatal(msg)\r\n prelog\r\n logger.fatal(msg)\r\n end",
"def fatal(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"FATAL\".red.bold + \"] \" + \"#{input.red.bold}\"\n end",
"def log_fatal(message)\n logger.fatal(message) if logger && logger.fatal?\n end",
"def fatal(msg)\n logger.fatal msg\n end",
"def fatal( msg=nil, &block )\n\t\t\t\tGemserver.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def fatal(m)\n log_handler.fatal msg(m)\n end",
"def fatal( msg=nil, &block )\n\t\t\t\tMongrel2.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def fatal(*args, &block)\n Log.fatal(*args, &block)\n end",
"def fatal(*args)\n log(*args)\n fail_now\n end",
"def fatal?; @level <= FATAL; end",
"def fatal?; @level <= FATAL; end",
"def fatal?; @loggers.first.level <= FATAL; end",
"def fatal(*msg, &block)\n log(:fatal, *msg, &block)\n end",
"def fatal!(msg, err = -1)\n Backdat::Log.fatal(msg)\n Process.exit err\n end",
"def fatal(*args, &block)\n logger_instance.fatal(args, &block)\n end",
"def fatal(msg)\n banner(msg, RED)\n exit(1)\n end",
"def fatal?\n level <= FATAL\n end",
"def fatal?; @logger.fatal? end",
"def fatal!(message)\n fatal(message)\n exit 1\n end",
"def fatal(msg)\n banner(msg, color: RED)\n exit 1\n end",
"def fatal!(msg, err = -1)\n Kitchenplan::Log.fatal(msg)\n Process.exit err\n end",
"def fatal(msg = nil)\n if block_given?\n add(FATAL, msg) { yield }\n else\n add(FATAL, msg)\n end\n end",
"def fatal_raise error, *args, &block\n return if @level > FATAL\n message = block_given? ? build_pair(yield) : build_pair(*args)\n add( FATAL, nil, message )\n raise error, message\n end",
"def fatal; end",
"def fatal(str)\n @stdout_log.fatal(str) if @vars[:log_stdout]\n @log.fatal(str)\n send_mail(str) if @vars[:log_send_mail]\n end",
"def fatal!(message)\n # Not using safe_each in case that caused an error.\n safely { $stdout.reopen(@stdout, 'a+'); $stdout.puts message }\n safely { $stderr.reopen(@stderr, 'a+'); $stderr.puts message }\n exit 1\n end",
"def fatal(error)\n debug(error)\n raise(error)\n end",
"def fatalf(string, *args)\n logf(string, *args)\n fail_now\n end",
"def fatal_error(error)\n STDERR.puts Rainbow(\"Fatal error: #{error}\").red\n STDERR.puts \"Backtrace:\"\n STDERR.puts format_backtrace(error.backtrace)\n end",
"def fatal(object, **rest)\n protect do\n emit Log::Event.ify(object, severity: __method__, rest: rest)\n end\n end",
"def fatal!(str, e = nil)\n Merb.logger.fatal!\n Merb.logger.fatal!(\"\\e[1;31;47mFATAL: #{str}\\e[0m\")\n Merb.logger.fatal!\n\n print_colorized_backtrace(e) if e && Merb::Config[:verbose]\n \n if Merb::Config[:show_ugly_backtraces]\n raise e\n else\n exit(1)\n end\n end",
"def fatal message = nil, &block\n if block_given?\n add 4, nil, message, &block\n else\n add 4, message, nil, &block\n end\n end",
"def fatal?\n level >= ASL_LEVEL_CRIT\n end",
"def fatal?\n level == 3\n end",
"def fatal(&prc)\n @@fatal = prc unless prc.nil?\n return @@fatal\n end",
"def notice(msg) log(5, msg); end",
"def fatal_error(error)\n $stderr.puts \"#{$0}: error: #{error}\"\n exit 1\nend",
"def fatal_error(error)\n if $stdout.isatty\n $stdout.puts(\"\\033[31m#{error.message}\\033[0m\")\n else\n $stdout.puts(error.message)\n end\n end",
"def fatal_error(error, msg, args)\n Distributed.fatal \"#{self}: fatal error '#{error.message}' while processing #{msg}(#{args.join(\", \")})\"\n Distributed.fatal Roby.filter_backtrace(error.backtrace).join(\"\\n \")\n @connection_state = :disconnecting\n queue_call false, :fatal_error, [error, msg, args]\n end",
"def write_fatal_error message\n puts \"Error: #{message}. See spritemaster -h for usage\"\n exit\n end",
"def fatal_error(message)\n puts message\n exit -1\nend",
"def log_panic(log_entry = \"\")\n entry(Gml::LOG_LEVEL_PANIC, log_entry, 1)\n end",
"def fatal(task)\n printf('%-30s %20s', \"#{label(task)} \", \"\\e[31mFAILURE\\e[0m\\n\\n\")\n puts task.error_message + \"\\n\"\n end",
"def fatal?; end",
"def fatal?; end",
"def fatal?\n @level <= 4\n end",
"def fatal_dump why\n self.fatal why.class.to_s + ' ' + why.to_s\n self.liner '!'\n self.puts why.backtrace if self.debug?\n self.liner '!'\n end",
"def egregious_log(exception)\n logger.fatal(\n \"\\n\\n\" + exception.class.to_s + ' (' + exception.message.to_s + '):\\n ' +\n clean_backtrace(exception).join(\"\\n \") +\n \"\\n\\n\")\n notify_airbrake(exception)\n end",
"def abort(msg = '')\n\t\toutput.print_error(\"fatal: #{msg}\")\n\tend",
"def optest_fatal_error(line)\n print \"\\nTesting Operator Fatal Error: #{line}\\n\"\n args = line.split(/ /)\n result = TabulatorOperator.new.operator_command(args)\n assert((result =~ /^Fatal*/), \"Expected Fatal error: #{result}\")\n end",
"def emergency(msg) log(0, msg); end",
"def silent(text)\n GitPusshuTen::Log.silent(text)\n end",
"def notice!\n self.severity = :NOTICE\n end",
"def abort( msg )\n @log.fatal msg\n exit 1\n end",
"def fatal?\n false\n end",
"def fatalerror( err_msg )\n# Display a fatal error and quit. -----------------------------------\n if ($gTest_params[\"logfile\"])\n $fLOG.write(\"\\nsubstitute-h2k.rb -> Fatal error: \\n\")\n $fLOG.write(\"#{err_msg}\\n\")\n end\n print \"\\n=========================================================\\n\"\n print \"substitute-h2k.rb -> Fatal error: \\n\\n\"\n print \" #{err_msg}\\n\"\n print \"\\n\\n\"\n print \"substitute-h2k.rb -> Other Error or warning messages:\\n\\n\"\n print \"#{$ErrorBuffer}\\n\"\n exit() # Run stopped\nend",
"def abort( msg )\n @log.fatal msg\n exit 1\n end",
"def warning(msg) log(4, msg); end",
"def log_and_die(msg)\n logger.fatal(msg)\n raise msg\n end",
"def onquiet\n end",
"def reset_logging\n\t\tLoggability.formatter = nil\n\t\tLoggability.output_to( $stderr )\n\t\tLoggability.level = :fatal\n\tend",
"def fatal?\n @loggers.any? { |logger| logger.respond_to?(:fatal?) && logger.fatal? }\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def unknown(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_EMERG, message)\n end",
"def fatal?\n exception.fatal?\n end",
"def print message=nil\n log(:info, message) unless Qcmd.silent?\n end",
"def logNormal(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.normal(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def error\n %i[error fatal]\n end",
"def filter_logging_level level\n level.downcase!\n case level\n when 'fatal'\n Logger::FATAL\n when 'error'\n Logger::ERROR\n when 'warn'\n Logger::WARN\n when 'debug'\n Logger::DEBUG\n when 'info'\n Logger::INFO\n when 'unknown'\n Logger::UNKNOWN\n else\n raise RuntimeError, \"Error: Unknown logging level #{level} in config file.\"\n end\n end",
"def log( *messages )\n\t$stderr.puts( messages.join ) unless Rake.application.options.quiet\nend",
"def info(msg) log(6, msg); end",
"def log_error(exception)\n message = format_error(exception)\n log_message(message, log_method: 'fatal')\n end",
"def report(message)\n puts message unless quiet? #or trial?\n end",
"def error(message)\n logger.error(PROG_NAME) { message }\n end",
"def mute_logger\n zk_log = Zookeeper::Logger.wrapped_logger\n\n orig_level, zk_log.level = zk_log.level, ::Logger::FATAL\n orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR\n yield\n ensure\n zk_log.level = orig_zk_level\n end",
"def notice=(message); end",
"def notice=(message); end",
"def log(msg)\n STDERR.puts msg\n end",
"def add_fatal_error(error)\n warn error if verbose\n @errors << error\n end",
"def log!(message)\n log message if very_verbose\n end",
"def log!(message)\n log message if very_verbose\n end",
"def unknown(*args, &block)\n logger_instance.unknown(args, &block)\n end",
"def puts_error(msg)\n warn \"\\e[31m[ERROR] #{msg}\\e[0m\" if Calamum::Config[:debug]\n exit(1)\nend",
"def log(msg)\r\n STDERR.puts msg\r\n end",
"def notice; end",
"def log_e\n log\n exit\n end",
"def notice_error(error)\n return unless @error_logger\n\n error = RuntimeError.new(error) unless error.is_a?(StandardError)\n @error_logger.call(error)\n end"
] | [
"0.81237775",
"0.7936535",
"0.7876504",
"0.7806069",
"0.7619184",
"0.7555627",
"0.7514704",
"0.74702346",
"0.7452359",
"0.74346936",
"0.74006814",
"0.7318397",
"0.7298454",
"0.7294897",
"0.7280418",
"0.72745955",
"0.7246595",
"0.72340906",
"0.71783423",
"0.7109056",
"0.70672935",
"0.7014671",
"0.6961476",
"0.6961476",
"0.69412935",
"0.692918",
"0.68384856",
"0.67719495",
"0.66743284",
"0.6644739",
"0.6643348",
"0.65099907",
"0.6413677",
"0.63829255",
"0.6365817",
"0.6332962",
"0.62461984",
"0.6222165",
"0.6162782",
"0.61604553",
"0.61443377",
"0.6038107",
"0.59145015",
"0.5898921",
"0.5882728",
"0.5837873",
"0.5821793",
"0.57959384",
"0.5754787",
"0.57454216",
"0.5702476",
"0.5669449",
"0.5646145",
"0.5602404",
"0.55508345",
"0.5531982",
"0.5508313",
"0.5508313",
"0.5367177",
"0.53585035",
"0.5320289",
"0.53195584",
"0.53011084",
"0.5222563",
"0.5195635",
"0.51532906",
"0.51503855",
"0.5142939",
"0.5131523",
"0.5104023",
"0.5090075",
"0.5031933",
"0.49960104",
"0.49862257",
"0.49739978",
"0.49355784",
"0.49250785",
"0.49178013",
"0.490967",
"0.48871005",
"0.4862196",
"0.48343796",
"0.48179632",
"0.47948685",
"0.47816813",
"0.4776011",
"0.47589758",
"0.46758547",
"0.46669483",
"0.46669483",
"0.46627578",
"0.4660822",
"0.46569163",
"0.46569163",
"0.4651182",
"0.46311748",
"0.4621738",
"0.46180925",
"0.46149164",
"0.46139488"
] | 0.6866033 | 26 |
Log an +UNKNOWN+ message. This will be printed no matter what the logger's level. See info for more information. | def unknown(progname = nil, &block)
add(UNKNOWN, nil, progname, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown(*args, &block)\n logger_instance.unknown(args, &block)\n end",
"def unknown(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_EMERG, message)\n end",
"def unknown(message = nil, progname = nil, &block)\n add(UNKNOWN, message, progname, &block)\n end",
"def <<(message)\n add(Logger::UNKNOWN, message)\n end",
"def unknown\n state(\"unknown\")\n end",
"def unknown(msg = nil)\n if block_given?\n add(UNKNOWN, msg) { yield }\n else\n add(UNKNOWN, msg)\n end\n end",
"def unknown; status[:unknown]; end",
"def unknown(*args, &block)\n add_with_options(UNKNOWN, *args, &block)\n end",
"def unknown_string\n t('Unknown')\n end",
"def puts(msg)\n msg = msg.to_s\n @logger.unknown(msg)\n msg\n end",
"def on_unknown(&blk)\n @on_unknown = blk\n end",
"def notice(msg) log(5, msg); end",
"def supporting_method\n logger.warn 'This does nothing'\n end",
"def msg(message)\n puts message unless nagios_mode?\n end",
"def event(msg)\n unknown(\"=====> #{msg}\")\n end",
"def fatal(msg); @logger.fatal(msg); end",
"def fatal(m)\n log_handler.fatal msg(m)\n end",
"def emergency(msg) log(0, msg); end",
"def unknown?\n status == 'Unknown'\n end",
"def info message\n log Logger::INFO, message\n end",
"def untrap_info\n return unless Signal.list['INFO']\n\n trap 'INFO', 'DEFAULT'\n end",
"def noop(msg); \"200 \"; end",
"def fatal(message)\n log(4, message)\n end",
"def fatal(msg)\n logger.fatal msg\n end",
"def info message; write INFO, message, caller[0] unless level > @level end",
"def info(msg); @logger.info(msg); end",
"def info msg\n logger.info msg\n end",
"def << message; write UNKNOWN, message, caller[0] end",
"def noop\n tagged_response(\"NOOP\")\n end",
"def fatal(msg)\n log.fatal msg\n end",
"def ignore_unknown\n @gapi.ignore_unknown_values\n end",
"def handle_bogus_message(message)\n @connection.append('bogus', message)\n end",
"def fatal message; write FATAL, message, caller[0] unless level > @level end",
"def fatal(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"FATAL\".red.bold + \"] \" + \"#{input.red.bold}\"\n end",
"def info(msg) log(6, msg); end",
"def status\n 'unknown'\n end",
"def unknownCommand\n @t.say(\"Sorry, I couldn't understand your message. Please use following syntax: [command] [arguments]\\nText HELP for available commands\")\nend",
"def fallback\n logger.info ap params\n head :ok\n end",
"def warning(msg) log(4, msg); end",
"def method_missing(*args)\n puts \"unimplemented: #{args}\"\n end",
"def fatal( msg=nil, &block )\n\t\t\t\tGemserver.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def fatal\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_CRIT, message)\n end",
"def log_fatal(message)\n logger.fatal(message) if logger && logger.fatal?\n end",
"def unknown; status[:unknown] || []; end",
"def notice; end",
"def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend",
"def say(text, level = DEFAULT_LOG_LEVEL)\n puts text if @loud\n logger.add level, \"HARE: #{text}\"\n end",
"def fatal(message)\n log(\"#{color(\"FATAL:\", :red, :bold)} #{message}\")\n end",
"def fatal(msg)\n log(msg, level: Level::FATAL)\n end",
"def unknown_cmd(cmd)\n\t\t\t\t\"Unknown command: #{cmd}\"\n\t\t\tend",
"def unknown message = nil, &block\n if block_given?\n add 5, nil, message, &block\n else\n add 5, message, nil, &block\n end\n end",
"def logNormal(message)\n found = false\n if ($logMessages)\n\tlogServer = get($serverPath+'log')\n\tif (logServer != nil)\n\t\tlogServer.normal(message)\n\t\tfound = true\n\tend\n end\n if (!found or !$logMessages or $printAllMessages)\n\tprint(message)\n end\n\nend",
"def info(_message)\n raise NotImplementedError.new\n end",
"def log_info(msg)\n logger ? logger.info(msg) : puts(msg)\n end",
"def info!\n self.severity = :INFO\n end",
"def notice!\n self.severity = :NOTICE\n end",
"def ignore_unknown= new_ignore_unknown\n frozen_check!\n @gapi.ignore_unknown_values = new_ignore_unknown\n end",
"def handle_bogus_message(message)\n # This needs a good solution\n end",
"def on_engine_ignored_message(e, who, msg)\n pre = '<Engine>'\n @log.info(\"#{pre} IGNORED: #{who}: #{msg}.\")\n end",
"def method_missing(name, *args)\n \"The method #{name} doesn't exist - args: #{args}\"\n end",
"def log(message); logger.info(message); end",
"def log(msg)\n puts msg unless ENV['TEST']\n end",
"def default!\n self.severity = :DEFAULT\n end",
"def fatal\n logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal?\n end",
"def info(msg)\n log.info msg\n end",
"def method_missing( name, *args )\n log(name, args) if @@enabled\n end",
"def info?; @level <= INFO; end",
"def info?; @level <= INFO; end",
"def report(message)\n puts message unless quiet? #or trial?\n end",
"def log_stuff\r\n log.info(\"TestLogger is here to log stuff.\")\r\n log.warn(\"TestLogger is finishged logging. Be careful.\")\r\n end",
"def print message=nil\n log(:info, message) unless Qcmd.silent?\n end",
"def notice\n #\n end",
"def unknown_host\n update_code(:unknown_host, %i(unknown redirected))\n end",
"def message(message)\n log.info(message.to_s)\n end",
"def info(message)\n logging.call(message)\n end",
"def missing_msg\n return unless missing?\n\n 'Missing timestamp.'\n end",
"def log!(message)\n log message if very_verbose\n end",
"def log!(message)\n log message if very_verbose\n end",
"def info(msg)\n @logger.info(msg)\n end",
"def process_missing_node(line, node_name, node_type)\n puts \"Unhandled node #{node_name} (#{node_type})\"\n end",
"def process_missing_node(line, node_name, node_type)\n puts \"Unhandled node #{node_name} (#{node_type})\"\n end",
"def message\n \"Node type: #{type.inspect} is unknown\"\n end",
"def output(message)\n return if disabled\n if Device.simulator?\n puts(message)\n else\n NSLog(message)\n end\n message\n end",
"def log_panic(log_entry = \"\")\n entry(Gml::LOG_LEVEL_PANIC, log_entry, 1)\n end",
"def unhandled(response)\n message = \"Unhandled response: #{response.name}\"\n if response.code.is_a?(Numeric)\n hexcode = response.code.to_s(16)\n message << \" (0x#{hexcode})\"\n end\n\n log(:warn, message)\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 say(message)\n puts green(message) if self.verbose \n end",
"def fatal( msg=nil, &block )\n\t\t\t\tMongrel2.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def method_missing(method_id)\n msg = \"Unknown event #{method_id}\"\n log msg\n end",
"def log!(msg)\n log_info(msg)\n puts(msg)\nend",
"def msg(text, level = :info)\n case level\n when :warn\n puts \"\\e[31m#{text}\\e[0m\"\n else\n puts \"\\e[33m#{text}\\e[0m\"\n end\nend",
"def msg(text, level = :info)\n case level\n when :warn\n puts \"\\e[31m#{text}\\e[0m\"\n else\n puts \"\\e[33m#{text}\\e[0m\"\n end\nend",
"def none\n Internal::Logging::DevNullLogging::DEV_NULL_LOGGING\n end",
"def notice_missing_feature(name)\n return unless @missing_feature_logger\n\n @missing_feature_logger.call(name)\n end",
"def info_msg(msg=\"\")\n puts(msg)\n @file.puts(msg)\n end",
"def print_none(msg)\n tag = ' '\n print_formatted(tag,msg)\n end",
"def fatal(msg)\r\n prelog\r\n logger.fatal(msg)\r\n end",
"def info(msg)\n puts msg\n end",
"def level\n @level ||= :warn\n end",
"def fatal(*msg, &block)\n log(:fatal, *msg, &block)\n end"
] | [
"0.70054436",
"0.65999097",
"0.65218997",
"0.6402451",
"0.61886585",
"0.5943599",
"0.5842592",
"0.57028",
"0.55858874",
"0.5540516",
"0.5508974",
"0.5400999",
"0.5396245",
"0.53955823",
"0.53819925",
"0.53815335",
"0.53673345",
"0.5352537",
"0.5333538",
"0.5292616",
"0.52878004",
"0.5279454",
"0.5271343",
"0.52677965",
"0.5266404",
"0.52498204",
"0.52162737",
"0.51969606",
"0.51900595",
"0.5185435",
"0.5173043",
"0.5149095",
"0.51388484",
"0.513531",
"0.5119259",
"0.511782",
"0.51150584",
"0.51123166",
"0.5111273",
"0.51024705",
"0.50804216",
"0.50772136",
"0.50687146",
"0.5062039",
"0.50610685",
"0.50594693",
"0.5058226",
"0.5057289",
"0.5034535",
"0.50319946",
"0.502371",
"0.5016879",
"0.498455",
"0.49842936",
"0.49762425",
"0.4976119",
"0.49658042",
"0.49625793",
"0.49429625",
"0.49419016",
"0.49298298",
"0.4925919",
"0.49249238",
"0.49224332",
"0.49192476",
"0.49132475",
"0.49093083",
"0.49093083",
"0.49008915",
"0.48866692",
"0.4885031",
"0.48790327",
"0.48733386",
"0.4870263",
"0.486835",
"0.48631695",
"0.48629963",
"0.48629963",
"0.4862147",
"0.48605698",
"0.48605698",
"0.48573285",
"0.485686",
"0.48511726",
"0.48454833",
"0.48429546",
"0.48427454",
"0.48405173",
"0.48395327",
"0.48340586",
"0.48327702",
"0.48327702",
"0.48309925",
"0.4822936",
"0.48149738",
"0.48144943",
"0.4805853",
"0.48049575",
"0.47998273",
"0.47849834"
] | 0.5244772 | 26 |
Close the logging device. | def close
@logdev.close if @logdev
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n @logdev.close if @logdev\n end",
"def close\n @logdevs.each do |name, ld|\n ld[:dev].close\n end\n end",
"def closeLog()\n @logger.close() ;\n end",
"def close\n flush\n @log.close if @log.respond_to?(:close) && !@log.tty?\n @log = nil\n end",
"def close\n @log_file.close\n end",
"def close\n flush\n @log.close if @log.respond_to?(:close)\n @log = nil\n end",
"def close_log\n if @logging_io && @logging_io != $stdout\n @logging_io.close\n @logging_io = nil\n end\n end",
"def end_logging\n finalize_log_file()\n @logger.close()\n end",
"def close\n checkpoint\n @logfile.close\n end",
"def close\n ensure_handle_is_valid\n DeviceManager::close_device(@handle)\n end",
"def close_logfile\n return unless @__current_logfile\n\n @__current_logfile.close\n logfile = @__current_logfile\n @__current_logfile = nil\n logfile\n end",
"def close\n DeregisterEventSource(@eventlog_handle)\n ensure\n @eventlog_handle = nil\n end",
"def close\n\t\trequest = Packet.create_request('stdapi_sys_eventlog_close')\n\n\t\trequest.add_tlv(TLV_TYPE_EVENT_HANDLE, self.handle);\n\n\t\tresponse = client.send_request(request)\n\t\treturn nil\n\tend",
"def do_close\n @logger.debug(\"closing\", :plugin => self.class.name)\n close\n end",
"def close\n if threaded?\n @dump_queue.push nil\n @dump_thread.join\n end\n ensure\n logfile.close\n end",
"def close\n @closed = true\n @on_close and @on_close.call\n end",
"def close\n send_termination_event\n end",
"def close\n SLPClose(@handle)\n end",
"def close\n\n # nothing to do here.\n end",
"def close\n return if @ptr.nil?\n\n ObjectSpace.undefine_finalizer(self) if @finalize\n Native.sd_journal_close(@ptr)\n\n @ptr = nil\n end",
"def game_close\n @console_delegate.close\n end",
"def close!\n close(true)\n end",
"def close\n _do_if_open { _handle_closed! ; Dnet.fw_close(@handle) }\n end",
"def close\n close!\n end",
"def close\n # Force full flush call to ensure that all accumulated messages are flushed.\n buffer_flush(:final => true)\n end",
"def close\n return if @fileformat == nil\n\n @device.close unless @device == nil || @device.closed?\n end",
"def close\n @fh.close\n end",
"def close\n @ios.each(&:close)\n end",
"def close\n\t remove_common_event_handlers\n\t remove_specific_event_handlers\n\t sleep 0.2\n Phidgets::FFI::Common.close(@handle) \n\t delete\n true\n end",
"def close\n self.disconnect\n end",
"def close()\n @closed = true\n end",
"def close_console\n self.destroy\n end",
"def closeLog_old()\n @logStreamList.each{|strm|\n strm.close() if(strm.is_a?(File)) ;\n }\n end",
"def close\n # no-op\n end",
"def close\n Highgui.release_capture(FFI::MemoryPointer.new(:pointer).write_pointer(@capture_handler))\n @capture_handler = nil\n end",
"def close(context)\n context.debug('Logout connection')\n @connection_info = nil\n @client.logout\n @client = nil\n @system = nil\n end",
"def reopen(logdev = nil)\n flush\n end",
"def close\r\n CloseEventLog(@handle)\r\n end",
"def close!\n # Not implemented\n end",
"def close!\n finish!\n @fd.close\n end",
"def close\n handler.close\n end",
"def close\n\t\t\tKernel.exit 0\n\t\tend",
"def close\n $stdout.puts if @debug\n @leds = nil\n end",
"def close_on_terminate\n @close_on_terminate = true\n end",
"def close_on_terminate\n @close_on_terminate = true\n end",
"def close\n @log.info { \"Closing connection to client #{@ip}\" }\n @socket.close\n end",
"def close\n @closed = true\n end",
"def close\n @handler.close if @handler\n @handler = nil\n end",
"def close\n UV.close(@handle)\n self.emit('close')\n @handle = nil\n end",
"def close!\n end",
"def close\n $file.close\t\t\t\t# Closes the log file\n puts \"Files flushed properly\"\t\t# Basically means that file has been closed properly instead of force quitting which MAY/COULD result in \t\t\t\t\t\t#memory leaks\n abort(\"Exiting\")\t\t\t# Actually exits the game but not before outputting 'Exiting'\nend",
"def close\n each_ios(&:close)\n nil\n end",
"def close_write\n if @output.respond_to?(:close)\n @output&.close\n end\n\n @output = nil\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n # NOOP\n end",
"def close\n # NOOP\n end",
"def close\n @io.close\n end",
"def close\n @io.close\n end",
"def close\n logger.debug \"Closing #{self.class}##{object_id}\"\n @input.close unless @input.nil?\n @input = nil\n @output.close unless @output.nil?\n @output = nil\n end",
"def close\n @h.close\n end",
"def close\n close_data_file\n end",
"def close()\n @connection.disconnect\n @connection = nil\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n end",
"def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end",
"def close\n C.snd_rawmidi_close(@output)\n end",
"def close\n CoreServices::asl_close_output_file(@context, @dest.to_i) if @dest\n CoreServices::asl_finalize_context(@context)\n @context = nil\n end",
"def stream_close\n self[STREAM_CLOSE].call\n end",
"def close\n @io.close\n end",
"def close\n stop_monitoring_connection\n close_connection\n end",
"def close()\n\t\t@connection.disconnect\n\t\t@connection = nil\n\tend",
"def close\n # ..\n end",
"def close\n @closed = true\n end",
"def close\n close_client_connections\n @event_file.close\n end",
"def stop_logs_broadcast\n @logcat_client.close\n\n @driver.execute_script 'mobile: stopLogsBroadcast'\n end",
"def close!\n safe_close\n end",
"def close\n nil\n end",
"def on_close\n on :close\n close\n end",
"def close()\n #This is a stub, used for indexing\n end",
"def close\n unregister\n end",
"def close\n @handle.closeFile\n @handle = nil\n end",
"def _close\n end",
"def close\n end",
"def close\n end",
"def close\n @_io.close\n end"
] | [
"0.81122386",
"0.7884688",
"0.7607325",
"0.75072706",
"0.74091536",
"0.7402672",
"0.73840773",
"0.7304757",
"0.71073735",
"0.6899726",
"0.68814754",
"0.68182427",
"0.6670712",
"0.6466136",
"0.6224144",
"0.6173834",
"0.61599284",
"0.6155557",
"0.61449194",
"0.6142942",
"0.60996485",
"0.60906464",
"0.6073539",
"0.60625476",
"0.6061303",
"0.6059026",
"0.60541487",
"0.6050338",
"0.6047511",
"0.6045375",
"0.6025348",
"0.602456",
"0.60240084",
"0.59800315",
"0.596509",
"0.59583026",
"0.5955278",
"0.5945297",
"0.5939534",
"0.59267",
"0.59222865",
"0.59129",
"0.5909186",
"0.5901012",
"0.5901012",
"0.5895933",
"0.5894803",
"0.58799297",
"0.5878844",
"0.5877041",
"0.5868524",
"0.5850544",
"0.5847962",
"0.58477247",
"0.58477247",
"0.58477247",
"0.58477247",
"0.58477247",
"0.58477247",
"0.58477247",
"0.58477247",
"0.58477247",
"0.5844774",
"0.5844774",
"0.58447355",
"0.58447355",
"0.58073515",
"0.58049655",
"0.57816577",
"0.57752264",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5762338",
"0.5758554",
"0.57582474",
"0.57577515",
"0.5748435",
"0.5736243",
"0.57312816",
"0.57298934",
"0.5728244",
"0.5722011",
"0.5721782",
"0.5713129",
"0.571308",
"0.5704634",
"0.5697047",
"0.5695809",
"0.5693257",
"0.5691086",
"0.5689572",
"0.5682872",
"0.5682872",
"0.56800383"
] | 0.81379324 | 0 |
GET /teams GET /teams.json | def index
@teams = policy_scope(Team)
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end",
"def teams\n render json: @team_query\n end",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end",
"def team(id)\n get \"/teams/#{id}\"\n end",
"def index\n @teams = Team.all\n render :json => @teams\n end",
"def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end",
"def show\n # @teams = ::Services::TeamService.show_teams\n end",
"def show\n @team = Team.find(params[:id])\n\n render json: @team\n end",
"def teams(org)\n get \"/orgs/#{org}/teams\"\n end",
"def index\n @teams = Team.all.order(:name)\n if params[:all]\n json_response(TeamSerializer, @teams)\n else\n @teams_paginated = @teams.page(current_page, per_page).per(per_page)\n json_response(TeamSerializer, @teams_paginated, options(@teams))\n end\n end",
"def get_teams_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\nend",
"def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.json.jbuilder'\n\tend",
"def show\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def index\n if current_user_total?\n @teams = Team.order(:description).page(params[:page]).per(5)\n else\n ids = []\n tus = TeamUser.where(user_id: current_user.id)\n tus.each do |tu| # user_id | team_id\n ids << tu.team_id # [1, 6, 7]\n end\n\n return @teams = Team.where(id: ids).order(:description).page(params[:page]).per(5)\n end\n=======\n\n # GET /teams\n # GET /teams.json\n def index\n @teams = Team.order(:description).page(params[:page]).per(5)\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end\n\n # GET /teams/1\n # GET /teams/1.json\n def show\n<<<<<<< HEAD\n=======\n @team = Team.find(params[:id])\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end",
"def index\n @teams = Team.page(params[:page])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def index\n @teams = current_user.teams\n end",
"def index\n @teams = current_user.teams\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def get_teams\n reply = @client.call(:get_teams)\n data = reply.body.dig(:get_teams_response,\n :get_teams_result,\n :string)\n check_if_data_exists(data)\n rescue Savon::HTTPError => error\n logger.debug error.http.code\n return []\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @league }\n end\n end",
"def index\n\t\t@teams = Team.all\n\tend",
"def team\n fetch('esport.teams')\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n render status: 200, json: Team.find(params[:id])\n end",
"def index\n @teams = @organization.teams\n end",
"def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end",
"def show\n team = Team.find_by(:id => params[:id])\n render :json => team\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end",
"def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end",
"def index\n\t\t@teams = Team.all\n\t\trender '/teams/index.json.jbuilder'\n\tend",
"def list_teams_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TeamApi.list_teams ...\"\n end\n # resource path\n local_var_path = \"/v2/teams\"\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 = ['GenieKey']\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 => 'ListTeamsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamApi#list_teams\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n # @teams = Team.all\n \n redirect_to \"/members\"\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @teams }\n # end\n end",
"def index\n @user_teams = UserTeam.all\n end",
"def get_team(params = {})\n params = Utils.symbolize_hash_keys(params)\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def get_project_teams(project_id_or_key)\n get(\"projects/#{project_id_or_key}/teams\")\n end",
"def index\n @users_teams = UsersTeam.all\n end",
"def team\n @team = Team.where('team_id = ?', params[:id])\n @active_stats = ActiveStat.where('team_id = ?', params[:id])\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def teams\n @teams ||= @api.client.orgs.teams.list(org: @org)\n end",
"def index\n @teams = @competition.teams.sort_by{|t| t.number}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def get_teams_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TeamsApi.get_teams ...'\n end\n # resource path\n local_var_path = '/teams'\n\n # query parameters\n query_params = {}\n query_params[:'conference'] = opts[:'conference'] if !opts[:'conference'].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 = []\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 => 'Array<Team>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TeamsApi#get_teams\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @teams = Team.order(:id).page(params[:page]).per(10)\n end",
"def teams\n @teams\n end",
"def get_teams( org )\n teams = Homework.get(\"/orgs/#{org}/teams\", :headers => @auth)\n teams.each do |team|\n puts team['id']\n end\n end",
"def show\n @user_teams = @game.team.user_teams\n end",
"def org_teams(org)\n Hardmode.get(\"/orgs/#{org}/teams\", :headers => @auth)\n end",
"def show\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimate_team }\n end\n end",
"def user_team(team_id)\n get(\"/user_teams/#{team_id}\")\n end",
"def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end",
"def app_teams(org_name:, platform:, app_id:)\n endpoint = \"/api/organizations/#{org_name}/platforms/#{platform}\"\\\n \"/apps/#{app_id}/teams\"\n res = api.get endpoint\n Response.new(res)\n end",
"def get_event_teams ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/teams\"\n end",
"def teams\n @teams ||= ApiFactory.new 'Orgs::Teams'\n end",
"def index\n\t\t@teams = Team.order(\"name ASC\").all\n\n\t\t# Pulls upcoming fixtures in Premier League\n\t\t@data = party_time(\"http://api.statsfc.com/premier-league/fixtures.json?key=DThzCPsM_TI0XUGeUOJqr26JHwtYXVIfYvSSb0ui&timezone=America/New_York&limit=10\")\n\n\t\t# Pulls top scorers in Premier League\n\t\t@data2 = party_time(\"http://api.statsfc.com/top-scorers.json?key=DThzCPsM_TI0XUGeUOJqr26JHwtYXVIfYvSSb0ui&competition=premier-league&year=2013/2014&limit=10\")\t\n\n\t\t# Pulls news articles about the league through Google RSS\n\t\tdata = party_time(\"https://news.google.com/news/feeds?q=barclays+premier+league&output=rss\")\n\t\t@articles = data[\"rss\"][\"channel\"][\"item\"]\n\tend",
"def index\n @games_teams = GamesTeam.all\n end",
"def get_teams\n TeamNode.get(node_object_id)\n end",
"def index\n @teams = current_user.recent_teams\n end",
"def load_teams\n tell \"Loading teams...\" unless options.quiet?\n teams = []\n\n doc = Nokogiri::HTML(open(TEAMS_URL))\n div1a = doc.css('div.mod-container > div.span-2').first\n list = div1a.css('div.mod-teams-list-medium ul li')\n \n list.each do |t|\n a_tag = t.search('h5 > a').first\n id = a_tag['href'].match(/_\\/id\\/([\\d]+)\\/.+\\Z/)[1]\n name = a_tag.content\n teams.push({:id => id, :name => name})\n end\n\n teams.sort_by { |team| team[:name] }\n end",
"def index\n @mens_teams = MensTeam.all\n end",
"def teams\n parse_domain_top '/Teams/TeamList.aspx', 'lnkTeamInfo'\n end",
"def team_information_list\n @teams = Team.find_teams_by_user(session[:user_id])\n \n end",
"def show\n @swim_team = SwimTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swim_team }\n end\n end",
"def show\n\n \t\t\trespond_with @team\n\n \t\tend",
"def get_team_details(params)\n get('team', params)\n end",
"def all_teams_in_league\n \treturnArray = []\n\t\tbase_uri = 'https://www.thesportsdb.com/api/v1/json/1/search_all_teams.php?l=' + @league_name.to_s\n\t\tresponse = RestClient.get(base_uri)\n\t\tjson_response = JSON.parse(response)\n\t\thashIds = json_response['teams'] \n\t\thashIds.length.times do |i|\n\t\t\treturnArray[i] = \"Team ID: #{hashIds[i]['idTeam']}, Name: #{hashIds[i]['strTeam']}, Short Name: #{hashIds[i]['strTeamShort']}, Formed Year: #{hashIds[i]['intFormedYear']}, Sport: #{hashIds[i]['strSport']}, Alternate Name: #{hashIds[i]['strAlternateName']}\"\n\t\tend\n\t\treturn returnArray\n\tend",
"def get\n service_response = ManagerManagement::Team::Get.new(params).perform\n return render_api_response(service_response)\n end",
"def index\n\t\t@team = Team.find(params[:team_id])\n\tend",
"def index\n @teams = Team.order(:description).page(params[:page]).per(5)\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n\t\tmembers = Member.where(team_id: params[:team_id]).all\n\t\trespond_with members\n\tend"
] | [
"0.81233996",
"0.8093715",
"0.78999794",
"0.78722113",
"0.78547835",
"0.78078264",
"0.7747201",
"0.77240586",
"0.77240586",
"0.76768875",
"0.76768875",
"0.7509183",
"0.748406",
"0.74762034",
"0.7434379",
"0.7405707",
"0.738585",
"0.73797023",
"0.73748475",
"0.73599476",
"0.7348547",
"0.7348547",
"0.7327408",
"0.7310985",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7307202",
"0.7301507",
"0.7300436",
"0.7277264",
"0.7245222",
"0.7245222",
"0.7245222",
"0.7245222",
"0.724455",
"0.7243269",
"0.7241881",
"0.7235316",
"0.71967894",
"0.7196733",
"0.71881753",
"0.71829146",
"0.71707696",
"0.71510035",
"0.71252704",
"0.711344",
"0.7109858",
"0.7069363",
"0.7067806",
"0.7058983",
"0.7032325",
"0.70113534",
"0.70083153",
"0.7007239",
"0.70044684",
"0.7001454",
"0.7000331",
"0.699491",
"0.6984708",
"0.6973587",
"0.6971218",
"0.6969064",
"0.6951376",
"0.693093",
"0.6930197",
"0.69199103",
"0.69005525",
"0.6894487",
"0.6893299",
"0.6874521",
"0.6866087",
"0.68473387",
"0.6843824",
"0.68262994",
"0.6817829",
"0.6816209",
"0.67961437",
"0.6793898",
"0.67862207",
"0.6779673"
] | 0.0 | -1 |
GET /teams/1 GET /teams/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team(id)\n get \"/teams/#{id}\"\n end",
"def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end",
"def show\n @team = Team.find(params[:id])\n\n render json: @team\n end",
"def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.json.jbuilder'\n\tend",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def index\n @teams = @club.teams\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def index\n @teams = Team.all\n render :json => @teams\n end",
"def show\n render status: 200, json: Team.find(params[:id])\n end",
"def show\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def show\n team = Team.find_by(:id => params[:id])\n render :json => team\n end",
"def teams\n render json: @team_query\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end",
"def index\n @teams = Team.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teams }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @league }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end",
"def show\n @team = Team.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end",
"def index\n if current_user_total?\n @teams = Team.order(:description).page(params[:page]).per(5)\n else\n ids = []\n tus = TeamUser.where(user_id: current_user.id)\n tus.each do |tu| # user_id | team_id\n ids << tu.team_id # [1, 6, 7]\n end\n\n return @teams = Team.where(id: ids).order(:description).page(params[:page]).per(5)\n end\n=======\n\n # GET /teams\n # GET /teams.json\n def index\n @teams = Team.order(:description).page(params[:page]).per(5)\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end\n\n # GET /teams/1\n # GET /teams/1.json\n def show\n<<<<<<< HEAD\n=======\n @team = Team.find(params[:id])\n>>>>>>> d0c6183c3349cba16c54d8ce4c0fb5ee26c49700\n end",
"def get_team ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}\"\n end",
"def index\n @teams = Team.page(params[:page])\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def show\n # @teams = ::Services::TeamService.show_teams\n end",
"def show\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ultimate_team }\n end\n end",
"def get_teams_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}teams/league/#{league_id}\")[\"teams\"]\nend",
"def team\n @team = Team.where('team_id = ?', params[:id])\n @active_stats = ActiveStat.where('team_id = ?', params[:id])\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all\n end",
"def index\n @teams = Team.all.order(:name)\n if params[:all]\n json_response(TeamSerializer, @teams)\n else\n @teams_paginated = @teams.page(current_page, per_page).per(per_page)\n json_response(TeamSerializer, @teams_paginated, options(@teams))\n end\n end",
"def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n end",
"def index\n\t\t@teams = Team.all\n\tend",
"def show\n @swim_team = SwimTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @swim_team }\n end\n end",
"def index\n\t\t@team = Team.find(params[:team_id])\n\tend",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def index\n\t\t@teams = Team.all\n\t\trender '/teams/index.json.jbuilder'\n\tend",
"def index\n # @teams = Team.all\n \n redirect_to \"/members\"\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @teams }\n # end\n end",
"def show\n @team = Team.find(params[:id])\n end",
"def show\n @team = Team.find(params[:id])\n end",
"def get_team(params = {})\n params = Utils.symbolize_hash_keys(params)\n query_params = { }\n headers = {}\n body = nil\n\n path = \"/team\"\n\n @client.request(\n method: :get,\n path: path,\n query: query_params,\n headers: headers,\n body: body)\n end",
"def index\n @teams = current_user.teams\n end",
"def index\n @teams = current_user.teams\n end",
"def team\n fetch('esport.teams')\n end",
"def index\n @teams = @organization.teams\n end",
"def user_team(team_id)\n get(\"/user_teams/#{team_id}\")\n end",
"def index\n @teams = @competition.teams.sort_by{|t| t.number}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teams }\n end\n end",
"def show\n @team = Team.find(params[:id])\n @runners = @team.runners\n @count = @runners.length\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team }\n end\n end",
"def show\n\t\t@team = Team.find(params[:id])\n\tend",
"def new\n @teammate = Teammate.new\n @teams = Hackathon.find(params[:hackathon_id]).teams\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teammate }\n end\n end",
"def show\n @id = @my_team.team_id\n @team_name = Teams.find(@id)\n roster = RestClient.get(\"https://statsapi.web.nhl.com/api/v1/teams/#{@id}/roster\")\n @roster = JSON.parse(roster)[\"roster\"]\n end",
"def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end",
"def show\n\n \t\t\trespond_with @team\n\n \t\tend",
"def index\n @teams = Team.order(:id).page(params[:page]).per(10)\n end",
"def team( team_id )\n\n if( team_id.is_a?(String) && team_id.is_a?(Integer) )\n raise ArgumentError.new(format('wrong type. user \\'team_id\\' must be an String (for an Team name) or an Integer (for an Team Id), given \\'%s\\'', team_id.class.to_s))\n end\n raise ArgumentError.new('missing \\'team_id\\'') if( team_id.size.zero? )\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'team has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n if(team_id.is_a?(String))\n o_team = search_team(name: team_id)\n status = o_team.dig('status')\n total_count = o_team.dig('totalCount')\n\n return { 'status' => 404, 'message' => format( 'No Team \\'%s\\' found', team_id) } unless(status == 200 && total_count > 0)\n\n teams = o_team.dig('teams')\n team = teams.detect { |x| x['name'] == team_id }\n team_id = team.dig('id')\n end\n\n endpoint = format( '/api/teams/%s', team_id )\n\n @logger.debug(\"Getting team by Id #{team_id} (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\n end\n end",
"def index\n @team = Team.find(params[:team_id])\n @sprints = @team.sprints.find(:all)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @nba_team = NbaTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nba_team }\n end\n end",
"def teams(org)\n get \"/orgs/#{org}/teams\"\n end",
"def get\n service_response = ManagerManagement::Team::Get.new(params).perform\n return render_api_response(service_response)\n end",
"def index\n @user_teams = UserTeam.all\n end",
"def get_team_details(params)\n get('team', params)\n end",
"def show\n @team=Team.find(params[:id])\n end",
"def index\n @team = Team.find(params[:team_id])\n @players = @team.players\n end",
"def show\n @team = Team.where(:id=>params[:id]).first\n end",
"def get_project_teams(project_id_or_key)\n get(\"projects/#{project_id_or_key}/teams\")\n end",
"def get_teams( org )\n teams = Homework.get(\"/orgs/#{org}/teams\", :headers => @auth)\n teams.each do |team|\n puts team['id']\n end\n end",
"def show\n @teamming = Teamming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teamming }\n end\n end",
"def show\n @teammate = Teammate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teammate }\n end\n end",
"def index\n @games_teams = GamesTeam.all\n end",
"def get_team_name_by_id(team_id)\n response = parse_api_request(\"#{BASE_URL}teams/team/#{team_id}\")[\"teams\"].values.first[\"name\"]\nend",
"def index\n @teams = Team.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end",
"def index\n @users_teams = UsersTeam.all\n end",
"def get_players_by_team(team_id)\n response = parse_api_request(\"#{BASE_URL}players/2018/#{team_id}\")[\"players\"]\nend",
"def team\n @club = Club.find(params[:id])\n\n respond_to do |format|\n format.html #team.html.erb\n end\n end",
"def show\n @user = User.find(params[:id])\n @teams = TeamPlayer.where(:user_id => params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def show\n @user_teams = @game.team.user_teams\n end",
"def show\n @sales_team = SalesTeam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_team }\n end\n end"
] | [
"0.79965734",
"0.7839026",
"0.77549696",
"0.7668721",
"0.76588887",
"0.7612523",
"0.7592633",
"0.75889164",
"0.75806767",
"0.7573229",
"0.7573229",
"0.7572959",
"0.7543039",
"0.7533832",
"0.7533832",
"0.75130427",
"0.75130427",
"0.75130427",
"0.75130427",
"0.747294",
"0.7471413",
"0.74712056",
"0.7338054",
"0.73112506",
"0.72966003",
"0.7296313",
"0.7288566",
"0.7254408",
"0.72103345",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7157142",
"0.7150474",
"0.7142374",
"0.7104",
"0.7095558",
"0.7091905",
"0.7087202",
"0.7074083",
"0.7048957",
"0.7031196",
"0.7031196",
"0.70009905",
"0.6971664",
"0.6971664",
"0.6957333",
"0.69423765",
"0.6936346",
"0.69206333",
"0.6914471",
"0.6910428",
"0.6901726",
"0.6895425",
"0.68819726",
"0.68807393",
"0.68695533",
"0.68513054",
"0.6845099",
"0.68333346",
"0.68304145",
"0.68271446",
"0.6824016",
"0.68217105",
"0.68155235",
"0.6811259",
"0.68044645",
"0.6786963",
"0.6767461",
"0.6754562",
"0.6752242",
"0.6730595",
"0.6705941",
"0.66998875",
"0.669911",
"0.66971004",
"0.6693567",
"0.6693292",
"0.6690718",
"0.668625",
"0.66765445"
] | 0.0 | -1 |
POST /teams POST /teams.json | def create
@team = Team.new(team_params)
authorize @team
current_user.update team: @team
respond_to do |format|
if @team.persisted?
format.html { redirect_to @team, notice: 'Team was successfully created.' }
format.json { render :show, status: :created, location: @team }
else
format.html { render :new }
format.json { render json: @team.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end",
"def create\n @team = Team.new(params[:team])\n\n if @team.save\n render json: @team, status: :created, location: @team\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to '/teams', notice: 'Team was successfully created.' }\n format.json { render :index, status: :created }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team(name, params = {})\n params[:name] = name\n post('teams', params)\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, :notice => 'Team was successfully created.' }\n format.json { render :json => @team, :status => :created, :location => @team }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\n team.save\r\n\r\n end \r\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\tif @team.save\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend",
"def create\n @team = Team.new(team_params)\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @race.teams.build team_params\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to [@race, @team], notice: I18n.t(:create, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if team.save\n format.html { redirect_to team, notice: 'Team was successfully created.' }\n format.json { render json: team, status: ':created', location: team }\n else\n format.html { render action: 'new' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.create({:name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to root_path, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tTeam.create(params[:team])\n\n\t\tredirect_to teams_path\n\tend",
"def create\n @team = Team.new(params.required(:team).permit!)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team created successfully.' }\n format.json { render :my_team, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @competition.teams.build(params[:team])\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html do\n flash[:notice] = 'Team was successfully created.'\n current_user.is_admin? ? (redirect_to teams_path) : (redirect_to user_teams_path(current_user))\n end\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_team = UserTeam.new(user_team_params)\n\n respond_to do |format|\n if @user_team.save\n format.html { redirect_to @user_team, notice: 'User team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n begin\n @team.save!\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n rescue => e\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(params[:team])\n @team.user = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html { redirect_to @team, notice: 'Team was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @swim_team = SwimTeam.new(params[:swim_team])\n\n respond_to do |format|\n if @swim_team.save\n format.html { redirect_to swim_teams_path(), notice: 'Swim team was successfully created.' }\n format.json { render json: @swim_team, status: :created, location: @swim_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @swim_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end",
"def create\n @games_team = GamesTeam.new(games_team_params)\n\n respond_to do |format|\n if @games_team.save\n format.html { redirect_to @games_team, notice: 'Games team was successfully created.' }\n format.json { render :show, status: :created, location: @games_team }\n else\n format.html { render :new }\n format.json { render json: @games_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n @team.users << current_user\n\n respond_to do |format|\n if @team.save\n setup_team(@team)\n format.html { redirect_to user_root_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n \t\t\t@team = Team.new team_params\n\n \t\t\tif @team.save\n\n \t\t\t\trender json: @team,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend",
"def create\n @ultimate_team = UltimateTeam.new(params[:ultimate_team])\n\n respond_to do |format|\n if @ultimate_team.save\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully created.' }\n format.json { render json: @ultimate_team, status: :created, location: @ultimate_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(_team)\n # stub\n end",
"def create\n @my_team = MyTeam.new(my_team_params)\n\n respond_to do |format|\n if @my_team.save\n format.html { redirect_to @my_team, notice: 'My team was successfully created.' }\n format.json { render :show, status: :created, location: @my_team }\n else\n format.html { render :new }\n format.json { render json: @my_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teams\n render json: @team_query\n end",
"def create\n puts \"IN CREATE ACTION\"\n if(current_user.role == \"guest\")\n redirect_to login_url and return\n end\n @coaches = Coach.all\n @divisions = Division.all\n @organizations = Organization.all\n @students = Student.all\n @team = Team.new(team_params)\n\n unless current_user.coach.nil?\n @team_organization = current_user.coach.organization\n #@team_name = @team.organization.short_name + \" \" + (@team.organization.teams.count+1).to_s\n @team.organization_id = @team_organization.id\n #@team.name = @team_name\n end\n\n puts \"TEAM IS #{@team.valid?} -- #{@team.to_yaml}\"\n \n respond_to do |format|\n if @team.save\n params[:team][:student_teams_attributes].each do |sta|\n st = StudentTeam.new\n puts \"PREVIEW -- #{@team.id} :: #{sta[1][1]}\"\n # @team.student_teams.each do |st|\n st.team_id = 86\n st.student_id = sta[1][1]\n if st.save\n puts \"StudentTeam ID: #{st.id}\"\n else\n puts \"FAIL\"\n end\n end\n format.html { redirect_to edit_team_url(@team), notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.find_by_name(params[:team][:team_name])\n if @team.nil?\n @team = Team.new(captain_id: params[:team][:captain_id],\n\t\t team_name: params[:team][:team_name])\n\n respond_to do |format|\n if @team.save\n format.json { render json: @team, status: :created, location: @team }\n if params[:players]\n \tTeamPlayers.create(params[:players], team_name: @team.name)\n end\n else\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n else \n Team.update(params[:team])\n end\n end",
"def create\n\t\t# league admin can add\n\t\t# anyone can add (own team) as pending iff league is addable\n\t\tds = DivisionSeason.find params[:division_season_id]\n\t\tteam = Team.find team[:team_id]\n\n\t\tif can? :manage_teams, ds\n\t\t\tTeamDSService.add_team(ds, team)\n\t\telse\n\t\t\tauthorize! :add_team, ds\n\t\t\tTeamDSService.add_pending_team(ds, team)\n\t\tend\n\n\t\trespond_with tdsr\n\tend",
"def create\n @team = current_user.teams.new(team_params)\n @league = League.find_by(id: params[:league_id])\n @team.league = @league\n if @team.save\n LeagueInvite.where(email: current_user.email, league: @league).destroy_all\n flash[:success] = \"Added team to league\"\n if @league.teams.count == 10 && current_season = Season.current.first\n if LeagueSeason.where(league: @league, season: current_season).count == 0\n LeagueSeason.create(league: @league, season: current_season)\n end\n end\n redirect_to league_players_path(@league)\n else\n render action: :new\n end\n end",
"def create\n match_day_team = MatchDayTeam.new(match_day_team_params)\n if match_day_team.save\n render json: match_day_team, status: 201, location: [:api, match_day_team]\n else\n failed_to_create(match_day_team, \"match_day_team\")\n end\n end",
"def create\n @users_team = UsersTeam.new(users_team_params)\n\n respond_to do |format|\n if @users_team.save\n format.html { redirect_to @users_team, notice: 'Membro adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @users_team }\n else\n format.html { render :new }\n format.json { render json: @users_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n # current_game.users.push(@team)\n format.html { redirect_to teams_path, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @team.save\n flash[:notice] = 'Team was successfully created.'\n @changed << @team.id\n \n format.html { redirect_to teams_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @team, status: :created, location: @team }\n else\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'team'; flash.discard }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @team = @competition.teams.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def create_user_team(name, path)\n post(\"/user_teams\", :body => {:name => name, :path => path})\n end",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@team = Team.new(team_params)\n\n\t\trespond_to do |format|\n\t\t\tif @team.save\n\t\t\t\tformat.html do\n\t\t\t\t\t# Add current user to team.\n\t\t\t\t\tmembership = Membership.new\n\t\t\t\t\tmembership.user_id = current_user.id\n\t\t\t\t\tmembership.team_id = @team.id\n\t\t\t\t\tmembership.started_at = DateTime.now\n\n\t\t\t\t\tredirect_to @team, notice: \"Team was successfully created.\", alert: (membership.save ? nil : \"Could not join created team.\")\n\t\t\t\tend\n\t\t\t\tformat.json { render action: \"show\", status: :created, location: @team }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @team.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @mens_team = MensTeam.new(mens_team_params)\n\n respond_to do |format|\n if @mens_team.save\n format.html { redirect_to @mens_team, notice: 'Mens team was successfully created.' }\n format.json { render :show, status: :created, location: @mens_team }\n else\n format.html { render :new }\n format.json { render json: @mens_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_team = EventTeam.new(event_team_params)\n\n respond_to do |format|\n if @event_team.save\n format.html { redirect_to @event_team, notice: 'Event team was successfully created.' }\n format.json { render :show, status: :created, location: @event_team }\n else\n format.html { render :new }\n format.json { render json: @event_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new\n @team.name = team_params[:name]\n @team.captain = current_user\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n student_ids = params[:student_ids].to_a\n student_ids.each_with_index do |student_id|\n student = Student.where(id: student_id.to_i).first\n @team.students << student\n end\n end",
"def create\n unless current_user.instructor\n render :nothing => true, :status => :unauthorized\n end\n \n # create team\n team = Team.create(name: params[:team_name], course: $selected_course)\n\n # add students to teams\n student_ids = params[:student_ids]\n student_ids.each do |student_id|\n StudentTeam.create(student_id: student_id, team: team)\n end\n\n render json: { success: true }\n end",
"def create\n @team = Team.new(team_params)\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: \"Team was successfully created.\" }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n newTeam = TeamMemberRelation.new()\n newTeam.team_id = @team.id\n newTeam.user_id = session[:user]\n newTeam.team_role_id = 1\n newTeam.save\n end",
"def create\n @admin_team = Team.new(admin_team_params)\n\n respond_to do |format|\n if @admin_team.save\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @admin_team }\n else\n format.html { render :new }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team_member\n clinics = params[:clinics].split(\", \")\n\n team_member = TeamMember.create(\n email: params[:email],\n first_name: params[:first_name],\n last_name: params[:last_name],\n user: params[:user],\n status: \"Active\",\n role: params[:role]\n )\n\n clinics.each do |clinic|\n Clinic.find(clinic).team_members << team_member\n end\n\n render json: team_member, include: ['clinics']\n end",
"def create\n @team = Team.new(team_params)\n if @team.save\n flash[:notice] = \"Team successfully created\"\n redirect_to teams_url\n else\n render \"new\"\n end\n end",
"def create\n @team = Team.new(team_params)\n @team.slug = @team.name.downcase.gsub(\" \", \"-\")\n\n @team.community_rating = 0\n\n # Set default picture url\n if !@team.picture_url\n @team.picture_url = 'https://d13yacurqjgara.cloudfront.net/users/205424/screenshots/1953810/pandamoniumshot.png'\n end\n\n @user = User.find(session[:session_key])\n\n respond_to do |format|\n if @team.save\n @team.users.push(@user)\n @team.users\n @team.save\n user_teams = @team.user_teams.find_by(user_id: @user.id)\n user_teams.role = params[:role]\n user_teams.status = 1\n user_teams.save!\n\n # TODO: Add game to user profile if it's not already there\n\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n team_name = params[:name]\n description = params[:description]\n\n @okr_team = OkrTeam.new(name: team_name, description: description)\n\n respond_to do |format|\n if @okr_team.save\n format.json { render json: 'Team is created successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def new\n @teammate = Teammate.new\n @teams = Hackathon.find(params[:hackathon_id]).teams\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teammate }\n end\n end",
"def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', :body => opts)\n end",
"def create\n @sports_team = SportsTeam.new(sports_team_params)\n\n respond_to do |format|\n if @sports_team.save\n format.html { redirect_to @sports_team, notice: 'Sports team was successfully created.' }\n format.json { render :show, status: :created, location: @sports_team }\n else\n format.html { render :new }\n format.json { render json: @sports_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n\n @membership = Membership.new(team_id: @team.id, player_id: @team.player_id)\n @membership.save\n end",
"def create\n @manage_team = ManageTeam.new(manage_team_params)\n\n respond_to do |format|\n if @manage_team.save\n format.html { redirect_to @manage_team, notice: 'Manage team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @manage_team }\n else\n format.html { render action: 'new' }\n format.json { render json: @manage_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @teams = Team.all\n render :json => @teams\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def create\n @users = User.active\n @team = Team.new(team_params)\n @projects = Project.active\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', body: opts)\n end",
"def create\n @sales_team = SalesTeam.new(params[:sales_team])\n\n respond_to do |format|\n if @sales_team.save\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully created.' }\n format.json { render json: @sales_team, status: :created, location: @sales_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def team_params\n params.require(:team).permit(:name, :description, :company_id, :opportunity_ids => [], :team_ids => [])\n end",
"def create\n @ab_team = AbTeam.new(ab_team_params)\n\n respond_to do |format|\n if @ab_team.save\n format.html { redirect_to @ab_team, notice: 'Record was created.' }\n format.json { render :show, status: :created, location: @ab_team }\n else\n format.html { render :new }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = fetch_team\n authorize @team\n @team.owners << current_user\n\n if @team.save\n @team.create_activity(:create,\n owner: current_user,\n parameters: { team: @team.name })\n respond_with(@team)\n else\n respond_with @team.errors, status: :unprocessable_entity\n end\n end",
"def create\n @mission_team = @game.mission_teams.new(mission_team_params)\n\n respond_to do |format|\n if @mission_team.save\n format.html { redirect_to [@game, @mission_team], notice: 'Mission team was successfully created.' }\n format.json { render :show, status: :created, location: @mission_team }\n else\n format.html { render :new }\n format.json { render json: @mission_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @monster_team = MonsterTeam.new(monster_team_params)\n\n respond_to do |format|\n if @monster_team.save\n format.html { redirect_to monster_teams_path, notice: 'Monster team was successfully created.' }\n format.json { render :show, status: :created, location: @monster_team }\n else\n format.html { render :new }\n format.json { render json: @monster_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def create\n @team = @project.ae_teams.new(team_params)\n if @team.save\n redirect_to editor_project_ae_team_path(@project, @team), notice: \"Team was successfully created.\"\n else\n render :new\n end\n end",
"def create_teams\n parent = Object.const_get(session[:team_type]).find(params[:id])\n Team.randomize_all_by_parent(parent, session[:team_type], params[:team_size].to_i)\n undo_link(\"Random teams have been successfully created.\")\n ExpertizaLogger.info LoggerMessage.new(controller_name, '', 'Random teams have been successfully created', request)\n redirect_to action: 'list', id: parent.id\n end",
"def create\n unless team_registrable?\n respond_to do |format|\n format.html { redirect_to teams_path, alert: 'Team registration is closed.' }\n format.json { render json: { status: 'closed' } }\n end\n return\n end\n\n @team = Team.new(team_params)\n\n respond_to do |format|\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team }\n else\n format.html { render action: 'new' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @organization.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n current_user.add_role :admin, @team\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_teams\n number_of_teams.to_i.times do |i|\n self.teams << Team.create!(:name => TEAM_NAMES[i])\n end\n end",
"def new\n @team = Team.new\n @sports = Sport.all\n @levels = Level.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def create_team\n new_team_code = genTeamCode(current_user.id)\n team_params = {\n :team_name => params[:teamname],\n :team_code => new_team_code,\n :advisor_users_id => current_user.id,\n }\n team = Team.new(team_params)\n team.save\n\n current_user.update_attribute( :team_name, params[:teamname] )\n current_user.update_attribute( :team_code, new_team_code)\n\n flash.now[:flash] = 'Team Created'\n render '/advisor/index'\n end"
] | [
"0.74072",
"0.7352566",
"0.72058403",
"0.71848714",
"0.70729256",
"0.70230156",
"0.70230156",
"0.70230156",
"0.69894767",
"0.6969357",
"0.69600475",
"0.692509",
"0.69239825",
"0.69201565",
"0.6915113",
"0.6915113",
"0.6915113",
"0.6915113",
"0.6915113",
"0.6915113",
"0.6915113",
"0.6915113",
"0.6914543",
"0.68969446",
"0.6885399",
"0.6876103",
"0.68693686",
"0.68531394",
"0.68500334",
"0.683293",
"0.67810625",
"0.6753319",
"0.67528564",
"0.67464966",
"0.67305356",
"0.6725586",
"0.6723467",
"0.67095476",
"0.6707806",
"0.6689971",
"0.6673054",
"0.6656693",
"0.6633728",
"0.66291046",
"0.661735",
"0.66087383",
"0.66002995",
"0.6554542",
"0.6541196",
"0.65375364",
"0.6527058",
"0.6521508",
"0.6520413",
"0.6518664",
"0.65167385",
"0.6511262",
"0.65098387",
"0.65002096",
"0.6495411",
"0.64772457",
"0.6472481",
"0.64707935",
"0.64652014",
"0.64629567",
"0.6462138",
"0.645224",
"0.6431067",
"0.64271",
"0.6419771",
"0.640133",
"0.6398336",
"0.6387923",
"0.6381704",
"0.6372191",
"0.63676155",
"0.6365606",
"0.6365606",
"0.6364636",
"0.6362614",
"0.635903",
"0.6339397",
"0.6335365",
"0.6324913",
"0.6309276",
"0.6292905",
"0.6291356",
"0.6291356",
"0.6291356",
"0.6291356",
"0.6291356",
"0.6291356",
"0.6291356",
"0.62911016",
"0.6288676",
"0.62807965",
"0.6272458",
"0.6264218",
"0.6262792",
"0.6253719",
"0.6253693"
] | 0.64705455 | 62 |
PATCH/PUT /teams/1 PATCH/PUT /teams/1.json | def update
respond_to do |format|
if @team.update(team_params)
format.html { redirect_to @team, notice: 'Team was successfully updated.' }
format.json { render :show, status: :ok, location: @team }
else
format.html { render :edit }
format.json { render json: @team.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params.required(:team).permit!)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render json: @team }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tteam_id = params[:id]\n\t\t@team = Team.find(team_id)\n\t\tif @team.update(team_params)\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, :notice => 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end\n end",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to competition_team_url(@competition, @team), notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if team.update(team_params)\n format.html { redirect_to team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: team.errors, status: ':unprocessable_entity' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to teams_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @team.name = team_params[:name]\n if @team.save\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:team][:team_id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n if params[:players]\n TeamPlayers.update(params[:players], team_name: @team.name)\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = @club.teams.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to club_path(@club), notice: 'Mannschaft wurde aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to organization_teams_path(@team.organization_id), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @league = League.find(params[:league_id])\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_team(id, team_name, options={})\n options.merge!(:name => team_name)\n patch \"/teams/#{id}\", :body => options\n end",
"def update\n\n if @team.update(team_params)\n\n render json: @team,status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to user_path(current_user), notice: 'Team information was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to user_root_url, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: \"Team was successfully updated.\" }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to [@race, @team], notice: I18n.t(:update, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to league_team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_team\n @team.update(team_params)\n end",
"def update\n\n respond_to do |format|\n ap @team.name\n ap @categorys = Category.where(:team => @team.name)\n ap @admin_tasks = AdminTask.where(:team => @team.name)\n ap @eadmin_tasks = EadminTask.where(:team => @team.name)\n ap @users = User.where(:user_info => @team.name)\n\n if @team.update(team_params)\n ap @team.name\n @admin_tasks.update_all(:team => @team.name )\n @eadmin_tasks.update_all(:team => @team.name )\n @categorys.update_all(:team => @team.name )\n @users.update_all(:user_info => @team.name )\n\n\n format.html { redirect_to team_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n define_team_user\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n flash[:success] = 'Team was successfully updated.'\n format.html { redirect_to @team}\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_team.update(user_team_params)\n format.html { redirect_to @user_team, notice: 'User team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @swim_team = SwimTeam.find(params[:id])\n\n respond_to do |format|\n if @swim_team.update_attributes(params[:swim_team])\n format.html { redirect_to swim_teams_path(), notice: 'Swim team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @swim_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_team\n \n end",
"def update\n @ultimate_team = UltimateTeam.find(params[:id])\n\n respond_to do |format|\n if @ultimate_team.update_attributes(params[:ultimate_team])\n format.html { redirect_to @ultimate_team, notice: 'Ultimate team was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ultimate_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Team was successfully updated.'\n @changed << @team.id\n\n format.html { redirect_to teams_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @team.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'team' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if (current_user.team_id != @team.id) \n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n else\n if @team.update(team_params)\n #format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n #format.html { render :edit, notice: 'Team was successfully updated.' }\n format.html { redirect_to tracks_url, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n render_success format, 'updated', :ok\n else\n render_errors format, @team.errors, :edit\n end\n end\n end",
"def update\n @users = User.active\n @projects = Project.active\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.find_by_name(params[:id].upcase)\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to([@club, @team], :notice => 'Team was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @my_team.update(my_team_params)\n format.html { redirect_to @my_team, notice: 'My team was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_team }\n else\n format.html { render :edit }\n format.json { render json: @my_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update_attributes(team_params)\n format.html { redirect_to(@team, :notice => 'Team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_team.update(admin_team_params)\n format.html { redirect_to admin_teams_path, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_team }\n else\n format.html { render :edit }\n format.json { render json: @admin_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @leagues = League.all.order(:name)\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @team, :update?\n\n @team_form = Team::Form.new(team: @team, attributes: team_params)\n\n respond_to do |format|\n if @team_form.save\n format.html { redirect_to team_url(subdomain: @team.subdomain, auth_token: GenerateLoginToken.call(user: current_user)), notice: 'Team was successfully updated.' }\n format.json { render :show, status: :ok, location: @team }\n else\n format.html { render :edit }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @games_team.update(games_team_params)\n format.html { redirect_to @games_team, notice: 'Games team was successfully updated.' }\n format.json { render :show, status: :ok, location: @games_team }\n else\n format.html { render :edit }\n format.json { render json: @games_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n notify :notice, 'Team was successfully updated.'\n format.html { redirect_to(@team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user_team = UserTeam.find(params[:id])\n\n respond_to do |format|\n if @user_team.update_attributes(params[:user_team])\n format.html { redirect_to(@user_team, :notice => 'User team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Tím bol úspšne zmenený.'\n format.html { redirect_to(@team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_team(opts)\n HelloSign::Resource::Team.new post('/team', :body => opts)\n end",
"def update\n @team = Team.find(params[:id])\n if @team.update_attributes(team_params)\n flash[:notice] = \"Team successfully updated\"\n redirect_to teams_url\n else\n render 'edit'\n end\n end",
"def update\n\t\tteam = Team.find(params[:id])\n\t\tteam.update_attributes(params[:team])\n\n\t\tredirect_to teams_path\n\tend",
"def update\n t = params[:project][:team]\n team_id = t[:team_id]\n @team = Team.find(team_id)\n @project = Project.find(params[:id])\n params[:project].delete :team\n\n respond_to do |format|\n if @project.update_attributes(params[:project]) and \n @team.update_attribute(:project_id,@project.id)\n format.html { redirect_to admin_projects_url, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @team = Team.find params[:id]\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Yay, saved!'\n format.html { redirect_to(:action => :show, :id => @team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @teams = Team.order(:name)\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to \"/retrospectives\", notice: \"Your profile was succesfully updated!\" }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n @player = Player.find(params[:player_id])\n if @player.access_key == params[:access_key] && (@team.leader_id == @player.id || @team.game.owner_id == @player.id) then\n @team.name = params[:name]\n @team.leader_id = params[:leader_id]\n\n respond_to do |format|\n if @team.save\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end",
"def update\n respond_to do |format|\n if @tournamentteam.update(tournamentteam_params)\n format.html { redirect_to @tournamentteam, notice: 'Tournamentteam was successfully updated.' }\n format.json { render :show, status: :ok, location: @tournamentteam }\n else\n format.html { render :edit }\n format.json { render json: @tournamentteam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @team.update(team_params)\n redirect_to teams_url, notice: 'Team was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @manage_team.update(manage_team_params)\n format.html { redirect_to @manage_team, notice: 'Manage team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manage_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n param = team_params\n # There is no need to be changed if the password field is empty.\n param.delete(:password) if param[:password].blank?\n respond_to do |format|\n if @team.update(param)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sales_team = SalesTeam.find(params[:id])\n\n respond_to do |format|\n if @sales_team.update_attributes(params[:sales_team])\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: \"Project was successfully updated.\" }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html do\n @teams = Team.order(:name)\n render :edit\n end\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_team.update(event_team_params)\n format.html { redirect_to @event_team, notice: 'Event team was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_team }\n else\n format.html { render :edit }\n format.json { render json: @event_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_team = Team.where(\"league_id = ?\", @league.id)[0]\n respond_to do |format|\n if @league.update(league_params)\n format.html { redirect_to team_path(@user_team.id), notice: 'League was successfully updated.' }\n format.json { render :show, status: :ok, location: @league }\n else\n format.html { render :edit }\n format.json { render json: @league.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_team(opts)\n HelloSign::Resource::Team.new post('/team', body: opts)\n end",
"def update\n respond_to do |format|\n if @ab_team.update(ab_team_params)\n format.html { redirect_to @ab_team, notice: 'Record was updated' }\n else\n format.html { render :edit }\n format.json { render json: @ab_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona_team = PersonaTeam.find(params[:id])\n\n respond_to do |format|\n if @persona_team.update_attributes(params[:persona_team])\n flash[:notice] = 'Persona team was successfully updated.'\n format.html { redirect_to(@persona_team) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @persona_team.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7289483",
"0.7120175",
"0.7045829",
"0.7030194",
"0.70000815",
"0.69931203",
"0.69931203",
"0.6977324",
"0.6977324",
"0.6977324",
"0.6977324",
"0.6977324",
"0.6977324",
"0.69671524",
"0.6939162",
"0.6861243",
"0.68286526",
"0.6816322",
"0.6816322",
"0.6810702",
"0.68044317",
"0.6800968",
"0.67416596",
"0.67393106",
"0.67287874",
"0.67171794",
"0.6713503",
"0.67009187",
"0.6685229",
"0.66821736",
"0.6673708",
"0.6663544",
"0.66410905",
"0.66063595",
"0.6563325",
"0.6552673",
"0.6552282",
"0.6549787",
"0.65379065",
"0.6521709",
"0.6508235",
"0.6499745",
"0.6496208",
"0.6474188",
"0.6473394",
"0.6471466",
"0.6433923",
"0.6416889",
"0.639837",
"0.6389887",
"0.63840806",
"0.6378342",
"0.6357059",
"0.633442",
"0.63169646",
"0.6315602",
"0.63066816",
"0.6283747",
"0.6283501",
"0.62829494",
"0.62819195",
"0.62798893",
"0.6272133",
"0.62502795",
"0.6250146",
"0.62487656",
"0.6231224",
"0.62234515",
"0.62187755",
"0.62151825",
"0.6211225",
"0.620415",
"0.6203267",
"0.6199866",
"0.6188143",
"0.6187642"
] | 0.67115885 | 49 |
DELETE /teams/1 DELETE /teams/1.json | def destroy
@team.destroy
respond_to do |format|
format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ultimate_team = UltimateTeam.find(params[:id])\n @ultimate_team.destroy\n\n respond_to do |format|\n format.html { redirect_to ultimate_teams_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n head :no_content\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_teams_url(@competition) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_team(id)\n boolean_request :delete, \"/teams/#{id}\"\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to leagues_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_team.destroy\n respond_to do |format|\n format.html { redirect_to user_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to view_teams_path, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to league_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def destroy_team\n post('/team/destroy')\n end",
"def delete(_team)\n # stub\n end",
"def destroy\n @swim_team = SwimTeam.find(params[:id])\n @swim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to swim_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to user_root_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to(teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to team_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_team.destroy\n respond_to do |format|\n format.html { redirect_to manage_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@team.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to teams_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n\n if @team.destroy\n\n render json: {team: {id: params[:id].to_i}},status: :ok\n\n else\n\n render json: {error: true,errors: @team.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to organization_teams_url(@organization), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_has_d.destroy\n respond_to do |format|\n format.html { redirect_to team_has_ds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n (kick and return) if not is_god?\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @team.destroy\n # respond_to do |format|\n # format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to race_teams_url(@race), notice: I18n.t(:destroy, scope: 'messages.crud', model: Team.model_name.human) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_team.destroy\n respond_to do |format|\n format.html { redirect_to my_teams_url, notice: 'My team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n team_id = params[:id]\n status = OkrTeam.remove_team_from_system(team_id)\n\n respond_to do |format|\n if status == 200\n format.json { render json: 'Team is removed successfully from the system!', status: :ok }\n else\n format.json { render json: 'Unable to remove team from system!', status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @nfl_team = NflTeam.find(params[:id])\n @nfl_team.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nba_team = NbaTeam.find(params[:id])\n @nba_team.destroy\n\n respond_to do |format|\n format.html { redirect_to nba_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n allTeamRelation = TeamMemberRelation.where(team_id: @team.id)\n allTeamRelation.each do |r|\n r.destroy\n end\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: \"Team was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ab_team.destroy\n respond_to do |format|\n format.html { redirect_to ab_teams_url, notice: 'Record was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_team = UserTeam.find(params[:id])\n @user_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize @team, :destroy?\n\n @team.destroy\n respond_to do |format|\n format.html { redirect_to root_url(subdomain: ENV[\"DEFAULT_SUBDOMAIN\"]), notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @games_team.destroy\n respond_to do |format|\n format.html { redirect_to games_teams_url, notice: 'Games team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teamstat.destroy\n respond_to do |format|\n format.html { redirect_to teamstats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id]);\n @team.destroy();\n redirect_to(user_path(current_user) + '/teams');\n end",
"def destroy\n match_day_team = MatchDayTeam.find(params[:id])\n match_day_team.destroy\n head 204\n end",
"def destroy\n @tournamentteam.destroy\n respond_to do |format|\n format.html { redirect_to tournamentteams_url, notice: 'Tournamentteam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nhl_team.destroy\n respond_to do |format|\n format.html { redirect_to pool_nhl_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_team.destroy\n respond_to do |format|\n format.html { redirect_to admin_teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n team = @player.team\n @player.destroy\n respond_to do |format|\n format.html { redirect_to team }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team = Team.find(params[:id])\n @team.destroy\n respond_to do |format|\n format.html { redirect_to course_teams_path, notice: 'Team was successfully removed.' }\n end\n end",
"def destroy\n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_team = SalesTeam.find(params[:id])\n @sales_team.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_teams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @player.destroy\n @teams = @player.teams\n if @teams.exists?\n @teams.each do |t|\n t.destroy\n end\n end\n respond_to do |format|\n format.html { redirect_to players_url, notice: 'Player was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teammate = Teammate.find(params[:id])\n @teammate.destroy\n\n respond_to do |format|\n format.html { redirect_to teammates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @athletes_team.destroy\n respond_to do |format|\n format.html { redirect_to athletes_teams_url, notice: 'Athletes team was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_team_stat.destroy\n respond_to do |format|\n format.html { redirect_to test_team_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n team = Team.find(@users_team.team_id)\n @users_team.destroy\n respond_to do |format|\n format.html { redirect_to team_path(team), notice: 'Membro removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sim_team = SimTeam.find(params[:id])\n @sim_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(sim_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @team = Team.find(params[:id]).destroy\n flash[:notice] = \"Team successfully deleted\"\n redirect_to teams_url\n end",
"def destroy\n @team = Team.find_by_id(params[:id])\n @team.destroy\n\n if request.xhr?\n render :json => @team\n end\n end",
"def delete_team_with(id)\n visit teams_path\n click_button 'Delete'\n click_button 'OK'\n end",
"def delete()\n\n Team.destroy(self.id)\n end",
"def destroy\n if (current_user.team_id != @team.id || !current_user.admin?)\n return\n end \n @team.destroy\n respond_to do |format|\n format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' }\n format.json { head :no_content }\n end\n \n end",
"def delete(team_id)\n @client.team.delete(team_id)\n end"
] | [
"0.7868205",
"0.7819776",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.7807478",
"0.77657557",
"0.77657557",
"0.77657557",
"0.77657557",
"0.77476865",
"0.7617056",
"0.75655633",
"0.7555221",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7524412",
"0.7519429",
"0.75088274",
"0.7507463",
"0.75025505",
"0.74852633",
"0.74754584",
"0.74754584",
"0.7472454",
"0.74715775",
"0.74499106",
"0.7448884",
"0.7448884",
"0.7448884",
"0.7448884",
"0.7448884",
"0.7445441",
"0.74160564",
"0.74093455",
"0.7398133",
"0.7382918",
"0.73659605",
"0.7360807",
"0.73500395",
"0.7347468",
"0.7335934",
"0.7323845",
"0.7322313",
"0.7316011",
"0.7311703",
"0.73080206",
"0.73073286",
"0.7302544",
"0.72952795",
"0.72951007",
"0.72759116",
"0.7265425",
"0.7259331",
"0.72494084",
"0.7239291",
"0.72386765",
"0.72213286",
"0.7215611",
"0.7212721",
"0.71961856",
"0.7195722",
"0.71913254",
"0.71571153",
"0.71525866",
"0.71507204",
"0.71454084",
"0.7132882",
"0.71315974",
"0.7131328",
"0.71265703",
"0.7117115",
"0.7104823"
] | 0.75439465 | 22 |
Use callbacks to share common setup or constraints between actions. | def set_team
@team = Team.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 setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\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 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 workflow\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 setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\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 startcompany(action)\n @done = true\n action.setup\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 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\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\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 init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 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 setup\n #implement in subclass;\n end",
"def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; 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 setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); 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",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def team_params
params.require(:team).permit(:name, :image_url, :invite_parms)
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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\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 url_whitelist; 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 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 permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"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 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.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] | 0.0 | -1 |
GET /ios_topbars/1 GET /ios_topbars/1.json | def show
@ios_topbar = @user.ios_topbar
if @ios_topbar == nil
@ios_topbar = @user.build_ios_topbar
render action: "new"
else
respond_to do |format|
format.html # show.html.erb
format.json { render json: @ios_topbar }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end",
"def index\n @barns = current_user.barns\n\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barns }\n end\n end",
"def show\n @top_up = TopUp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @top_up }\n end\n end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def index\n @user=current_user\n\t @bars = @user.bars\n\t bar_num = @user.bars.count\n\t logger.error \"Bar Num: #{bar_num}\"\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bars }\n\tend\n end",
"def new\n @ios_topbar = @user.build_ios_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ios_topbar }\n end\n end",
"def index\n @non_smoking_bars = NonSmokingBar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @non_smoking_bars }\n end\n end",
"def index\n @topups = Topup.all\n end",
"def index\n @topis = Topi.all\n end",
"def index\n @bar80s = Bar80.all\n end",
"def destroy\n @ios_topbar = @user.ios_topbar\n @ios_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end",
"def index\n @bar_items = BarItem.all\n end",
"def top_urls\n if valid_params?(top_urls_params)\n render json: PageView.top_urls(top_urls_params),\n each_serializer: PageView::TopUrlsSerializer\n else\n render json: { message: invalid_params_message }\n end\n end",
"def show\n # Let's make sure someone is logged in. If not, send them to the user homepage\n if not session[:user_id] and not session[:bar_id]\n redirect_to '/userhome'\n return\n end\n \n # Fetch the bar being requested\n begin\n @bar = Bar.find(params[:id])\n rescue\n flash[:notice] = 'The requested bar does not exist.'\n redirect_to '/userhome'\n return\n end\n \n # Fetch the favorites \n @favorite = Favorite.where('user_id = ? and bar_id = ?', session[:user_id], @bar.id)\n \n # Fetch the events\n @events = BarEvent.where('bar_id = ?', @bar.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bar }\n end\n end",
"def index\n @bar68s = Bar68.all\n end",
"def index\n @slider_tops = SliderTop.all\n end",
"def top\n render :action => 'top'\n end",
"def show\n @non_smoking_bar = NonSmokingBar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @non_smoking_bar }\n end\n end",
"def index\n @bar8s = Bar8.all\n end",
"def index\n #if(params[:stack_count].nil?)\n #@stacks = Stack.all\n #else\n @stacks = Stack.all.order(id: :desc).limit(5)\n\n render json: @stacks\n end",
"def show\n @why_sumbar = WhySumbar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @why_sumbar }\n end\n end",
"def index\n @bar76s = Bar76.all\n end",
"def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end",
"def show\n respond_to do |format|\n format.json {render :json => @top_category.to_json }\n end\n end",
"def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created, location: @ios_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @set_top_boxes = SetTopBox.order(:name).paginate(page: params[:page], per_page: 10)\n end",
"def index\n @bar_graphs = BarGraph.all\n end",
"def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end",
"def top(options) \n Client.get(\"/colors/top\", :query => options)\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def index\n @tacks = Tack.all\n\n render json: @tacks\n end",
"def index\n @bar74s = Bar74.all\n end",
"def index\n @bar81s = Bar81.all\n end",
"def index\n @bar52s = Bar52.all\n end",
"def get_top_list params = { :list_type => 1, :page => 1, :language => 'en' }\n json = send_request 'get_top_list', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def show\n @bar = Bar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bar }\n end\n end",
"def update\n @ios_topbar = @user.ios_topbar\n\n respond_to do |format|\n if @ios_topbar.update_attributes(params[:ios_topbar])\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bar71s = Bar71.all\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrio }\n end\n end",
"def index\n @top_categories = TopCategory.all\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def get_current_bar\n if !params[:bar_name].nil?\n @current_bar = HomeBar.find_by_name(params[:bar_name])\n end\n end",
"def index\n @top_musics = TopMusic.all\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def display_top(n: 3)\n draw \"Top #{n} sections:\"\n draw \"Top #{n} HTTP status:\"\n draw \"Top #{n} IPs:\"\n draw_eol\n clear_line\n\n sections = @queue.top_sections.first(n)\n statuses = @queue.top_status.first(n)\n ips = @queue.top_ips.first(n)\n\n n.times do |index|\n clear_line\n\n section, section_hits = sections[index]\n status, status_hits = statuses[index]\n ip, ip_hits = ips[index]\n\n draw \" %-19s %-10s\" % [section.to_s.empty? ? '/' : section, section_hits]\n status.nil? ? (draw '') : (draw \" #{status} #{status_hits}\" % [status, status_hits])\n ip.nil? ? (draw '') : (draw \" %-16s %s\" % [ip, ip_hits])\n\n draw_eol\n end\n end",
"def index\r\n getMostRecentItems\r\n outlet \r\n render :action => 'list' \r\n end",
"def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end",
"def index\n @bar22s = Bar22.all\n end",
"def index\n @timeline_objects = TimelineObject.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timeline_objects }\n end\n end",
"def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barrio }\n end\n end",
"def index\n @api_v2_dashboard_shop360s = Api::V2::Dashboard::Shop360.all\n end",
"def index\n @bar77s = Bar77.all\n end",
"def index\n @bar42s = Bar42.all\n end",
"def index\n @notification_counts = NotificationCount.all\n\n render json: @notification_counts\n end",
"def index\n @bar30s = Bar30.all\n end",
"def index\n @bouncers = Bouncer.find_top_urls\n @title = \"Top 10 URLs\"\n @show_edit_controls = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bouncers }\n end\n end",
"def top_albums(tag)\n get(:standard, {:method => \"tag.getTopAlbums\", :tag => tag})\n end",
"def index\n @bars = Bar.all.order(:title).page(params[:page]).per(12)\n end",
"def index\n @found_items_top = FoundItem.where(\"user_id IS NOT NULL\").not_found.count\n @found_items = FoundItem.where(\"user_id IS NOT NULL\").not_found.order('id desc').page(params[:page]).per(10)\n\n respond_to do |format|\n format.js\n format.html # index.html.erb\n format.json { render json: @found_items }\n end\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def top_tags\n\n keys = ((params[:time] && params[:time].to_i) || 6).times.map do |i| \n at = (i*10).minutes.ago\n \"#{at.year}:#{at.month}:#{at.day}:#{at.hour}:#{at.min/10}\"\n end\n\n hashtags = keys.reduce({}) do |acc, k|\n $redis.zrevrange(k, 0, -1, {with_scores: true}).each do |hashtag, value|\n acc[hashtag] = (acc[hashtag] || 0) + value.to_i\n end\n acc\n end\n\n @tags = hashtags.to_a.sort{|a, b| b.second <=> a.second}.map{|h| {name: h[0], value: h[1]}}.first((params[:count] && params[:count].to_i) || 50)\n\n respond_to do |format|\n format.html\n format.json { render json: @tags }\n end\n\n end",
"def index\n @sys_msgs_timelines = SysMsgsTimeline.order(\"created_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.json {\n render json: {page: @sys_msgs_timelines.current_page,total_pages: @sys_msgs_timelines.total_pages, feeds: @sys_msgs_timelines}\n }\n end\n end",
"def index #TODO redundant with home\n add_breadcrumb 'Your hubs', :hubs_path\n append_title 'Hubs'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @hubs }\n end\n end",
"def show\n redirect_to_home\n \n #@bar_event = BarEvent.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n # format.json { render :json => @bar_event }\n #end\n end",
"def top\n end",
"def index\n @barometers = Barometer.all\n end",
"def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end",
"def show\n @sumbar_content = SumbarContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sumbar_content }\n end\n end",
"def index\n @zabbix_servers = ZabbixServer.all\n\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def index\n @barrios = Barrio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @barrios }\n end\n end",
"def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end",
"def index\n @barn_configurations = BarnConfiguration.all\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barn_configurations }\n end\n end",
"def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end",
"def top\n redirect_to stats_url\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def get_top_tags( params )\n LastFM.get( \"chart.getTopTags\", params )\n end",
"def index\n @bar50s = Bar50.all\n end",
"def show\n render json: @app\n end",
"def show\n @barn = Barn.find(params[:id])\n @page_title = @barn.name\n @header_icon_class = \"icon-building\"\n @reading = @last_reading = @barn.readings.any? ? @barn.readings.last : nil\n @readings = []\n if @last_reading\n first_reading_time = @last_reading.created_at - 5.days\n @readings = Reading.where(\"barn_id = ? and created_at > ? and created_at <= ?\",\n @barn.id, first_reading_time, @last_reading.created_at).order(\"created_at DESC\")\n end\n @event_reports = @barn.event_reports.order(\"created_at DESC\")\n \n @inventory_report = @barn.inventory_reports.last\n @shipment = @barn.shipments.last\n @total_pigs = @barn.total_pigs\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barn }\n end\n end",
"def index\n @barista = Baristum.all\n end",
"def index\n @system_overviews = SystemOverview.all\n if @system_overviews.size > 0\n\n data_table = GoogleVisualr::DataTable.new\n data_table.new_column('string', 'Label')\n data_table.new_column('number', 'Value')\n data_table.add_rows(3)\n data_table.set_cell(0, 0, 'Current')\n data_table.set_cell(0, 1, SystemOverview\n .last.currently_running\n .tr('W', '')\n .tr('KW', '')\n .to_i\n )\n opts = { width: 400, height: 120, redFrom: 90, redTo: 100, yellowFrom: 75, yellowTo: 90, minorTicks: 5 }\n @chart = GoogleVisualr::Interactive::Gauge.new(data_table, opts)\n end\n end",
"def index\n @baz72s = Baz72.all\n end",
"def top_containers\n container_information.select do |container|\n container[\"label\"].to_s.downcase.include?(\"box\") || container[\"profile\"].include?(\"OS folder\")\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @bar82s = Bar82.all\n end",
"def bars_with_info\n bars.lazy.map { |bar| client.details(placeid: bar.place_id) }\n end",
"def index\n @daily_horoscopes = DailyHoroscope.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_horoscopes }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def topAlbums(artist)\n\tartistinfo = HTTParty.get(\"http://ws.audioscrobbler.com/2.0/?method=artist.gettopalbums&artist=#{artist}&api_key=#{API_KEY}&format=json\")\n\treturn artistinfo\nend",
"def top_data\n \n # Parse parameters\n device = params[:device]\n category = params[:category_top]\n \n # Format the rank we want to search on\n rank = \"top_%s_apps_%s\" % [category, device]\n \n # Get query parameters and add the rank\n query = get_query.merge!({rank => {:$gt => 0}})\n\n # Get list of fields to return\n fields = get_fields\n \n # Get list of fields to remove\n without = get_without_fields\n\n # Check if sorting method is specified\n sort_field = get_sorting(rank)\n \n # If the limit is specified set it otherwise default to 100\n limit_num = get_limit\n \n # Create mongo query.\n # Select based on store where both criteria match:\n # => country is the specified one\n # => rank is greater than 0\n apps = AppData.where(query)\n .sort(sort_field)\n .fields(fields)\n .limit(limit_num)\n .all\n \n # Apply interests weighting if interests exist \n apps = weight_interests(apps, request.query_parameters['interests'])\n \n # Return result as json\n render :json => {\n :success => true,\n :message => \"Success\",\n :apps_data => apps.as_json(:only => fields, :except => without)\n }\n \n end",
"def set_bar80\n @bar80 = Bar80.find(params[:id])\n end",
"def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end",
"def index\n @newsbars = Newsbar.order(\"id DESC\").all\n end",
"def index\n @bar90s = Bar90.all\n end"
] | [
"0.66528857",
"0.6166441",
"0.60621494",
"0.6062122",
"0.60161376",
"0.5995399",
"0.5873841",
"0.58144885",
"0.5767542",
"0.57427114",
"0.5711255",
"0.5693885",
"0.56908983",
"0.568174",
"0.56807774",
"0.5676478",
"0.5645216",
"0.56350785",
"0.5589838",
"0.55607957",
"0.5544679",
"0.5538227",
"0.55379295",
"0.55246115",
"0.5523072",
"0.5516751",
"0.5509177",
"0.5471984",
"0.5453283",
"0.543962",
"0.54291",
"0.5428834",
"0.5426051",
"0.54115325",
"0.5406698",
"0.5399937",
"0.53992724",
"0.5379968",
"0.5372133",
"0.53617334",
"0.5359025",
"0.53405327",
"0.5305265",
"0.52877754",
"0.5287032",
"0.52860713",
"0.52783555",
"0.5277825",
"0.52657634",
"0.5263051",
"0.5263029",
"0.5261461",
"0.525554",
"0.52504694",
"0.5248336",
"0.5247896",
"0.52445024",
"0.5241551",
"0.52366275",
"0.5235497",
"0.52335197",
"0.52317864",
"0.5228729",
"0.5225643",
"0.52184016",
"0.5214713",
"0.5210772",
"0.52094567",
"0.5208172",
"0.5205343",
"0.5198527",
"0.51920426",
"0.51906765",
"0.5181641",
"0.5181641",
"0.5173652",
"0.51693547",
"0.5168747",
"0.516677",
"0.515881",
"0.5156208",
"0.5154754",
"0.5154345",
"0.51465976",
"0.5142139",
"0.51414293",
"0.51410824",
"0.5133",
"0.51322705",
"0.5127219",
"0.51266515",
"0.5126162",
"0.5120091",
"0.511303",
"0.51063347",
"0.51038814",
"0.5101312",
"0.5100159",
"0.50941974",
"0.5091872"
] | 0.6150471 | 2 |
GET /ios_topbars/new GET /ios_topbars/new.json | def new
@ios_topbar = @user.build_ios_topbar
respond_to do |format|
format.html # new.html.erb
format.json { render json: @ios_topbar }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created, location: @ios_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @barrack = Barrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrack }\n end\n end",
"def new\n @pushup = Pushup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup }\n end\n end",
"def new\n @non_smoking_bar = NonSmokingBar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @non_smoking_bar }\n end\n end",
"def new\n @barn = Barn.new\n set_page_title\n if current_user.is_admin?\n @farms = Farm.all\n @locations = []\n @barns = []\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barn }\n end\n end",
"def show\n @ios_topbar = @user.ios_topbar\n\n if @ios_topbar == nil\n @ios_topbar = @user.build_ios_topbar\n render action: \"new\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ios_topbar }\n end\n end\n end",
"def new\n @tuoshui = Tuoshui.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tuoshui }\n end\n end",
"def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end",
"def new\n @barrio = Barrio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrio }\n end\n end",
"def new\n @troop = Troop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @troop }\n end\n end",
"def new\n @why_sumbar = WhySumbar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @why_sumbar }\n end\n end",
"def new\n @foobar = Foobar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foobar }\n end\n end",
"def new\n redirect_to_home\n \n #@bar_event = BarEvent.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render :json => @bar_event }\n #end\n end",
"def new\n @barrio = Barrio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @barrio }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @bar = Bar.new\n @button_text = \"Sign up!\"\n @show_tos = true\n @show_password_explanation = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bar }\n end\n end",
"def new\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end",
"def new\n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb 'New hub', new_hub_path\n append_title 'New hub'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hub }\n end\n end",
"def new\n @highfive = Highfive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @highfive }\n end\n end",
"def new\n @sticky = Sticky.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sticky }\n end\n end",
"def new\n @bucket = current_user.buckets.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bucket }\n format.iphone { render :layout => false}\n end\n end",
"def create\n @top = Top.new(top_params)\n\n respond_to do |format|\n if @top.save\n format.html { redirect_to @top, notice: 'Top was successfully created.' }\n format.json { render :show, status: :created, location: @top }\n else\n format.html { render :new }\n format.json { render json: @top.errors, status: :unprocessable_entity }\n end\n end\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 @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end",
"def new\n @rackitem = Rackitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rackitem }\n end\n end",
"def new\n current_admin_user\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end",
"def new\n @itemstable = Itemstable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstable }\n end\n end",
"def create\n @top5 = Top5.new(top5_params)\n \n respond_to do |format|\n if @top5.save\n @status = 'success' \n @action = 'create' \n format.js { render :index} \n else\n @status = 'danger'\n format.js { render :new } \n end\n end\n end",
"def new\n @weibo = Weibo.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def new\n @sidebar = Sidebar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sidebar }\n end\n end",
"def new\n @container_stack = ContainerStack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @container_stack }\n end\n end",
"def new\n @sumbar_content = SumbarContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sumbar_content }\n end\n end",
"def new\n @get_in_touch = GetInTouch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get_in_touch }\n end\n end",
"def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end",
"def new\n @itemstatus = Itemstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itemstatus }\n end\n end",
"def create\n @non_smoking_bar = NonSmokingBar.new(params[:non_smoking_bar])\n\n respond_to do |format|\n if @non_smoking_bar.save\n format.html { redirect_to root_url, notice: 'Successfully created.' }\n format.json { render json: @non_smoking_bar, status: :created, location: @non_smoking_bar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @non_smoking_bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cocktail_history = CocktailHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cocktail_history }\n end\n end",
"def new\n @top_menu = TopMenu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @top_menu }\n end\n end",
"def new\n @mostsmalltrapinfo = Mostsmalltrapinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmalltrapinfo }\n end\n end",
"def new\n @heroku = Heroku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heroku }\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 @weibo = Weibo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weibo }\n end\n end",
"def new\n @foo = Foo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foo }\n end\n end",
"def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n @objects_info = ObjectsInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objects_info }\n end\n end",
"def new\n @poi = Poi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poi }\n end\n end",
"def new\n @trap = Trap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trap }\n end\n end",
"def new\n @stable = Stable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stable }\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 @push_notification = PushNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @push_notification }\n end\n end",
"def new\n @board = Board.new_with_initial_items\n @template = Template.find(1)\n session[:board] = @board\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @closing_item = ClosingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closing_item }\n end\n end",
"def new\n @tip_so = TipSo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_so }\n end\n end",
"def new\n @buying_history = BuyingHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @buying_history }\n end\n end",
"def new\n @mostsmalliteminfo = Mostsmalliteminfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmalliteminfo }\n end\n end",
"def new\n @poi_category = PoiCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @poi_category }\n end\n end",
"def new\n @dummy_table = DummyTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy_table }\n end\n end",
"def new\n @notebook = Notebook.new\n render json: @notebook\n end",
"def new\n @query_history = QueryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @query_history }\n end\n end",
"def new\n @huerto = Huerto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @huerto }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end",
"def new\n @ambush = Ambush.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ambush }\n end\n end",
"def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end",
"def new\n @width = Width.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @width }\n end\n end",
"def new \n set_tab :shopping_new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shopping }\n end\n \n end",
"def new\n @rush = Rush.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rush }\n end\n end",
"def new\n @poi_type = PoiType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poi_type }\n end\n end",
"def new\n @os_release = OsRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @os_release }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @boxtype = Boxtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @boxtype }\n end\n end",
"def new\n @socio = Socio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socio }\n end\n end",
"def new\n @mac = Mac.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mac }\n end\n end",
"def new\n @shooting = Shooting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shooting }\n end\n end",
"def new\n @box = Box.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @box }\n end\n end",
"def new\n @heat_type = HeatType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_type }\n end\n end",
"def new\n @stocklist = Stocklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stocklist }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end",
"def new\n \t@title = \"New Order\"\n @navtop = \"3\"\n @order = Order.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @closet_item = ClosetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @closet_item }\n end\n end",
"def create\n @bar_event = BarEvent.new\n @bar_event.bar_id = params[:bar_id]\n @bar_event.detail = params[:detail]\n \n #for header in request.env.select {|k,v| k.match(\"^HTTP.*\")}\n # print header\n #end\n #print \"Bar id: \" + request.env[\"HTTP_BAR_ID\"] + \"\\n\"\n #print \"Session id: \" + request.env[\"HTTP_SESSION_ID\"] + \"\\n\"\n #print \"Bar name: \" + request.env[\"HTTP_BAR_NAME\"] + \"\\n\"\n #print \"CSRF token: \" + request.env[\"HTTP_X_CSRF_TOKEN\"] + \"\\n\"\n \n # Get data and save to the bar_event object\n #print params.to_s\n\n respond_to do |format|\n if @bar_event.save\n #format.html { redirect_to @bar_event, :notice => 'Bar event was successfully created.' }\n format.html { render :text => @bar_event.id }\n format.json { render :json => @bar_event, :status => :created, :location => @bar_event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bar_event.errors, :status => :unprocessable_entity }\n end\n\tend\n end",
"def new\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n #@ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/default_ecosystems.json\" , \"r\" ).read )\n #@name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n #@ecosystem = @ecosystems[0]\n\n respond_to do |format|\n format.html\n end\n end",
"def create\n @topi = Topi.new(topi_params)\n\n respond_to do |format|\n if @topi.save\n format.html { redirect_to @topi, notice: 'Topi was successfully created.' }\n format.json { render :show, status: :created, location: @topi }\n else\n format.html { render :new }\n format.json { render json: @topi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @getoff_info = GetoffInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n end",
"def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n if params[:q]\n result = JSON.load(open(\"http://nanoappli.com/tracking/api/#{params[:q]}.json\").read)\n \n if result['result'] == 0 \n @status = \"[最新状況]:#{result['status']}\"\n @imagetype = \"[配送物種別]:#{result['itemType']}\" \n @slipno = \"[配送物伝票番号]:#{result['slipNo']}\"\n \n result['statusList'].each do |info|\n @detail = \"[時刻]:#{info['date']} #{info['time']} [状況]:#{info['status']} [位置]:#{info['placeName']} (#{info['placeCode']})\"\n end\n end\n end\n end",
"def new\n get_status\n @tag = Tag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tag }\n end\n end",
"def new\n @monthly_overhead_breakdown_item = MonthlyOverheadBreakdownItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monthly_overhead_breakdown_item }\n end\n end"
] | [
"0.67649686",
"0.6763822",
"0.6451191",
"0.6434442",
"0.63553584",
"0.63374573",
"0.62913173",
"0.6272199",
"0.6260369",
"0.62488884",
"0.6220289",
"0.61899066",
"0.6173362",
"0.6168536",
"0.6167665",
"0.6144411",
"0.61321086",
"0.6129298",
"0.61153615",
"0.6110055",
"0.61036426",
"0.6072442",
"0.60722286",
"0.6033401",
"0.6023389",
"0.6020306",
"0.59938425",
"0.59937024",
"0.59548366",
"0.59511817",
"0.59416384",
"0.59369963",
"0.59348917",
"0.5930746",
"0.59304744",
"0.592714",
"0.59265083",
"0.5925561",
"0.59185255",
"0.5915064",
"0.59100056",
"0.59080493",
"0.5907538",
"0.58944553",
"0.5877062",
"0.5865029",
"0.5857402",
"0.5847183",
"0.5846086",
"0.5833625",
"0.58322567",
"0.58129513",
"0.5811476",
"0.58107454",
"0.5809781",
"0.58076394",
"0.58034635",
"0.57982504",
"0.5791236",
"0.5790139",
"0.5789532",
"0.5789532",
"0.5789532",
"0.5789532",
"0.57892275",
"0.5787685",
"0.57869077",
"0.57863724",
"0.57863426",
"0.578467",
"0.5783416",
"0.5781703",
"0.5780472",
"0.57763463",
"0.5775702",
"0.57746637",
"0.57739776",
"0.57668185",
"0.576325",
"0.5761279",
"0.5760277",
"0.5759929",
"0.5757331",
"0.575531",
"0.57530165",
"0.5752108",
"0.57498586",
"0.57464117",
"0.57464117",
"0.57464117",
"0.57464117",
"0.57464117",
"0.57464117",
"0.5745345",
"0.574528",
"0.574528",
"0.5743659",
"0.57407457",
"0.5740177",
"0.5739503"
] | 0.70895004 | 0 |
POST /ios_topbars POST /ios_topbars.json | def create
@ios_topbar = @user.build_ios_topbar(params[:ios_topbar])
respond_to do |format|
if @ios_topbar.save
format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }
format.json { render json: @ios_topbar, status: :created, location: @ios_topbar }
else
format.html { render action: "new" }
format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @ios_topbar = @user.build_ios_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ios_topbar }\n end\n end",
"def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end",
"def destroy\n @ios_topbar = @user.ios_topbar\n @ios_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def show\n @ios_topbar = @user.ios_topbar\n\n if @ios_topbar == nil\n @ios_topbar = @user.build_ios_topbar\n render action: \"new\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ios_topbar }\n end\n end\n end",
"def update\n @ios_topbar = @user.ios_topbar\n\n respond_to do |format|\n if @ios_topbar.update_attributes(params[:ios_topbar])\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar_event = BarEvent.new\n @bar_event.bar_id = params[:bar_id]\n @bar_event.detail = params[:detail]\n \n #for header in request.env.select {|k,v| k.match(\"^HTTP.*\")}\n # print header\n #end\n #print \"Bar id: \" + request.env[\"HTTP_BAR_ID\"] + \"\\n\"\n #print \"Session id: \" + request.env[\"HTTP_SESSION_ID\"] + \"\\n\"\n #print \"Bar name: \" + request.env[\"HTTP_BAR_NAME\"] + \"\\n\"\n #print \"CSRF token: \" + request.env[\"HTTP_X_CSRF_TOKEN\"] + \"\\n\"\n \n # Get data and save to the bar_event object\n #print params.to_s\n\n respond_to do |format|\n if @bar_event.save\n #format.html { redirect_to @bar_event, :notice => 'Bar event was successfully created.' }\n format.html { render :text => @bar_event.id }\n format.json { render :json => @bar_event, :status => :created, :location => @bar_event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bar_event.errors, :status => :unprocessable_entity }\n end\n\tend\n end",
"def create\n @top = Top.new(top_params)\n\n respond_to do |format|\n if @top.save\n format.html { redirect_to @top, notice: 'Top was successfully created.' }\n format.json { render :show, status: :created, location: @top }\n else\n format.html { render :new }\n format.json { render json: @top.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topup = Topup.new(topup_params)\n\n respond_to do |format|\n if @topup.save\n format.html { redirect_to @topup, notice: 'Topup was successfully created.' }\n format.json { render :show, status: :created, location: @topup }\n else\n format.html { render :new }\n format.json { render json: @topup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @barns = current_user.barns\n\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barns }\n end\n end",
"def create\n @slider_top = SliderTop.new(slider_top_params)\n\n respond_to do |format|\n if @slider_top.save\n format.html { redirect_to @slider_top, notice: 'Slider top was successfully created.' }\n format.json { render :show, status: :created, location: @slider_top }\n else\n format.html { render :new }\n format.json { render json: @slider_top.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @non_smoking_bar = NonSmokingBar.new(params[:non_smoking_bar])\n\n respond_to do |format|\n if @non_smoking_bar.save\n format.html { redirect_to root_url, notice: 'Successfully created.' }\n format.json { render json: @non_smoking_bar, status: :created, location: @non_smoking_bar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @non_smoking_bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar80 = Bar80.new(bar80_params)\n\n respond_to do |format|\n if @bar80.save\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar80 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @topi = Topi.new(topi_params)\n\n respond_to do |format|\n if @topi.save\n format.html { redirect_to @topi, notice: 'Topi was successfully created.' }\n format.json { render :show, status: :created, location: @topi }\n else\n format.html { render :new }\n format.json { render json: @topi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @top5 = Top5.new(top5_params)\n \n respond_to do |format|\n if @top5.save\n @status = 'success' \n @action = 'create' \n format.js { render :index} \n else\n @status = 'danger'\n format.js { render :new } \n end\n end\n end",
"def index\n @topups = Topup.all\n end",
"def index\n @user=current_user\n\t @bars = @user.bars\n\t bar_num = @user.bars.count\n\t logger.error \"Bar Num: #{bar_num}\"\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bars }\n\tend\n end",
"def index\n #if(params[:stack_count].nil?)\n #@stacks = Stack.all\n #else\n @stacks = Stack.all.order(id: :desc).limit(5)\n\n render json: @stacks\n end",
"def create\n @set_top_box = SetTopBox.new(set_top_box_params)\n if @set_top_box.save\n flash[:success] = \"Create success!\"\n redirect_to @set_top_box\n else\n render 'new'\n end\n end",
"def create\n @top_category = TopCategory.new(top_category_params)\n\n respond_to do |format|\n if @top_category.save\n format.json { render :show, status: :created, location: @top_category }\n else\n format.json { render json: @top_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createTitlebar\n height = NSHeight(self.window.frame) - NSHeight(self.window.contentView.frame)\n @spinner = NSProgressIndicator.alloc\n .initWithFrame([[0, 2], [height - 4, height - 4]])\n .tap do |obj|\n obj.usesThreadedAnimation = true\n obj.indeterminate = true\n obj.style = NSProgressIndicatorSpinningStyle\n obj.displayedWhenStopped = false\n end\n titlebarView = NSView.alloc.initWithFrame([[0, 0], [40, height]])\n titlebarView.addSubview(@spinner)\n NSTitlebarAccessoryViewController.alloc.init.tap do |obj|\n obj.view = titlebarView\n obj.layoutAttribute = NSLayoutAttributeRight\n end\n end",
"def create\n @bar8 = Bar8.new(bar8_params)\n\n respond_to do |format|\n if @bar8.save\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar8 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @non_smoking_bars = NonSmokingBar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @non_smoking_bars }\n end\n end",
"def create\n @barrack = Barrack.new(params[:barrack])\n\n respond_to do |format|\n if @barrack.save\n format.html { redirect_to @barrack, notice: 'Barrack was successfully created.' }\n format.json { render json: @barrack, status: :created, location: @barrack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bar_item_params\n params.require(:bar_item).permit(:ticket_id, :bar_menu_item_id, :bar_closeout)\n end",
"def new\n @barrack = Barrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrack }\n end\n end",
"def top\n render :action => 'top'\n end",
"def create\n @bar = Bar.new(params[:bar])\n\t@bar.address = @bar.street_address + \", \" + @bar.city + \", \" + @bar.state + \", \" + @bar.zip_code\n\t@user = User.find(params[:os])\n\t@bar.user = @user\n\t@bar.user_id= @user.id\n respond_to do |format|\n if @bar.save\n format.html { redirect_to user_bar_path(@bar.user,@bar), notice: 'Bar was successfully created.' }\n format.json { render json: @bar, status: :created, location: @bar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar_item = BarItem.new(bar_item_params)\n\n respond_to do |format|\n if @bar_item.save\n format.html { redirect_to @bar_item, notice: 'Bar item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bar_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @bar_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar68 = Bar68.new(bar68_params)\n\n respond_to do |format|\n if @bar68.save\n format.html { redirect_to @bar68, notice: \"Bar68 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar68 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar68.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar52 = Bar52.new(bar52_params)\n\n respond_to do |format|\n if @bar52.save\n format.html { redirect_to @bar52, notice: \"Bar52 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar52 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar52.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar_graph = BarGraph.new(bar_graph_params)\n\n respond_to do |format|\n if @bar_graph.save\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully created.' }\n format.json { render :edit, status: :created, location: @bar_graph }\n else\n format.html { render :new }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar74 = Bar74.new(bar74_params)\n\n respond_to do |format|\n if @bar74.save\n format.html { redirect_to @bar74, notice: \"Bar74 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar74 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar74.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @set_top_boxes = SetTopBox.order(:name).paginate(page: params[:page], per_page: 10)\n end",
"def index\n @bar_items = BarItem.all\n end",
"def bar_params\n params.require(:bar).permit(:title)\n end",
"def create\n unless user_signed_in? && current_user.admin?\n flash[:notice] = \"You don't have access to that page!\"\n redirect_to root_path\n return\n end\n @bar = Bar.new(bar_params)\n\n respond_to do |format|\n if @bar.save\n format.html { redirect_to @bar, notice: 'Bar was successfully created.' }\n format.json { render :show, status: :created, location: @bar }\n else\n format.html { render :new }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bar_params\n params.require(:bar).permit(:widget, :sprocket, :crank)\n end",
"def create_status_bar\n status_bar.show_message(tr(\"Ready\"))\n end",
"def create\n @bar82 = Bar82.new(bar82_params)\n\n respond_to do |format|\n if @bar82.save\n format.html { redirect_to @bar82, notice: \"Bar82 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar82 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar82.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_scroll_bar\n @scroll_bar = ScrollBar.new(@viewport)\n update_scroll_bar\n end",
"def index\n @bar_graphs = BarGraph.all\n end",
"def create\n @bar71 = Bar71.new(bar71_params)\n\n respond_to do |format|\n if @bar71.save\n format.html { redirect_to @bar71, notice: \"Bar71 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar71 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar71.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @top_up = TopUp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @top_up }\n end\n end",
"def set_top_box_params\n params.require(:set_top_box).permit(:name, :description)\n end",
"def index\n @slider_tops = SliderTop.all\n end",
"def setup\n @headers = {}\n @headers[\"User-Agent\"] = \"iPadApp\"\n @headers[\"Content-type\"] = \"application/json\"\n end",
"def index\n @topis = Topi.all\n end",
"def show\n redirect_to bar_graphs_url\n end",
"def index\n @tacks = Tack.all\n\n render json: @tacks\n end",
"def create\n @bar50 = Bar50.new(bar50_params)\n\n respond_to do |format|\n if @bar50.save\n format.html { redirect_to @bar50, notice: \"Bar50 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar50 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar50.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_topup\n @topup = Topup.find(params[:id])\n end",
"def create\n @bar76 = Bar76.new(bar76_params)\n\n respond_to do |format|\n if @bar76.save\n format.html { redirect_to @bar76, notice: \"Bar76 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar76 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar76.errors, status: :unprocessable_entity }\n end\n end\n end",
"def top_tags\n\n keys = ((params[:time] && params[:time].to_i) || 6).times.map do |i| \n at = (i*10).minutes.ago\n \"#{at.year}:#{at.month}:#{at.day}:#{at.hour}:#{at.min/10}\"\n end\n\n hashtags = keys.reduce({}) do |acc, k|\n $redis.zrevrange(k, 0, -1, {with_scores: true}).each do |hashtag, value|\n acc[hashtag] = (acc[hashtag] || 0) + value.to_i\n end\n acc\n end\n\n @tags = hashtags.to_a.sort{|a, b| b.second <=> a.second}.map{|h| {name: h[0], value: h[1]}}.first((params[:count] && params[:count].to_i) || 50)\n\n respond_to do |format|\n format.html\n format.json { render json: @tags }\n end\n\n end",
"def create\n @bar = Bar.new(bar_params)\n\n respond_to do |format|\n if @bar.save\n format.html { redirect_to @bar, notice: 'Bar was successfully created.' }\n format.json { render :show, status: :created, location: @bar }\n else\n format.html { render :new }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render\n write_item = toolbar_item(:label => \"Write\", :image => image(icon_path(\"187-pencil\")))\n \n read_item = toolbar_item(:label => \"Read\", :image => image(icon_path(\"57-download\")))\n read_item.on_action { connect_serial }\n \n reset_item = toolbar_item(:label => \"Reset\", :image => image(icon_path(\"01-refresh\")))\n \n expert_view_item = toolbar_item(:label => \"Expert view\") do |ev|\n ev.view = button(:title => \"Expert\", :bezel => :textured_rounded, :type => :push_on_push_off )\n end\n \n debug_item = toolbar_item(:label => \"Debug console\", :image => image(:named => \"NSActionTemplate\"))\n debug_item.on_action { connect_serial }\n \n # search_item = toolbar_item(:identifier => \"Search\") do |si|\n # search = search_field(:frame => [0, 0, 150, 30], :layout => {:align => :right, :start => false})\n # search.on_action { |sender| filter_instances(search) }\n # si.view = search\n # end\n \n tbar = toolbar(:default => [read_item, write_item, reset_item, debug_item, :flexible_space, expert_view_item]) \n \n # TODO: someone please tell me how where I go wrong:\n HotCocoaApplication.instance.controllers[:application_controller].application_window.toolbar = tbar\n end",
"def create\n @barrio_colonium = BarrioColonium.new(barrio_colonium_params)\n\n respond_to do |format|\n if @barrio_colonium.save\n format.html { redirect_to @barrio_colonium, notice: 'Barrio colonium was successfully created.' }\n format.json { render :show, status: :created, location: @barrio_colonium }\n else\n format.html { render :new }\n format.json { render json: @barrio_colonium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tuoshui = Tuoshui.new(params[:tuoshui])\n\n respond_to do |format|\n if @tuoshui.save\n format.html { redirect_to @tuoshui, notice: 'Tuoshui was successfully created.' }\n format.json { render json: @tuoshui, status: :created, location: @tuoshui }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tuoshui.errors, status: :unprocessable_entity }\n end\n end\n end",
"def top_urls\n if valid_params?(top_urls_params)\n render json: PageView.top_urls(top_urls_params),\n each_serializer: PageView::TopUrlsSerializer\n else\n render json: { message: invalid_params_message }\n end\n end",
"def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end",
"def push_data(push_params)\n # Push URI\n push_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/push\")\n\n # Post to API to set up tile\n push_response = Net::HTTP.post_form(push_uri, push_params)\nend",
"def set_top\n @top = Top.find(params[:id])\n end",
"def index\n @bar80s = Bar80.all\n end",
"def new\n @tuoshui = Tuoshui.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tuoshui }\n end\n end",
"def create\n @bar81 = Bar81.new(bar81_params)\n\n respond_to do |format|\n if @bar81.save\n format.html { redirect_to @bar81, notice: \"Bar81 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar81 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar81.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addNewBarChart(numberOpenClosed, numberOpen, numberResolved, numberResolvedKo)\n\n chartBar = ChartBarOpen.new\n\n chartBar.numberOpenClosed = numberOpenClosed\n chartBar.numberOpen = numberOpen\n chartBar.numberResolved = numberResolved\n chartBar.numberResolvedKo = numberResolvedKo\n\n @chartBarOpen << chartBar\n\n end",
"def destroy\n @top.destroy\n respond_to do |format|\n format.html { redirect_to tops_url, notice: 'Top was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_bar80\n @bar80 = Bar80.find(params[:id])\n end",
"def display_top(n: 3)\n draw \"Top #{n} sections:\"\n draw \"Top #{n} HTTP status:\"\n draw \"Top #{n} IPs:\"\n draw_eol\n clear_line\n\n sections = @queue.top_sections.first(n)\n statuses = @queue.top_status.first(n)\n ips = @queue.top_ips.first(n)\n\n n.times do |index|\n clear_line\n\n section, section_hits = sections[index]\n status, status_hits = statuses[index]\n ip, ip_hits = ips[index]\n\n draw \" %-19s %-10s\" % [section.to_s.empty? ? '/' : section, section_hits]\n status.nil? ? (draw '') : (draw \" #{status} #{status_hits}\" % [status, status_hits])\n ip.nil? ? (draw '') : (draw \" %-16s %s\" % [ip, ip_hits])\n\n draw_eol\n end\n end",
"def create\n @bar30 = Bar30.new(bar30_params)\n\n respond_to do |format|\n if @bar30.save\n format.html { redirect_to @bar30, notice: \"Bar30 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar30 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar30.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @top_menu = TopMenu.new(params[:top_menu])\n\n respond_to do |format|\n if @top_menu.save\n flash[:notice] = 'TopMenu was successfully created.'\n format.html { redirect_to(@top_menu) }\n format.xml { render :xml => @top_menu, :status => :created, :location => @top_menu }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @top_menu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def top_params\n params.require(:top).permit(:url, :name, :money, :site)\n end",
"def new\n @why_sumbar = WhySumbar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @why_sumbar }\n end\n end",
"def top_data\n \n # Parse parameters\n device = params[:device]\n category = params[:category_top]\n \n # Format the rank we want to search on\n rank = \"top_%s_apps_%s\" % [category, device]\n \n # Get query parameters and add the rank\n query = get_query.merge!({rank => {:$gt => 0}})\n\n # Get list of fields to return\n fields = get_fields\n \n # Get list of fields to remove\n without = get_without_fields\n\n # Check if sorting method is specified\n sort_field = get_sorting(rank)\n \n # If the limit is specified set it otherwise default to 100\n limit_num = get_limit\n \n # Create mongo query.\n # Select based on store where both criteria match:\n # => country is the specified one\n # => rank is greater than 0\n apps = AppData.where(query)\n .sort(sort_field)\n .fields(fields)\n .limit(limit_num)\n .all\n \n # Apply interests weighting if interests exist \n apps = weight_interests(apps, request.query_parameters['interests'])\n \n # Return result as json\n render :json => {\n :success => true,\n :message => \"Success\",\n :apps_data => apps.as_json(:only => fields, :except => without)\n }\n \n end",
"def draw_album_bar\n bar_width = 200\n margin = 15\n box_height = 50\n add_element(ELEMENT,0,0,bar_width,HEIGHT,PRIMARY,MIDDLE, \"rect_album_background\")\n\n # If statements determine the current page number using\n # a instance variable to shift viewable elements out and in\n # of the defined amount of viewable albums\n if !(@page <= 0)\n add_element(ELEMENT,0,0,bar_width,25,HIGHLIGHT,MIDDLE,\"scroll_button_0\")\n end\n if !(@page + @viewable_albums >= @data_array.size)\n # Helps scale button positioning to work around the playbar\n # and prevent the UI overlapping\n @show_playbar ? offset = 100 : offset = 25 \n add_element(ELEMENT,0,HEIGHT - offset,bar_width,25,HIGHLIGHT,MIDDLE,\"scroll_button_1\")\n end\n display_albums(margin, box_height, bar_width)\nend",
"def new\n @sumbar_content = SumbarContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sumbar_content }\n end\n end",
"def new\n @bar = Bar.new\n @button_text = \"Sign up!\"\n @show_tos = true\n @show_password_explanation = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bar }\n end\n end",
"def create\n @bar42 = Bar42.new(bar42_params)\n\n respond_to do |format|\n if @bar42.save\n format.html { redirect_to @bar42, notice: \"Bar42 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar42 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar42.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bar68s = Bar68.all\n end",
"def new\n @non_smoking_bar = NonSmokingBar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @non_smoking_bar }\n end\n end",
"def create\n# @why_sumbar = current_user.why_sumbars.new(params[:why_sumbar])\n @why_sumbar = WhySumbar.new(params[:why_sumbar])\n @why_sumbar.user_id = current_user.id\n\n respond_to do |format|\n if @why_sumbar.save\n format.html { redirect_to @why_sumbar, notice: 'Why sumbar was successfully created.' }\n format.json { render json: @why_sumbar, status: :created, location: @why_sumbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @why_sumbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def new\n redirect_to_home\n \n #@bar_event = BarEvent.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render :json => @bar_event }\n #end\n end",
"def create\n @stack = Stack.new(stack_params)\n\n if @stack.save\n render json: @stack, status: :created, location: @stack\n else\n render json: @stack.errors, status: :unprocessable_entity\n end\n end",
"def top\n redirect_to stats_url\n end",
"def charting\n check_state_and_update\n @titles = Title.build_horizontal_collection(@task.id,current_user.id)\n \n respond_to do |format| \n format.html \n end\n end",
"def hcShowBar _args\n \"hcShowBar _args;\" \n end",
"def create\n @system_overview = SystemOverview.new(system_overview_params)\n\n respond_to do |format|\n if @system_overview.save\n format.html { redirect_to @system_overview, notice: 'System overview was successfully created.' }\n format.json { render :show, status: :created, location: @system_overview }\n else\n format.html { render :new }\n format.json { render json: @system_overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar77 = Bar77.new(bar77_params)\n\n respond_to do |format|\n if @bar77.save\n format.html { redirect_to @bar77, notice: \"Bar77 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar77 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar77.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @troop = Troop.new(troop_params)\n\n if @troop.save\n render :show, status: :created, location: @troop\n else\n render json: @troop.errors, status: :unprocessable_entity\n end\n end",
"def create_guest_tab(supplied_guest)\n @bar_tabs[supplied_guest] = 0\n end",
"def create\n @bar90 = Bar90.new(bar90_params)\n\n respond_to do |format|\n if @bar90.save\n format.html { redirect_to @bar90, notice: \"Bar90 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar90 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar90.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar_item\n @bar_item = BarItem.find(params[:id])\n end",
"def index\n @bar8s = Bar8.all\n end",
"def createWidgets\n @topTab = KDE::TabWidget.new\n\n @mainTabPageHSplitter = Qt::Splitter.new\n @topTab.addTab(@mainTabPageHSplitter, 'Channels')\n\n @mainTabPageHSplitter.addWidget(createChannelAreaWidget)\n\n # Main Tab page. programme table area\n @progTableFrame = Qt::Splitter.new(Qt::Vertical)\n @progTableFrame.addWidget(createProgrammeAreaWidget)\n @progTableFrame.addWidget(createProgrammeSummaryWidget)\n @mainTabPageHSplitter.addWidget(@progTableFrame)\n\n # parameter : Qt::Splitter.setStretchFactor( int index, int stretch )\n @mainTabPageHSplitter.setStretchFactor( 0, 0 )\n @mainTabPageHSplitter.setStretchFactor( 1, 1 )\n\n # dock\n createPlayerDock\n\n\n # Top Tab - Task Page\n @taskWin = TaskWindow.new\n @topTab.addTab(@taskWin, 'Task')\n\n # Top Tab - Schedule Page\n @scheduleWin = ScheduleWindow.new\n @topTab.addTab(@scheduleWin, 'Schedule')\n\n # Top Tab - Log Page\n @logWin = LogWindow.new\n @topTab.addTab(@logWin, 'Log')\n\n\n # set Top Widget & Layout\n setCentralWidget(@topTab)\n end",
"def index #TODO redundant with home\n add_breadcrumb 'Your hubs', :hubs_path\n append_title 'Hubs'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @hubs }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def index\n @barn_configurations = BarnConfiguration.all\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barn_configurations }\n end\n end",
"def post_to_historical(data_hash, title_number)\n\n response = rest_post_call($HISTORIAN_URL + '/' + title_number, data_hash.to_json)\n\n if (response.code != '200') then\n raise \"Failed to create the historical data: \" + response.body\n end\n\n return response.body\nend",
"def add_bar_stacks(time_range, inner_start_value, inner_start_value_used, counts, colors_to_use, y_max, keys, colors, interval)\n\t\tbar_values = [[],[]] # bar_values[0] is the value for each program / bar_values[1] is the total\n\t\ttool_tip = (time_range == 0) ? \"<br>Time: #{(inner_start_value+(inner_start_value_used-inner_start_value.hour).hour).to_s(:time12)}\" : \"<br>Date range: #{inner_start_value_used} | #{inner_start_value_used+interval}\"\n\t\ttmp = 0\n\t\tcounts[0].each do |count|\n\t\t\tif tmp == 0\n\t\t\t\tcolor = colors_to_use[tmp]\n\t\t\t\tbar_values[1] << { \"val\" => count, \"colour\" => color, \"tip\" => \"All Programs \"+tool_tip+\"<br>This Interval: #{count}<br>Running Total: #{counts[1][tmp]}\" }\n\t\t\t\ty_max = count if count > y_max\n\t\t\telsif count != nil\n\t\t\t\tcolor = nil\n\t\t\t\tif colors_to_use[tmp].nil?\n\t\t\t\t\tcolor = colors.size == 0 ? random_color : colors.pop\n\t\t\t\t\tcolors_to_use = colors_to_use.merge( { tmp => color } )\n\t\t\t\t\tkeys[0] << { \"colour\" => color, \"text\" => Unit.find(tmp).name , \"font-size\"=> 9} \n\t\t\t\telse\n\t\t\t\t\tcolor = colors_to_use[tmp]\n\t\t\t\tend\n\t\t\t\tbar_values[0] << { \"val\" => count, \"colour\" => color, \"tip\" => \"#{Unit.find(tmp).name} \"+tool_tip+\"<br>This Interval: #{count} (~ #{ (count.to_f / counts[0][0]*100).to_i unless counts[0][0].nil? || counts[0][0] == 0 }% )<br>Running Total: #{counts[1][tmp]} (~ #{ (counts[1][tmp].to_f / counts[1][0]*100).to_i unless counts[1][0].nil? || counts[1][0] == 0 }% )\" }\n\t\t\tend\n\t\t\ttmp += 1\n\t\tend\n\t\treturn [bar_values, colors, colors_to_use, y_max, keys]\n\tend",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end"
] | [
"0.63054585",
"0.58808243",
"0.5842777",
"0.5764179",
"0.5598212",
"0.5550156",
"0.55280316",
"0.54193044",
"0.5368331",
"0.53079444",
"0.5147426",
"0.5113014",
"0.50867176",
"0.5082762",
"0.5045289",
"0.5043123",
"0.503894",
"0.5021577",
"0.49959806",
"0.49874905",
"0.4963999",
"0.4960496",
"0.4948922",
"0.49304748",
"0.49276984",
"0.4902482",
"0.4867722",
"0.4852622",
"0.48470291",
"0.48218673",
"0.48110813",
"0.48048857",
"0.48043957",
"0.47990283",
"0.47853768",
"0.4769957",
"0.47550732",
"0.47498888",
"0.4744941",
"0.47337908",
"0.47315127",
"0.47297826",
"0.47288504",
"0.47178498",
"0.47110215",
"0.4710335",
"0.4700513",
"0.46969944",
"0.4696656",
"0.46940032",
"0.4684518",
"0.46795005",
"0.46770924",
"0.46762016",
"0.46712852",
"0.46712187",
"0.4657595",
"0.46527788",
"0.4651338",
"0.464339",
"0.46427265",
"0.46320182",
"0.4631797",
"0.46140036",
"0.4611551",
"0.45882514",
"0.4580986",
"0.45803723",
"0.4571545",
"0.45686245",
"0.45679495",
"0.45664665",
"0.45642182",
"0.4563093",
"0.4558375",
"0.4551142",
"0.45488212",
"0.4543854",
"0.45385587",
"0.45381108",
"0.4532032",
"0.45276538",
"0.45269924",
"0.45127305",
"0.45063826",
"0.45055452",
"0.45015106",
"0.44978976",
"0.44963104",
"0.44961238",
"0.4487785",
"0.44872606",
"0.44863945",
"0.44854417",
"0.44759545",
"0.44715926",
"0.44633597",
"0.44628736",
"0.4455576",
"0.4448781"
] | 0.6848883 | 0 |
PUT /ios_topbars/1 PUT /ios_topbars/1.json | def update
@ios_topbar = @user.ios_topbar
respond_to do |format|
if @ios_topbar.update_attributes(params[:ios_topbar])
format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created, location: @ios_topbar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ios_topbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @ios_topbar = @user.ios_topbar\n @ios_topbar.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def new\n @ios_topbar = @user.build_ios_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ios_topbar }\n end\n end",
"def update\n respond_to do |format|\n if @top.update(top_params)\n format.html { redirect_to @top, notice: 'Top was successfully updated.' }\n format.json { render :show, status: :ok, location: @top }\n else\n format.html { render :edit }\n format.json { render json: @top.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider_top.update(slider_top_params)\n format.html { redirect_to @slider_top, notice: 'Slider top was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_top }\n else\n format.html { render :edit }\n format.json { render json: @slider_top.errors, status: :unprocessable_entity }\n end\n end\n end",
"def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end",
"def update\n if @set_top_box.update(set_top_box_params)\n flash[:success] = \"Update success!\"\n redirect_to @set_top_box\n else\n render 'edit'\n end\n end",
"def show\n @ios_topbar = @user.ios_topbar\n\n if @ios_topbar == nil\n @ios_topbar = @user.build_ios_topbar\n render action: \"new\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ios_topbar }\n end\n end\n end",
"def set_bar80\n @bar80 = Bar80.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar80.update(bar80_params)\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar80 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_boss_hp_bar\n return unless @boss_hp_bar\n @boss_hp_bar.update\n end",
"def update\n @top_up = TopUp.find(params[:id])\n\n respond_to do |format|\n if @top_up.update_attributes(params[:top_up])\n format.html { redirect_to @top_up, notice: 'Top up was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @top_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar_item\n @bar_item = BarItem.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @topup.update(topup_params)\n format.html { redirect_to @topup, notice: 'Topup was successfully updated.' }\n format.json { render :show, status: :ok, location: @topup }\n else\n format.html { render :edit }\n format.json { render json: @topup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_info_bars\n @info_bars.each_value do |info_bars|\n info_bars.each(&:update)\n end\n end",
"def update\n respond_to do |format|\n if @top_category.update(top_category_params)\n format.json { render :show, status: :ok, location: @top_category }\n else\n format.json { render json: @top_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar74\n @bar74 = Bar74.find(params[:id])\n end",
"def set_top\n @top = Top.find(params[:id])\n end",
"def set_topup\n @topup = Topup.find(params[:id])\n end",
"def set_bar8\n @bar8 = Bar8.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar8.update(bar8_params)\n format.html { redirect_to @bar8, notice: \"Bar8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar8.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_baristum\n @baristum = Baristum.find(params[:id])\n end",
"def set_bar\n @bar = Bar.find(params[:id])\n end",
"def set_bar\n @bar = Bar.find(params[:id])\n end",
"def set_bar22\n @bar22 = Bar22.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @topi.update(topi_params)\n format.html { redirect_to @topi, notice: 'Topi was successfully updated.' }\n format.json { render :show, status: :ok, location: @topi }\n else\n format.html { render :edit }\n format.json { render json: @topi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar68\n @bar68 = Bar68.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar52.update(bar52_params)\n format.html { redirect_to @bar52, notice: \"Bar52 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar52 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar52.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar76\n @bar76 = Bar76.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar74.update(bar74_params)\n format.html { redirect_to @bar74, notice: \"Bar74 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar74 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar74.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar52\n @bar52 = Bar52.find(params[:id])\n end",
"def set_bar90\n @bar90 = Bar90.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @baristum.update(baristum_params)\n format.html { redirect_to @baristum, notice: 'Baristum was successfully updated.' }\n format.json { render :show, status: :ok, location: @baristum }\n else\n format.html { render :edit }\n format.json { render json: @baristum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar.update(bar_params)\n format.html { redirect_to @bar, notice: 'Bar was successfully updated.' }\n format.json { render :show, status: :ok, location: @bar }\n else\n format.html { render :edit }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar71\n @bar71 = Bar71.find(params[:id])\n end",
"def set_bar50\n @bar50 = Bar50.find(params[:id])\n end",
"def set_topi\n @topi = Topi.find(params[:id])\n end",
"def update\n bosses_update\n update_boss_hp_bar\n end",
"def update\n respond_to do |format|\n if @bar50.update(bar50_params)\n format.html { redirect_to @bar50, notice: \"Bar50 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar50 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar50.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar77\n @bar77 = Bar77.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar76.update(bar76_params)\n format.html { redirect_to @bar76, notice: \"Bar76 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar76 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar76.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar_item.update(bar_item_params)\n format.html { redirect_to @bar_item, notice: 'Bar item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bar_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar81\n @bar81 = Bar81.find(params[:id])\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 respond_to do |format|\n if @bar71.update(bar71_params)\n format.html { redirect_to @bar71, notice: \"Bar71 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar71 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar71.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_space_in_system(slug, body, headers=default_headers)\n @logger.info(\"Updating Space \\\"#{slug}\\\"\")\n put(\"#{@api_url}/spaces/#{slug}\", body, headers)\n end",
"def set_bar42\n @bar42 = Bar42.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar68.update(bar68_params)\n format.html { redirect_to @bar68, notice: \"Bar68 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar68 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar68.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless user_signed_in? && current_user.admin?\n flash[:notice] = \"You don't have access to that page!\"\n redirect_to root_path\n return\n end\n respond_to do |format|\n if @bar.update(bar_params)\n format.html { redirect_to @bar, notice: 'Bar was successfully updated.' }\n format.json { render :show, status: :ok, location: @bar }\n else\n format.html { render :edit }\n format.json { render json: @bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @non_smoking_bar = NonSmokingBar.find(params[:id])\n\n respond_to do |format|\n if @non_smoking_bar.update_attributes(params[:non_smoking_bar])\n format.html { redirect_to root_url, notice: 'Successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @non_smoking_bar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar30\n @bar30 = Bar30.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar82.update(bar82_params)\n format.html { redirect_to @bar82, notice: \"Bar82 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar82 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar82.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status_bar\n VIM::evaluate(\"genutils#MoveCursorToWindow(1)\")\n @status_buffer[1] = \" \"*@width\n print_to_buffer(@status_buffer, 1, 0, \"Money: #{@city.coins.round}\")\n print_to_buffer(@status_buffer, 1, 18, \"Population: #{@city.population.round} / #{@city.population_cap}\")\n print_to_buffer(@status_buffer, 1, 40, \"Free people: #{@city.free_workers.round}\")\n print_to_buffer(@status_buffer, 1, 60, \"Oxygen: #{@city.oxygen.round}\")\n print_to_buffer(@status_buffer, 2, 90, \"- Press '?' for commands -\")\n VIM::evaluate(\"genutils#MoveCursorToWindow(2)\")\n end",
"def set_top5\n @top5 = Top5.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar77.update(bar77_params)\n format.html { redirect_to @bar77, notice: \"Bar77 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar77 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar77.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar22.update(bar22_params)\n format.html { redirect_to @bar22, notice: \"Bar22 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar22 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar22.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to_home\n \n #@bar_event = BarEvent.find(params[:id])\n\n #respond_to do |format|\n # if @bar_event.update_attributes(params[:bar_event])\n # format.html { redirect_to @bar_event, :notice => 'Bar event was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @bar_event.errors, :status => :unprocessable_entity }\n # end\n #end\n end",
"def update\n @stack = Stack.find(params[:id])\n\n if @stack.update(stack_params)\n head :no_content\n else\n render json: @stack.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bar81.update(bar81_params)\n format.html { redirect_to @bar81, notice: \"Bar81 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar81 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar81.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar90.update(bar90_params)\n format.html { redirect_to @bar90, notice: \"Bar90 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar90 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar90.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bar_item_params\n params.require(:bar_item).permit(:ticket_id, :bar_menu_item_id, :bar_closeout)\n end",
"def update\n respond_to do |format|\n if @bar42.update(bar42_params)\n format.html { redirect_to @bar42, notice: \"Bar42 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar42 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar42.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar18\n @bar18 = Bar18.find(params[:id])\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @male_shot_put_head.update(male_shot_put_head_params)\n format.html { redirect_to @male_shot_put_head, notice: 'Male shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @male_shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @male_shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar_graph.update(bar_graph_params)\n format.html { redirect_to edit_bar_graph_path(@bar_graph), notice: 'Bar graph was successfully updated.' }\n format.json { render :edit, status: :ok, location: @bar_graph }\n else\n format.html { render :edit }\n format.json { render json: @bar_graph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_slider_top\n @slider_top = SliderTop.find(params[:id])\n end",
"def set_system_overview\n @system_overview = SystemOverview.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @bar30.update(bar30_params)\n format.html { redirect_to @bar30, notice: \"Bar30 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar30 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar30.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_set_top_box\n if SetTopBox.where(id: params[:id]).blank?\n redirect_to home_path\n else\n @set_top_box = SetTopBox.find(params[:id])\n end\n end",
"def update\n respond_to do |format|\n if @top_category.update(category_params)\n format.html { redirect_to @top_category, notice: ' top_category was successfully updated.' }\n format.json { render :show, status: :ok, location: @top_category }\n else\n format.html { render :edit }\n format.json { render json: @top_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_top_box_params\n params.require(:set_top_box).permit(:name, :description)\n end",
"def update\n respond_to do |format|\n if @bar18.update(bar18_params)\n format.html { redirect_to @bar18, notice: \"Bar18 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar18 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar18.errors, status: :unprocessable_entity }\n end\n end\n end",
"def topology_tag_uuid_put_with_http_info(topotaguuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TopologiesApi.topology_tag_uuid_put ...'\n end\n # verify the required parameter 'topotaguuid' is set\n if @api_client.config.client_side_validation && topotaguuid.nil?\n fail ArgumentError, \"Missing the required parameter 'topotaguuid' when calling TopologiesApi.topology_tag_uuid_put\"\n end\n # resource path\n local_var_path = '/ttms/1.0.0/topology_tag/{topotaguuid}/'.sub('{' + 'topotaguuid' + '}', topotaguuid.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 # 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[:'topotagupdateresponse'])\n auth_names = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'Topology')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TopologiesApi#topology_tag_uuid_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if params[:commit] == 'Display'\n @promobar.update_attribute(\"promobar_show\", true)\n elsif params[:commit] == 'Hide'\n @promobar.update_attribute(\"promobar_show\", false)\n elsif params[:commit] == 'Back'\n format.html { redirect_to root_url(:protocol => 'https', :shop => params[:shop_domain]) }\n end\n\n @subheader = @promobar.subheader \n @store_promobars = Promobar.where(:shop_domain => params[:shop_domain])\n unless @store_promobars.empty? and promobar_params[:change_time] != \"\" and promobar_params[:change_time] != nil\n @store_promobars.each do |bar|\n bar.update_attributes(:change_time => promobar_params[:change_time])\n end\n end\n if @promobar.update_attributes(promobar_params) \n format.html { redirect_to root_url(:protocol => 'https', :shop => params[:shop_domain]), notice: 'Promobar was successfully updated.' }\n format.json { redirect_to root_url(:protocol => 'https', :shop => params[:shop_domain]), location: @promobar, notice: 'Promobar was successfully updated.' }\n else\n flash[:error] = @promobar.errors.full_messages\n format.html { redirect_to :back }\n format.json { render json: @promobar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bar34.update(bar34_params)\n format.html { redirect_to @bar34, notice: \"Bar34 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar34 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bar34.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @top = Top.new(top_params)\n\n respond_to do |format|\n if @top.save\n format.html { redirect_to @top, notice: 'Top was successfully created.' }\n format.json { render :show, status: :created, location: @top }\n else\n format.html { render :new }\n format.json { render json: @top.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bar_event = BarEvent.new\n @bar_event.bar_id = params[:bar_id]\n @bar_event.detail = params[:detail]\n \n #for header in request.env.select {|k,v| k.match(\"^HTTP.*\")}\n # print header\n #end\n #print \"Bar id: \" + request.env[\"HTTP_BAR_ID\"] + \"\\n\"\n #print \"Session id: \" + request.env[\"HTTP_SESSION_ID\"] + \"\\n\"\n #print \"Bar name: \" + request.env[\"HTTP_BAR_NAME\"] + \"\\n\"\n #print \"CSRF token: \" + request.env[\"HTTP_X_CSRF_TOKEN\"] + \"\\n\"\n \n # Get data and save to the bar_event object\n #print params.to_s\n\n respond_to do |format|\n if @bar_event.save\n #format.html { redirect_to @bar_event, :notice => 'Bar event was successfully created.' }\n format.html { render :text => @bar_event.id }\n format.json { render :json => @bar_event, :status => :created, :location => @bar_event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bar_event.errors, :status => :unprocessable_entity }\n end\n\tend\n end",
"def show\n @top_up = TopUp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @top_up }\n end\n end",
"def update_waybar\n `pkill -RTMIN+8 waybar`\nend",
"def index\n @topups = Topup.all\n end",
"def update\n @why_sumbar = WhySumbar.find(params[:id])\n\n respond_to do |format|\n if @why_sumbar.update_attributes(params[:why_sumbar])\n format.html { redirect_to @why_sumbar, notice: 'Why sumbar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @why_sumbar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bar_items = BarItem.all\n end",
"def set_newsbar\n @newsbar = Newsbar.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @top5.update(top5_params)\n @status = 'success'\n @action = 'update'\n format.js { render :index } \n \n else\n @status = 'danger'\n format.js { render :edit }\n \n end\n end\n end",
"def set_top_category\n @top_category = TopCategory.find(params[:id])\n end",
"def bar_params\n params.require(:bar).permit(:title)\n end",
"def set_bar13\n @bar13 = Bar13.find(params[:id])\n end",
"def put(value)\n $_api_queue.clear\n puts \"#{ApiSettings::API_PUT_PREFIX}#{value.to_s}#{ApiSettings::API_CMD_SUFFIX}\"\nend",
"def status_bar_item\n @status_bar_item ||= NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength)\n @status_bar_item.target = self\n @status_bar_item.action = :\"item_clicked:\"\n @status_bar_item\n end",
"def update\n if @troop.update(troop_params)\n render :show, status: :ok, location: @troop\n else\n render json: @troop.errors, status: :unprocessable_entity\n end\n end",
"def set_baz80\n @baz80 = Baz80.find(params[:id])\n end",
"def index\n @user=current_user\n\t @bars = @user.bars\n\t bar_num = @user.bars.count\n\t logger.error \"Bar Num: #{bar_num}\"\n\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bars }\n\tend\n end",
"def set_male_shot_put_head\n @male_shot_put_head = MaleShotPutHead.find(params[:id])\n end",
"def update\n @bucket = current_user.buckets.find(params[:id])\n respond_to do |format|\n if @bucket.update_attributes(params[:bucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(@bucket) }\n format.xml { head :ok }\n format.iphone { redirect_to(@bucket) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bucket.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"edit\", :layout => false}\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_overview.update(system_overview_params)\n format.html { redirect_to @system_overview, notice: 'System overview was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_overview }\n else\n format.html { render :edit }\n format.json { render json: @system_overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def create\n @bar80 = Bar80.new(bar80_params)\n\n respond_to do |format|\n if @bar80.save\n format.html { redirect_to @bar80, notice: \"Bar80 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar80 }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bar80.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_bar82\n @bar82 = Bar82.find(params[:id])\n end"
] | [
"0.6147237",
"0.58415157",
"0.5777632",
"0.5756605",
"0.56879574",
"0.56521755",
"0.56232065",
"0.5592485",
"0.55634034",
"0.5460779",
"0.5442371",
"0.54187995",
"0.54149514",
"0.53758353",
"0.53338075",
"0.53068495",
"0.5272955",
"0.5256504",
"0.52412534",
"0.5218861",
"0.5205574",
"0.51939166",
"0.519283",
"0.519283",
"0.5165787",
"0.51594996",
"0.5157816",
"0.5125528",
"0.5124059",
"0.51232475",
"0.51151973",
"0.51121086",
"0.5108336",
"0.5077566",
"0.507708",
"0.50741905",
"0.50691444",
"0.50652444",
"0.5062679",
"0.5062486",
"0.50619227",
"0.50613064",
"0.5052137",
"0.5017979",
"0.5013805",
"0.5013077",
"0.5003016",
"0.49913898",
"0.49837047",
"0.49736643",
"0.49530178",
"0.49468797",
"0.49442488",
"0.49357134",
"0.49305752",
"0.49224252",
"0.49207443",
"0.49159765",
"0.4910002",
"0.49025458",
"0.48887402",
"0.4886775",
"0.48844564",
"0.48799402",
"0.4878834",
"0.4866891",
"0.48618364",
"0.48551634",
"0.48452997",
"0.48446226",
"0.48427495",
"0.4830117",
"0.48286802",
"0.48225987",
"0.48116842",
"0.481083",
"0.48038873",
"0.47917643",
"0.4774331",
"0.47656894",
"0.47647116",
"0.4764143",
"0.47616345",
"0.47559303",
"0.4750106",
"0.47496048",
"0.47480962",
"0.4740212",
"0.47286484",
"0.47261786",
"0.47194064",
"0.47164738",
"0.47162703",
"0.47112",
"0.470887",
"0.47081423",
"0.47056752",
"0.47013825",
"0.4697354",
"0.4690437"
] | 0.69610995 | 0 |
DELETE /ios_topbars/1 DELETE /ios_topbars/1.json | def destroy
@ios_topbar = @user.ios_topbar
@ios_topbar.destroy
respond_to do |format|
format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # Make sure the request came from an admin\n unless session[:admin_id]\n redirect_to_home\n return\n end\n \n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar_item.destroy\n respond_to do |format|\n format.html { redirect_to bar_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar80.destroy\n respond_to do |format|\n format.html { redirect_to bar80s_url, notice: \"Bar80 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar71.destroy\n respond_to do |format|\n format.html { redirect_to bar71s_url, notice: \"Bar71 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def test_del\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 id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @bar74.destroy\n respond_to do |format|\n format.html { redirect_to bar74s_url, notice: \"Bar74 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar68.destroy\n respond_to do |format|\n format.html { redirect_to bar68s_url, notice: \"Bar68 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar8.destroy\n respond_to do |format|\n format.html { redirect_to bar8s_url, notice: \"Bar8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @why_sumbar = WhySumbar.find(params[:id])\n @why_sumbar.destroy\n\n respond_to do |format|\n format.html { redirect_to why_sumbars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @top_up = TopUp.find(params[:id])\n @top_up.destroy\n\n respond_to do |format|\n format.html { redirect_to top_ups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar52.destroy\n respond_to do |format|\n format.html { redirect_to bar52s_url, notice: \"Bar52 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @non_smoking_bar = NonSmokingBar.find(params[:id])\n @non_smoking_bar.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Successfully deleted.' }\n format.json { head :ok }\n end\n end",
"def destroy\n @bar76.destroy\n respond_to do |format|\n format.html { redirect_to bar76s_url, notice: \"Bar76 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar64.destroy\n respond_to do |format|\n format.html { redirect_to bar64s_url, notice: \"Bar64 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar50.destroy\n respond_to do |format|\n format.html { redirect_to bar50s_url, notice: \"Bar50 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar81.destroy\n respond_to do |format|\n format.html { redirect_to bar81s_url, notice: \"Bar81 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar.destroy\n respond_to do |format|\n format.html { redirect_to bars_url, notice: 'Bar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar.destroy\n respond_to do |format|\n format.html { redirect_to bars_url, notice: 'Bar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar18.destroy\n respond_to do |format|\n format.html { redirect_to bar18s_url, notice: \"Bar18 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @top.destroy\n respond_to do |format|\n format.html { redirect_to tops_url, notice: 'Top was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar77.destroy\n respond_to do |format|\n format.html { redirect_to bar77s_url, notice: \"Bar77 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar84.destroy\n respond_to do |format|\n format.html { redirect_to bar84s_url, notice: \"Bar84 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foobar = Foobar.find(params[:id])\n @foobar.destroy\n\n respond_to do |format|\n format.html { redirect_to foobars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar42.destroy\n respond_to do |format|\n format.html { redirect_to bar42s_url, notice: \"Bar42 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar90.destroy\n respond_to do |format|\n format.html { redirect_to bar90s_url, notice: \"Bar90 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar34.destroy\n respond_to do |format|\n format.html { redirect_to bar34s_url, notice: \"Bar34 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz72.destroy\n respond_to do |format|\n format.html { redirect_to baz72s_url, notice: \"Baz72 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar22.destroy\n respond_to do |format|\n format.html { redirect_to bar22s_url, notice: \"Bar22 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar82.destroy\n respond_to do |format|\n format.html { redirect_to bar82s_url, notice: \"Bar82 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sumbar_content = SumbarContent.find(params[:id])\n @sumbar_content.destroy\n\n respond_to do |format|\n format.html { redirect_to sumbar_contents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baristum.destroy\n respond_to do |format|\n format.html { redirect_to barista_url, notice: 'Baristum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar_graph.destroy\n respond_to do |format|\n format.html { redirect_to bar_graphs_url, notice: 'Bar graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar47.destroy\n respond_to do |format|\n format.html { redirect_to bar47s_url, notice: \"Bar47 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_top.destroy\n respond_to do |format|\n format.html { redirect_to slider_tops_url, notice: 'Slider top was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar_menu_item.destroy\n respond_to do |format|\n format.html { redirect_to bar_menu_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar30.destroy\n respond_to do |format|\n format.html { redirect_to bar30s_url, notice: \"Bar30 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar_event = BarEvent.find(params[:id])\n @bar_event.destroy\n\n respond_to do |format|\n #format.html { redirect_to bar_events_url }\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @overall.destroy\n respond_to do |format|\n format.html { redirect_to overalls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @male_shot_put_head.destroy\n respond_to do |format|\n format.html { redirect_to male_shot_put_heads_url, notice: 'Male shot put head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar36.destroy\n respond_to do |format|\n format.html { redirect_to bar36s_url, notice: \"Bar36 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ambush = Ambush.find(params[:id])\n @ambush.destroy\n\n respond_to do |format|\n format.html { redirect_to ambushes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rackitem = Rackitem.find(params[:id])\n @rackitem.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Rackitem removed' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrio = Barrio.find(params[:id])\n @barrio.destroy\n\n respond_to do |format|\n format.html { redirect_to barrios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @topup.destroy\n respond_to do |format|\n format.html { redirect_to topups_url, notice: 'Topup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_admin_user\n @tablet = Tablet.find(params[:id])\n @tablet.destroy\n\n respond_to do |format|\n format.html { redirect_to tablets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrio = Barrio.find(params[:id])\n @barrio.destroy\n\n respond_to do |format|\n format.html { redirect_to barrios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz80.destroy\n respond_to do |format|\n format.html { redirect_to baz80s_url, notice: \"Baz80 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar97.destroy\n respond_to do |format|\n format.html { redirect_to bar97s_url, notice: \"Bar97 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @topi.destroy\n respond_to do |format|\n format.html { redirect_to topis_url, notice: 'Topi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tuoshui = Tuoshui.find(params[:id])\n @tuoshui.destroy\n\n respond_to do |format|\n format.html { redirect_to tuoshuis_url }\n format.json { head :ok }\n end\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",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dockyard = Dockyard.find(params[:id])\n @dockyard.destroy\n\n respond_to do |format|\n format.html { redirect_to dockyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bar13.destroy\n respond_to do |format|\n format.html { redirect_to bar13s_url, notice: \"Bar13 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @bar4.destroy\n respond_to do |format|\n format.html { redirect_to bar4s_url, notice: \"Bar4 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_history.destroy\n respond_to do |format|\n format.html { redirect_to bmet_item_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barometer.destroy\n respond_to do |format|\n format.html { redirect_to barometers_url, notice: 'Barometer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz8.destroy\n respond_to do |format|\n format.html { redirect_to baz8s_url, notice: \"Baz8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo62.destroy\n respond_to do |format|\n format.html { redirect_to foo62s_url, notice: \"Foo62 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo52.destroy\n respond_to do |format|\n format.html { redirect_to foo52s_url, notice: \"Foo52 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n unless user_signed_in? && current_user.admin?\n flash[:notice] = \"You don't have access to that page!\"\n redirect_to root_path\n return\n end\n @bar.destroy\n respond_to do |format|\n format.html { redirect_to bars_url, notice: 'Bar was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_state.destroy\n\n head :no_content\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @foo8.destroy\n respond_to do |format|\n format.html { redirect_to foo8s_url, notice: \"Foo8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @size.destroy\n\n render json: @size, status: :ok#, location: @size\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @top5.destroy\n @status = 'success'\n @action = 'destroy'\n respond_to do |format|\n format.js { render :index } \n end\n end",
"def destroy\n @bucket = current_user.buckets.find(params[:id])\n @bucket.destroy\n\n respond_to do |format|\n format.html { redirect_to(buckets_url) }\n format.xml { head :ok }\n format.iphone { render :layout => false}\n end\n end",
"def destroy\n @top_category.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrio_colonium.destroy\n respond_to do |format|\n format.html { redirect_to barrio_colonia_url, notice: 'Barrio colonium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @components_bottom_bracket = Components::BottomBracket.find(params[:id])\n @components_bottom_bracket.destroy\n\n respond_to do |format|\n format.html { redirect_to(components_bottom_brackets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\t@bar = Bar.find(params[:id])\n\t@user = @bar.user\n @bar.destroy\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Bar was successfully deleted.'}\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @foo71.destroy\n respond_to do |format|\n format.html { redirect_to foo71s_url, notice: \"Foo71 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz62.destroy\n respond_to do |format|\n format.html { redirect_to baz62s_url, notice: \"Baz62 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barn = Barn.find(params[:id])\n @barn.destroy\n\n respond_to do |format|\n format.html { redirect_to barns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo51.destroy\n respond_to do |format|\n format.html { redirect_to foo51s_url, notice: \"Foo51 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo56.destroy\n respond_to do |format|\n format.html { redirect_to foo56s_url, notice: \"Foo56 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo81.destroy\n respond_to do |format|\n format.html { redirect_to foo81s_url, notice: \"Foo81 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @foo83.destroy\n respond_to do |format|\n format.html { redirect_to foo83s_url, notice: \"Foo83 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmalltrapinfo = Mostsmalltrapinfo.find(params[:id])\n @mostsmalltrapinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapinfos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foo88.destroy\n respond_to do |format|\n format.html { redirect_to foo88s_url, notice: \"Foo88 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_haiku = Api::Haiku.find(params[:id])\n @api_haiku.destroy\n\n respond_to do |format|\n format.html { redirect_to api_haikus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tablet = Tablet.find(params[:id])\n @tablet.destroy\n\n respond_to do |format|\n format.html { redirect_to tablets_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @thermostat_history.destroy\n respond_to do |format|\n format.html { redirect_to thermostat_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz55.destroy\n respond_to do |format|\n format.html { redirect_to baz55s_url, notice: \"Baz55 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @top_standing_entry.destroy\n respond_to do |format|\n format.html { redirect_to top_standing_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @foo58.destroy\n respond_to do |format|\n format.html { redirect_to foo58s_url, notice: \"Foo58 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end"
] | [
"0.67203504",
"0.6693712",
"0.66052395",
"0.6596948",
"0.65449905",
"0.6540875",
"0.65384316",
"0.65342724",
"0.65323496",
"0.65127444",
"0.6466629",
"0.64347625",
"0.64247054",
"0.63976705",
"0.6392009",
"0.63696116",
"0.63678545",
"0.6366376",
"0.6366376",
"0.63474625",
"0.6340433",
"0.63356996",
"0.6329676",
"0.63067615",
"0.6300478",
"0.6290482",
"0.6289858",
"0.62735504",
"0.6267643",
"0.62642884",
"0.6256814",
"0.624817",
"0.6213585",
"0.6212337",
"0.6205363",
"0.6199714",
"0.61954814",
"0.6175897",
"0.61734325",
"0.6171688",
"0.6156281",
"0.61556005",
"0.6151227",
"0.6135672",
"0.61335814",
"0.61333764",
"0.6130814",
"0.612769",
"0.6115468",
"0.61128926",
"0.6105091",
"0.60850585",
"0.60850585",
"0.60850585",
"0.60850585",
"0.6080546",
"0.6076069",
"0.60641164",
"0.60640806",
"0.6062181",
"0.60609114",
"0.60505205",
"0.6047164",
"0.60459256",
"0.60445476",
"0.60425013",
"0.604036",
"0.6037468",
"0.60357875",
"0.60290176",
"0.602723",
"0.60212195",
"0.6019836",
"0.6018765",
"0.6016431",
"0.6015073",
"0.6012978",
"0.6002678",
"0.6002463",
"0.5999903",
"0.59926367",
"0.59920007",
"0.59852237",
"0.59784305",
"0.5973507",
"0.59718734",
"0.59698343",
"0.59684163",
"0.59672165",
"0.5966972",
"0.59669656",
"0.59647554",
"0.59611493",
"0.59609705",
"0.5956897",
"0.5955489",
"0.59496516",
"0.59395033",
"0.59371454",
"0.59347105"
] | 0.7557382 | 0 |
Description Test useful to check correctness of conversion and cross browser visibility of all elements of kind Video Mode Html Specific filters ApplicationControlleradmin_authenticate Skipped filters ApplicationControllerauthenticate ApplicationControllerinitialize_location ApplicationControllerinitialize_players_counter | def videos_test
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_video_element(video_doc, video_options)\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:gallery_loc').text).to eq(video_options[:gallery_loc])\n expect(video_doc.at_xpath('video:gallery_loc').attribute('title').text).to eq(video_options[:gallery_title])\n expect(video_doc.at_xpath('video:title').text).to eq(video_options[:title])\n expect(video_doc.at_xpath('video:view_count').text).to eq(video_options[:view_count].to_s)\n expect(video_doc.at_xpath('video:duration').text).to eq(video_options[:duration].to_s)\n expect(video_doc.at_xpath('video:rating').text).to eq('%0.1f' % video_options[:rating])\n expect(video_doc.at_xpath('video:content_loc').text).to eq(video_options[:content_loc])\n expect(video_doc.at_xpath('video:category').text).to eq(video_options[:category])\n expect(video_doc.xpath('video:tag').collect(&:text)).to eq(video_options[:tags])\n expect(video_doc.at_xpath('video:expiration_date').text).to eq(video_options[:expiration_date].iso8601)\n expect(video_doc.at_xpath('video:publication_date').text).to eq(video_options[:publication_date].iso8601)\n expect(video_doc.at_xpath('video:player_loc').text).to eq(video_options[:player_loc])\n expect(video_doc.at_xpath('video:player_loc').attribute('allow_embed').text).to eq(video_options[:allow_embed] ? 'yes' : 'no')\n expect(video_doc.at_xpath('video:player_loc').attribute('autoplay').text).to eq(video_options[:autoplay])\n expect(video_doc.at_xpath('video:uploader').text).to eq(video_options[:uploader])\n expect(video_doc.at_xpath('video:uploader').attribute('info').text).to eq(video_options[:uploader_info])\n expect(video_doc.at_xpath('video:price').text).to eq(video_options[:price].to_s)\n expect(video_doc.at_xpath('video:price').attribute('resolution').text).to eq(video_options[:price_resolution].to_s)\n expect(video_doc.at_xpath('video:price').attribute('type').text).to eq(video_options[:price_type].to_s)\n expect(video_doc.at_xpath('video:price').attribute('currency').text).to eq(video_options[:price_currency].to_s)\n xml_fragment_should_validate_against_schema(video_doc, 'sitemap-video', 'xmlns:video' => SitemapGenerator::SCHEMAS['video'])\n end",
"def verify_user_can_access_channel_or_video\n public_token = params[:channel_token]\n user_can_access_either_one = (public_token and public_token.strip == @video.channel.public_token) || user_can_access_channel\n \n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end",
"def check_for_modern_browser\n if browser.ie6? || browser.ie7?\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end\n end",
"def test_on_legacy_browsers\n for legacy_browser in LEGACY_BROWSERS\n @request.user_agent = legacy_browser\n get :index\n assert_response :success\n assert_select 'div[style*=filter:progid:DXImageTransform.Microsoft.AlphaImageLoader]'\n assert_select 'div[style*=height:175px]'\n assert_select 'div[style*=width:120px]'\n end\n end",
"def verify_user_owns_video\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end",
"def verify_user_can_access_channel\n unless user_can_access_channel\n if (params[:controller] == \"channels\" && params[:action] == \"show\")\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n else\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end\n end\n end",
"def verify_user_owns_page\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end",
"def verify_user_owns_channel\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end",
"def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend",
"def verify_current_user_is_not_blocked\n unless current_user.blank? || current_user?(@user)\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end\n end",
"def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end",
"def decide_interested_video_type\n \n end",
"def show\n @seo_video = true # let app header know this is an seo page\n # Consider errors and render seovideo page\n @auth_failure = params[:auth_failure] == '1'\n @auth_strategy = params[:auth_strategy]\n @access_error = params[:access] == \"nos\"\n @invite_error = params[:invite] == \"invalid\"\n\n @from_similar_video = params[:s]\n\n # route guarantees provider_name and provider_id will exist\n @video_provider_name = params.delete(:provider_name)\n @video_provider_id = params.delete(:provider_id)\n @is_mobile = is_mobile?\n @user_signed_in = user_signed_in?\n\n # set all other @video_ variables relevant to primary video\n getVideo(@video_provider_name, @video_provider_id)\n # if the primary video isn't available, means we can't really show a great page, rescue_from catches error\n\n # we'll return a page regardless of how successful the rest of these are\n getRecommendedVideos()\n getConversations()\n splitConversationMessagesByNetwork()\n setMetaDescription()\n\n # A/B tests\n #@seo_show_play_on_related = ab_test :seo_show_play_on_related\n #@seo_messaging_v2 = ab_test :seo_messaging_v2\n=begin\n # if the referrer is google search, parse the search query out of its url\n http_referer = request.env[\"HTTP_REFERER\"]\n if http_referer && http_referer.length > 0\n # the parser doesn't know it's an http url without the protocol, so ensure\n # that it starts with http://\n unless http_referer.start_with? 'http://'\n if http_referer.start_with? 'https://'\n http_referer.slice! 4\n else\n http_referer = 'http://' + http_referer\n end\n end\n\n begin\n referer_uri = Addressable::URI.parse(http_referer)\n rescue Exception => e\n #don't want to blow up on uri parsing errors, but log them so we have some way of tracking them\n Rails.logger.info \"SEO Page Parse Referer URI Failed (ignoring): #{e}\"\n return\n end\n\n if referer_host = referer_uri.host\n if referer_host.start_with?('http://google.') || referer_host.start_with?('google.') || referer_host.include?('.google.')\n if query_values = referer_uri.query_values\n # its a google url so grab the search query\n if @search_query = query_values[\"q\"]\n # check if the google url specified an encoding for the search query and if so decode it accordingly\n if search_query_encoding = query_values[\"ie\"]\n if encoding_obj = Encoding.list.find {|enc| enc.name.casecmp(search_query_encoding) == 0 }\n # re-encode the search query as UTF-8, respecting the input encoding that was passed to google\n @search_query.encode!('utf-8', encoding_obj, :invalid => :replace, :undef => :replace, :replace => '?')\n end\n end\n end\n end\n end\n end\n end\n=end\n\n respond_to do |format|\n format.html { render }\n format.any { head :not_found }\n end\n\n end",
"def w3c_tests # :nologin:\n render(layout: false)\n end",
"def get_info()\n video_array=[]\n max_info_length = 0\n max_video_info_num = \"\"\n max_video_info = \"\"\n j=0\n\n def displayed?(locator)\n puts \"looking for #{locator}\"\n @driver.find_element(locator)\n puts \"#{locator} found\"\n true\n rescue Selenium::WebDriver::Error::NoSuchElementError\n puts \"#{locator} not found\"\n false\n end\n\n grid = @wait.until{@driver.find_element(:id,\"presentation_grid\")}\n # presentation_list = @driver.find_elements(:css, \".isotope > li\")\n presentation_list = @driver.find_elements(:css, \".presentation_wrap\")\n\n presentation_list_length = presentation_list.length\n\n presentation_list.each do |presentation|\n presentation_classes = presentation.attribute(\"class\")\n sep_presentation_classes = presentation_classes.gsub(\" \",\",\")\n video_array.push(sep_presentation_classes)\n end\n\n while j<video_array.length\n i=2\n cleaned_video_info=[]\n video_info = video_array[j].split(\",\") #video_info = [\"presentation_wrap\", \"p_1022\", \"k_139\", \"k_145\", \"g_70\", \"i_1176\", \"s_ok\", \"c_none\", \"l_grades_k_6\", \"l_grades_6_8\", \"l_grades_9_12\", \"a_researchers\", \"a_informal_educators\", \"p_imls\", \"isotope-item\"]\n cleaned_video_info[0]=video_info[1].gsub(\"p_\",\"\").to_i #[1022]\n while i<video_info.length\n if (video_info[i].include? \"l_\") || (video_info[i].include? \"s_\") || (video_info[i].include? \"a_\")\n cleaned_video_info.push((video_info[i][2..-1]))\n end\n i +=1\n end\n video_info_length = cleaned_video_info.length\n if video_info_length > max_info_length\n max_info_length = video_info_length\n max_video_info_num = cleaned_video_info[0]\n max_video_info = cleaned_video_info\n end\n write_to_file(cleaned_video_info)\n j +=1\n end\n puts \"Longest info video # #{max_video_info_num}. length of info #{max_info_length} info is #{max_video_info}\"\nend",
"def test_browser_mode!\r\n @browser_mode = BrowserMode::Test\r\n end",
"def test_006\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #A task type is changed into \"individual analysis\"\n # with a \"general control\" tab.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析 (Individual Analysis)\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n #An option setup of \"master: A qac\" subwindow is displayed.\n click $xpath[\"task\"][\"option_setup_link\"]\n # click \"link=設定する\"\n sleep 3\n # #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n sleep 2\n\n # logout\n logout\n\n end",
"def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end",
"def test04_MediaPhotoVideo\n\t\tlogin $editor_1_email, $master_password\n\t\t$browser.goto($patch_boards_pre_closed_article_new)\n\t\t\n#\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n#\t\t$post_media_description.set(\"mt townsend is my favorite mountain #{random}.\")\n\t\tif $environment == 'nixon'\t\n\t\t\trepostGroupPop #category already selected in staging\n\t\tend\n\t\t$post_article_title.set(\"Mountain #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('mt townsend is my favorite mountain #{random}.')\")\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"DungenessSpit102.26.2012.mov\"\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n if $environment == 'staging'\n\t\t\tsleep 10 #loads \n\t\tend\n\t\t$post_now_edit.fire_event(\"onclick\")\n\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\tend",
"def set_video_based_on_user\n video_id = params[:video_id] || params[:id]\n\n begin\n if current_user?(@user)\n @video ||= @user.videos.where(:id => video_id).joins(:video_graph).where(:video_graphs => { :status => Video.statuses_to_show_to_current_user }).first\n else\n @video ||= @user.videos.where(:id => video_id).joins(:video_graph).where(:video_graphs => { :status => VideoGraph.get_status_number(:ready) }).first\n end\n rescue ActiveRecord::StatementInvalid\n @video = nil\n end\n \n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Dark Content Wrapper \n # Main (White) Content Wrapper \n link_to \"Go back\", :back \n image_tag(\"okayguy.png\", :alt => \"Okay\", :size => \"256x275\") \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end",
"def w3c_tests\n render(layout: false)\n end",
"def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mobilkies not nahodyatsya, smeni prices epta')\n end\n $driver.manage.timeouts.implicit_wait = 10\n end",
"def test_playlist\n end",
"def test_valley_smoketest\n @driver.get(@base_url)\n verify_home_page()\n verify_services_page()\n verify_about_page()\n verify_contact_page()\n verify_faq_page()\n verify_links_page()\n end",
"def TelevisionPage()\n \n \n begin\n \n #Chromedriver location\n Selenium::WebDriver::Chrome.driver_path = File.expand_path('C:\\\\TestProject\\\\ChromeDriver\\\\chromedriver.exe')\n \n #Open a Chrome browser\n driver = Watir::Browser.new :chrome\n \n #Navigate to the url\n driver.goto \"https://www.which.co.uk/reviews/televisions\"\n sleep 4\n #Maximize the Chrome window\n driver.window.maximize \n sleep 1\n #get page title\n oPageTitle=driver.title\n UtilsTestScript.TakeScreenshot(driver)\n #Check that the page title is Television reviews - Which?\n if(oPageTitle != \"Television reviews - Which?\") \n puts\"Title of the webpage is not 'Television reviews - Which?'. \" \n #Utility to take screenshot \n UtilsTestScript.TakeScreenshot(driver)\n return false\n end\n \n #Scenario 1\n #Check if the top level menu items are displayed as expected\n ############################################################\n \n #Expected Toplevel menu items \n array_toplevelmenu=[\"Technology\",\"Home & garden\",\"Money\",\"Baby & child\",\"Cars & travel\",\"Campaigns\",\"Services\",\"More from Which?\"]\n \n for i in 0 ... array_toplevelmenu.length\n #Xpath_ToplevelMenu returns all the elements in the top level menu.\n xpath_menuitems=TelevisionPageObjects.ReplaceString(TelevisionPageObjects::Xpath_ToplevelMenu,\"#{i+1}\")\n #Waits(for 5 seconds) until the object is returned\n isMenuItemPresent = Watir::Wait.until(5){driver.element(:xpath => xpath_menuitems)}\n if(isMenuItemPresent.present?)\n #Get the text of the menuitem\n menuItem=isMenuItemPresent.text\n puts \"#{menuItem}\"\n #compare the text retrived to the array\n if(array_toplevelmenu[i] != menuItem)\n puts\"Top level menu item '#{array_toplevelmenu[i]}' is not displayed in the web page.\"\n UtilsTestScript.TakeScreenshot(driver) \n end\n else\n puts\"Not able to get the reference of top level menu item #{array_toplevelmenu[i]}.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n end\n \n #Scenario 2\n #Check if 'TV & home entertainment' link is displayed in the page\n ############################################################ \n isLinkPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_TVHomeELink)}\n if !(isLinkPresent.present?) \n puts\"'TV & home entertainment' link is not displayed in the page\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n #Scenario 3\n #For the first product displayed in the page,make sure that Compare button is displayed.\n #Click on it and verify that the Compare popup shows up with the same product name.\n ############################################################ \n \n #Check if Compare button is present inside the first product description \n isButtonPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_CompareBtn)}\n if (isButtonPresent.present?) \n #Click on Compare button\n isButtonPresent.click\n UtilsTestScript.TakeScreenshot(driver)\n #Check if Compare popup is displayed\n isPopupPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_ComparePopup)}\n if(isPopupPresent)\n #Get the model name from the product tile\n isModel = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_model)} \n if(isModel)\n puts\"#{isModel.text}\"\n else\n puts\"Not able to get the reference of the first product model name in the product list.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n #Check the manufacturer name in the Compare popup \n checkPopupMf = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_modelMf)} \n if(checkPopupMf)\n getPopupMf=checkPopupMf.text\n puts\"#{getPopupMf}\"\n else\n puts\"Not able to get the reference of the product manufacturer name in the popup.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n #Check the model number in the Compare popup \n checkPopupModel = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_modelno)} \n if(checkPopupModel)\n getPopupModel=checkPopupModel.text\n puts\"#{getPopupModel}\"\n else\n puts\"Not able to get the reference of the product model name in the popup.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n #Check that product name matches in the Compare popup and the first product tile\n if(isModel.text != getPopupMf+\" \"+ getPopupModel)\n puts\"Product name in the first tile doesn't match with the one displyed in Compare popup .\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n end\n \n end\n \n #rescue block to display any Exception that may happen \n rescue Exception => e\n puts e\n ensure\n #Close the driver\n driver.quit\n end \n \nend",
"def get_detection_html(user_agent)\n ua_info = fingerprint_user_agent(user_agent)\n os = ua_info[:os_name]\n client = ua_info[:ua_name]\n\n code = ERB.new(%Q|\n <%= js_base64 %>\n <%= js_os_detect %>\n <%= js_ajax_post %>\n <%= js_misc_addons_detect %>\n <%= js_ie_addons_detect if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n\n function objToQuery(obj) {\n var q = [];\n for (var key in obj) {\n q.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n }\n return Base64.encode(q.join('&'));\n }\n\n function isEmpty(str) {\n return (!str \\|\\| 0 === str.length);\n }\n\n function sendInfo(info) {\n var query = objToQuery(info);\n postInfo(\"<%=get_resource.chomp(\"/\")%>/<%=@info_receiver_page%>/\", query, function(){\n window.location=\"<%= get_module_resource %>\";\n });\n }\n\n var flashVersion = \"\";\n var doInterval = true;\n var maxTimeout = null;\n var intervalTimeout = null;\n\n function setFlashVersion(ver) {\n flashVersion = ver\n if (maxTimeout != null) {\n clearTimeout(maxTimeout);\n maxTimeout = null\n }\n doInterval = false\n return;\n }\n\n function createFlashObject(src, attributes, parameters) {\n var i, html, div, obj, attr = attributes \\|\\| {}, param = parameters \\|\\| {};\n attr.type = 'application/x-shockwave-flash';\n if (window.ActiveXObject) {\n attr.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';\n param.movie = src;\n } else {\n attr.data = src;\n }\n\n html = '<object';\n for (i in attr) {\n html += ' ' + i + '=\"' + attr[i] + '\"';\n }\n html += '>';\n for (i in param) {\n html += '<param name=\"' + i + '\" value=\"' + param[i] + '\" />';\n }\n html += '</object>';\n div = document.createElement('div');\n div.innerHTML = html;\n obj = div.firstChild;\n div.removeChild(obj);\n return obj;\n }\n\n window.onload = function() {\n var osInfo = os_detect.getVersion();\n var d = {\n \"os_vendor\" : osInfo.os_vendor,\n \"os_device\" : osInfo.os_device,\n \"ua_name\" : osInfo.ua_name,\n \"ua_ver\" : osInfo.ua_version,\n \"arch\" : osInfo.arch,\n \"java\" : misc_addons_detect.getJavaVersion(),\n \"silverlight\" : misc_addons_detect.hasSilverlight(),\n \"flash\" : misc_addons_detect.getFlashVersion(),\n \"vuln_test\" : <%= js_vuln_test %>,\n \"os_name\" : osInfo.os_name\n };\n\n <% if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n d['office'] = ie_addons_detect.getMsOfficeVersion();\n d['mshtml_build'] = ScriptEngineBuildVersion().toString();\n <%\n activex = @requirements[:activex]\n if activex\n activex.each do \\|a\\|\n clsid = a[:clsid]\n method = a[:method]\n %>\n var ax = ie_addons_detect.hasActiveX('<%=clsid%>', '<%=method%>');\n d['activex'] = \"\";\n if (ax == true) {\n d['activex'] += \"<%=clsid%>=><%=method%>=>true;\";\n } else {\n d['activex'] += \"<%=clsid%>=><%=method%>=>false;\";\n }\n <% end %>\n <% end %>\n <% end %>\n\n if (d[\"flash\"] != null && (d[\"flash\"].match(/[\\\\d]+.[\\\\d]+.[\\\\d]+.[\\\\d]+/)) == null) {\n var flashObject = createFlashObject('<%=get_resource.chomp(\"/\")%>/<%=@flash_swf%>', {width: 1, height: 1}, {allowScriptAccess: 'always', Play: 'True'});\n\n // After 5s stop waiting and use the version retrieved with JS if there isn't anything\n maxTimeout = setTimeout(function() {\n if (intervalTimeout != null) {\n doInterval = false\n clearInterval(intervalTimeout)\n }\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }, 5000);\n\n // Check if there is a new flash version every 100ms\n intervalTimeout = setInterval(function() {\n if (!doInterval) {\n clearInterval(intervalTimeout);\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }\n }, 100);\n\n document.body.appendChild(flashObject)\n } else {\n sendInfo(d)\n }\n }\n |).result(binding())\n\n js = ::Rex::Exploitation::JSObfu.new code\n js.obfuscate\n\n %Q|\n <script>\n #{js}\n </script>\n <noscript>\n <img style=\"visibility:hidden\" src=\"#{get_resource.chomp(\"/\")}/#{@noscript_receiver_page}/\">\n <meta http-equiv=\"refresh\" content=\"1; url=#{get_module_resource}\">\n </noscript>\n |\n end",
"def test_lesson_access_rights\n $ie.text_field(:id, \"login\").set((users :watir_premium).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.text_field(:id, \"login\").set((users :registered).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"upgrade\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n end",
"def iframes; end",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end",
"def add_visibility_verifier; end",
"def test_02()\n\t\t\n\t\tputs \"************** START : Login to Redmine ****************\"\t\n\t\t\n\t\tputs \"Inside test 2\"\n\t\tsleep 4\n\t\t@loginbutton_topposition = $browser.get_element_position_top \"link=Log in\"\n\t\tputs \"Login button Top position : #{@loginbutton_topposition}\"\n\t\tif @loginbutton_topposition == '9'\n\t\t\tputs \"UI Check : Pass. Login link is present at the correct position.\"\n\t\telse\n\t\t\tputs \"UI Check : Fail. Login link is not present at the correct position.\"\n\t\tend\n\t\t\n\t\t\n\t\t\n\t\t@loginbutton_leftposition = $browser.get_element_position_left \"link=Log in\"\n\t\tputs \"Login button Left position : #{@loginbutton_leftposition}\"\n\t\tif @loginbutton_leftposition == '1091'\n\t\t\tputs \"UI Check : Pass. Login link is present at the correct position.\"\n\t\telse\n\t\t\tputs \"UI Check : Fail. Login link is not present at the correct position.\"\n\t\tend\n\t\t@loginbutton_width = $browser.get_element_width \"link=Log in\"\n\t\tputs \"Login button Width : #{@loginbutton_width}\"\n\t\tif @loginbutton_width == '40'\n\t\t\tputs \"UI Check : Pass. Login link is present at the correct position.\"\n\t\telse\n\t\t\tputs \"UI Check : Fail. Login link is not present at the correct position.\"\n\t\tend\n\t\t\n\t\t@browse_topposition = $browser.get_element_position_top \"//div[2]/div/a/em\"\n\t\tputs \"Browse button Top position : #{@browse_topposition}\"\n\t\t@signupbutton_leftposition = $browser.get_element_position_left \"link=Sign up\"\n\t\tputs \"Signup button Left position : #{@signupbutton_leftposition}\"\n\t\t@signupbutton_width = $browser.get_element_width \"link=Sign up\"\n\t\tputs \"Signup button Width : #{@signupbutton_width}\"\n\t\t\n\t\t\t\t\n\t\t#~ #$browser.click_at \"link=Log in\", \"916,10\"\n\t\t#~ #$browser.break()\n\t\t#~ $browser.wait_for_page_to_load \n\t\t#~ puts \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t\t#~ $browser.type \"user_session_email\", email_id \n\t\t#~ $browser.type \"user_session_password\", pass_word\n\t\t#~ $browser.click \"//button[@type='submit']\"\n\t\t#~ $browser.wait_for_page_to_load \n\t\t\n\t\t#~ # FOR LOOP\n\t\t#~ for row in 1..10\n\t\t\t#~ print row, \"Hello\\n\"\n\t\t#~ end\n\t\t\n\t\t#~ puts \"----------------------------\"\n\t\t#~ # ARRAY\n\t\t#~ $players = \"www.google.com/test \"\n\t\t#~ print $players.strip, \"\\n\"\n\t\t#~ $splitvalue = $players.split(\"/\", 5)\n\t\t#~ print $splitvalue[0], \"\\n\"\n\t\t#~ print $players, \"\\n\"\n\t\t#~ print $players.length, \"\\n\"\n\t\t\n\t\t#~ puts \"----------------------------\"\n\t\t#~ #ANOTHER METHOD\n\t\t#~ $players = [\"sachin\",\"dravid\",\"ganguly \"]\n\t\t#~ $players.pop\n\t\t#~ $players.push(\"Sheryln\")\n\t\t#~ $players.each { |i| print i, \"\\n\"}\n\t\t\n\t\t#~ puts \"----------------------------\"\n\t\t#~ presidents = [\"Ford\", \"Carter\", \"Reagan\", \"Bush1\", \"Clinton\", \"Bush2\"]\n\t\t#~ for ss in 0...presidents.length\n\t\t#~ print ss, \": \", presidents[-ss -1], \"\\n\";\n\t\t#~ end\n\t\t#~ puts \"----------------------------\"\n\t\t\n\t\t#~ string1 = \"Steve was here\"\n\t\t#~ print \"e.*e found\", \"\\n\" if string1 =~ /e.*e/\n\n\t\t#~ puts \"----------------------------\"\n\t\t#~ mystring = \"wew_1234\"\n\t\t#~ regex = Regexp.new(/we../)\n\t\t#~ matchdata = regex.match(mystring)\n\t\t#~ if matchdata\n\t\t\t#~ puts matchdata[0]\n\t\t#~ else\n\t\t\t#~ puts \"NO MATCH\"\n\t\t#~ end\n\t\t\n\t\t\t\n\t\t#~ $browser.click \"link=Sign in\"\n\t\t#~ $browser.wait_for_page_to_load \n\t\t#~ $browser.type \"username\", email_id\n\t\t#~ $browser.type \"password\", pass_word\n\t\t#~ $browser.click \"login\"\n\t\t#~ $browser.wait_for_page_to_load \n\n\t\tputs \"************** END : Login to Redmine ****************\"\t\n\tend",
"def iframe(criteria = T.unsafe(nil)); end",
"def loading_wait\n \tcase ENV['BROWSER']\n \twhen \"iphone\",\"ipad\",\"android_phone\",\"android_tablet\" then\n \t\tWatir::Wait.until {\n \t\tnot @browser.element(xpath: '//div[contains(@class, \"load\")]').visible?\n \t\t}\n \telse\n \t\tWatir::Wait.until {\n \t\tnot @browser.iframe(:id, 'quote-frame').div(xpath: '//div[contains(@id, \"load\")]').visible?\n \t\t}\n \tend\n \tend",
"def check_profile_attributes_match\n wait_for { displayed?(TITLES) }\n titles_array = get_array(TITLES)\n # @@n variable is a random integer that is used as index for selecting only one of the titles elements array\n @@n = rand(0...9)\n log \"STEP 9: Click on random freelancer's title.\"\n # For scrolling the page to the randomly selected title element it uses javascript executor instead of actions\n execute_script_on_element \"arguments[0].scrollIntoView(true);\", titles_array[@@n.to_i]\n # This fixed explicit sleep ensures reliability after scrolling and clicking on the element\n sleep 5\n log \"STEP 10: Get into that freelancer's profile (by clicking on desired Freelancer's title).\"\n # Following the same logic and strategy for scrolling, we use again this method for click\n execute_script_on_element \"arguments[0].click();\", titles_array[@@n.to_i]\n\n # After clicking on the freelancer's title we wait until the slide window is open and freelancer profile elements are present\n wait_for { displayed?(DESCRIPTION) }\n description = text_of(DESCRIPTION)\n log \"STEP 11: Check that each attribute value is equal to one of those stored in the structure created in STEPS 7 and 8.\"\n log \"STEP 12: Check whether at least one attribute contains #{$keyword}.\"\n\n if (description.to_s.eql? @@array[@@n.to_i][:description].to_s)\n $test_result = false\n error \"ERROR!!! => Description differs between profiles search results and freelancer profile for #{@@array[@@n.to_i][:name].to_s}.\"\n end\n wait_for { displayed?(TITLE) }\n description = text_of(TITLE)\n if (description.to_s.eql? @@array[@@n.to_i][:description].to_s)\n $test_result = false\n error \"ERROR: Title differs between profiles search results and freelancer profile for #{@@array[@@n.to_i][:name].to_s}.\"\n end\n end",
"def test_authorization_of_protocols_and_datafiles_links\n #sanity check the fixtures are correct\n check_fixtures_for_authorization_of_protocols_and_datafiles_links\n login_as(:model_owner)\n experiment=experiments(:experiment_with_public_and_private_protocols_and_datafiles)\n assert_difference('ActivityLog.count') do\n get :show, :id=>experiment.id\n end\n\n assert_response :success\n\n assert_select \"div.tabbertab\" do\n assert_select \"h3\", :text=>\"Protocols (1+1)\", :count=>1\n assert_select \"h3\", :text=>\"Data Files (1+1)\", :count=>1\n end\n\n assert_select \"div.list_item\" do\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :text=>\"Protocol with fully public policy\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :text=>\"Download Only\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n end\n\n end",
"def test_00030_view_upcoming_event\n @admin_events_page.start!(user_for_test)\n check_events\n \t@browser.wait_until{ @admin_events_page.first_event_item.present? }\n \ttitle = @admin_events_page.first_event_title.text\n \t# topics = @admin_events_page.first_event_topics.map{ |x|x.inner_html }\n \t@admin_events_page.event_view.click\n @browser.wait_until{ @admin_events_page.pic_view.present? }\n assert @admin_events_page.content_view.text.include? title\n # topics_view = @admin_events_page.related_topics_view.map{ |x|x.inner_html }\n # assert topics.sort == topics_view.sort\n end",
"def test_032\n test_000\n login(\"root\",\"root\")\n create_1st_user\n sleep WAIT_TIME\n attribute = @selenium.get_attribute(\"//body/div[2]@style\")\n # if there is a piece of text \"display: none\", this subwindow will be fade out\n result = (attribute.to_s =~ /display: none/ )\n # 'result' is nill demonstrates that the subwindow still available\n assert_equal result, nil\n logout\n end",
"def audios_test\n end",
"def test_039\n test_000\n login(\"root\",\"root\")\n create_2nd_user\n sleep WAIT_TIME\n abc = @selenium.get_attribute(\"//body/div[2]@style\")\n # if there is a piece of text \"display: none\", this subwindow will be fade out\n result = (abc.to_s =~ /display: none/ )\n # 'result' is nill demonstrates that the subwindow still available\n assert_equal result, nil\n logout\n end",
"def analyze_session session\n watched_video_set = Set.new\n conversion_complete = false\n \n mark_landing = false\n version = \"\"\n analyze session do |action|\n if !mark_landing && action[\"_type\"] == \"page_load\"\n unless front_porch? action\n return\n end\n mark_landing = true\n version = extract_version action[\"pageurl\"] \n end\n\n if action[\"_type\"] == \"play_action\"\n if action[\"packageid\"] == \"4\"\n watched_video_set.add \"Free Episode\"\n elsif action[\"packageid\"] == \"5\"\n watched_video_set.add \"90s\"\n end\n elsif action[\"_type\"] == \"slider_action\"\n if action[\"pageurl\"] =~ /^http:\\/\\/www2\\.hulu\\.jp\\/?(\\?.*)?$/\n puts action[\"pageurl\"]\n watched_video_set.add \"Homepage Preview\"\n end\n elsif action[\"_type\"] == \"page_load\" \n if conversion? action\n conversion_complete = true\n end\n end\n end\n\n unless mark_landing\n return\n end\n if conversion_complete\n @total_conversions[version] ||= 0\n @total_conversions[version] += 1\n watched_video_set.each do |content_id|\n @watch_conversions[version] ||= {}\n @watch_conversions[version][content_id] ||= 0\n @watch_conversions[version][content_id] += 1\n end \n end\n watched_video_set.each do |content_id|\n @total_visitors[version] ||= 0\n @total_visitors[version] += 1\n @watch_visitors[version] ||= {}\n @watch_visitors[version][content_id] ||= 0\n @watch_visitors[version][content_id] += 1\n end \n end",
"def has_flash?\n not web_video.nil?\n end",
"def check_accessibility\n end",
"def test_metacafe\r\n skip \"plugin broken\"\r\n result = `ruby bin/viddl-rb http://www.metacafe.com/watch/7731483/video_preview_final_fantasy_xiii_2/ --url-only`\r\n assert_equal $?, 0\r\n can_download_test(result) { |url_output| http_code_grabber(url_output) }\r\n end",
"def test_update_whitelist\n # Assert nothing is injected before whitelisting\n page.driver.browser.get(\"http://test.privly.org/test_pages/nonwhitelist.html\")\n assert page.has_no_xpath?('//iframe')\n\n # Update the whitelist\n page.driver.browser.get(@options_url)\n elements = page.all(:css, '.whitelist_url')\n elements[0].set 'Dev.Privly.Org.phish.org'\n page.driver.browser.get(\"http://test.privly.org/test_pages/nonwhitelist.html\")\n assert page.has_xpath?('//iframe')\n\n # Assert something injected\n page.driver.browser.get(\"http://test.privly.org/test_pages/nonwhitelist.html\")\n assert page.has_xpath?('//iframe')\n end",
"def load_preview\n @media_element_id = correct_integer?(params[:media_element_id]) ? params[:media_element_id].to_i : 0\n @media_element = MediaElement.find_by_id @media_element_id\n if !@media_element.nil? && (@media_element.is_public || @media_element.user_id == current_user.id) && @media_element.converted\n @ok = true\n @media_element.set_status current_user.id\n else\n @ok = false\n end\n end",
"def test_00160_homepage_featured_b_widget\n # # @browser.execute_script(\"window.scrollBy(0,8000)\")\n # @browser.wait_until { @home_page.home_featured_blog.present? }\n # assert @home_page.home_featured_blog.present?\n # assert @home_page.home_featured_b_desc.present?\n @browser.wait_until { @home_page.featured_b_widget.present? }\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.featured_b_widget.posts[0].title\n @home_page.featured_b_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.featured_b_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.featured_b_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_b_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.featured_b_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.featured_b_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end",
"def set_all_tests_as_control\n UiChanged::Screenshot.set_all_tests_as_controls\n head :ok\n end",
"def select_video(title)\n first(:link, title).click\n expect(page).to have_text 'Add to'\n # plz_be_quiet\nend",
"def test_003\n open_pu_management_page\n assert is_element_present(xpath[\"pu_management\"][\"search_box\"])\n assert is_element_present(xpath[\"pu_management\"][\"pu_table\"])\n logout\n end",
"def test_login_controls\n get :login_controls\n assert_response :success\n assert_nil session[:user]\n end",
"def ensure_the_user_is_not_deactivated\n unless current_user.nil?\n if current_user.is_deactivated\n sign_out\n ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n if we_should_show_og_tags && !@video.blank? \n # Facebook OpenGraph protocol for embedding our video link back to Brevidy \n public_video_url(:public_token => @video.public_token) \n @video.title \n @video.description \n @video.get_thumbnail_url(@video.selected_thumbnail) \n public_video_url(:public_token => @video.public_token) \n else \n # Standard meta tags \n image_path('meta_tag_logo.png') \n end \n browser_title \n # Logged In CSS \n cache_buster_path('/stylesheets/i_love_lamp-1.0.3.min.css') \n # Site-wide JS \n javascript_include_tag \"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\" \n cache_buster_path('/javascripts/functions.min.js') \n cache_buster_path('/javascripts/i_love_lamp-1.0.3.min.js') \n javascript_include_tag \"player/player.js\" \n javascript_include_tag \"http://html5shiv.googlecode.com/svn/trunk/html5.js\" \n # Fav Icon and CSRF meta tag \n favicon_link_tag \n csrf_meta_tag \n get_background_for_user \n # Top navigation header \n link_to(image_tag(\"brevidy_rgb_white.png\", :size => \"135x35\", :alt => \"Brevidy - The Soul of Video\"), signed_in? ? user_stream_path(current_user) : :root, :class => \"brand\") \n video_search_path \n if signed_in? \n link_to(\"Explore\", explore_path) \n link_to(\"Upload\", new_user_video_path(current_user)) \n link_to(\"Share a Link\", user_share_dialog_path(current_user), :remote => true, \"data-method\" => \"GET\") \n link_to(\"Invite\", user_invitations_path(current_user)) \n end \n if signed_in? \n link_to(user_path(current_user), :class => \"dropdown-toggle\") do \n image_tag(\"#{current_user.image.blank? ? 'default_user_35px.jpg' : current_user.image_url(:small_profile) }\", :alt => \"#{current_user.name}\", :size => \"35x35\") \n current_user.username \n end \n link_to(\"My Channels\", user_channels_path(current_user)) \n link_to(\"Account Settings\", user_account_path(current_user)) \n link_to(\"Find People\", find_people_path) \n link_to(\"Help\", \"http://getsatisfaction.com/brevidy\", :target => \"_blank\") \n link_to(\"Logout\", logout_path, :remote => true, \"data-method\" => \"DELETE\") \n else \n link_to(\"Explore\", explore_path) \n link_to(\"Sign up\", signup_path) \n link_to(\"Login\", login_path) \n end \n \n # Main container \n # Lower navigation \n unless @page_has_infinite_scrolling \n succeed \" \" do \n link_to(\"FAQ\", faq_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Blog\", \"http://blog.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Status\", \"http://status.brevidy.com\", :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Contact\", contact_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Terms\", tos_path, :class => \"inlinelink\") \n end \n succeed \" \" do \n link_to(\"Privacy\", privacy_path, :class => \"inlinelink\") \n end \n \n end \n # GetSatisfaction Feedback Widget & Google Analytics \n # Google Analytics \n # GetSatisfaction Code \n # AddThis script \n \n # Scroll back to top \n\nend\n\n end\n end\n end",
"def verify_changed_gallery_settings(nom, cols, media_display = \"Show nothing\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Starting test for Verification of Gallery Settings done in previous test\")\n i = 0\n while i < nom\n image_xpath = \"//div[contains(@class, 'media-gallery-sortable-processed') and contains(@class, 'ui-sortable')]/div[contains(@id, 'media-gallery-media-#{i}')]\"\n @browser.find_elements(:xpath => image_xpath).should have_at_least(1).items\n @browser.find_element(:xpath => \"#{image_xpath}//div[@class='gallery-thumb-inner']/a/img\").click\n cbox = wait.until { @browser.find_element(:xpath =>\"//div[@id='cboxClose']\") } #this element is invis...needs hover or js_click\n Log.logger.info(\"Clicking cbox via js...\")\n begin\n elem = @browser.find_element(:xpath => \"//div[@id='cboxClose']\")\n script = \"arguments[0].click();\"\n @browser.execute_script(script, elem)\n rescue Exception => e\n Log.logger.info(\"Caught an exception: #{e.inspect}\")\n end\n if (media_display == \"Show nothing\")\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/span/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path.\n @browser.find_elements(:xpath => \"#{image_xpath}/.//span[contains(@class, 'media-title')]\").should be_empty\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/a/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path. Difference is a tag.\n @browser.find_elements(:xpath => \"#{image_xpath}//a//span[contains(@class, 'media-title')]\").should be_empty\n end\n if (media_display == \"Show title below\")\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/span/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path.\n @browser.find_elements(:xpath => \"#{image_xpath}//span[contains(@class, 'media-title')]\").should have_at_least(1).items\n end\n if (media_display == \"Show title on hover\")\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/a/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path. Difference is a tag.\n @browser.find_elements(:xpath => \"#{image_xpath}//a//span[contains(@class, 'media-title')]\").should have_at_least(1).items\n end\n i += 1\n end\n @browser.find_elements(:xpath => \"//div[contains(@class, 'content')]/div[contains(@class, 'mg-col-#{cols}')]\").should have_at_least(1).items\n # NOTE: This last four assertions will only work if the gallery has number of images more than nom.\n @browser.find_elements(:xpath => \"//a[contains(@title, 'Go to page 2')]\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//a[contains(@title, 'Go to next page')]\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//a[contains(@title, 'Go to last page')]\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//div[contains(@class, 'media-gallery-sortable-processed') and contains(@class, 'ui-sortable')]/div[contains(@id, 'media-gallery-media-#{nom}')]\").should be_empty\n end",
"def test_allApplication_load\n @driver.get(@baseURL)\n #begin\n @Nexa_Util.loginAsNormalUser(@driver)\n # @wait.until { @driver.find_element(:id, 'leftNavigationContent') }\n\n # rescue Timeout::Error\n waitForPageFullyLoaded(40);\n @start = Time.now\n @driver.find_element(:link_text, 'All Applications').click\n # @wait.until { @driver.find_element(:class, 'resultTable') }\n waitForPageFullyLoaded(20);\n @stop = Time.now\n @sitePerformance.puts \"Page load time 'All Applications': #{@Nexa_Util.time_diff_milli(@start, @stop)}\"\n assert_operator 60000.00, :>, @Nexa_Util.time_diff_milli(@start, @stop)\n # end\n end",
"def test_00020_profilepage_profile_page\n @profile_page.goto_profile\n @browser.wait_until { @profile_page.profile_activity_item.present? }\n\n assert_all_keys({\n :profile_page => @profile_page.profile_page.present?,\n :profile_username_match => @c.users[user_for_test].name == @profile_page.user_name,\n :work_info => @profile_page.profile_workinfo_line.present?,\n :profile_img => @profile_page.profile_img.present?,\n :profile_edit_button => @profile_page.profile_edit_button.present?,\n :profile_activity_item => @profile_page.profile_activity_item.present?,\n :topnav_home => @profile_page.topnav_home.present?,\n :topnav_topic => @profile_page.topnav_topic.present?,\n :topnav_product => @profile_page.topnav_product.present?,\n :topnav_about => @profile_page.topnav_about.present?,\n :topnav_search => @profile_page.topnav_search.present?,\n :topnav_logo => @profile_page.topnav_logo.present?,\n # :browser_title => (@browser.title == \"#{@c.users[user_for_test].name}'s Profile\"),\n })\n \n #TODO\n @profile_page.profile_avatar_img.when_present.hover\n @profile_page.profile_avatar_camera.when_present\n assert @profile_page.profile_avatar_camera.present?\n # comment below assert since it is invisible when no bio\n # assert @profile_page.profile_bioinfo_line.present? \n end",
"def test_on_current_browsers\n for current_browser in CURRENT_BROWSERS\n @request.user_agent = current_browser\n get :index\n assert_response :success\n assert_select 'img[src*=painless_test.png]'\n end\n end",
"def setup\n # Do nothing\n @driver = Selenium::WebDriver.for :firefox\n @driver.manage.window.maximize\n @driver.manage.timeouts.implicit_wait = 10\n @wait = Selenium::WebDriver::Wait.new :timeout => 10\n @verification_errors = []\n @baseURL = 'http://www.aci.aero/'\n end",
"def has_video?\n false\n end",
"def test_012\n\n #login\n login\n\n #Open PU management page\n open_pu_management_page_1\n\n # Find a PU\n # Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #test for make root in the master tab & in the popup which is displayed by clicking 設定する\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n #test for make root\n type \"makeroot_qac\", \"abc\"\n run_script \"destroy_subwindow()\"\n assert is_text_present(_(\"Make root\")+\":\")\n click $xpath[\"task\"][\"option_setup_link\"]\n sleep 2\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n sleep 3\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n type \"makeroot_qac\", \"abc\"\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 2\n assert is_text_present(_(\"Make root\")+\":\")\n click $xpath[\"task\"][\"option_setup_link\"]\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n\n\n\n #logout\n logout\n\n end",
"def test_convert_video\n get convert_url, params: { url: Predoc::TestConfig::FIXTURE_URLS[:mp4] }\n assert_response :success\n assert_template(:error)\n end",
"def test_scm_st_003\n printf \"\\n Test 003\"\n open_periodical_analysis_setting_tab \n assert(is_element_present($display_scm_xpath[\"save_button\"])) \n assert(is_element_present($display_scm_xpath[\"clear_button\"]))\n assert(is_element_present($display_scm_xpath[\"delete_button\"]))\n assert(is_element_present($display_scm_xpath[\"save_all_button\"]))\n logout\n end",
"def get_frames\n return driver.find_elements(:css, 'internal-frame')\nend",
"def assert_ponzu_frame(options = {})\n ponzu_frames = css_select \"[data-container='ponzu_frame']\"\n if @request.user_agent != user_agent_strings_for(:galapagos)\n assert_equal 1, ponzu_frames.size, \n \"ponzu_frame not found within #{@templates.keys}\"\n else\n assert_equal 0, ponzu_frames.size, \n \"ponzu_frame advertantly found within #{@templates.keys}\"\n end\n assert_absence_of_non_kamishibai_links(options)\n end",
"def test_00010_profanity_blocker\n \t@loginpage.login($user1)\n enable_profanity_blocker($networkslug, true)\n #check community post\n title_before = \"watir test profanity blocker - #{get_timestamp}\"\n title_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"discussion\", title_before, false)\n title_before[\"test profanity\"] = \"**** *********\"\n assert title_before == title_after\n # comment_root_post\n # reply_to_comment\n # #check hybris post\n # create_post_from_hybris\n enable_profanity_blocker($networkslug, false)\n title2_before = \"watir test profanity blocker - #{get_timestamp}\"\n title2_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"question\", title2_before, false)\n assert title2_before == title2_after\n end",
"def initialize(site_url,defaults = {})\n defaults = {\n :results_path => File.expand_path(File.dirname(__FILE__)) + \"/public/results/\",\n :webdriver_type => \"watir\" ,\n :browser_type => \"firefox\" ,\n :har_type => \"internal\" ,\n :display => \"\" ,\n :chrome_settings => %W[ --enable-benchmarking --enable-net-benchmarking --no-sandbox --user-data-dir],\n :vnc_enabled => false ,\n :debug_option => false,\n :test_cycles => 1,\n :id => \"\",\n :secscan => false,\n :vlc_bin => `which vlc`\n }.merge(defaults)\n @options = defaults\n @logger = Logger.new(STDOUT)\n pp \"Initialize options : #{options.inspect}\"\n \n \n \n \n if File.exists?(File.expand_path(File.dirname(__FILE__))+\"/settings.yml\")\n @config = YAML::load(File.open(File.expand_path(File.dirname(__FILE__))+\"/settings.yml\"))\n @logger.debug \"loaded config : \" + @config.inspect\n log_file = File.open(@config[\"debug_file\"], 'a+')\n log_file.sync = true \n @logger = Logger.new(log_file)\n if (@config[\"results_path\"]) ; @results_path = @config[\"results_path\"] else @results_path = options[:results_path] end\n if (@config[\"webdriver_type\"]) ; @webdriver_type = @config[\"webdriver_type\"] else @webdriver_type = options[:webdriver_type] end\n if (@config[\"browser_type\"]) ; @browser_type = @config[\"browser_type\"] else @browser_type = options[:browser_type] end\n if (@config[\"har_type\"]) ; @har_type = @config[\"har_type\"] else @har_type = options[:har_type] end\n if (@config[\"display\"]) ; @display = @config[\"display\"] else @display = options[:display] end\n if (@config[\"chrome_settings\"]) ; @chrome_settings = @config[\"chrome_settings\"] else @chrome_settings = options[:chrome_settings] end\n if (@config[\"vnc_enabled\"]) ; @vnc_enabled = @config[\"vnc_enabled\"] else @vnc_enabled = options[:vnc_enabled] end\n if (@config[\"debug_options\"]) ; @debug_option = @config[\"debug\"] else @debug_option = options[:debug_options] end\n if (@config[\"test_cycles\"]) ; @test_cycles = @config[\"test_cycles\"] else @test_cycles = options[:test_cycles] end\n if (@config[\"failsafe\"]) ; @failsafe = @config[\"failsafe\"] else @failsafe = options[:failsafe] end\n if (@config[\"vlc_bin\"]) ; @vlc_bin = @config[\"vlc_bin\"] else @vlc_bin = options[:vlc_bin] end\n else\n @results_path = options[:results_path]\n @webdriver_type = options[:webdriver_type]\n @browser_type = options[:browser_type]\n @har_type = options[:har_type]\n @display = options[:display]\n @chrome_settings = options[:chrome_settings]\n @vnc_enabled = options[:vnc_enabled]\n @debug_option = options[:debug_options]\n @test_cycles = options[:test_cycles]\n @failsafe = options[:failsafe]\n @vlc_bin = options[:vlc_bin]\n end\n \n @logger.info pp @chrome_settings.inspect\n \n if @debug_option \n @logger.level = Logger::DEBUG\n else\n @logger.level = Logger::ERROR\n end\n @logger.level = Logger::DEBUG\n \n unless site_url[/^http:\\/\\//] || site_url[/^https:\\/\\//]\n site_url = URI.parse 'http://' + site_url rescue nil\n end\n @url = site_url\n options[:id] == \"\" ? @name = \"#{Time.now.hash}\" : @name = options[:id]\n @name = \"#{name}\".gsub(/-/,\"\")\n @results_path = \"#{results_path}#{name}/\"\n @logger.debug \"Name : #{name} | Result Path : #{results_path} | URL : #{url}\"\n \n @firefox_settings = Selenium::WebDriver::Firefox::Profile.new\n @firefox_settings.assume_untrusted_certificate_issuer=false \n end",
"def test_0_before\n\t\t$report = Report.new()\n \t\t$testReport = $report.createReport($REPORT)\n\n\t\t$browser = Watir::Browser.new\n\t\t$current=\"\"\n\tend",
"def test_Browser_001_DisplayWatirEnv\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_DisplayWatirEnv\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - display_watir_env\")\n display_watir_env()\n\n end",
"def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend",
"def one_player_mode\nend",
"def two_player_mode\nend",
"def test_017\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #All file of directory is checked.\n\n assert is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_sources_tc958 #20 \n # Refering candidate with tracking source, new candidate, Clear Source Tracking for Internal Referrals\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n # Preconditions\n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::INTERNAL_LINK_LIST_XPATH)\n Common.displayed(BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH)\n test = [\n {\"displayed\" => BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH},\n {\"click\" => BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH},\n \n {\"displayed\" => BoardSetupEditPage::BOARD_EDIT_APPLY_REFERRAL_IMMEDIATELY_XPATH},\n {\"checked\" => BoardSetupEditPage::BOARD_EDIT_APPLY_REFERRAL_IMMEDIATELY_XPATH},\n {\"set_text\" => BoardSetupEditPage::BOARD_EDIT_SOURCE_TRACKING_FOR_INTERNAL_REFERRAL_XPATH, \"text\" => \" \"},\n \n {\"click\" => BoardSetupEditPage::BOARD_EDIT_SAVE_BUTTON_XPATH},\n ]\n Common.main(test)\n \n $browser.get HomePage::JOB_BOARD_INTERNAL_URL\n test = [\n {\"check_apply\" => \"\"},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_REFER_CANDIDATE_XPATH},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_REFER_CANDIDATE_XPATH},\n \n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_REFERRER_EMAIL_XPATH},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_APPLY_REFERRER_EMAIL_XPATH, \"text\" => Users::JOB_BOARD_USER_TEXT},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_CONTINUE_BUTTON_XPATH},\n \n {\"displayed\" => JobBoardJobDetail::PROSPECT_FIRST_NAME_XPATH},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_FIRST_NAME_XPATH, \"text\" => \"a\"},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_LAST_NAME_XPATH, \"text\" => \"b\"},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_EMAIL, \"text\" => \"matiast@oktana.io\"},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH},\n {\"displayed\" => JobBoardJobDetail::THANK_YOU_REFERRAL_MESSAGE_XPATH}\n ]\n Common.main(test)\n \n assert $browser.find_element(:xpath, JobBoardJobDetail::THANK_YOU_REFERRAL_MESSAGE_XPATH).displayed?\n \n end",
"def test_pageload\n @driver.navigate.to(@url)\n element = @driver.find_element(:class, \"ss-form-title\")\n assert_equal(element.text,\"Basic Web Forms\") # Check if the page open and the title is \"Basic Web Forms\"\n end",
"def test_browser_mode?\r\n @browser_mode == BrowserMode::Test\r\n end",
"def test_ID_25835_edit_profile_desc\n login_as_user1\n go_to_edit_profile_page\n verify_elements_left_nav \"test_ID_25835_edit_profile_desc\"\n verify_elements_on_edit_profile \"test_ID_25835_edit_profile_desc\"\n end",
"def test_014\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Maximize window\n click window_id + \"_close\"\n\n sleep 3\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_report_browser_status\n self.request = TestRequest.new(\n :method => :get,\n :request_uri => '/foo/bar?var=val'\n )\n self.session = {}\n\n @session_working = false\n @js = false\n str = report_browser_status\n assert_equal(nil, str)\n\n @session_working = true\n @js = false\n str = report_browser_status\n assert(str.match(/<script/))\n\n @js = true\n str = report_browser_status\n assert(str.match(/<noscript/))\n\n session[:js_override] = :off\n str = report_browser_status\n assert_equal(nil, str)\n end",
"def control_user(where)\r\n ####### Switch to explorer frame #######\r\n list_home_iframe = @driver.find_elements(:tag_name => 'iframe')\r\n get_explorer_iframe = list_home_iframe[3]\r\n @driver.switch_to.frame(get_explorer_iframe)\r\n sleep 5\r\n\r\n ####### Switch to system view (tree) frame #######\r\n list_system_view_iframe = @driver.find_elements(:tag_name => 'iframe')\r\n get_system_view_iframe = list_system_view_iframe[0]\r\n @driver.switch_to.frame(get_system_view_iframe)\r\n sleep 5\r\n\r\n ####### unwrap page source to each line, and click at 'CPBI Members' tree #######\r\n tree_pagesource2 = @driver.page_source\r\n tree_pagesource2 = tree_pagesource2.to_s\r\n newline_tree = tree_pagesource2.gsub(/\\>/, \">\\r\\n\")\r\n\r\n @ary = Array.new\r\n newline_tree.each_line do |line|\r\n matcher_member = line.include? 'Members for CPBI'\r\n if matcher_member\r\n get_all_member = line.scan(/key[0-9]+/)\r\n get_all_member.each do |key|\r\n @ary.push(key)\r\n end\r\n end\r\n end\r\n\r\n get_key_member = @ary[3]\r\n @driver.action.double_click(@driver.find_element(:xpath, '//*[@id=\"'+get_key_member+'\"]')).perform\r\n sleep 5\r\n\r\n ####### unwrap page source to each line, and click at 'Users' tree #######\r\n user_pagesource = @driver.page_source\r\n user_pagesource = user_pagesource.to_s\r\n newline_user = user_pagesource.gsub(/\\>/, \">\\r\\n\")\r\n\r\n @ary2 = Array.new\r\n\r\n matcher_user = newline_user.scan(/key[0-9]+\" label=\"Users\"/)\r\n matcher_user.each do |line|\r\n get_all_user = line.scan(/key[0-9]+/)\r\n get_all_user.each do |key|\r\n @ary2.push(key)\r\n end\r\n end\r\n\r\n get_key_user = @ary2[1]\r\n @driver.action.click(@driver.find_element(:xpath, '//*[@id=\"'+get_key_user+'\"]')).perform\r\n sleep 5\r\n\r\n # back to main iframe id, outermost frame\r\n @driver.switch_to.default_content\r\n select_iframeid()\r\n @driver.switch_to.frame(@iframe.to_s)\r\n\r\n create_user_pagesource = @driver.page_source\r\n create_user_pagesource = create_user_pagesource.to_s\r\n newline_create_user = create_user_pagesource.gsub(/\\>/, \">\\r\\n\")\r\n\r\n @ary3 = Array.new\r\n\r\n # select Create User or Manage User\r\n if where == 'Create User'\r\n matcher_create_user = newline_create_user.scan(/key[0-9]+\" label=\"Create User\"/)\r\n else\r\n matcher_create_user = newline_create_user.scan(/key[0-9]+\" label=\"Manage Users\"/)\r\n end\r\n\r\n if matcher_create_user.size > 1\r\n matcher_create_user.each do |line|\r\n get_all_create_user = line.scan(/key[0-9]+/)\r\n get_all_create_user.each do |key|\r\n @ary3.push(key)\r\n end\r\n end\r\n get_key_create_user = @ary3[0]\r\n else\r\n get_key_create_user = matcher_create_user[0].scan(/key[0-9]+/)\r\n get_key_create_user = get_key_create_user[0]\r\n end\r\n\r\n @driver.action.click(@driver.find_element(:xpath, '//*[@id=\"'+get_key_create_user+'\"]')).perform\r\n sleep 10\r\n\r\n end",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def index\n\t\t\n\t\t#session[:test] = \"xxx\"\n\t\t#render :text => session[:valid_api_key] and return \n\t\t\n\t\t@menuItem = \"home\"\n\t\t\n\t\t#if request.fullpath.include?(\"/lang/\")\n\t\t#\tredirect_to(\"/\")\n\t\t#\treturn\n\t\t#enA\n\t\t\n\t\tif params[:route]\n\t\t\tresult = Route.find_by_sql([\"select video_id from routes where id = ? limit 1\", params[:route]])\n\t\t\tredirect_to(:action => 'video', :video_id => result[0].video_id) and return if (result && result.length == 1 && result[0].video_id)\n\t\tend\n\t\t\n\t\tsession[:return_to] = request.fullpath\n\t\t@page_title = @vm_string_table[:web_title_index]\n\t\t\n\t\tflash[:login] ? @login_message = flash[:login] : @login_message = \"\"\n\t\n\t\t#New tracks\n\t\t@videos_new = Video.find_by_sql(\"SELECT start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, submitted_at, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on uploads.id = videos.upload_id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by submitted_at desc limit 4\")\n\t\n\t\t#Popular tracks\n\t\t@videos_popular = Video.find_by_sql(\"SELECT start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, times_played/(DATEDIFF(now(), submitted_at)+1) as performance, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on uploads.id = videos.upload_id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by performance desc limit 4\")\n\t\t\n\t\t#Recently played\n\t\t@videos_recently = Video.find_by_sql(\"SELECT start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on videos.upload_id = uploads.id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by latest_playback desc limit 4\")\n\t\n\t\t#Random route\n\t\t@random_route = Route.find_by_sql(\"SELECT videos.youtube, times_played, routes.id as route_id FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by rand() limit 1\")[0]\n\t\t\n\t\t#Slider\n\t\t@slider = Video.find_by_sql(\"select * from (SELECT content, start_locality_en, end_locality_en, start_country_en, end_country_en, start_locality_de, end_locality_de, start_country_de, end_country_de, youtube, times_played, videos.DARX, videos.DARY, videos.public, videos.id as id, filename_img, videos.duration, videos.name, end_at_distance as distance, times_played/(DATEDIFF(now(), submitted_at)+1) as performance, DATEDIFF(now(), submitted_at) as existance_days FROM videos inner join routes on videos.id = routes.video_id inner join users on user_id = users.id inner join uploads on uploads.id = videos.upload_id inner join contents on contents.city like end_locality_en where public = 1 and videos.blocked = 0 and users.blocked = 0 and videos.disabled = 0 and videos.visible = 1 order by performance desc limit 20) tab order by rand()\")\n\t\t#######\n\t\t\t\t\n\t\trender :action => 'startpage_'+@vm_language\n\tend",
"def test_018\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #Click a sub directory link\n click $xpath[\"task\"][\"master_option_file1\"]\n sleep 2\n #uncheck a file\n\n click $xpath[\"task\"][\"master_option_chk5\"]\n sleep 2\n\n #The state of other check boxes is not influenced.\n assert is_checked($xpath[\"task\"][\"master_option_chk6\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def browser_setup\n @js_loaded = false\n @browser_running = false\n Logger.log \"setting up...\"\n room = 'http://plug.dj/fractionradio/'\n\n # Make our browser instance, if we need it\n @browser = Watir::Browser.new :firefox, profile: 'default' unless @browser && @browser.exists?\n\n @browser.goto room # Try to load the room\n google_button = @browser.div(id: \"google\")\n if google_button.exists? # Do we need to log in?\n Logger.log \"logging in...\" # Yup\n google_button.click\n @browser.text_field(id: \"Email\").set OPTIONS[\"email\"] # provide email\n @browser.text_field(id: \"Passwd\").set OPTIONS[\"pass\"] # and pass\n @browser.button(id: \"signIn\").click\n @browser.wait # Wait for the lobby to load\n @browser.goto room # head to our room\n end\n\n Logger.log \"loading room...\"\n @browser.wait # Wait while the room loads\n\n begin\n Logger.log \"injecting javascript...\"\n @browser.execute_script JS # Inject Javascript\n @js_loaded = true\n Logger.log \"setting authorized users...\"\n @browser.execute_script \"RuB.setAuthorizedUsers(#{OPTIONS[\"users\"]})\" # Set authorized users\n rescue Selenium::WebDriver::Error::JavascriptError => e\n Logger.log e # Something may go wrong (I'm not perfect, after all)\n @js_loaded = false\n if e.message.match(\"API is not defined\") # If plug's API is not defined, we should be a little worried\n if @browser.url != room # Check that we're in the right place\n @browser.goto room # If not, let's go there\n @browser.wait\n else\n @browser.execute_script \"delete window.RuB\" # If we are, delete the existing instance. It failed to run anyways\n end\n\n retry # Try loading the JS again\n end\n end\n\n Logger.log \"loading last playing song...\"\n @current_song = YAML.load_file(FILES[:song]) # Load up the song that was playing the last time we were here\n\n Logger.log \"setup complete!\"\n @browser_running = true # ALL DONE!\n #bot.post_to_chat \"DJ-RuB is in the HOUSE!\"\n end",
"def valid_videos\n self.videos.select{ |video|\n video.exist? && video.embed? && video.auto_play?\n }\n end",
"def test_p1_00010_profilepage_profile_option\n if !@profilepage.profile_activity.present?\n @profilepage.goto_profile\n end\n if @profilepage.profile_pic_modal.present?\n @profilepage.profile_pic_cancel_button.click\n @browser.wait_until($t) { !@profilepage.profile_pic_modal.present? }\n end\n \t@profilepage.check_profile_in_user_dropdown\n \tassert @profilepage.profile_link.present? \n @profilepage.newline\n end",
"def capybara_elements\n context.capybara_context.all(\"iframe[src='#{site_value}']\")\n end",
"def test_020\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n\n #A subwindow carries out fade-out and closes.\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_016\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n assert !is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert !is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_015\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n #uncheck an option setup\n click $xpath[\"task\"][\"master_option_chk1\"]\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Close window\n click window_id + \"_close\"\n\n sleep 3\n #Open popup set again\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #the information set remains\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_013\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Maximize window\n click window_id + \"_maximize\"\n\n sleep 3\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_005\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # Below \"selection of the upload method of an individual analysis file\" is displayed.\n assert is_text_present(_(\"Select a master\"))\n assert is_text_present(_(\"Master\"))\n assert is_text_present(_(\"Select the upload method of individual analysis files\"))\n assert is_text_present(_(\"Upload of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def te_st_DOL_016_Access_SupportHome\r\n\r\n sTestCase_Name = \"test_DOL_016_Access_SupportHome\"\r\n sPageName = \"Support Home\"\r\n puts2(\"\")\r\n puts2(\"Starting Testcase: #{sTestCase_Name}\")\r\n\r\n # Continue since prior test cases have passed\r\n if(@@bContinue == true)\r\n #@@bContinue = false # Clear flag since this test has NOT passed yet\r\n\r\n begin # Access Validation DOL page: Support Home\r\n\r\n puts2(\"\\t Get the identifiers of the current window...\")\r\n sMainWindowTitle = $browser.title\r\n sMainWindowURL = $browser.url\r\n puts2(\"\\t sMainWindowTitle: '\" + sMainWindowTitle + \"'\")\r\n puts2(\"\\t sMainWindowURL: \" + sMainWindowURL)\r\n if($browser.is_ie? == true)\r\n iMainWindowHWND = $browser.hwnd() # Not supported in FireWatir\r\n puts2(\"\\t iMainWindowHWND \" + iMainWindowHWND.to_s)\r\n end\r\n\r\n=begin\r\n ################## Support Home ##################\r\n=end\r\n\r\n # Capture time before navigating to next page\r\n tPageLoadTime = Time.now\r\n\r\n puts2(\"Accessing page - \" + sPageName)\r\n assert($browser.access_quicklink_Help?())\r\n\r\n puts2(\"\\t Attach to the new window...\")\r\n\r\n # Secondary window\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).use do\r\n\r\n $browser.wait_until_status(\"Done\")\r\n\r\n # Calculate and record the elapsed time for the current test case\r\n puts2(\"\\t Page load time - \" + sPageName + \", \" + calc_elapsed_time(tPageLoadTime, false))\r\n puts2(\"\\t Url - \" + sPageName + \" : \"+ $browser.url)\r\n puts2(\"\\t Title - \" + sPageName + \" : \"+ $browser.title)\r\n\r\n sActualSecondaryBrowserUrl = $browser.url\r\n sExpectedSecondaryBrowserUrl = EXTERNAL_SITE_URL[\"SupportHome\"]\r\n\r\n puts2(\"\\t Validating on the page: \" + sPageName)\r\n if(sExpectedSecondaryBrowserUrl != sActualSecondaryBrowserUrl)\r\n raise(\"*** URL's don't match. \\n\\t Expected: \" + sExpectedSecondaryBrowserUrl + \"\\n\\t Actual: \" + sActualSecondaryBrowserUrl)\r\n else\r\n assert($browser.isPage_dishonline_SupportHome?()== true)\r\n end\r\n\r\n puts2(\"Close the second window...\")\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).close\r\n\r\n end # Secondary window\r\n\r\n puts2(\"Back to the main window...\")\r\n puts2(\"\\t Current browser Url: \" + $browser.url.to_s)\r\n puts2(\"\\t Current browser Title: \" + $browser.title.to_s)\r\n\r\n puts2(\"\\t Validating on the page: Home\")\r\n assert($browser.isPage_dishonline_Home?() == true)\r\n\r\n\r\n rescue => e\r\n\r\n puts2(\"*** ERROR Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"), \"ERROR\")\r\n\r\n puts2(\"\")\r\n puts2(\"\\t Current Url - : \"+ $browser.url)\r\n puts2(\"\\t Current Title - : \"+ $browser.title)\r\n #$browser.save_screencapture(\"Dish\" + sPageName , false) # Save the desktop\r\n $browser.save_html(\"Dish\" + sPageName)\r\n\r\n #$browser.generate_testcode_html_tag_counts()\r\n #$browser.generate_testcode_html_tag_attributes()\r\n\r\n raise(\"*** TESTCASE - #{sTestCase_Name}\")\r\n\r\n ensure\r\n\r\n #@@bContinue = true # Set flag since testcase passed\r\n\r\n # Set the flag to close the $browser after the last test case runs\r\n #@@bCloseBrowser = true\r\n\r\n\r\n end # Access Validation DOL page: Support Home\r\n\r\n end # Continue since prior test cases have passed\r\n\r\nend",
"def test_004\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 全体解析 (Analysis of all)\n select \"analyze_type\", \"label=#{@overall}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #There is no display below \"selection of the upload method of an individual analysis file.\"\n assert !is_text_present(_(\"Select the upload method of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def test_nonhero_is_vulnerable\n end",
"def test05_news_OpenLiving_TC_24397\n\t\tlogin $editor_1_email, $master_password\n\t\twait_for_ajax\n\t\t\n\t\t$header_tools_icon.click\n\t\tsleep 2\n\t\t$header_tools_start_news.click\n\n\t\t$group_name.set(\"Living Group #{random}\")\n\t\t$boards_group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$group_category_living.click\n\t\t$boards_arts_ent_image.when_present.fire_event(\"onclick\")\n\t\t$group_create.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\t\n\t\t\n\t\t#edit group type settings\n\t\twait_for_ajax\n \t\tsleep 2\n \t\t$group_basic_information_link.click\n \t\t$group_group_type.click \n \t\twait_for_ajax\n \t\t$group_setting_pre_moderated.click #make blog pre-moderated\n \t\tsleep 2\n \t\t$group_settings_save.click\n \t\tsleep 3\n \t\t\n \t\tassert $browser.text.include? \"group updated successfully\"\n \t\t\n \t\t$group_back_group.click\n \t\twait_for_ajax\n \t\t$browser.text.include? \"Posts awaiting your approval\"\n\tend",
"def verifySpeakersDisplayed()\n speakers= speakersDisplayed()\n #assert_equal speakers, true, \"In people>>speaker screen speakers should be shown\"\n end",
"def test_00171_homepage_featured_review_widget\n @browser.wait_until { @home_page.featured_r_widget.present? }\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.featured_r_widget.posts[0].title\n @home_page.featured_r_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.featured_r_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.featured_r_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.featured_r_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.featured_r_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.featured_r_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end",
"def test_001\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def test_int_page\n open_new_tab(Constants::INT_PAGE)\n sleep 5\n button_click(LOCATOR['RWDS_TAB'])\n switch_frame\n button_click(LOCATOR['ERN_PTS'])\n p text_displayed?(LOCATOR['ACT_NM'], 'Account Creation')\n switch_back\n @driver.close\n end",
"def auth_workarounds()\n # if(@configuration['Brand'].downcase.include?('proactiv') && @report.url.include?('.grdev.'))\n # Rails.logger.info 'working around auth popups'\n # env = @report.url.scan(/.proactiv.([^.]+)/).first.first\n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@proactiv.#{env}.dw.grdev.com\" \n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@proactiv.#{env}.dw.grdev.com/on/demandware.store/Sites-Proactiv-Site/default/RedirectURL-Hostname\"\n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@original.proactiv.#{env}.dw.grdev.com\"\n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@mypa.proactiv.#{env}.dw.grdev.com\"\n # @page.browser.driver.browser.get \"http://storefront:Grcweb123@mypa.proactiv.#{env}.dw.grdev.com/on/demandware.store\"\n # end\n\n if(@configuration['Brand'].downcase == 'crepeerase' && @report.url.include?('.grdev.'))\n env = @report.url.scan(/.crepeerase.([^.]+)/).first.first\n @page.browser.driver.browser.get \"https://storefront:Grcweb123@www.crepeerase.#{env}.dw2.grdev.com\"\n end\n\n if(@configuration['Brand'] == 'MeaningfulBeauty' && @report.url.include?('.qa.'))\n Rails.logger.info 'working around auth popups'\n @page.browser.driver.browser.get \"https://storefront:Grcweb123@catalog-meaningfulbeauty.stg01.dw.grdev.com\"\n end\n end",
"def test03_EventLanding_Headers #to be deprecated once page objects is complete\n\t\tlogin $user_1_email, $master_password\n\t\tsleep 3\n\t\t$home_see_all_events.click\n\t\tsleep 4\n\t\t\n\t\tassert $events_all_events_header.exists?\n\t\t\n\t\t$events_family.click\n\t\tsleep 1\n\t\tassert $events_family_header.exists?\n\t\t\n\t\t$events_free.click\n\t\tsleep 1\n\t\tassert $events_free_header.exists?\n\t\t\n\t\t$events_this_weekend.click\n\t\tsleep 1\n\t\tassert $events_this_weekend_header.exists?\n\tend",
"def test_also_works_without_png_extension\n @request.user_agent = CURRENT_BROWSERS[0]\n get :index, :src => \"painless_test\"\n assert_response :success\n assert_select \"img[src*=painless_test.png]\"\n \n @request.user_agent = LEGACY_BROWSERS[0]\n get :index, :src => \"painless_test\"\n assert_response :success\n assert_select 'div[style*=filter:progid:DXImageTransform.Microsoft.AlphaImageLoader]'\n assert_select 'div[style*=height:175px]'\n assert_select 'div[style*=width:120px]'\n end"
] | [
"0.5891938",
"0.5838972",
"0.58306587",
"0.5765835",
"0.5723487",
"0.5677557",
"0.5674475",
"0.56693363",
"0.5656986",
"0.5590565",
"0.55620307",
"0.5522716",
"0.54958296",
"0.54794925",
"0.5467298",
"0.5377037",
"0.53142023",
"0.53003246",
"0.52932036",
"0.52903837",
"0.52758443",
"0.5270961",
"0.52659136",
"0.52628744",
"0.5248143",
"0.52219766",
"0.5211097",
"0.5185081",
"0.5169806",
"0.5157864",
"0.5150687",
"0.51481754",
"0.5138644",
"0.51345277",
"0.5130345",
"0.51288694",
"0.51280487",
"0.5106827",
"0.5097038",
"0.50961727",
"0.50885916",
"0.5087541",
"0.5086876",
"0.50838894",
"0.5080503",
"0.50767314",
"0.50710744",
"0.5066616",
"0.5064472",
"0.505649",
"0.5055236",
"0.5054574",
"0.5053144",
"0.5048825",
"0.50473493",
"0.50469553",
"0.5042706",
"0.5019361",
"0.49914688",
"0.49879828",
"0.4983606",
"0.49803516",
"0.49793914",
"0.49791852",
"0.49756658",
"0.49717623",
"0.4966609",
"0.4957609",
"0.4951962",
"0.4951178",
"0.49494112",
"0.49457133",
"0.49378717",
"0.49347842",
"0.49336654",
"0.49276075",
"0.49258125",
"0.4923435",
"0.49228203",
"0.49219242",
"0.49209148",
"0.4917747",
"0.49100325",
"0.490676",
"0.4904739",
"0.49031162",
"0.4900227",
"0.48997462",
"0.48995703",
"0.48919165",
"0.4888183",
"0.48651809",
"0.48633084",
"0.48629147",
"0.4851767",
"0.48515025",
"0.48478562",
"0.4845055",
"0.48440537",
"0.48432776"
] | 0.66605896 | 0 |
Description Test useful to check correctness of conversion and cross browser visibility of all elements of kind Audio Mode Html Specific filters ApplicationControlleradmin_authenticate Skipped filters ApplicationControllerauthenticate ApplicationControllerinitialize_location ApplicationControllerinitialize_players_counter | def audios_test
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mobilkies not nahodyatsya, smeni prices epta')\n end\n $driver.manage.timeouts.implicit_wait = 10\n end",
"def videos_test\n end",
"def test_on_legacy_browsers\n for legacy_browser in LEGACY_BROWSERS\n @request.user_agent = legacy_browser\n get :index\n assert_response :success\n assert_select 'div[style*=filter:progid:DXImageTransform.Microsoft.AlphaImageLoader]'\n assert_select 'div[style*=height:175px]'\n assert_select 'div[style*=width:120px]'\n end\n end",
"def test_playlist\n end",
"def w3c_tests # :nologin:\n render(layout: false)\n end",
"def check_accessibility\n end",
"def browser_setup\n @js_loaded = false\n @browser_running = false\n Logger.log \"setting up...\"\n room = 'http://plug.dj/fractionradio/'\n\n # Make our browser instance, if we need it\n @browser = Watir::Browser.new :firefox, profile: 'default' unless @browser && @browser.exists?\n\n @browser.goto room # Try to load the room\n google_button = @browser.div(id: \"google\")\n if google_button.exists? # Do we need to log in?\n Logger.log \"logging in...\" # Yup\n google_button.click\n @browser.text_field(id: \"Email\").set OPTIONS[\"email\"] # provide email\n @browser.text_field(id: \"Passwd\").set OPTIONS[\"pass\"] # and pass\n @browser.button(id: \"signIn\").click\n @browser.wait # Wait for the lobby to load\n @browser.goto room # head to our room\n end\n\n Logger.log \"loading room...\"\n @browser.wait # Wait while the room loads\n\n begin\n Logger.log \"injecting javascript...\"\n @browser.execute_script JS # Inject Javascript\n @js_loaded = true\n Logger.log \"setting authorized users...\"\n @browser.execute_script \"RuB.setAuthorizedUsers(#{OPTIONS[\"users\"]})\" # Set authorized users\n rescue Selenium::WebDriver::Error::JavascriptError => e\n Logger.log e # Something may go wrong (I'm not perfect, after all)\n @js_loaded = false\n if e.message.match(\"API is not defined\") # If plug's API is not defined, we should be a little worried\n if @browser.url != room # Check that we're in the right place\n @browser.goto room # If not, let's go there\n @browser.wait\n else\n @browser.execute_script \"delete window.RuB\" # If we are, delete the existing instance. It failed to run anyways\n end\n\n retry # Try loading the JS again\n end\n end\n\n Logger.log \"loading last playing song...\"\n @current_song = YAML.load_file(FILES[:song]) # Load up the song that was playing the last time we were here\n\n Logger.log \"setup complete!\"\n @browser_running = true # ALL DONE!\n #bot.post_to_chat \"DJ-RuB is in the HOUSE!\"\n end",
"def verifySpeakersDisplayed()\n speakers= speakersDisplayed()\n #assert_equal speakers, true, \"In people>>speaker screen speakers should be shown\"\n end",
"def test_006\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #A task type is changed into \"individual analysis\"\n # with a \"general control\" tab.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析 (Individual Analysis)\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n #An option setup of \"master: A qac\" subwindow is displayed.\n click $xpath[\"task\"][\"option_setup_link\"]\n # click \"link=設定する\"\n sleep 3\n # #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n sleep 2\n\n # logout\n logout\n\n end",
"def verify_desboard_containts\n\n expect(@driver.find_element(:id,'off-canvas-menu-landing').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-open-order-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-history').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-locations-list').displayed?).to be_truthy\n expect(@driver.find_element(:id,'off-canvas-menu-settings').displayed?).to be_truthy\n\nend",
"def w3c_tests\n render(layout: false)\n end",
"def test03_L1DLT03_TC_24418\n\t\t#skipping for now, currently unable to interact with the \"Like\" button\n\tend",
"def test_home_bk_app\n @driver.navigate.to(@rootURL)\n verify_visible_image_in_css(:css, '.bkDelivers')\n just_verify {assert @driver.find_element(:css, 'section.bkDelivers h3.title').text.include?'APP'}\n just_verify {assert_not_nil @driver.find_element(:css, 'section.bkDelivers h4.subtitle').text}\n end",
"def test_browser_mode!\r\n @browser_mode = BrowserMode::Test\r\n end",
"def test_lesson_access_rights\n $ie.text_field(:id, \"login\").set((users :watir_premium).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.text_field(:id, \"login\").set((users :registered).login)\n $ie.text_field(:id, \"password\").set(\"test\") \n $ie.form(:action, \"/sessions\").submit\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"upgrade\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n $ie.link(:text, /Return to Course Overview/).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n\n $ie.link(:text, \"Logout\").click\n $ie.link(:text, \"Courses\").click \n\n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_premium).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_registered).title).click\n assert $ie.url.include?(\"login\")\n $ie.link(:text, \"Courses\").click \n $ie.link(:text, (courses :tagged).title).click\n $ie.link(:text, (contents :tagged_1_public).title).click\n end",
"def test_10_filter_html\n\t\tprintTestHeader \"filter_html Option\"\n\t\trval = bc = nil\n\n\t\t# Test as a 1st-level param\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, :filter_html )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_styles }\n\t\tassert_equal nil, rval\n\n\t\t# Test rendering with filters on\n\t\tassert_nothing_raised { rval = bc.to_html }\n\t\tassert_equal DangerousHtmlOutput, rval\n\n\t\t# Test setting it in a sub-array\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, [:filter_html] )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\t\t\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_styles }\n\t\tassert_equal nil, rval\n\n\t\t# Test rendering with filters on\n\t\tassert_nothing_raised { rval = bc.to_html }\n\t\tassert_equal DangerousHtmlOutput, rval\n\tend",
"def test_0_before\n\t\t$report = Report.new()\n \t\t$testReport = $report.createReport($REPORT)\n\n\t\t$browser = Watir::Browser.new\n\t\t$current=\"\"\n\tend",
"def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end",
"def test_filters\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"pt-pt,pt;q=0.5\"\n good_ajax_request(:test)\n assert_nil(@controller.instance_variable_get(\"@user\"))\n assert_nil(User.current)\n assert_equal(:pt, I18n.locale)\n assert_equal(0, cookies.count)\n assert_equal({ \"locale\" => \"pt\" }, session.to_hash)\n session.delete(\"locale\")\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"pt-pt,xx-xx;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete(\"locale\")\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"pt-pt,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete(\"locale\")\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"en-xx,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n\n @request.env[\"HTTP_ACCEPT_LANGUAGE\"] = \"zh-*\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n end",
"def test_018\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #Click a sub directory link\n click $xpath[\"task\"][\"master_option_file1\"]\n sleep 2\n #uncheck a file\n\n click $xpath[\"task\"][\"master_option_chk5\"]\n sleep 2\n\n #The state of other check boxes is not influenced.\n assert is_checked($xpath[\"task\"][\"master_option_chk6\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_filters\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"pt-pt,pt;q=0.5\"\n good_ajax_request(:test)\n assert_nil(@controller.instance_variable_get('@user'))\n assert_nil(User.current)\n assert_equal(:pt, I18n.locale)\n assert_equal(0, cookies.count)\n assert_equal({'locale'=>'pt'}, session)\n session.delete('locale')\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"pt-pt,xx-xx;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete('locale')\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"pt-pt,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:pt, I18n.locale)\n session.delete('locale')\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"en-xx,en;q=0.5\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n\n @request.env['HTTP_ACCEPT_LANGUAGE'] = \"zh-*\"\n good_ajax_request(:test)\n assert_equal(:en, I18n.locale)\n end",
"def test_allApplication_load\n @driver.get(@baseURL)\n #begin\n @Nexa_Util.loginAsNormalUser(@driver)\n # @wait.until { @driver.find_element(:id, 'leftNavigationContent') }\n\n # rescue Timeout::Error\n waitForPageFullyLoaded(40);\n @start = Time.now\n @driver.find_element(:link_text, 'All Applications').click\n # @wait.until { @driver.find_element(:class, 'resultTable') }\n waitForPageFullyLoaded(20);\n @stop = Time.now\n @sitePerformance.puts \"Page load time 'All Applications': #{@Nexa_Util.time_diff_milli(@start, @stop)}\"\n assert_operator 60000.00, :>, @Nexa_Util.time_diff_milli(@start, @stop)\n # end\n end",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end",
"def get_detection_html(user_agent)\n ua_info = fingerprint_user_agent(user_agent)\n os = ua_info[:os_name]\n client = ua_info[:ua_name]\n\n code = ERB.new(%Q|\n <%= js_base64 %>\n <%= js_os_detect %>\n <%= js_ajax_post %>\n <%= js_misc_addons_detect %>\n <%= js_ie_addons_detect if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n\n function objToQuery(obj) {\n var q = [];\n for (var key in obj) {\n q.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]));\n }\n return Base64.encode(q.join('&'));\n }\n\n function isEmpty(str) {\n return (!str \\|\\| 0 === str.length);\n }\n\n function sendInfo(info) {\n var query = objToQuery(info);\n postInfo(\"<%=get_resource.chomp(\"/\")%>/<%=@info_receiver_page%>/\", query, function(){\n window.location=\"<%= get_module_resource %>\";\n });\n }\n\n var flashVersion = \"\";\n var doInterval = true;\n var maxTimeout = null;\n var intervalTimeout = null;\n\n function setFlashVersion(ver) {\n flashVersion = ver\n if (maxTimeout != null) {\n clearTimeout(maxTimeout);\n maxTimeout = null\n }\n doInterval = false\n return;\n }\n\n function createFlashObject(src, attributes, parameters) {\n var i, html, div, obj, attr = attributes \\|\\| {}, param = parameters \\|\\| {};\n attr.type = 'application/x-shockwave-flash';\n if (window.ActiveXObject) {\n attr.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';\n param.movie = src;\n } else {\n attr.data = src;\n }\n\n html = '<object';\n for (i in attr) {\n html += ' ' + i + '=\"' + attr[i] + '\"';\n }\n html += '>';\n for (i in param) {\n html += '<param name=\"' + i + '\" value=\"' + param[i] + '\" />';\n }\n html += '</object>';\n div = document.createElement('div');\n div.innerHTML = html;\n obj = div.firstChild;\n div.removeChild(obj);\n return obj;\n }\n\n window.onload = function() {\n var osInfo = os_detect.getVersion();\n var d = {\n \"os_vendor\" : osInfo.os_vendor,\n \"os_device\" : osInfo.os_device,\n \"ua_name\" : osInfo.ua_name,\n \"ua_ver\" : osInfo.ua_version,\n \"arch\" : osInfo.arch,\n \"java\" : misc_addons_detect.getJavaVersion(),\n \"silverlight\" : misc_addons_detect.hasSilverlight(),\n \"flash\" : misc_addons_detect.getFlashVersion(),\n \"vuln_test\" : <%= js_vuln_test %>,\n \"os_name\" : osInfo.os_name\n };\n\n <% if os.match(OperatingSystems::Match::WINDOWS) and client == HttpClients::IE %>\n d['office'] = ie_addons_detect.getMsOfficeVersion();\n d['mshtml_build'] = ScriptEngineBuildVersion().toString();\n <%\n activex = @requirements[:activex]\n if activex\n activex.each do \\|a\\|\n clsid = a[:clsid]\n method = a[:method]\n %>\n var ax = ie_addons_detect.hasActiveX('<%=clsid%>', '<%=method%>');\n d['activex'] = \"\";\n if (ax == true) {\n d['activex'] += \"<%=clsid%>=><%=method%>=>true;\";\n } else {\n d['activex'] += \"<%=clsid%>=><%=method%>=>false;\";\n }\n <% end %>\n <% end %>\n <% end %>\n\n if (d[\"flash\"] != null && (d[\"flash\"].match(/[\\\\d]+.[\\\\d]+.[\\\\d]+.[\\\\d]+/)) == null) {\n var flashObject = createFlashObject('<%=get_resource.chomp(\"/\")%>/<%=@flash_swf%>', {width: 1, height: 1}, {allowScriptAccess: 'always', Play: 'True'});\n\n // After 5s stop waiting and use the version retrieved with JS if there isn't anything\n maxTimeout = setTimeout(function() {\n if (intervalTimeout != null) {\n doInterval = false\n clearInterval(intervalTimeout)\n }\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }, 5000);\n\n // Check if there is a new flash version every 100ms\n intervalTimeout = setInterval(function() {\n if (!doInterval) {\n clearInterval(intervalTimeout);\n if (!isEmpty(flashVersion)) {\n d[\"flash\"] = flashVersion\n }\n sendInfo(d);\n }\n }, 100);\n\n document.body.appendChild(flashObject)\n } else {\n sendInfo(d)\n }\n }\n |).result(binding())\n\n js = ::Rex::Exploitation::JSObfu.new code\n js.obfuscate\n\n %Q|\n <script>\n #{js}\n </script>\n <noscript>\n <img style=\"visibility:hidden\" src=\"#{get_resource.chomp(\"/\")}/#{@noscript_receiver_page}/\">\n <meta http-equiv=\"refresh\" content=\"1; url=#{get_module_resource}\">\n </noscript>\n |\n end",
"def test_017\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #All file of directory is checked.\n\n assert is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_Browser_001_DisplayWatirEnv\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_DisplayWatirEnv\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - display_watir_env\")\n display_watir_env()\n\n end",
"def test_20_filter_styles\n\t\tprintTestHeader \"filter_styles Option\"\n\t\trval = bc = nil\n\n\t\t# Test as a 1st-level param\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, :filter_styles )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\t\t\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_styles }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal nil, rval\n\n\t\t# Test rendering with filters on\n\t\tassert_nothing_raised { rval = bc.to_html }\n\t\tassert_equal DangerousStylesOutput, rval\n\n\t\t# Test setting it in a subarray\n\t\tassert_nothing_raised {\n\t\t\tbc = BlueCloth::new( DangerousHtml, [:filter_styles] )\n\t\t}\n\t\tassert_instance_of BlueCloth, bc\n\n\t\t# Accessors\n\t\tassert_nothing_raised { rval = bc.filter_styles }\n\t\tassert_equal true, rval\n\t\tassert_nothing_raised { rval = bc.filter_html }\n\t\tassert_equal nil, rval\n\n\t\t# Test rendering with filters on\n\t\tassert_nothing_raised { rval = bc.to_html }\n\t\tassert_equal DangerousStylesOutput, rval\n\n\tend",
"def pbPlayDecisionSE()\n if $data_system && $data_system.respond_to?(\"decision_se\") &&\n $data_system.decision_se && $data_system.decision_se.name!=\"\"\n pbSEPlay($data_system.decision_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[1] && $data_system.sounds[1].name!=\"\"\n pbSEPlay($data_system.sounds[1])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel decision\")\n pbSEPlay(\"GUI sel decision\",80)\n end\nend",
"def one_player_mode\nend",
"def test_015\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n #uncheck an option setup\n click $xpath[\"task\"][\"master_option_chk1\"]\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Close window\n click window_id + \"_close\"\n\n sleep 3\n #Open popup set again\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #the information set remains\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def TelevisionPage()\n \n \n begin\n \n #Chromedriver location\n Selenium::WebDriver::Chrome.driver_path = File.expand_path('C:\\\\TestProject\\\\ChromeDriver\\\\chromedriver.exe')\n \n #Open a Chrome browser\n driver = Watir::Browser.new :chrome\n \n #Navigate to the url\n driver.goto \"https://www.which.co.uk/reviews/televisions\"\n sleep 4\n #Maximize the Chrome window\n driver.window.maximize \n sleep 1\n #get page title\n oPageTitle=driver.title\n UtilsTestScript.TakeScreenshot(driver)\n #Check that the page title is Television reviews - Which?\n if(oPageTitle != \"Television reviews - Which?\") \n puts\"Title of the webpage is not 'Television reviews - Which?'. \" \n #Utility to take screenshot \n UtilsTestScript.TakeScreenshot(driver)\n return false\n end\n \n #Scenario 1\n #Check if the top level menu items are displayed as expected\n ############################################################\n \n #Expected Toplevel menu items \n array_toplevelmenu=[\"Technology\",\"Home & garden\",\"Money\",\"Baby & child\",\"Cars & travel\",\"Campaigns\",\"Services\",\"More from Which?\"]\n \n for i in 0 ... array_toplevelmenu.length\n #Xpath_ToplevelMenu returns all the elements in the top level menu.\n xpath_menuitems=TelevisionPageObjects.ReplaceString(TelevisionPageObjects::Xpath_ToplevelMenu,\"#{i+1}\")\n #Waits(for 5 seconds) until the object is returned\n isMenuItemPresent = Watir::Wait.until(5){driver.element(:xpath => xpath_menuitems)}\n if(isMenuItemPresent.present?)\n #Get the text of the menuitem\n menuItem=isMenuItemPresent.text\n puts \"#{menuItem}\"\n #compare the text retrived to the array\n if(array_toplevelmenu[i] != menuItem)\n puts\"Top level menu item '#{array_toplevelmenu[i]}' is not displayed in the web page.\"\n UtilsTestScript.TakeScreenshot(driver) \n end\n else\n puts\"Not able to get the reference of top level menu item #{array_toplevelmenu[i]}.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n end\n \n #Scenario 2\n #Check if 'TV & home entertainment' link is displayed in the page\n ############################################################ \n isLinkPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_TVHomeELink)}\n if !(isLinkPresent.present?) \n puts\"'TV & home entertainment' link is not displayed in the page\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n #Scenario 3\n #For the first product displayed in the page,make sure that Compare button is displayed.\n #Click on it and verify that the Compare popup shows up with the same product name.\n ############################################################ \n \n #Check if Compare button is present inside the first product description \n isButtonPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_CompareBtn)}\n if (isButtonPresent.present?) \n #Click on Compare button\n isButtonPresent.click\n UtilsTestScript.TakeScreenshot(driver)\n #Check if Compare popup is displayed\n isPopupPresent = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_ComparePopup)}\n if(isPopupPresent)\n #Get the model name from the product tile\n isModel = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_model)} \n if(isModel)\n puts\"#{isModel.text}\"\n else\n puts\"Not able to get the reference of the first product model name in the product list.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n #Check the manufacturer name in the Compare popup \n checkPopupMf = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_modelMf)} \n if(checkPopupMf)\n getPopupMf=checkPopupMf.text\n puts\"#{getPopupMf}\"\n else\n puts\"Not able to get the reference of the product manufacturer name in the popup.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n #Check the model number in the Compare popup \n checkPopupModel = Watir::Wait.until(5){driver.element(:xpath => TelevisionPageObjects::Xpath_modelno)} \n if(checkPopupModel)\n getPopupModel=checkPopupModel.text\n puts\"#{getPopupModel}\"\n else\n puts\"Not able to get the reference of the product model name in the popup.\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n #Check that product name matches in the Compare popup and the first product tile\n if(isModel.text != getPopupMf+\" \"+ getPopupModel)\n puts\"Product name in the first tile doesn't match with the one displyed in Compare popup .\"\n UtilsTestScript.TakeScreenshot(driver)\n end\n \n end\n \n end\n \n #rescue block to display any Exception that may happen \n rescue Exception => e\n puts e\n ensure\n #Close the driver\n driver.quit\n end \n \nend",
"def test_012\n\n #login\n login\n\n #Open PU management page\n open_pu_management_page_1\n\n # Find a PU\n # Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #test for make root in the master tab & in the popup which is displayed by clicking 設定する\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n #test for make root\n type \"makeroot_qac\", \"abc\"\n run_script \"destroy_subwindow()\"\n assert is_text_present(_(\"Make root\")+\":\")\n click $xpath[\"task\"][\"option_setup_link\"]\n sleep 2\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n sleep 3\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n type \"makeroot_qac\", \"abc\"\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 2\n assert is_text_present(_(\"Make root\")+\":\")\n click $xpath[\"task\"][\"option_setup_link\"]\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n\n\n\n #logout\n logout\n\n end",
"def test_016\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n assert !is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert !is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_add_filter\n flunk\n end",
"def initialize(site_url,defaults = {})\n defaults = {\n :results_path => File.expand_path(File.dirname(__FILE__)) + \"/public/results/\",\n :webdriver_type => \"watir\" ,\n :browser_type => \"firefox\" ,\n :har_type => \"internal\" ,\n :display => \"\" ,\n :chrome_settings => %W[ --enable-benchmarking --enable-net-benchmarking --no-sandbox --user-data-dir],\n :vnc_enabled => false ,\n :debug_option => false,\n :test_cycles => 1,\n :id => \"\",\n :secscan => false,\n :vlc_bin => `which vlc`\n }.merge(defaults)\n @options = defaults\n @logger = Logger.new(STDOUT)\n pp \"Initialize options : #{options.inspect}\"\n \n \n \n \n if File.exists?(File.expand_path(File.dirname(__FILE__))+\"/settings.yml\")\n @config = YAML::load(File.open(File.expand_path(File.dirname(__FILE__))+\"/settings.yml\"))\n @logger.debug \"loaded config : \" + @config.inspect\n log_file = File.open(@config[\"debug_file\"], 'a+')\n log_file.sync = true \n @logger = Logger.new(log_file)\n if (@config[\"results_path\"]) ; @results_path = @config[\"results_path\"] else @results_path = options[:results_path] end\n if (@config[\"webdriver_type\"]) ; @webdriver_type = @config[\"webdriver_type\"] else @webdriver_type = options[:webdriver_type] end\n if (@config[\"browser_type\"]) ; @browser_type = @config[\"browser_type\"] else @browser_type = options[:browser_type] end\n if (@config[\"har_type\"]) ; @har_type = @config[\"har_type\"] else @har_type = options[:har_type] end\n if (@config[\"display\"]) ; @display = @config[\"display\"] else @display = options[:display] end\n if (@config[\"chrome_settings\"]) ; @chrome_settings = @config[\"chrome_settings\"] else @chrome_settings = options[:chrome_settings] end\n if (@config[\"vnc_enabled\"]) ; @vnc_enabled = @config[\"vnc_enabled\"] else @vnc_enabled = options[:vnc_enabled] end\n if (@config[\"debug_options\"]) ; @debug_option = @config[\"debug\"] else @debug_option = options[:debug_options] end\n if (@config[\"test_cycles\"]) ; @test_cycles = @config[\"test_cycles\"] else @test_cycles = options[:test_cycles] end\n if (@config[\"failsafe\"]) ; @failsafe = @config[\"failsafe\"] else @failsafe = options[:failsafe] end\n if (@config[\"vlc_bin\"]) ; @vlc_bin = @config[\"vlc_bin\"] else @vlc_bin = options[:vlc_bin] end\n else\n @results_path = options[:results_path]\n @webdriver_type = options[:webdriver_type]\n @browser_type = options[:browser_type]\n @har_type = options[:har_type]\n @display = options[:display]\n @chrome_settings = options[:chrome_settings]\n @vnc_enabled = options[:vnc_enabled]\n @debug_option = options[:debug_options]\n @test_cycles = options[:test_cycles]\n @failsafe = options[:failsafe]\n @vlc_bin = options[:vlc_bin]\n end\n \n @logger.info pp @chrome_settings.inspect\n \n if @debug_option \n @logger.level = Logger::DEBUG\n else\n @logger.level = Logger::ERROR\n end\n @logger.level = Logger::DEBUG\n \n unless site_url[/^http:\\/\\//] || site_url[/^https:\\/\\//]\n site_url = URI.parse 'http://' + site_url rescue nil\n end\n @url = site_url\n options[:id] == \"\" ? @name = \"#{Time.now.hash}\" : @name = options[:id]\n @name = \"#{name}\".gsub(/-/,\"\")\n @results_path = \"#{results_path}#{name}/\"\n @logger.debug \"Name : #{name} | Result Path : #{results_path} | URL : #{url}\"\n \n @firefox_settings = Selenium::WebDriver::Firefox::Profile.new\n @firefox_settings.assume_untrusted_certificate_issuer=false \n end",
"def test_a_filter_all\n filter = 'filter-all'\n tag_name='All'\n basic_check_list(filter, tag_name)\n end",
"def test_00010_profanity_blocker\n \t@loginpage.login($user1)\n enable_profanity_blocker($networkslug, true)\n #check community post\n title_before = \"watir test profanity blocker - #{get_timestamp}\"\n title_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"discussion\", title_before, false)\n title_before[\"test profanity\"] = \"**** *********\"\n assert title_before == title_after\n # comment_root_post\n # reply_to_comment\n # #check hybris post\n # create_post_from_hybris\n enable_profanity_blocker($networkslug, false)\n title2_before = \"watir test profanity blocker - #{get_timestamp}\"\n title2_after = PageObject.new(@browser).create_conversation($network, $networkslug, \"A Watir Topic\", \"question\", title2_before, false)\n assert title2_before == title2_after\n end",
"def test_003\n open_pu_management_page\n assert is_element_present(xpath[\"pu_management\"][\"search_box\"])\n assert is_element_present(xpath[\"pu_management\"][\"pu_table\"])\n logout\n end",
"def loading_wait\n \tcase ENV['BROWSER']\n \twhen \"iphone\",\"ipad\",\"android_phone\",\"android_tablet\" then\n \t\tWatir::Wait.until {\n \t\tnot @browser.element(xpath: '//div[contains(@class, \"load\")]').visible?\n \t\t}\n \telse\n \t\tWatir::Wait.until {\n \t\tnot @browser.iframe(:id, 'quote-frame').div(xpath: '//div[contains(@id, \"load\")]').visible?\n \t\t}\n \tend\n \tend",
"def filter_leapfrog_character\r\n # Click lick on filter link\r\n leapfrog_character_lnk.click\r\n end",
"def test_007\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n @@pu = Pu.find_by_name('SamplePU1')\n\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')\n\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n sleep 2\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def test_authorization_of_protocols_and_datafiles_links\n #sanity check the fixtures are correct\n check_fixtures_for_authorization_of_protocols_and_datafiles_links\n login_as(:model_owner)\n experiment=experiments(:experiment_with_public_and_private_protocols_and_datafiles)\n assert_difference('ActivityLog.count') do\n get :show, :id=>experiment.id\n end\n\n assert_response :success\n\n assert_select \"div.tabbertab\" do\n assert_select \"h3\", :text=>\"Protocols (1+1)\", :count=>1\n assert_select \"h3\", :text=>\"Data Files (1+1)\", :count=>1\n end\n\n assert_select \"div.list_item\" do\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :text=>\"Protocol with fully public policy\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :text=>\"Download Only\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n end\n\n end",
"def test_005\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # Below \"selection of the upload method of an individual analysis file\" is displayed.\n assert is_text_present(_(\"Select a master\"))\n assert is_text_present(_(\"Master\"))\n assert is_text_present(_(\"Select the upload method of individual analysis files\"))\n assert is_text_present(_(\"Upload of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def test_020\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n\n #A subwindow carries out fade-out and closes.\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_004\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 全体解析 (Analysis of all)\n select \"analyze_type\", \"label=#{@overall}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #There is no display below \"selection of the upload method of an individual analysis file.\"\n assert !is_text_present(_(\"Select the upload method of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def test_find_application_load\n @driver.get(@baseURL)\n @Nexa_Util.loginAsNormalUser(@driver)\n # Click at Contacts link Top Nav\n @driver.find_element(:link_text, 'Applications').click\n @driver.find_element(:css, '#simpleSearchApplicationForm > table > tbody > tr:nth-child(2) > td.valueLabel > input[type=\"text\"]').send_keys 'Lisa'\n waitForPageFullyLoaded(20);\n @start = Time.now\n @driver.find_element(:css, '#simpleSearchApplicationForm > table > tbody > tr:nth-child(8) > td:nth-child(2) > table > tbody > tr > td.textButton2014').click\n # @wait.until { @driver.find_element(:class, 'standardTable') }\n waitForPageFullyLoaded(20);\n @stop = Time.now\n @sitePerformance.puts \"Page load time 'Find Applications': #{@Nexa_Util.time_diff_milli(@start, @stop)}\"\n assert_operator 15000.00, :>, @Nexa_Util.time_diff_milli(@start, @stop)\n end",
"def test_009\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qac)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qacpp)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_update_whitelist\n # Assert nothing is injected before whitelisting\n page.driver.browser.get(\"http://test.privly.org/test_pages/nonwhitelist.html\")\n assert page.has_no_xpath?('//iframe')\n\n # Update the whitelist\n page.driver.browser.get(@options_url)\n elements = page.all(:css, '.whitelist_url')\n elements[0].set 'Dev.Privly.Org.phish.org'\n page.driver.browser.get(\"http://test.privly.org/test_pages/nonwhitelist.html\")\n assert page.has_xpath?('//iframe')\n\n # Assert something injected\n page.driver.browser.get(\"http://test.privly.org/test_pages/nonwhitelist.html\")\n assert page.has_xpath?('//iframe')\n end",
"def plz_be_quiet\n if find('.ytp-mute-button')['title'] == 'Mute'\n page.find('.ytp-mute-button').click\n puts 'shhh!'\n end\nend",
"def test_032\n test_000\n login(\"root\",\"root\")\n create_1st_user\n sleep WAIT_TIME\n attribute = @selenium.get_attribute(\"//body/div[2]@style\")\n # if there is a piece of text \"display: none\", this subwindow will be fade out\n result = (attribute.to_s =~ /display: none/ )\n # 'result' is nill demonstrates that the subwindow still available\n assert_equal result, nil\n logout\n end",
"def include_dsl_modules\n WebBrowser.include_module(:GameStopDSL)\n WebBrowser.include_module(:GameStopAccountsDSL)\n WebBrowser.include_module(:GameStopAnalyticsDSL)\n WebBrowser.include_module(:GameStopCartFunctions)\n WebBrowser.include_module(:GameStopCartValidations)\n WebBrowser.include_module(:GameStopCheckoutFunctions)\n WebBrowser.include_module(:GameStopCheckoutValidations)\n WebBrowser.include_module(:GameStopProductDetailsFunctions)\n WebBrowser.include_module(:GameStopProductDetailsValidations)\n WebBrowser.include_module(:GameStopSearchDSL)\n WebBrowser.include_module(:GameStopWalletDSL)\n WebBrowser.include_module(:CommonFunctions)\n WebBrowser.include_module(:CommonCookieDSL)\n WebBrowser.include_module(:TestHarnessDSL)\n WebBrowser.include_module(:MonitoringDSL)\n WebBrowser.include_module(:ContinuousIntegrationDSL)\n WebBrowser.include_module(:GameStopRecommerceDSL)\n WebBrowser.include_module(:DataFuzzer)\n WebBrowser.include_module(:ProxyFunctions)\n\tWebBrowser.include_module(:GameStopGiftCardsDSL)\n WebBrowser.include_module(:GameStopStoreDSL)\nend",
"def test_001\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def before_players_ready\r\n end",
"def test_sources_tc958 #20 \n # Refering candidate with tracking source, new candidate, Clear Source Tracking for Internal Referrals\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n # Preconditions\n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::INTERNAL_LINK_LIST_XPATH)\n Common.displayed(BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH)\n test = [\n {\"displayed\" => BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH},\n {\"click\" => BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH},\n \n {\"displayed\" => BoardSetupEditPage::BOARD_EDIT_APPLY_REFERRAL_IMMEDIATELY_XPATH},\n {\"checked\" => BoardSetupEditPage::BOARD_EDIT_APPLY_REFERRAL_IMMEDIATELY_XPATH},\n {\"set_text\" => BoardSetupEditPage::BOARD_EDIT_SOURCE_TRACKING_FOR_INTERNAL_REFERRAL_XPATH, \"text\" => \" \"},\n \n {\"click\" => BoardSetupEditPage::BOARD_EDIT_SAVE_BUTTON_XPATH},\n ]\n Common.main(test)\n \n $browser.get HomePage::JOB_BOARD_INTERNAL_URL\n test = [\n {\"check_apply\" => \"\"},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_REFER_CANDIDATE_XPATH},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_REFER_CANDIDATE_XPATH},\n \n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_REFERRER_EMAIL_XPATH},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_APPLY_REFERRER_EMAIL_XPATH, \"text\" => Users::JOB_BOARD_USER_TEXT},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_CONTINUE_BUTTON_XPATH},\n \n {\"displayed\" => JobBoardJobDetail::PROSPECT_FIRST_NAME_XPATH},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_FIRST_NAME_XPATH, \"text\" => \"a\"},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_LAST_NAME_XPATH, \"text\" => \"b\"},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_EMAIL, \"text\" => \"matiast@oktana.io\"},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH},\n {\"displayed\" => JobBoardJobDetail::THANK_YOU_REFERRAL_MESSAGE_XPATH}\n ]\n Common.main(test)\n \n assert $browser.find_element(:xpath, JobBoardJobDetail::THANK_YOU_REFERRAL_MESSAGE_XPATH).displayed?\n \n end",
"def test_039\n test_000\n login(\"root\",\"root\")\n create_2nd_user\n sleep WAIT_TIME\n abc = @selenium.get_attribute(\"//body/div[2]@style\")\n # if there is a piece of text \"display: none\", this subwindow will be fade out\n result = (abc.to_s =~ /display: none/ )\n # 'result' is nill demonstrates that the subwindow still available\n assert_equal result, nil\n logout\n end",
"def test_scm_st_003\n printf \"\\n Test 003\"\n open_periodical_analysis_setting_tab \n assert(is_element_present($display_scm_xpath[\"save_button\"])) \n assert(is_element_present($display_scm_xpath[\"clear_button\"]))\n assert(is_element_present($display_scm_xpath[\"delete_button\"]))\n assert(is_element_present($display_scm_xpath[\"save_all_button\"]))\n logout\n end",
"def test_021\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n # logout\n logout\n\n end",
"def test_scm_st_028\n printf \"\\n Test 028\"\n open_periodical_analysis_setting_tab\n assert !is_checked($display_scm_xpath[\"qac\"])\n assert !is_checked($display_scm_xpath[\"qacpp\"])\n logout\n end",
"def test_login_controls\n get :login_controls\n assert_response :success\n assert_nil session[:user]\n end",
"def universal_plug_and_play(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Universal Plug and Play\" page.\n begin\n @ff.link(:text, 'Universal Plug and Play').click\n self.msg(rule_name, :info, 'Universal Plug and Play', 'Reached page \\'Universal Plug and Play\\'.')\n rescue\n self.msg(rule_name, :error, 'Universal Plug and Play', 'Did not reach \\'Universal Plug and Play\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') &&\n info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'local_administration','Some key NOT found.')\n return\n end \n \n # Parese the json file.\n \n # \"Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features\"\n if info.has_key?('Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features')\n \n case info['Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features']\n \n when 'on'\n \n # Set \"Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features\"\n @ff.checkbox(:name,'upnp_enabled').set\n self.msg(rule_name,:info,'Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features',info['Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features'])\n \n when 'off'\n \n # Clear \"Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features\"\n @ff.checkbox(:name,'upnp_enabled').clear\n self.msg(rule_name,:info,'Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features',info['Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Allow Other Network Users to Control Wireless Broadband Router\\'s Network Features\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Enable Automatic Cleanup of Old Unused UpnP Services\"\n if info.has_key?('Enable Automatic Cleanup of Old Unused UpnP Services')\n \n case info['Enable Automatic Cleanup of Old Unused UpnP Services']\n \n when 'on'\n \n # Set \"Enable Automatic Cleanup of Old Unused UpnP Services\"\n @ff.checkbox(:name,'upnp_rules_auto_clean_enabled').set\n self.msg(rule_name,:info,'Enable Automatic Cleanup of Old Unused UpnP Services',info['Enable Automatic Cleanup of Old Unused UpnP Services'])\n \n when 'off'\n \n # Clear \"Enable Automatic Cleanup of Old Unused UpnP Services\"\n @ff.checkbox(:name,'upnp_rules_auto_clean_enabled').clear\n self.msg(rule_name,:info,'Enable Automatic Cleanup of Old Unused UpnP Services',info['Enable Automatic Cleanup of Old Unused UpnP Services'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Enable Automatic Cleanup of Old Unused UpnP Services\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Publish Only the Main WAN Connection\"\n if info.has_key?('Publish Only the Main WAN Connection')\n \n case info['Publish Only the Main WAN Connection']\n \n when 'on'\n \n # Set \"Publish Only the Main WAN Connection\"\n @ff.select_list(:name,'wan_conns_to_publish').select_value(\"0\")\n self.msg(rule_name,:info,'Publish Only the Main WAN Connection',info['Publish Only the Main WAN Connection'])\n \n when 'off'\n \n # Clear \"Publish Only the Main WAN Connection\"\n # Do nothing.\n self.msg(rule_name,:info,'Publish Only the Main WAN Connection',info['Publish Only the Main WAN Connection'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Publish Only the Main WAN Connection\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Publish All WAN Connections\"\n if info.has_key?('Publish All WAN Connections')\n \n case info['Publish All WAN Connections']\n \n when 'on'\n \n # Set \"Publish All WAN Connections\"\n @ff.select_list(:name,'wan_conns_to_publish').select_value(\"1\")\n self.msg(rule_name,:info,'Publish All WAN Connections',info['Publish All WAN Connections'])\n \n when 'off'\n \n # Clear \"Publish All WAN Connections\"\n # Do nothing.\n self.msg(rule_name,:info,'Publish All WAN Connections',info['Publish All WAN Connections'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'','Did NOT find the value in \\'Publish All WAN Connections\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # Apply for the change.\n @ff.link(:text,'Apply').click\n self.msg(rule_name,:info,'Universal Plug and Play','SUCCESS')\n \n end",
"def set_all_tests_as_control\n UiChanged::Screenshot.set_all_tests_as_controls\n head :ok\n end",
"def test_scm_st_011\n printf \"\\n Test 011\"\n open_periodical_analysis_setting_tab\n assert is_text_present($display_scm[\"analysis_field\"])\n assert is_element_present($display_scm_xpath[\"qac\"])\n assert is_element_present($display_scm_xpath[\"qacpp\"])\n assert is_text_present(\"QAC\")\n assert is_text_present(\"QAC++\")\n logout\n end",
"def test_speak_none\n style = \"#speak-none-local,\n #speak-none-inherit,\n #speak-none-local-ignore,\n #speak-none-inherit-ignore {\n speak: none;\n }\"\n html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n \"<!DOCTYPE html>\n <html>\n <head>\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <span id=\\\"speak-none-local\\\">Not speak this text.</span>\n <div id=\\\"speak-none-inherit\\\">\n Not speak <strong>this text.</strong>\n </div>\n <span id=\\\"speak-none-local-ignore\\\" #{DATA_IGNORE}>\n Not speak this text.\n </span>\n <div id=\\\"speak-none-inherit-ignore\\\" #{DATA_IGNORE}>\n Not speak <strong>this text.</strong>\n </div>\n </body>\n </html>\"\n )\n css_parser = Hatemile::Util::Css::Rcp::RCPParser.new(style)\n css = Hatemile::Implementation::AccessibleCSSImplementation.new(\n html_parser,\n css_parser,\n @configure\n )\n css.provide_all_speak_properties\n speak_none_local = html_parser.find('#speak-none-local').first_result\n speak_none_inherit = html_parser.find('#speak-none-inherit').first_result\n speak_none_local_ignore = html_parser.find(\n '#speak-none-local-ignore'\n ).first_result\n\n assert(speak_none_local.has_attribute?('role'))\n assert_equal('presentation', speak_none_local.get_attribute('role'))\n assert(speak_none_local.has_attribute?('aria-hidden'))\n assert_equal('true', speak_none_local.get_attribute('aria-hidden'))\n\n speak_none_inherit.get_children_elements.each do |child|\n assert(child.has_attribute?('role'))\n assert_equal('presentation', child.get_attribute('role'))\n assert(child.has_attribute?('aria-hidden'))\n assert_equal('true', child.get_attribute('aria-hidden'))\n end\n\n assert(!speak_none_local_ignore.has_attribute?('role'))\n assert(!speak_none_local_ignore.has_attribute?('aria-hidden'))\n assert_nil(\n html_parser.find('#speak-none-inherit-ignore [role]').first_result\n )\n assert_nil(\n html_parser.find('#speak-none-inherit-ignore [aria-hidden]').first_result\n )\n end",
"def setup_before_each_scenario(url)\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n # Some of the stuff in this method would be a more natural fit in the after(:each) but\n # we can't use after(:each) for browser-based clean up at this time because it iterferes\n # with the automatic snapshots.\n ensure_only_one_browser_window_open\n open(url)\n wait_for_landing_page_load\n $tracer.trace(\"URL: #{url_data.full_url}\")\n\n store_build_file_info\n\n=begin\n # TODO: SKIP RIGHT NOW SINCE LOGIN ISSUE ON MOBILE SITE\n # login unless already logged in\n unless (timeout(5000).log_out_link.exists)\n log_in_link.click\n log_into_my_account_button.click #bob\n log_in(account_login_parameter, account_password_parameter)\n end\n\n # empty logged in user cart\n empty_cart\n log_out_link.click\n=end\n\n # empty guest cart\n empty_cart\n\n end",
"def ios_getEpisodeToPlay(client)\n\t\tbegin\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.HamburgerButton']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='洋画' and ./parent::*[@class='UITableViewCellContentView']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UIImageView' and @height>0 and ./parent::*[@accessibilityLabel='button search']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='タイトルとの一致']\") == true || client.isElementFound(\"NATIVE\", \"xpath=//*[@accessibilityLabel='戻る' and ./preceding-sibling::*[@accessibilityLabel='']]\") == true\n\t\t\t\t$obj_gener.icheckSearchField(client)\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"text=海外ドラマ一覧\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=すべての作品\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=見放題\", 0, 1)\n\t\t\tclient.sleep(3000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UIView' and @height>0 and ./parent::*[@class='UNextMobile_Protected.ThumbPlayButton']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.swipe2(\"Down\", 500, 2000)\n\t\t\tclient.sleep(3000)\n\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='エピソードを選択']\")\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='エピソードを選択']\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.PlayingStateView' and @width>0 and ./parent::*[./parent::*[@class='UNextMobile_Protected.ThumbPlayButton']]]\", 0, 1)\n\t\t\t\tclient.sleep(10000)\n\t\t\t\tHistoryPlay.new.ios_playbackCheckFromList(client)\n\t\t\t\tHistoryPlay.new.ios_leavingPlayer(client)\n\t\t\telse\n\t\t\t\tputs \"::MSG:: This contents does not have episode list!!!\"\n\t\t\tend\t\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityLabel='戻る' and ./preceding-sibling::*[@accessibilityLabel='エピソード']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UIImageView' and @height>0 and ./parent::*[@accessibilityLabel='main nav close']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityLabel='戻る' and ./preceding-sibling::*[@class='UNextMobile_Protected.UNTitleListHeaderView']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityLabel='戻る' and ./preceding-sibling::*[@accessibilityLabel='']]\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UIControl']\", 0, 1)\t\t\n\t\trescue Exception => e\n\t\t\t$errMsgTanwa = \"::MSG:: Exception occurrred while finding ELEMENT\" + e.message\n\t\tend\t\t\n\tend",
"def check_profile_attributes_match\n wait_for { displayed?(TITLES) }\n titles_array = get_array(TITLES)\n # @@n variable is a random integer that is used as index for selecting only one of the titles elements array\n @@n = rand(0...9)\n log \"STEP 9: Click on random freelancer's title.\"\n # For scrolling the page to the randomly selected title element it uses javascript executor instead of actions\n execute_script_on_element \"arguments[0].scrollIntoView(true);\", titles_array[@@n.to_i]\n # This fixed explicit sleep ensures reliability after scrolling and clicking on the element\n sleep 5\n log \"STEP 10: Get into that freelancer's profile (by clicking on desired Freelancer's title).\"\n # Following the same logic and strategy for scrolling, we use again this method for click\n execute_script_on_element \"arguments[0].click();\", titles_array[@@n.to_i]\n\n # After clicking on the freelancer's title we wait until the slide window is open and freelancer profile elements are present\n wait_for { displayed?(DESCRIPTION) }\n description = text_of(DESCRIPTION)\n log \"STEP 11: Check that each attribute value is equal to one of those stored in the structure created in STEPS 7 and 8.\"\n log \"STEP 12: Check whether at least one attribute contains #{$keyword}.\"\n\n if (description.to_s.eql? @@array[@@n.to_i][:description].to_s)\n $test_result = false\n error \"ERROR!!! => Description differs between profiles search results and freelancer profile for #{@@array[@@n.to_i][:name].to_s}.\"\n end\n wait_for { displayed?(TITLE) }\n description = text_of(TITLE)\n if (description.to_s.eql? @@array[@@n.to_i][:description].to_s)\n $test_result = false\n error \"ERROR: Title differs between profiles search results and freelancer profile for #{@@array[@@n.to_i][:name].to_s}.\"\n end\n end",
"def test_valley_smoketest\n @driver.get(@base_url)\n verify_home_page()\n verify_services_page()\n verify_about_page()\n verify_contact_page()\n verify_faq_page()\n verify_links_page()\n end",
"def auth_workarounds()\n # if(@configuration['Brand'].downcase.include?('proactiv') && @report.url.include?('.grdev.'))\n # Rails.logger.info 'working around auth popups'\n # env = @report.url.scan(/.proactiv.([^.]+)/).first.first\n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@proactiv.#{env}.dw.grdev.com\" \n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@proactiv.#{env}.dw.grdev.com/on/demandware.store/Sites-Proactiv-Site/default/RedirectURL-Hostname\"\n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@original.proactiv.#{env}.dw.grdev.com\"\n # @page.browser.driver.browser.get \"https://storefront:Grcweb123@mypa.proactiv.#{env}.dw.grdev.com\"\n # @page.browser.driver.browser.get \"http://storefront:Grcweb123@mypa.proactiv.#{env}.dw.grdev.com/on/demandware.store\"\n # end\n\n if(@configuration['Brand'].downcase == 'crepeerase' && @report.url.include?('.grdev.'))\n env = @report.url.scan(/.crepeerase.([^.]+)/).first.first\n @page.browser.driver.browser.get \"https://storefront:Grcweb123@www.crepeerase.#{env}.dw2.grdev.com\"\n end\n\n if(@configuration['Brand'] == 'MeaningfulBeauty' && @report.url.include?('.qa.'))\n Rails.logger.info 'working around auth popups'\n @page.browser.driver.browser.get \"https://storefront:Grcweb123@catalog-meaningfulbeauty.stg01.dw.grdev.com\"\n end\n end",
"def setup \n @playground = PlayGround.new\n @playground.create_browser('firefox')\n @playground.set_implicit_wait(30)\n end",
"def initialize\n @driver = $driver\n @action_button = '//*[@id=\"checkbox-example\"]/button'\n @alet_message = 'message'\n end",
"def test_inventory_control_enabled\n setup_inventory_control()\n assert Preference.find_by_name('store_use_inventory_control').update_attribute('value', 1)\n get :show, :id => @product.code\n assert_response :success\n assert_select \"h3#out_of_stock\"\n end",
"def global_filter; end",
"def test_05\n prepare_web_application\n assert_equal(200, Alfa::WebApplication.call({'PATH_INFO'=>'/frontend_only'})[0]) # defined in frontend/DefaultController\n assert_equal(404, Alfa::WebApplication.call({'PATH_INFO'=>'/admin/frontend_only'})[0]) # not defined in admin/DefaultController\n end",
"def te_st_DOL_016_Access_SupportHome\r\n\r\n sTestCase_Name = \"test_DOL_016_Access_SupportHome\"\r\n sPageName = \"Support Home\"\r\n puts2(\"\")\r\n puts2(\"Starting Testcase: #{sTestCase_Name}\")\r\n\r\n # Continue since prior test cases have passed\r\n if(@@bContinue == true)\r\n #@@bContinue = false # Clear flag since this test has NOT passed yet\r\n\r\n begin # Access Validation DOL page: Support Home\r\n\r\n puts2(\"\\t Get the identifiers of the current window...\")\r\n sMainWindowTitle = $browser.title\r\n sMainWindowURL = $browser.url\r\n puts2(\"\\t sMainWindowTitle: '\" + sMainWindowTitle + \"'\")\r\n puts2(\"\\t sMainWindowURL: \" + sMainWindowURL)\r\n if($browser.is_ie? == true)\r\n iMainWindowHWND = $browser.hwnd() # Not supported in FireWatir\r\n puts2(\"\\t iMainWindowHWND \" + iMainWindowHWND.to_s)\r\n end\r\n\r\n=begin\r\n ################## Support Home ##################\r\n=end\r\n\r\n # Capture time before navigating to next page\r\n tPageLoadTime = Time.now\r\n\r\n puts2(\"Accessing page - \" + sPageName)\r\n assert($browser.access_quicklink_Help?())\r\n\r\n puts2(\"\\t Attach to the new window...\")\r\n\r\n # Secondary window\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).use do\r\n\r\n $browser.wait_until_status(\"Done\")\r\n\r\n # Calculate and record the elapsed time for the current test case\r\n puts2(\"\\t Page load time - \" + sPageName + \", \" + calc_elapsed_time(tPageLoadTime, false))\r\n puts2(\"\\t Url - \" + sPageName + \" : \"+ $browser.url)\r\n puts2(\"\\t Title - \" + sPageName + \" : \"+ $browser.title)\r\n\r\n sActualSecondaryBrowserUrl = $browser.url\r\n sExpectedSecondaryBrowserUrl = EXTERNAL_SITE_URL[\"SupportHome\"]\r\n\r\n puts2(\"\\t Validating on the page: \" + sPageName)\r\n if(sExpectedSecondaryBrowserUrl != sActualSecondaryBrowserUrl)\r\n raise(\"*** URL's don't match. \\n\\t Expected: \" + sExpectedSecondaryBrowserUrl + \"\\n\\t Actual: \" + sActualSecondaryBrowserUrl)\r\n else\r\n assert($browser.isPage_dishonline_SupportHome?()== true)\r\n end\r\n\r\n puts2(\"Close the second window...\")\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).close\r\n\r\n end # Secondary window\r\n\r\n puts2(\"Back to the main window...\")\r\n puts2(\"\\t Current browser Url: \" + $browser.url.to_s)\r\n puts2(\"\\t Current browser Title: \" + $browser.title.to_s)\r\n\r\n puts2(\"\\t Validating on the page: Home\")\r\n assert($browser.isPage_dishonline_Home?() == true)\r\n\r\n\r\n rescue => e\r\n\r\n puts2(\"*** ERROR Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"), \"ERROR\")\r\n\r\n puts2(\"\")\r\n puts2(\"\\t Current Url - : \"+ $browser.url)\r\n puts2(\"\\t Current Title - : \"+ $browser.title)\r\n #$browser.save_screencapture(\"Dish\" + sPageName , false) # Save the desktop\r\n $browser.save_html(\"Dish\" + sPageName)\r\n\r\n #$browser.generate_testcode_html_tag_counts()\r\n #$browser.generate_testcode_html_tag_attributes()\r\n\r\n raise(\"*** TESTCASE - #{sTestCase_Name}\")\r\n\r\n ensure\r\n\r\n #@@bContinue = true # Set flag since testcase passed\r\n\r\n # Set the flag to close the $browser after the last test case runs\r\n #@@bCloseBrowser = true\r\n\r\n\r\n end # Access Validation DOL page: Support Home\r\n\r\n end # Continue since prior test cases have passed\r\n\r\nend",
"def test_024\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n #The directory/file names which were being changed into the state\n #where it does not check at the information dialog\n #which clicks analyze_deny_files and comes out are enumerated.\n\n click $xpath[\"task\"][\"analyze_deny_files\"]\n sleep 3\n\n assert is_text_present(\"sample_c/Makefile\")\n\n\n # logout\n logout\n\n end",
"def setup\n # Do nothing\n @driver = Selenium::WebDriver.for :firefox\n @driver.manage.window.maximize\n @driver.manage.timeouts.implicit_wait = 10\n @wait = Selenium::WebDriver::Wait.new :timeout => 10\n @verification_errors = []\n @baseURL = 'http://www.aci.aero/'\n end",
"def test_023\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n #The directory/file names which were being changed into the check state\n #at the information dialog which clicks analyze_allow_files\n #and comes out are enumerated.\n click $xpath[\"task\"][\"analyze_allow_file_link\"]\n sleep 3\n\n assert !is_text_present(\"sample_c/Makefile\")\n\n # logout\n logout\n\n end",
"def verify_aud; end",
"def verify_aud; end",
"def test_010\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_011\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def bench_filters\n skip 'TODO'\n end",
"def test_013\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Maximize window\n click window_id + \"_maximize\"\n\n sleep 3\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def two_player_mode\nend",
"def test_report_browser_status\n self.request = TestRequest.new(\n :method => :get,\n :request_uri => '/foo/bar?var=val'\n )\n self.session = {}\n\n @session_working = false\n @js = false\n str = report_browser_status\n assert_equal(nil, str)\n\n @session_working = true\n @js = false\n str = report_browser_status\n assert(str.match(/<script/))\n\n @js = true\n str = report_browser_status\n assert(str.match(/<noscript/))\n\n session[:js_override] = :off\n str = report_browser_status\n assert_equal(nil, str)\n end",
"def test_014\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Maximize window\n click window_id + \"_close\"\n\n sleep 3\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def check_capabilities(filter)\n capabilities = ddl.discovery_interface[:capabilities]\n\n unless capabilities.include?(:classes)\n raise \"Cannot use class filters while using the '%s' discovery method\" % discovery_method unless filter[\"cf_class\"].empty?\n end\n\n unless capabilities.include?(:facts)\n raise \"Cannot use fact filters while using the '%s' discovery method\" % discovery_method unless filter[\"fact\"].empty?\n end\n\n unless capabilities.include?(:identity)\n raise \"Cannot use identity filters while using the '%s' discovery method\" % discovery_method unless filter[\"identity\"].empty?\n end\n\n unless capabilities.include?(:compound)\n raise \"Cannot use compound filters while using the '%s' discovery method\" % discovery_method unless filter[\"compound\"].empty?\n end\n end",
"def clickOnSpeakers()\n el= @driver.find_element(:css, \"a.x-btn-speakers\")\n el.click\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until { @driver.find_element(:css => \"span.speaker-tag\").displayed? }\n end",
"def test_00090_homepage_open_q_conv_link\n @browser.wait_until { @home_page.open_questions_widget.present? }\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify the title link would redirect to conversation page.\n q_title = @home_page.open_questions_widget.posts[0].title\n @home_page.open_questions_widget.posts[0].click_title_link\n @browser.wait_until { @convdetail_page.conv_detail.present? }\n assert_equal @convdetail_page.conv_title.when_present.text, q_title, \"title doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify avatar link would redirect to profile page\n @home_page.open_questions_widget.posts[0].click_avatar\n @browser.wait_until { @profile_page.profile_page.present? }\n author_name = @profile_page.profile_page_author_name_betaon.when_present.text\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify author link would redirect to profile page\n @home_page.open_questions_widget.posts[0].click_author_link\n @browser.wait_until { @profile_page.profile_page.present? }\n assert_equal @profile_page.profile_page_author_name_betaon.when_present.text, author_name, \"Author doesn't match\"\n\n @home_page.navigate_in\n @browser.wait_until { @home_page.open_questions_widget.posts.size > 0 }\n\n # verify topic link would redirect to the correct topic page\n post_in_topic = @home_page.open_questions_widget.posts[0].in_topic_link.when_present.text\n\n @home_page.open_questions_widget.posts[0].click_topic_link\n @browser.wait_until { @topicdetail_page.topic_filter.present? }\n assert_equal @topicdetail_page.topic_title.when_present.text, post_in_topic, \"Title doesn't match\"\n end",
"def testing\n # ...\n end",
"def iframes; end",
"def _before_all # :nodoc:\n #: prints Benchmarker.platform().\n print Benchmarker.platform()\n end",
"def test_on_current_browsers\n for current_browser in CURRENT_BROWSERS\n @request.user_agent = current_browser\n get :index\n assert_response :success\n assert_select 'img[src*=painless_test.png]'\n end\n end",
"def check_room_form\n has_element(\"input#bigbluebutton_room_name\",\n { :name => 'bigbluebutton_room[name]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_meetingid\",\n { :name => 'bigbluebutton_room[meetingid]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_private\",\n { :name => 'bigbluebutton_room[private]', :type => 'checkbox' })\n has_element(\"input#bigbluebutton_room_attendee_key\",\n { :name => 'bigbluebutton_room[attendee_key]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_moderator_key\",\n { :name => 'bigbluebutton_room[moderator_key]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_welcome_msg\",\n { :name => 'bigbluebutton_room[welcome_msg]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_logout_url\",\n { :name => 'bigbluebutton_room[logout_url]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_dial_number\",\n { :name => 'bigbluebutton_room[dial_number]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_max_participants\",\n { :name => 'bigbluebutton_room[max_participants]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_external\",\n { :name => 'bigbluebutton_room[external]', :type => 'checkbox' })\n has_element(\"input#bigbluebutton_room_slug\",\n { :name => 'bigbluebutton_room[slug]', :type => 'text' })\n has_element(\"input#bigbluebutton_room_voice_bridge\",\n { :name => 'bigbluebutton_room[voice_bridge]', :type => 'text' })\n has_element(\"label\", { :for => 'bigbluebutton_room_name' })\n has_element(\"label\", { :for => 'bigbluebutton_room_meetingid' })\n has_element(\"label\", { :for => 'bigbluebutton_room_private' })\n has_element(\"label\", { :for => 'bigbluebutton_room_attendee_key' })\n has_element(\"label\", { :for => 'bigbluebutton_room_moderator_key' })\n has_element(\"label\", { :for => 'bigbluebutton_room_welcome_msg' })\n has_element(\"label\", { :for => 'bigbluebutton_room_logout_url' })\n has_element(\"label\", { :for => 'bigbluebutton_room_dial_number' })\n has_element(\"label\", { :for => 'bigbluebutton_room_max_participants' })\n has_element(\"label\", { :for => 'bigbluebutton_room_external' })\n has_element(\"label\", { :for => 'bigbluebutton_room_slug' })\n has_element(\"label\", { :for => 'bigbluebutton_room_voice_bridge' })\n has_element(\"input\", { :name => 'commit', :type => 'submit' })\n end",
"def validate_video_element(video_doc, video_options)\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:gallery_loc').text).to eq(video_options[:gallery_loc])\n expect(video_doc.at_xpath('video:gallery_loc').attribute('title').text).to eq(video_options[:gallery_title])\n expect(video_doc.at_xpath('video:title').text).to eq(video_options[:title])\n expect(video_doc.at_xpath('video:view_count').text).to eq(video_options[:view_count].to_s)\n expect(video_doc.at_xpath('video:duration').text).to eq(video_options[:duration].to_s)\n expect(video_doc.at_xpath('video:rating').text).to eq('%0.1f' % video_options[:rating])\n expect(video_doc.at_xpath('video:content_loc').text).to eq(video_options[:content_loc])\n expect(video_doc.at_xpath('video:category').text).to eq(video_options[:category])\n expect(video_doc.xpath('video:tag').collect(&:text)).to eq(video_options[:tags])\n expect(video_doc.at_xpath('video:expiration_date').text).to eq(video_options[:expiration_date].iso8601)\n expect(video_doc.at_xpath('video:publication_date').text).to eq(video_options[:publication_date].iso8601)\n expect(video_doc.at_xpath('video:player_loc').text).to eq(video_options[:player_loc])\n expect(video_doc.at_xpath('video:player_loc').attribute('allow_embed').text).to eq(video_options[:allow_embed] ? 'yes' : 'no')\n expect(video_doc.at_xpath('video:player_loc').attribute('autoplay').text).to eq(video_options[:autoplay])\n expect(video_doc.at_xpath('video:uploader').text).to eq(video_options[:uploader])\n expect(video_doc.at_xpath('video:uploader').attribute('info').text).to eq(video_options[:uploader_info])\n expect(video_doc.at_xpath('video:price').text).to eq(video_options[:price].to_s)\n expect(video_doc.at_xpath('video:price').attribute('resolution').text).to eq(video_options[:price_resolution].to_s)\n expect(video_doc.at_xpath('video:price').attribute('type').text).to eq(video_options[:price_type].to_s)\n expect(video_doc.at_xpath('video:price').attribute('currency').text).to eq(video_options[:price_currency].to_s)\n xml_fragment_should_validate_against_schema(video_doc, 'sitemap-video', 'xmlns:video' => SitemapGenerator::SCHEMAS['video'])\n end",
"def load_preview\n @media_element_id = correct_integer?(params[:media_element_id]) ? params[:media_element_id].to_i : 0\n @media_element = MediaElement.find_by_id @media_element_id\n if !@media_element.nil? && (@media_element.is_public || @media_element.user_id == current_user.id) && @media_element.converted\n @ok = true\n @media_element.set_status current_user.id\n else\n @ok = false\n end\n end",
"def html5_noti\n \n end",
"def test_Browser_003_BrowserTypes\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_003_BrowserTypes\")\n puts2(\"#######################\")\n\n #$VERBOSE = true\n #$DEBUG = true\n\n #sAskURL = \"http://ask.com\"\n sBingURL = \"http://www.bing.com\"\n sGoogleURL = \"http://google.com\"\n #sBlankURL = \"about:blank\"\n\n # Define an empty array\n aSupportedBrowsers = []\n\n # Determine the current OS\n sCurrentOS = \"\"\n if(is_win?)\n #sCurrentOS = \"windows\"\n puts2(\"OS = Windows\")\n if(is_win?(10))\n aSupportedBrowsers = [\"Firefox\", \"Chrome\", \"Internet Explorer\", \"Edge\"]\n else\n aSupportedBrowsers = [\"Firefox\", \"Chrome\", \"Internet Explorer\"]\n end\n elsif(is_osx?)\n #sCurrentOS = \"osx\"\n puts2(\"OS = OSX\")\n aSupportedBrowsers = [\"Firefox\", \"Chrome\", \"Safari\"]\n elsif(is_linux?)\n #sCurrentOS = \"linux\"\n puts2(\"OS = Linux\")\n aSupportedBrowsers = [\"Firefox\", \"Chrome\"]\n end\n\n puts2(\"Supported browsers = \" + aSupportedBrowsers.to_s)\n\n # Loop thru each browser\n aSupportedBrowsers.each { |sBrowserName|\n\n # Start a browser\n oBrowser = start_browser(sBrowserName)\n\n #puts2(\"\\nIs a Global browser running: \" + is_global_browser_running?.to_s + \"\\n\\n\")\n\n sCurrentURL = oBrowser.url\n puts2(\"Current URL: \" + sCurrentURL)\n\n puts2(\"\\nBrowser type...\")\n puts2(\"\\tis_chrome? = \" + oBrowser.is_chrome?.to_s)\n puts2(\"\\tis_edge? = \" + oBrowser.is_edge?.to_s)\n puts2(\"\\tis_firefox? = \" + oBrowser.is_firefox?.to_s)\n puts2(\"\\tis_ie? = \" + oBrowser.is_ie?.to_s)\n puts2(\"\\tis_opera? = \" + oBrowser.is_opera?.to_s)\n puts2(\"\\tis_safari? = \" + oBrowser.is_safari?.to_s)\n\n oBrowser.display_info()\n\n # The #browser.version method is not supported for Edge\n if(oBrowser.is_edge?)\n puts2(\"SKIPPED - #browser.version method is not supported for Edge\")\n else\n sBrowserVersion = oBrowser.version.to_s\n puts2(\"Browser's full version = \" + sBrowserVersion)\n sBrowserMajorVersion = sBrowserVersion.prefix(\".\")\n puts2(\"Browser's major version = \" + sBrowserMajorVersion)\n end\n\n if(oBrowser.is_chrome?)\n puts2(\"Chrome \" + (sBrowserMajorVersion.to_i - 1).to_s + \".x browser?: \" + oBrowser.is_chrome?((sBrowserMajorVersion.to_i - 1)).to_s)\n puts2(\"Chrome \" + sBrowserMajorVersion + \".x browser?: \" + oBrowser.is_chrome?(sBrowserMajorVersion.to_i).to_s)\n puts2(\"Chrome \" + (sBrowserMajorVersion.to_i + 1).to_s + \".x browser?: \" + oBrowser.is_chrome?((sBrowserMajorVersion.to_i + 1)).to_s)\n end\n if(oBrowser.is_edge?)\n puts2(\"SKIPPED - For Edge\")\n #puts2(\"Edge \" + (sBrowserMajorVersion.to_i - 1).to_s + \".x browser?: \" + oBrowser.is_edge?((sBrowserMajorVersion.to_i - 1)).to_s)\n #puts2(\"Edge \" + sBrowserMajorVersion + \".x browser?: \" + oBrowser.is_edge?(sBrowserMajorVersion.to_i).to_s)\n #puts2(\"Edge \" + (sBrowserMajorVersion.to_i + 1).to_s + \".x browser?: \" + oBrowser.is_edge?((sBrowserMajorVersion.to_i + 1)).to_s)\n end\n if(oBrowser.is_firefox?)\n puts2(\"Firefox \" + (sBrowserMajorVersion.to_i - 1).to_s + \".x browser?: \" + oBrowser.is_firefox?((sBrowserMajorVersion.to_i - 1)).to_s)\n puts2(\"Firefox \" + sBrowserMajorVersion + \".x browser?: \" + oBrowser.is_firefox?(sBrowserMajorVersion.to_i).to_s)\n puts2(\"Firefox \" + (sBrowserMajorVersion.to_i + 1).to_s + \".x browser?: \" + oBrowser.is_firefox?((sBrowserMajorVersion.to_i + 1)).to_s)\n end\n if(oBrowser.is_ie?)\n puts2(\"IE \" + (sBrowserMajorVersion.to_i - 1).to_s + \".x browser?: \" + oBrowser.is_ie?((sBrowserMajorVersion.to_i - 1)).to_s)\n puts2(\"IE \" + sBrowserMajorVersion + \".x browser?: \" + oBrowser.is_ie?(sBrowserMajorVersion.to_i).to_s)\n puts2(\"IE \" + (sBrowserMajorVersion.to_i + 1).to_s + \".x browser?: \" + oBrowser.is_ie?((sBrowserMajorVersion.to_i + 1)).to_s)\n end\n if(oBrowser.is_opera?)\n puts2(\"Opera \" + (sBrowserMajorVersion.to_i - 1).to_s + \".x browser?: \" + oBrowser.is_opera?((sBrowserMajorVersion.to_i - 1)).to_s)\n puts2(\"Opera \" + sBrowserMajorVersion + \".x browser?: \" + oBrowser.is_opera?(sBrowserMajorVersion.to_i).to_s)\n puts2(\"Opera \" + (sBrowserMajorVersion.to_i + 1).to_s + \".x browser?: \" + oBrowser.is_opera?((sBrowserMajorVersion.to_i + 1)).to_s)\n end\n if(oBrowser.is_safari?)\n puts2(\"Safari \" + (sBrowserMajorVersion.to_i - 1).to_s + \".x browser?: \" + oBrowser.is_safari?((sBrowserMajorVersion.to_i - 1)).to_s)\n puts2(\"Safari \" + sBrowserMajorVersion + \".x browser?: \" + oBrowser.is_safari?(sBrowserMajorVersion.to_i).to_s)\n puts2(\"Safari \" + (sBrowserMajorVersion.to_i + 1).to_s + \".x browser?: \" + oBrowser.is_safari?((sBrowserMajorVersion.to_i + 1)).to_s)\n end\n\n # Access a URL\n puts2(\"\\nBrowser - Set URL = \" + sBingURL)\n oBrowser.goto(sBingURL)\n sleep(10) # Placeholder delay to figure out why a new IE fails at this point, and what can be waited on.\n puts2(\"\\tURL = \" + oBrowser.url)\n puts2(\"\\tBrowser name = \" + oBrowser.name.to_s)\n\n puts2(\"Misc. browser methods...\")\n puts2(\"\\tBrowser status = '\" + oBrowser.status.to_s + \"'\")\n puts2(\"\\tBrowser ready_state = \" + oBrowser.ready_state.to_s)\n puts2(\"\\tWindow current = \" + oBrowser.window.current?.to_s)\n puts2(\"\\tBrowse refresh...\")\n oBrowser.refresh\n\n # Start with browser in it's current size\n puts2(\"\\tBrowser is at it's initial size & position\")\n oBrowser.display_info()\n\n puts2(\"\\nMaximize browser\")\n oBrowser.window.maximize\n oBrowser.display_info()\n\n puts2(\"Resize the window to 640x480\")\n oBrowser.window.resize_to(640,480)\n oBrowser.display_info()\n\n puts2(\"Move the window to 100x100\")\n oBrowser.window.move_to(100,100)\n oBrowser.display_info()\n\n iWindowWidth = 1024\n puts2(\"Resize the window to its max height but specified width (\" + iWindowWidth.to_s + \")\")\n oBrowser.window.move_to(100,10) # w,h\n oBrowser.display_info()\n\n puts2(\"Maximize window...\")\n oBrowser.window.maximize\n oBrowser.display_info()\n\n puts2(\"Max height & specified width...\")\n iHeight = oBrowser.window.size.height\n oBrowser.window.resize_to(iWindowWidth,iHeight)\n oBrowser.display_info()\n\n puts2(\"\\nLoad a different URL \" + sGoogleURL)\n oBrowser.goto(sGoogleURL)\n puts(\"\\tURL = \" + oBrowser.url)\n puts(\"\\tTitle = \" + oBrowser.title)\n\n puts2(\"Use the browser's 'back' button...\")\n if(oBrowser.is_safari?)\n puts2(\"\\tSKIPPED - Safari Browser's back operation not supported.\")\n oBrowser.goto(sBingURL)\n sleep(1)\n else\n oBrowser.back\n puts(\"\\tURL = \" + oBrowser.url)\n puts(\"\\tTitle = \" + oBrowser.title)\n end\n\n puts2(\"Use the browser's 'forward' button...\")\n if(oBrowser.is_safari?)\n puts2(\"\\tSKIPPED - Safari Browser's forward operation not supported.\")\n oBrowser.goto(sGoogleURL)\n sleep(1)\n else\n oBrowser.forward\n puts(\"\\tURL = \" + oBrowser.url)\n puts(\"\\tTitle = \" + oBrowser.title)\n end\n\n puts2(\"Focus the cursor on 1st div...\")\n oBrowser.div(:id, \"searchform\").focus\n sleep(1)\n\n puts2(\"Hover the cursor on 1st div...\")\n if(oBrowser.is_safari?)\n puts2(\"\\tSKIPPED - Safari Browser does not appear to support hover\")\n else\n oBrowser.div(:id, \"searchform\").hover\n sleep(1)\n end\n\n puts2(\"Click the cursor on 1st div...\")\n oBrowser.div(:id, \"searchform\").click\n sleep(1)\n\n puts2(\"\\nAbout to close the current browser\")\n puts2(\"\\tDoes browser exist? = \" + oBrowser.exists?.to_s)\n puts2(\"\\tDoes window exist? = \" + oBrowser.window.exists?.to_s)\n puts2(\"Close the browser...\")\n oBrowser.close\n puts2(\" Does browser exist? = \" + oBrowser.exists?.to_s)\n #puts2(\" Does window exist? = \" + oBrowser.window.exists?.to_s) # Can't check on window if its closed.\n\n puts2(\"\\n##### Next browser...\")\n\n } # END - Loop thru each browser\n\n rescue => e\n\n puts2(\"*** ERROR and Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"), \"ERROR\")\n\n if(oBrowser.exists? == true)\n oBrowser.display_info()\n else\n puts(\"No existing browser found\")\n end\n\n # Force any open browsers to exit\n kill_browsers()\n\n # Raise the error with a custom message after the rest of the rescue actions\n raise(\"*** TESTCASE - test_Browser_003_LocalBrowsers\")\n\n ensure\n\n #end # Start browser types\n\n end",
"def test_scm_st_043\n printf \"\\n Test 043\"\n open_periodical_analysis_setting_tab\n type($display_scm_xpath[\"user_field\"], \"sample\")\n type($display_scm_xpath[\"url_field\"], \"sample\")\n click $display_scm_xpath[\"clear_button\"]\n sleep SLEEP_TIME\n assert_equal \"\", get_value($display_scm_xpath[\"user_field\"])\n assert_equal \"\", get_value($display_scm_xpath[\"url_field\"])\n logout\n end"
] | [
"0.56154615",
"0.5464052",
"0.54391384",
"0.53845745",
"0.5375689",
"0.5348216",
"0.5299415",
"0.52725124",
"0.5262615",
"0.5251521",
"0.5251047",
"0.52241135",
"0.51914674",
"0.51686305",
"0.51580733",
"0.51398253",
"0.5126495",
"0.51260114",
"0.51169014",
"0.51077414",
"0.50990385",
"0.508858",
"0.5075253",
"0.5049441",
"0.5035435",
"0.5000893",
"0.49992085",
"0.49910367",
"0.49904972",
"0.4990161",
"0.4981034",
"0.4975892",
"0.49728444",
"0.49715742",
"0.49699292",
"0.49596336",
"0.49546963",
"0.49541354",
"0.49470288",
"0.49330747",
"0.49249333",
"0.49192315",
"0.49182397",
"0.49167296",
"0.4910406",
"0.4909033",
"0.48997185",
"0.48949787",
"0.4893059",
"0.4889058",
"0.4879465",
"0.48776057",
"0.48767588",
"0.48633015",
"0.48625112",
"0.48502162",
"0.48497364",
"0.48469242",
"0.48445305",
"0.4831839",
"0.4824121",
"0.48210686",
"0.4816436",
"0.48116967",
"0.48082972",
"0.48044503",
"0.48038357",
"0.48037514",
"0.48033425",
"0.4796824",
"0.4795975",
"0.47950682",
"0.47895455",
"0.47791347",
"0.47730476",
"0.4772861",
"0.4772289",
"0.47685665",
"0.4764637",
"0.4764637",
"0.4760181",
"0.47516832",
"0.4751538",
"0.47511542",
"0.47471425",
"0.474636",
"0.47462043",
"0.47456065",
"0.47417796",
"0.4740798",
"0.4733931",
"0.47281724",
"0.47272307",
"0.47266388",
"0.47184053",
"0.47171348",
"0.47150216",
"0.47128528",
"0.47120726",
"0.4707627"
] | 0.6196123 | 0 |
Description Main page of the section 'elements'. When it's called via ajax it's because of the application of filters, paginations, or after an operation that changed the number of items in the page. Mode Html + Ajax Specific filters ApplicationControllerinitialize_layout MediaElementsControllerinitialize_paginator | def index
get_own_media_elements
if @page > @pages_amount && @pages_amount != 0
@page = @pages_amount
get_own_media_elements
end
render_js_or_html_index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @page_elements = @page.page_elements\n if (@page)\n @mainelements = @page.page_elements.where(visible: true,sidebar: false)\n @sidebarelements = @page.page_elements.where(visible:true,sidebar: true)\n end\n if(@mainelemnents) && (@mainelements.count > 1)\n @mainelements = @mainelements.sort_by{ |x| x[:displayIndex]}\n end\n @poster = @council.posts\n @rest = @page.page_elements.where(visible: false)\n end",
"def index\n\t @robot_img = 'http://www.bia.or.th/en/images/photo/08dec.jpg'\n\t @title = 'Articles - Suan Mokkh'\n\t # @featured_books = Book.includes(:authors, :groups, :languages).where(featured: true, draft: false).order('created_at DESC').limit(10)\n\t # @recommended_books = Book.includes(:authors).where(recommended: true, draft: false).order('created_at DESC').limit(15)\n\t @filterrific = initialize_filterrific(\n\t Article,\n\t params[:filterrific],\n\t :select_options => {\n\t with_language_id: Language.options_for_select,\n\t with_author_id: Author.options_for_select,\n\t with_series: Article.options_for_series,\n\t },\n\t # default_filter_params: [],\n\t # persistence_id: 'shared_key',\n\t # available_filters: [],\n\t ) or return\n\t @articles = @filterrific.find.page(params[:page]).where(draft: false)\n\n\t respond_to do |format|\n\t format.html\n\t format.js\n\t end\n\tend",
"def initialize_paginator\n @page = correct_integer?(params[:page]) ? params[:page].to_i : 1\n @display = [MediaElement::DISPLAY_MODES[:compact], MediaElement::DISPLAY_MODES[:expanded]].include?(params[:display]) ? params[:display] : MediaElement::DISPLAY_MODES[:expanded]\n if @display == MediaElement::DISPLAY_MODES[:expanded]\n @for_row = correct_integer?(params[:for_row]) ? params[:for_row].to_i : 1\n @for_row = 1 if @for_row > 50\n @for_page = @for_row * 2\n else\n @for_page = FOR_PAGE\n end\n @filter = params[:filter]\n @filter = Filters::ALL_MEDIA_ELEMENTS if !Filters::MEDIA_ELEMENTS_SET.include?(@filter)\n @just_resizing = params[:resizing].present?\n end",
"def advance_search \n if params[:entity_type]==\"static-fragment\"\n @page_properties={:selected_menu=>'static_fragment',:menu_title=>'Static Fragment List'}\n else\n @page_properties={:selected_menu=>'static_articles',:menu_title=>'Static Page List'}\n end \n @search=true \n @search_data=SearchData.new(params[:search_data]) if params[:search_data] \n @article_path=\"static_page\" \n @selected_section=@site.static_sections.find(params[:search_data][:section_id]) if params[:search_data] and params[:search_data][:section_id]!=\"\"\n session[:per_page]=params[:per_page] if params[:per_page]!=nil\n sort_init \"updated_at\"\n sort_update\n respond_to do |format|\n format.html do \n render :action=>\"index\" ,:entity_type => params[:entity_type]\n end\n format.js do\n render :update do |page| \n page.replace_html 'article_list',component_table_list(@site.find_component_by_name(\"static_article_search\"))\n end\n end\n end \n end",
"def page\n @data_management_plans = paginate_response(results: search_filter_and_sort)\n render layout: false\n end",
"def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end",
"def index\n #@articles = Article.all\n # @article = Article.friendly.find(params[:id])\n # impressionist(@article)\n @articleOrder = Article.article_order(params[:page])\n # @jasonObject = render json: @articleOrder\n # puts JSON.pretty_generate(@articleOrder)\n if params[:tag]\n @articles = Article.tagged_with(params[:tag])\n else\n @articles = Article.order('created_at DESC').paginate(page: params[:page], :per_page => 4)\n end\n # @articles = Article.order('created_at DESC').paginate(page: params[:page], :per_page => 4)\n # all.page(params[:page]).per(4)\n @articles_corousal = Article.all\n # use scope\n @article_paginate = Article.paginate(page: params[:page], :per_page => 4)\n @widgetArticle = Article.widget_article(params[:page])\n \n end",
"def index\n #p = logged_in? ? logged_in_person : nil\n per_page = 12\n conditions = []\n condition_vars = {}\n if params[:title] and params[:title] != ''\n conditions.push(\"lower(title) like :title\")\n condition_vars[:title] =\"%#{params[:title].downcase}%\"\n end\n find_conditions = [conditions.join(\" and \"), condition_vars]\n permitted_questionnaires = Questionnaire.all(:conditions => find_conditions, :order => 'id DESC')\n pager = ::Paginator.new(permitted_questionnaires.size, per_page) do |offset, pp|\n permitted_questionnaires[offset, pp]\n end\n @questionnaires = returning WillPaginate::Collection.new(params[:page] || 1, per_page, permitted_questionnaires.size) do |paginator|\n paginator.replace pager.page(params[:page]).items\n end\n \n\n respond_to do |format|\n format.html { }\n format.js do\n render :update do |page|\n page.replace_html 'questionnaire_list', :partial => 'paged_results'\n end\n end\n end\n end",
"def show\n @page = @question_sheet.pages.find(params[:id])\n @elements = @page.elements\n\n respond_to do |format|\n format.js\n end\n end",
"def index\n block_pagination\n respond_to do |format|\n format.html {\n @action_nav = CW::ActionNav::Controller::Base.new.section('Change') {|s|\n s.link 'add show episode ordering', { :action => 'new', :type => 'HomePageBlockShowDl' }, { :title => 'Add a Show DL Episode ordered block to the home page' }\n s.link 'add show filtered ordering', { :action => 'new', :type => 'HomePageBlockFiltered' }, { :title => 'Add a block filtered by show id and order to the home page' }\n }\n render :action => 'index'\n }\n end\n end",
"def show\n @attachable_comments = Comment.order(created_at: :desc).where(\"article_id <> #{@article.id}\").paginate(page: params[:page_attach_comm], per_page: 5)\n if params[:page_attach_comm]\n render partial: 'shared/append_items', locals:\n { appendable_body: '.attachable-comments tbody', partial: 'shared/attachable_item', collection: @attachable_comments,\n item: :item, scrollable_div: '#attachable-comments-pagination .pagination', param_name: 'page_attach_comm' } and return\n end\n @attachable_articles = Article.order(created_at: :desc).paginate(page: params[:page_attach_art], per_page: 5)\n if params[:page_attach_art]\n render partial: 'shared/append_items', locals:\n { appendable_body: '.attachable-articles tbody', partial: 'shared/attachable_item', collection: @attachable_articles,\n item: :item, scrollable_div: '#attachable-articles-pagination .pagination', param_name: 'page_attach_art' } and return\n end\n @article_comments = @article.comments.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n @comment = current_user.comments.new if current_user\n @attachment = Attachment.new\n @attachments = Attachment.paginate(page: params[:page_attachment], per_page: 5)\n respond_to do |format|\n format.html\n format.js { render partial: 'shared/append_items', locals:\n { appendable_body: '.table-comments tbody', partial: 'articles/comment', collection: @article_comments,\n item: :comment, scrollable_div: '#infinite-scrolling .pagination', param_name: 'page' }\n }\n end\n end",
"def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end",
"def page_elements\n []\n end",
"def configure\n # fetching page via before filter\n if @page.redirects_to_external?\n render action: 'configure_external', layout: !request.xhr?\n else\n @page_layouts = PageLayout.layouts_with_own_for_select(@page.page_layout, session[:language_id], @page.layoutpage?)\n render layout: !request.xhr?\n end\n end",
"def partial_html_sections\n # Tell our application_helper#url_for to generate urls with hostname\n @generate_urls_with_host = true\n # Force background status to be the spinner--default js way of putting\n # spinner in does not generally work through ajax techniques.\n @force_bg_progress_spinner = true\n # Mark that we're doing a partial generation, because it might\n # matter later.\n @generating_embed_partials = true\n # Run the request if neccesary.\n self.service_dispatch()\n @user_request.save!\n self.api_render()\n end",
"def show\n @page = Page.find(params[:id])\n @page.images.build\n @description = @page.description ? @page.description : @page.body[0..150]\n \n get_sidebar(@page)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end",
"def index\n # config de layout \n @layout = Array.new()\n @layout[0] = \"produto\" # menu \n @layout[1] = \"Produtos\" # titulos \n @layout[2] = \"sloganD2\" # subtitulo_css \n @layout[3] = \"Adicionar um produto\" # subtitulo_css \n @layout[4] = \"produtos/new\" #subtitulo_url\n @layout[5] = \"produtos/search\" #busca_url\n\n # paginacao\n if params[:pag]\n @offset = params[:pag].to_i\n else\n @offset = 0\n end\n \n # criando a lista\n @adm_produtos_full = Adm::Produto.limit(20).offset(@offset).all\n\n # filtrando pela permissao do usuário os registros que ele pode ver\n if session[:usuario].status.area.codigo != '0'\n @adm_produtos = @adm_produtos_full.find_all {|p| p.status.codigo == '0' or p.status.codigo == '1' }\n else\n @adm_produtos = @adm_produtos_full\n end\n\n if @adm_produtos.length == 0 and params[:pag]\n redirect_to(adm_produtos_path, :notice => 'Não ha mais produtos')\n else\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @adm_produtos }\n end \n end\n end",
"def index\n @all_knowledgement_areas = Periodic.distinct.pluck(:knowledgement_area).compact.each(&:strip!)\n @all_qualis = Periodic.distinct.pluck(:qualis).compact.each(&:strip!)\n @periodics_count = Periodic.all.count\n\n if params[:selected_knowledgement_area] && params[:selected_qualis]\n @listage_title = 'Listagem de periódicos pesquisados'\n @periodics = find_periodic(params[:selected_knowledgement_area], params[:selected_qualis]).paginate(page: params[:page], per_page: 80).order('created_at ASC')\n @returned_results_txt = \"Total de Periódicos retornados na consulta: #{@periodics.size}\"\n else\n @listage_title = 'Listagem de todos os periódicos'\n @returned_results_txt = \"Você ainda não realizou uma filtragem na busca\"\n @periodics = Periodic.paginate(page: params[:page], per_page: 39).order('created_at ASC')\n respond_to do |format|\n format.html\n format.js\n end\n end\n end",
"def page_load; end",
"def full_page\n end",
"def kopal_layout_after_page_meta\n\n end",
"def render_pagination\n num_pages = Document.num_results.to_f / @per_page.to_f\n num_pages = Integer(num_pages.ceil)\n return '' if num_pages == 0\n\n content_tag :div, :class => 'ui-grid-c' do\n content = content_tag(:div, :class => 'ui-block-a') do\n if @page != 0\n page_link(I18n.t(:'search.index.first_button'), 0, 'back')\n end\n end\n content << content_tag(:div, :class => 'ui-block-b') do\n if @page != 0\n page_link(I18n.t(:'search.index.previous_button'), @page - 1, 'arrow-l')\n end\n end\n\n content << content_tag(:div, :class => 'ui-block-c') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.next_button'), @page + 1, 'arrow-r', true)\n end\n end\n content << content_tag(:div, :class => 'ui-block-d') do\n if @page != (num_pages - 1)\n page_link(I18n.t(:'search.index.last_button'), num_pages - 1, 'forward', true)\n end\n end\n\n content\n end\n end",
"def index\n # @posts = Post.order(created_at: :desc)\n @smalls = Post.of_small.order(created_at: :DESC).paginate(:page => params[:page], :per_page => 15)\n @covers = Post.of_cover.order(created_at: :DESC)\n @slides = Post.of_slide.order(created_at: :DESC).limit(5)\n @tops = Post.of_top.order(created_at: :DESC).limit(1)\n @reports = Post.order(created_at: :DESC)\n @bots = Post.of_bottom.order(created_at: :DESC).limit(1)\n @bigs = Post.of_big.order(created_at: :DESC).limit(1)\n @defaults = Post.of_default.paginate(page: params[:page], :per_page => 15)\n if request.xhr?\n render :partial=>\"default\"\n end\n end",
"def show\n # config de layout \n @layout = Array.new \n @layout[0] = \"produto\" \n @layout[1] = \"Ficha do Produto\" \n @layout[2] = \"slogan\" \n @layout[3] = \"COD: \" + \"%07d\" % params[:id] \n @layout[4] = \"\"\n @layout[5] = \"/adm/produtos/search\" \n \n @adm_produto = Adm::Produto.find(params[:id])\n \n # LEMBRETE\n # Para a edicao dos modelos produto_extra funcione, eh preciso \n # criar uma funcao do application_helper que possibilita ativar ou\n # não o java script que abre o form de edicao.\n # Inclusive eh tb por isso que o DIV que faz o efeito light box fica\n # criado na pagina e não dinamicamente como o de costume.\n \n # obtendo registros\n @arquivos_full = Arquivo.where(['fl_sistema = 1 AND produto_id = ?', @adm_produto.id]).all\n @adm_produto_extras_full = Adm::ProdutoExtra.where(['produto_id = ?', @adm_produto.id]).all\n \n # filtrando pela permissao do usuário os registros que ele pode ver\n if session[:usuario].status.area.codigo == '0'\n @arquivos = @arquivos_full\n @adm_produto_extras = @adm_produto_extras_full\n else\n @arquivos = @arquivos_full.find_all {|a| a.status.codigo == '0' }\n @adm_produto_extras = @adm_produto_extras_full.find_all {|p| p.status.codigo == '0' }\n end\n\n # verificando se é uma edição de Produto Extra\n if params[:id_produto_extras]\n @adm_produto_extra = Adm::ProdutoExtra.find(params[:id_produto_extras])\n else\n @adm_produto_extra = Adm::ProdutoExtra.new\n end\n \n # obtendo dados extras\n @historico = LogProduto.order(\"created_at DESC\").limit(10).where([\"produto_id = ?\", @adm_produto.id]).all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @adm_produto }\n end\n end",
"def show \n meta :title => \"Parlio - Iniciativas relacionadas con #{@topic.name}\"\n @initiatives = @topic.initiatives.paginate :per_page => 5, :page => params[:page]\n @tags = @topic.initiatives.map{|i| i.tags}.flatten.uniq\n @most_active_parliamentarians = @topic.most_active_parliamentarians\n \n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @topic }\n wants.atom { render(:layout => false) }\n end\n end",
"def pages; end",
"def set_elements\n super\n element(:message) {b.li(:class => 'uif-infoMessageItem')}\n element(:messages) {b.lis(:class => 'uif-infoMessageItem')}\n element(:message_header) {b.h3(:class => 'uif-pageValidationHeader')}\n element(:submit_button) {b.button(:id => \"submitEditor\")}\n element(:cancel_button) {b.button(:id => \"cancelEditor\")}\n element(:close_button) {b.button(:id => \"closeEditor\")}\n element(:return_to_search_button) {b.button(:id => \"returnToSearch_button\")}\n # Navigation Area Elements\n element(:delete_bib_button) {b.button(:title => 'Delete Bib')}\n element(:add_instance_button) {b.button(:title => 'Add Instance')}\n element(:add_einstance_button) {b.button(:title => 'Add EInstance')}\n # @note Vakata Context Menu items are only present on the screen after the containing menu header has been right-clicked.\n element(:delete_instance_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => \"Delete\")}\n element(:add_item_button) {b.button(:title => 'Add Item')}\n element(:delete_item_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => 'Delete')}\n end",
"def load_edit_component_page\n @all_groups = Group.all\n @all_properties = Property.all\n @all_categories = Category.all\n @all_components = Component.all\n @all_products = Product.all\n @all_images = Image.all\n @all_datafiles = DataFile.all\n @component = Component.find(params[:component_id])\n\n @component_components = @component.components\n @component_valuefields = @component.valuefields\n @component_properties = @component.properties\n @component_images = @component.images\n @component_datafiles = @component.data_files\n @component_products = @component.products\n @component_group = @component.group\n respond_to do |format|\n format.js\n end\n end",
"def kopal_layout_after_page_sidebar\n\n end",
"def set_elements\n super\n # Requisition Detail Area\n element(:license_request_checkbox) {b.checkbox(:id => \"document.licensingRequirementIndicator\")}\n element(:receiving_required_checkbox) {b.checkbox(:id => \"document.receivingDocumentRequiredIndicator\")}\n element(:payment_request_approval_required_checkbox) {b.checkbox(:id => \"document.paymentRequestPositiveApprovalIndicator\")}\n # Additional Institutional Info Tab\n element(:additional_info_tab_toggle) {b.input(:id => \"tab-AdditionalInstitutionalInfo-imageToggle\")}\n element(:additional_info_phone_number_field) {b.text_field(:id => \"document.requestorPersonPhoneNumber\")}\n # Delivery Tab\n element(:room_field) {b.text_field(:id => \"document.deliveryBuildingRoomNumber\")}\n element(:building_search_icon) {b.input(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[1]/input[1]\")}\n element(:campus_search_icon) {b.input(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[1]/input[1]\")}\n element(:delivery_phone_number_field) {b.text_field(:id => \"document.deliveryToPhoneNumber\")}\n # Vendor Tab\n element(:vendor_name_field) {b.text_field(:id => \"document.vendorName\")}\n element(:vendor_alias_field) {b.text_field(:id => 'document.vendorAliasName')}\n element(:select_vendor_button) {b.input(:alt => 'select vendor')}\n element(:vendor_search_icon) {b.input(:xpath => \"//input[@id='document.vendorName']/following-sibling::input[1]\")}\n # Titles Tab\n element(:grand_total_field) {b.b(:xpath => \"//div[@id='tab-Titles-div']/descendant::th[div[contains(text(),'Grand Total')]]/following-sibling::td/div/b\")}\n end",
"def index\n\t\t@page = params[:page].to_i\n @topics = Topic.paginate :page => @page, :per_page => 10\n\n\t\trespond_to do |format|\n format.html\n format.js do\n render :update do |page|\n page.replace_html 'topics', :partial => \"topics/list\"\n end\n end\n end\n end",
"def home \n @total = Activity.count()\n @activities_pages, @activities = paginate :activities,:per_page =>2\n if request.xml_http_request?\n render :partial => \"activities_list\", :layout => false\n \n end\n end",
"def index\n @resources=WorkFlow.page(params[:page]).per(20)\n @model_s_name=\"work_flow\"\n @model_p_name=\"work_flows\"\n respond_to do |format|\n format.xml { render :xml => @resources }\n format.js { render \"basic_setting/index\"}\n end\n end",
"def paginations(collection)\n content_tag :div, class: 'page-wrapper' do\n if collection.next_page\n will_paginate collection, renderer: BootstrapPagination::Rails\n else\n content_tag :div, \"没有更多了\", class: 'no-more'\n end\n end\n end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def show_about\n @metadata_profile = @unit.effective_metadata_profile\n @num_downloads = MonthlyUnitItemDownloadCount.sum_for_unit(unit: @unit)\n @num_submitted_items = @unit.submitted_item_count\n @collections = Collection.search.\n institution(@unit.institution).\n filter(Collection::IndexFields::PRIMARY_UNIT, @unit.id).\n order(\"#{Collection::IndexFields::TITLE}.sort\").\n limit(999)\n @subunits = Unit.search.\n institution(@unit.institution).\n parent_unit(@unit).\n order(\"#{Unit::IndexFields::TITLE}.sort\").\n limit(999)\n render partial: \"show_about_tab\"\n end",
"def kopal_layout_before_page_meta\n\n end",
"def index\n if(params[:search_article_banners])\n @article_banners = ArticleBanner.search params[:search_article_banners], :page => params[:page], :per_page => 10, :order => 'publish_date DESC'\n else\n @article_banners = ArticleBanner.paginate( :per_page => 10, :page => params[:page], :order => 'publish_date DESC' )\n end \n render 'shared/admin/index.js.erb'\n end",
"def display_selected_matter\n params[:search] ||= {} #to set params[:search] if params is nil Bug 9871\n @matters =[]\n @mode_type = params[:mode_type] #passed from the application.js to set the mode type in view\n data = params\n @matters = matter_search # Common search\n @perpage = params[:per_page].present? ? params[:per_page] : 25 # added for changing pagination limit - do not remove -- Supriya\n @matters = @matters.paginate :page => data[:page], :per_page => @perpage\n respond_to do |format|\n format.js {render :partial=> 'matter'}\n end\n end",
"def get_page\n render_page_sections_json\n end",
"def index\n\n \n @per_page = 5\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n \n\nif ( params[:search] )\n \n @paises = Paise.search( params[:search] ).limit(@per_page).skip(@skip)\n elsif ( params[:column] )\n @paises = Paise.sort( params[:column], params[:sort] ).limit(@per_page).skip(@skip)\n else\n @paises = Paise.all.limit(@per_page).skip(@skip)\n end \n \n @num_of_pages = ( @per_page.to_i > 0 ) ? ( @paises.size / @per_page.to_f ).ceil : 1\n\n\nrespond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'paises/list', :locals => { :paises => @paises }, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @paises }\n end\n end",
"def index\n @announcements = Feature.for_announcements.published.page params[:announcements]\n @activities = PublicActivity::Activity.order(\"created_at desc\").page params[:activities]\n \n \n # @all_features = Feature.homepage_list\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n format.js\n end\n end",
"def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end",
"def add_element\n @inner_page = Embeddable::InnerPage.find(params['id'])\n @page = Page.find(params['page_id'])\n @container = params['container'] || 'elements_container'\n\n # dynamically instantiate the component based on its type.\n component_class = params['class_name'].constantize\n if component_class == Embeddable::DataCollector\n if probe_type_id = session[:last_saved_probe_type_id]\n probe_type = Probe::ProbeType.find(probe_type_id)\n @component = Embeddable::DataCollector.new\n @component.probe_type = probe_type\n @component.save\n else\n @component = Embeddable::DataCollector.create\n end\n session[:last_saved_probe_type_id] = @component.probe_type_id\n else\n @component = component_class.create\n end\n @component.pages << @page\n @component.user = current_visitor\n @component.save\n @element = @page.element_for(@component)\n @element.user = current_visitor\n @element.save\n # @element.update_investigation_timestamp\n @page.reload\n if params['static']\n render :partial => \"static_page\", :locals => {:page => @page, :inner_page => @inner_page}\n else\n render :partial => \"page\", :locals => {:page => @page, :inner_page => @inner_page}\n end\n end",
"def index\n @filterrific = initialize_filterrific(\n CircPolicyMatrix,\n params[:filterrific],\n persistence_id: 'shared_key',\n select_options: {\n with_cpg_id: CircPolicyGroup.options_for_select,\n with_pg_id: PatronGroup.options_for_select,\n with_it_id: ItemType.options_for_select\n },\n ) or return\n #@circ_policy_matrices = CircPolicyMatrix.order(:circ_group_id).page params[:page]\n @circ_policy_matrices = @filterrific.find.page(params[:page])\n\n\n respond_to do |format|\n format.html\n format.js\n end \n\n end",
"def index\n respond_to do |format|\n format.html\n format.json do\n collections = Collection.where.not(published_at: nil)\n .order(published_at: :desc)\n .page(params[:page])\n .per(Collection::COLLECTION_PER)\n is_more_load = collections.total_pages > params[:page].to_i\n render json: { collections: collections, is_more_load: is_more_load }\n end\n end\n end",
"def render_index(updates)\n @updates = updates\n set_pagination\n render :index, :layout => show_layout?\n end",
"def load_page\n respond_to do |format|\n format.html do\n load_albums_page\n render '_album_rows' , layout: false\n end\n end\n end",
"def after_pagination\n end",
"def index\n @category_header = true \n @skip_bottom = true \n @top_stories_none = true \n \nif params[:tag]\n@posts = Post.where(:hide => true).tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per_page(3)\n@hidden = Post.hiddencategory.order(\"created_at desc\").tagged_with(params[:tag]) \nelse\n@toppost = Post.where(:hide => true).order(\"position\").limit(1)\n@posts = Post.where(:hide => true).order(\"position\").offset(1).limit(2)\n@homepage_answers = Question.where(:hide => true, :recommend => true).limit(1)\n\n\nend\n\nrespond_to do |format|\n format.html\n format.js\n end\nend",
"def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end",
"def index\n\n # @work_pieces = WorkPiece.all\n\n if !params[:section_id].nil? && !(params[:section_id].eql? \"0\")\n @work_pieces = WorkPiece.where(:section_id => params[:section_id]).paginate(:page => params[:page]).order('id DESC')\n @current_section_id = params[:section_id]\n else\n @work_pieces = WorkPiece.paginate(:page => params[:page]).order('id DESC')\n @current_section_id = 0\n end\n\n @sections = Section.all\n \n #flash[:notice] = \"teste\"\n\n respond_to do |format|\n format.html #index.html.erb\n format.xml { render :xml => @work_pieces }\n end\n end",
"def index\n # seeker_result Site, \"div.site_list\" # , clear_tags: true\n response_service.title = 'Sites'\n smartrender \n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def load_page\n respond_to do |format|\n format.html do\n load_artists_page\n render '_artist_rows' , layout: false\n end\n end\n end",
"def load_page\n respond_to do |format|\n format.html do\n load_artists_page\n render '_artist_rows' , layout: false\n end\n end\n end",
"def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end",
"def index\n @articles = Article.all.paginate(page: params[:page], per_page: 20)\n content_for :title, \"Articles\"\n end",
"def kopal_layout_after_page_header\n\n end",
"def index\n @admin_section = true\n #@courses = Course.paginate(:all, :per_page=>10, :page=>params[:page])\n @courses = Course.page(params[:page]).per(10) \n\n @course_category_id = \"\"\n @admin_section = true\n @page_title = \"Courses\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @courses }\n end\n end",
"def set_elements\n super\n # Search Control Elements\n element(:search_button) {b.button(:id => \"search_button\")}\n element(:clear_button) {b.button(:id => \"clear_button\")}\n element(:doc_type_bib) {b.radio(:id => 'SearchPanel-docType-Section_control_0')}\n element(:doc_type_holdings) {b.radio(:id => 'SearchPanel-docType-Section_control_1')}\n element(:doc_type_item) {b.radio(:id => 'SearchPanel-docType-Section_control_2')}\n element(:doc_type_e_holdings) {b.radio(:id => 'SearchPanel-docType-Section_control_3')}\n element(:link_to_order_button) {b.button(:id => 'submit_button')}\n element(:export_to_xml_button) {b.button(:id => 'export_button1')}\n element(:close_button) {b.button(:id => 'cancel_button')}\n # Search Fields\n element(:search_field_1) {b.text_field(:id => \"searchText_id_line0_control\")}\n element(:search_which_selector_1) {b.select_list(:id => \"operator_id_line0_control\")}\n element(:search_field_selector_1) {b.select_list(:id => \"docField_id_line0_control\")}\n element(:search_scope_1_and) {b.radio(:id => 'searchScope_id_line0_control_0')}\n element(:search_scope_1_or) {b.radio(:id => 'searchScope_id_line0_control_1')}\n element(:search_scope_1_not) {b.radio(:id => 'searchScope_id_line0_control_2')}\n element(:search_field_2) {b.text_field(:id => 'searchText_id_line1_control')}\n element(:search_which_selector_2) {b.select_list(:id => 'operator_id_line1_control')}\n element(:search_field_selector_2) {b.select_list(:id => 'docField_id_line1_control')}\n element(:search_scope_2_and) {b.radio(:id => 'searchScope_id_line1_control_0')}\n element(:search_scope_2_or) {b.radio(:id => 'searchScope_id_line1_control_1')}\n element(:search_scope_2_not) {b.radio(:id => 'searchScope_id_line1_control_2')}\n # Search Results Elements\n element(:next_link) {b.a(:text => 'Next')}\n element(:previous_link) {b.a(:text => 'Previous')}\n end",
"def index\n #@group_banners = GroupBanner.all\n\n #Sorting\n sort_init 'espositore'\n #asso number of occurrence\n sort_update 'espositore' => 'espositore',\n 'url' => 'url',\n 'priorita' => 'priorita',\n 'posizione' => 'posizione'\n\n respond_to do |format|\n #ovverride for paging format.html # index.html.erb\n format.html {\n # Paginate results\n @group_banner_count = GroupBanner.all.count\n @group_banner_pages = Paginator.new self, @group_banner_count, per_page_option, params['page']\n @group_banners = GroupBanner.find(:all,\n :order => sort_clause,\n :limit => @group_banner_pages.items_per_page,\n :offset => @group_banner_pages.current.offset)\n render :layout => !request.xhr?\n }\n format.xml { render :xml => @group_banners }\n end\n end",
"def load_new_component_page\n @parent = get_parent(params[:parent_id])\n @items_to_select = [@parent]\n @all_properties = Property.all\n @all_products = Product.all\n @all_groups = Group.all\n respond_to do |format|\n format.js\n end\n end",
"def show\n @inner_page = Embeddable::InnerPage.find(params[:id])\n @page = @inner_page.children[0]\n @teacher_mode = params['teacher_mode'] || nil\n\n if request.xhr?\n render :partial => 'show', :locals => { :inner_page => @inner_page, :sub_page => @inner_page.sub_pages.first}\n else\n respond_to do |format|\n format.html # show.html.haml\n format.otml { render :layout => \"layouts/embeddable/inner_page\"} # inner_page.otml.haml\n format.jnlp { render :partial => 'shared/installer', :locals => { :runnable => @inner_page , :teacher_mode => @teacher_mode } }\n format.config { render :partial => 'shared/show', :locals => { :runnable => @inner_page, :session_id => (params[:session] || request.env[\"rack.session.options\"][:id]) , :teacher_mode => @teacher_mode } }\n format.dynamic_otml { render :partial => 'shared/show', :locals => {:runnable => @inner_page, :teacher_mode => @teacher_mode} }\n format.xml { render :inner_page => @inner_page }\n end\n end\n end",
"def default\r\n can_view, msg = dc_user_can_view(@parent, @page)\r\n return msg unless can_view\r\n\r\n html = \"<div class=\\\"#{@page.div_class} #{@opts[:div_class]}\\\">\"\r\n html << dc_page_edit_menu() if @opts[:edit_mode] > 1\r\n @parent.page_title = @page.title.blank? ? @page.subject : @page.title\r\n html << @page.body\r\n # render poll if defined\r\n if @page.dc_poll_id\r\n @opts.merge!(poll_id: @page.dc_poll_id, return_to: @parent.request.url, method: nil)\r\n comment = DcPollRenderer.new(@parent, @opts)\r\n html << \"<div class='wrap row'>#{comment.render_html}</div>\"\r\n @css << \"\\n#{comment.render_css}\"\r\n end\r\n # also add iframe\r\n html << iframe() << '</div>'\r\nend",
"def index\n\t #@title = \"Главная\"\n\t @topSlider = true\n\t @add_functions = \"myParalaxes();\"\n\t @events = Event.where(display_area_id: ([1, 3]), occupation: 'Code Artist').order('post_date DESC').limit(5)\n\t @albums = PhotoAlbum.where(status_id: 1).order(\"created_at DESC\").limit(5)\n\t @videos = Video.all.order('created_at DESC').limit(3)\n end",
"def show\n render :partial => 'element_container', :object => @size\n end",
"def index\n b_admin = current_user.admin? rescue false\n @products = Product.filter_by_params(b_admin, params)\n #@products = Product.available\n \n @title = Product.page_description(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def info_page(collection, style = nil)\n if collection.page(1).length > 0\n html = \"#{t('views.pagination.displaying')} #{collection.offset_value + 1} -\n #{collection.offset_value + collection.length}\"\n html << \" #{t('of')} #{collection.total_count}\"\n\n content_tag :div, html, class: 'pagination', style: style\n end\n end",
"def kopal_layout_after_page_front\n\n end",
"def index\n @partial_file = \"index\"\n respond_to do |format|\n format.html\n format.js {\n render :update do |page|\n page['left_col'].replace_html render_template_sub_menu(\"admin/page_templates\")\n page['middle_col'].replace_html :partial => \"index\"\n end\n }\n format.json {\n @templates = actionize PageTemplate.grid_data\n render :json => { :root => @templates }\n }\n end\n end",
"def edit_page\n self.back_to_top\n edit_page_button\n wait_for_ajax\n self.class.class_eval { include DocumentWidget }\n end",
"def paginator; end",
"def pageless(total_pages, options = {})\n javascript_tag(\n \"$('#{options[:element]}').pageless({\" \\\n \"totalPages:#{total_pages},\" \\\n \"url:'#{options[:url]}',\" \\\n \"params:{without_layout: true}, \" \\\n \"loaderMsg:'#{options[:message]}',\" \\\n \"loaderImage: '/images/ajax-spinner.gif'\" \\\n \"});\")\n end",
"def index\n #@unitarios = Unitario.all\n #@grupos_unitarios = GruposUnitario.all\n @filterrific = initialize_filterrific(\n InscripcionDiplomado,\n params[:filterrific],\n select_options: {\n with_grupos_unitario_id: GruposDiplomado.seleccion_curso_nombre,\n with_documentos_validados: InscripcionDiplomado.options_for_documentos_validados\n },\n ) or return\n @inscripcion_diplomados = @filterrific.find.page(params[:pagina])\n\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n # There is an issue with the persisted param_set. Reset it.\n puts \"Se restablecieron los parámetros: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n end",
"def show\n @website = Website.find_by_id(@page.website_id) \n @websitepages = @website.pages \n @times = @website.timetables\n @sections = @page.page_sections\n\n if (@page.title == \"inventory\")\n # @newlisting = Listing.new(\"https://fierce-sea-43472.herokuapp.com/categories.json\")\n # @listings = @newlisting.getresponse((User.find_by_id(@website.user_id).email).to_s) \n if params[:sort].present? && params[:direction].present?\n @listings = Inventory.where(:website_id => @website.id).search(params[:search]).order(params[:sort] + \" \" + params[:direction]).paginate(:per_page => 12, :page => params[:page]) \n else\n @listings = Inventory.where(:website_id => @website.id).search(params[:search]).paginate(:per_page => 12, :page => params[:page]) \n end\n\n # @listings = Inventory.where(:website_id => @website.id)\n \n end\n\n end",
"def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def kopal_layout_before_page_sidebar\n\n end",
"def index\n @webinars = Webinar.paginate :order => 'date desc', :page => params[:page], :per_page => 25\n if request.xhr?\n render(:update) do |page|\n page.replace_html 'results', :partial => \"results\"\n end\n end\n end",
"def index\n #@company = Company.find(1)\n @effects = Effect.page(params[:page]).per(1)\n respond_to do |format|\n format.html\n format.js \n\n end\n end",
"def show\n newest_comments\n calendar_set\n\n @section = Section.find(params[:id])\n\n if (@section.virtual == false)\n @photos = @section.photos.paginate :page => params[:page],\n :order => \"created_at #{@section.order}\",\n :conditions => ['photos.publish_at <= NOW()'],\n :per_page => Setting.get_setting(\"photos_per_page\")\n\n elsif (@section.virtual_name == \"sections-all_photos\")\n @photos = Photo.paginate :include => :section,\n :conditions =>['sections.builtin != 1 and photos.publish_at <= NOW()'],\n :order => 'photos.created_at DESC', :page => params[:page],\n :per_page => Setting.get_setting(\"photos_per_page\")\n render :action => \"all_photos\"\n\n elsif (@section.virtual_name == \"sections-most_viewed\")\n @photos = Photo.paginate :include => :section,\n :conditions =>['sections.builtin != 1 and photos.publish_at <= NOW()'],\n :order => 'photos.view DESC', :page => params[:page],\n :per_page => Setting.get_setting(\"photos_per_page\")\n end\n\n\n\n end",
"def index\n\n @per_page = 2\n params[:page] = 1 if ( params[:page].to_i < 1 )\n @page = ( params[:page].to_i > 0 ) ? params[:page].to_i - 1 : 0\n @skip = ( @per_page * @page )\n\n\n\n if ( params[:search] )\n @ciudades = Ciudade.search( params[:search] ).limit( @per_page ).skip( @skip )\n elsif ( params[:column] )\n @ciudades = Ciudade.sort( params[:column], params[:sort] ).limit( @per_page ).skip( @skip )\n else\n @ciudades = Ciudade.all.limit( @per_page ).skip( @skip )\n end\n \n\n@num_of_pages = ( @per_page.to_i > 0 ) ? ( @ciudades.size / @per_page.to_f ).ceil : 1\n\n \n respond_to do |format|\n format.html {# index.html.erb\n if ( request.xhr? )\n render( { :partial => 'ciudades/list', :locals => { :ciudades => @ciudades}, :layout => false } )\n return\n end\n }\n format.js {# index.js.erb\n render( :index )\n }\n format.json { render json: @ciudades }\n end\n end",
"def index\n @core_seller_areas = Core::SellerArea.find_mine(params).paginate(page: params[:page])\n respond_to do |format|\n format.js {}\n format.html {}\n end\n end",
"def index\n # @events = Event.all.paginate(page: params[:page])\n @filterrific = initialize_filterrific(\n Event,\n params[:filterrific],\n :select_options => {\n with_event_category_id: EventCategory.options_for_select\n }\n ) or return\n @events = @filterrific.find.page(params[:page])\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n @medium = Medium.find(params[:id]) \n @tab_options ||= {}\n @tab_options[:entity] = @medium\n respond_to do |format|\n format.html do # show.rhtml\n @pictures = Picture.all.order('RAND()').limit(Medium::COLS * Medium::PREVIEW_ROWS)\n @videos = Video.all.order('RAND()').limit(1)\n @documents = Document.all.order('RAND()').limit(1)\n @titles = { :picture => ts(:daily, :what => Picture.model_name.human(:count => :many).titleize), :video => ts(:daily, :what => Video.model_name.human(:count => :many).titleize), :document => ts(:daily, :what => Document.model_name.human(:count => :many).titleize) }\n @more = { :type => '' }\n end\n format.js\n format.xml #{ render :xml => @medium.to_xml }\n format.json { render :json => Hash.from_xml(render_to_string(:action => 'show.xml.builder')) }\n end\n end",
"def paginate; false; end",
"def more\n\t\t@restaurant = Restaurant.find(params[:restaurant_id])\n\t\t@comments = @restaurant.comments.paginate(page: params[:page], per_page: 10)\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend"
] | [
"0.625409",
"0.61387765",
"0.6132003",
"0.6017818",
"0.59001946",
"0.5831664",
"0.5740247",
"0.5725626",
"0.5712588",
"0.5699596",
"0.5685144",
"0.5675316",
"0.56638634",
"0.5645248",
"0.55774915",
"0.5576835",
"0.5566876",
"0.55541265",
"0.5545101",
"0.55389386",
"0.55271435",
"0.5524155",
"0.5518908",
"0.5518693",
"0.55118215",
"0.54955405",
"0.5463709",
"0.546316",
"0.54571277",
"0.5456518",
"0.5454134",
"0.5450211",
"0.54479176",
"0.5440284",
"0.5434163",
"0.5425468",
"0.5425468",
"0.54210895",
"0.54181",
"0.5417882",
"0.5417491",
"0.54108113",
"0.54081655",
"0.54059416",
"0.53905517",
"0.5389973",
"0.53753185",
"0.537471",
"0.5370226",
"0.53702193",
"0.5357942",
"0.53553486",
"0.5353138",
"0.5352889",
"0.534993",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5345297",
"0.5340989",
"0.5340989",
"0.5340595",
"0.5311595",
"0.5308108",
"0.5306897",
"0.5306335",
"0.5304531",
"0.52950484",
"0.52902573",
"0.5284719",
"0.5281621",
"0.52787715",
"0.52780795",
"0.52750987",
"0.52724606",
"0.52612615",
"0.5259997",
"0.5255713",
"0.523931",
"0.52392006",
"0.5237527",
"0.52369577",
"0.52322066",
"0.52301323",
"0.52277017",
"0.5226107",
"0.522448",
"0.5222213",
"0.5219997",
"0.5217961",
"0.5216247",
"0.5216059"
] | 0.64609236 | 0 |
Description Opens the general page of the elements editor: the video icon redirects to VideoEditorControllernew the audio icon redirects to AudioEditorControllernew the image icon redirects to GalleriesControllerimage_for_image_editor (and successively to ImageEditorControlleredit) Mode Html | def new
render :layout => 'media_element_editor'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end",
"def new\n @editor = Editor.new\n @editor.build_logo\n @title = \"Creer un editeur\"\n ariane.add \"Nouvel editeur\", new_editor_path\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @editor }\n end\n end",
"def editing_help(editing_help_type)\n case editing_help_type\n when 'Partial'\n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n # help << '<h4>Tags for this Custom Type</h4>'\n when 'Layout' \n help = '<h4>Useful tags</h4>'\n help << '<p><code><%= navigation %></code><br />'\n help << '<code><%= page.page_title %><c/ode><br />' \n help << '<code><%= stylesheet_link_tag \"stylename\" %></code><br />' \n help << '<code><%= javascript_include_tag \"scriptname\" %></code><br />' \n help << '<code><%= region :example %></code></p>' \n end\n end",
"def edit_description\n end",
"def lcr_edit\n @page_title = _('LCR_edit')\n @page_icon = \"edit.png\"\n end",
"def fleximage_editor\n \n ar_object = Kernel::const_get(params[:ar_object_class]).find(params[:ar_object_id])\n display_editor = (params[:display_editor] == \"false\")\n display_thumbnail = (params[:display_thumbnail] == \"true\")\n \n render :update do |page| \n page.replace(MainController.fleximage_domid(ar_object),\n render(:partial => \"/main/media_edit\", \n :locals => {:ar_object => ar_object, \n :timestamp => nil,\n :display_thumbnail => display_thumbnail, \n :display_editor => display_editor})\n )\n\t\tend\n end",
"def render_editor(element)\n render_element(element, :editor)\n end",
"def render_editor(element)\n render_element(element, :editor)\n end",
"def preview\n #for debug\n params[:d] = 'www.rubyecommerce.com'\n editor = params[:editor]\n website=menu=layout=theme = resource = nil\n website = Website.find_by_url(params[:d])\n if params[:c]\n menu = Menu.find_by_id(params[:c])\n if params[:r]\n resource = BlogPost.find_by_id(params[:r])\n end \n else\n menu = Menu.find_by_id(website.index_page) \n end\n theme = TemplateTheme.find(menu.find_theme_id(is_preview=true))\n html,css = do_preview(theme, menu, {:blog_post_id=>(resource.nil? ? nil:resource.id),:editor=>editor})\n #insert css to html\n style = %Q!<style type=\"text/css\">#{css}</style>!\n \n #editor_panel require @theme, @editors, @editor ...\n prepare_params_for_editors(theme)\n editor_panel = render_to_string :partial=>'layout_editor_panel'\n html.insert(html.index(\"</head>\"),style)\n html.insert(html.index(\"</body>\"),editor_panel)\n render :text => html\n end",
"def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend",
"def edit\n\t\t@page_name = \" - Edit Show\"\n\tend",
"def new\n @header_tab = \"media\"\n @medium = Media.new\n render :layout => \"admin\"\n\n end",
"def content_preview\n self.description.present? ? self.description : self.main_content\n end",
"def edit_gallery_title_desc(gallery_name = \"test\", gallery_title = \"samplegallery\", gallery_desc = \"Its a sample gallery\",_browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Editing '#{gallery_name}' Gallery properties (Title + Desc).\")\n self.open_gallery(gallery_name)\n wait.until { _browser.find_element(:xpath => @galmgr.edit_gallery) }.click\n frame = wait.until { _browser.find_element(:xpath => @galmgr.edit_overlay_frame) }\n _browser.switch_to.frame(frame)\n temp = wait.until { _browser.find_element(:xpath => @galmgr.gallery_title) }\n temp.clear\n temp.send_keys(gallery_title)\n wait.until { _browser.find_element(:xpath => @galmgr.gallery_desc) }\n self.type_text_in_wysiwyg_editor(gallery_desc)\n ## we need to be on the overlay at this point of execution\n wait.until { _browser.find_element(:xpath => @galmgr.save_gallery_btn) }.click\n _browser.switch_to.default_content\n end",
"def initialize\n @klass = TOOLBAR_EDITOR\n @description = nil\n # Wait for the page to be displayed with MAX_WAIT_ON_LOAD seconds timeout\n raise 'The page was not loaded' unless self.displayed?($janus::MAX_WAIT_ON_LOAD)\n end",
"def message_editor\n frm.frame(:id, \"description___Frame\").td(:id, \"xEditingArea\").frame(:index=>0)\n end",
"def set_elements\n super\n element(:message) {b.li(:class => 'uif-infoMessageItem')}\n element(:messages) {b.lis(:class => 'uif-infoMessageItem')}\n element(:message_header) {b.h3(:class => 'uif-pageValidationHeader')}\n element(:submit_button) {b.button(:id => \"submitEditor\")}\n element(:cancel_button) {b.button(:id => \"cancelEditor\")}\n element(:close_button) {b.button(:id => \"closeEditor\")}\n element(:return_to_search_button) {b.button(:id => \"returnToSearch_button\")}\n # Navigation Area Elements\n element(:delete_bib_button) {b.button(:title => 'Delete Bib')}\n element(:add_instance_button) {b.button(:title => 'Add Instance')}\n element(:add_einstance_button) {b.button(:title => 'Add EInstance')}\n # @note Vakata Context Menu items are only present on the screen after the containing menu header has been right-clicked.\n element(:delete_instance_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => \"Delete\")}\n element(:add_item_button) {b.button(:title => 'Add Item')}\n element(:delete_item_button) {b.div(:id => 'vakata-contextmenu').ul.li(:index => 0).a(:rel => 'Delete')}\n end",
"def default\r\n can_view, msg = dc_user_can_view(@parent, @page)\r\n return msg unless can_view\r\n\r\n html = \"<div class=\\\"#{@page.div_class} #{@opts[:div_class]}\\\">\"\r\n html << dc_page_edit_menu() if @opts[:edit_mode] > 1\r\n @parent.page_title = @page.title.blank? ? @page.subject : @page.title\r\n html << @page.body\r\n # render poll if defined\r\n if @page.dc_poll_id\r\n @opts.merge!(poll_id: @page.dc_poll_id, return_to: @parent.request.url, method: nil)\r\n comment = DcPollRenderer.new(@parent, @opts)\r\n html << \"<div class='wrap row'>#{comment.render_html}</div>\"\r\n @css << \"\\n#{comment.render_css}\"\r\n end\r\n # also add iframe\r\n html << iframe() << '</div>'\r\nend",
"def index\n @urls = ['index', 'fade_replace', 'simple_blind_ror', 'javascript']\n @descriptions = {'index' => \"listing of all demos/methods. This page\",\n \n 'fade_replace' => \"link triggers central page replacement. This will be used in the final project. Uses ror/rjs\",\n 'simple_blind_ror' => \"simplistic scriptaculous effects using ror. demo only.\",\n 'javascript' => \"uses javascript directly. demo only. straight from Scriptaculous site.\"\n }\n end",
"def link_4edit #:nodoc:\n html = ''\n return html unless @opts[:edit_mode] > 1\n \n @opts[:editparams].merge!( { table: 'dc_big_menu', controller: 'cmsedit', action: 'edit' } )\n title = \"#{t('drgcms.edit')}: \"\n @opts[:editparams].merge!( { id: @menu.id, title: \"#{title}#{@menu.name}\" } ) if @menu\n title << t('helpers.label.dc_big_menu.tabletitle')\n @opts[:editparams].merge!( { action: 'index', title: title }) if @menu.nil?\n html << dc_link_for_edit( @opts[:editparams] )\nend",
"def smart_edit(content_type=0,save_url)\n if content_type == 1\n render \"shared/wysihtml5_js\", {url: save_url}\n else\n render \"shared/autosave_js\", {url: save_url}\n end\n end",
"def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t\t:class => 'small button with_icon new_content_link'\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\tend",
"def initialize\n @commands = {\n edit: 'Write',\n preview: 'Preview'\n }\n @theme = {\n base: '/simple_form_epic_editor/default_theme/base.css',\n preview: '/simple_form_epic_editor/default_theme/preview.css',\n editor: '/simple_form_epic_editor/default_theme/editor.css'\n }\n end",
"def mokio_preview_link_in_edit_page\n self.path\n end",
"def show\n # Get the html, svg, css, and js code to render\n @code = get_article_code\n\n # The default layouts are not added as this page will be\n # embeded in an iframe\n render layout: false\n end",
"def editor\n NanoEditor\n end",
"def show\n render 'show', layout: \"detail_editor\"\n end",
"def render_picture_editor(element, options={})\n default_options = {\n :last_image_deletable => true,\n :maximum_amount_of_images => nil,\n :refresh_sortable => true\n }\n options = default_options.merge(options)\n picture_contents = element.all_contents_by_type(\"EssencePicture\")\n render(\n :partial => \"admin/elements/picture_editor\",\n :locals => {\n :picture_contents => picture_contents,\n :element => element,\n :options => options\n }\n )\n end",
"def preview\n end",
"def preview\n end",
"def markup_editor_area(name, method, options ={}, html_options ={})\n id = options[:id]\n pl_caption = options.delete(:caption)\n pl_caption ||= \"Preview #{method}\"\n\n preview_dom_id = method_to_preview_dom(name, method, id)\n preview_target = \"#{preview_dom_id}_target\"\n\n editor_opts = {:class => 'markup-editor'}.merge(html_options)\n #links\n markup_link = link_to('Textile Markup reference', \"#{ActionController::Base.asset_host}/textile_reference.html\",\n :popup => ['Textile markup reference',\n 'height=400,width=520,location=0,status=0,menubar=0,resizable=1,scrollbars=1'])\n preview_link = link_to pl_caption,\n {:controller => '/markup', :action => \"preview_content\", :object => name, :control => method}, {:id => \"#{preview_dom_id}_link\", :style => \"display: none;\"}\n\n links = content_tag('div', markup_link + ' | ' + preview_link, {:class => 'markup-area-link'})\n #preview container\n preview_target = content_tag('div', ' ', :id => preview_target, :class => 'markup-preview')\n preview_close_link = content_tag(:div, link_to('Close preview', '#', {:id => \"#{preview_dom_id}_close\", :style => \"display: none;\"}), {:class => 'markup-area-link'})\n preview = content_tag('div', preview_target << preview_close_link, :id => \"#{preview_dom_id}\", :style => 'display: none;')\n #render all\n content_tag('div', text_area(name, method, editor_opts) << links << preview , :id => \"#{name}_#{method}_editor\")\n end",
"def cntrl_settg; det.image(:id, 'imgCtrlSettings'); end",
"def aboutButton\n \"* marked:'About'\"\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENTED YET>'\n end",
"def edit_page\n self.back_to_top\n edit_page_button\n wait_for_ajax\n self.class.class_eval { include DocumentWidget }\n end",
"def edit_button_clicked\n\n\t\t\t# Set flag for edit mode, store \n\t\t\t@edited_item = @form.folderList.currentItem\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form(@edited_item.text)\n\t\tend",
"def edit_all_galleries(new_title = \"Galleries\", desc_format = \"Plain text\", new_desc = \"\",\n new_url = \"galleries\", new_cols = 4, new_rows = 3, new_display = \"Show title on hover\", _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n Log.logger.info(\"Editing All Galleries\")\n Log.logger.info(\"Waiting for gallery overlay frame\")\n frame = wait.until { _browser.find_element(:xpath => @galmgr.eag_overlay_frame) }\n _browser.switch_to.frame(frame)\n Log.logger.info(\"Waiting for the 'Gallery settings' title. (to make really sure we're on the right iframe)\")\n #<h1 id=\"overlay-title\">Gallery settings</h1>\n wait.until { _browser.find_element(:xpath => \"//h1[@id='overlay-title' and text()='Gallery settings']\") }\n Log.logger.info(\"Waiting for eag_title\")\n already_retried = false\n temp = wait.until { _browser.find_element(:xpath => @galmgr.eag_title) }\n temp.clear\n temp.send_keys(new_title)\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Selecting eac_desc_format (#{desc_format.inspect} in text-format list.\")\n elm = wait.until { _browser.find_element(:xpath => \"#{@galmgr.eag_desc_format}/option[text()='#{desc_format}']\") }\n wait.until { elm.displayed? }\n elm.click\n if desc_format == \"Plain text\"\n Log.logger.info(\"Waiting for text 'Allowed tags: None' to show up (Because 'Plain text' option was selected)\")\n wait.until { _browser.find_element(:xpath => \"//div[@class='wysiwyg-none-header']//span[contains(text(), 'None')]\") }\n else\n JQuery.wait_for_events_to_finish(_browser)\n end\n=begin\n begin\n _browser.find_element(:xpath => @galmgr.eag_url_path).send_keys(new_url)\n##### THIS HAS CHANGED DUE TO THE NEW SEO SHIT\n rescue\n Log.logger.info(\"TF!!\")\n gets\n end\n=end\n Log.logger.info(\"Setting columns to: #{new_cols}\")\n wait.until { _browser.find_element(:xpath => \"#{@galmgr.edit_gallery_cols}/option[text()='#{new_cols}']\") }.click\n Log.logger.info(\"Setting row to: #{new_rows}\")\n r_ows = _browser.find_element(:xpath => @galmgr.edit_gallery_rows)\n r_ows.clear\n r_ows.send_keys(new_rows)\n wait.until { _browser.find_element(:xpath => \"#{@galmgr.edit_gallery_media_display}/option[text()='#{new_display}']\") }.click\n if (desc_format == \"Plain text\")\n Log.logger.info(\"Typing in new description \")\n temp = wait.until { _browser.find_element(:xpath => @galmgr.eag_desc) }\n temp.clear\n temp.send_keys(new_desc)\n else\n _browser.switch_to.default_content\n Log.logger.info(\"Selecting ckeditor frame\")\n frame = wait.until { _browser.find_element(:xpath => @galmgr.ckeditor_frame) }\n _browser.switch_to.frame(frame)\n Log.logger.info(\"Waiting for ckeditor body\")\n wait.until { _browser.find_element(:xpath => @galmgr.ckeditor_body) }\n Log.logger.info(\"Typing in new description\")\n\n type_text_in_wysiwyg_editor(new_desc)\n\n _browser.switch_to.default_content\n frame = wait.until { _browser.find_element(:xpath => @galmgr.edit_overlay_frame) }\n _browser.switch_to.frame(frame)\n end\n Log.logger.info(\"Clicking on save gallery button\")\n wait.until { _browser.find_element(:xpath => @galmgr.save_gallery_btn) }.click\n Log.logger.info(\"Waiting for confirmation message\")\n confirmation_msg = wait.until { _browser.find_element(:xpath => @galmgr.confirmation_message) }.text\n Log.logger.info(\"Got confirmation message: #{confirmation_msg.inspect}\")\n frame = wait.until { _browser.find_element(:xpath => @galmgr.close_overlay) }\n Log.logger.info(\"Clicking on close overlay link\")\n begin\n alert = _browser.switch_to.alert\n Log.logger.info(\"Encountered an alert while closing overlay...perhaps I shouldn't be using the overlay!!!!\")\n alert.accept\n rescue\n Log.logger.info(\"No alert present...continuing\")\n end\n wait.until { _browser.find_element(:xpath => @galmgr.close_overlay) }.click\n _browser.switch_to.default_content\n return confirmation_msg\n end",
"def render\n content_tag(:section, class: \"umm-preview #{form_id}\") do\n render_preview_accordion\n end\n end",
"def content\n \"#{title} #{description_text}\"\n end",
"def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end",
"def ed\n \tAas::Application.DocumentManager.MdiActiveDocument.Editor\n end",
"def activate\n Page.send :include, ExtraRadiantTags\n Admin::PagesController.send :include, InterfaceAdditions\n \n # admin.page.edit.add :form, \"/admin/page/hide_page\", :before => \"edit_extended_metadata\"\n # admin.tabs.remove \"Assets\"\n # admin.tabs.add \"Bilder\", \"/admin/assets\", :after => \"Snippets\", :visibility => [:all]\n # admin.tabs.remove \"Pages\"\n # admin.tabs.add \"Seiten\", \"/admin/pages\", :before => \"Snippets\", :visibility => [:all]\n end",
"def description\n page.render_part('description') rescue ''\n end",
"def description\n page.render_part('description') rescue ''\n end",
"def main_window\r\n super\r\n # Make help window\r\n @help_window = Window_Help.new\r\n @help_window.set_text(@help_text)\r\n # Make save file window\r\n @savefile_windows = []\r\n for i in 0..3\r\n @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))\r\n end\r\n @savefile_windows[@file_index].selected = true\r\n end",
"def new\n page_title(\"New Experiment\")\n \n @experiment = Experiment.new\n page_group(current_user.group)\n \n @calendars = self.calendars_select_array()\n @locations = self.locations_select_array()\n self.use_markdown_editor = true\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @experiment }\n end\n end",
"def dev_exp; nav.link(:text, 'Device Explorer'); end",
"def ide_menu\n\t\tputs \"***IDE Menu***\"\n\t\tputs \"1. Comment a selection \"\n\t\tputs \"2. Save a file\"\n\t\tputs \"3. Create new file\"\nend",
"def edit\n @page_title = @content.locale_title(I18n.locale)\n @content.setup_uri_path # be sure to recover uri_path or scope will get messed up when the content is saved.\n respond_to do |format|\n format.html { render :template => @edit_template || 'contents/edit'}\n format.pjs { render :template => @edit_template || 'contents/edit', :layout => 'popup'}\n end\n end",
"def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end",
"def use_technology_preview; end",
"def preview\n frm.link(:text=>\"Preview\").click\n PreviewOverview.new(@browser)\n end",
"def provide_navigation_to_long_description(image)\n # Interface method\n end",
"def show\n @main_page = \"Admin\"\n @page_title = \"Configuração\"\n end",
"def edit\n @idea = Idea.find(params[:id])\n\t\t@categories = Category.find(:all)\n\n\t\t@path = [link_to_ideas, link_to_edit_idea(@idea)]\n\t\t@subnavigation = [active_link_to_edit_idea(@idea), link_to_destroy_idea(@idea)]\n\n end",
"def show\n render_general(@image)\n end",
"def about; render; end",
"def edit\n\n @icons = Rails.configuration.icons['material']\n @image_list = Image.where({\n imageable_type: 'Website',\n imageable_id: params[:id],\n }).order(created_at: :desc); \n @components = @website.components\n .order(id: :asc)\n @articles = @website.articles\n .where(fake: true)\n .select(:title, :intro, :date)\n @image_top = Image.where({\n imageable_type: 'Website',\n imageable_id: params[:id],\n name: 'top'\n }).order(updated_at: :desc)[0]; \n @image_bottom = Image.where({\n imageable_type: 'Website',\n imageable_id: params[:id],\n name: 'bottom'\n }).order(updated_at: :desc)[0]; \n \n @preview = @website.preview\n @gitconfig = @website.gitconfig\n @style = @website.style\n PreviewJob.perform_later @website, true\n end",
"def open_edit_all_galleries_by_config(browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Opening 'edit all galleries' area\")\n wait.until { browser.find_element(:xpath => @galmgr.config_tab) }.click\n frame = wait.until { browser.find_element(:xpath => @galmgr.edit_overlay_frame) }\n browser.switch_to.frame(frame)\n wait.until { browser.find_element(:xpath => @galmgr.gallery_settings) }.click\n browser.switch_to.default_content\n Log.logger.info(\"Done opening 'edit all gallers' area\")\n end",
"def edit\n @prompt = \"save\"\n %[<textarea name='settings' class='form' style='width: 100%; height: 30%;'>#{self.yaml.value || BASIC}</textarea><textarea name='editor' class='form' style='width: 100%; height: 70%;'>#{self.md.value || INDEX}</textarea>];\n end",
"def add_view_code\n return '' if (data = @record.send(@yaml['name'])).blank?\n\n table, form_name = @yaml['view'].split(/\\ |\\,/).delete_if { |e| e.blank? }\n url = @parent.url_for(controller: 'cmsedit', id: data, action: :edit, table: table, form_name: form_name, readonly: true, window_close: 1 )\n icon = @parent.mi_icon('eye-o md-18')\n %(<span class=\"dc-window-open\" data-url=\"#{url}\"> #{icon}</span>)\nend",
"def description_input\n adding_field do |f|\n view_context.render \"questions/editor\", :f => f\n end\n end",
"def activate\n tab 'Content' do\n add_item \"Gestion des Slides\", \"/admin/slides\", :after => \"Pages\"\n end\n Page.send :include, HomeSliderTags\n end",
"def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end",
"def help\n #render(text: \"Help method in StaticPages controller class\");\n end",
"def config\r\n $ie.frame(:index, 2).image(:id, 'imgConfigure')\r\nend",
"def page\n\t\t\teditor.page\n\t\tend",
"def new\n @image_reference = ImageReference.new\n smartrender\n end",
"def edit_description\n self.div(:id=>\"contentmetadata_description_container\").fire_event \"onmouseover\"\n self.div(:id=>\"contentmetadata_description_container\").fire_event \"onclick\"\n end",
"def preview\n frm.button(:value=>\"Preview\").click\n PreviewAnnouncements.new(@browser)\n end",
"def show() end",
"def show() end",
"def show() end",
"def edit\n turbolinks_animate 'fadeinright'\n super\n end",
"def content_edit_action_item(text=nil, &block)\n icon = content_tag(:div, '', :class => 'iconEditSmall')\n content_action_item(text, icon, &block)\n end",
"def show_assignment_details\n frm.image(:src, \"/library/image/sakai/expand.gif\").click\n end",
"def show_assignment_details\n frm.image(:src, \"/library/image/sakai/expand.gif\").click\n end",
"def render_picture_gallery_editor(element, options={})\n default_options = {\n :maximum_amount_of_images => nil,\n :grouped => true\n }\n options = default_options.merge(options)\n render(\n :partial => \"alchemy/admin/elements/picture_gallery_editor\",\n :locals => {\n :pictures => element.contents.gallery_pictures,\n :element => element,\n :options => options\n }\n )\n end",
"def edit\n # Renders the edit form\n end",
"def edit\n\t@desktop_override = true\n\n\trespond_to do |format|\n\t format.html do\n\t\trender :layout => \"restlessnapkin\" # new.html.erb\n\t end\n\tend\n end",
"def admin_edit_prep\n\n @artist = Artist.find_by_url_slug(params[:url_slug])\n authorize! :admin, @artist\n\n @artist_test=\"blah\"\n\n image_upload_prep(@artist)\n\n @form = render_to_string('artists/_form',:layout => false)\n\n #varable to remove defualt artist loading. Loads the edit layout insted\n @edit = \"true\" #see new\n\n layout(params[:layout])\n\n\n\n end",
"def initialize(iParent, iSC, iRootTag, iController, iType = nil, iInitialTag = nil)\n if (iSC == nil)\n @Type = iType\n else\n @Type = iSC.Type\n end\n\n super(iParent,\n :title => \"Edit Shortcut (#{@Type.pluginDescription[:PluginName]})\",\n :style => Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER|Wx::MAXIMIZE_BOX\n )\n\n # First create all the panels that will fit in this dialog\n require 'pbs/Windows/ContentMetadataPanel'\n @ContentMetadataPanel = ContentMetadataPanel.new(self, @Type, iController)\n if (iSC == nil)\n lTags = {}\n if (iInitialTag != nil)\n lTags[iInitialTag] = nil\n end\n createTagsPanel(self, iRootTag, lTags)\n @ContentMetadataPanel.setData(iType.createEmptyContent, {'title' => 'New Shortcut', 'icon' => nil})\n else\n createTagsPanel(self, iRootTag, iSC.Tags)\n @ContentMetadataPanel.setData(iSC.Content, iSC.Metadata)\n end\n lButtonsPanel = createButtonsPanel(self)\n # Fit them all now, as we will use their true sizes to determine proportions in the sizers\n @ContentMetadataPanel.fit\n @TagsPanel.fit\n\n # Then put everything in place using sizers\n\n # Create the main sizer\n lMainSizer = Wx::BoxSizer.new(Wx::VERTICAL)\n self.sizer = lMainSizer\n\n # First sizer item is the group of 3 panels (content, metadata and tags)\n l3PanelsSizer = Wx::BoxSizer.new(Wx::HORIZONTAL)\n\n l3PanelsSizer.add_item(@ContentMetadataPanel, :flag => Wx::GROW, :proportion => @ContentMetadataPanel.size.width)\n # A little space\n l3PanelsSizer.add_item([8,0], :proportion => 0)\n # The second part of the 3 Panels sizer is the panel of tags\n l3PanelsSizer.add_item(@TagsPanel, :flag => Wx::GROW, :proportion => @TagsPanel.size.width)\n\n lMainSizer.add_item(l3PanelsSizer, :flag => Wx::GROW|Wx::ALL, :border => 8, :proportion => 1)\n # The second part of the main sizer is the panel containing the buttons\n lMainSizer.add_item(lButtonsPanel, :flag => Wx::GROW|Wx::ALL, :border => 8, :proportion => 0)\n\n self.fit\n\n end",
"def render_show_doc_actions(document=@document, options={})\n content = []\n content << tag_control(document)\n content_tag(\"div\", content.join(\"\\n\").html_safe, :class=>\"documentFunctions\")\n end",
"def new\n\t\t@path = [link_to_ideas, link_to_new_idea]\n\t\t@subnavigation = [active_link_to_new_idea,link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\n @idea = Idea.new\n\t\t@categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @idea }\n end\n end",
"def content_preview\n self.send(content_preview_method)\n end",
"def display_intro\n # Display Company Logo\n display_logo\n # Display Emergency Information\n display_emergency_info\n end",
"def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend",
"def title_view\n html = \"\"\n html << \"<span class=\\\"icon12 icomoon-icon-home home_page\\\"></span>\" if self[:home_page]\n html << (ActionController::Base.helpers.link_to self[:title], ApplicationController.helpers.edit_url(self.class.base_class, self))\n html.html_safe\n end",
"def edit_form\n\t\titem_text = question_items.first.text #in_place_editor_field :question_cell, :items, {}, :rows => 3\n\t\tdiv_item(item_text, \"iteminformation\")\n\tend",
"def about\r\n end",
"def editor_interface\n Contentful::Management::ContentTypeEditorInterfaceMethodsFactory.new(self)\n end",
"def content\n end",
"def content\n end",
"def content\n end",
"def show\n if owner_logged_in?\n @show_edit_controls = true\n else\n @show_edit_controls = false\n end\n end",
"def show\n if owner_logged_in?\n @show_edit_controls = true\n else\n @show_edit_controls = false\n end\n end",
"def kefed_editor\n @project = Yogo::Project.get(params[:id])\n @uid = @project.yogo_model_uid || params[:uid]\n @action = params[:action]\n @kefed_params = \"callbackFunction=editorCallback\"\n if params[:editor_action]\n @kefed_params += \"&action=#{params[:editor_action]}\"\n else\n @kefed_params += \"&action=editModel\"\n end\n @kefed_params += \"&uid=#{@uid.to_s.upcase}\" if @uid\n @kefed_params += \"&zoom=1.0\"\n @no_blueprint = true \n end",
"def show\n\t\traise NotImplementedError, \"FIXME: Implement showing comments.\"\n\tend",
"def show\n @ole.Show\n end",
"def edit\n frm.button(:value=>\"Edit\").click\n AddEditAnnouncements.new(@browser)\n end"
] | [
"0.6211096",
"0.5943301",
"0.584834",
"0.5838946",
"0.5833649",
"0.57943696",
"0.57561123",
"0.57561123",
"0.5717198",
"0.56711775",
"0.5628239",
"0.5617931",
"0.5597701",
"0.5596176",
"0.557289",
"0.55670696",
"0.55634266",
"0.5531548",
"0.5519143",
"0.5514199",
"0.5507684",
"0.55005485",
"0.54918003",
"0.54757494",
"0.546666",
"0.5462228",
"0.5457115",
"0.54291475",
"0.54216284",
"0.54216284",
"0.5416047",
"0.5414443",
"0.5411453",
"0.540274",
"0.53961456",
"0.53865385",
"0.5381678",
"0.5361139",
"0.5359948",
"0.5347643",
"0.53391063",
"0.5338263",
"0.5327562",
"0.5327562",
"0.5326118",
"0.5324891",
"0.53210247",
"0.5305698",
"0.52952",
"0.52933794",
"0.5290789",
"0.52855104",
"0.5281026",
"0.5278816",
"0.52778226",
"0.5274087",
"0.52728456",
"0.5272815",
"0.5263858",
"0.52628845",
"0.5255846",
"0.5254306",
"0.52326345",
"0.5220646",
"0.52171445",
"0.5213872",
"0.5210191",
"0.5208448",
"0.52034956",
"0.5202756",
"0.51994985",
"0.51994985",
"0.51994985",
"0.5197894",
"0.51969236",
"0.5196039",
"0.5196039",
"0.5191264",
"0.51787513",
"0.51773053",
"0.517626",
"0.5174486",
"0.516585",
"0.5164217",
"0.5154251",
"0.51542395",
"0.514972",
"0.51456463",
"0.5142237",
"0.5141516",
"0.5138168",
"0.51348084",
"0.51348084",
"0.51348084",
"0.5131338",
"0.5131338",
"0.5130298",
"0.5126325",
"0.5121605",
"0.5114449"
] | 0.63153374 | 0 |
Description This action checks for errors without setting the media on the new element Mode Js | def create_fake
record = MediaElement.new
record.title = params[:title_placeholder] != '0' ? '' : params[:title]
record.description = params[:description_placeholder] != '0' ? '' : params[:description]
record.tags = params[:tags_value]
record.user_id = current_user.id
record.save_tags = true
record.valid?
@errors = convert_media_element_error_messages record.errors
@errors[:media] = t('forms.error_captions.media_file_too_large').downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_retry\n\t\t#@media = Media.find(params[:id])\n\t\t\n\t\tif [:error, :invalid].include? @media.workflow_state.to_sym\n\t\t\t@media.workflow_state = 'checking'\n\t\t\t@media.media_type = nil\n\t\t\t@media.save!\n\t\tend\n\t\t\n\t\t@media.check_media\n\tend",
"def media_element\n if correct_integer?(params[:media_element_id])\n @media_element_id = params[:media_element_id].to_i\n @resp = current_user.report_media_element(@media_element_id, params[:content])\n @error = current_user.get_base_error\n else\n @media_element_id = nil\n @resp = false\n @error = I18n.t('activerecord.errors.models.user.problem_reporting')\n end\n end",
"def load_preview\n @media_element_id = correct_integer?(params[:media_element_id]) ? params[:media_element_id].to_i : 0\n @media_element = MediaElement.find_by_id @media_element_id\n if !@media_element.nil? && (@media_element.is_public || @media_element.user_id == current_user.id) && @media_element.converted\n @ok = true\n @media_element.set_status current_user.id\n else\n @ok = false\n end\n end",
"def add\n @ok_msg = t('other_popup_messages.correct.add.media_element')\n if @ok\n if !current_user.bookmark('MediaElement', @media_element_id)\n @ok = false\n @error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')\n end\n else\n @error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')\n end\n if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT\n prepare_media_element_for_js\n @ok_msg = nil\n render 'media_elements/reload.js'\n else\n render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)}\n end\n end",
"def update\n if @ok\n @media_element.title = params[:title]\n @media_element.description = params[:description]\n @media_element.tags = params[:tags_value]\n @media_element.save_tags = true\n if !@media_element.save\n @errors = convert_media_element_error_messages @media_element.errors\n else\n @media_element.set_status current_user.id\n end\n end\n end",
"def destroy\n if @ok\n if !@media_element.check_and_destroy\n @ok = false\n @error = @media_element.get_base_error\n end\n else\n @error = I18n.t('activerecord.errors.models.media_element.problem_destroying')\n end\n render :json => {:ok => @ok, :msg => @error}\n end",
"def validate_impossible_changes\n if @media_element.nil?\n errors.add(:is_public, :must_be_false_if_new_record) if self.is_public && !self.skip_public_validations\n else\n errors.add(:sti_type, :cant_be_changed) if @media_element.sti_type != self.sti_type\n if @media_element.is_public\n if !self.skip_public_validations\n errors.add(:media, :cant_be_changed_if_public) if self.changed.include? 'media'\n errors.add(:title, :cant_be_changed_if_public) if @media_element.title != self.title\n errors.add(:description, :cant_be_changed_if_public) if @media_element.description != self.description\n errors.add(:is_public, :cant_be_changed_if_public) if !self.is_public\n errors.add(:publication_date, :cant_be_changed_if_public) if @media_element.publication_date != self.publication_date\n end\n else\n errors.add(:user_id, :cant_be_changed) if @media_element.user_id != self.user_id\n end\n end\n end",
"def create\n media = params[:media]\n record = MediaElement.new :media => media\n record.title = params[:title_placeholder] != '0' ? '' : params[:title]\n record.description = params[:description_placeholder] != '0' ? '' : params[:description]\n record.tags = params[:tags_value]\n record.user_id = current_user.id\n record.save_tags = true\n if record.save\n if !record.image?\n Notification.send_to(\n current_user.id,\n I18n.t(\"notifications.#{record.class.to_s.downcase}.upload.started.title\"),\n I18n.t(\"notifications.#{record.class.to_s.downcase}.upload.started.message\", :item => record.title),\n ''\n )\n end\n else\n if record.errors.added? :media, :too_large\n return render :file => Rails.root.join('public/413.html'), :layout => false, :status => 413\n end\n @errors = convert_media_element_error_messages record.errors\n end\n render :layout => false\n end",
"def check\n checkVar(:MediawikiDir, '--mediawikidir')\n\n return performModify(false)\n end",
"def media_status\n super\n end",
"def check_media\n\t\tif !GroupMedia.where(:media_id => self.media_id).exists?\n\t\t\tMedia.destroy(self.media_id)\n\t\tend\n\tend",
"def test02_pre_open_board_MediaCancel\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_media)\n\t\t\n\t\tsleep 2\n\t\tassert $post_media_description.exists?\n\t\t$post_media_description.set(\"Media Description #{random}.\")\n \t\trepostGroupPop\n\t\t$post_media_button.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n\t\t$post_cancel.click\n\n\t\tsleep 3\n\t\tassert $post_cancel.exists?\n\tend",
"def handle_silent_modification_failure?\n false\n end",
"def test04_flag_repost_media_TC_24323\n\t\trepostMediaPop\n\t\tsleep 2\n\t\trepost\n\t\tcommentFlag\n\t\tsleep 2\n\t\t\n\t\tbegin\n\t\tassert $browser.text.include?(\"Comment\")\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"R8_T4: FAILED! User unable to flag post.\"\n\t\tend\n\tend",
"def thumbwebs_record_not_found\n flash[:error] = \"Record not found\"\n redirect_to show_errors_thumbwebs_channels_path\nend",
"def test04_MediaPhotoVideo\n\t\tlogin $editor_1_email, $master_password\n\t\t$browser.goto($patch_boards_pre_closed_article_new)\n\t\t\n#\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n#\t\t$post_media_description.set(\"mt townsend is my favorite mountain #{random}.\")\n\t\tif $environment == 'nixon'\t\n\t\t\trepostGroupPop #category already selected in staging\n\t\tend\n\t\t$post_article_title.set(\"Mountain #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('mt townsend is my favorite mountain #{random}.')\")\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"DungenessSpit102.26.2012.mov\"\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n if $environment == 'staging'\n\t\t\tsleep 10 #loads \n\t\tend\n\t\t$post_now_edit.fire_event(\"onclick\")\n\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\tend",
"def test03_MediaAllFields\n\t\tloginPost\n\t\t$browser.goto($patch_media)\n\t\t\t\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"pictures of hiking mr. rainier #{random}.\")\n \t\t\t\tpostGroupPop\n \t\t\t\tpostGroupPop2\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"P01T03: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\tbegin\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\t\t\trescue => e\n\t\t\tputs (\"P01T03: FAILED! User unable to Post.\")\n\t\t\tputs e\n\t\tend\t\n\tend",
"def relaunch?\n errors.present?\n end",
"def check_errors;\n end",
"def remove\n @ok_msg = t('other_popup_messages.correct.remove.media_element')\n if @ok\n bookmark = Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).first\n if bookmark.nil?\n @ok = false\n @error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')\n else\n bookmark.destroy\n if Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).any?\n @ok = false\n @error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')\n end\n end\n else\n @error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')\n end\n if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT\n prepare_media_element_for_js\n render 'media_elements/reload.js'\n else\n render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)}\n end\n end",
"def create_new_media(data_set)\n enter_media_info_data data_set\n click_save_button\n when_exists(delete_button, Config.short_wait)\nend",
"def err_mex \n flash.now[:notice] = \"Non sei il possessore di questo feed e non detieni i privilegi per alterarlo!\" \t\t\t\n render \"show\"\n end",
"def error!\n @error = true\n end",
"def action_if_note_not_created_or_updated(errors,from)\n if from.eql?('iframe')\n responds_to_parent do\n render :update do |page|\n page << \"enableAllSubmitButtons('buttons_to_disable');jQuery('#TB_ajaxContent').animate({scrollTop: 0}, 1000);show_error_msg('modal_new_task_errors','#{escape_javascript(errors.to_s)}','message_error_div');\"\n end\n end\n elsif from.eql?('assign')\n render :update do |page|\n page << \"enableAllSubmitButtons('buttons_to_disable');jQuery('#TB_ajaxContent').animate({scrollTop: 0}, 1000);show_error_msg('modal_new_task_errors','#{escape_javascript(errors.to_s)}','message_error_div');\"\n end\n end\n end",
"def test02_EmptyMPopGD\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_pick_group.exists?\n\t\t\t\tpostGroupPop\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV04T02: FAILED! User unable to locate Post button.\"\n\t\t\tend \t\t\t\t\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV04T02: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def setting_WAN_port(media,setting)\n # click the my network page\n begin\n @ff.link(:href, /actiontec%5Ftopbar%5FHNM/).click\n rescue\n self.msg(rule_name, :error, 'My Network', 'did not reach page')\n return\n end\n # click the Network Connections link\n begin\n @ff.link(:text, 'Network Connections').click\n rescue\n self.msg(rule_name, :error, 'NetworkConnections', 'Did not reach Network Connections page')\n return\n end\n \n begin\n if (@ff.text.include? 'Advanced >>')\n @ff.link(:text,'Advanced >>').click\n end\n rescue\n self.msg(rule_name,:error,'initialize BHR2','Wrong with\\'Advanced >>\\'')\n end\n\n case media \n\twhen 'ether' \n\t # click the 'Broadband Connection(Ethernet)' link \n\t @ff.link(:href, 'javascript:mimic_button(\\'edit: eth1..\\', 1)').click\n\twhen 'coax' \n\t # click the 'Broadband Connection(Coax)' link \n\t @ff.link(:href, 'javascript:mimic_button(\\'edit: clink1..\\', 1)').click\n\twhen 'pppoe'\n\t # click the 'WAN pppoe' link\n\t @ff.link(:href,'javascript:mimic_button(\\'edit: ppp0..\\', 1)').click\n\twhen 'pppoe2'\n\t # click the 'WAN pppoe2' link\n\t @ff.link(:href,'javascript:mimic_button(\\'edit: ppp1..\\', 1)').click\n\telse\n\t puts \"Error: Can NOT enter media interface\"\n\t return\n end\n puts setting+' WAN ' + media+\"....\"\n if ( setting =~ /enable/)\n if @ff.contains_text('Enable')\n puts \"==>Process: Enable WAN \"+ media\n @ff.link(:text, 'Enable').click\n sleep 1\n @ff.link(:text, 'Apply').click\n sleep 2\n else \n puts \" Warning: WAN \"+media+\" is already enabled\"\n end \n else \n if @ff.contains_text('Enable')\n puts \" Warning: WAN \"+media+\" is already disabled\"\n else\n puts \"==>Process: Disable WAN \"+ media\n @ff.link(:text, 'Disable').click\n sleep 1\n @ff.link(:text, 'Apply').click\n sleep 2\n end \n end \n if @ff.contains_text('Please wait, system is now rebooting')\n sleep 80\n end\n\n \n end",
"def check_conversion\n @mes = []\n params.keys.each do |key|\n if key[0, 2] == 'me'\n id = key[2, key.length - 2]\n media_element_id = correct_integer?(id) ? id.to_i : 0\n media_element = MediaElement.find_by_id media_element_id\n ok = (media_element && current_user.id == media_element.user_id && !media_element.is_public)\n media_element.set_status current_user.id if ok\n @mes << {\n :ok => ok,\n :media_element_id => media_element_id,\n :media_element => media_element\n }\n end\n end\n end",
"def est03_post_open_board_MediaPhotoVideo\n\t\tif $environment == 'staging'\n\t\tputs \"Staging watir issue with adding media for boards 8/23\"\n\t\telse\n\t\t@caption = \"awesome mountain #{random}\"\n\t\tlogin $editor_1_email, $master_password\n\t\t$browser.goto($patch_boards_post_open_article_new)\n\t\t\n\t\t$post_article_title.set(\"Article #{random}\")\n\t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('mt townsend is my favorite mountain #{random}.')\")\n\t\tsleep 2\n\t\t$post_add_media.click\n\t\tfile_upload \"GlacierBasinTrailMtRainier.JPG\"\n\t\tsleep 5\n\t\t\n \t\t$post_add_media.click\n \t\tfile_upload \"DungenessSpit102.26.2012.mov\"\n \t\tsleep 5\n \t\tif $environment == 'staging'\n\t\t\tsleep 10 #loads \n\t\tend\n\t\t$post_media_caption.set(@caption)\n\t\t$post_now_alt_1.fire_event(\"onclick\")\n\n\t\tsleep 4\n\t\tassert $post_new_post.exists?\n\t\tassert $post_picture_caption.text.include?(@caption)\n\t\tend\n\tend",
"def interface_bug?\n if type == 'Interface bug' && screenshot.nil?\n self.errors.add(:screenshot, \"can't be blank on interface bugs\")\n end\n end",
"def media_object_must_exist\n if media_object_id.present?\n errors.add(:media_object_id, 'not found') unless media_object_exists?\n end\n end",
"def test04_EmptyGPopDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV03T04: FAILED! UUser unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV03T04: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend",
"def convert_media_type\n if can?(:>=, \"5\")\n @kit = Kitting::Kit.find_by_kit_number_and_commit_id(params[:kit_number],nil)\n @current_kit_media_type=@kit.kit_media_type\n @media_type_to_convert= Kitting::KitMediaType.find(params[:media_type])\n # if @current_kit_media_type.kit_type == \"configurable\" or @media_type_to_convert.kit_type == \"configurable\"\n # flash[:error] = \"Cannot Convert Kit Media of Configurable/Service Not Available\"\n # redirect_to :back\n # else\n if @media_type_to_convert.kit_type == \"binder\" and @current_kit_media_type.kit_type == \"binder\"\n flash[:error] = \"Cannot Convert Kit Media of Same Type(binder-binder) \"\n redirect_to :back\n else\n if @current_kit_media_type.kit_type == \"binder\"\n if @media_type_to_convert.kit_type == \"configurable\"\n @cups_to_delete = Kitting::Cup.where(\"kit_id = ? and id NOT IN (?)\",@kit.id,@kit.cup_parts.select { |cp| cp.status ==true }.map(&:cup_id))\n @cups_to_delete.map(&:destroy)\n if @kit.cups.count <= @media_type_to_convert.compartment\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_size = @media_type_to_convert.compartment - @kit.cups.count\n cup_count = @kit.cups.count\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,cup_count+cup_size,true, cup_count+1)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" )\n end\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n @cups_to_delete = Kitting::Cup.where(\"kit_id = ? and id NOT IN (?)\",@kit.id,@kit.cup_parts.select { |cp| cp.status ==true }.map(&:cup_id))\n @cups_to_delete.map(&:destroy)\n if @kit.cups.count <= @media_type_to_convert.compartment\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_size = @media_type_to_convert.compartment - @kit.cups.count\n @kit.create_binder_cups(@kit,cup_size,true)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attribute(\"cup_number\",index+1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n #Change Media Type from Configurable to Non-Configurable\n elsif @current_kit_media_type.kit_type == \"configurable\"\n if @media_type_to_convert.kit_type == \"binder\"\n flash[:error] = \"Cannot Convert Media Type to Binder\"\n redirect_to :back\n elsif @media_type_to_convert.kit_type == \"non-configurable\"\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_count = @kit.cups.where('status = ?',true).count\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n if cup_count <= @media_type_to_convert.compartment\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,@kit.cups.count+cup_size,true,@kit.cups.count+1)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n cup_count = @kit.cups.where('status = ?',true).count\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n cup_size = cup_count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"cup_number asc\").last(cup_size)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n ## Change Media Type from Configurable to Configurable\n elsif @media_type_to_convert.kit_type == \"configurable\"\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n cup_count = @kit.cups.where('status = ?',true).count\n if cup_count <= @media_type_to_convert.compartment\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,@kit.cups.count+cup_size,true,@kit.cups.count+1)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_number => index+1, :cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" ,:status => 1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n cup_count = @kit.cups.where('status = ?',true).count\n delete_cups = @kit.cups.where('status = ?',false).map(&:destroy)\n cup_size = cup_count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"cup_number asc\").last(cup_size)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_number => index+1, :cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" ,:status => 1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n end\n else\n if @media_type_to_convert.kit_type == \"binder\"\n flash[:error] = \"Cannot Convert Media Type to Binder\"\n redirect_to :back\n elsif @media_type_to_convert.kit_type == \"configurable\"\n #CHANGE Media Type from Non-Configurable to Configurable\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n if @kit.cups.count >= @media_type_to_convert.compartment\n # Changing From larger KitMediaType(Larger Kit) Cup Count to Smaller Configurable Kit ..............\n cup_count = @kit.cups.count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"id asc\").last(cup_count)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_number => index+1, :cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" ,:status => 1)\n end\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n # Changing From Lesser KitMediaType(Smaller Kit) Cup Count to Larger Configurable Kit (UPGRADING ....)\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_count = @kit.cups.count\n cup_size = @media_type_to_convert.compartment - cup_count\n @kit.create_binder_cups(@kit,cup_count+cup_size,true,@kit.cups.count+1)\n if (@media_type_to_convert.compartment == 18)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1 ,1], [3, 1, 1, 1 ,1], [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1],\n [1, 5, 1, 1, 1], [2, 5, 1, 1, 1], [3, 5, 1, 1, 1], [1, 6, 1, 1, 1], [2, 6, 1, 1, 1], [3, 6, 1, 1, 1]]\n elsif (@media_type_to_convert.compartment == 48)\n cup_layout = [[1, 1, 1, 1, 1], [2, 1, 1, 1, 1], [3, 1, 1, 1, 1], [4, 1, 1, 1, 1], [5, 1, 1, 1, 1], [6, 1, 1, 1, 1], [7, 1, 1, 1, 1], [8, 1, 1, 1, 1], [9, 1, 1, 1, 1], [10, 1, 1, 1, 1],\n [1, 2, 1, 1, 1], [2, 2, 1, 1, 1], [3, 2, 1, 1, 1], [4, 2, 1, 1, 1], [5, 2, 1, 1, 1], [6, 2, 1, 1, 1], [7, 2, 1, 1, 1], [8, 2, 1, 1, 1], [9, 2, 1, 1, 1], [10, 2, 1, 1, 1],\n [1, 3, 1, 1, 1], [2, 3, 1, 1, 1], [3, 3, 1, 1, 1], [4, 3, 1, 1, 1], [5, 3, 1, 1, 1], [6, 3, 1, 1, 1], [7, 3, 1, 1, 1], [8, 3, 1, 1, 1], [9, 3, 1, 1, 1], [10, 3, 1, 1, 1],\n [1, 4, 1, 1, 1], [2, 4, 1, 1, 1], [3, 4, 1, 1, 1], [4, 4, 1, 1, 1], [5, 4, 1, 1, 1], [6, 4, 1, 1, 1], [7, 4, 1, 1, 1], [8, 4, 1, 1, 1], [9, 4, 1, 1, 1], [10, 4, 1, 1, 1],\n [1, 1, 1, 1, 2], [2, 1, 1, 1, 2], [1, 2, 1, 1, 2], [2, 2, 1, 1, 2],\n [1, 1, 1, 1, 3], [2, 1, 1, 1, 3], [1, 2, 1, 1, 3], [2, 2, 1, 1, 3]]\n else\n cup_layout = [[ 1,1,2,1,1], [3,1,2,1,1],[5,1,2,1,1],\n [1,1,2,1,2], [3,1,2,1,2], [5,1,2,1,2],\n [1,1,1,1,3], [2,1,2,1,3], [4,1,2,1,3], [6,1,1,1,3]]\n end\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attributes(:cup_dimension => cup_layout[index].join(',') + \",#{cup.id}\" )\n end\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n # DOWNGRADING ..............\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n if @kit.cups.count >= @media_type_to_convert.compartment\n cup_count = @kit.cups.count - @media_type_to_convert.compartment\n @cups = @kit.cups.order(\"id asc\").last(cup_count)\n @check_cup_part = Kitting::CupPart.where(\"cup_id IN (?) and status = ? \", @cups.map(&:id), 1)\n if @check_cup_part.empty?\n @cups.each(&:destroy)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attribute(\"cup_number\",index+1)\n end\n flash[:success] =\"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n else\n flash[:error] = \"Delete Cups/Parts from Cup to Convert Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n else\n # KIT MEDIA TYPE HAVING CUP LESSER THAN THE ORIGINAL KIT MEDIA TYPE (UPGRADING ....)\n config.logger.warn \"{\\\"Msg\\\":\\\"Changing Kit Media Type for #{@kit.kit_number} from #{@current_kit_media_type.name} to #{@media_type_to_convert.name}.\\\"}\" rescue \"\"\n cup_size = @media_type_to_convert.compartment - @kit.cups.count\n @kit.create_binder_cups(@kit,cup_size,true)\n @kit.update_attribute(\"kit_media_type_id\",@media_type_to_convert.id)\n @kit.cups.sort.each_with_index do |cup,index|\n cup.update_attribute(\"cup_number\",index+1)\n end\n flash[:success] = \"Changed Kit Media Type from #{@current_kit_media_type.name} to #{@media_type_to_convert.name} .\"\n redirect_to :back\n end\n end\n end\n end\n #end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def check_and_destroy\n errors.clear\n if self.new_record?\n errors.add(:base, :problem_destroying)\n return false\n end\n if self.is_public\n errors.add(:base, :cant_destroy_public)\n return false\n end\n old_id = self.id\n begin\n self.destroy\n rescue StandardError\n errors.add(:base, :problem_destroying)\n return false\n end\n if MediaElement.exists?(old_id)\n errors.add(:base, :problem_destroying)\n return false\n end\n true\n end",
"def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def additional_controls # \n if kats.nil? or kats.size == 0\n# errors.add('kats', 'At least one category should be selected!')\n end\n if text_over\n errors.add('css_over', 'helpers.help.rotator.css_over_error') if css_over.blank?\n errors.add('picture', 'helpers.help.rotator.picture_error') if picture.blank?\n end\nend",
"def error?; end",
"def error?; end",
"def error?; end",
"def unsuccessful\n end",
"def test02_MediaCancel\n\t\tloginPost\n\t\t$browser.goto($patch_media)\n\t\t\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n \t\t\t\tpostGroupPop\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_cancel.click\n\t\t\telse puts \"PC01T02: FAILED! User unable to cancel.\"\n\t\t\tend\n\t\t\t\n\t\tsleep 1\n\t\tif $post_cancel.exists?\n\t\t\tputs (\"PC01T06: FAILED! User unable to cancel.\")\n\t\t\telse nil\n\t\tend\n\tend",
"def test03_EmptyGDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_button.exists?\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV03T03: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV03T03: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend",
"def test03_4GroupsRepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\tfourGroupSelect\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS06T03: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def confirm_gift_message_warning()\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n wait_for_landing_page_load\n gift_messsage_error.should_exist\n invalid_gc_msg = gift_messsage_error.inner_text\n invalid_gc_msg.should match(\"Gift message cannot exceed 50 characters\")\n end",
"def test04_CancelFlagMediaDialog\n\t\tcommentMediaPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCloseFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPST04: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def errors; end",
"def add_media_action(gallery_name, media_url_list = [\"http://testimages.drupalgardens.com/sites/testimages.drupalgardens.com/files/styles/media_gallery_large/public/150x62XMasNeon.gif\"], _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Adding New Images into the Gallery '#{gallery_name}'.\")\n # media_xpath = \"//div[contains(@id, 'media-gallery-media-')]//a[@href and contains(@class, 'media-gallery-thumb')]\"\n media_xpath = \"//div[contains(@class, 'media-gallery-sortable-processed ui-sortable')]/div[contains(@id, 'media-gallery-media-')]\"\n Log.logger.info(\"Opening Gallery #{gallery_name}\")\n self.open_gallery(gallery_name)\n media_url_list.each do |media_url|\n Log.logger.info(\"Working on media item: #{media_url}\")\n switch_to_last_pagination_page\n #Get the amount of items so we later know which ID something that gets added will get (IDs start at 0, so it will get the id 'nom')\n nom = Integer(_browser.find_elements(:xpath => media_xpath).size)\n Log.logger.info(\"Found #{nom} media item(s).\")\n\n Log.logger.info(\"Waiting for 'Add media' link.\")\n wait.until { _browser.find_element(:xpath => @galmgr.add_media) }\n #we have to wait for the WHOLE page to be loaded and it might even refresh itself for some reason.\n #if we don't sleep, we sometimes run into the page refreshing after we clicked on the add media link\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Clicking on'Add media' link.\")\n _browser.find_element(:xpath => @galmgr.add_media).click\n Log.logger.info(\"Waiting for Overlay.\")\n wait.until { _browser.find_element(:xpath => \"//div[@class='ui-widget-overlay']\") }\n Log.logger.info(\"Waiting for media browser iframe.\")\n start_time = Time.now\n frame = wait.until { _browser.find_element(:xpath => @galmgr.media_upload_frame) }\n Log.logger.info(\"Found media browser iframe after #{Time.now - start_time} seconds.\")\n JQuery.wait_for_events_to_finish(_browser)\n if _browser.find_elements(:xpath => @galmgr.media_upload_frame).size > 0 #perhaps unnecessary?\n Log.logger.info(\"Switching to media browser iframe.\")\n _browser.switch_to.frame(_browser.find_element(:xpath => @galmgr.media_upload_frame))\n else\n raise \"Media Browser frame seems to have disappeared after we had waited for it!\"\n end\n Log.logger.info(\"Waiting for media upload tab link\")\n wait.until { _browser.find_element(:xpath => @galmgr.embed_image_video) }.click\n #Wait til the content of the tab is actually visible\n Log.logger.info(\"Waiting for media upload tab to be visible\")\n wait.until { _browser.find_element(:xpath => \"//div[@id='media-tab-upload' and not(@class='ui-tabs-hide')]\") }\n Log.logger.info(\"Waiting for text input field and entering media URL: (#{media_url})\")\n temp = wait.until { _browser.find_element(:xpath => @galmgr.url_textbox) }\n temp.clear\n temp.send_keys(media_url)\n Log.logger.info(\"Waiting for and clicking on submit button\")\n wait.until { _browser.find_element(:xpath => @galmgr.submit_url_btn) }.click\n Log.logger.info(\"Waiting for embed popup to disappear\")\n # wait.until { ! _browser.find_element(:xpath => @galmgr.embed_image_video) }\n Log.logger.info(\"Switching back to main frame.\")\n _browser.switch_to.default_content\n Log.logger.info(\"Waiting for overlay to disappear.\")\n wait.until { _browser.find_elements(:xpath => \"//div[@class='ui-widget-overlay']\").empty? }\n Log.logger.info(\"Overlay is gone.\")\n #Our newly inserted element will show up shortly EITHER on a new paginated page or within this context\n partial_file_name = media_url.split('/').last.split(\".\").first.gsub(\"watch?v=\", \"\")\n Log.logger.info(\"Waiting for the media-gallery-media-#{nom} we just added to show up (with a link inside and an img src that points to a file with #{partial_file_name.inspect}).\")\n #TODO: Find out if this can be handled by an \"OR\" in the xpath\n start_time = Time.now\n if switch_to_last_pagination_page()\n nom = Integer(_browser.find_elements(:xpath => media_xpath).size)\n Log.logger.info(\"Found #{nom} media items on the last page.\")\n end\n inserted_media_item_path = \"//img[contains(@src, '#{partial_file_name}')]\"\n #//div[contains(@id, 'media-gallery-media-#{nom}')].//div[contains(@class, 'media-gallery-draggable-processed')].//a[@href and contains(@class, 'media-gallery-thumb')].\n Log.logger.info(\"Waiting for #{inserted_media_item_path}\")\n wait.until { _browser.find_element(:xpath => inserted_media_item_path) }\n Log.logger.info(\"Inserted media item 'media-gallery-media-#{nom}' showed up (after #{Time.now - start_time} seconds).\")\n end #end each-loop\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Done with media file insertion\")\n end",
"def error\n nil\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def checkRetraitFail\n\n end",
"def test03_EmptyGPopDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n \t\t\t\tpostGroupPop\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV04T03: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tsleep 2\n\t\t\tassert $post_new_post.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV04T03: FAILED! User unable to Post.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend",
"def new_player_allowed?; false end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def create\n\t\tparams[:case_medium][:owner_id] = devise_current_user.id.to_s\n\t\t# Creating the case media attachments according to the surgeon\n\t\t@case_media = current_user.case_media.new(case_media_params)\n\t\tif !current_user.setting.media_upload.nil?\n\t\t\t# Condition For checking the case media attachments are store into database or not\n\t\t\t@attachment_size = check_size_attachment(@case_media)\n\t\t\t if !(@attachment_size.include? false)\n\t\t\t\tif @case_media.save\n\t\t\t\t\t# After creating the case media attachment redirect the case media edit page\n\t\t\t\t\tredirect_to edit_case_case_medium_path(@surgery_case,@case_media)\n\t\t\t\telse\n\t\t\t\t\t# If case media is not creating the that is take into the same page\n\t\t\t\t\tredirect_to :back\n\t\t\t\t\t# Showing the warning message for the if image is not uploaded\n\t\t\t\t\tflash[:notice] = \"Cannot upload more than 10 images at one go\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t # If case media is not creating the that is take into the same page\n\t\t\t redirect_to :back\n\t\t\t # Showing the warning message for the if image is not uploaded\n\t\t\t # flash[:notice] = \"each attachment size limit is not more than 64MB\"\n\t\t\t flash[:notice] = \"Attachments size limit is exceed\"\n\t\t\tend\n\t\telse\n\t\t # If case media is not creating the that is take into the same page\n\t\t\tredirect_to :back\n\t\t # Showing the warning message for the if image is not uploaded\n\t\t\tflash[:notice] = \"please assign the size limit of the attachment in media upload settings\"\n\t\tend\n\tend",
"def set_attributes\n attr_accessor :media_errors\n end",
"def error_mode; end",
"def check_res!\n unless EnergySystem.find_by_id(@current_res)\n flash[:alert] = \"Please select an energy system or create a new one.\"\n redirect_to(root_path)\n end\n end",
"def newProgramme()\n @media_operation = :create\n end",
"def error?\n true\n end",
"def stop_if_public\n return true if destroyable_even_if_public\n @media_element = Valid.get_association self, :id\n if @media_element.try(:is_public)\n errors.add :is_public, :undestroyable\n false\n else\n true\n end\n end",
"def error\n end",
"def error\n end",
"def error\n nil\n end",
"def delete_media_action(_browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n item = wait.until { _browser.find_element(:xpath => @galmgr.action) }\n if not item.displayed?\n Log.logger.info(\"Select bar is not visible...you haven't checked any content to delete!\")\n return\n end\n wait.until { _browser.find_element(:xpath => \"#{@galmgr.action}/option[contains(@value,'delete')]\") }.click\n JQuery.wait_for_events_to_finish(@browser)\n Log.logger.info(\"Clicking delete button.\")\n temp = wait.until { _browser.find_element(:xpath => @galmgr.confirm_delete) }\n wait.until { temp.displayed? }\n temp.click\n JQuery.wait_for_events_to_finish(@browser)\n next_body_text = wait.until { _browser.find_element(:xpath => \"//body\") }.text\n if next_body_text.include?(\"Error 503 Service Unavailable\")\n raise \"Got an error while trying to delete media items.\"\n end\n\n #are you sure?\n Log.logger.info(\"Waiting for and consuming confirmation.\")\n temp = wait.until { _browser.find_element(:xpath => @galmgr.confirm_delete) }\n wait.until { temp.displayed? }\n temp.click\n JQuery.wait_for_events_to_finish(@browser)\n end",
"def error(options = '', element_ids = {})\n if element_ids.empty?\n hide_message_blocks\n show_message_block(ERROR_BLOCK_ID, options)\n else\n hide element_ids[:error_block], element_ids[:success_block]\n show_message_block(element_ids[:error_block], options)\n end\n end",
"def new_player_required?; false end",
"def media_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.media_url = params[:media_url]\n if ar_object.save\n @messages = 'media updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.media_domid(ar_object),\n render(:partial => \"/main/media_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end",
"def validate_maximum_media_elements_folder_size\n errors.add :media, :folder_size_exceeded if Media::Uploader.maximum_media_elements_folder_size_exceeded?\n end",
"def error?\n false\n end",
"def check_gallery_status_message(gal_name, action = \"deleted\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n begin\n m_t = wait.until { @browser.find_element(:xpath => \"//div[contains(@class, 'messages status')]\") }\n rescue\n m_t = wait.until { @browser.find_element(:xpath => \"//div[contains(@class, 'messages error')]\") }\n end\n message = m_t.text\n if (action == \"deleted\")\n expected_message = \"Gallery #{gal_name} has been deleted.\"\n elsif (action == \"blocks_update\")\n expected_message = \"The block settings have been updated.\"\n else\n expected_message = \"Gallery #{gal_name} has been updated.\"\n end\n message.should include(expected_message)\n end",
"def init_validation\n @media_element = Valid.get_association self, :id\n @user = Valid.get_association self, :user_id\n @inner_tags =\n if @tags.blank?\n Tag.get_tags_for_item(self.id, 'MediaElement')\n else\n resp_tags = []\n prev_tags = []\n @tags.split(',').each do |t|\n if t.present?\n t = t.to_s.strip.mb_chars.downcase.to_s\n if !prev_tags.include? t\n tag = Tag.find_or_initialize_by(:word => t)\n resp_tags << tag if tag.valid?\n end\n prev_tags << t\n end\n end\n resp_tags\n end\n end",
"def test04_MediaPDF\n\t\tlogin $editor_1_email, $master_password\n\t\t$browser.goto($patch_boards_pre_closed_article_new)\n\t\t\n#\t\t$post_activate_note.when_present.fire_event(\"onclick\")\n#\t\t$post_media_description.set(\"mt townsend is my favorite mountain #{random}.\")\n\t\tif $environment == 'nixon'\t\n\t\t\trepostGroupPop #category already selected in staging\n\t\tend\n\t\t$post_article_title.set(\"Mountain #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('mt townsend is my favorite mountain #{random}.')\")\n\t\tsleep 2\n\t\t$post_add_media_article.click\n\t\tfile_upload \"PDFDocument.pdf\"\n\t\t$post_now_edit.fire_event(\"onclick\")\n\t\tif $environment == 'staging'\n\t\t\tsleep 10 #loads \n\t\tend\n\t\tsleep 2\n\t\tassert $post_new_post.exists?\n\tend",
"def error?\n message.fields[0] == 'WE'\n end",
"def test05_CancelFlagMediaComment_TC_24319\n\t\tcommentMediaPop\n\t\tsleep 4\n\t\tcommentPopSubmit\n\t\tsleep 4\n\t\tcommentCancelFlag\n\t\t\n\t\tbegin \n\t\tassert $comment_flag_link.exists?\n\t\t\trescue => e\n\t\t\tputs \"IPS05T05: FAILED! User unable to flag comment!\"\n\t\t\tputs e\n\t\tend\n\tend",
"def sword_mediation\n Utility.find_element_boolean(extensions, \"sword:mediation\") || false\n end",
"def media_resource?\n true\n end",
"def verify_changed_gallery_settings(nom, cols, media_display = \"Show nothing\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Starting test for Verification of Gallery Settings done in previous test\")\n i = 0\n while i < nom\n image_xpath = \"//div[contains(@class, 'media-gallery-sortable-processed') and contains(@class, 'ui-sortable')]/div[contains(@id, 'media-gallery-media-#{i}')]\"\n @browser.find_elements(:xpath => image_xpath).should have_at_least(1).items\n @browser.find_element(:xpath => \"#{image_xpath}//div[@class='gallery-thumb-inner']/a/img\").click\n cbox = wait.until { @browser.find_element(:xpath =>\"//div[@id='cboxClose']\") } #this element is invis...needs hover or js_click\n Log.logger.info(\"Clicking cbox via js...\")\n begin\n elem = @browser.find_element(:xpath => \"//div[@id='cboxClose']\")\n script = \"arguments[0].click();\"\n @browser.execute_script(script, elem)\n rescue Exception => e\n Log.logger.info(\"Caught an exception: #{e.inspect}\")\n end\n if (media_display == \"Show nothing\")\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/span/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path.\n @browser.find_elements(:xpath => \"#{image_xpath}/.//span[contains(@class, 'media-title')]\").should be_empty\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/a/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path. Difference is a tag.\n @browser.find_elements(:xpath => \"#{image_xpath}//a//span[contains(@class, 'media-title')]\").should be_empty\n end\n if (media_display == \"Show title below\")\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/span/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path.\n @browser.find_elements(:xpath => \"#{image_xpath}//span[contains(@class, 'media-title')]\").should have_at_least(1).items\n end\n if (media_display == \"Show title on hover\")\n # Actual element is \"//div[@id='media-gallery-media-#{i}']/div/a/span/span/span[contains(@class, 'media-title')]\". Asertion is for relative path. Difference is a tag.\n @browser.find_elements(:xpath => \"#{image_xpath}//a//span[contains(@class, 'media-title')]\").should have_at_least(1).items\n end\n i += 1\n end\n @browser.find_elements(:xpath => \"//div[contains(@class, 'content')]/div[contains(@class, 'mg-col-#{cols}')]\").should have_at_least(1).items\n # NOTE: This last four assertions will only work if the gallery has number of images more than nom.\n @browser.find_elements(:xpath => \"//a[contains(@title, 'Go to page 2')]\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//a[contains(@title, 'Go to next page')]\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//a[contains(@title, 'Go to last page')]\").should have_at_least(1).items\n @browser.find_elements(:xpath => \"//div[contains(@class, 'media-gallery-sortable-processed') and contains(@class, 'ui-sortable')]/div[contains(@id, 'media-gallery-media-#{nom}')]\").should be_empty\n end",
"def picture_validation\n if picture.attached?\n if picture.blob.byte_size > 2000000\n picture.purge\n errors[:base] << 'Maksymalny rozmiar logo klanu to 2MB'\n elsif !picture.blob.content_type.starts_with?('image/')\n picture.purge\n errors[:base] << 'Zły format'\n end\n else\n errors[:base] << 'Logo klanu jest obowiązkowe.'\n end\n end",
"def mensaje_error\n\t\tmensaje_error_element.text\n\tend",
"def verify_image_not_in_use\r\n if @image.player_characters.size > 0 || @image.creatures.size > 0 || @image.features.size > 0\r\n flash[:notice] = 'Cannot delete \"' + @image.name + '\", it is in use.'\r\n false\r\n else\r\n true\r\n end\r\n end",
"def set_question_media\n\t\t@question_media = QuestionMediaAttachment.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Question Media Attachment ID !'}, status: 400 if @question_media.nil?\n\tend",
"def validate\n if (errors.empty?) then \n if (plugin.nil?) then \n errors.add_to_base(\"Plugin may not be nil\"); \n elsif (plugin.new_record?) then \n errors.add_to_base \"Can't attach to unsaved plugin #{plugin.name}\" \n end \n end\n end",
"def error\n @error = flash[:error]\n if @error.nil?\n @error = \"No errors! You have reached this page in error.\"\n end\n end",
"def test04_DraftEmptyGPopDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\tsleep 2\n\t\t\t\tsleep 4\n\t\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\telse puts \"PDEV04T04: FAILED! UUser unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_draft_error.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PDEV04T04: FAILED! User able to save incomplete draft.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend"
] | [
"0.63747287",
"0.5950261",
"0.590259",
"0.5877903",
"0.57182795",
"0.5624235",
"0.54531837",
"0.5447904",
"0.54159355",
"0.5407462",
"0.540742",
"0.53515553",
"0.53004056",
"0.5252276",
"0.52428377",
"0.52267224",
"0.5198166",
"0.51672584",
"0.5161317",
"0.5160924",
"0.515516",
"0.51550287",
"0.514497",
"0.5131113",
"0.511942",
"0.5097679",
"0.5090536",
"0.5082577",
"0.506893",
"0.50567174",
"0.5050752",
"0.50394773",
"0.50294054",
"0.5028259",
"0.50273556",
"0.5017356",
"0.5017356",
"0.5017356",
"0.5014664",
"0.5009406",
"0.5006663",
"0.50066495",
"0.49930316",
"0.49886113",
"0.49871668",
"0.49871668",
"0.49871668",
"0.49871668",
"0.49871668",
"0.49871668",
"0.49871668",
"0.49871668",
"0.49871668",
"0.4965187",
"0.49584213",
"0.4957748",
"0.4957748",
"0.4957748",
"0.4957748",
"0.49495584",
"0.49485308",
"0.49452516",
"0.49423477",
"0.49423477",
"0.49423477",
"0.49423477",
"0.49423477",
"0.49423477",
"0.49423477",
"0.49289927",
"0.49261034",
"0.49241665",
"0.4923548",
"0.49235195",
"0.49192375",
"0.491754",
"0.49169722",
"0.49112335",
"0.49071884",
"0.49067238",
"0.49063382",
"0.490267",
"0.4894869",
"0.48794007",
"0.4870874",
"0.48676848",
"0.48622885",
"0.48558453",
"0.48520246",
"0.4848798",
"0.48375115",
"0.4832673",
"0.48321933",
"0.48314106",
"0.48301092",
"0.48280966",
"0.48221272",
"0.48185426",
"0.4817202",
"0.48146385"
] | 0.5451369 | 7 |
Description Action that calls the uploader, casts the type, and creates the new element Mode Html | def create
media = params[:media]
record = MediaElement.new :media => media
record.title = params[:title_placeholder] != '0' ? '' : params[:title]
record.description = params[:description_placeholder] != '0' ? '' : params[:description]
record.tags = params[:tags_value]
record.user_id = current_user.id
record.save_tags = true
if record.save
if !record.image?
Notification.send_to(
current_user.id,
I18n.t("notifications.#{record.class.to_s.downcase}.upload.started.title"),
I18n.t("notifications.#{record.class.to_s.downcase}.upload.started.message", :item => record.title),
''
)
end
else
if record.errors.added? :media, :too_large
return render :file => Rails.root.join('public/413.html'), :layout => false, :status => 413
end
@errors = convert_media_element_error_messages record.errors
end
render :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_uploader\n # TODO\n end",
"def new\n @upload = Upload.new\n @upload.tmp_content_type = params[:content_type]\n\n upload_type = [\"image\",\"document\"].delete(params[:type])\n \n\n respond_to do |format|\n format.html { \n layout = true\n layout = \"ajax\" if request.xhr?\n layout = params[:layout].to_s.strip==\"false\" ? false : params[:layout] if [\"false\",\"ajax\",\"dialog\"].include?(params[:layout].to_s.strip)\n if upload_type\n render :action => \"new_\"+upload_type,:layout=>layout \n else\n render :layout => layout\n end\n } # new.html.erb\n format.xml { render :xml => @upload }\n end\n end",
"def new\n @upload = Upload.new\n @upload.tmp_content_type = params[:content_type]\n\n upload_type = [\"image\",\"document\"].delete(params[:type])\n \n\n respond_to do |format|\n format.html { \n layout = true\n layout = \"ajax\" if request.xhr?\n layout = params[:layout].to_s.strip==\"false\" ? false : params[:layout] if [\"false\",\"ajax\",\"dialog\"].include?(params[:layout].to_s.strip)\n if upload_type\n render :action => \"new_\"+upload_type,:layout=>layout \n else\n render :layout => layout\n end\n } # new.html.erb\n format.xml { render :xml => @upload }\n end\n end",
"def upload\n create_document\n \n render_upload\n end",
"def ftype() end",
"def upload_document\n render template: \"/dash/chooser/upload_document\"\n end",
"def create\n\n responds_to_parent do\n render :update do |page|\n page.replace_html('resposta', \"<p>Parabéns! A sua imagem foi enviada com sucesso.</p>\")\n page.visual_effect :highlight, \"resposta\"\n page.replace_html('form_upload', :partial => 'form')\n end\n end\n\n end",
"def upload_image\n render template: \"/dash/chooser/upload_image\"\n end",
"def custom_file_browser_field(name, title, id,*args)\n args[0] ||= {}\n args.first[:col] ||= \"8\"\n @template.content_tag :div, class: \"mdl-cell--#{args.first[:col]}-col mdl-cell--#{args.first[:col]}-col-tablet ml-color--shades-white m-8\" do\n @template.content_tag :div, class: \"mdl-grid mdl-grid--no-spacing\" do\n div = @template.content_tag :div, class: \"mdl-cell--6-col mdl-cell--6-col-tablet ekitpage\" do\n @template.content_tag :div, class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label disableinput\" do\n # str = file_field(name, id: id, class: \"upload\")\n str = label(title, options[:label])\n end \n end\n div += @template.content_tag :div, class: \"mdl-cell--1-col mdl-cell--1-col-tablet fileUpload thems-imgupload\" do\n str = file_field(name, id: id[:id], class: \"upload\")\n end\n div += @template.content_tag :div, class: \"mdl-cell--5-col mdl-cell--5-col-tablet\" do\n @template.label(\"\", \"\", class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label file_name\", id: \"1#{id[:id]}\" )\n end\n end\n end \n end",
"def custom_file_browser_field(name, title, id,*args)\n args[0] ||= {}\n args.first[:col] ||= \"8\"\n @template.content_tag :div, class: \"mdl-cell--#{args.first[:col]}-col mdl-cell--#{args.first[:col]}-col-tablet ml-color--shades-white m-8\" do\n @template.content_tag :div, class: \"mdl-grid mdl-grid--no-spacing\" do\n div = @template.content_tag :div, class: \"mdl-cell--6-col mdl-cell--6-col-tablet ekitpage\" do\n @template.content_tag :div, class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label disableinput\" do\n # str = file_field(name, id: id, class: \"upload\")\n str = label(title, options[:label])\n end \n end\n div += @template.content_tag :div, class: \"mdl-cell--1-col mdl-cell--1-col-tablet fileUpload thems-imgupload\" do\n str = file_field(name, id: id[:id], class: \"upload\")\n end\n div += @template.content_tag :div, class: \"mdl-cell--5-col mdl-cell--5-col-tablet\" do\n @template.label(\"\", \"\", class: \"mdl-textfield mdl-js-textfield mdl-textfield--floating-label file_name\", id: \"1#{id[:id]}\" )\n end\n end\n end \n end",
"def upload_file\n #Load upload view\n #render the view \"upload_file\"\n end",
"def html_actions_panel(node, output)\n return nil unless node.is_a?(ICollection)\n\n # We also know fairly certain that if an object is a non-extended\n # SimpleCollection, we won't need to show the panel either.\n return nil if node.class == Tilia::Dav::SimpleCollection\n\n output.value << <<FORM\n<form method=\"post\" action=\"\">\n <h3>Create new folder</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"mkcol\" />\n <label>Name:</label> <input type=\"text\" name=\"name\" /><br />\n <input type=\"submit\" value=\"create\" />\n</form>\n<form method=\"post\" action=\"\" enctype=\"multipart/form-data\">\n <h3>Upload file</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"put\" />\n <label>Name (optional):</label> <input type=\"text\" name=\"name\" /><br />\n <label>File:</label> <input type=\"file\" name=\"file\" /><br />\n <input type=\"submit\" value=\"upload\" />\n</form>\nFORM\n end",
"def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end",
"def new_elem\n @type_name = params[:type]\n @name =eval(@type_name).to_p_name\n @parent_id = params[:parent_id]\n end",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def save_elem\n type = params[:type_name]\n\n parent_id = params[:parent_id].nil?? -1:params[:parent_id]\n\n if request.post? and elem = eval(type).new(params[:type])\n case type\n when \"ProcessModel\"\n elem.date = Time.now\n elem.author_id = User.current.id\n when \"Activity\"\n elem.model_id = parent_id\n when \"Action\"\n elem.activity_id = parent_id\n when \"PfTask\"\n elem.action_id = parent_id\n end\n elem.save\n flash[:notice] = l(:notice_successful_update)\n else\n flash[:notice] = \"failed!\"\n return\n end\n if parent_id==-1\n redirect_to :action => 'index', :tab =>params[:type_name]\n else\n redirect_to :action =>'show_subs',:parent_id => parent_id, :parent_type => elem.class.get_parent_name\n end\n end",
"def edit_form\n parsed = Namae::Name.parse(current_user.name)\n generic_file = ::GenericFile.new(creator: [parsed.sort_order], title: @batch.generic_files.map(&:label))\n edit_form_class.new(generic_file)\n end",
"def create\n # Get the content type\n content_type = params[:file].content_type\n asset_params = {name: params[:file].original_filename, filename: params[:file]}\n\n # Create the appropriate model\n if content_type.split(\"/\").first == \"image\"\n @asset = Assetabler::Image.new(asset_params)\n elsif content_type.split(\"/\").first == \"video\"\n @asset = Assetabler::Video.new(asset_params)\n elsif content_type.split(\"/\").first == \"application\"\n @asset = Assetabler::Document.new(asset_params)\n end\n\n # Return\n @fieldname = params[:fieldname]\n @uploader_id = params[:uploader_id]\n if @asset.errors.empty? and @asset.save\n render :create\n else\n render :error\n end\n end",
"def create\n image_params = params[:ueditor_image] || {}\n self._create(image_params[:data], image_params[:title])\n # input: { fileName:'', Filename:'', pictitle: '', dir:'', 'file_file_name':'', upfile:'', Upload:submit_button_value, otherparam123:xx}\n # output: { url:'', title:'', original:'', state:'SUCCESS'}\n end",
"def admin_edit_prep\n\n @artist = Artist.find_by_url_slug(params[:url_slug])\n authorize! :admin, @artist\n\n @artist_test=\"blah\"\n\n image_upload_prep(@artist)\n\n @form = render_to_string('artists/_form',:layout => false)\n\n #varable to remove defualt artist loading. Loads the edit layout insted\n @edit = \"true\" #see new\n\n layout(params[:layout])\n\n\n\n end",
"def upload\n end",
"def upload\n end",
"def new\n @resource = Resource.new\n @type = 'file' if params[:type] == 'file'\n respond_to do |format|\n format.html{}\n end\n end",
"def create\n @file_upload = FileUpload.new(params[:file_upload])\n\n respond_to do |wants|\n if @file_upload.save\n flash[:notice] = 'File was successfully uploaded.'\n wants.html { redirect_to(@file_upload) }\n wants.xml { render :xml => @file_upload, :status => :created, :location => @file_upload }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @file_upload.errors, :status => :unprocessable_entity }\n end\n\t\t\twants.js { responds_to_parent do; render :action => 'create', :layout => false; end }\n end\n end",
"def upload\n respond_to do |format|\n format.html # upload.html.erb\n end\n end",
"def upload_simple\r\n \r\n end",
"def create\n create_document\n\n respond_to do |format|\n if @node.new_record?\n @node.skin_id ||= current_site.root_node.skin_id\n\n flash.now[:error] = _(\"Upload failed.\")\n unless @node.respond_to?('target_klass')\n # Could we find another way to fake the new object as acting like a template ?\n class << @node\n def target_klass; nil; end\n end\n end\n format.html { render :action => 'new'}\n else\n flash.now[:notice] = _(\"Upload succeeded.\")\n format.html { redirect_to document_url(@node[:zip]) }\n end\n end\n end",
"def upload_from_ck\n begin\n #TODO translate, dynamics messages\n uploaded_item = params[:item_type].classify.constantize.new(:title => params[:upload].original_filename,\n :description => \"uploaded from FCK\",\n params[:item_type].to_sym => params[:upload],\n :user_id => current_user.id\n )\n # TODO containers\n if params[:ws_id].nil?\n uploaded_item.associated_workspaces = [@current_user.private_workspace.id.to_s]\n else\n uploaded_item.associated_workspaces = [@current_user.private_workspace.id.to_s, params[:ws_id]]\n end\n\n if uploaded_item.save\n\n #message contains the HTML code to insert in the ck editor\n case params[:item_type]\n when \"image\"\n message = upload_image(uploaded_item)\n when \"video\"\n \n message = upload_video(uploaded_item)\n when \"audio\"\n message = upload_audio(uploaded_item)\n else\n render :text => '<script type=\"text/javascript\">$(\\'#notice\\').showMessage(\"no type available\", 1500);</script>'\n end\n \n else\n render :text => '<script type=\"text/javascript\">$(\\'#notice\\').showMessage(\"error while saving\", 1500);</script>'\n end\n \n render :text => message\n \n rescue Exception => e\n logger.error(e.to_s + \"\\n\" + e.backtrace.collect { |trace|' ' + trace + \"\\n\" }.to_s)\n #TODO -> display error in notice on top (or error in fck erorrs) \n render :text => '<script type=\"text/javascript\">$(\\'#notice\\').showMessage(\"error during transfer\", 1500);</script>', :layout => false\n end\n end",
"def upload\n @active_link = \"upload\"\n @post = generate_post(session_obj, {:is_upload=>true})\n render :new\n end",
"def upload\r\n \r\n end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/image.html.erb\"\n else\n \"#{DirMap.html_views}/fields/image.html.erb\"\n end\n end",
"def create_attachment\n @mode = params[:mode]\n logger.debug \"==== Create attachment ====\"\n frbr_model_as_string = params[:frbr][:object]\n @mode = params[:attachment_mode][:mode]\n @frbr_object = convert_id_to_model(frbr_model_as_string)\n klass = @frbr_object.class.to_s.underscore\n \n logger.debug \"Klass is #{klass}\"\n \n valid = false\n begin MediaItem.transaction \n @media_item = MediaItem.new(params[:media_item])\n @media_item.updated_by = @login.login_id\n logger.debug \"** MEDIA ITEM UPDATED BY IS #{@media_item.updated_by}\"\n logger.debug @media_item.to_yaml\n @media_item.save \n logger.debug \"MEDIA ITEM SAVED\"\n \n #Create a new class for the attachment, such as SampleAttachment, VenueAttachment etc\n attachment_class_string = @frbr_object.class.to_s+\"Attachment\"\n attachment_class_string.gsub!(\"CampaignMailout\", \"Mailout\") #fix for attachment table with non standard name\n attachment_class = attachment_class_string.constantize\n @klass_attachment = attachment_class.send('new')\n \n logger.debug \"KLASS attachment is #{@klass_attachment}\"\n logger.debug \"Sending to klass_attachment: #{klass}_id, #{@frbr_object.id}\"\n @klass_attachment.send(klass+\"_id=\",@frbr_object.id)\n #@klass_attachment.send(\"manifestation_id\",@frbr_object.id)\n logger.debug \"klass attachment is now #{@klass_attachment.to_yaml}\"\n @klass_attachment.media_item = @media_item\n \n if @klass_attachment.respond_to?('attachment_type_id')\n if @mode == 'tiny_mce'\n @klass_attachment.attachment_type_id = AttachmentType::TINY_MCE.attachment_type_id\n else\n \n \n #get the attachment type from the drop down\n type_id = params[:attachment_type][:attachment_type_id]\n logger.debug \"TYPE_ID: #{type_id}\"\n raise ArgumentError, \"Please provide an attachment type\" if type_id.blank?\n \n #now check its valid\n new_attachment_type = AttachmentType.find(type_id)\n raise ArgumentError, \"The selected attachment type of id #{type_id} is invalid\" if new_attachment_type.blank?\n logger.debug \"NEW ATT TYPE: #{new_attachment_type}\"\n @klass_attachment.attachment_type = new_attachment_type\n \n end\n end\n \n @klass_attachment.save\n valid = @frbr_object.save # This will save the attachment\n logger.debug \"Media Item created\"\n #Rescue a failed transaction\n rescue Exception => e\n logger.debug \"Transaction was invalid\"\n logger.debug \"AttachmentException: #{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n @error_message = \"The upload failed, the error was #{e.message}\"\n valid = false\n end\n\n respond_to do |format|\n if valid\n logger.debug \"Valid response\"\n flash[:attachment] = 'MediaItem was successfully created.'\n \n #This is rather naughty... \n #See http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent for background\n #Without the option of forcing .js routing from a form tag (as opposed to remote form tag) the\n #HTML response is doing javascript manipulation of the page\n format.html do\n logger.debug \"VALID RESPONSE, HTML\"\n responds_to_parent do\n @media_items = attachments(@frbr_object)\n render :update do |page|\n edit_media_item_form = 'shared/attachments/edit_media_item'\n # special case for campaign mailouts\n edit_media_item_form = 'campaign_mailouts/media_item' if @frbr_object.class.to_s.match('CampaignMailout')\n \n page.insert_html :bottom, \"attachments_\"+generate_id(@frbr_object),\n :partial => edit_media_item_form, :locals => {:object => @frbr_object, :media_item => @media_item, :mode => @mode.to_sym}\n #Clear the text field of the image upload\n # page.replace_html 'uploadWidget', :partial => 'shared/attachments/upload_widget'\n page.replace_html 'new_attachment_form_'+generate_id(@frbr_object), :partial => 'shared/attachments/new_attachment_form_button', :locals => {:object => @frbr_object, :mode => @mode.to_sym}\n \n page.visual_effect :highlight, generate_id(@media_item)\n \n end\n end\n end\n format.xml { head :created, :location => media_item_url(@media_item) }\n \n else\n logger.debug \"Response for invalid option\"\n flash[:attachment] = 'The file upload failed for some reason'\n \n #Ensure rendering in case where user does not select an attachment type\n @attachment_type = AttachmentType.new if @attachment_type.blank?\n format.html { \n #prepare_edit\n get_attachment_types(@frbr_object)\n responds_to_parent do\n render :update do |page|\n \n dom_id = 'new_attachment_form_'+generate_id(@frbr_object)\n \n page.replace_html dom_id,\n :partial => 'shared/attachments/attachment_form',\n :locals => {:object => @frbr_object, :submission => :new, :media_item => @media_item, :mode => @mode}\n page.visual_effect :shake, dom_id\n page << \"alert('#{@error_message}');\"\n end\n end\n }\n format.xml { render :xml => @media_item.errors.to_xml }\n \n end\n end\n end",
"def new\n @file_upload = FileUpload.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @file_upload }\n end\n end",
"def create\n @screen_self = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n @save_as_new_copy = params[:save_as_new_copy]\n\n @field = params['field']['type'].constantize.new(params[:field])\n @field.display_seq = @field.screen.fields.count + 1\n\n @field.save\n\n respond_to do |format|\n format.html # create.html.erb\n format.xml { render :xml => @field }\n end\n end",
"def uploader_string(contributor_type, contributor_id, html_required, show_leading_text=true)\n res = show_leading_text ? \"Uploader: \" : \"\"\n \n case contributor_type.downcase\n when \"user\"\n user = User.find(contributor_id)\n if html_required\n res += \"<a href=#{Conf.base_uri}/users/#{contributor_id}>#{user.name}</a>\"\n else\n res += user.name + \" (profile: #{Conf.base_uri}/users/#{contributor_id})\"\n end\n when \"network\"\n group = Network.find(contributor_id)\n if html_required\n res += \"<a href=#{Conf.base_uri}/groups/#{contributor_id}>\\\"#{group.title}\\\" group</a>\"\n else\n res += group.title + \" (profile: #{Conf.base_uri}/groups/#{contributor_id})\"\n end\n else\n res += \"unknown (contributor_type: #{contributor_type}; contributor_id: #{contributor_id})\"\n end\n \n return res\n end",
"def create\n\n # If it's an image place it into the content directory and create a new url\n if( params[:medium][:category] == \"image\")\n tmp = params[:my_file];\n directory = 'content'\n newFileName = String(Time.now.to_i) + File.extname(tmp.original_filename);\n newFilePath = Rails.root.join('public', directory, newFileName)\n File.open(newFilePath, 'w') { |file|\n file.write(tmp.read)\n }\n # Remove the attribute from params and set the url\n params[:medium].delete('my_file');\n params[:medium][:url] = directory + \"/\" + newFileName;\n end\n\n @medium = Medium.new( params[:medium])\n\n respond_to do |format|\n if @medium.save\n format.html { render :xml => @medium, :status => :created, :location => @medium }\n format.js { render :xml => @medium, :status => :created, :location => @medium }\n format.xml { render :xml => @medium, :status => :created, :location => @medium }\n else\n format.html { render :xml => @medium, :status => :created, :location => @medium }\n format.js { render :xml => @medium, :status => :created, :location => @medium }\n format.xml { render :xml => @medium, :status => :created, :location => @medium }\n end\n end\n end",
"def ftype\n :file\n end",
"def create\n Rails.logger.debug \"File type is: #{params[:upload].content_type}\"\n @parser = Import::Parser.new\n @parser.parse(params[:upload])\n\n if @parser.valid?\n @processor = Import::VehicleImporter.new(current_account, current_user)\n @processor.store(params[:upload].original_filename, @parser.data)\n else\n flash.now[:error] = @parser.errors[0]\n render :action => \"index\"\n end\n end",
"def new\n render :layout => 'media_element_editor'\n end",
"def mime_type=(_); end",
"def call\n context.replace_file_id = case context.mime_type\n when %r{audio/.*}, %r{.*/ogg} # Audio\n bot.api.send_chat_action(\n chat_id: context.telegram_user.id,\n action: 'upload_audio'\n )\n context.file = file_id_to_converted_file(context.file_id)\n true\n else\n raise InvalidMimeTypeError\n end\n\n context.sound = Sound.create(\n uploader: context.user,\n title: context.title.strip,\n )\n\n context.tags = context.tags&.split(',')&.map(&:strip)&.map do |tag_content|\n next nil unless tag_content.strip.length > 0\n\n tag = Tag.find_or_create(content: tag_content)\n context.sound.add_tag(tag)\n tag\n end\n context.tags&.compact!\n\n context.sound.save_changes\n\n rescue InvalidMimeTypeError\n context.fail!(error: :invalid_mime_type)\n\n rescue ConversionError\n context.fail!(error: :conversion_error)\n\n end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def mime_type; end",
"def pshr_uploader(upload)\n render 'pshr/uploads/uploader', upload: upload\n end",
"def create\n create_entry\n \n # Redirect to entry view to show the new element\n redirect_to show_entry_path(params[:type], @entry[:id])\n end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def mime_type=(_arg0); end",
"def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/fields/image-and-text.html.erb\"\n else\n \"#{DirMap.html_views}/fields/image-and-text.html.erb\"\n end\n end",
"def to_subtype\n elem = wd()\n tag_name = elem.tag_name.downcase\n\n klass = nil\n\n if tag_name == \"input\"\n klass = case elem.attribute(:type)\n when *Button::VALID_TYPES\n Button\n when 'checkbox'\n CheckBox\n when 'radio'\n Radio\n when 'file'\n FileField\n else\n TextField\n end\n else\n klass = Watir.element_class_for(tag_name)\n end\n\n klass.new(@parent, :element => elem)\n end",
"def content_element_form_extension(context={})\n \n app = context[:app]\n \n locals = {:photo_album => SystemConfiguration::Variable.get('content_album_name').value, \n :width => SystemConfiguration::Variable.get('content_album_photo_width').value, \n :height => SystemConfiguration::Variable.get('content_album_photo_height').value}\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form_extension = renderer.render('formextension', 'em', locals)\n \n \n end",
"def toggle_type\n @document = Document.toggle_type(params[:document_id])\n if @document.content_type == 1\n @document.content = markdown_to_html(@document.content)\n @document.save\n else\n @document.content = html_to_markdown(@document.content)\n @document.save\n end\n @task = Task.find(@document.task_id)\n respond_to do |format|\n format.html {render :new }\n end\n end",
"def attachment_tag(object_name, method, options={})\n variable = instance_variable_get(\"@#{object_name}\")\n html = []\n html << '<!-- Generated from Lipsiadmin -->'\n\n unless options[:only_upload]\n html << '<ul id=\"' + \"#{method}-order\" + '\" class=\"label\">'\n\n if attachment = variable.send(method)\n # Create first the remove link\n remove_link = link_to_remote(tl(:remove), :url => \"/backend/attachments/#{attachment.id}\",\n :method => :delete,\n :success => \"$('#{method}_#{attachment.id}').remove();\")\n\n if options[:image]\n fstyle = \"float:left;margin:5px;margin-left:0px;\"\n fclass = \"box-image\"\n ftag = '<div>' + image_tag(attachment.url(:thumb)) + '</div>'\n ftag += '<div style=\"text-align:center;padding:5px;cursor:pointer\">'\n ftag += ' ' + remove_link\n ftag += '</div>'\n else\n fstyle = \"padding:5px;border-bottom:1px solid #DDE7F5;\"\n fclass = \"box-file\"\n ftag = '<div style=\"float:left;cursor:pointer\">'\n ftag += ' ' + link_to(attachment.attached_file_name, attachment.url) + ' ' + number_to_human_size(attachment.attached_file_size)\n ftag += '</div>'\n ftag += '<div style=\"float:right;cursor:pointer\">'\n ftag += ' ' + remove_link\n ftag += '</div>'\n ftag += '<br style=\"clear:both\" />'\n end\n\n html << '<li id=\"' + \"#{method}_#{attachment.id}\" + '\" class=\"' + fclass + '\" style=\"' + fstyle + '\">'\n html << ' ' + ftag\n html << '</li>'\n end # End of Loop\n\n html << '</ul>'\n html << '<br style=\"clear:both\" />'\n end\n\n flbl = options[:image] ? :upload_image : :upload_file\n html << '<div class=\"label-title\">' + tl(flbl) + '</div>'\n html << '<table>'\n rowa = ' <tr class=\"attachment\">'\n rowa << ' <td>' + human_name_for(:attachment, :attached_file_name) + '</td>'\n rowa << ' <td>' + file_field_tag(\"#{object_name}[#{method}_attributes][file]\", :style => \"width:250px\") + '</td>'\n rowa << ' </tr>'\n html << rowa\n html << '</table>'\n html.join(\"\\n\")\n end",
"def set_type\n end",
"def upload\n do_upload(self.class.upload_class)\n end",
"def create_fake\n record = MediaElement.new\n record.title = params[:title_placeholder] != '0' ? '' : params[:title]\n record.description = params[:description_placeholder] != '0' ? '' : params[:description]\n record.tags = params[:tags_value]\n record.user_id = current_user.id\n record.save_tags = true\n record.valid?\n @errors = convert_media_element_error_messages record.errors\n @errors[:media] = t('forms.error_captions.media_file_too_large').downcase\n end",
"def create\n @attachment = Attachment.new\n @entries = Entry.find(:all, :order => \"updated_at DESC\").map { |e| [e.title, e.id] }\n #Since we're using swfUpload, the file will be in params[:Filedata]\n #We need to change the content_type since swfUpload messes it up\n params[:Filedata].content_type = MIME::Types.type_for(params[:Filename]).to_s\n\n #Set the object to be the file uploaded\n @attachment.object = params[:Filedata]\n #Set the entry_id if there is one\n @attachment.entry_id = params[:entry_id]\n\n if @attachment.save\n flash[:notice] = 'Attachment was successfully created.'\n output = @attachment.object_file_name + \" successfully uploaded\";\n if params[:entry_id]\n output += \" to \"+Entry.find(params[:entry_id]).title\n end\n render :text => output\n else\n flash[:error] = 'Attachment creation failed.'\n render :action => \"edit\"\n end\n end",
"def update\n @type = Type.find(params[:id])\n if params[:type]['temp_title'] && params[:type]['temp_description']\n @type.name = params[:type]['temp_title']\n @type.description = params[:type]['temp_description']\n @type.image = params[:type]['temp_image']\n end\n @type.active = true\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def html=(klass); end",
"def new\n @storage_type = parent.storage_types.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @storage_type }\n format.js\n end\n end",
"def create\n @mode = 'I'\n render 'admin/slides/slide'\n end",
"def create\n if params.has_key?(:number_of_files) and params[:number_of_files] != \"0\"\n return redirect_to({:controller => \"catalog\", :action => \"edit\", :id => params[:id], :wf_step => :files, :number_of_files => params[:number_of_files], :anchor=>\"uploader\"})\n elsif params.has_key?(:number_of_files) and params[:number_of_files] == \"0\"\n return redirect_to( {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow) )\n end\n \n if params.has_key?(:Filedata)\n @file_assets = create_and_save_file_assets_from_params\n notice = []\n @file_assets.each do |file_asset|\n apply_depositor_metadata(file_asset)\n \n notice << \"The file #{file_asset.label} has been saved in <a href=\\\"#{asset_url(file_asset.pid)}\\\">#{file_asset.pid}</a>.\"\n \n if !params[:container_id].nil?\n associate_file_asset_with_container(file_asset,params[:container_id])\n end\n \n ## Apply any posted file metadata\n unless params[:asset].nil?\n logger.debug(\"applying submitted file metadata: #{@sanitized_params.inspect}\")\n apply_file_metadata\n end\n # If redirect_params has not been set, use {:action=>:index}\n logger.debug \"Created #{file_asset.pid}.\"\n end\n flash[:notice] = notice.join(\"<br/>\") unless notice.blank?\n else\n flash[:notice] = \"You must specify a file to upload.\"\n end\n \n if !params[:container_id].nil?\n redirect_params = {:controller => \"catalog\", :action => \"edit\", :id => params[:container_id]}.merge(params_for_next_step_in_wokflow)\n end\n redirect_params ||= {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow)\n \n redirect_to redirect_params\n end",
"def newProgramme()\n @media_operation = :create\n end",
"def media_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.media_url = params[:media_url]\n if ar_object.save\n @messages = 'media updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.media_domid(ar_object),\n render(:partial => \"/main/media_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end",
"def fleximage_editor\n \n ar_object = Kernel::const_get(params[:ar_object_class]).find(params[:ar_object_id])\n display_editor = (params[:display_editor] == \"false\")\n display_thumbnail = (params[:display_thumbnail] == \"true\")\n \n render :update do |page| \n page.replace(MainController.fleximage_domid(ar_object),\n render(:partial => \"/main/media_edit\", \n :locals => {:ar_object => ar_object, \n :timestamp => nil,\n :display_thumbnail => display_thumbnail, \n :display_editor => display_editor})\n )\n\t\tend\n end",
"def change doc, class_name, card\n xpath = \"//a[@class='#{class_name}']\"\n doc.xpath(xpath).each do |dom|\n if dom.attribute('id').present?\n id = dom.attribute('id').value\n attachment = card.attachments.where(markup_id: id).first\n if attachment.present?\n attachment.kind = class_name\n attachment.save!\n end\n end\n end\nend",
"def set_media_type\n @media_type = MediaType.find(params[:id])\n end",
"def run\n @Type.run(@Content)\n end",
"def create\n @resource = Resource.new(params[:resource])\n\n @resource.assetable_id = 1\n @resource.assetable_type = 'User'\n\n if params[:resource]\n if image_types.include? params[:resource][:data].content_type\n @resource.type = 'Ckeditor::Picture'\n else\n @resource.type = 'Ckeditor::AttachmentFile'\n end\n end\n\n respond_to do |format|\n \n if @resource.save\n \n #Checking resource type for image or file and redirecting as per the lists with conditions\n if @resource.is_type_image? \n redirect_path = admin_resources_path(:type => 'image')\n else\n redirect_path = admin_resources_path(:type => 'file')\n end\n\n format.html { redirect_to redirect_path, notice: 'Resource was successfully uploaded.' }\n else\n format.html { render action: \"new\", :type => @type }\n end\n end\n end",
"def image_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.image_file_url = params[:image_file_url]\n if ar_object.save\n @messages = 'fleximage updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.image_domid(ar_object),\n render(:partial => \"/main/image_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end",
"def attachment_input(method, options = {})\n delete_attachment_link = \"delete_#{method}_link\"\n preview_id = \"#{method}_preview\"\n attachment_file_field = \"#{method}_file_field\"\n unless (attachment = @object.send(method)).blank? or (not attachment.file?)\n if (attachment.content_type =~ /^image\\/.+/) and (attachment.styles.member?(:thumbnail) or attachment.styles.member?(:edit))\n style = attachment.styles.member?(:thumbnail) ? :thumbnail : :edit\n preview = <<-HTML\n <img id=\"#{preview_id}\" src=\"#{attachment.url(style)}\" />\n HTML\n else\n preview = <<-HTML\n <a href=\"#{attachment.url}\" id=\"#{preview_id}\">#{attachment.original_filename}</a>\n HTML\n end\n end\n deleter_input_id = \"#{method}_deleter\"\n deleter_input_html = hidden_field(method.to_s + '_file_name', :value => '', :id => deleter_input_id )\n magic = <<-JAVASCRIPT\n <script type=\"text/javascript\">\n $(function() {\n $(\"##{delete_attachment_link}\").click(function() {\n $('##{preview_id}').hide();\n $('##{delete_attachment_link}').hide();\n $(this).after('#{deleter_input_html}');\n return false;\n });\n $('form').submit(function () {\n if ($('##{attachment_file_field}').val() != '') {\n $('##{deleter_input_id}').remove();\n }\n return true;\n });\n })\n </script>\n JAVASCRIPT\n ff = file_field method, {:id => attachment_file_field}.merge(options.except(:required))\n if preview\n preview << <<-HTML\n <span class=\"attachment_delete\" id=\"#{delete_attachment_link}\">(<a href=\"#delete\">Delete</a>)</span>\n HTML\n end\n l = label(method, options.delete(:label), options.slice(:required))\n\n template.content_tag(:li, <<-HTML, nil, false)\n #{l}\n #{ff}\n <div class=\"attachment_preview\">#{preview}</div>\n #{magic}\n HTML\n end",
"def create\n @image = Image.new(params[:image])\n type = @image.url_type\n #response.headers[\"Content-type\"] = \"text/plain\"\n if @image.save\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else \n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n end\n end",
"def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end",
"def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end",
"def type\n stype = \"file\"\n stype = \"atom\" if @filepath.nil? and !@metadata.empty?\n stype = \"multipart\" if !@filepath.nil? and !@metadata.empty?\n stype\n end",
"def generate_object_types_list\n #@items = options.objects if options.objects\n @items = [\n \"App Level Classes\",\n \"Entity Classes\",\n \"Collection Classes\",\n \"Geom Classes\",\n \"UI Classes\",\n \"Observer Classes\",\n \"Core Ruby Classes\"\n ]\n @list_title = \"Object Index\"\n @list_type = \"object_types\"\n\n # optional: the specified stylesheet class\n # when not specified it will default to the value of @list_type\n @list_class = \"class\"\n\n # Generate the full list html file with named feature_list.html\n # @note this file must be match the name of the type\n asset(url_for_list(@list_type), erb(:full_list))\nend",
"def upload_file\n #TODO\n end",
"def create\n @document = params[:type].constantize.new(params[params[:type].underscore.to_sym], :without_protection => false)\\\n if %w(Paper Email PhoneCall Visit ExternalPaper).include? params[:type] \n @document.set_user_info session[:user]\n #tct_logger.info \"@document.inspect: #{@document.inspect}\\n params.inspect: #{params.inspect}\"\n @document.send_now = true if params[:send_now] # only for emails\n #@document.files.first.file = params[:file] if params[:type] == 'Email'\n\n respond_to do |format|\n if @document.save\n logger.info \" --- #{params.inspect}\" if @document.type == 'Email'\n logger.info \" --- #{@document.inspect}\" if @document.type == 'Email'\n flash[:notice] = \"#{@document.type} wurde gespeichert.\"\n flash[@document.sent ? :notice : :warning] = \"Email wurde #{@document.sent ? '' : 'NICHT'} versendet.\" if @document.type == 'Email'\n format.html { redirect_to(customers_url) }\n format.xml { render :xml => @document, :status => :created, :location => @document }\n else\n tct_logger.info \"!!! Could not be saved! --- #{params.inspect}\"\n tct_logger.info \" --- #{@document.inspect}\"\n format.html { render :action => \"new\", :controller => \"#{@document.main_type.downcase}s\" }\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def pxe_image_type_form_field_changed\n return unless load_edit(\"pxe_image_type_edit__#{params[:id]}\", \"replace_cell__explorer\")\n pxe_image_type_get_form_vars\n render :update do |page|\n page << javascript_prologue\n page.replace_html(\"form_div\", :partial => \"pxe_image_type_form\") if params[:provision_type]\n changed = (@edit[:new] != @edit[:current])\n page << javascript_for_miq_button_visibility(changed)\n end\n end",
"def map_type_import_body(uploaded_file)\n { 'fileUpload' => UploadIO.new(uploaded_file, uploaded_file.content_type, uploaded_file.original_filename) }\n end",
"def element_template(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('photo', app) \n photo_template = renderer.render('view', 'em')\n \n end",
"def update_page_after_property_image_upload\n responds_to_parent do\n render :action => 'update_page_after_property_image_upload.rjs'\n end\n end",
"def create\n @admin_media_type = Admin::MediaType.new(admin_media_type_params)\n\n respond_to do |format|\n if @admin_media_type.save\n format.html { redirect_to @admin_media_type, notice: 'Media type was successfully created.' }\n format.json { render :show, status: :created, location: @admin_media_type }\n else\n format.html { render :new }\n format.json { render json: @admin_media_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload\n \tset_up_instances_variable\n \tuploaded_io = @tree.file\n \t@nome_arquivo = Rails.root.join('public', 'uploads', uploaded_io.original_filename)\n \tFile.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n \t\tfile.write(uploaded_io.read)\n \tend\n \tler_texto @nome_arquivo\n end",
"def create\n @dl_type = DlType.new(params[:dl_type])\n\tif @dl_type.dl_type\n\t\t@dl_type.type_lv = @dl_type.dl_type.type_lv + 1\n\tend\n\n respond_to do |format|\n if @dl_type.save\n format.html { redirect_to(downloads_admin_dl_types_url, :notice => 'Dl type was successfully created.') }\n format.xml { render :xml => @dl_type, :status => :created, :location => @dl_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dl_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_filetypes\n #unless params[:id] == 'download' || params == :file\n @filetype = Filetype.find(params[:id])\n # end\n end",
"def type\n \"StillImage\"\n end",
"def type\n if new_record? || image?\n 'image'\n elsif video?\n 'video'\n else\n 'text'\n end\n end",
"def complete_upload_document\n @dom_id = \"##{params[:file][:dom_id]}\"\n\n @asset = Document.new(uploaded_asset_attributes.reverse_merge(uploaded_by: current_user))\n key = @asset.add_meta(params[:file])\n if @asset.save\n @asset.update_columns(media: key)\n end\n render template: \"/dash/chooser/complete_upload\"\n end",
"def create\n if request.format == :xml\n super\n else\n passed_values = params[:asset]\n @asset = Asset.create(\n :g_u_i_d => passed_values[:g_u_i_d],\n :tag => passed_values[:tag],\n :name => passed_values[:name],\n :i_d_in_info_source => passed_values[:i_d_in_info_source],\n :status => \"1\",\n :model => Model.find_by_guid(passed_values[:model]),\n :manufacturer => Manufacturer.find_by_guid(passed_values[:manufacturer]),\n :serial_number => passed_values[:serial_number])\n Notification.create(\n :message => \"Created an Asset via HTML CRUD utility (create Asset form)\", \n :operation => \"Create\",\n :ccom_entity => @asset.guid,\n :about_user => User.find_by_id(session[:user_id]),\n :database => ActiveRegistry.find_database(session[:user_id])\n ) \n if object_type = ObjectType.find_by_guid(passed_values[:object_type])\n @asset.update_attributes(:object_type => object_type)\n else\n @asset.update_attributes(:object_type => ObjectType.undetermined)\n end\n \n ref_valid_network = ValidNetwork.find_by_guid(passed_values[:valid_network])\n valid_network = ref_valid_network.nil? ? nil : ref_valid_network.dup_entity(:gen_new_guids => true)\n @asset.update_attributes( :valid_network => valid_network)\n\n respond_to do |format|\n if @asset.save\n flash[:notice] = \"Asset was saved into database at #{@asset.last_edited}\"\n format.html { redirect_to(@asset) }\n else\n @types = get_all_asset(:object_type)\n @manufacturers = get_all_asset(:manufacturer)\n @models = get_all_asset(:model)\n @networks = define_networks()\n format.html { render :action => \"new\" }\n end\n end\n end\n end",
"def upload_show(upload_filename)\n upload_var = \"file\"\n up_sym = upload_var.to_sym\n up_show = show do\n title \"Upload Your Measurements\"\n note \"Select and Upload: #{upload_filename}\"\n upload var: \"#{upload_var}\"\n end\n return up_show, up_sym\n end",
"def form_type\n return '<form accept-charset=\"UTF-8\" action=\"/jobs\" class=\"new_job\" enctype=\"multipart/form-data\" id=\"job_form\" method=\"post\">'\n end",
"def edit\n\n @resource = Resource.find(params[:id])\n @resource.type = 'Resource'\n @type = 'file' if params[:type] == 'file'\n\n end",
"def create_easy_type_source\n create_source(TYPE_TEMPLATE, type_path)\n end",
"def collectible_editpic_button decorator, size=nil, styling={}\n entity = decorator.object\n if policy(entity).update? \n if size.is_a? Hash\n size, options = nil, size\n end\n button = button_to_submit styling.delete(:label),\n polymorphic_path( [:editpic, decorator.as_base_class], styling: styling),\n 'glyph-upload',\n size,\n styling.merge(mode: :modal, title: 'Get Picture')\n # content_tag :div, button, class: 'upload-button glyph-button'\n end\n end",
"def upload\n\n\t\t@uploads = Idea.find(params[:id]).uploads\n\t\t@idea = params[:id]\n\t\t@idea_obj = Idea.find(@idea)\n\n\t\t# allows user to delete files\n\t\t@delete = true\n\n\t\t@path = [link_to_ideas, link_to_idea_uploads(@idea_obj)]\n\t\t@subnavigation = [active_link_to_idea_uploads(@idea_obj), link_to_idea(@idea_obj), link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\tend",
"def new\n @upload = Upload.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @upload }\n end\n end",
"def attachment_form(model)\n s = \"<div id=\\\"files\\\" class=\\\"files\\\">\\n <ul>\\n \"\n model.attachments.each do |attachment|\n s << \"<li><a href=\\\"#{attachment.public_path}\\\">#{attachment.name}</a> (#{a('delete', rs(:delete_attachment, model.name, attachment.name))})</li>\\n\"\n end\n s << \"</ul>\\n</div>\\n\\n\"\n\n s << <<EOF\n<script type=\"text/javascript\">\n // The number of created attachments.\n var created_attachments = 0;\n // The number of existing attachments.\n var existing_attachments = 0;\n\n function add_attachment_field_to(element) {\n // The attachment id we'll be creating;\n var id = created_attachments++;\n existing_attachments++;\n\n // The paragraph which contains our file entry line.\n var p = document.createElement('p');\n\n // Label.\n var label = document.createElement('label');\n label.setAttribute('for', 'attachments_' + id);\n label.appendChild(document.createTextNode('Attach:'));\n p.appendChild(label);\n\n // File field.\n field = document.createElement('input');\n field.setAttribute('id', 'attachments_' + id);\n field.setAttribute('name', 'attachments[' + id + ']');\n field.setAttribute('size', '30');\n field.setAttribute('type', 'file');\n field.setAttribute('onchange', 'attachment_field_changed(this);');\n p.appendChild(field);\n\n // Remove button\n remove = document.createElement('input');\n remove.setAttribute('type', 'button');\n remove.setAttribute('value', 'Clear');\n remove.setAttribute('onclick', 'clear_attachment_field(this.previousSibling);');\n p.appendChild(remove);\n\n // Add paragraph to element.\n element.appendChild(p);\n }\n\n function attachment_field_changed(field) {\n if (field.value.length == 0) {\n remove_attachment_field(field);\n }\n if (field.value.length > 0) {\n add_attachment_field_to(field.parentNode.parentNode);\n }\n }\n\n function clear_attachment_field(field) {\n field.value = '';\n attachment_field_changed(field);\n }\n\n function remove_attachment_field(field) {\n if (existing_attachments > 1) {\n field.parentNode.parentNode.removeChild(field.parentNode);\n existing_attachments--;\n }\n }\n\n // Add the first attachment field.\n add_attachment_field_to(document.getElementById('files'));\n</script>\nEOF\n end"
] | [
"0.65443194",
"0.6024381",
"0.6024381",
"0.5881656",
"0.58660126",
"0.582179",
"0.5816329",
"0.571392",
"0.5711732",
"0.5711732",
"0.5687911",
"0.5664766",
"0.5650847",
"0.56303483",
"0.5628996",
"0.55806154",
"0.5491383",
"0.54716045",
"0.5465243",
"0.5456131",
"0.54556197",
"0.54556197",
"0.5454481",
"0.5452357",
"0.5449766",
"0.54405737",
"0.54290843",
"0.54233503",
"0.54024285",
"0.53857094",
"0.5384943",
"0.5360913",
"0.5358921",
"0.5352593",
"0.53327423",
"0.5325407",
"0.5324464",
"0.532175",
"0.53217256",
"0.53094697",
"0.5302302",
"0.53001547",
"0.53001547",
"0.53001547",
"0.53001547",
"0.52999574",
"0.52962154",
"0.52953565",
"0.52953565",
"0.52953565",
"0.5288902",
"0.52843744",
"0.5279958",
"0.5274838",
"0.5262057",
"0.52536654",
"0.5245938",
"0.52335036",
"0.5212916",
"0.52099437",
"0.52092206",
"0.5204963",
"0.5204211",
"0.520403",
"0.51974565",
"0.51943386",
"0.5192582",
"0.5191291",
"0.51906747",
"0.5189721",
"0.51858795",
"0.5183099",
"0.5181361",
"0.51791227",
"0.5172188",
"0.5172188",
"0.51656324",
"0.5156952",
"0.5153444",
"0.5150124",
"0.51444083",
"0.5141889",
"0.51327103",
"0.51290554",
"0.5124254",
"0.5123937",
"0.5123656",
"0.5119361",
"0.5117456",
"0.51153606",
"0.5110986",
"0.5109797",
"0.5107765",
"0.51061064",
"0.51054054",
"0.50997597",
"0.5095238",
"0.5090822",
"0.50888276",
"0.50881046"
] | 0.5491391 | 16 |
Description Adds a link of this element to your section. found: reloads the element in compact mode compact: [this action doesn't occur] expanded: removes the element and reloads the whole page Mode Ajax + Json Specific filters ApplicationControllerinitialize_media_element ApplicationControllerinitialize_media_element_destination | def add
@ok_msg = t('other_popup_messages.correct.add.media_element')
if @ok
if !current_user.bookmark('MediaElement', @media_element_id)
@ok = false
@error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')
end
else
@error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element')
end
if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT
prepare_media_element_for_js
@ok_msg = nil
render 'media_elements/reload.js'
else
render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t\t:class => 'small button with_icon new_content_link'\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\tend",
"def create_expand_collapse_link(update_element_id, *args, &block)\n return '' if update_element_id.blank?\n \n options = args.extract_options!\n # default config options\n options.reverse_merge!(:link_text => update_element_id,\n :link_style => \"\",\n :style => \"\", \n :class => nil,\n :icon_left_margin => \"5px\",\n :icon_float => \"\")\n \n link_text = if block_given?\n capture(&block)\n else\n options[:link_text]\n end\n\n unless options[:icon_float].blank?\n expand_link = (expand_image(options[:icon_left_margin], options[:icon_float]) + link_text).html_safe\n collapse_link = (collapse_image(options[:icon_left_margin], options[:icon_float]) + link_text).html_safe\n else\n expand_link = (link_text + expand_image(options[:icon_left_margin])).html_safe\n collapse_link = (link_text + collapse_image(options[:icon_left_margin])).html_safe\n end\n\n expand_link_id = update_element_id + '_name_more_link'\n collapse_link_id = update_element_id + '_name_less_link'\n \n expand_link_content = link_to_function(expand_link, :id => expand_link_id, :style => \"vertical-align: baseline; #{options[:link_style]}\") do |page| \n page.toggle expand_link_id, collapse_link_id\n page.visual_effect :toggle_blind, update_element_id, :duration => '0.2'\n end.html_safe\n\n collapse_link_content = link_to_function(collapse_link, :id => collapse_link_id, :style => \"display:none; vertical-align: baseline; #{options[:link_style]}\") do |page| \n page.toggle expand_link_id, collapse_link_id\n page.visual_effect :toggle_blind, update_element_id, :duration => '0.2'\n end.html_safe\n \n span_content = expand_link_content + collapse_link_content\n \n content = content_tag(:span, span_content, :class => options[:class], :style => \"vertical-align: baseline; #{options[:style]}\")\n\n return content\n\n end",
"def render_create_content_link(element, options = {})\n\t\t\t\tdefaults = {\n\t\t\t\t\t:label => t('add new content')\n\t\t\t\t}\n\t\t\t\toptions = defaults.merge(options)\n\t\t\t\tlink_to(\n\t\t\t\t\toptions[:label],\n\t\t\t\t\talchemy.admin_contents_path(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t\t:name => options[:content_name],\n\t\t\t\t\t\t\t:element_id => element.id\n\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t\t:method => 'post',\n\t\t\t\t\t:remote => true,\n\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t:class => 'button new_content_link'\n\t\t\t\t)\n\t\t\tend",
"def media_link &block\n ASObj.generate :media_link,true,&block\n end",
"def add_medium_link(opts)\n unless opts.keys.include?(:object) || \n opts.keys.include?(:context)\n raise \"Must give object and context\" \n end\n klass = opts[:object].class.to_s.underscore\n opts[:text]||= I18n.t('add_link', \n :medium_label => I18n.t(opts[:context], :scope => [:activerecord, :attributes, klass]),\n :scope => [:has_media, :form])\n link_to_function opts[:text] do |page| \n page.insert_html :bottom, generate_uid(\n :object => opts[:object], \n :context => opts[:context]\n ), \n :partial => 'has_media/medium_field', \n :locals => {\n :object => opts[:object], \n :context => opts[:context]\n }\n end \n end",
"def new_association_link(name, f, model, additional_javascript = \"\")\n fields = new_child_fields(f, model.to_sym)\n link_to_function(name, raw(\"replace_content(this, \\\"#{model}\\\", \\\"#{escape_javascript(fields)}\\\");$(\\\"#add-#{model}-select-link\\\").show();$(\\\"#add-#{model}-entry-link\\\").hide();#{additional_javascript}\"), :id=> \"add-#{model}-entry-link\", :class=>\"add-child-form-link admin-link\")\n end",
"def add_content\n self.link(:id=>\"navigation_create_and_add_link\").fire_event(\"onmouseover\")\n self.link(:text=>\"Add content\").click\n self.wait_until { @browser.text.include? \"Collected items\" }\n self.class.class_eval { include AddContentContainer }\n end",
"def add_href\n return if attributes.key?(\"href\")\n return unless attributes.key?(\"id\")\n attributes[\"href\"] = client.connection.api_path(\"#{collection.name}/#{attributes['id']}\")\n end",
"def respond_to_url_change\n return if apotomo_root.find_by_id('deep_link') # add only once.\n apotomo_root << widget(\"apotomo/deep_link_widget\", :setup, 'deep_link')\n end",
"def switcher_link_to(text, options={}, html_options={}, &block)\n id = html_options.delete(:id) || \"lm-#{rand(1000000)}\"\n inner_id = id + '_more'\n link_id = id + '_link'\n action_id = id + '_action'\n icon = boolean_default(options.delete(:icon), true)\n action_icon_id = id + '_action_icon'\n action_label_id = id + '_action_label'\n css_class = html_options.delete(:class)\n style = html_options.delete(:style)\n inner_css_class = html_options.delete(:inner_class)\n open = options.delete(:open) || false\n sticky = boolean_default(options.delete(:sticky), false)\n \n function = update_page do |page|\n page << \"if ($('#{inner_id}').style.display == 'none') {\"\n page[inner_id].visual_effect :blind_down, {:duration => 0.3}\n if sticky \n page << \"$('#{action_icon_id}').removeClassName('closed');\"\n page << \"$('#{action_icon_id}').addClassName('opened');\"\n else\n page[action_id].hide\n end\n page << \"} else {\"\n page[inner_id].visual_effect :blind_up, {:duration => 0.3}\n page[link_id].show\n if sticky \n page << \"$('#{action_icon_id}').removeClassName('opened');\"\n page << \"$('#{action_icon_id}').addClassName('closed');\"\n else\n page[action_id].show\n end\n page << \"}\"\n end\n\n onclick = \"#{\"#{html_options[:onclick]}; \" if html_options[:onclick]}#{function}; return false;\"\n href = html_options[:href] || '#'\n \n html = <<-HTML\n<div id=\"#{id}\" class=\"switcher #{css_class}\" style=\"#{style}\">\n <div id=\"#{action_id}\" class=\"switcherAction\">\n <a id=\"#{link_id}\" href=\"#{href}\" onclick=\"#{escape_once(onclick)};return false;\">\n <span id=\"#{action_icon_id}\" class=\"actionIcon #{open ? 'opened' : 'closed'}\" style=\"#{icon ? '' : 'display:none;'}\"></span>\n <span id=\"#{action_label_id}\" class=\"actionLabel\">#{text}</span>\n </a>\n </div>\n <div id=\"#{inner_id}\" class=\"#{inner_css_class}\" style=\"#{open ? '' : 'display:none;'}\">\n #{capture(&block)}\n </div>\n</div>\n HTML\n concat(html, block.binding)\n end",
"def link(**opt)\n opt[:path] = show_path(id: object.identifier)\n super(**opt)\n end",
"def show_add_section_to_item\n @item = Item.find(params[:id])\n @section = Section.new(\n :item_id => params[:id],\n :publish => true\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end",
"def add_iform_link(name, id, obj, locals={})\n link_to_function name do |page|\n page.insert_html :bottom, id, :partial => 'iform', :object => obj, :locals => locals\n end\n end",
"def publication_link\n h.link_to \"Read Now\" , object.publication_url , title: 'Read Now' , class: 'btn waves-effect waves-light btn-primary custom-btn' , target: '_blank'\n end",
"def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end",
"def add_media_action(gallery_name, media_url_list = [\"http://testimages.drupalgardens.com/sites/testimages.drupalgardens.com/files/styles/media_gallery_large/public/150x62XMasNeon.gif\"], _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n Log.logger.info(\"Adding New Images into the Gallery '#{gallery_name}'.\")\n # media_xpath = \"//div[contains(@id, 'media-gallery-media-')]//a[@href and contains(@class, 'media-gallery-thumb')]\"\n media_xpath = \"//div[contains(@class, 'media-gallery-sortable-processed ui-sortable')]/div[contains(@id, 'media-gallery-media-')]\"\n Log.logger.info(\"Opening Gallery #{gallery_name}\")\n self.open_gallery(gallery_name)\n media_url_list.each do |media_url|\n Log.logger.info(\"Working on media item: #{media_url}\")\n switch_to_last_pagination_page\n #Get the amount of items so we later know which ID something that gets added will get (IDs start at 0, so it will get the id 'nom')\n nom = Integer(_browser.find_elements(:xpath => media_xpath).size)\n Log.logger.info(\"Found #{nom} media item(s).\")\n\n Log.logger.info(\"Waiting for 'Add media' link.\")\n wait.until { _browser.find_element(:xpath => @galmgr.add_media) }\n #we have to wait for the WHOLE page to be loaded and it might even refresh itself for some reason.\n #if we don't sleep, we sometimes run into the page refreshing after we clicked on the add media link\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Clicking on'Add media' link.\")\n _browser.find_element(:xpath => @galmgr.add_media).click\n Log.logger.info(\"Waiting for Overlay.\")\n wait.until { _browser.find_element(:xpath => \"//div[@class='ui-widget-overlay']\") }\n Log.logger.info(\"Waiting for media browser iframe.\")\n start_time = Time.now\n frame = wait.until { _browser.find_element(:xpath => @galmgr.media_upload_frame) }\n Log.logger.info(\"Found media browser iframe after #{Time.now - start_time} seconds.\")\n JQuery.wait_for_events_to_finish(_browser)\n if _browser.find_elements(:xpath => @galmgr.media_upload_frame).size > 0 #perhaps unnecessary?\n Log.logger.info(\"Switching to media browser iframe.\")\n _browser.switch_to.frame(_browser.find_element(:xpath => @galmgr.media_upload_frame))\n else\n raise \"Media Browser frame seems to have disappeared after we had waited for it!\"\n end\n Log.logger.info(\"Waiting for media upload tab link\")\n wait.until { _browser.find_element(:xpath => @galmgr.embed_image_video) }.click\n #Wait til the content of the tab is actually visible\n Log.logger.info(\"Waiting for media upload tab to be visible\")\n wait.until { _browser.find_element(:xpath => \"//div[@id='media-tab-upload' and not(@class='ui-tabs-hide')]\") }\n Log.logger.info(\"Waiting for text input field and entering media URL: (#{media_url})\")\n temp = wait.until { _browser.find_element(:xpath => @galmgr.url_textbox) }\n temp.clear\n temp.send_keys(media_url)\n Log.logger.info(\"Waiting for and clicking on submit button\")\n wait.until { _browser.find_element(:xpath => @galmgr.submit_url_btn) }.click\n Log.logger.info(\"Waiting for embed popup to disappear\")\n # wait.until { ! _browser.find_element(:xpath => @galmgr.embed_image_video) }\n Log.logger.info(\"Switching back to main frame.\")\n _browser.switch_to.default_content\n Log.logger.info(\"Waiting for overlay to disappear.\")\n wait.until { _browser.find_elements(:xpath => \"//div[@class='ui-widget-overlay']\").empty? }\n Log.logger.info(\"Overlay is gone.\")\n #Our newly inserted element will show up shortly EITHER on a new paginated page or within this context\n partial_file_name = media_url.split('/').last.split(\".\").first.gsub(\"watch?v=\", \"\")\n Log.logger.info(\"Waiting for the media-gallery-media-#{nom} we just added to show up (with a link inside and an img src that points to a file with #{partial_file_name.inspect}).\")\n #TODO: Find out if this can be handled by an \"OR\" in the xpath\n start_time = Time.now\n if switch_to_last_pagination_page()\n nom = Integer(_browser.find_elements(:xpath => media_xpath).size)\n Log.logger.info(\"Found #{nom} media items on the last page.\")\n end\n inserted_media_item_path = \"//img[contains(@src, '#{partial_file_name}')]\"\n #//div[contains(@id, 'media-gallery-media-#{nom}')].//div[contains(@class, 'media-gallery-draggable-processed')].//a[@href and contains(@class, 'media-gallery-thumb')].\n Log.logger.info(\"Waiting for #{inserted_media_item_path}\")\n wait.until { _browser.find_element(:xpath => inserted_media_item_path) }\n Log.logger.info(\"Inserted media item 'media-gallery-media-#{nom}' showed up (after #{Time.now - start_time} seconds).\")\n end #end each-loop\n JQuery.wait_for_events_to_finish(_browser)\n Log.logger.info(\"Done with media file insertion\")\n end",
"def add_element\n @inner_page = Embeddable::InnerPage.find(params['id'])\n @page = Page.find(params['page_id'])\n @container = params['container'] || 'elements_container'\n\n # dynamically instantiate the component based on its type.\n component_class = params['class_name'].constantize\n if component_class == Embeddable::DataCollector\n if probe_type_id = session[:last_saved_probe_type_id]\n probe_type = Probe::ProbeType.find(probe_type_id)\n @component = Embeddable::DataCollector.new\n @component.probe_type = probe_type\n @component.save\n else\n @component = Embeddable::DataCollector.create\n end\n session[:last_saved_probe_type_id] = @component.probe_type_id\n else\n @component = component_class.create\n end\n @component.pages << @page\n @component.user = current_visitor\n @component.save\n @element = @page.element_for(@component)\n @element.user = current_visitor\n @element.save\n # @element.update_investigation_timestamp\n @page.reload\n if params['static']\n render :partial => \"static_page\", :locals => {:page => @page, :inner_page => @inner_page}\n else\n render :partial => \"page\", :locals => {:page => @page, :inner_page => @inner_page}\n end\n end",
"def add_full_set_link(form_builder)\n link_to_function 'Extra Full Set' do |page|\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'laptop', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'interface_box', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n form_builder.fields_for :equipment, Equipment.new, :child_index => 'NEW_RECORD' do |f|\n html = render(:partial => 'pads', :locals => { :form => f })\n page << \"$('#equipment_list').append('#{escape_javascript(html)}'.replace(/NEW_RECORD/g, new Date().getTime()));\"\n end\n end\n end",
"def set_elements\n super\n # View Related Documents Tab\n element(:view_related_tab_toggle) {b.input(:id => \"tab-ViewRelatedDocuments-imageToggle\")}\n element(:view_related_po_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Purchase Order')]/a\")}\n element(:view_related_requisition_link) {b.a(:xpath => \"//div[@id='tab-ViewRelatedDocuments-div']/descendant::h3[contains(text(),'Requisition')]/a\")}\n # Delivery Tab\n element(:delivery_tab_toggle) {b.input(:id => \"tab-Delivery-imageToggle\")}\n element(:building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_room_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[5]/td[1]\")}\n element(:closed_building_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[2]/td[1]\")}\n element(:closed_campus_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/div/table/tbody/tr[1]/td[1]\")}\n element(:closed_address_1_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[1]\")}\n element(:closed_address_2_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[4]/th[1]/following-sibling::td[1]\")}\n element(:closed_city_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[6]/th[1]/following-sibling::td[1]\")}\n element(:closed_state_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[7]/th[1]/following-sibling::td[1]\")}\n element(:closed_postal_code_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[8]/th[1]/following-sibling::td[1]\")}\n element(:closed_country_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[9]/th[1]/following-sibling::td[1]\")}\n element(:closed_delivery_to_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[1]/th[1]/following-sibling::td[2]\")}\n element(:closed_delivery_phone_number_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[2]/th[1]/following-sibling::td[2]\")}\n element(:closed_email_field) {b.td(:xpath => \"//div[@id='tab-Delivery-div']/descendant::tr[3]/th[1]/following-sibling::td[2]\")}\n # Vendor Tab\n element(:vendor_tab_toggle) {b.input(:id => \"tab-Vendor-imageToggle\")}\n element(:closed_vendor_name_field) {b.td(:xpath => \"//tr/th[div[contains(text(),'Suggested Vendor:')]]/following-sibling::td[1]\")}\n # Route Log Tab\n element(:route_log_tab_toggle) {b.input(:id => \"tab-RouteLog-imageToggle\")}\n # element(:actions_taken) {b.bs(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[1]/b\")}\n # element(:actions_taken_by) {b.as(:xpath => \"//div[@id='tab-ActionsTaken-div']/div[1]/table/tbody/tr/td[2]/a\")}\n end",
"def sections_augmented_link( obj )\n title = \"\"\n title << obj.code unless obj.try( :code ).blank?\n title << \"\\n\" unless title.empty? or obj.try( :description ).blank?\n title << obj.description unless obj.try( :description ).blank?\n\n content_tag(\n :span,\n link_to( h( obj.title ), obj ),\n :title => title\n )\n end",
"def initialize(media_elem)\n super()\n\n @id = nil\n @media_url = nil # メディアの URL\n @media_url_https = nil # メディアの SSL URL\n @url = nil # メディア URL(展開)\n @display_url = nil\n @expanded_url = nil\n @type = MEDIA_TYPE_PHOTO # only \"photo\" for now\n @sizes = nil\n @indices = nil\n end",
"def media_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.media_url = params[:media_url]\n if ar_object.save\n @messages = 'media updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.media_domid(ar_object),\n render(:partial => \"/main/media_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end",
"def js_append_element_to(element, content)\n rjs_method :append_element, :element => element, :content => content\n end",
"def click(link); end",
"def create\n\n @link = Link.new(params[:link])\n @link.resource_id = @resource.id\n \n if !@link.link.include? \"http://\"\n @link.link = \"http://\" + @link.link\n end\n\n\n @resource.attachment = @link\n @resource.save\n\n @link.save\n\n\n\n respond_to do |format|\n if @link.update_attributes(params[:text]) && @resource.update_attributes(params[:resource])\n format.js\n end\n end \n end",
"def remove_link\n # cocoon JS needs class specifically remove_fields.dynamic, just treat em all\n # like dynamic, it seems okay.\n template.link_to(I18n.t(\"kithe.repeatable_input.remove\"), '#', class: \"remove_fields dynamic btn btn-secondary\")\n end",
"def initialize(media_elem)\n super()\n\n @id = nil\n @media_url = nil # メディアの URL\n @media_url_https = nil # メディアの SSL URL\n @url = nil # メディア URL(展開)\n @display_url = nil\n @expanded_url = nil\n @type = MEDIA_TYPE_ANIMATED_GIF\n @sizes = nil\n @indices = nil\n end",
"def expand_contract_section(arg_heading, id, options={}, &block)\n expanded = (params[\"umlaut.show_#{id}\"] == \"true\") || options[:initial_expand] || false\n icon = content_tag(:i, nil, :class => [] << ( expanded ? \"umlaut_icons-list-open\" : \"umlaut_icons-list-closed\"))\n heading = content_tag(:span,( expanded ? \"Hide \" : \"Show \"), :class=>'expand_contract_action_label') + arg_heading\n body_class = (expanded ? \"in\" : \"\")\n link_params = params.merge('umlaut.request_id' => @user_request.id,\n \"umlaut.show_#{id}\" => (! expanded).to_s,\n # Need to zero out format-related params for when we're coming\n # from a partial html api request, so the link we generate\n # is not to format json/xml/etc.\n :format => nil,\n 'umlaut.response_format' => nil,\n 'umlaut.jsonp'=>nil,\n # In Rails3, an :anchor param will actually be used for #fragmentIdentifier\n # on end of url\n :anchor => \"#{id}_toggle_link\"\n )\n # Make sure a self-referencing link from partial_html_sections\n # really goes to full HTML view.\n link_params[:action] = \"index\" if link_params[:action] == \"partial_html_sections\"\n return content_tag(:div, :class => \"collapsible\", :id => \"collapse_#{id}\") do\n link_to(icon + \" \" + heading, link_params, :class => \"collapse-toggle\", \"data-target\" => \"##{id}\", \"data-toggle\" => \"collapse\") +\n content_tag(:div, :id => id, :class => [\"collapse\"]<< body_class, &block)\n end\n end",
"def edit\n resource.prepare_links\n\n super\n end",
"def show\n @object = referenced_object\n @attribute = params[:attribute]\n @form_element = params[:form_element]\n close = params[:close] || false\n if @form_element == \"associated\"\n @sub_id = params[:sub_id]\n if @sub_id.to_i > 0\n @associated_record_id = @object.send(@attribute.to_s.singularize + \"_ids\").index(@sub_id.to_i)\n @associated_record = @object.send(@attribute)[@associated_record_id]\n end\n end\n if @form_element == \"has_one\"\n @associated_record = @object.send(@attribute)\n @associated_record_id = @associated_record.id\n end\n @update_span = params[:update]\n if @attribute.nil?\n respond_to do |format|\n @attributes = @object.inline_forms_attribute_list\n if close\n format.js { render :close }\n else\n format.js { }\n end\n end\n else\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { render :show_element }\n end\n end\n end",
"def link_to(*args, &block)\n if block_given?\n super(*args)\n else\n options = args[1] || {}\n html_options = args[2] || {}\n unless html_options.has_key? :'data-id'\n begin\n path = URI.split(url_for(options) || html_options['href'])[5].split(/\\//).select {|x| !x.empty?}\n if path.size > 0\n max = path.size <= 3 ? path.size : 3\n id = path.last(max).join('_')\n else\n id = 'not_defined'\n end\n rescue Exception => e\n id = 'not_parseable'\n end\n html_options.merge!(:'data-id' => \"aid_#{id}\")\n end\n super(args[0], args[1], html_options)\n end\n end",
"def add_link(el, href, title, alt_text = nil, ial = nil)\n el.options[:ial] = ial\n update_attr_with_ial(el.attr, ial) if ial\n if el.type == :a\n el.attr['href'] = href\n else\n el.attr['src'] = href\n el.attr['alt'] = alt_text\n el.children.clear\n end\n el.attr['title'] = title if title\n @tree.children << el\n end",
"def remove\n @ok_msg = t('other_popup_messages.correct.remove.media_element')\n if @ok\n bookmark = Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).first\n if bookmark.nil?\n @ok = false\n @error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')\n else\n bookmark.destroy\n if Bookmark.where(:user_id => current_user.id, :bookmarkable_type => 'MediaElement', :bookmarkable_id => @media_element_id).any?\n @ok = false\n @error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')\n end\n end\n else\n @error = I18n.t('activerecord.errors.models.bookmark.problem_destroying_for_media_element')\n end\n if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT\n prepare_media_element_for_js\n render 'media_elements/reload.js'\n else\n render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)}\n end\n end",
"def link!\n self.linkbutton = true\n self.save\n self.linkbutton\n end",
"def show_swfupload_container_link\n %Q{<a class=\"show_swfupload_container\" style=\"display:none;\" href=\"#\">#{I18n.t('uploader.show_swfupload_container')}</a>}\n end",
"def add_link\n @bib.link.each do |l|\n case l.type&.downcase\n when \"doi\" then @item.doi = l.content\n when \"file\" then @item.file2 = l.content\n when \"src\" then @item.url = l.content\n end\n end\n end",
"def append_link\n url = params[:link]\n @link = Link.new()\n @link.url = url[:url]\n @link.package = Package.find(params[:package_id])\n @link.save()\n # renova a busca para atualizar lista de links.\n @links = Link.find(:all, :conditions => [\"package_id = ?\", params[:package_id]])\n\n flash[:notice] = \"Link was successfully appended.<br/>\" + url[:url]\n redirect_to :action => 'show', :id => params[:package_id]\n end",
"def ajax_add_link\n\n # Create a new Link Instance\n link = Link.new\n\n # Update the fields of Link Instance\n link.funnel_id = params[:funnel_id]\n link.to_node_id = params[:to_operator_id].to_i\n\n if params[:from_operator_id].to_i === 0\n # If the link starts at the start node, set slink to 1\n link.start_link = 1\n else\n # Otherwise, set slink to 0 (false) and set from_operator_id\n link.start_link = 0\n link.from_node_id = params[:from_operator_id].to_i\n end\n\n # Save and verify Link and return correct JSON response\n if link.save!\n final_json = JSON.pretty_generate(result = {\n :success => true\n })\n else\n final_json = JSON.pretty_generate(result = {\n :success => false\n })\n end\n\n # Return JSON response\n render json: final_json\n\n end",
"def render_link\n content_tag(:a, **integrated_slat_action_html_options) do\n if icon\n NfgUi::Components::Foundations::Icon.new({ traits: [icon], text: (block_given? ? yield : body), theme: theme }, view_context).render\n else\n (block_given? ? yield : body)\n end\n end\n end",
"def add_another_asset_link\n expect(focused_element).to eq(find_button('Add another link').native)\n\n focused_element.send_keys(:enter,\n [:shift, :tab],\n [:shift, :tab],\n [:shift, :tab],\n [:shift, :tab])\n end",
"def set_link\n @link = @campaign.links.find(params[:id])\n end",
"def element_action(context={}, aspect_model)\n \n content_translation_guiblock.element_action(context, aspect_model)\n \n end",
"def abide_link_to_product_attachment(product_attachment)\n if !product_attachment.product_attachment_file_name.blank?\n link_to(image_tag(product_attachment.product_attachment.url(:tiny_square), style: \"vertical-align: middle\"),\n product_attachment.product_attachment.url)\n else\n img = product_attachment.product_media_thumb.url(:tiny)\n if product_attachment.product_media_file_name.to_s.match(/swf$/i)\n width = (product_attachment.width.blank?) ? \"100%\" : product_attachment.width\n height = (product_attachment.height.blank?) ? \"100%\" : product_attachment.height\n new_content = swf_tag(product_attachment.product_media.url, size: \"#{width}x#{height}\")\n elsif product_attachment.product_media_file_name.to_s.match(/flv|mp4|mov|mpeg|mp3|m4v$/i)\n # At one point, I prepended the protocol and host. Not sure why, but I'm trying it without\n # this to see if I can get it to come through the Amazon cloudfont CDN. (10/2013)\n # media_url = request.protocol + request.host_with_port + product_attachment.product_media.url('original', false)\n\n new_content = render_partial(\"shared/player\", media_url: product_attachment.product_media.url)\n else\n new_content = product_attachment.product_attachment.url\n end\n link_to_function image_tag(img, style: \"vertical-align: middle\"), \"$('#viewer').html('#{escape_javascript(new_content)}')\"\n end\n end",
"def update_link(link)\n if i = find_index { |l| l.rel.to_s == link.rel.to_s }\n return self[i] = link\n end\n self << link\n end",
"def add_nested_resource(resource, nested_resource, options={})\n target = options[:target].present? ? options[:target] : \".#{nested_resource.to_s}\"\n\n if options[:content] == false\n resource.link_to_add(fa_icon('plus'), nested_resource, data:{target: target, toggle:'tolltip', title: t('simple_form.nested_btn.defaults.add')}, class:'btn btn-primary')\n else\n content = options[:content] || nested_resource.to_s.singularize\n content = t(\"mongoid.models.#{content}.one\") if options[:localize] && options[:content].blank?\n resource.link_to_add(fa_icon('plus', text: t('simple_form.nested_btn.add', model: content)), nested_resource, data:{target: target}, class:'btn btn-primary')\n end\n end",
"def link_to_add_fields(name, association, *args)\n options = args.extract_options!\n\n new_object = object.class.reflect_on_association(association).klass.new\n fields = fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n @template.render(association.to_s.singularize + \"_fields\", :f => builder)\n end\n\n options.merge!(:class => \"add_fields btn\", :data => { :association => association, :content => CGI::escapeHTML(fields.gsub(/\\t|\\n|\\r/, \"\")) })\n @template.link_to(name, \"#\", options)\n end",
"def click_add_advertiser_contact_link\n add_advertiser_contact_link.click\n end",
"def append!(element)\n\t\t\trpc(:append, [@id, element.to_html])\n\t\tend",
"def add_agency_link\n self.get_element(@browser, '//a[contains(@href, \"/insertion_orders_organizations_agencies/create?insertion_orders.id=\")]')\n end",
"def new\n render :layout => 'media_element_editor'\n end",
"def remote_readest_link(name, begin_date, type, section_id = nil)\r\n link_to_remote name || \"24 hodin\", :url=>{:controller=>\"web/ajax\", :action=>\"update_readest\", :begin_date=>begin_date || (Time.now-24.hours), :type=>type || 1, :section_id=>section_id}, :loading=>\"Element.show('readest_spinner');\", :complete=>\"Element.hide('readest_spinner');\"\r\n end",
"def href; end",
"def remote_link_to_new(text = \"新規追加\", options = {}, html_options = {})\n if registered? && (at_present? || simulation_mode?) && allow_to_add_new_entity?(options)\n options[:controller] ||= controller_name\n options[:url] = {:controller => options[:controller], :action => \"new\"}\n options[:params] = options[:params].to_h.merge( :background_params => @background_params )\n html_options[:class] ||= \"op-control\"\n link_to_remote_with_params( text, options, html_options ) \n end\n end",
"def set_element\n @element = @article.elements.find(params[:id])\n end",
"def add_fields_link(name, f, association)\n if (name == nil or name == \"\" or f == nil or association == nil or association == \"\")\n return false\n end\n \n new_object = f.object.send(association).klass.new\n id = new_object.object_id\n metarows = f.fields_for(association, new_object, child_index: id) do |builder|\n render(association.to_s.singularize + \"_fields\", f: builder)\n end\n link_to(name, '#', class: \"add_fields btn btn-primary\", data: {id: id, metarows: metarows.gsub(\"\\n\", \"\")})\n \n #return true #gets displayed in view\n end",
"def remove_medium_link(opts)\n opts[:text] ||= I18n.t('remove_link', :scope => [:has_media, :form])\n link_to opts[:text], medium_url(opts[:medium]), :remote => true, :method => :delete\n end",
"def AddNewDataElement(class_name, options)\n @class_name = class_name\n \n # Determine the class name, create a new instance of it. \n instance_variable_set(class_name.constantize::DEFAULT_VARIABLE_NAME, class_name.constantize.new)\n \n # Use the short underscore name by convention: e.g. data_domain, rather than data_domain_data_element\n class_name_short = class_name.constantize.short_underscore_name\n \n # Optionally override the partial we are going to render.\n @partial_name = \"/data_sheets/pages/#{@globe.globe_reference}/#{class_name_short}/new.html.erb\" if @partial.nil?\n \n # By default the DIV will be: new_data_element_content but you can override this.\n @div_content = \"new_data_element_content\" if @div_content.nil?\n \n # Text to display for minimise button.\n @button_text = \"New #{class_name.constantize.friendly_class_name} <<\" if @button_text.nil?\n # new_data_element.js.erb called by default\n\n render(:partial => 'new_data_element_link',\n :locals => {\n :class_name => class_name,\n :options => options\n })\n end",
"def queue_link( tag, source )\n return if tag.attributes['class'] && tag.attributes['class']['thickbox'] == 'thickbox'\n return if tag.attributes['onclick']\n dest = (tag.attributes['onclick'] =~ /^new Ajax.Updater\\(['\"].*?['\"], ['\"](.*?)['\"]/i) ? $1 : tag.attributes['href']\n if !(dest =~ %r{^(mailto:|#|javascript:|http://|.*\\.jpg|aim:|ichat:|xmpp:)})\n @links_to_visit << Link.new( dest, source )\n end\n end",
"def initialize(media_elem)\n super()\n\n @id = nil\n @media_url = nil # メディアの URL\n @media_url_https = nil # メディアの SSL URL\n @url = nil # メディア URL(展開)\n @display_url = nil\n @type = MEDIA_TYPE_VIDEO\n @sizes = nil\n @indices = nil\n @video_info = nil\n end",
"def process_include anElement\r\n self.transform_include anElement.content\r\n end",
"def view_more_button(url, custom_class = '', settings = {})\n settings = {label: 'View more', closest: '.text-center'}.merge(settings)\n content_tag :div, link_to(\"#{settings[:label]} »\".html_safe, url, class: 'link_more_btn ujs_success_replace margin_top10 inline underline '+custom_class, 'data-closest-replace' => settings[:closest], remote: true, 'data-disable-with' => button_spinner), class: 'text-center'\n end",
"def handle_element(cs, element, new_model)\n case cs.content_type\n when 'content'\n handle_content_element(cs, element, new_model)\n when 'foreign_key'\n handle_foreign_key_element(cs, element, new_model)\n when 'link'\n # handles parsing issues with malformed HTML where content isn't captured by the selector (williams rss links)\n url = element.text.blank? ? next_non_blank(element).text.squish : element.text.squish\n # needs to save the url in the model in order to display the detail page rather than the index\n new_model.assign_attributes(cs.column_name => url)\n detail_page_scrape(cs, url, new_model)\n else\n logger.error \"UNKNOWN CONTENT TYPE for child selector #{cs.id}: #{cs.selector}\"\n end # end content_type case statement\n end",
"def click_fin_aid_details_link\n logger.debug 'Clicking link to FinAid Details'\n details_link\n activity_heading_element.when_visible WebDriverUtils.page_load_timeout\n end",
"def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end",
"def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end",
"def link_to_remove_section(linktext, form, class_of_section_to_remove=\"removeme\")\n form.hidden_field(:_destroy) + \"\\n\" +\n link_to_function(linktext, \"remove_section(this, \\\"#{class_of_section_to_remove}\\\")\")\n end",
"def fleximage_editor\n \n ar_object = Kernel::const_get(params[:ar_object_class]).find(params[:ar_object_id])\n display_editor = (params[:display_editor] == \"false\")\n display_thumbnail = (params[:display_thumbnail] == \"true\")\n \n render :update do |page| \n page.replace(MainController.fleximage_domid(ar_object),\n render(:partial => \"/main/media_edit\", \n :locals => {:ar_object => ar_object, \n :timestamp => nil,\n :display_thumbnail => display_thumbnail, \n :display_editor => display_editor})\n )\n\t\tend\n end",
"def click_add_agency_link\n add_agency_link.click\n end",
"def append\n \n @subsection = Subsection.find(params['id'])\n \n @new_subsection = @subsection.dup\n \n @new_subsection.name = ''\n @new_subsection.note = ''\n\n end",
"def add_link(lh)\n lnk_wid = lh[:wid]\n\tlnk_role = lh[:role]\n\t\n\t# find or create the attach node\n if @doc.xpath('//field[@id=\"linkedWorkItems\"]/list').last.nil?\n Nokogiri::XML::Builder.with(@doc.xpath('//work-item').last) do\n field(:id => 'linkedWorkItems') {\n\t list {}\n\t }\n end\n end\n\t\n\t# build and attach the link struct\n\tNokogiri::XML::Builder.with(@doc.xpath('//field[@id=\"linkedWorkItems\"]/list').last) do\n\t struct {\n\t item(:id => 'revision')\n\t\titem(:id => 'workItem') {\n\t\t text lnk_wid\n\t\t}\n\t\titem(:id => 'role') {\n\t\t text lnk_role\n\t\t}\n\t }\n\tend\n end",
"def link_to_add_ingest_association(f, association)\n group = association.to_s.singularize\n label = I18n.t(\"ingest_form.#{group}.add\", :default => \"Add #{group}\")\n html = %Q|<span class=\"sr-only\">#{label}</span><i class=\"icon-plus icon-white\"></i>|\n return link_to_add_association(raw(html), f, association,\n :class => \"btn btn-success\",\n :title => label,\n :partial => \"ingest/ingest_fields\"\n )\n end",
"def content_edit_action_link(text, object)\n content_edit_action_item(link_to_remote_facebox(text, member_url([@tier, object], :edit), {:rel => \"nofollow\"}))\n end",
"def link\n h.content_tag :li do\n h.link_to h.content_tag(:i, '' , class: object.icon ) , object.url , target: \"_blank\" , title: object.name\n end\n end",
"def add_video_to_queue(video)\n visit home_path\n click_on_video_on_home_page(video) # This method is in macros.rb\n click_link \"+ My Queue\"\n end",
"def external_link(link_label, url, options={})\n attributes = options[:attributes] || {}\n children = options[:children] || {}\n image = options[:image] || {}\n\n img =\"\"\n unless image.empty?\n img = self.external_image(image[:url], image, true) \n end\n\n child_elements = self.children_list(children) << img\n link_label = self.tag('label', link_label)\n url = self.tag('url', url)\n link = self.tag('externalLink', url << link_label << child_elements, attributes)\n\n cell = options[:cell] || {}\n row = options[:row] || {}\n self.row_cell(link, cell, row)\n end",
"def add_link(options = {}, &block)\n id = @link_options[:id] ? (@link_options[:id].to_s + \"_\" + (@links.size + 1).to_s) : nil\n link = Ubiquo::NavigationLinks::Link.new(\n { :id => id, \n :class => @link_options[:class]\n }.merge(options))\n @links << link\n block.call(link)\n link\n end",
"def add_data_elements\n \n end",
"def add_part\n frm.link(:text=>\"Add Part\").click\n AddEditAssessmentPart.new(@browser)\n end",
"def full_url_for_element element\n \"http://\" + request.env[\"HTTP_HOST\"] + \"/\" + element.page.urlname + \"##{element.name}_#{element.id}\" \n end",
"def adding_responder\n article = find_entity\n @thread = article.a_thread\n receive_and_set_background_params\n @display_mode = @background_params[:display_mode]\n @responder = article.responder(@thread, params[:responding_to])\n \n base_div_id = params[:base_div_id] # id of div to add\n uuid = random_id # generate random id\n preparation_for_altering\n render :update do |page| \n page.replace_html base_div_id, \n :partial => \"article_threads/responder\", \n :locals => {:uuid => uuid},\n :object => @responder\n end\n end",
"def expand(name)\n self.div(:id=>\"lhnavigation_container\").link(:text=>name).click\n end",
"def add_attachment_link(name, attachment_name, attachment_model_name)\n link_to_function name do |page|\n page.insert_html :bottom, attachment_name.pluralize.to_sym, :partial => attachments_name, :object => Run.attachment_model_name.to_model.new\n end\n end",
"def list_item_expander\n respond_to do |format|\n format.html {\n render :nothing => true, :status => :no_content\n }\n format.js {\n @kase = Kase.find_by_permalink(params[:id])\n render :partial => 'kases/list_item_content', :object => @kase, :locals => {\n :expanded => params[:expanded].to_s.index(/1/) ? false : true\n }\n }\n end\n end",
"def add_line_items_link\n self.get_element(@browser, '//a[contains(@href, \"/line_items/create?insertion_orders.id=\")]')\n end",
"def link(href, opts={})\n @resource.tap {|obj| obj.add_link(@rel, href, opts) }\n end",
"def check_is_add_link_request\n if params[:add_link]\n link_text = \" link(#{t(:visible_text)}, #{t(:invisible_url)}) \"\n p = Paragraph.find(params[:add_link].keys.first)\n p.update_attributes({title: p.get_title, body: p.get_body + link_text})\n end\n end",
"def active_media\n super\n end",
"def append\n\n @section = Section.find(params[:id])\n @checklist = Checklist.find(@section.checklist_id)\n \n @new_section = @section.dup\n \n @new_section.name = ''\n @new_section.background_color = ''\n\n end",
"def link_to_add_fields(name, icon, f, association, link_classes = '', create_children=nil)\n # Creates the new object\n new_object = f.object.class.reflect_on_association(association).klass.new\n\n # Create the object's children, if create_children is non-nil\n if create_children\n 4.times{new_object.send(create_children).build}\n end\n\n # Render the partial that will be insterted via javascript when this link is\n # clicked\n fields = f.fields_for(association, new_object, :child_index => \"new_#{association}\") do |builder|\n render(:partial => association.to_s.singularize + \"_fields\", :locals => {:f => builder})\n end\n\n # The link text is an icon and the value of the <name> argument\n content = (\"<i class='#{icon}'></i> \" + name).html_safe\n\n # Link to the javascript that will insert the partial we rendered\n link_to_function(content, \"TemplateBuilder.add_fields(this, \\\"#{association}\\\", \\\"#{escape_javascript(fields)}\\\")\", :class => link_classes)\n end",
"def link_to_new_file(name)\n link_to_function name, js_add_new_file(ArticleFile.new)\n end",
"def click_add_line_items_link\n add_line_items_link.click\n end",
"def show\n @links = Documentation::Link.where( :link_category_id => @documentation_link_category.id)\n respond_to do |format|\n format.js\n end\n end",
"def section_link(name,options)\n if options[:action].include?(@current_action) && options[:controller] == @current_controller\n link_to(name, \"/\"+ options[:url], :class => 'current')\n else\n link_to(name, \"/\"+ options[:url])\n end\n end",
"def link_to_add_association(name, f, association)\n new_object = f.object.class.reflect_on_association(association).klass.new\n model_name = new_object.class.name.underscore\n hidden_div = content_tag('div', :id => \"#{model_name}_fields_template\", :style => \"display:none;\") do\n render_association(association, f, new_object)\n end\n hidden_div.html_safe + link_to(name, '#', :class => 'add_fields', :'data-association' => association.to_s.singularize)\n end",
"def js_prepend_element_to(element, content)\n rjs_method :prepend_element, :element => element, :content => content\n end",
"def element_add\r\n @env.issue.element_add @meta.element_add ElementAdd.new(@env).insert @is.element_add\r\n end",
"def js_show_element(element)\n rjs_method :show_element, element\n end",
"def element_subcategory; end",
"def add(fullpath, attributes = {})\n unless self.pages.key?(fullpath)\n # editable elements\n editable_elements = self.filter_editable_elements(attributes.delete('editable_elements'))\n\n # content type\n if content_type_slug = attributes.delete('target_klass_slug')\n attributes['content_type'] = self.mounting_point.content_types[content_type_slug] #.values.find { |ct| ct._id == content_type_id }\n end\n\n self.pages[fullpath] = Locomotive::Mounter::Models::Page.new(attributes)\n\n self.pages[fullpath].set_editable_elements(editable_elements)\n end\n\n self.pages[fullpath]\n end",
"def add_media\n @media = Media.find_by_id(params[:media_id])\n add_media_update\n end"
] | [
"0.5843755",
"0.5815826",
"0.57196784",
"0.5506087",
"0.53053194",
"0.5248692",
"0.5224908",
"0.51986885",
"0.51724136",
"0.51460075",
"0.50608623",
"0.50183207",
"0.49998343",
"0.4998185",
"0.49402708",
"0.49364203",
"0.49209848",
"0.4889916",
"0.48832592",
"0.48704955",
"0.4864744",
"0.48481447",
"0.48474103",
"0.4845689",
"0.484383",
"0.48355004",
"0.48250583",
"0.4809909",
"0.48044825",
"0.47874594",
"0.47833636",
"0.4778006",
"0.4775588",
"0.47700953",
"0.47563154",
"0.47439903",
"0.474371",
"0.47207403",
"0.46413502",
"0.46320963",
"0.46301264",
"0.462411",
"0.4613488",
"0.4606996",
"0.45717883",
"0.45676827",
"0.4563643",
"0.4563123",
"0.4556442",
"0.4550756",
"0.4535294",
"0.45186162",
"0.4518537",
"0.45180938",
"0.4505364",
"0.4504775",
"0.4502834",
"0.44950143",
"0.4491252",
"0.44912148",
"0.44899392",
"0.44896615",
"0.44877207",
"0.448597",
"0.448597",
"0.44849",
"0.44812146",
"0.44795322",
"0.4479389",
"0.44793394",
"0.44789064",
"0.4476406",
"0.4474503",
"0.44736615",
"0.4472262",
"0.44698432",
"0.44657868",
"0.44640985",
"0.44631645",
"0.4462961",
"0.44601604",
"0.44593224",
"0.44575334",
"0.4457154",
"0.44553617",
"0.44510755",
"0.4446578",
"0.4444656",
"0.44361502",
"0.44341502",
"0.44313455",
"0.44298854",
"0.4428633",
"0.44277823",
"0.4426796",
"0.44259998",
"0.4422606",
"0.44223434",
"0.4405274",
"0.4404699"
] | 0.5955865 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.