query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
DELETE /minumen/1 DELETE /minumen/1.json | def destroy
@minuman.destroy
respond_to do |format|
format.html { redirect_to minumen_url, notice: 'Minuman was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @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",
"def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n respond_to do |format|\n format.html { redirect_to minicursos_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(*rest) end",
"def delete\n request(:delete)\n end",
"def destroy\n @minut.destroy\n respond_to do |format|\n format.html { redirect_to minuts_url, notice: 'Minut was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @ministrante.destroy\n respond_to do |format|\n format.html { redirect_to ministrantes_url, notice: 'Ministrante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministries = Ministries.find(params[:id])\n @ministries.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministries_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end",
"def destroy\n @minnpaku.destroy\n respond_to do |format|\n format.html { redirect_to minnpakus_url, notice: 'Minnpaku was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moresmalltrial = Moresmalltrial.find(params[:id])\n @moresmalltrial.destroy\n\n respond_to do |format|\n format.html { redirect_to moresmalltrials_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n delete_from_server single_url\n end",
"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.xml { head :ok }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @mini_url.destroy\n respond_to do |format|\n format.html { redirect_to mini_urls_url, notice: 'Mini url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @modrequest.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @minister.destroy\n respond_to do |format|\n format.html { redirect_to ministers_url, notice: 'Minister was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @muneco.destroy\n respond_to do |format|\n format.html { redirect_to munecos_url, notice: 'Muneco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testmonial.destroy\n\n head :no_content\n end",
"def delete\n \n end",
"def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @mineral.destroy\n respond_to do |format|\n format.html { redirect_to minerals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @setum.destroy\n respond_to do |format|\n format.html { redirect_to seta_url, notice: 'Setum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n \n end",
"def deleteRequest\n\n end",
"def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @mini_pago = MiniPago.find(params[:id])\n @mini_pago.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_pagos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mata_matum.destroy\n respond_to do |format|\n format.html { redirect_to mata_mata_url, notice: 'Mata matum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mi = Mi.find(params[:id])\n @mi.destroy\n\n respond_to do |format|\n format.html { redirect_to mis_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def delete\n\n end",
"def destroy\n @metum = Metum.find(params[:id])\n @metum.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :ok }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n #@phone.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @major.destroy\n respond_to do |format|\n format.html { redirect_to majors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @minisound.destroy\n respond_to do |format|\n format.html { redirect_to minisounds_url, notice: 'Minisound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @optimu = Optimu.find(params[:id])\n @optimu.destroy \n\n respond_to do |format|\n format.html { redirect_to optimus_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n return if @name.nil?\n delete_rest \"extra/#{@name}\"\n end"
] | [
"0.692041",
"0.6753942",
"0.66980445",
"0.6630836",
"0.66298884",
"0.6552481",
"0.6537767",
"0.65110785",
"0.6494982",
"0.6473316",
"0.6466775",
"0.6460174",
"0.645114",
"0.64442205",
"0.6435797",
"0.6431703",
"0.64227897",
"0.64171326",
"0.63979447",
"0.639683",
"0.63965845",
"0.6388077",
"0.6384661",
"0.63711625",
"0.6364498",
"0.63582027",
"0.6357152",
"0.63530415",
"0.63530415",
"0.63517785",
"0.634644",
"0.6345112",
"0.6342187",
"0.633726",
"0.633726",
"0.63267404",
"0.6326112",
"0.63248616",
"0.63066125",
"0.63066125",
"0.63066125",
"0.63066125",
"0.63058114",
"0.6296284",
"0.62949556",
"0.62931615",
"0.62893546",
"0.6288603",
"0.62762374",
"0.62757415",
"0.62755233",
"0.6274417",
"0.6273964",
"0.6272517",
"0.62645817",
"0.6264298",
"0.6260138",
"0.6259418",
"0.6259118",
"0.6256623",
"0.62543434",
"0.62445027",
"0.62436336",
"0.6243517",
"0.62380785",
"0.6235708",
"0.6234363",
"0.62322843",
"0.62308186",
"0.6224145",
"0.6222871",
"0.6221404",
"0.62193155",
"0.62185717",
"0.6217217",
"0.620814",
"0.62001014",
"0.61981493",
"0.61939",
"0.6191727",
"0.6190131",
"0.61900914",
"0.6181495",
"0.6179066",
"0.61777365",
"0.61728597",
"0.616496",
"0.61614156",
"0.6160545",
"0.6159347",
"0.6151012",
"0.6150453",
"0.61471194",
"0.6146862",
"0.6145684",
"0.61452",
"0.6144859",
"0.614267",
"0.6141902",
"0.6138972"
] | 0.6596285 | 5 |
Use callbacks to share common setup or constraints between actions. | def set_minuman
@minuman = Minuman.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def minuman_params
params.fetch(:minuman, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004",
"0.6290563",
"0.6284484",
"0.62436926",
"0.6239928",
"0.62184125",
"0.62158304",
"0.6210187",
"0.6194002",
"0.61786795",
"0.61759156",
"0.617342",
"0.6162248",
"0.61528504",
"0.61527",
"0.6146735",
"0.6122714",
"0.61169004",
"0.61082125",
"0.61052656",
"0.6091036",
"0.60807735",
"0.6070328",
"0.60634184",
"0.60213035",
"0.6017676",
"0.6013606",
"0.601112",
"0.6007318",
"0.6007318",
"0.6001461",
"0.6001135",
"0.59966296",
"0.5992013",
"0.59919006",
"0.599182",
"0.5980991",
"0.59676576",
"0.5960269",
"0.59588194",
"0.59585214",
"0.59578323",
"0.5953503",
"0.5952524",
"0.59432703",
"0.5939858",
"0.59388995",
"0.59388995",
"0.5933866",
"0.5930038",
"0.5925672",
"0.5924214",
"0.59169805",
"0.59106255",
"0.5910254",
"0.59086037",
"0.5906149",
"0.5898294",
"0.58981514",
"0.5896171",
"0.58944154",
"0.58943397",
"0.5892325",
"0.5887239",
"0.58842856",
"0.5880209",
"0.5874584",
"0.58694917",
"0.5868719",
"0.58669394",
"0.5866552",
"0.58662945",
"0.5864085",
"0.58623236",
"0.5862258",
"0.58597904",
"0.58579135",
"0.58542645",
"0.5853335",
"0.58517563",
"0.5850614"
] | 0.0 | -1 |
attempting to connect login to users | def login_is_valid
username = params["uname"]
password = params["psw"]
if username == "admin" && password == "password"
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_to_login\n User.login(self.name, self.password)\n end",
"def login; end",
"def login\n end",
"def login\n client.login(\n params[:user],\n params[:password],\n authParams: {\n scope: 'openid name email'\n },\n connection: 'Username-Password-Authentication'\n )\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n\n end",
"def login\n\n end",
"def login(username, pwd)\n user = @server.proxy('User')\n logged_in_user_response = user.login({'login' => username, 'password' => pwd})\n #puts \"\\nlogged in user id = \" + logged_in_user_response['id'].to_s\n end",
"def logon2(username, password, dbname, mode)\n #This is a stub, used for indexing\n end",
"def login\n\tend",
"def login_as_testuser\n login '[email protected]', 'TestPass'\n end",
"def connect\n \t\t#Se sigue la convencion para la identificacion del usuario\n \t\t#y buscamos alusuario que se intenta conectar\n \t\tself.current_user = find_user\n \tend",
"def login\n make_login_call\n end",
"def userlogin(req)\n\tbasica = request.env[\"HTTP_AUTHORIZATION\"].to_s.split(\"Basic \")\n\tbasicas = basica[1].to_s\n\tauthdata = (Base64.decode64(basica.to_s)).split(':')\n\tusername = authdata[0].to_s\n\tpass = authdata[1].to_s\n\tputs \"Usuario: #{username}\"\n\tputs \"Password: #{pass}\"\n\tu = User.where(email:username,password:pass).take\n\tsession[:username] = username\n\treturn u\nend",
"def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end",
"def login(user, password)\n\[email protected]('String' => \"login #{user} #{password}\\r\",'Match' => /error id=0 msg=ok\\n/, 'Timeout' => 3)\nend",
"def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && user.authenticate(params[:password]) == false) || user.deleted\n render status: 400, json: nil \n else\n session[:user_id] = user.id\n session[:username] = user.username\n session[:email] = user.email\n session[:verified] = user.verified\n user.last_ip_login = request.remote_ip\n user.save\n render status: 200, json: session\n end\n end",
"def make_login user, password\n server = Configuration.SERVER\n addr = Configuration.CLIOWL_ADDRESS\n \n HttpHelper.post \"http://#{server}#{addr}/login\", { 'user' => user, 'password' => password }\n end",
"def login \n\t\tuser_data = @view.display_login\n\t\t$users.each do |user|\n\t\t\tif user_data[0] == user.mail && user_data[1] == user.password\n\t\t\t\t@current_user = user\n\t\t\t\toption = @view.second_view(user, user.actions)\n\t\t\t\tlist(option)\n\t\t\telse \n\t\t\t\tputs \"User not register\\n\"\n\t\t\t\tputs \"\"\t\n\t\t\t\toption = @view.initial_view\n\t\t\t\tlist(option)\n\t\t\tend\n\t\tend\t\n\tend",
"def login\n\t\tbegin\n\t\t\tr = execute(make_xml('LoginRequest', { 'sync-id' => 0, 'password' => @password, 'user-id' => @username }))\n\t\trescue APIError\n\t\t\traise AuthenticationFailed.new(r)\n\t\tend\n\t\tif(r.success)\n\t\t\t@session_id = r.sid\n\t\t\treturn true\n\t\tend\n\tend",
"def try_login\n if user = http_auth_login || validation_login || remember_me_login\n session[:uid] = user.id\n end\n end",
"def login_correctly\r\n\t\tuserid = \"[email protected]\"\r\n\t\tpassword = \"correct_password\"\r\n\tend",
"def login\n @user = User.find_by nickname: params[:nickname]\n if @user\n if (@user.is_password?(params[:password]))\n session[:id] = @user.id\n redirect_to url_for(:controller => :users, :action => :show, id: @user.id)\n else\n redirect_to action: \"index\", :notice => \"Login failed. Invalid password.\"\n end\n else\n redirect_to action: \"index\", :notice => \"Login failed. Invalid username.\"\n end\n end",
"def login\n valid = true\n \n if username.blank?\n self.errors.add_to_base(\"Please enter a user name\")\n valid = false\n end\t\n \n if password.blank?\n self.errors.add_to_base(\"Please enter a password\")\n valid = false\n end\n \t\t\n if valid\n user = User.find(:first, :conditions => [\"username = ? AND password = ?\", username, password])\n \n if user\n self.id = user.id\n self.reload\n else\n self.errors.add_to_base(\"The user name/password was incorrect.\")\n valid = false\n end\n end\n \n valid\n end",
"def create_user_and_login \n\t\tinsert_into :users, {\n\t\t\tid: 1 ,\n\t\t\tfirst_name: 'First',\n\t\t\tlast_name: 'Last',\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password',\n\t\t\trole_id: 1,\n\t\t\tuid: \"a\"\n\t\t}\n\n\t\tproxy.post( 'http://my.ownet/api/session',{\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password'\n\t\t}.to_json)\n\tend",
"def login\n\t\t\tresponse = @http.get(\"/authentication/whoami\")\n\t if(response.code == '200')\n\t set_cookie(response)\n\t puts \"\"\n\t puts \"================\"\n\t puts \"login\"\n\t login_response = @http.post(\"/authentication/login\",\"username=#{@username}&password=#{@password}&skin=#{@skin}&account=#{@account}\",{'Cookie' => @cookies.to_s})\n\t check_cookie(login_response)\n\t login_check(login_response)\n\t puts \"--------\"\n\t else\n\t puts \"Error invalid host #{response.message}\"\n\t abort #if the login site is invalid, then abort\n\t end \n\t\tend",
"def login\n username.set 'tomsmith'\n password.set 'SuperSecretPassword!'\n end",
"def login\n @user = users(:user1)\n post user_session_path, params: { 'user[email]' => @user.email, 'user[password]' => 'password' }\n end",
"def connect_login(global = true)\n pop2sock = connect(global)\n\n\n if !(user and pass)\n print_status(\"No username and password were supplied, unable to login\")\n return false\n end\n\n print_status(\"Authenticating as #{user} with password #{pass}...\")\n res = raw_send_recv(\"HELO #{user} #{pass}\\r\\n\")\n\n if (res !~ /messages/)\n print_status(\"Authentication failed\")\n return false\n end\n\n print_status(\"Messages: #{res}\")\n return true\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def login(params)\r\n db = connect()\r\n result = db.execute(\"SELECT userid, username, password FROM users WHERE users.username=(?)\", params[\"username\"])\r\n if result == []\r\n return {\r\n error: true,\r\n message: \"Username or Password is incorrect\"\r\n }\r\n end\r\n username = result[0][\"username\"]\r\n password = result[0][\"password\"]\r\n id = result[0][\"userid\"]\r\n if params[\"username\"] == username && BCrypt::Password.new(password) == params[\"password\"]\r\n return {\r\n error: false,\r\n data: id\r\n }\r\n else \r\n return{\r\n error: true,\r\n message: \"Username or password is incorrect\"\r\n }\r\n end\r\n end",
"def login\n self.login\n end",
"def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end",
"def login(login, pass)\n @logged_in_user = Fotolia::User.new(self, login, pass)\n res = self.remote_call('loginUser', login, pass)\n raise UserLoginError unless(res['session_id'])\n @session_id = res['session_id']\n end",
"def login\n\t\t# Checks if there's a user associated\n\t\t# with the given email.\n\t\tu = User.find_by_email(params[:email])\n\n\t\t# If we find an email and the user\n\t\t# supplied the correct password we \n\t\t# login the user by starting a session.\n\t\t# We also redirect the user to the\n\t\t# control panel.\n\t\tif u && u.authenticate(params[:password])\n\t\t\t@id = u.id\n\t\t\t@token = Base64.encode64(params[:email] + ':' + params[:password])[0..-2]\n\n\t\t\tsession[:userid] = u.id\n\t\t\trender :template => 'api/v1/login/success'\n\t\telse\n\t\t\trender :status => 401, :template => 'api/v1/login/failure'\n\t\tend\n\tend",
"def db_login(db_connection)\n sql = 'SELECT username FROM user_logins WHERE user_id=$1'\n result = db_connection.exec_params(sql, [ id ])\n result.values.first.first\n end",
"def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend",
"def login_into_alchemy\n visit '/alchemy/admin/login'\n fill_in('alchemy_user_session_login', :with => 'jdoe')\n fill_in('alchemy_user_session_password', :with => 's3cr3t')\n click_on('Login')\n end",
"def login(params)\n if validate_login_user(params)\n db = connect_to_db()\n db.results_as_hash = true\n result = db.execute(\"SELECT id, password FROM users WHERE username=?\", [params[\"username\"]])\n if result.length == 0\n return {error: \"Check your input again\"}\n end \n if BCrypt::Password.new(result[0][\"password\"]) == params[\"password\"]\n return {user_id: result[0]['id']}\n else\n return {error: \"You have not provided the correct credentials!\"}\n end\n else\n return {error: \"Make sure your password is the same in both boxes.\"}\n end\n end",
"def capable_login_auth?; end",
"def default_login\n login(\"[email protected]\",\"codetheoryio\")\n end",
"def login user, password\n @username = user\n @ctx.login user, password\n end",
"def login\n\n username = prompt.ask(\"Enter your username:\\n\")\n while !User.find_by(username: username)\n puts \"Username not found - please try again.\\n\"\n username = prompt.ask(\"Enter your username:\\n\")\n end\n\n password = prompt.mask(\"Enter your password:\")\n while User.find_by(username: username).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your password:\")\n end\n \n self.user_id = User.find_by(username: username).id\n puts \"Successfully logged in! Welcome #{User.return_username(user_id)}!\\n\"\n\n show_threads\n end",
"def login()\n uri = URI('http://54.252.241.122:8000/users/authenticate')\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {email: '[email protected]', password: '*********'}.to_json\n res = http.request(req)\n tkn=JSON.parse(res.body)\n return tkn['result']['token']\nend",
"def mssql_login_datastore(db='')\n\t\tmssql_login(datastore['USERNAME'], datastore['PASSWORD'], db)\n\tend",
"def client_login\n user = User.authenticate(params[:email], params[:password])\n if user\n session[:user_id] = user.id\n params.delete(:locale)\n set_locale\n redirect_to :controller=>'home', :action=>'index'\n else # Si hay error:\n #Verifico que el usuario este registrado en el sistema\n if User.find_by_email(params[:email]).nil?\n flash[:error] = I18n.t('session.login_email_error', :user=> params[:email].to_s)\n redirect_to sessions_url\n else\n #Si email es valido entonces el error es el password\n flash[:error] = I18n.t('session.login_password_error')\n render \"index\", :layout => \"login\"\n end\n end\n end",
"def login\n self.class.trace_execution_scoped(['Custom/login/find_user']) do\n @u = (User.find_by_primary_email(params[:username].downcase) || User.find_by_nickname(params[:username].downcase.to_s)) if params[:username]\n end\n\n self.class.trace_execution_scoped(['Custom/login/if_block']) do\n if @u and @u.has_password? and @u.valid_password?(params[:password])\n @user = @u\n elsif @u and (params[:password] == \"anonymous\") and (@u.user_type == User::USER_TYPE[:anonymous])\n @user = @u\n else\n query = {:auth_failure => 1, :auth_strategy => \"that username/password\"}\n query[:redir] = params[:redir] if params[:redir]\n redirect_to add_query_params(request.referer || Settings::ShelbyAPI.web_root, query) and return\n end\n end\n\n # any user with valid email/password is a valid Shelby user\n # this sets up redirect\n self.class.trace_execution_scoped(['Custom/login/sign_in_current_user']) do\n sign_in_current_user(@user)\n end\n redirect_to clean_query_params(@opener_location) and return\n end",
"def run()\n login()\n end",
"def needs_login?() false end",
"def login(luser, password)\n @sid = @connection.call(\"auth.login\", luser, password)\n end",
"def connect\n self.current_user = find_verified_user # define current_user property once user sucessfully connected\n end",
"def login_user(username, password) # a[userid], \n result = db_connection().execute('SELECT id, password FROM users WHERE username=?', username)\n p result\n if result.length > 0\n if BCrypt::Password.new(result[0][\"password\"]) == password\n return {\n ok: true,\n msg: \"Logged in!\",\n id: result[0][\"id\"]\n }\n end\n return {\n ok: true,\n msg: \"Logged in!\"\n }\n end\n return {\n ok: false,\n msg: \"Password not located!\"\n }\n end",
"def require_login\n end",
"def login(args)\n return self.request(:c => :user, :a => :login, :username => args[:username], :password => args[:password])\n end",
"def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end",
"def login\n # pull the user info from the user model with the login params\n user = User.find_by_login(params[:login])\n # Authenciate with password\n if user and user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:user_login] = user.login\n session[:user_authority] = user.authority\n # redirect to the landing page\n redirect_to \"/projects\"\n # failed \n else\n redirect_to login_url, alert: \"無効なID、パスワードの組み合わせです。\"\n end\n end",
"def login\n response = get \"server\"\n response.code == 200\n end",
"def login\n response = get \"server\"\n response.code == 200\n end",
"def login_as(user)\n login(users(user).email, users(user).password)\n end",
"def login\n \tauthenticate(params)\n end",
"def _login(username, password)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.users_path}/login.#{@configuration.api_request_format}\"\n response = post url, body: {user: username, password: Digest::MD5.hexdigest(password)}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end",
"def login\n user = User.find_by_email(params[:user][:email])\n if user == nil\n flash[:errors] = [\"Email not found!\"]\n redirect_to :back\n else\n if user.authenticate(params[:user][:password])\n session[:user_id] = user.id\n redirect_to '/channels/main'\n else\n flash[:errors] = [\"Password does not match!\"]\n redirect_to :back\n end\n end\n end",
"def login_known(the_user)\n # Get an instance of the user\n user = users(the_user)\n # provide the credentials and log in\n # Note the encrypted_password in the yml was created using an\n # instance of User in console with a password as below\n post user_session_path,\n params: {\n user: {\n email: user.email,\n password: \"secret08\",\n remember_me: 0\n },\n commit: \"Log in\"\n }\n end",
"def login(username = '[email protected]')\n @user = User.find(:first, :conditions => { User._(:username) => username})\n @request.session[:user] = @user.id\n @request.session[:ministry_id] = 1\n @person = @user.person\n end",
"def setup_session_with_username\n method = 'smugmug.login.withPassword'\n setup_session_with [\"method=#{method}\",\"EmailAddress=#{@smug_user.email}\",\"Password=#{@smug_user.password}\"]\n end",
"def login(username, password)\n db = connect_db(\"db/webshop.db\")\n params = [username, password]\n is_valid(params)\n result = db.execute(\"SELECT * FROM users WHERE username=?\", username).first\n if result != nil\n password_digest = result[\"password_digest\"]\n id = result[\"id\"]\n if BCrypt::Password.new(password_digest) == password\n session[:user] = username\n session[:id] = id\n redirect('/elever')\n else\n session[:error] = \"Fel lösenord eller användarnamn. Försök igen.\"\n redirect('/error')\n end\n else\n session[:error] = \"Fel lösenord eller användarnamn. Försök igen.\"\n redirect('/error')\n end\n end",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end",
"def login_user(xml) \n login = xml.root.get_elements('User').first.text \n password = xml.root.get_elements('Password').first.text \n self.current_user = User.authenticate(login, password) \n end",
"def _login argv = nil\n\t\tif argv[:name] and argv[:pawd]\n\n\t\t\t# valid field format\n\t\t\tf = argv\n\t\t\t_valid :user, f\n\n\t\t\t# if no user\n\t\t\tds = Sdb[:_user].filter(:name => f[:name])\n\t\t\t_throw Sl[:'the user is not existed'] if ds.empty?\n\n\t\t\t# verify password\n\t\t\trequire \"digest/sha1\"\n\t\t\tif ds.get(:pawd) == Digest::SHA1.hexdigest(f[:pawd] + ds.get(:salt))\n\t\t\t\tsid = Digest::SHA1.hexdigest(f[:name] + Time.now.to_s)\n\t\t\t\t_session_create sid, ds.get(:uid)\n\t\t\telse\n\t\t\t\t_throw Sl[:'the password is wrong']\n\t\t\tend\n\n\t\tend\n\tend",
"def login_guest()\n login(:guest)\n end",
"def login\n email = params[:email]\n password = params[:password]\n user_db = User.find_by(email: email)\n if user_db.nil? \n @msg = \"User does not exists\"\n render :adduser\n return \n end\n if user_db.password != password \n @msg = \"Authentication failed\"\n render :adduser\n return\n end\n session[:email] = email\n session[:firstname] = user_db.firstname\n session[:lastname] = user_db.lastname\n render \"article/addarticle\"\n \n end",
"def login\n\t\t# If the person is already logged in, redirected to the index\n redirect_to(:controller=>\"neurons\", :action=>\"index\") unless session[:user_id].nil? \n\t\n\t\t if request.post?\n\t\t\t user = User.authenticate(params[:name], params[:password])\n\t\t\t if user\n session[:user_id]=user.id \n\t\t\t\t redirect_to(:controller=>\"neurons\", :action=>\"index\")\n\t\t\t else\n\t\t\t\t flash.now[:error] = \"Wrong password\"\n\t\t\t end\n\t\t end\n\tend",
"def login\n @current_user = nil\n system 'clear'\n puts \"--------LOGIN--------\"\n username = @prompt.ask(\"Username: \", required: true)\n if User.all.map(&:name).include?(username)\n @current_user = User.all.find{|user_instance| user_instance.name == username}\n if password\n main_menu\n end\n else\n if @prompt.yes?(\"There is no user by this name. Would you like to create an account?\")\n create_account\n end\n end\n end",
"def login(user=:joerg)\r\n login_as(user)\r\n end",
"def login(username, password)\n db = connect_db(\"db/webshop.db\")\n\n params = [username, password]\n is_valid(params)\n\n result = db.execute(\"SELECT * FROM users WHERE username=?\", username).first\n \n if result != nil\n password_digest = result[\"password_digest\"]\n id = result[\"id\"]\n if BCrypt::Password.new(password_digest) == password\n p username\n session[:user] = username\n p session[:user]\n session[:id] = id\n redirect('/items')\n else\n session[:error] = \"Wrong password or username. Try again\"\n redirect('/error')\n end\n else\n session[:error] = \"Wrong password or username. Try again\"\n redirect('/error')\n end\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def login_helper\n username = prompt.ask(\"Enter Username\")\n password = prompt.ask(\"Enter Password\")\n if User.find_by(name: username, password: password)\n self.user = User.find_by(name: username, password: password)\n # no music yet\n puts \"Let's Get Cookin, #{self.user.name.upcase}!!!\"\n sleep(1.5)\n main_menu\n else\n puts \"Incorrect Username or Password\"\n sleep(1.5)\n login_page\n end\n end",
"def login\n if params[:username].nil? || params[:username].empty?\n flash[:error] = \"You must enter a username\"\n # If ldap is not setup, there will be no password\n elsif LdapInfo.setup?\n if LdapInfo.login params[:username], params[:password]\n set_current_user params[:username]\n else\n flash[:error] = \"Username and password not accepted\"\n end\n else\n set_current_user params[:username]\n end\n if !request.referer.nil? # Try to redirect to the same page they logged in from\n redirect_to request.referer\n else\n redirect_to tips_path\n end\n end",
"def login\n if not @login.nil? and not @login.blank?\n @login\n elsif not self.username.nil? and not self.username.empty?\n self.username\n else\n self.email\n end\n end",
"def login\n \t# Find a user with params\n \tuser = User.authenticate(@credentials[:password], @credentials[:username])\n \tif user\n\t \t# Save them in the session\n\t \tlog_in user\n\t \t# Redirect to articles page\n\t \tredirect_to articles_path\n\telse\n\t\tredirect_to :back, status: :created\n\tend\n end",
"def log_in(user)\n email = $credentials[user]['email']\n password = $credentials[user]['password']\n case user\n when 'User A'\n transporter.go_to_url(USER_A_HOST)\n set_field('identifier', email)\n click_btn('Next')\n set_field('password', password)\n click_btn('Next')\n when 'User B'\n transporter.go_to_url(USER_B_HOST)\n end\n end",
"def login\n # puts \"UserNAme #{username}.\"\n self.login_username_element.when_present(30)\n # expect(self.login_username?).to be_truthy\n self.login_username= DT['ENV']['Username']\n self.login_password= DT['ENV']['Password']\n self.login_login\n end",
"def loginNormal(userInfo)\n \n begin\n \n query = \"SELECT uuid FROM `#{USER_TABLE}` WHERE `email` = ? AND `password` = ?\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute(userInfo[\"email\"],userInfo[\"password\"])\n count=0\n isIn=false\n sth.fetch() { |row| \n isIn=row[0]\n } \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return isIn\n \n end",
"def login_with_proper_credentials\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, VALID_PASSWORD)\r\n\r\n click_on_button(SUBMIT_BUTTON_ID)\r\n\r\n end",
"def login\n $log.debug \"Logging in\" \n `./nplogin #{@@username} #{@@password}`\n end",
"def login_user(params)\n val = validate_user(params)\n if val == false\n return {\n error: true,\n message: \"no such user user\"\n }\n end\n username = params[\"name\"]\n pswrd = params[\"password\"]\n\n db = connect()\n \n result = db.execute(\"SELECT id, password FROM Users WHERE name = ?\", username).first\n \n password = result[\"password\"]\n if BCrypt::Password.new(password) != pswrd\n return {\n error: true,\n message: \"Wrong password\"\n }\n else\n return {\n error: false,\n id:result[\"id\"]\n }\n end\n end",
"def UserLogin(user)\n choose_language(user.language)\n username_tb.type_text(user.username)\n password_tb.type_text(user.password)\n partnerType = user.partnerType\n case partnerType\n when 'home'\n home_login_btn.click\n when 'pro'\n login_btn.click\n ent_restore_link.click\n when 'ent'\n login_btn.click\n #if (user.keyType == 'ckey')\n # if (\"#{QA_ENV['environment']}\" == \"staging\")\n # ent_restore_link_ckey.click\n # else if (\"#{QA_ENV['environment']}\" == \"production\")\n # ent_restore_link_ckey1.click\n # end\n # end\n #end\n\n if (\"#{QA_ENV['environment']}\" == \"staging\")\n if (user.keyType == 'ckey')\n ent_restore_link_ckey.click\n else\n ent_restore_link_stag.click\n end\n else if (\"#{QA_ENV['environment']}\" == \"production\")\n if (user.keyType == 'ckey')\n ent_restore_link_ckey1.click\n else\n ent_restore_link.click\n end\n\n else\n ent_restore_link.click\n end\n end\n\n when 'oem'\n login_btn.click\n ent_restore_link.click\n end\n #puts \"**********\"\n #puts page.response_headers()\n #puts `pwd`\n end",
"def check_login\n \t\t\tif self.session == nil\n \t\t\t\t login\n \t\t\tend\n \tend",
"def do_login(user, pass)\n vprint_status(\"#{rhost}:#{rport} - Trying username:'#{user.inspect}' with password:'#{pass.inspect}'\")\n begin\n res = send_request_cgi(\n {\n 'uri' => \"/doms/login/processLogin.php\",\n 'method' => 'GET',\n 'vars_get' =>\n {\n 'login' => user,\n 'passwd' => pass,\n 'tzOffset' => '-25200',\n 'tzString' => 'Thur+May+05+1983+05:05:00+GMT+0700+'\n }\n })\n\n if res.nil?\n print_error(\"#{rhost}:#{rport} - Connection timed out\")\n return :abort\n end\n\n check_key = \"The user has logged in successfully.\"\n\n key = JSON.parse(res.body)[\"statusString\"]\n\n if (not res or key != \"#{check_key}\")\n vprint_error(\"#{rhost}:#{rport} - FAILED LOGIN. '#{user.inspect}' : '#{pass.inspect}' with code #{res.code}\")\n return :skip_pass\n else\n print_good(\"#{rhost}:#{rport} - SUCCESSFUL LOGIN. '#{user.inspect}' : '#{pass.inspect}'\")\n report_cred(\n ip: rhost,\n port: rport,\n service_name: 'SevOne Network Performance Management System Application',\n user: user,\n password: pass,\n proof: key\n )\n return :next_user\n end\n\n rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE\n print_error(\"#{rhost}:#{rport} - HTTP Connection Failed, Aborting\")\n return :abort\n end\n end",
"def login!(passwd = nil)\n self.password = passwd || self.password\n response = client.login(username.to_s, password.to_s)\n apply_attributes! response.result\n self.session_token.present?\n end",
"def login\n username = find_username\n password = find_password\n\n Log.info(\"Logging in as #{username}... \", newline: false)\n\n conn = Faraday.new(url: \"https://redacted.ch/\")\n response = conn.post do |request|\n request.url \"login.php\"\n request.headers[\"User-Agent\"] = RedactedBetter.user_agent\n request.body = { username: username, password: password }\n end\n\n handle_login_response(response)\n rescue Faraday::TimeoutError\n Log.error(\"Logging in timed out. Perhaps Redacted is down?\")\n false\n end",
"def checklogin\n\t\t@login = User.where(\"username = '#{params[:username]}'\").first\n\n\t\tp params, @login\n\n\t\tif @login && @login.password == params[:password]\n\t\t\tsession[:user_id] = @login.id\n\t\telse\n\t\t\tflash[:notice] = \"YOU ARE AN IMPOSTER\"\n\t\t\t@login = nil\n\t\t\tredirect_to '/'\n\t\tend\n\tend",
"def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end"
] | [
"0.7239709",
"0.72365034",
"0.7222955",
"0.7163254",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.7114124",
"0.71093374",
"0.71093374",
"0.7049157",
"0.6981573",
"0.6962475",
"0.6932809",
"0.69017315",
"0.68457365",
"0.68354714",
"0.68314654",
"0.6792055",
"0.6783449",
"0.6777833",
"0.67756987",
"0.6726767",
"0.67245823",
"0.67142546",
"0.66864234",
"0.66859496",
"0.6645223",
"0.6645118",
"0.6645097",
"0.664434",
"0.6643156",
"0.6636375",
"0.6623072",
"0.6615468",
"0.6602083",
"0.6601085",
"0.6595222",
"0.65861785",
"0.6581682",
"0.65812933",
"0.65770906",
"0.65742",
"0.6549397",
"0.6545574",
"0.65425897",
"0.65398276",
"0.6533633",
"0.652648",
"0.6519543",
"0.6510487",
"0.6508802",
"0.6501759",
"0.64941305",
"0.64892006",
"0.64888775",
"0.6487507",
"0.64873904",
"0.64771026",
"0.6474401",
"0.6474401",
"0.64672583",
"0.64642036",
"0.6457926",
"0.64566857",
"0.6454915",
"0.64545006",
"0.6451594",
"0.64455575",
"0.64431626",
"0.6432174",
"0.6432123",
"0.64280856",
"0.64270246",
"0.6423651",
"0.6404198",
"0.64013374",
"0.6400265",
"0.63973665",
"0.6395394",
"0.6391933",
"0.63863635",
"0.637515",
"0.63700956",
"0.6368488",
"0.63677317",
"0.6362508",
"0.63593763",
"0.635528",
"0.63526803",
"0.6352476",
"0.6348687",
"0.63427323",
"0.6342594",
"0.63418585",
"0.6337701"
] | 0.0 | -1 |
Here's a handy guide: The major takeaway for being able to read this code is to understand that these things, called symbols, are essentially global constants. They cannot be declared or assigned. They are referenced by a string representation preceded by a colon. All symbols with the same string representation are the SAME OBJECT. Above, we were using the symbols as an obtuse way to reference a string. This is not a realistic use. On the other hand, if there are global tokens that should always reference the same thing: | def planetaryWelcome(planet)
if [:mercury, :venus, :earth, :mars, :jupiter, :saturn, :uranus, :neptune].include? planet
puts "Welcome to planet #{planet}!"
else
puts "#{planet} is not a planet!"
if [:moon].include? planet
puts "Come to the dark side, we have cake."
elsif [:pluto].include? planet
puts "Sorry dude."
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def objects_and_symbols; end",
"def symbols; end",
"def symbol\n @symbol\n end",
"def symbols() @symbols end",
"def symbol\n :R\n end",
"def symbolidentifier\n\n \t\n\t\tif @usersym.upcase == \"X\" then \n\t\t @compsym = \"O\" \n \t\t else \n \t\t @compsym = \"X\"\n \t\tend \n\n\n end",
"def sym\n @sym\n end",
"def symbol\n \n end",
"def symbol\n :R\n end",
"def symbol\n Util.from_bytes :symbol, value\n end",
"def sym(name)\n SymEngine::Symbol.new(name)\nend",
"def init_constants\n @symbol_table.store_symbol 'SPACE', ' ', readonly: true\n @symbol_table.store_symbol 'TAB', \"\\t\", readonly: true\n @symbol_table.store_symbol 'NEWLINE', \"\\n\", readonly: true\n end",
"def get_symbol\n token = @tokens.next\n\n case token\n when :symbol then\n [:symbol, *parse_symbol]\n when :symbol_link then\n [:symbol_link, @tokens.next]\n else\n raise ArgumentError, \"expected SYMBOL or SYMLINK, got #{token.inspect}\"\n end\n end",
"def gen_symbols\n @symbols = true\n end",
"def use(sym); end",
"def literal_symbol(sym)\n Sequel.synchronize{@symbol_literal_cache[sym]}\n end",
"def sym(name)\n #This is a stub, used for indexing\n end",
"def symbol(string)\n Types::Symbol.cast(string)\n end",
"def k_symbol(aSymbol)\n Atomic::KSymbol.new(aSymbol)\n end",
"def parse_typographic_syms; end",
"def start_symbol\n @start_symbol\n end",
"def to_sym() end",
"def to_sym() end",
"def to_sym() end",
"def object_symbol\n class_name = self.class.name\n index = class_name.rindex(/::/)\n class_name[index+2..-1].underscore.to_sym\n end",
"def replace_symbols_with_refs\n symbol_defs = symbols_first_pass\n symbols_second_pass symbol_defs\n end",
"def get_symbols\n\t\treturn @symbols\n\tend",
"def known_symbol?(s)\n @@known_symbols_by_glass[glass] && @@known_symbols_by_glass[glass].member?(s)\n end",
"def globals; end",
"def globals; end",
"def symbol\n sub_str = @sub ? \"b\" : \"\"\n chord_str = @@chord_symbols[@mode][@step]\n modifiers_str = @modifiers.empty? ? \"\" : \"-#{@modifiers * \"-\"}\"\n inversion_str = @inversion > 1 ? \"_#{@inversion}\" : \"\"\n \n \"#{sub_str}#{chord_str}#{modifiers_str}#{inversion_str}\".intern\n end",
"def symbol\n :Y\n end",
"def do_global_map\r\n $FOORTH_GLOBALS[@symbol]\r\n end",
"def initialize(symbol)\n @symbol = symbol # the printable representation of variable\n end",
"def get_tokenize\n @lexeme = nil\n loop {\n case @string\n\t when nil\t\t# the end\n\t @sym = nil\n\t break\n when \"\" # the end\n @sym = nil\n break\n when /\\A[\\r\\n\\t ]+/m\t# skip whitespace\n @string = $'\n when /\\A\\(/m # skip comment\n comment\n when /\\A\"\"/ # skip empty quoted text\n @string = $'\n when /\\A[\\w!$%&\\'*+\\/=?^\\`{\\}|~#-]+/m\n @string = $'\n @sym = SYM_ATOM\n break\n when /\\A\"(.*?([^\\\\]|\\\\\\\\))\"/m\n @string = $'\n @sym = SYM_QTEXT\n @lexeme = $1.gsub(/\\\\(.)/, '\\1')\n break\n when /\\A</\n @string = $'\n @sym = SYM_LESS_THAN\n break\n when /\\A>/\n @string = $'\n @sym = SYM_GREATER_THAN\n break\n when /\\A@/\n @string = $'\n @sym = SYM_AT_SIGN\n break\n when /\\A,/\n @string = $'\n @sym = SYM_COMMA\n break\n when /\\A:/\n @string = $'\n @sym = SYM_COLON\n break\n when /\\A;/\n @string = $'\n @sym = SYM_SEMI_COLON\n break\n when /\\A\\./\n @string = $'\n @sym = SYM_PERIOD\n break\n\t when /\\A(\\[.*?([^\\\\]|\\\\\\\\)\\])/m\n\t @string = $'\n\t @sym = SYM_DOMAIN_LITERAL\n\t @lexeme = $1.gsub(/(^|[^\\\\])[\\r\\n\\t ]+/, '\\1').gsub(/\\\\(.)/, '\\1')\n\t break\n when /\\A[\\200-\\377\\w!$%&\\'*+\\/=?^\\`{\\}|~#-]+/nm\n # This is just like SYM_ATOM, but includes all characters\n # with high bits. This is so we can allow such tokens in\n # the display name portion of an address even though it\n # violates the RFCs.\n @string = $'\n @sym = SYM_ATOM_NON_ASCII\n break\n when /\\A./\n @string = $'\t# garbage\n\t error('garbage character in string')\n else\n raise \"internal error, @string is #{@string.inspect}\"\n end\n }\n if @sym\n @lexeme ||= $&\n end\n end",
"def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end",
"def get_symbol_or_name\n tk = get_tk\n case tk[:kind]\n when :on_symbol then\n text = tk[:text].sub(/^:/, '')\n\n next_tk = peek_tk\n if next_tk && :on_op == next_tk[:kind] && '=' == next_tk[:text] then\n get_tk\n text << '='\n end\n\n text\n when :on_ident, :on_const, :on_gvar, :on_cvar, :on_ivar, :on_op, :on_kw then\n tk[:text]\n when :on_tstring, :on_dstring then\n tk[:text][1..-2]\n else\n raise RDoc::Error, \"Name or symbol expected (got #{tk})\"\n end\n end",
"def symbols\n @symbols ||= Array(@grpc.symbols).map do |b|\n Symbol.from_grpc b\n end\n end",
"def symbols\n @symbol_set.symbols\n end",
"def parse_symbol_in_arg\n tk = get_tk\n if :on_symbol == tk[:kind] then\n tk[:text].sub(/^:/, '')\n elsif :on_tstring == tk[:kind] then\n tk[:text][1..-2]\n elsif :on_dstring == tk[:kind] or :on_ident == tk[:kind] then\n nil # ignore\n else\n warn(\"Expected symbol or string, got #{tk.inspect}\") if $DEBUG_RDOC\n nil\n end\n end",
"def asm_symbol(s)\n sa = Word[s]\n return sa if !sa.nil?\n a = ['']\n s.each_char do |c|\n g = Graph[c]\n if g.nil?\n a[-1] << c\n else\n # graph char found\n if g != ''\n if a[-1] == ''\n a[-1] << g\n a << ''\n else\n a << \"#{g}\"\n a << ''\n end\n end\n end\n end\n if a[-1] == ''\n a.pop\n end\n a.join('_').downcase\n end",
"def scm_symbol?; SCM_FALSE; end",
"def initialize(sym)\n @sym = sym\n end",
"def globalsymbols(node)\n case node\n when Statements\n for stmt in node.stmts\n if stmt.class == FuncDecl\n for stmt_ in stmt.body.stmts\n if stmt_.class == Statements\n for stmt__ in stmt_.stmts\n if stmt__.class == VarDecl\n varDecl(stmt__)\n end\n end\n end\n end\n elsif stmt.class == Statements\n for stmt_ in stmt.stmts\n if stmt_.class == VarDecl\n varDecl(stmt_)\n end\n end\n end\n @cg.freeall_registers\n end\n end\n end",
"def add_known_symbol(s)\n @@known_symbols << s.to_sym\n @@known_symbols_by_glass[glass] ||= []\n @@known_symbols_by_glass[glass] << s.to_sym\n end",
"def initialize(name, symbol)\n @name = name\n @symbol = symbol\n end",
"def start_symbol\n START\n end",
"def sym\n @name.to_sym\n end",
"def to_sym; end",
"def symbol\n # prefer a code display value since the state name may not be unique between modules\n if [email protected]? && [email protected]?\n @codes.first.display.gsub(/\\s+/, '_').downcase.to_sym\n else\n @name.gsub(/\\s+/, '_').downcase.to_sym\n end\n end",
"def symbol\n # prefer a code display value since the state name may not be unique between modules\n if [email protected]? && [email protected]?\n @codes.first.display.gsub(/\\s+/, '_').downcase.to_sym\n else\n @name.gsub(/\\s+/, '_').downcase.to_sym\n end\n end",
"def symbol_suffix\n \"\"\n end",
"def os_sym\n os_parser.sym\n end",
"def Ref(from)\n return checkToken(Symbol)\n end",
"def find_local_symbol(symbol)\n find_method_named(symbol) or\n find_constant_named(symbol) or\n find_attribute_named(symbol) or\n find_external_alias_named(symbol) or\n find_module_named(symbol) or\n find_file_named(symbol)\n end",
"def global_variables() end",
"def current_symbol\n current_data ? current_data[:symbol] : nil\n end",
"def initialize(symbols:)\n @symbols = symbols\n @learned = {}\n end",
"def initialize(name, symbol)\n\t\t@name = name \n\t\t@symbol = symbol\n\tend",
"def current_symbol\r\n current_data ? current_data[:symbol] : nil\r\n end",
"def ==(other)\n self.symbol == other.symbol \n end",
"def to_symbol(str)\n case str\n when /'/\n \":'\" + str.to_s.gsub(\"'\"){ \"\\\\'\" } + \"'\"\n else\n ':' + str.to_s\n end\n end",
"def sym(position)\n return position if position.is_a? Symbol\n position.gsub(/\\s/, '_').to_sym\n end",
"def initialize(name, symbol)\n\t\t@name = name\n\t\t@symbol = symbol\n\tend",
"def find_local_symbol(symbol)\n find_method_named(symbol) or\n find_constant_named(symbol) or\n find_attribute_named(symbol) or\n find_module_named(symbol) or\n find_file_named(symbol)\n end",
"def symbol! sym\n initialize\n s0 = new_state\n s1 = new_state\n set_start(s0)\n set_final(s1, true)\n add_transition(s0, s1, sym)\n if (sym != \"\") && ([email protected]? sym)\n @alphabet.push sym\n end\n end",
"def symbol_ref\n @symbols += 1\n end",
"def register_symbol symbol\n @@registeredkeys[symbol] = self\n end",
"def inspect\r\n @symbol.inspect\r\n end",
"def symbols\n each_symbol.to_a\n end",
"def instance_var_sym(key)\n \"@#{key}\".to_sym\n end",
"def to_symbol\n case node\n in SyntaxTree::Label[value:]\n value.chomp(\":\").to_sym\n in SyntaxTree::SymbolLiteral[value: SyntaxTree::Ident[value:]]\n value.to_sym\n in SyntaxTree::SymbolLiteral[value:]\n raise CompilationError, \"Unexpected symbol value type: #{value.inspect}\"\n else\n raise CompilationError, \"Unexpected node type: #{node.class.name}\"\n end\n end",
"def turn_symbol_into_string(symbol)\n\tn = :foobar\n\tn.to_s\nend",
"def global_decls; end",
"def parse_user_defined\n name = get_symbol\n\n data = @tokens.next\n\n [object_ref, name, data]\n end",
"def symbol\n codepoints.pack(\"U*\")\n end",
"def foo\n {\n 'test': 1,\n 'special-key': 2,\n \"double-quote\": 3,\n \"#{1 + 1}\": 4,\n :\"non-hash-label\" => 5\n }\nend",
"def symbol! sym\ninitialize\ns0 = new_state\ns1 = new_state\nset_start(s0)\nset_final(s1, true)\nadd_transition(s0, s1, sym)\nif sym != \"\" && @alphabet.include?(\"#{sym}\") == false\[email protected](\"#{sym}\")\nend\nend",
"def create_symbols\n # creates all named symbols, including vector references\n @expressions.map { |a| a.create_symbols }\n puts(self.class)\n end",
"def browser_sym\n browser_parser.sym\n end",
"def symbol_key(x)\n key = x.dup\n key.traverse do |n|\n next unless n.name == \"math\"\n n.replace(grkletters(MathML2AsciiMath.m2a(n.to_xml)))\n end\n ret = Nokogiri::XML(key.to_xml)\n HTMLEntities.new.decode(ret.text.downcase).\n gsub(/[\\[\\]\\{\\}<>\\(\\)]/, \"\").gsub(/\\s/m, \"\").\n gsub(/[[:punct:]]|[_^]/, \":\\\\0\").gsub(/`/, \"\").\n gsub(/[0-9]+/, \"þ\\\\0\")\n end",
"def constants() end",
"def symbol_for_name(name)\n if symbols.has_key? name\n symbols[name]\n else\n raise \"No symbol with name #{name} found\"\n end\n end",
"def key_symbol\n @key\n end",
"def encode_global_variable(name)\n raise if name.to_s[0,1] != '$'\n \"$\" + @global_name_generator.get(name.to_s)\n end",
"def turn_symbol_into_string(symbol)\n symbol.to_s\nend",
"def literal_symbol_set(sym, lit)\n Sequel.synchronize{@symbol_literal_cache[sym] = lit}\n end",
"def symbol_key(x)\n HTMLEntities.new.decode(x.text).gsub(/_/, \":\").gsub(/`/, \"\").\n gsub(/[0-9]+/, \"þ\\\\1\")\n end",
"def to_symbol(string)\n string.gsub(/[\\-_]/, '').to_sym\n end",
"def intern() end",
"def constant_decls; end",
"def global_string_pointer(string, name = \"\")\n Instruction.from_ptr(C.build_global_string_ptr(self, string, name))\n end",
"def methods_accepting_symbol; end",
"def labels_have_symbols!\n end",
"def intern(sym)\n sym.to_sym.to_i\n end"
] | [
"0.69113374",
"0.69113374",
"0.69113374",
"0.69113374",
"0.69113374",
"0.69113374",
"0.68875116",
"0.67763805",
"0.67164433",
"0.6650552",
"0.63615495",
"0.63352233",
"0.6324929",
"0.62851375",
"0.62288034",
"0.618387",
"0.6167982",
"0.61440414",
"0.6103599",
"0.6050412",
"0.6043668",
"0.60137063",
"0.5997558",
"0.5983076",
"0.5976127",
"0.59318864",
"0.59310853",
"0.59047693",
"0.59047693",
"0.59047693",
"0.588757",
"0.5853942",
"0.5834898",
"0.5807264",
"0.578925",
"0.578925",
"0.5782854",
"0.5782328",
"0.5764174",
"0.57541376",
"0.5716626",
"0.56978697",
"0.56965744",
"0.5669373",
"0.5669277",
"0.5653545",
"0.5647515",
"0.56461704",
"0.56343186",
"0.563414",
"0.56335896",
"0.5607204",
"0.56059635",
"0.5600496",
"0.55761456",
"0.55658823",
"0.55658823",
"0.5546332",
"0.5537516",
"0.55293643",
"0.5521299",
"0.5518097",
"0.551054",
"0.550937",
"0.54735965",
"0.5470121",
"0.54686326",
"0.545985",
"0.54561853",
"0.5456103",
"0.54504985",
"0.54434067",
"0.54332066",
"0.5432436",
"0.5422872",
"0.5418884",
"0.5416446",
"0.5404155",
"0.539599",
"0.5390808",
"0.5388588",
"0.5381247",
"0.5373222",
"0.53717965",
"0.53707606",
"0.53647286",
"0.53566045",
"0.5354615",
"0.53530425",
"0.5352134",
"0.53516644",
"0.53477836",
"0.5341059",
"0.5340518",
"0.53381073",
"0.5328808",
"0.53204614",
"0.53112966",
"0.53062564",
"0.5295852",
"0.5290262"
] | 0.0 | -1 |
Calculate and set the corrective_change parameter, based on the old_system_value of the property. | def calculate_corrective_change(old_system_value)
# Only idempotent properties, and cases where we have an old system_value
# are corrective_changes.
if @property_instance.idempotent? &&
!@property_instance.sensitive &&
!old_system_value.nil?
# If the values aren't insync, we have confirmed a corrective_change
insync = @property_instance.insync_values?(old_system_value, previous_value)
# Preserve the nil state, but flip true/false
@corrective_change = insync.nil? ? nil : !insync
else
@corrective_change = false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed_value(property)\n new_value = new_resource.send(property)\n return new_value if current_resource.nil?\n\n current_value = current_resource.send(property)\n\n return current_value if required_properties.include? property\n\n new_value == current_value ? nil : new_value\n end",
"def change\n attributes.fetch(:change)\n end",
"def old_value; end",
"def compute_change(current_value, previous_value)\n diff = current_value - previous_value\n change = nil\n if diff < -0.2\n change = -1\n elsif diff > 0.2\n change = 1\n else\n change = 0\n end\n\n return change\n end",
"def change\n @last_change = if rand < @change_probability[:speed]\n change_speed; :speed\n else\n change_offset; :offset\n end\n end",
"def changed_by\n return :setter if @initial_value.nil? || @value.nil? || @value == @initial_value\n\n # the value was clearly altered, now let's see how\n\n base_value = @value\n base_value -= @incremented_by\n\n return :modifier if base_value.round(6) == @initial_value.round(6)\n return :setter\n end",
"def change_value(attribute)\n value = ticker.send(attribute)\n if value > 0\n return \"+#{value}\"\n else\n return value\n end\n end",
"def calculate_report_corrective_change\n @corrective_change = resource_statuses.any? do |name, status|\n status.corrective_change\n end\n end",
"def calculate_change\n\t\t## by this point in time the cart has already been set, and prepared, so we know the total pending amount. \n\t\tif self.amount > self.cart.cart_pending_balance\n\t\t\tself.cash_change = self.amount - self.cart.cart_pending_balance\n\t\telse\n\t\t\tself.cash_change = 0\n\t\tend\n\tend",
"def change_rate\n return nil if @value_1.nil? || @value_2.nil?\n\n if @value_1 == 0\n if @value_2 > 0\n return 1\n elsif @value_2 < 0\n return -1\n else\n return 0\n end\n end\n\n (@value_2 - @value_1) / @value_1.to_f\n end",
"def update_internal(time_factor)\n @on.send(@property, @origin + @delta * time_factor)\n end",
"def set_last_system_changing\n @last_system_changing = LastSystemChanging.find(params[:id])\n end",
"def fix_property(new_property, fixed_date)\n\t\t# TODO: these should be executed atmicly\n\t\tcurrent = self.property\n\t\tPropertyFixHistory.create(user: self, new_property: new_property, fixed_date: fixed_date)\n\t\tself.update(property: new_property)\n\tend",
"def percentage_change\n return unless starting_weight && up_by\n @percentage_change ||= up_by.to_f / starting_weight * 100\n end",
"def fire_property_change text, oldvalue, newvalue\n return if @_object_created.nil? # 2018-05-15 - removed check for nil, as object can be nil on creation\n # but set later.\n #$log.debug \" FPC #{self}: #{text} #{oldvalue}, #{newvalue}\"\n $log.debug \" FPC #{self}: #{text} \"\n if @pce.nil?\n @pce = PropertyChangeEvent.new(self, text, oldvalue, newvalue)\n else\n @pce.set( self, text, oldvalue, newvalue)\n end\n fire_handler :PROPERTY_CHANGE, @pce\n @repaint_required = true \n repaint_all(true) # for repainting borders, headers etc 2011-09-28 V1.3.1 \n end",
"def changed_by\n return :setter if @initial_value.nil? || @value.nil? || @value == @initial_value\n\n # the value was clearly altered, now let's see how\n\n base_value = @value\n base_value -= @incremented_by\n\n return :modifier if base_value == @initial_value\n return :setter\n end",
"def attribute_changed_value_message=(_arg0); end",
"def update_property_region_regression\n property.region.recalculate_regression if self.price_changed?\n end",
"def update_internal(time_factor)\n @on.send(@property, (@base + @delta * time_factor).to_i.clamp(@origin, @end) * @factor)\n end",
"def changed_velocity\n return compute_velocity(changed) {|view| changed_net_cost}\n end",
"def update(new_val)\n @previous_read = new_val\n\n if new_val >= @upper\n publish(event_topic_name(\"update\"), \"upper\", new_val)\n publish(event_topic_name(\"upper\"), new_val)\n elsif new_val <= @lower\n publish(event_topic_name(\"update\"), \"lower\", new_val)\n publish(event_topic_name(\"lower\"), new_val)\n end\n end",
"def changed?(old_status, prop)\n (old_status == nil && self[prop] > 0) ||\n (old_status != nil && self[prop] != old_status[prop])\n end",
"def updated_trust_score(seller)\n 60 + self.trust_score\n end",
"def keep_calculating\n self.max_price = broker.max_mortgage.price.to_i\n self.min_price = broker.min_mortgage.price.to_i\n self.rate = broker.max_mortgage.rate\n end",
"def update_setpoint_relative_diff\n\t\trelative_diff = 0.0\n\t\tlive_value = self.live_setpoint\n\t\tsaved_value = self.saved_setpoint\n\t\tdiff = Java::Math.abs(live_value - saved_value)\n\t\tif diff > 0\n\t\t\t# baseline is average of live and saved value to avoid issues if either is zero\n\t\t\tbaseline = 0.5 * ( Java::Math.abs( live_value ) + Java::Math.abs( saved_value ) )\n\t\t\t# compute relative difference as a percent\n\t\t\trelative_diff = 100 * diff / baseline\n\t\telsif Double.isNaN( diff )\n\t\t\trelative_diff = Double::NaN\n\t\tend\n\t\tself[\"setpoint_relative_diff\"] = relative_diff\n\t\tself[\"formatted_setpoint_relative_diff\"] = FormattedNumber.new(DEFAULT_NUMBER_FORMAT, relative_diff)\n\tend",
"def test_change_criteria\n # attribute change\n @test.checked_criteria[0].replacement_attribute = 'relevantPeriod'\n @test.checked_criteria[0].change_criteria\n has_relevant_period = @test.checked_criteria.any? do |cc|\n cc.source_data_criteria['dataElementAttributes'][cc.attribute_index]['attribute_name'] == 'relevantPeriod'\n end\n assert has_relevant_period\n\n # attribute change with valueset\n @test.checked_criteria[0].replacement_attribute = 'dischargeDisposition:1.5.6.7'\n @test.checked_criteria[0].change_criteria\n has_discharge_disposition = @test.checked_criteria.any? do |cc|\n cc.source_data_criteria['dataElementAttributes'][cc.attribute_index]['attribute_name'] == 'dischargeDisposition'\n end\n assert has_discharge_disposition\n\n # data_criteria change\n index = Measure.first.source_data_criteria.index { |a| a['description'] == 'Patient Characteristic Ethnicity: Ethnicity' }\n @test.checked_criteria[0].replacement_data_criteria = Measure.first.source_data_criteria[index]._id.to_s\n @test.checked_criteria[0].change_criteria\n has_ethnicity = @test.checked_criteria.any? { |cc| cc.source_data_criteria['description'] == 'Patient Characteristic Ethnicity: Ethnicity' }\n assert has_ethnicity\n\n # both change\n index = Measure.first.source_data_criteria.index { |a| a['description'] == 'Encounter, Performed: EncounterInpatient' }\n @test.checked_criteria[0].replacement_data_criteria = Measure.first.source_data_criteria[index]._id.to_s\n @test.checked_criteria[0].replacement_attribute = 'relevantPeriod'\n @test.checked_criteria[0].change_criteria\n has_ethnicity = @test.checked_criteria.any? { |cc| cc.source_data_criteria['description'] == 'Patient Characteristic Ethnicity: Ethnicity' }\n assert has_ethnicity\n end",
"def standard_update\n lambda do\n update_sell_date\n @quality -= (@sell_in >= 0 ? 1 : 2)\n quality_limits\n end\n end",
"def update_internal(time_factor)\n @on.send(@property, (@origin_x + @delta_x * time_factor).to_i, (@origin_y + @delta_y * time_factor).to_i)\n end",
"def calc_od_change(dmg, gain, action = nil)\n if action != nil and Overdrive_Modifier[action.type_name] != nil and\n Overdrive_Modifier[action.type_name][action.id] != nil\n modifier = Overdrive_Modifier[action.type_name][action.id] / 100.0\n else\n modifier = 1.0\n end\n if dmg <= self.maxhp / 10\n return (gain * modifier * (dmg * 100 / (self.maxhp / 10.0)) / 100).to_i\n else\n value = (dmg > self.maxhp / 5) ? self.maxhp / 5 : dmg\n return (gain * modifier * (value * 100 / (self.maxhp / 10.0)) / 100).to_i\n end\n end",
"def new_value(old_value)\n raise 'to be implemented in subclass'\n end",
"def change_due\n\t\tif self.total_amount.blank?\n\t\t\treturn 0.00\n\t\telse\n\t\t\tif paid_total > self.total_amount\n\t\t\t\treturn paid_total - self.total_amount\n\t\t\telse\n\t\t\t\treturn 0.00\n\t\t\tend\n\t\tend\n\tend",
"def set_original_value(resource, original)\n original_attributes = resource.original_attributes\n original = self.value(original)\n\n if original_attributes.key?(self)\n # stop tracking the value if it has not changed\n original_attributes.delete(self) if original == original_attributes[self] && resource.saved?\n else\n original_attributes[self] = original\n end\n end",
"def force_aggressive=(val)\n if val > 15\n @force_aggressive = 15\n elsif val < 0\n @force_aggressive = 0\n else\n @force_aggressive = val\n end\n end",
"def compute_changes_for_existing_resource(properties)\n specified_properties = properties.select do |property|\n @new_resource.property_is_set?(property)\n end\n modified = specified_properties.reject do |p|\n @new_resource.send(p) == current_resource.send(p)\n end\n\n generate_pretty_green_text(modified)\n end",
"def compute_changes_for_existing_resource(properties)\n specified_properties = properties.select do |property|\n @new_resource.property_is_set?(property)\n end\n modified = specified_properties.reject do |p|\n @new_resource.send(p) == current_resource.send(p)\n end\n\n generate_pretty_green_text(modified)\n end",
"def compute_changes_for_new_resource(properties)\n property_size = properties.map(&:size).max\n properties.map do |property|\n default = ' (default value)' \\\n unless @new_resource.property_is_set?(property)\n next if @new_resource.send(property).nil?\n properties_str = if @new_resource.sensitive\n '(suppressed sensitive property)'\n else\n @new_resource.send(property).inspect\n end\n [\" set #{property.to_s.ljust(property_size)}\",\n \"to #{properties_str}#{default}\"].join(' ')\n end.compact\n end",
"def compute_changes_for_new_resource(properties)\n property_size = properties.map(&:size).max\n properties.map do |property|\n default = ' (default value)' \\\n unless @new_resource.property_is_set?(property)\n next if @new_resource.send(property).nil?\n properties_str = if @new_resource.sensitive\n '(suppressed sensitive property)'\n else\n @new_resource.send(property).inspect\n end\n [\" set #{property.to_s.ljust(property_size)}\",\n \"to #{properties_str}#{default}\"].join(' ')\n end.compact\n end",
"def update_internal(time_factor)\n @on.send(@property, @origin_x + @delta_x * time_factor, @origin_y + @delta_y * time_factor)\n end",
"def update\n @property.Rate = ((@property.CurrentPrice - @property.Price) / @property.Price) * 100\n @property.ShareValue = @property.CurrentPrice / @property.Shares\n # update share value in individual shares\n @property.shares.update_all(value: @property.ShareValue)\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Please Press edit to verify changes and PRESS UDATE again' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def converge_if_changed(*properties, &converge_block)\n unless converge_block\n raise ArgumentError, \"converge_if_changed must be passed a block!\"\n end\n\n properties =\n if properties.empty?\n new_resource.class.state_properties\n else\n properties.map { |property| new_resource.class.properties[property] }\n end\n\n if current_resource\n # Collect the list of modified properties\n specified_properties = properties.select { |property| property.is_set?(new_resource) || property.has_default? }\n specified_properties = specified_properties.map(&:name).map(&:to_sym)\n modified = specified_properties.select { |p| new_resource.send(p) != current_resource.send(p) }\n if modified.empty?\n properties_str = if new_resource.sensitive\n specified_properties.join(\", \")\n else\n specified_properties.map do |property|\n \"#{property}=\" << if new_resource.class.properties[property].sensitive?\n \"(suppressed sensitive property)\"\n else\n new_resource.send(property).inspect\n end\n end.join(\", \")\n end\n logger.debug(\"Skipping update of #{new_resource}: has not changed any of the specified properties #{properties_str}.\")\n return false\n end\n\n # Print the pretty green text and run the block\n property_size = modified.map(&:size).max\n modified.map! do |p|\n properties_str = if new_resource.sensitive || new_resource.class.properties[p].sensitive?\n \"(suppressed sensitive property)\"\n else\n \"#{new_resource.send(p).inspect} (was #{current_resource.send(p).inspect})\"\n end\n \" set #{p.to_s.ljust(property_size)} to #{properties_str}\"\n end\n converge_by([ \"update #{current_resource.identity}\" ] + modified, &converge_block)\n\n else\n # The resource doesn't exist. Mark that we are *creating* this, and\n # write down any properties we are setting.\n property_size = properties.map(&:name).map(&:to_sym).map(&:size).max\n created = properties.map do |property|\n default = \" (default value)\" unless property.is_set?(new_resource)\n properties_str = if new_resource.sensitive || property.sensitive?\n \"(suppressed sensitive property)\"\n else\n new_resource.send(property.name.to_sym).inspect\n end\n \" set #{property.name.to_sym.to_s.ljust(property_size)} to #{properties_str}#{default}\"\n end\n\n converge_by([ \"create #{new_resource.identity}\" ] + created, &converge_block)\n end\n true\n end",
"def compute_changes\n properties = @new_resource.class.state_properties.map(&:name)\n properties = properties.map(&:to_sym)\n if current_resource\n compute_changes_for_existing_resource properties\n else\n compute_changes_for_new_resource properties\n end\n end",
"def compute_changes\n properties = @new_resource.class.state_properties.map(&:name)\n properties = properties.map(&:to_sym)\n if current_resource\n compute_changes_for_existing_resource properties\n else\n compute_changes_for_new_resource properties\n end\n end",
"def change_props\n out_of_sync=[]\n # Compare the desired values against the current values\n resource[:properties].each_pair do |prop,should_be|\n is = properties[prop]\n # Current Value == Desired Value\n unless is == should_be\n # Stash out of sync property\n out_of_sync.push(\"%s=%s\" % [prop, should_be])\n end\n end\n out_of_sync\n end",
"def update_resources_on_production_rate_changes\n if self.changed?\n changed = false \n amount_changed = false\n weighted_production_rate = 0; # weighted according to rating_value of resource type. will be used in the ranking.\n GameRules::Rules.the_rules().resource_types.each do |resource_type|\n attribute = resource_type[:symbolic_id].to_s()+'_production_rate'\n weighted_production_rate += self[attribute] * (resource_type[:rating_value] || 0) \n if self.send resource_type[:symbolic_id].to_s()+'_production_rate_changed?'\n changed = true\n end\n amount_changed = true if self.send resource_type[:symbolic_id].to_s()+'_amount_changed?'\n end\n Rails.logger.error(\"ERROR : amounts were manually changed in resource pool at the same time as production rates change. THIS MUST BE PREVENTED SINCE IT CAUSES IMMEDIATE RESOURCE LOSSES.\") if changed && amount_changed\n update_resource_amount_atomically if changed # this will completely bypass the rails object (what is necessary, because it needs to use the old production_rates in the update). needs to make sure no amounts are set directly.\n update_resource_in_ranking(weighted_production_rate) if changed\n end \n true\n end",
"def update_easiness_factor(quality)\n new_easiness_factor = calculate_easiness_factor(quality)\n # If EF is less than 1.3 then let EF be 1.3\n self.easiness_factor = new_easiness_factor < 1.3 ? 1.3 : new_easiness_factor\n end",
"def change_margin(delta)\n # binding.pry\n calc = delta.to_f/100.0\n new_sellprice = @costprice.to_f / (1.0-calc)\n self.sellprice = new_sellprice.to_i\n self.update()\n end",
"def increased_valuation(i,d)\n (property_value * ((1 + (i / 100)) ** d)) / 1000\n end",
"def changed?\n\t\tchanged = (@price_new != @price_old)\n\t\t@price_old = @price_new\n\t\treturn changed\n\tend",
"def update issue, property, value\n trigger_listener(issue, [org.ofbiz.core.entity.GenericEntity.new(property, value)])\n end",
"def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_e_factor\n ef = @e_factor + (0.1 - (5 - @quality) * (0.08 + (5 - @quality) * 0.02))\n @e_factor = ef < 1.3 ? 1.3 : ef\n end",
"def force_offensive=(val)\n if val > 15\n @force_offensive = 15\n elsif val < 0\n @force_offensive = 0\n else\n @force_offensive = val\n end\n end",
"def initialize\n super\n @initial_should_be = 0.0\n @reevaluated_should_be = 0.0\n @difference = 0.0\n end",
"def overriding_system_value\n clone(:override=>:system)\n end",
"def value=(new_value)\n new_value = new_value.to_s\n return if new_value.blank?\n new_value = '-' + new_value unless new_value =~ /^(\\+|-)/\n write_attribute :value, new_value.to_f.round\n end",
"def change_to_s(currentvalue, newvalue)\n \"executed successfully\"\n end",
"def change\n if work.genre_string.include? OLD_VALUE\n # << doesn't work on this property in all versions\n work.genre_string = work.genre_string.map { |s| s == OLD_VALUE ? NEW_VALUE : s }\n return true\n end\n return false\n end",
"def set_EffectiveOn(value)\n set_input(\"EffectiveOn\", value)\n end",
"def change\n updated = false\n work.attributes.keys.each do |property|\n if work.send(property).is_a?(Array)\n work.send(\"#{property}=\", work.send(property).collect do |val|\n if val.is_a?(String) && val.strip != val\n updated = true\n val.strip\n else\n val\n end\n end)\n elsif work.send(property).is_a?(String)\n if work.send(property) != work.send(property).strip\n updated = true\n work.send(\"#{property}=\", work.send(property).strip)\n end\n end\n end\n return updated\n end",
"def rate_of_change(p_two, p_one, p_zero)\n #this is the most recent slope\n @l_zero = p_zero - p_one\n #this is the older slope\n @l_one = p_one - p_two\n\n if (@l_zero.abs > @l_one.abs) && (@l_zero > 0)\n 1\n elsif (@l_zero.abs < @l_one.abs) && (@l_zero < 0)\n -1\n else\n 0\n end\n end",
"def update\n #@transaction.situation == true ? @transaction.value = @transaction.value.to_i * -1 : @transaction.value \n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: \"Transação atualizada com sucesso.\" }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def calc_new_num_available\n # old_num_available = self.num_available\n # when num_offered changes, num_available cannot go below 0\n # new_num_available = self.num_available + self.num_offered\n # if new_num_available < 0\n # self.errors[:base] << \"ERROR: You cannot set 'Num Offered' to #{self.num_offered} because the new 'Num Available' would be negative (#{new_num_available}).\\n\"\n # # { :result => false, \n # # :message => \"ERROR: You cannot set 'Num Offered' to #{self.num_offered} because the new 'Num Available' would be negative (#{new_num_available}).\\n\" }\n # else\n # can proceed with the update\n if self.num_offered == 0\n self.num_available = 0\n else\n self.num_available = self.num_available + self.num_offered \n end\n # { :result => true, \n # :message => \"There are now #{new_num_available} deals available\"}\n # end \n # total_redeemed = Redemption.where(:deal_id => self.id).sum('num_redeemed')\n end",
"def change(params); end",
"def value=(new_value)\n\t\t@value = new_value\n\t\tinform_obeservers\n\tend",
"def change\n { value: (@change == :unknown ? \"N/A\" : \"%0.1f\" % @change + \" %\"), color: Openreply::Color.color_change(@change) }\n end",
"def point_adjustment=(new_point_adjustment)\n @point_adjustment = new_point_adjustment\n post_initialize\n @point_adjustment\n end",
"def update!(**args)\n @max_compensation = args[:max_compensation] if args.key?(:max_compensation)\n @min_compensation = args[:min_compensation] if args.key?(:min_compensation)\n end",
"def attribute_previous_change(attr_name)\n mutations_before_last_save.change_to_attribute(attr_name.to_s)\n end",
"def change_to_s(currentvalue, newvalue)\n # Our \"new\" checksum value is provided by the source.\n source = resource.parameter(:source) \n tmp = source.checksum if source\n if tmp\n newvalue = tmp\n end\n if currentvalue == :absent\n return \"defined content as '#{newvalue}'\"\n elsif newvalue == :absent\n return \"undefined content from '#{currentvalue}'\"\n else\n return \"content changed '#{currentvalue}' to '#{newvalue}'\"\n end\n end",
"def fix_game_rating(old, new)\n if !old.nil?\n self.game_rating -= 2**(old-1)\n end\n self.game_rating += 2**(new-1)\n save\n end",
"def track_attribute _name, _new_value\n unless self.send(_name).eql?(_new_value)\n self.modified_attributes << _name.to_sym\n end\n end",
"def trigger_setting_was_under_15_at_dx\n\t\tlogger.debug \"DEBUG: calling update_patient_was_under_15_at_dx from StudySubject:#{self.attributes['id']}\"\n\t\tlogger.debug \"DEBUG: DOB changed from:#{dob_was}:to:#{dob}\"\n\t\tupdate_patient_was_under_15_at_dx\n\tend",
"def old_price\n\t\tif $global_share\n\t\t\tif self[:old_price] == 0\n\t\t\t\tself[:price]\n\t\t\telse\n\t\t\t\tself[:old_price]\n\t\t\tend\n\t\telse\n\t\t\tself[:old_price]\n\t\tend\n\tend",
"def adjustment\n return 0 unless eligible?\n\n calculation\n end",
"def price_adjustment \n price_adjustment_fixed / 100.0 \n end",
"def change_attribute current, new\n diff = current ^ new\n attribute(new & diff, current & diff)\n end",
"def change (cost, quantity) \n\t@total_change = @total - (cost.to_i * quantity.to_i) #subtract cost*quantity to the total money\n\t@new_total = @total_change \n\t#looking for number of bills per denomination\n\tif @total_change >= 1000\n \t\tthousands_change = @total_change / 1000\n \t\t@total_change = @total_change % 1000\n \tend\n \t\n \tif @total_change >= 500\n \t\tfive_hundreds_change = @total_change / 500\n \t\t@total_change = @total_change % 500\n \tend\n \t\n \tif @total_change >= 100\n \t\thundreds_change = @total_change / 100\n \t\t@total_change = @total_change % 100\n \tend\n \t\n \tif @total_change >= 50\n \t\tfifties_change = @total_change / 50\n \t\t@total_change = @total_change % 50\n \tend\n \t\n \tif @total_change >= 20\n \t\ttwenties_change = @total_change / 20\n \t\t@total_change = @total_change % 20\n \tend\n \t\n \tif @total_change >= 10\n \t\ttens_change = @total_change / 10\n \t\t@total_change = @total_change % 10\n \tend\n \t\n \tif @total_change >= 5\n \t\tfives_change = @total_change / 5\n \t\t@total_change = @total_change % 5\n \tend\n \t\n \tif @total_change >= 1\n \t\tones_change = @total_change / 1\n \t\t@total_change = @total_change % 1\n \tend\n \t\n \tchange = {\n \t\t:ones => ones_change.to_i,\n \t\t:fives => fives_change.to_i,\n \t\t:tens => tens_change.to_i,\n \t\t:twenties => twenties_change.to_i,\n \t\t:fifties => fifties_change.to_i,\n \t\t:hundreds => hundreds_change.to_i,\n \t\t:five_hundreds => five_hundreds_change.to_i,\n \t\t:thousands => thousands_change.to_i\n \t}\n \t\n \t\"<br /> #{change[:ones]} Php 1\" \"<br />#{change[:fives]} Php 5\" \"<br />#{change[:tens]} Php 10,\" \"<br />#{change[:twenties]} Php 20\" \"<br />#{change[:fifties]} Php 50\" \"<br />#{change[:hundreds]} Php 100\" \"<br />#{change[:five_hundreds]} Php 500\" \"<br />#{change[:thousands]} Php 1000\"\n end",
"def change_to_s(currentvalue, newvalue)\n begin\n if currentvalue == :absent\n return \"defined '%s' as '%s'\" %\n [self.name, self.currentsum]\n elsif newvalue == :absent\n return \"undefined %s from '%s'\" %\n [self.name, self.is_to_s(currentvalue)]\n else\n if defined? @cached and @cached\n return \"%s changed '%s' to '%s'\" %\n [self.name, @cached, self.is_to_s(currentvalue)]\n else\n return \"%s changed '%s' to '%s'\" %\n [self.name, self.currentsum, self.is_to_s(currentvalue)]\n end\n end\n rescue Puppet::Error, Puppet::DevError\n raise\n rescue => detail\n raise Puppet::DevError, \"Could not convert change %s to string: %s\" %\n [self.name, detail]\n end\n end",
"def change_type=(value)\n @change_type = value\n end",
"def volume_adjustment(value)\n @ole.VolumeAdjustment = value\n nil\n end",
"def sugar_amount=(new_amount)\n @sugar_amount = new_amount\n end",
"def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n end",
"def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n end",
"def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n end",
"def evaluate()\n @effective\n end",
"def update(new_value)\n self.value = new_value\n end",
"def set_value new_value\n if validate_value new_value\n @value = new_value\n end\n end",
"def attribute=(name, value)\n send(\"#{name}_will_change!\") if _active_remote_track_changes? && value != self[name]\n super\n end",
"def updateVal!(newVal)\n update_attributes(amount: newVal)\n end",
"def make_change(amount, denominations)\n\nend",
"def store_changes_for_estimated_hours!(result, old_value, new_value)\n \t\tchange = hash_for_ticket_change(old_value, new_value)\n \t\tresult[N_('Estimated hours')] = change if change\n \tend",
"def update!(**args)\n @system_violation = args[:system_violation] if args.key?(:system_violation)\n end",
"def update()\n Rails.logger.debug \"yes, in HtmlAttributeValue.save\"\n self.param_value.update_html_attribute_value(self.html_attribute, self.properties, 'system')\n end",
"def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"def trigger_setting_was_under_15_at_dx\n\t\tlogger.debug \"DEBUG: calling update_patient_was_under_15_at_dx from \"<<\n\t\t\t\"StudySubject:#{self.id}\"\n\t\tlogger.debug \"DEBUG: DOB changed from:#{dob_was}:to:#{dob}\"\n\t\tupdate_patient_was_under_15_at_dx\n\tend",
"def change_sugar(new_value)\n @sugar = new_value\n end",
"def changed=(value)\n @changed = value\n @deleted = false if value == true\n end",
"def update\n respond_to do |format|\n if @sys_property.update(sys_property_params)\n @sys_property.save_property_values(params[:property_values_name])\n format.html { redirect_to @sys_property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sys_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_speed\n @statistics[:speed_changes] += 1\n # pick a coordination to change speed for\n @changed_coord = @coordinations.rand\n @previous_speed = @current_speed[@changed_coord]\n @current_speed[@changed_coord] = @previous_speed + SPEED_CHANGE_OPTIONS.rand\n delta_eval(@changed_coord)\n end",
"def set_adjust(action, prop)\n cmd = \"{\\\"id\\\":15,\\\"method\\\":\\\"set_adjust\\\",\\\"params\\\":[\\\"#{action}\\\",\\\"#{prop}\\\"]}\\r\\n\"\n request(cmd)\n end"
] | [
"0.6497386",
"0.60641843",
"0.6031669",
"0.5838843",
"0.5789279",
"0.5634075",
"0.55774206",
"0.5522548",
"0.55003774",
"0.54552",
"0.54224056",
"0.54061586",
"0.53566515",
"0.53543466",
"0.534424",
"0.53415537",
"0.5340293",
"0.53168666",
"0.5264588",
"0.52580327",
"0.52480143",
"0.52470666",
"0.5243228",
"0.5219509",
"0.5215647",
"0.52120847",
"0.5192538",
"0.51684654",
"0.5154189",
"0.5147216",
"0.513196",
"0.51287955",
"0.51206017",
"0.51103234",
"0.51103234",
"0.5098598",
"0.5098598",
"0.50915575",
"0.50915426",
"0.5090044",
"0.5087525",
"0.5087525",
"0.50814503",
"0.5071693",
"0.5069354",
"0.5062692",
"0.50522095",
"0.5044163",
"0.50324965",
"0.50321233",
"0.50297654",
"0.5011978",
"0.5007583",
"0.5002764",
"0.50012934",
"0.49975103",
"0.49920607",
"0.49920428",
"0.4987064",
"0.49833012",
"0.4970926",
"0.49552333",
"0.4949485",
"0.49433035",
"0.49383992",
"0.49356145",
"0.49341252",
"0.49238074",
"0.4920575",
"0.49196932",
"0.4916931",
"0.4915951",
"0.49131703",
"0.4912454",
"0.48916304",
"0.48891485",
"0.48864597",
"0.48829126",
"0.4881987",
"0.4875843",
"0.48733744",
"0.48629805",
"0.48629805",
"0.48629805",
"0.4861782",
"0.48585224",
"0.48568758",
"0.48470035",
"0.48402005",
"0.48370445",
"0.48341054",
"0.48313877",
"0.48312953",
"0.48263738",
"0.48241216",
"0.48181218",
"0.48067737",
"0.480404",
"0.4803839",
"0.47941518"
] | 0.81333745 | 0 |
If it's a failure, use 'err', else use either the resource's log level (if available) or 'notice'. | def log_level
status == "failure" ? :err : (@default_log_level || :notice)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollbar_level(severity)\n [:debug, :info, :warning, :error, :critical, :error][severity] || :error\n end",
"def level\n Logger::Severity.constants.each do |name|\n return name.downcase.to_sym if @logger.level.eql?(Logger::Severity.const_get(name))\n end\n raise \"error\"\n end",
"def severity\n :error\n end",
"def severity_string(level) \n case level \n when DEBUG \n :DEBUG \n when INFO \n :INFO \n when WARN \n :WARN \n when ERROR \n :ERROR \n when FATAL \n :FATAL \n else \n :UNKNOWN \n end \n end",
"def log(str, log_type = :info)\n str = \"- ERROR - #{str}\" if log_type == :error\n puts str\nend",
"def get_severity\n\t\treturn ERROR_SEVERITY[:medium]\n\tend",
"def error?; @loggers.first.level <= ERROR; end",
"def log_level; end",
"def log_level; end",
"def severity_str\n return \"\" if severity.nil?\n case severity\n when 3 then \"Low\"\n when 2 then \"Medium\"\n when 1 then \"High\"\n end\n end",
"def error?; @level <= ERROR; end",
"def error?; @level <= ERROR; end",
"def result_message_severity(xccdf_status)\n case xccdf_status\n when 'fail'\n 'error'\n when 'notapplicable'\n 'warning'\n else\n 'info'\n end\n end",
"def level\n @level ||= :warn\n end",
"def severity()\n @logger.level\n end",
"def log_level\n @log_level ||= WARN\n end",
"def sarif_level(severity)\n case severity\n when \"LOW\"\n SARIF_WARNINGS[:warning]\n when \"MEDIUM\"\n SARIF_WARNINGS[:error]\n when \"HIGH\"\n SARIF_WARNINGS[:error]\n else\n SARIF_WARNINGS[:note]\n end\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def severity_string(level)\n if ActiveRecord::Base.colorize_logging\n case level\n when DEBUG; \"#{color(:light_green)}DEBUG\"\n when INFO; \"#{color(:green)}INFO\"\n when WARN; \"#{color(:yellow)}WARN\"\n when ERROR; \"#{color(:light_red)}ERROR\"\n when FATAL; \"#{color(:red)}FATAL\"\n else\n \"#{color(:purple)}UNKNOWN\"\n end\n else\n case level\n when DEBUG; :DEBUG\n when INFO; :INFO\n when WARN; :WARN\n when ERROR; :ERROR\n when FATAL; :FATAL\n else\n :UNKNOWN\n end\n end\n end",
"def flash_class(level)\n case level\n when 'notice' then \"info\"\n when 'success' then \"success\"\n when 'error' then \"danger\"\n when 'alert' then \"warning\"\n else level.to_s\n end\n end",
"def logger_level; end",
"def log(s, type = :info)\n\t\tcolor = :gray\n\t\tcase type\n\t\twhen :error\n\t\t\tcolor = :red\n\t\twhen :warning\n\t\t\tcolor = :yellow\n\t\twhen :debug\n\t\t\tcolor = :purple\n\t\tend\n\t\tsuper _fmt(color, s), type\n\tend",
"def error_level\n @error_level\n end",
"def severity_lookup(severity, fallback = :unknown)\n LOG_LEVELS[severity.to_sym] || LOG_LEVELS[fallback]\n end",
"def log_level\n @log_level ||= \"Log4r::#{@options[:log_level].upcase}\".constantize\n end",
"def convert_level(val)\n if val.is_a? String\n begin\n val = Logger.const_get(val.upcase)\n rescue NameError\n raise \"Invalid log level '#{val}' specified.\"\n end\n end\n\n return val\n end",
"def failure_notice(message)\n { type: 'error', message: message }\n end",
"def loglevel\n @loglevel ||= ::Logger::WARN\n end",
"def severity\n @severity || SEVERITY_LEVELS.first\n end",
"def get_default_log_check_levels\n return [:error, :fatal]\n end",
"def severity_string severity\n\n\t\t::Pantheios::Core.severity_string severity\n\tend",
"def severity= severity\n @logger.level = severity\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def warning(msg) log(4, msg); end",
"def log_level\n (self['resque.log_level'] || 1).to_i\n end",
"def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n logger.info \"\\n\\n#{@err_msg}\\n\\n\"\n end",
"def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n logger.info \"\\n\\n#{@err_msg}\\n\\n\"\n end",
"def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n logger.info \"\\n\\n#{@err_msg}\\n\\n\"\n end",
"def fetch_log_level(mode)\n case mode\n when 'verbose'\n Logger::INFO\n when 'debug'\n Logger::DEBUG\n else # silent mode\n Logger::ERROR\n end\n end",
"def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end",
"def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end",
"def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end",
"def fail_level\n @fail_level || SEVERITY_LEVELS.last\n end",
"def format_message level, time, msg\n prefix = case level\n when \"warn\"; \"WARNING: \"\n when \"error\"; \"ERROR: \"\n else \"\"\n end\n \"[#{time.to_s}] #{prefix}#{msg.rstrip}\\n\"\n end",
"def flash_class(level)\n\t\tcase level\n\t\t\twhen :notice then \"success\"\n\t\t\twhen :error then \"error\"\n\t\t\twhen :alert then \"warning\"\n\t\tend\n\tend",
"def flash_class(level)\n case level\n when 'notice' then \"alert alert-info\"\n when 'success' then \"alert alert-success\"\n when 'error' then \"alert alert-danger\"\n when 'alert' then \"alert alert-error\"\n end\n end",
"def default_log_level\n\t\t\tif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE\n\t\t\t\tLogger::INFO\n\t\t\telse\n\t\t\t\tLogger::WARN\n\t\t\tend\n\t\tend",
"def default_level\n ENV.key?(ENV_FLAG) ? ::Logger::DEBUG : ::Logger::WARN\n end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end",
"def flash_class(level)\n case level\n when :notice then 'alert alert-info'\n when :success then 'alert alert-success'\n when :error then 'alert alert-error'\n when :alert then 'alert'\n end\n end",
"def select_appropriate_alert_level(level)\n if level == 0\n ok\n elsif level == 1\n warning\n elsif level == 2\n critical\n else\n unknown\n end\n end",
"def severity(type)\n case type\n when 'Fire'\n fire_severity\n when 'Police'\n police_severity\n when 'Medical'\n medical_severity\n end\n end",
"def log_level level\n level = Deployable::Logger.const_get level.upcase unless \n level.kind_of? ::Fixnum\n\n @log.level = level\n end",
"def level=(level) # needed to meet the Sentry spec\n @level = level.to_s == \"warn\" ? :warning : level\n end",
"def log_level=(_arg0); end",
"def log_level=(_arg0); end",
"def _notice(msg, type = :notice)\n if type == :error\n add_error(msg)\n else\n add_msg(\"* #{msg}\", type)\n end\nend",
"def info?; @level <= INFO; end",
"def info?; @level <= INFO; end",
"def notice(msg) log(5, msg); end",
"def log_level\n @log_level ||= begin\n log_level = @config.log_level || @config_from_file['galaxy.agent.log-level'] || 'INFO'\n case log_level\n when \"DEBUG\"\n Logger::DEBUG\n when \"INFO\"\n Logger::INFO\n when \"WARN\"\n Logger::WARN\n when \"ERROR\"\n Logger::ERROR\n end\n end\n end",
"def flash_type(type)\n case type.to_s\n when \"notice\" then \"info\"\n when \"alert\" then \"warning\"\n else type\n end\n end",
"def flash_class(level)\n\t\t case level\n\t\t\twhen :notice then \"alert alert-info\"\n\t\t\twhen :success then \"alert alert-success\"\n\t\t\twhen :error then \"alert alert-danger\"\n\t\t\twhen :warning then \"alert alert-warning\"\n\t\t end\n\t\tend",
"def level\n @log.level\n end",
"def flash_class(level)\n case level\n when 'notice' then \"alert alert-info\"\n when 'success' then \"alert alert-success\"\n when 'error' then \"alert alert-danger\"\n when 'alert' then \"alert alert-warning\"\n end\n end",
"def to_checkstyle_severity(rubocop_severity)\n case rubocop_severity.to_s\n when 'fatal', 'error' then 'error'\n when 'warning' then 'warning'\n when 'convention', 'refactor' then 'info'\n else 'warning'\n end\n end",
"def allowable_log_level(log_level) \n log_level = \"\" if log_level.nil?\n log_level = log_level.to_sym unless log_level.is_a?(Symbol)\n if !@log_levels.include?(log_level)\n log_level = :notice\n end\n return log_level\n end",
"def flash_class(level)\n case level\n when :notice then 'alert alert-info'\n when :success then 'alert alert-success'\n when :error then 'alert alert-danger'\n when :alert then 'alert alert-info'\n end\n end",
"def log_level\n @log_level ||= begin\n log_level = @config.log_level || @config_from_file['galaxy.console.log-level'] || 'INFO'\n case log_level\n when \"DEBUG\"\n Logger::DEBUG\n when \"INFO\"\n Logger::INFO\n when \"WARN\"\n Logger::WARN\n when \"ERROR\"\n Logger::ERROR\n end\n end\n end",
"def replace_log io = DefaultIO, level = @log.level\n l = ::Deployable::Logger.new io, level\n #l.level = @log.level\n @log = l\n end",
"def severity_level\n return @values['severityLevel'] if @values.key?('severityLevel')\n @defaults['severityLevel']\n end",
"def flash_class(level)\n case level\n when :notice then \"alert alert-info\"\n when :success then \"alert alert-success\"\n when :error then \"alert alert-error\"\n when :alert then \"alert alert-error\"\n end\n end",
"def flash_class(level)\n case level\n when :notice then \"alert alert-info\"\n when :success then \"alert alert-success\"\n when :error then \"alert alert-error\"\n when :alert then \"alert alert-alert\"\n end\n end",
"def warn?; @loggers.first.level <= WARN; end",
"def message\n (job = delayed_job) && job.failed? ?\n job.last_error.lines.first.chomp.gsub(/^\\{/, '') :\n status.humanize\n end",
"def error_message; end",
"def flash_class(level)\n case level\n when :error\n when :alert\n \"alert alert-error\"\n else\n \"alert alert-success\"\n end\n end",
"def rule_priority_text\n severity\n end",
"def flash_class(level)\n case level\n when :info then ' alert-info'\n when :notice then ' alert-success'\n when :error then ' alert-error'\n when :alert then ''\n else ''\n end\n end",
"def express_error_context resource\n I18n.t \"errors.action.#{params[:controller]}.#{params[:action]}.#{resource.class.model_name.i18n_key}\",\n default: \"Couldn't #{params[:action]} the #{resource.class.to_s.downcase}\"\n end",
"def error(msg); @logger.error(msg); end",
"def failure_message(activity)\n case activity\n when 'skip_fact_check' then \"Could not skip fact check for this publication.\"\n when 'start_work' then \"Couldn't start work on #{description(resource).downcase}\"\n else \"Couldn't #{activity.to_s.humanize.downcase} for #{description(resource).downcase}\"\n end\n end",
"def warn?; @level <= WARN; end",
"def warn?; @level <= WARN; end",
"def level; @logger.level; end",
"def err(message)\n warn \" > #{message}\"\nend",
"def raise_api_error_msg(res)\n \"HTTP status code: #{res.status}, \" \\\n \"Error message: #{res.body['message']}, \" \\\n \"Reference: #{res.body['reference']}\"\n end",
"def message\n format(ERRORS.fetch(type), **params)\n end",
"def message\n format(ERRORS.fetch(type), **params)\n end",
"def log level, message; write level, message, caller[0] unless level > @level end",
"def log_level\n @log_level ||= :debug\n end",
"def log_level\n @log_level ||= :debug\n end"
] | [
"0.6471586",
"0.64533466",
"0.6344949",
"0.6226175",
"0.61946154",
"0.6092242",
"0.60480857",
"0.60421276",
"0.60421276",
"0.602095",
"0.60084015",
"0.60084015",
"0.59934914",
"0.59897155",
"0.5955885",
"0.5925081",
"0.5910066",
"0.58708024",
"0.5869981",
"0.5863575",
"0.5828904",
"0.5801901",
"0.5781122",
"0.5780065",
"0.57732487",
"0.57658213",
"0.5756442",
"0.57125753",
"0.568787",
"0.5668931",
"0.5654475",
"0.56479335",
"0.5634399",
"0.5634399",
"0.56223446",
"0.5614242",
"0.56105804",
"0.56105804",
"0.56105804",
"0.5607673",
"0.5602956",
"0.5602956",
"0.5602956",
"0.5548471",
"0.55458593",
"0.5545505",
"0.55426",
"0.55362314",
"0.5524554",
"0.55191886",
"0.55191886",
"0.55191886",
"0.55191886",
"0.55191886",
"0.55191886",
"0.55191886",
"0.5512912",
"0.5512032",
"0.5508914",
"0.55026084",
"0.5491486",
"0.5484446",
"0.54843104",
"0.54843104",
"0.54802686",
"0.5478863",
"0.5478863",
"0.5473379",
"0.54678774",
"0.5466643",
"0.5466251",
"0.5464381",
"0.54622734",
"0.54527366",
"0.5449804",
"0.54492444",
"0.54443544",
"0.5436085",
"0.5428533",
"0.54244983",
"0.5417927",
"0.5414952",
"0.5413622",
"0.540335",
"0.54025984",
"0.53984565",
"0.5396639",
"0.5393451",
"0.5386126",
"0.53818536",
"0.5369309",
"0.5369309",
"0.536262",
"0.53577614",
"0.5357077",
"0.53496623",
"0.53496623",
"0.5341204",
"0.5332009",
"0.5332009"
] | 0.7750526 | 0 |
Used by the Logging module | def log_source
source_description || property || resource
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger_output; end",
"def log_writer; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger; end",
"def logger ; @log end",
"def log_file; end",
"def log\n end",
"def log_formatter; end",
"def log_formatter; end",
"def logging_prefs; end",
"def log=(log); end",
"def colorize_logging; end",
"def logs\n end",
"def logger; LOGGER; end",
"def error_log\n end",
"def error_log\n end",
"def error_log\n end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logs\n\n end",
"def autoflush_log; end",
"def autoflush_log; end",
"def log=(logger); end",
"def log_file\n end",
"def colorize_logging=(_arg0); end",
"def logL\n raise \"No implemented\"\n end",
"def log_level; end",
"def log_level; end",
"def log=(_arg0); end",
"def log=(_arg0); end",
"def log=(_arg0); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logger=(writer); end",
"def logged?; false end",
"def logged?; false end",
"def result_log\n end",
"def result_log\n end",
"def result_log\n end",
"def autoflush_log=(_arg0); end",
"def autoflush_log=(_arg0); end",
"def logger_level; end",
"def log()\n @log\n end",
"def log_formatter=(_arg0); end",
"def log_formatter=(_arg0); end",
"def initialize\n @log = Logging::Logger[self]\n end",
"def logging_prefs=(_arg0); end",
"def log\n @log ||= Logging.logger[self]\n end",
"def log_tags; end",
"def log_tags; end",
"def log_tags; end",
"def log\n @log\n end",
"def log_state\n super\n end",
"def verbose_logging; end",
"def new_tagged_logger; end",
"def log(*args); end",
"def logger=(logger); end",
"def logger=(logger); end",
"def request_log(request); end",
"def log \n\t\t\tArrow::Logger[ self.class ]\n\t\tend",
"def configure_logging\n @logger = Logging.logger[self]\n end",
"def reopen_logs; end",
"def log(message); logger.info(message); end",
"def info(msg) log(6, msg); end",
"def get_logger; @logger; end",
"def log\n advanced[:log]\n end",
"def initialize\n @logger = Logging::Logger[self]\n end",
"def initialize()\n @log = {}\n end",
"def create_log(param); end"
] | [
"0.77528805",
"0.7639025",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7523746",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.7471306",
"0.71479017",
"0.71074647",
"0.70984477",
"0.7098109",
"0.7098109",
"0.70415926",
"0.69921565",
"0.6960261",
"0.6938917",
"0.6924598",
"0.68889236",
"0.68889236",
"0.68889236",
"0.6851592",
"0.6851592",
"0.6851592",
"0.6851592",
"0.6851592",
"0.6851592",
"0.6851592",
"0.6799278",
"0.67897147",
"0.67897147",
"0.67847496",
"0.6755317",
"0.67355645",
"0.66734177",
"0.6650403",
"0.6650403",
"0.664741",
"0.664741",
"0.664741",
"0.66318554",
"0.66318554",
"0.66318554",
"0.66318554",
"0.66318554",
"0.66227543",
"0.66227543",
"0.66118544",
"0.66118544",
"0.66118544",
"0.6592552",
"0.6592552",
"0.65872234",
"0.6577493",
"0.65347975",
"0.65347975",
"0.652485",
"0.6514458",
"0.6506828",
"0.65005904",
"0.65005904",
"0.65005904",
"0.6495402",
"0.6489792",
"0.64797574",
"0.64793545",
"0.6474499",
"0.64632374",
"0.64632374",
"0.64587396",
"0.64574355",
"0.6455983",
"0.6436136",
"0.6433602",
"0.64187515",
"0.6410994",
"0.6382945",
"0.63494045",
"0.63353115",
"0.6325719"
] | 0.0 | -1 |
Print a short summary of the list. | def to_s
sprintf("#<%s:0x%x size=%d>", self.class.name, object_id, @size)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def print_summary\r\n traverse do |node|\r\n print node.effectively_skipped? ? '-' : '+'\r\n case\r\n when node.test? then print 'T'\r\n when node.suite? then print 'S'\r\n when node.static? then print 'X'\r\n else print '?'\r\n end\r\n print node.indented_name(' ')\r\n tags = node.effective_tags.to_a\r\n unless tags.empty?\r\n # highlight the tags that are explicit on this node\r\n tags = tags.map {|tag| node.explicit_tags.include?(tag) ? \"*#{tag}\" : tag }\r\n print \" [#{tags.join(',')}]\"\r\n end\r\n print \"\\n\"\r\n end\r\n end",
"def summary_list(name, subcmds)\n section \"List of #{name} commands (with minimum abbreviation in parenthesis):\"\n subcmds.list.each do |subcmd_name|\n # Some commands have lots of output.\n # they are excluded here because 'in_list' is false.\n msg summary_help(subcmds.subcmds[subcmd_name])\n end\n end",
"def summary\n # TODO\n end",
"def summary *args\n @summary = args.first if args.size > 0\n end",
"def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_quantity} of #{item_name}.\"\n\t}\nend",
"def pretty_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"There are #{quantity} #{item} on the grocery list.\"\n\tend\nend",
"def dump_summary *args; end",
"def _summary_list(list)\n list_for_display = []\n\n if list\n list.each do |item|\n display_item = yield(item, list_for_display)\n list_for_display += display_item if display_item\n end\n end\n\n list_for_display\n end",
"def pretty_list(list)\r\n\tlist.each { |item, quantity| puts \"Item: #{item.capitalize} - Amount: #{quantity}\" }\r\nend",
"def print_summary\n puts \"\\n\\nScore : # Instances\\n\" << (\"=\" * 19)\n @summary_totals.each_with_index { |value, index| puts \" %5d:%8d\\n\" % [index, value] unless value.nil? }\n puts \"\\n** End of Report\"\n end",
"def summary_list(name, subcmds)\n msg \"List of #{name} commands (with minimum abbreviation in parenthesis):\"\n subcmds.list.each do |subcmd_name|\n # Some commands have lots of output.\n # they are excluded here because 'in_list' is false.\n msg summary_help(subcmds.subcmds[subcmd_name])\n end\n end",
"def summary\n end",
"def summary\n end",
"def look_pretty(list)\n puts \"Here is your grocery list:\"\n list.each { |item, quantity| puts \"#{item}: #{quantity}\" }\nend",
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def show\n header(@keyword)\n counter(list).each_with_index do |el, index|\n print \"#{index + 1} - #{el.first}\"\n (20 - el.first.length).times { print '-' }\n print \"#{el[1]} views\"\n puts\n end\n end",
"def summary\n @summary ||= HTML::Pipeline::TaskList::Summary.new(record.task_list_items)\n end",
"def summary\r\n ListingDataProcessor.new(self).set_auto_link self.description\r\n end",
"def pretty_list(list)\n list.each {|item, quantity| puts \"You need #{quantity} #{item}\"}\nend",
"def pretty_print(list)\n list.each {|item, quantity| puts \"#{item} : #{quantity}\"}\nend",
"def summary\n \n end",
"def print_summary\n stats = [statistics[:total_code_loc], statistics[:total_spec_loc]]\n stats.push(stats[1].to_f / stats[0].to_f)\n \n puts \" Code LOC: %s Test LOC: %s Code to Test Ratio: 1:%1.1f\" % stats\n puts\n end",
"def summary\n return desc.to_s.inspect unless desc.empty?\n flags.map(&:display_name).inspect\n end",
"def dump_summary( summary )\n\t\thtml = self.render_summary( summary )\n\t\[email protected]( html )\n\t\[email protected]\n\tend",
"def desc() summary; end",
"def pretty_list(list)\n list.each{|food, quantity| puts \"Please get #{quantity} #{food}.\"}\n puts \"Thanks!\"\nend",
"def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend",
"def pretty_list(list)\n list.each do |item,quantity|\n p \"#{item}! You have #{quantity}.\"\n end\nend",
"def summary\n\t\tobject.summary || \"\"\n\tend",
"def summary\n {}\n end",
"def prettify_list(list)\n\tlist.each do |item, quantity|\n\t\tp \"You have #{quantity} #{item}\"\n\tend\nend",
"def print\n placeholder = @head\n list = \"\"\n while placeholder.next\n list += placeholder.data + \"\\n\"\n placeholder = placeholder.next\n end\n list += placeholder.data + \"\\n\" # the plus \"\\n\" added because of the way the spec is written.\n printf list\n end",
"def render_summary\n summary = nil\n max_chars = (self.display_configuration.try {|h| h[\"summary_max_chars\"]}) || 280\n\n\n\n if self.snippets.length > 0 && !(self.display_configuration.try {|h| h[\"prefer_abstract_as_summary\"]} && self.abstract)\n summary = self.snippets.first\n self.snippets.slice(1, self.snippets.length).each do |snippet|\n summary += ' '.html_safe + snippet if (summary.length + snippet.length) <= max_chars\n end\n else\n summary = _h.bento_truncate( self.abstract, :length => max_chars )\n end\n\n summary\n end",
"def print_list; end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end",
"def print_summary\n raise InternalError.new( \"@key is empty for #{self.class}\" ) if \"#{@key}\".empty?\n\n log_params = []\n log_params += [ \"(#{@alt_source.to_s})\", [:CYAN, :BOLD] ] unless @alt_source.nil?\n log_params += [\"#{@key} = \", [], \"#{@value.inspect}\", [:BOLD] ]\n notice(*log_params)\n end",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item.capitalize}: #{quantity}\"\n\tend\nend",
"def short_display\n \"#{@test_name}: #{@message.split(\"\\n\")[0]}\"\n end",
"def short_display\n \"#{@test_name}: #{@message.split(\"\\n\")[0]}\"\n end",
"def short_display\n \"#{@test_name}: #{@message.split(\"\\n\")[0]}\"\n end",
"def show_summary!\n @runopts[:show_log] = false\n end",
"def summary\n \"#<#{short_class_name}\" +\n \" address=#{address}\" +\n # TODO Add summaries to descriptions and use them here\n \" prev=#{previous_description.server_type.upcase} new=#{new_description.server_type.upcase}#{awaited_indicator}>\"\n end",
"def prettify(list)\r\n\r\n list.each do |item, quantity|\r\n puts \"There are #{quantity} #{item} in the list.\"\r\n end\r\n\r\nend",
"def summary\n summary =\n \" - Name: #{@name}\\n\"+\n \" - Color: #{@color}\\n\"+\n \" - Mass (in kg): #{@mass_kg}kg\\n\"+\n \" - Distance From Sun (in km): #{@distance_from_sun_km} million km.\\n\"+\n \" - Fun Fact: #{@fun_fact}\"\n return summary\n end",
"def summary\n summary = \"\n - Name: #{@name}\n - Color: #{@color}\n - Mass (in kg): #{@mass_kg}\n - Distance From Sun (in km): #{@distance_from_sun_km}\n - Fun Fact: #{@fun_facts}\"\n\n #returns summary as string\n return summary\n end",
"def print_summary(products_with_errors)\n info_and_log(\"\\n--------\\nSUMMARY:\\n\")\n @products.sort.each do |product|\n result = products_with_errors.include?(product) ? '-' : '+'\n info_and_log(\" #{product}: #{result}\")\n end\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@name, @location], SUMMARY_COL_FORMATS)\n end",
"def summary\n authenticated_post(\"summary\").body\n end",
"def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def print_list(list)\n\tputs \"\\nHere is the list:\"\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}: #{quantity}\"\n\tend\nend",
"def print_friendly_list(list)\n puts \n puts \"Shopping List:\"\n puts \"----------------\"\n list.each {|key, value| puts \"#{key} #{value}\" }\n puts \nend",
"def showlist\n\t\t@people_list.each do |x|\n\t\t\tputs \"* #{capitalize(x.type)}, #{capitalize(x.name)}, #{capitalize(x.party)}\"\n\t\tend\n\tend",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def summary\n with_messages\n .map { |error| generate_summary_item(error) }\n .join(', ')\n end",
"def dump_summary(*args)\n output.puts super(*args).to_yaml\n output.puts \"...\"\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end",
"def list_formatter(list)\n\tlist.each do |item, quanity|\n\t\tputs \"we need #{quanity} of #{item}\"\n\tend\nend",
"def print_pretty(new_list)\n puts \"Grocery List:\"\n new_list.each do |item, amount|\n \n puts \"#{item}: #{amount}\"\n end\nend",
"def print_list(list)\n\tlist.each do |item, quantity| puts \"#{item}: #{quantity}\"\n\t\t\n\tend\nend",
"def summary\n summary =\"Planet #{name} is the color #{color} and it weights #{mass_kg}. and its #{distance_from_sun_km} km away from the sun. Here's a fun fact: #{fun_fact}.\"\n return summary\n end",
"def summary\n \"#{name} (#{email})\"\n end",
"def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttodo_items.each do |item|\n\t\t\tcase type\n\t\t\twhen 'all'\n\t\t\tputs item\n\t\twhen 'complete'\n\t\t\tputs item if item.complete?\n\t\twhen 'incomplete'\n\t\t\tputs item unless item.complete?\n\t\tend\n\t\tend\n\tend",
"def show_list\n\t\tclear\n\t\tputs \"= LISTE DES INSTANCES #{name} =\".bleu\n\t\tputs \"\\n\\n\"\n\t\tlen_delim = defined?(LIST_ENTETE) ? LIST_ENTETE.length + 2 : 80\n\t\tdelim = (\"-\"*len_delim).bleu\n\t\tif defined?(LIST_ENTETE)\n\t\t\tputs delim\n\t\t\tputs LIST_ENTETE \n\t\tend\n\t\tputs delim\n\t\tall.each do |inst|\n\t\t\tputs \" #{inst.to_console}\"\n\t\tend\n\t\tputs delim\n\t\tputs \"\\n\\n\"\n\tend",
"def description\n return summary\n end",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"We need #{quantity} #{item}\"\n\tend\nend",
"def display_list(list)\n\tlist.each do |list_item|\n\t\tputs \"* #{list_item}\"\n\tend\n\nend",
"def pretty(list)\n list.each {|item, quantity| p \"You need to buy #{quantity} of #{item}.\"}\nend",
"def list_stats\r\n puts \"#{@name} Stats:\"\r\n puts \"Total HP: #{@hp}\"\r\n puts \"Class: #{@job}\"\r\n puts \"Total Strength: #{@strength}\"\r\n puts \"Total Speed: #{@speed}\"\r\n end",
"def print_pretty(list)\n list.each { |item, value| puts \"#{item} #{value}\" }\nend",
"def pretty_list(list)\n list.each do |grocery_item, qty|\n puts \"#{grocery_item}, quantity: #{qty}\"\n end\nend",
"def print_pretty (list)\n puts \"Grocery list\".upcase.center(50)\n puts \"-----------------\".center(50)\n list.each do |item,quantity|\n puts item.rjust(25) + \":\" + quantity.to_s.ljust(25) \n end\nend",
"def summary\n #render unless @output\n @summary\n end",
"def print_list(list)\n\tlist.each do |item,count|\n\t\tputs \"#{item}: #{count}\"\n\tend\nend",
"def print_list\n\t puts \"\"\n\t puts \"\"\n\t\tputs \"#{@list_name}\"\n\t\tprint \"-\" * 40\n\t\t@grocery_list.each {|k, v| puts \"#{k} #{v}\"}\n\t\tputs \"\"\n\t\tget_item\n\tend",
"def print_list(list)\n\tlist.each do |item, quantity|\n\t\tputs \"#{item}, amount: #{quantity}\"\n\tend\nend",
"def print_list(list)\n\tlist.each do |item,quantity|\n\t\tp \"#{quantity} #{item}\"\n\tend\nend",
"def stats_summary\n html = \"\"\n %w(inhale exhale cycle).each do |phase|\n %w(min max avg).each do |stat|\n time = format_time(self.meditations.map {|med| med.send(phase + \"_\" + stat)}.max)\n html += \"record #{phase} #{stat}: #{time}<br>\"\n end\n end\n html\n end",
"def print_list(list)\r\n puts \"-\"*20\r\n list.each do |item,quantity|\r\n puts \"Item:#{item} quantity:#{quantity}\"\r\n end\r\n puts \"-\"*20\r\n list\r\nend",
"def list_details\n puts \"Name: \" + @name\n puts \"Description: \" + @details\n puts \"Exercise Time: \" + @duration\n end",
"def render_summary\n summary = nil\n\n end",
"def print_pretty (list_name, list)\n p list_name.upcase.center (100)\n list.each do |x,y|\n p \"#{x.rjust(50)} : #{y.to_s.ljust(50)} \"\n end\nend",
"def short_display\n \"#@test_name: #{@message.split(\"\\n\")[0]}\"\n end",
"def summary\n response = get \"summary\", {}\n Hashie::Mash.new(response)\n end",
"def summary\n @data['summary']\n end",
"def toString\n\t\tif (!@head)\n\t\t\tputs \"Empty List\\n\\n\"\n\t\telse\n\t\t\tcurrent = @head\n\t\t\tstring = \"Head->\"\n\t\t\twhile (current)\n\t\t\t\tstring += current.get_item().to_s + \"->\"\n\t\t\t\tcurrent = current.get_next()\n\t\t\tend\n\t\t\tstring += \"End\\n\\n\"\n\t\t\tputs \"List of Size: \" [email protected]_s\n\t\t\tputs string\n\t\tend\n\tend",
"def summary\n Rinku.auto_link(description.html_safe) rescue nil\n end",
"def print_summary\n return if @silent\n fail '@key is empty' if \"#{@key}\".empty?\n say( \"#{@key} = '<%= color( %q{#{value}}, BOLD )%>'\\n\" )\n end",
"def print_list(list)\n\tlist.each do |item, qty|\n\t\tputs \"#{item} = #{qty}\"\n\tend\nend",
"def summary()\n\t\treturn \"#{@name} is a wonderful planet! It is a beautiful #{color} color! #{@name} has a mass of #{mass_kg} kg and is #{distance_from_sun_km} km from the sun. You might be surprised to find that: #{fun_fact}.\"\n\tend",
"def display_list(list)\n\t\tsanitize(list.empty? ? \"None\" : list.map(&:display).join(', '))\n\tend",
"def print_list(complete_list)\n puts \"Here is a list of things of things you need to buy and the amount needed:\"\n complete_list.each {|key, value| puts \"#{value} #{key}\" }\nend",
"def pretty_list(list)\n # new_list = \"\"\n # list.each { |item, quantity| new_list << \"You want #{quantity} #{item}\\n\" }\n # return new_list\n list.each { |item, quantity| puts \"You want #{quantity} #{item}\\n\" }\nend",
"def print_list(list)\r\n puts \"_-\" *25 + \"\\n\\n\"\r\n puts \"Here is your Grocery List: \\n\\n\"\r\n list.each do |item, quantity|\r\n puts \"\\tItem: #{item} \\tAmount: #{quantity}\"\r\n end\r\n puts \"_-\" *25\r\nend"
] | [
"0.7308192",
"0.7046981",
"0.6886973",
"0.67912745",
"0.6763501",
"0.6756746",
"0.67528033",
"0.67180103",
"0.6704319",
"0.6692735",
"0.66745",
"0.6666163",
"0.6642983",
"0.6642983",
"0.6640412",
"0.6629535",
"0.6619164",
"0.6619164",
"0.6619164",
"0.6619164",
"0.6610866",
"0.6581994",
"0.65789205",
"0.65069383",
"0.6470915",
"0.6454353",
"0.64493555",
"0.64362633",
"0.6434718",
"0.64110553",
"0.6392742",
"0.6385025",
"0.6385025",
"0.6359001",
"0.6354702",
"0.6353652",
"0.63511026",
"0.63415587",
"0.633968",
"0.6339014",
"0.6339014",
"0.63385856",
"0.6335254",
"0.63337725",
"0.63337725",
"0.63337725",
"0.63182074",
"0.63029075",
"0.6301174",
"0.6294959",
"0.62803596",
"0.62800336",
"0.6265567",
"0.624151",
"0.62330383",
"0.62330383",
"0.62154466",
"0.6203427",
"0.61944383",
"0.61944383",
"0.61944383",
"0.6181906",
"0.61721706",
"0.6154651",
"0.6138734",
"0.61374295",
"0.61366457",
"0.6132487",
"0.6131968",
"0.61249566",
"0.6124561",
"0.6120994",
"0.61155576",
"0.611526",
"0.610536",
"0.61018467",
"0.6099281",
"0.6099232",
"0.609899",
"0.6083039",
"0.6082838",
"0.60817385",
"0.6077764",
"0.60649055",
"0.6058442",
"0.60541946",
"0.60536695",
"0.60525775",
"0.60498995",
"0.6048195",
"0.6040322",
"0.6039797",
"0.60317594",
"0.60275596",
"0.60252416",
"0.6010298",
"0.5999274",
"0.5989064",
"0.59879786",
"0.5987871",
"0.59850955"
] | 0.0 | -1 |
Fast, safe, unbounded accumulation of children. | def to_a
items = []
current = self
while current.tail != self
unless current.tail.is_a?(Iterator)
items << current.tail
end
current = current.tail
end
return items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_child_elements(memo = [])\n memo\n end",
"def collect_child_elements(memo = [])\n memo\n end",
"def collect_child_elements(memo = [])\n memo\n end",
"def all_children(accummulator=[])\n return accummulator if children.size == 0\n children.each do |child_id|\n child = Folder.get(child_id)\n accummulator << child\n child.all_children(accummulator)\n end\n accummulator\n end",
"def children_size\n leaf? ? 0 : children.map(&:size).reduce(:+)\n end",
"def all_children\n reload\n nodes = []\n queue = children.to_a\n until queue.empty?\n node = queue.pop\n nodes.push(node)\n queue += node.children.to_a\n queue.flatten!\n end\n nodes\n end",
"def each(&block)\n squish = lambda do |tree, list|\n new_children = tree.children.reduce(list) { |acc, elem| squish.call(elem, acc) }\n [tree.root].lazy_append(new_children)\n end\n\n squish.call(self, [])\n\n # base = [root]\n # recursive = children.map(&:each)\n # res = base.lazy_append(recursive)\n\n # return res.each(&block) if block_given?\n\n # res\n\n # res = [[root], children.flat_map(&:each)].lazy.flat_map(&:lazy)\n # res = res.map(&block) if block_given?\n # res\n end",
"def total_child_count\n count = 0\n self.apply_to_children { |e| count += 1 }\n count\n end",
"def sum_children(records, parent, total = 0)\n return 0 if records[parent].nil?\n\n records[parent].each do |child, how_many|\n total += how_many\n total += how_many * sum_children(records, child)\n end\n total\nend",
"def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end",
"def children() []; end",
"def total_bags_inside\n children.size + children.map(&:total_bags_inside).sum\n end",
"def each\n queue = [@root]\n until queue.empty?\n kids = queue.shift.children\n kids.each do |x| yield x end\n queue.concat kids\n end\n end",
"def each\n queue = [@root]\n until queue.empty?\n node = queue.shift\n queue += node.children\n yield node\n end\n end",
"def children; []; end",
"def find_childless\n @childless = []\n queue = [@root]\n until queue.empty?\n curr_node = queue[0]\n if curr_node.children.empty?\n @childless << curr_node\n else \n queue += curr_node.children\n end\n queue.shift\n end\n @childless\n end",
"def compute_children_of(current, relations) # :nodoc:\n\t old_size = current.size\n\t for rel in relations\n\t\tnext if (rel.parent && relations.include?(rel.parent))\n\n\t\tcomponents = rel.generated_subgraphs(current, false)\n\t\tfor c in components\n\t\t current.merge c\n\t\tend\n\t end\n\n\t if current.size == old_size\n\t\treturn current\n\t else\n\t\treturn compute_children_of(current, relations)\n\t end\n\tend",
"def num_children\n count = 0\n self.children.each do |child|\n count = count + child.num_children\n end\n\n return self.children.size + count\n end",
"def self_and_all_children\n [self] + all_children\n end",
"def children\n (items + collections)\n end",
"def children\n @children ||= []\n end",
"def count_children\n count = children.count\n if count\n children.each { |child| count += child.count_children }\n end\n count\n end",
"def add_children(kids)\n i = 0\n while i < kids.size\n t = kids.get(i)\n add_child(t)\n i += 1\n end\n end",
"def count_all\n # map all nodes into enumerable\n # then add them all together (reduce :+)\n self.map { |node| node.count }.reduce(:+)\n end",
"def merge\n # we merge only if out-degree(self) = 1 and out-degree(child) = 1\n while children.size == 1 && children[0].parents.size == 1\n c = children[0]\n c.children.each do |cc|\n cc.parents.reject! {|c2| c2.equal?(c) }\n cc.parents << self\n end\n\n # inherit the type and weight of the child\n self.children = c.children\n self.type = c.type\n self.weight += c.weight\n\n # remove the child from the DAG\n c.merged = true\n c.children = []\n end\n end",
"def add_children(anEnumerable, theBacklog)\n anEnumerable.reverse_each do |elem|\n theBacklog.unshift(elem)\n end\n end",
"def size\n @children.size\n end",
"def children_sumtrees\n children.each_with_object({}) do |child, sum|\n sum[child.name] = child.total_weight\n end\n end",
"def all_children(scope = {})\n full_set(scope) - [self]\n end",
"def build_current_children_and_evaluate! opts={}\n these_asserts\n @current.clear\n if (@start_offset > final_offset) # see :note3\n @done = true\n evaluate_ok!\n return nil\n end\n @ok = nil\n @done = false\n @children_productions = production.children\n @ctxt = parse_context\n ([email protected]).each do |idx|\n @current.push idx\n break unless build_this_child_and_keep_going?(idx, opts)\n end\n @children_productions = nil\n @ctxt = nil\n evaluate_ok!\n nil\n end",
"def children(target, rules)\n rule = rules[target]\n return 1 if rule.empty?\n\n sum = 1\n rule.each do |k, v|\n child_count = children(k, rules)\n sum += v * child_count\n end\n sum\nend",
"def lru_append(parent, child)\n lru_join(child, parent.lru_next)\n lru_join(parent, child)\n end",
"def _children\n @children\n end",
"def _children\n @children\n end",
"def _children\n @children\n end",
"def _children\n @children\n end",
"def each\n yield self\n children.each {|c| c.each {|n| yield n}}\n end",
"def grand_children\n []\n end",
"def all_children(special=nil)\n full_set(special) - [self]\n end",
"def size\n children_size + my_size\n end",
"def with_rows_and_height\n root = self\n queue = [root]\n visited = []\n\n until queue.empty?\n current = queue.shift\n adjacency_list = current.children\n\n self.height += 1\n adjacency_list.each do |node|\n root.rows << (node.nil? ? \"x\" : node.value)\n next if node.nil?\n visited << node.value\n\n if node.distance == Float::INFINITY\n node.distance = current.distance + 1\n node.parent = current\n queue.push(node)\n end\n end\n end\n\n self\n end",
"def _children\n @children\n end",
"def apply_children\n \n end",
"def keying_children\n return children.inject( 0 ) do |product, value|\n product += 1 if value.try( :device ).try( :keying? )\n product\n end\n end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def collecting(accessor, *params)\n self.inject([]) { |all, child| all + child.send(accessor, *params) } || []\n end",
"def compute_tree_children_occurences(result_occurences)\n result_occurences.add_up(@occurences)\n\n @tree_children.each do |child_cluster|\n child_cluster.compute_tree_children_occurences(result_occurences)\n end\n end",
"def visit_all(&block)\n visit &block\n children.each {|c| c.visit_all &block}\n end",
"def children\n @children ||= {}.with_indifferent_access\n end",
"def ignore_children!\n @ignoring_children += 1\n end",
"def children\n SideJob.redis.hgetall(\"#{redis_key}:children\").each_with_object({}) {|child, hash| hash[child[0]] = SideJob.find(child[1])}\n end",
"def each\n @children.each {|child| yield child}\n end",
"def expand_children node=:current_index\n $multiplier = 999 if !$multiplier || $multiplier == 0\n node = row_to_node if node == :current_index\n return if node.children.empty? # or node.is_leaf?\n #node.children.each do |e| \n #expand_node e # this will keep expanding parents\n #expand_children e\n #end\n node.breadth_each($multiplier) do |e|\n expand_node e\n end\n $multiplier = 0\n _structure_changed true\n end",
"def aggregate(accessor, *params)\n self.inject([]) { |all, child| all << child.send(accessor, *params) }.flatten || []\n end",
"def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end",
"def _children\n @children\n end",
"def num_children\n @children.size\n end",
"def divide_if_needed(defer_update = false)\n if children.size > MAX_SIZE\n raise \"node is not lowest level and can therefore not be divided: #{self}\" unless lowest_level?\n @children = (0...MAX_SIZE).collect do |i|\n leaves = children.find_all {|leaf| leaf.shash_array[level] == i}\n NonLeafNode.new(self, leaves)\n end\n children.each {|child| child.divide_if_needed(defer_update)}\n end\n update_shash(false) unless defer_update\n end",
"def children=(_arg0); end",
"def children=(_arg0); end",
"def descendants_r(*args)\n pending = [self]\n des = []\n while !pending.empty?\n e = pending.pop\n e.children(*args).each do |c|\n if !des.include?(c)\n des << c\n pending.push(c)\n end\n end\n end\n des\n end",
"def tasks_in_subtree\n seen = {}\n f = proc do |root|\n unless seen[root]\n seen[root] = root\n for elem in root.deps_o\n f.call(elem)\n end\n end\n end\n f.call(self)\n seen.values\n end",
"def calculate_num_children\n for x in @lattice do\n for c in @lattice.lower_covers[x] do\n if @irreducibles.contain?(c) then\n @num_children[x] += 1\n end\n end\n end\n end",
"def children\n []\n end",
"def reduce_all_lazy(_production, _range, _tokens, _children)\n :ALL_LAZY\n end",
"def count_children(color:)\n if color == \"no other\"\n 0\n else\n children_counts = BAG_MAP_2[color].map { |content_arry| content_arry.first }\n children = children_counts.inject(0) { |sum,x| sum + x }\n\n ary = BAG_MAP_2[color]\n\n ary.each do |arry_content|\n num = arry_content.first\n col = arry_content.last\n\n children += num * count_children(color: col)\n end\n\n children\n end\nend",
"def count_children(node)\n\t\treturn 0 if node.children.nil?\n\t\tnode.children.count + (node.children.map {|child| count_children(child)}).inject(&:+)\n\tend",
"def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end",
"def all_children\n children(all: true)\n end",
"def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end",
"def children\n []\n end",
"def children\n []\n end",
"def children\n []\n end",
"def children\n []\n end",
"def children\n []\n end",
"def clear_children!\n @children.clear\n end",
"def children_to_zero\n self.youngsters ||= 0\n end",
"def with_children\n [self].tap do |self_with_children|\n if children\n self_with_children.concat(child_nodes)\n end\n end\n end",
"def bfs(val) \n queue = [self] \n\n until queue.empty? \n if queue.first.value == val\n return queue.first\n else\n queue.concat(queue.shift.children) #you add [] + children's children\n end\n end\n nil #if noting == val\n end",
"def enqueue_roots\n vertices.each do |v|\n @blockers[v] = direct_dependencies_of(v).length\n enqueue(v) if @blockers[v] == 0\n end\n end",
"def grow( )\n\t\tnew_leaves = [ ]\n\t\[email protected] do |leaf|\n\t\t\tif @forward\n\t\t\t\tsearch = lambda { |song| leaf.song.last == song.first }\n\t\t\telse\n\t\t\t\tsearch = lambda { |song| leaf.song.first == song.last }\n\t\t\tend\n\t\t\t$songs.find_all(&search).each do |next_song|\n\t\t\t\tnew_leaves << leaf.add_next(next_song)\n\t\t\tend\n\t\tend\n\t\t@leaves = new_leaves\n\tend",
"def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\n count\n end",
"def collect_values_with_count_subtree(flag=nil)\n\t\tvalues = collect_values_with_count\n\t\tall_children_deep(flag).each do |c|\n\t\t\tc.collect_values_with_count.each do |k,v|\n\t\t\t\tvalues[k]+=v\n\t\t\tend\n\t\tend\n\t\tvalues\n\tend",
"def length\n @children.length\n end",
"def depth_first\n result = [self]\n if child_ids.empty?\n return result\n else\n children.sort.each do |child|\n result += child.depth_first\n end \n end\n return result \n end",
"def children\n _children\n end",
"def bft(&block)\n queue = Queue.new\n \n # Set all nodes to not enqueued\n self.each do |node|\n node.enqueued = false\n end\n\n queue.push(self) \n self.enqueued = true\n\n while(queue.size > 0)\n # Get next node in the queue\n node = queue.pop\n \n # Pass node off to block\n block.call(node)\n\n # Enqueue all children nodes\n node.child_array.each do |child|\n if !child.enqueued\n queue.push(child)\n child.enqueued = true\n end\n end\n\n end #while\n end",
"def render_child_count(node = @tree.root)\n @stack.push(node)\n child_count = 0\n until @stack.empty?\n current_node = @stack.pop\n current_node.children.each do |child|\n @stack.push(child)\n child_count += 1\n end\n end\n child_count\n end",
"def number_of_children\n @children.size\n end",
"def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end"
] | [
"0.6623573",
"0.6623573",
"0.6623573",
"0.65060663",
"0.64659846",
"0.64284015",
"0.63667667",
"0.6209316",
"0.6194813",
"0.61451435",
"0.6137409",
"0.61086774",
"0.60678965",
"0.6017126",
"0.600901",
"0.59775513",
"0.5952149",
"0.58408004",
"0.57900107",
"0.5771094",
"0.5728962",
"0.57158947",
"0.57131195",
"0.5672243",
"0.56715095",
"0.5670879",
"0.56578165",
"0.5641519",
"0.56358224",
"0.5622124",
"0.55939215",
"0.5591314",
"0.55812484",
"0.55812484",
"0.55812484",
"0.55812484",
"0.55686605",
"0.55580103",
"0.5546648",
"0.55425453",
"0.55185",
"0.55156773",
"0.5514981",
"0.5497675",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.54908395",
"0.5490655",
"0.5488456",
"0.5487966",
"0.54864436",
"0.54842097",
"0.5484156",
"0.5474068",
"0.54705805",
"0.546568",
"0.54599345",
"0.5455304",
"0.54485416",
"0.5429839",
"0.54291415",
"0.54291415",
"0.54227877",
"0.5414308",
"0.541216",
"0.5407443",
"0.5406375",
"0.5396295",
"0.5393796",
"0.5387287",
"0.53639",
"0.53602695",
"0.53583306",
"0.53583306",
"0.5355471",
"0.5355471",
"0.5355471",
"0.53505313",
"0.5346258",
"0.5345014",
"0.5342213",
"0.53410983",
"0.53366584",
"0.53321713",
"0.5331326",
"0.53277385",
"0.532446",
"0.531669",
"0.53143597",
"0.5297366",
"0.5295665",
"0.52948457"
] | 0.0 | -1 |
A callback that is invoked when an item is added to the list. | def added(node)
@size += 1
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(item)\n\t\t#takes in item and adds to list\n\t\t@list << item\n\tend",
"def add_item(item)\r\n @list << item \r\n end",
"def on_add(&block)\n @add_proc = block\n end",
"def add_item(item)\n @get_items << item\n end",
"def addItem(item)\n @items << item\n end",
"def add_item item\n if (@listOfItem != nil)\n @listOfItem.push item\n else\n puts \"@listOfItem is null, so can't add an item to this\"\n end\n \n end",
"def add_item(item)\n\t\[email protected](item)\n\tend",
"def add_new_item(new_item)\n @items.push(new_item)\n end",
"def add_to_list(list,item,quantity)\n\tupdate_item(list,item,quantity)\nend",
"def add_item(list,name,value)\n list = List.find(list)\n list.add(Item.new(name,value))\n say_set list.name, name, value\n end",
"def add_item item\n @items << item\n @@all_items << item\n end",
"def add_item(new_item)\n grocery_list.push(new_item)\n return grocery_list \nend",
"def add_item(item, quant=0)\n\t$grocery_list.store(item, quant)\n\tp \"You added #{item} to your list.\"\nend",
"def insert(item)\n @info << item\n changed\n notify_observers(self, :insert, item)\n self\n end",
"def add_item(current_list, item_added, quantity)\n current_list[item_added] = quantity\n current_list\nend",
"def add_item(new_item)\n item = Item.new(new_item)\n items.push(item)\n end",
"def on_add(clicker)\n end",
"def add(item)\r\n fail \"missing item\" if item.nil?\r\n fail \"item is not active, it cannot be put in your wish list\" unless item.is_active?\r\n\r\n self.items << item\r\n item.add_observer(self)\r\n end",
"def add_item(new_item)\n item = Item.new(new_item)\n @items.push(item)\n end",
"def on_add(&block)\n @index.each do |index, values|\n values.each do |v|\n block.call(v)\n end\n end\n @onAddBlock = block\n end",
"def update(list, item, qty)\n add_item(list, item, qty)\nend",
"def add_callback(type, options, &block); end",
"def add_item_to_list(item)\n @to_do_item.push(item)\n end",
"def push(item); end",
"def add_item (grocery_list, grocery_item)\n grocery_list.store(grocery_item, 0)\nend",
"def add_to_list(list, item, quantity)\n #method to add items\n list[item] = quantity\nend",
"def add_to_list(list)\n\n end",
"def add_to_list(list)\n\n end",
"def add_to_list(list)\n\n end",
"def add_item(list_item,user_list)\n#user_list is later defined/used to store a new list of information created when create_list method is called.\n#Uses create_list method to format information properly before allowing edits and updates to be done. \n#user_list = create_list(string) \n user_list[list_item] = 1\n user_list\nend",
"def updating_item(list,item,quantity)\r\n\r\n adding_item(list,item, quantity)\r\n\r\nend",
"def add_item(list,new_item,item_count)\n\tlist[new_item] = item_count\nend",
"def add_item(payload)\n if @first_item.nil?\n @first_item = LinkedListItem.new(payload)\n @size += 1\n # else\n # @first_item\n # until item.last?\n # item = item.next_list_item\n # end\n # item.next_list_item = LinkedListItem.new(payload)\n # @size += 1\n end\n end",
"def add( item)\n\t\titem.addtag self.gettag\n\tend",
"def accept_list_item_end list_item\n end",
"def add_item(item)\n @in_batch << item\n @in_count += 1\n @in_size += @size_of_item_proc.call(item)\n end",
"def after_item(item)\n item\n end",
"def insert_callback(&block)\n @callbacks << block\n end",
"def push(item)\n end",
"def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend",
"def add_item_to_list(grocery_list, grocery_item, quantity = 1)\n grocery_list.store(grocery_item,quantity)\n puts \"I've added #{grocery_item} to the list. Please pick up #{quantity} of these.\"\nend",
"def add(item)\n @batch << item\n execute if ready?\n end",
"def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend",
"def add_item(item)\r\n \[email protected](item)\r\n end",
"def << item\n @items << item\n end",
"def addListDataListener(l)\n @listeners << l\n end",
"def item_insert(item)\n insert(playlist_url, @response.new_index, item)\n end",
"def add_item(item)\n @chores << item\n end",
"def addItem _obj, _args\n \"_obj addItem _args;\" \n end",
"def add_item(list, new_item, qty=1)\n list[new_item] = qty\nend",
"def add list\n list_action list, \"add\"\n end",
"def add_item(existing_list, new_item, item_integer)\n\t# input: item name and optional quantity\n\t# steps: pass in item name as key and assign value\n\texisting_list[new_item] = item_integer\n\t# output: hash\n\tp existing_list\nend",
"def append(*args)\n update(*args)\n @list.push(args[0])\n end",
"def push(item)\n @items.push(item)\n end",
"def <<(item)\n @items << item\n end",
"def push(item)\n @items.push(item)\n end",
"def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(item, quantity, list)\n\tlist[item] = quantity\n\titem\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend",
"def on_add(xmlpath, id)\n\n yield(xmlpath, id) if block_given?\n\n end",
"def add_item(list, item, quantity = 1)\r\n# input: list, item name, and optional quantity\r\n# steps: \r\n # check for optional quantity. if not present, set to default (1)\r\n list[item] = quantity\r\n # update list with input\r\n puts \"#{item.upcase} has been added to your grocery list!\"\r\n p list\r\n# output: complete list, updated\r\nend",
"def add_item(item)\n delete_item(item.name) if find_item(item.name)\n @items << item\n end",
"def add_new(type, new_item)\n #Add exercise to exercise_list\n if type == \"exercise\"\n @exercise_list.push(new_item)\n return 0\n #Add a workout to workout_routines\n elsif type == \"workout\"\n @workout_routines.push(new_item)\n return 0\n #Error handling\n else\n return -1\n end\n\n end",
"def item_add item\n\t\tret = super\n\t\titem.known! if (ret)\n\t\treturn ret\n\tend",
"def ListView_InsertItem(hwnd, pitem) send_listview_message(hwnd, :INSERTITEM, lparam: pitem) end",
"def add_to_list(item, grocery_list)#add item and grocery_list to method\n if grocery_list.include?(item)#check if item is on list\n puts \"#{item} is already on your list\"#if item on list\n else\n grocery_list.push(item)#push new items to grocery list\n end\nend",
"def <<(item)\n append(List[item])\n end",
"def add_to_list\n\n # Keep a copy of position to set after the change detail is saved, \n # because the entry will be put at the end of the list.\n position = self.position\n self.save\n\n if self.errors.empty?\n change_details = self.change_item.change_details.find(:all)\n position = 1 if !position\n change_details.last.insert_at(position)\n end\n end",
"def add_item(list, item, quantity=0)\n\tlist[item] = quantity\n\tlist\nend",
"def add_item (groceries_list, new_item, quantity)\n\t# add 1 new item to list\n\tgroceries_list.merge!({new_item => quantity})\n\t# return updated list\n\tgroceries_list\n# output: hash\nend",
"def add_item(list, new_item, quantity=1)\n list[new_item] = quantity \nend",
"def add_item_to_list(list_name,item_to_add,quantity_to_add = 1)\n#create a hash element with the item name and the quantity, if specified\n#if no quantity is specified, default value = 1\n new_item = { \n item_name: item_to_add,\n quantity: quantity_to_add\n }\n# insert the hash into array \n list_name.push(new_item)\n new_item\nend",
"def add(item)\n save do\n items.push(Item.new(item)).last\n end\n end",
"def add_to_list(list_hash, item, qty)\r\n\tlist_hash[item] = qty\r\n\tlist_hash\t\r\nend",
"def add_item(electives, item)\n puts electives.push(\"debate club\")\nend",
"def addItem(item)\n @toDoListArray.push(item)\n end",
"def <<(item)\n add_item(item)\n end",
"def add_list_item(content,page_id = current_page_id, list_id = current_list_id)\n # POST /ws/page/#{page_id}/lists/#{list_id}/items/add\n request \"page/#{page_id}/lists/#{list_id}/items/add\", \"item\" => { \"content\" => content }\n end",
"def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend",
"def add(item)\n self[to_identifier(item)] = item\n end",
"def add_item(item)\n if (@items.has_key?(item.id))\n #raise error here\n end\n @items[item.id] = item\n Event::ItemUpdateEvent.item_created item\n end",
"def add_item(array, item)\n\tarray.push(item)\nend",
"def add_item_to_list?(_item)\n raise NoMethodError, \"Subclass must define the #{__method__} method and return true or false\", caller\n end",
"def add_to_list_resource\n manage_list_resource(:add)\n end",
"def done_adding(*) end",
"def add_callback(&block)\n @blocks << block\n end",
"def add_anniversary_item(item)\n @anniversary_list.push(item)\n end",
"def add_to_my_list(task)\n @my_list << task\n end",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def add_item(item,amount=1,the_lists)\r\n\t# steps: accept 2 arguments. Item name and Quantity (with default)\r\n\tif the_lists[item] != nil\r\n\t puts \"Item is already on the List !\"\r\n\t puts \"Added amount to the quantity\"\r\n\t the_lists[item] += amount\r\n\telse\r\n the_lists[item] = amount\r\n\tend\r\n\r\n\tprint_list(the_lists)\r\nend",
"def onCreated(item)\n @object.created(import(item))\n end",
"def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend",
"def add_item(name)\n\t\ttodo_items.push(TodoItem.new(name))\n\tend",
"def add_item_callback\n left = @adapter\n right = RepositoryAdapter.new(@adapter.constraint)\n builder = BuilderDialog.new(@driver, left, right)\n @driver << builder\n end",
"def add_item(grocery_list, new_item_to_add, quanity)\n\tgrocery_list[new_item_to_add] = quanity\n\tp grocery_list\n\nend",
"def add_to_list(list, item, quantity = 1)\n\tlist[item] = quantity\nend",
"def add(food)\n foodList << food\nend",
"def callback(&block)\n @callbacks << block\n end"
] | [
"0.7172329",
"0.7149613",
"0.6701956",
"0.64949346",
"0.64820355",
"0.645346",
"0.63813996",
"0.63811094",
"0.6361909",
"0.6355626",
"0.63524795",
"0.6342609",
"0.62787616",
"0.6270286",
"0.62450546",
"0.62250394",
"0.6201345",
"0.6183714",
"0.6131977",
"0.6060969",
"0.60318285",
"0.6027508",
"0.6013275",
"0.59901524",
"0.5986256",
"0.598488",
"0.598136",
"0.598136",
"0.598136",
"0.5979779",
"0.5976715",
"0.59710187",
"0.59682375",
"0.5955621",
"0.59467727",
"0.5943738",
"0.5942773",
"0.5925102",
"0.5907826",
"0.59010625",
"0.5895623",
"0.5894881",
"0.5894163",
"0.5889069",
"0.5871748",
"0.5870869",
"0.5854359",
"0.58512616",
"0.5844396",
"0.58374065",
"0.5825163",
"0.58169234",
"0.5814777",
"0.5807734",
"0.58073944",
"0.5804413",
"0.58020353",
"0.58020353",
"0.5801909",
"0.57983285",
"0.57983285",
"0.57977015",
"0.5790682",
"0.5789806",
"0.578783",
"0.5781166",
"0.57808375",
"0.5777455",
"0.5776204",
"0.577577",
"0.57603514",
"0.5757703",
"0.5757683",
"0.57441396",
"0.57434684",
"0.57290494",
"0.5720046",
"0.57016385",
"0.569769",
"0.5694574",
"0.5691379",
"0.5690431",
"0.5689388",
"0.56879115",
"0.5687643",
"0.56804514",
"0.5679616",
"0.5674287",
"0.5672063",
"0.5664952",
"0.56630987",
"0.5662219",
"0.5657973",
"0.565529",
"0.5654057",
"0.56333584",
"0.5625713",
"0.5623392",
"0.56199455",
"0.56179094",
"0.5616973"
] | 0.0 | -1 |
Append a node to the end of the list. | def append(node)
if node.head
raise ArgumentError, "Node is already in a list!"
end
node.tail = self
@head.tail = node
node.head = @head
@head = node
return added(node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(node)\n if next_node\n next_node.append(node)\n else\n next_node = node\n end\n end",
"def append(node)\n if @head.next.nil?\n @head.next = node\n else\n tail\n @current_node.next = node\n end\n end",
"def append(node)\n children.append(node)\n end",
"def append(node_value = nil)\n node = Node.new(node_value)\n if @tail.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def append(node)\n if @root==nil\n \t@root=node\n \t@tail=node\n else\n \[email protected]_node = node\n \t@tail= node\n\n end\n @size+=1\n end",
"def append(node)\n nxt = @nxt\n top = self\n while nxt\n top = nxt\n nxt = nxt.nxt\n end\n node = node.first\n top.nxt = node\n node.prv = top\n node\n end",
"def append( value )\n last.next = Node.new value\n end",
"def ll_append(data)\n new_node = Node.new(data)\n \n if @num_nodes == 0\n @head = new_node\n @tail = new_node\n else\n end_node = @tail\n end_node.set_Next(new_node)\n @tail = new_node\n end\n \n @num_nodes += 1\n end",
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def append\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n new_node = Node.new\n @head.next_node = new_node\n @tail = new_node\n else\n new_node = Node.new\n search_node = @tail\n search_node.next_node = new_node\n @tail = new_node\n end\n\n @size += 1\n @tail\n end",
"def append(value)\n new_node = create_node(value) \n if head.nil?\n self.head = new_node\n else\n last_node = tail\n last_node.next_node = new_node\n end\n self.size += 1\n end",
"def append(data)\n\t\[email protected]_node = Node.new(data, nil)\n\t\t@tail = @tail.next_node\n\tend",
"def append\n new_node = Node.new\n\n if @head.nil? #aka empty list (no nodes)\n @head = new_node\n @tail = new_node\n @head.next_node = @tail\n @tail.next_node = nil #problem alert\n else\n @tail.next_node = new_node\n @tail = new_node\n @tail.next_node = nil #problem alert\n end\n end",
"def append(value)\n\t\tself.tail.next_node = Node.new(value, nil)\n\tend",
"def append(value = nil, next_node = nil)\n\n if (@head.nil?)\n prepend(value)\n else\n node = @head\n while (node.has_next)\n node = node.next_node\n end\n node.next_node = Node.new(value, next_node)\n end\n\n end",
"def append(value)\n new_node = Node.new(value)\n @head ? @tail.next_node = new_node : @head = new_node\n @tail = new_node\n @size += 1\n end",
"def append(val)\n\t\t# create a new node\n\t\tnew_node = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\[email protected]_node = new_node\n\t\t# update tail\n\t\t@tail = new_node\n\tend",
"def add_to_tail(node)\n @head ||= node\n\n @tail.next = node if @tail\n @tail = node\n end",
"def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # ^ kind of like incrementing the loop counter\n end\n\n node.next = Node.new value\n end",
"def add_to_tail(node)\n if self.head == nil # if the list is empty, node becomes new head\n self.head = node\n else\n self.tail.next = node # otherwise, is the next node after the previous tail\n end\n node.next = nil # no next\n self.tail = node # it becomes the new tail\n end",
"def append(value)\n new_node = Node.new(value)\n node = @node\n\n while node.next\n node = node.next\n end\n\n node.next = new_node\n end",
"def append(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(self.tail, new_node)\n self.tail = new_node\n self.size += 1\n end\n self.as_string\n end",
"def append( value )\n\n # Find the last node in this list\n # i.e. keep looking at the next node\n # until the next node is 'nil'\n node = @head\n while node.next\n node = node.next\n # kind of like incrementing the loop counter\n end\n\n # puts \"End of loop:\"\n # p node\n\n node.next = Node.new value\n end",
"def append(value)\n node = Node.new(value)\n if last\n last.next = node\n else\n @head = node\n end\n end",
"def add_to_tail(node)\n if @head.nil?\n @head = node\n @tail = node\n else\n # search_until(nil)\n @tail.next = node\n @tail = node\n end\n end",
"def append(value)\n if @head\n find_tail.next = Node.new(value)\n else\n @head = Node.new(value)\n end\n end",
"def add_to_tail(node)\n if @head\n @tail.set_next(node)\n @tail = node\n else\n @head = node\n @tail = node\n end\n end",
"def append(value)\n new_node = Node.new(value)\n @node_counter += 1\n if @head == nil\n @head = new_node\n else\n last_node = traverse_nodes(@head)\n # require 'pry'; binding.pry\n last_node.next_node = new_node\n end\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n else\n @tail.next_node = node\n end\n @tail = node\n end",
"def append(value)\n\t\t\tif self.empty?\n\t\t\t\tself.prepend(value)\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\telement = self.head\n\t\t\t# loop through each element in the LinkedList, until element.next \n\t\t\t# equals @head, signifying we have reached the end of the list.\n\t\t\twhile(element != self.head)\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tnew_element = RubyStructures::Node.new(self, value)\n\t\t\t# insert the new element at the end of the LinkedList.\n\t\t\tnew_element.next = element.next\n\t\t\telement.next = new_element\n\t\tend",
"def append(val)\n current = @head\n while current.next?\n current = current.next_node\n end\n new_node = Node.new(val, nil)\n current.next_node = new_node\n end",
"def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end",
"def append(data)\n\t\ttemp = Node.new(data)\n\t\tif (!@head)\n\t\t\t@head = temp\n\t\t\t@tail = temp\n\t\telse\n\t\t\ttemp.set_prev(@tail)\n\t\t\[email protected]_next(temp)\n\t\t\t@tail = temp\n\t\tend\n\t\t@size +=1\n\tend",
"def append (number)\n # create new node\n this_node = Node.new(number)\n # make head if none\n if head.nil?\n return @head = this_node\n end\n\n # else, loop to end of list\n current = @head\n until current.next_node.nil?\n current = current.next_node\n end\n\n # make last node point to new node\n current.next_node = this_node\n\n # update tail to be this_node\n @tail = this_node\n end",
"def append(data)\n node = Node.new(data)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end",
"def append(data)\n if head\n next_node = head\n next_node = next_node.next_node while next_node.next_node\n next_node.next_node = Node.new(data: data)\n else\n @head = Node.new(data: data)\n end\n end",
"def append(value)\n # if the list is empty, you need to update head and tail. \n # you can do via push, because in the case append == push\n if isEmpty?\n push(value)\n return\n end\n\n # if the list is not empty, you need to create a new Node\n # after the tail\n @tail.next_node = Node.new(value)\n # since it's a tail-end insertion, the new node is also\n # the tail of the list\n @tail = @tail.next_node\n end",
"def append(value)\n if @size == 0\n @head = Node.new(value)\n else\n node = @head\n node = node.link until node.link.nil?\n node.link = Node.new(value)\n end\n\n @size += 1\n end",
"def append(val)\n\t\t# create a new node\n\t\tnewNode = Node.new(val, nil)\n\t\t# make old tail point to new node\n\t\[email protected]_node = newNode\n\t\t# update tail\n\t\t@tail = newNode\n\tend",
"def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n\n @last = newNode\n @length += 1\n self\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n @last = newNode\n @length += 1\n self\n end",
"def add_to_tail(node)\n return unless node\n self.head ||= node\n self.tail.next = node if self.tail\n self.tail = node\n self.tail.next = nil\n end",
"def append(data)\n if @head.data.nil?\n @head = Node.new(data)\n else\n node = @head\n node = node.next_node until node.next_node.nil?\n node.next_node = Node.new(data)\n end\n end",
"def append(value)\n if @head.nil?\n @head = Node.new(value)\n @tail = @head\n else\n @tail.next_node = Node.new(value)\n @tail = @tail.next_node\n end\n end",
"def append(value)\n a = Node.new(value);\n a.prev = last;\n a.next = nil;\n a.prev.next = a; #prev now 2nd last\n end",
"def add_to_tail(node)\n if self.tail\n self.tail.next = node\n self.tail = node\n else\n self.tail = node\n self.head = node\n end\n end",
"def append(value)\n node = Node.new(value)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = @tail.next_node\n end\n end",
"def append(value)\n node = LinkedListNode.new(value, @tail, nil)\n if @size.zero?\n @head = node\n @tail = node\n @size += 1\n return\n end\n\n @tail.next = node\n @tail = node\n @size += 1\n end",
"def add_last(node)\n if @head.nil?\n @head = node\n return\n end\n\n iterate do |curr_node|\n if curr_node.next_node.nil?\n curr_node.next_node = node\n node.prev_node = curr_node\n return\n end\n end\n end",
"def add_to_tail(node)\n\n if(@tail)\n @tail.next = node\n @tail = node\n else\n @head = node\n @tail= node\n end\n end",
"def add_to_tail(node)\n if @head == nil\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n @last = newNode\r\n @length += 1\r\n self\r\n end",
"def append(data)\n\t\ttmp = Node.new(data)\n\t\tif @head.nil?\n\t\t\t@head = tmp\n\t\t\t@tail = tmp\n\t\t\t\n\t\telse\n\t\t\[email protected] = tmp\n\t\t\ttmp.previous = @tail\n\t\t\ttmp.next = nil\n\t\t\t@tail = tmp\n\t\tend\n\t\t@count += 1\n\tend",
"def add_to_tail(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n self.tail.next = node\n self.tail = node\n end\n end",
"def add_to_tail(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n self.tail.next = node\n self.tail = node\n end\n end",
"def add_to_tail(node)\n if @tail.nil?\n @head = node\n else\n @tail.next = node\n end\n @tail = node\n end",
"def add_to_tail(node)\n if @head === nil\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end",
"def add_to_tail(node)\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end",
"def add_to_tail (data)\n new_element = Node.new (data)\n if @head.nil?\n @head = new_element\n else\n current_node = @head\n while current_node.next\n current_node = current_node.next\n end\n current_node.next = new_element\n end\n end",
"def append(val)\n node = Node.new\n node.value = val\n @array << node \n @array[-2].next_node = node unless @array.count == 1 \n end",
"def add_at_tail(val)\n @list << val\n end",
"def add_to_tail(node)\n if self.head.nil?\n\n self.head = node\n self.tail = node\n\n else\n self.tail.next = node\n self.tail = node\n end\n end",
"def add_last(data)\n @head.nil? ? @head = Node.new(data, @head) : add_last_helper(data, @head)\n end",
"def add_to_tail(node)\n if @head == nil # no head exist, so we need to create one\n @head = node\n @tail = @head # both head and tail are same (e.g. n1)\n else\n @tail.next = node # set the pointer (e.g. n1 points to n2)\n @tail = node # then set the new tail value to n2\n end\n end",
"def add(node)\r\n @nodes << node\r\n end",
"def add_to_tail(node)\n if self.head == nil\n self.head = node\n end\n if self.tail\n self.tail.next = node\n end\n node.next = nil\n self.tail = node\n end",
"def add_to_tail(node)\n if @head.nil?\n @head = node\n @tail = @head\n else\n @tail.next = node\n @tail = node\n end\n end",
"def add_to_tail(node)\n if @head === nil\n @head = node\n @tail = @head\n else\n @tail.next = node\n @tail = node\n end\n end",
"def append(value)\n if @head.nil?\n @head = Node.new(value)\n else\n current_node = @head\n new_node = Node.new(value)\n current_node = current_node.next_node until current_node.next_node.nil?\n current_node.next_node = new_node\n end\n end",
"def add_to_tail(node)\n if !self.head\n self.head = node\n self.tail = node\n else\n self.tail.next = node\n self.tail = node \n end\n end",
"def append(value)\n node = Node.new\n node.value = value\n\n if @head.nil?\n @head = node\n @tail = node\n else\n @tail.next_node = node\n @tail = node\n end\n @size += 1\n end",
"def append(value)\n if head == nil\n prepend(value)\n else\n tmp = head\n while tmp.next_node != nil\n tmp = tmp.next_node\n end\n tmp.next_node = Node.new(value)\n end\n end",
"def add_to_tail(node)\n if head.nil?\n @head = node\n @tail = node\n else\n @tail.next = node\n @tail = node\n end\n end",
"def add_to_tail(node)\n if self.head != nil\n current = self.head\n while current.next != nil\n current = current.next\n end\n current.next = node\n self.tail = node\n else\n self.head = node\n self.tail = node\n end\n self.tail.next = nil\n end",
"def add_to_tail(node)\n if self.tail == nil\n self.tail = node\n self.head = node\n node.next = nil\n return\n end\n \n old_tail = self.tail\n old_tail.next = node\n node.next = nil\n self.tail = node\n end",
"def append(x)\n elem = ListElement.new(x)\n self.next = elem\n end",
"def add_last element\n if empty?\n @head = @tail = Node.new(element, nil)\n else\n @tail.next_node = Node.new(element, nil)\n @tail = @tail.next_node\n end\n @size += 1\n\n return nil\n end",
"def append(newEntry)\n if @head.nil?\n @head = newEntry\n @tail = newEntry \n else\n @tail.next = newEntry\n @tail = newEntry\n end \n end",
"def add_to_tail(node)\n if (!@head)\n @head = node\n @tail = node\n elsif (@head == @tail)\n @tail = node\n @head.next = tail\n else\n current = head\n while(current.next != nil)\n current = current.next\n end\n current.next = node\n @tail = node\n end\n end",
"def append_elem(data)\n\t\tnode = Node.new(data)\n\t\tnode.next_node = nil\n\t\t@head = node if @head == nil\n\t\t@last_elem.next_node = node if @last_elem != nil\n\t\t@last_elem = node\n\tend",
"def add_last element\n if empty?\n @head = @tail = Node.new(element, nil, nil)\n else\n @tail.next_node = Node.new(element, @tail, nil)\n @tail = @tail.next_node\n end\n @size += 1\n\n return nil\n end",
"def add_last(data)\n if !@head\n @head = Node.new(data)\n else\n current = @head\n while current.next\n current = current.next\n end\n current.next = Node.new(data)\n end\n end",
"def add_last(elt)\n @tail = Node.new(elt, nil, @tail)\n if @size == 0\n @head = @tail\n else\n @tail.previous.next = @tail\n end\n @size += 1\n end",
"def add_last(data)\n current = @head\n # if list is empty, add data to front\n if length == 0\n add_first(data)\n else\n # use length method to move to the last node in the list\n (length - 1).times do \n current = current.next\n end\n last = current\n # insert the new node after the current last node; current last node's next become new last node\n new_node = Node.new(data)\n last.next = new_node\n # assign value of new node's next to nil\n new_node.next = nil\n end\n end",
"def add_last(data)\n current_node = @head\n\n if current_node == nil\n add_first(data)\n return\n end\n\n while current_node.next != nil\n current_node = current_node.next\n end\n\n current_node.next = Node.new(data, nil)\n end",
"def append(value)\n node = Node.new\n node.value = value\n if head.nil?\n @head = node\n else\n curr = head\n curr = curr.next until curr.next.nil?\n curr.next = node\n end\n head\n end",
"def add_last(data)\n new_node = Node.new(data)\n # Using add_first function to add new node in case the list is empty.\n if @head.nil?\n add_first(new_node.data)\n return \n end\n\n pointer = @head\n # Until we reach the last node\n until pointer.next.nil?\n # Move the pointer to the next.\n pointer = pointer.next\n end\n\n pointer.next = new_node\n new_node.next = nil\n end",
"def append(x)\n last_elem = self.tail\n if !empty?\n @tail = last_elem.append(x)\n else\n @head = ListElement.new(x)\n @tail = @head\n end\n end",
"def add_last(data)\n current = @head\n \n if current.nil?\n @head = Node.new(data)\n return\n end\n while !current.next.nil?\n current = current.next\n end\n current.next = Node.new(data)\n end",
"def add_last(value)\r\n \r\n # if list is empty, insert the new value at the head\r\n if @head.nil?\r\n @head = Node.new(value, nil)\r\n return @head\r\n end \r\n \r\n # otherwise, traverse the list from start to last node ...\r\n current = @head\r\n until current.next.nil?\r\n current = current.next\r\n end\r\n \r\n # ... and insert new node after last node\r\n current.next = Node.new(value, nil)\r\n \r\n end",
"def add_last(data)\n if @head.nil? \n @head = Node.new(data)\n else\n pointer = @head \n while !pointer.next.nil?\n pointer = pointer.next\n end\n pointer.next = Node.new(data)\n end\n end",
"def add_last(data)\n\n if head.nil?\n add_first(data)\n return\n end\n \n node = head\n until node.next.nil?\n node = node.next\n end\n \n node.next = Node.new(data)\n end",
"def add_node(n)\n @nodes.push n unless @nodes.include? n\n end",
"def append(other)\n self.last_sibling.add_sibling(other)\n end",
"def add_at_tail(val)\n if @llist\n node = @llist\n while node.next_node\n node = list.next_node\n end\n node.add_next_node Node.new(val)\n else\n add_at_head(val)\n end\n end"
] | [
"0.8177517",
"0.7799696",
"0.7706505",
"0.7628306",
"0.7623762",
"0.76045775",
"0.7581344",
"0.7519248",
"0.75068057",
"0.74191725",
"0.7396706",
"0.73656386",
"0.73631907",
"0.734137",
"0.7337335",
"0.7333959",
"0.7277202",
"0.7270262",
"0.72676307",
"0.72648823",
"0.7257583",
"0.72553647",
"0.72491217",
"0.7207575",
"0.7205825",
"0.71969444",
"0.71767956",
"0.7159201",
"0.7146194",
"0.71340555",
"0.7134035",
"0.71231943",
"0.7121456",
"0.7118695",
"0.71134055",
"0.7111837",
"0.71091086",
"0.71067184",
"0.7106229",
"0.7097766",
"0.7091766",
"0.70870405",
"0.70828164",
"0.7080671",
"0.7073231",
"0.7060869",
"0.70606816",
"0.7056248",
"0.70513374",
"0.70505935",
"0.70499367",
"0.70383334",
"0.70364374",
"0.70293623",
"0.70293623",
"0.70293623",
"0.70259625",
"0.7023098",
"0.701674",
"0.701674",
"0.7016155",
"0.7009",
"0.7005673",
"0.6988532",
"0.6987034",
"0.69668424",
"0.6962442",
"0.695741",
"0.6955401",
"0.69536287",
"0.695232",
"0.694531",
"0.69437176",
"0.6942902",
"0.69403315",
"0.6923681",
"0.69210833",
"0.69067085",
"0.68672496",
"0.6846491",
"0.6837483",
"0.68324804",
"0.68245125",
"0.68164027",
"0.6816375",
"0.68003476",
"0.6794519",
"0.6782537",
"0.6781147",
"0.6780607",
"0.6771975",
"0.6752623",
"0.67412335",
"0.67306507",
"0.6730358",
"0.67282826",
"0.67169195",
"0.66932184",
"0.6685157",
"0.6682927"
] | 0.75659466 | 7 |
A callback that is invoked when an item is removed from the list. | def removed(node)
@size -= 1
return node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(list, item_removed)\n list.delete(item_removed)\nend",
"def remove_item(list, item_remove)\n list.delete(item_remove)\nend",
"def remove_an_item(list, item)\n #method to remove item\n list.delete(item)\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item (list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item(list, item)\n list.delete(item)\nend",
"def remove_item\n\n end",
"def del_item(list, item_to_del)\n list.delete(item_to_del)\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\nend",
"def remove_item(item, list)\n list.delete(item)\nend",
"def remove_item(list, item)\n\tlist.delete(item)\nend",
"def remove_item(item)\n index = @list.index(item)\n remove_item_at(index)\n end",
"def remove_item(item_list, item)\r\n item_list.delete(item)\r\n item_list\r\nend",
"def remove_item(list,item)\n\tlist.delete(item)\nend",
"def remove (list, item)\n\tlist.delete(item)\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list_items, item_name)\n list_items.delete(item_name)\nend",
"def remove_item(new_list, item_name)\r\n new_list.delete(item_name)\r\nend",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def remove_item(list, item)\n list.delete(item)\n list\nend",
"def remove!\n self.class.removed(item)\n end",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove(list, item)\n\tlist.delete(item)\nend",
"def remove_item(list,item)\r\n\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item)\n list.delete(item)\n return list\nend",
"def remove_an_item(grocery_list, item_to_be_removed)\n grocery_list.delete(item_to_be_removed)\n grocery_list\nend",
"def remove_from_list(list, item)\n\tlist.delete(item)\nend",
"def remove_item(groceries_list, item_to_remove)\n\t# remove item from list\n\tgroceries_list.delete(item_to_remove)\n\t# return updated list\n\tgroceries_list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list,item)\n\tlist.delete(item)\n\tp list\nend",
"def remove(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def remove_item(list, item)\r\n list.delete(item)\r\n p list\r\nend",
"def remove_item(list,item)\n list.delete(item)\n p list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tp list\nend",
"def remove_item(new_list, item)\n \n new_list.delete(item)\n \n new_list\nend",
"def remove(list, item_name)\n\tlist.delete(item_name)\nend",
"def remove_item(list, item)\r\n\tlist.delete(item)\r\n\treturn list\r\nend",
"def remove_item(list, item)\r\n# input: item to be removed, list\r\n# steps: \r\n # check if item exists\r\n # remove item\r\n list.delete(item)\r\n # print success message of item removed\r\n puts \"#{item.upcase} has been removed to your grocery list!\"\r\n p list\r\n# output: updated list\r\nend",
"def remove_item(list, food)\n list.delete(food)\nend",
"def remove_item(list, item_to_be_removed)\n # if list.has_key? item_to_be_removed\n # list.delete(item_to_be_removed)\n # end\n list.delete(item_to_be_removed) if list.has_key? item_to_be_removed\n list\nend",
"def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend",
"def remove_item(item)\n # raises WrongListException if item.list != self\n # TODO\n end",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend",
"def remove(input_list, item)\n input_list.delete(item)\nend",
"def delete_item(item)\r\n @list.delete(item)\r\n end",
"def remove_item(item, list)\n list.delete(item)\n return list\nend",
"def remove_item (item, list)\n list.delete(item)\n return list\nend",
"def remove(final_list, item)\r\n final_list.delete(item)\r\n end",
"def remove_item(list, item_name)\r\n # list.delete_if { |item, amount| item == item_name }\r\n list.delete(item_name)\r\nend",
"def remove(list, item_name)\r\n\tlist.delete(item_name)\r\n\tp list\r\nend",
"def remove_item (item,list)\nlist.delete(item)\nlist\nend",
"def remove(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_item(grocery_list, item)\r\n grocery_list.delete(item) \r\n \r\nend",
"def remove(grocery_list, item)\n grocery_list.delete(item)\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def remove_item(shopping_list, item)\r\n\r\n\tshopping_list.delete(item)\r\n\r\nend",
"def remove_item(item, list)\n\tlist.delete_if do |i|\n\t\ti == item \n\tend\nend",
"def delete_item(list, item)\n list.delete(item)\nend",
"def remove_item(shopping_list, item)\n shopping_list.delete(item)\nend",
"def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend",
"def remove_item(item)\n $grocery_list.delete(item)\n # puts \"List with #{item} deleted\"\n $grocery_list\nend",
"def remove_item(item)\n\t$grocery_list.delete(item)\n\tp \"You crossed off #{item} from your list.\"\nend",
"def remove_item(list_item,user_list)\n user_list.delete(list_item)\n user_list\nend",
"def remove_from_list(item,list)\n list.delete(item)\nend",
"def remove_from_list(list, item)\n list.delete(item)\n p list\nend",
"def remove_item(list, removeitem)\n\t# input: existing list, item name\n\t# output: updated list\n\n\tmatch_index = find_item(list, removeitem)\n\t# alert if not found\n\tif not match_index\n\t\tmsg = \"\\n\\n** WARNING remove_item failure: item \\\"#{removeitem}\\\" \"\n\t\tmsg += \"not found in list. List unchanged **\"\n\t\treturn list\n\telse\t\t\t\n\t\tlist.delete_at(match_index)\n\t\tputs \"\\n\\nList updated: item '#{removeitem}' removed from list.\\n\"\n\t\tprint_list(list) if print\n\t\treturn list\n\tend\n\t# return updated list\n\t\nend",
"def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend",
"def delete_item(list,item)\n list.delete(item)\nend",
"def delete_item(list,item)\n list.delete(item)\nend",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def remove_item_from_list(grocery_list, item) \n grocery_list.delete(item) \n grocery_list \nend",
"def delete_item(list_item)\n @list.delete(list_item)\n @list\n end",
"def onDeleted(item)\n @object.deleted(import(item))\n end",
"def remove_item!(list, item)\r\n list.delete(item)\r\n list\r\nend",
"def delete_item(list, item)\n\tdel_list = list.delete(item)\nend",
"def delete_item(list, item)\n del_list = list.delete(item)\nend",
"def grocery_item_deleter(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def remove_item_from_list(list,item)\r\n list.delete(item)\r\n print_list(list)\r\nend",
"def on_remove(&block)\n @onRemoveBlock = block\n end",
"def remove_item(item, list)\r\n list.delete(item)\r\n p list\r\n list\r\nend",
"def remove_list(older_list, item)\r\n older_list.delete(item)\r\n return older_list\r\nend"
] | [
"0.76671064",
"0.7247406",
"0.7173165",
"0.7161813",
"0.7143181",
"0.71277976",
"0.71241826",
"0.7123011",
"0.7123011",
"0.7080409",
"0.7015575",
"0.7014446",
"0.7004985",
"0.7004259",
"0.6973761",
"0.6966492",
"0.6960967",
"0.6939578",
"0.6937549",
"0.693241",
"0.6917282",
"0.6916976",
"0.69042826",
"0.69042826",
"0.68935853",
"0.68935853",
"0.68935853",
"0.68935853",
"0.6881702",
"0.68692285",
"0.6850198",
"0.6849299",
"0.6848234",
"0.68436694",
"0.6825295",
"0.6810535",
"0.6809041",
"0.68090004",
"0.68090004",
"0.6793523",
"0.6772972",
"0.67707974",
"0.67598987",
"0.6756922",
"0.6756922",
"0.6756922",
"0.67555153",
"0.675347",
"0.6740199",
"0.67309994",
"0.6722043",
"0.67142755",
"0.67139417",
"0.671144",
"0.67066526",
"0.6706508",
"0.6706334",
"0.67061096",
"0.6704945",
"0.66940683",
"0.66940683",
"0.66940683",
"0.6689334",
"0.6689192",
"0.6674306",
"0.66608083",
"0.66605216",
"0.6653778",
"0.66459554",
"0.6637894",
"0.66363543",
"0.6632575",
"0.6627493",
"0.66160095",
"0.66160095",
"0.6613097",
"0.66124755",
"0.6605543",
"0.66023076",
"0.658568",
"0.6583315",
"0.658165",
"0.65729505",
"0.65725917",
"0.65677106",
"0.6565141",
"0.65635943",
"0.6561006",
"0.6561006",
"0.6553646",
"0.6536936",
"0.65345275",
"0.65283096",
"0.65281355",
"0.6518588",
"0.6518058",
"0.6516526",
"0.6488107",
"0.6487287",
"0.648213",
"0.6473887"
] | 0.0 | -1 |
Remove the node if it is in a list. You should be careful to only remove nodes that are part of this list. | def remove?(node)
if node.head
return remove!(node)
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_list_position(nil)\n end\n end",
"def remove_from_list(list)\n li = Fl::Framework::List::ListItem.query_for_listable_in_list(self, list).first\n if li.nil?\n false\n else\n self.listable_containers.delete(li)\n true\n end\n end",
"def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end",
"def remove(node)\n end",
"def delete(node)\n if [email protected]?\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else # iterate over the list\n current_node = @head\n while !current_node.nil? && current_node.next != node\n current_node = current_node.next #move to the next node\n end\n if current_node.next == node\n current_node.next = current_node.next.next # skip over the matched node and thereby reset current_node's next node.\n end\n end\n end\n end",
"def remove_from_list\n if in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_my_position nil\n end",
"def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end",
"def delete(node)\n if @tail == node # if node is tail (or also, where list of 1)\n remove_tail\n elsif @head == node # remove head\n @head = @head.next\n else # remove a middle node\n current_node = @head\n while current_node.next != node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end",
"def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end",
"def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend",
"def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend",
"def remove_node_if\n #_clear_cache #done in clear_node(node)\n all = self.nodes\n all.each do |node|\n if yield node then\n self.clear_node(node)\n @pathway.graph.delete(node)\n end\n end\n self\n end",
"def remove_at(index)\n\t return false if @head.nil? || index > self.size \n\n\t if self.size == 1 || index == self.size #only one node or the last one\n\t self.pop \n\t elsif index == 1 # first node in the list: shift\n\t\t @head = @head.next\n\t else\t\n\t temp_node = self.at(index)\n\t node_ant\t= self.at(index-1)\n\t node_ant.next = temp_node.next\n\t temp_node.next = nil\n end\n return true\t \n\tend",
"def delete(node)\n current_node = self.head.next\n last_node = self.head\n\n if self.head == node\n self.head = self.head.next \n else\n while current_node != nil # Runs through each node in the list.\n if current_node == node # Checks for node to be deleted.\n if current_node == self.tail\n self.tail = last_node\n end\n last_node.next = current_node.next\n end\n last_node = current_node\n current_node = current_node.next\n end\n end\n end",
"def remove(x)\n if x == head\n self.head = head.next\n x.next = nil\n else\n\n el = head\n while el and el != x\n prev = el \n el = el.next\n end\n\n raise ListError, \"Element not found\" unless el\n\n prev.next = el.next\n el.next = nil\n end\n x\n end",
"def remove_from_list(list_name, lead_or_idnum, options={})\n list_operation(list_name, \"REMOVEFROMLIST\", lead_or_idnum, options)\n end",
"def node_remove(node)\n return unless node_present? node\n nodes.delete prepare_key(node)\n end",
"def delete(node)\n examined_node = @head\n after_examined_node = @head.next\n\n if examined_node == node #to be deleted item is first on the list\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n\n while examined_node != node\n before_examined_node = examined_node\n\n if examined_node.next == nil\n\n else\n\n examined_node = examined_node.next\n end\n after_examined_node = examined_node.next\n\n if examined_node == node\n temp = before_examined_node\n before_examined_node.next = after_examined_node\n end\n end\n end\n end",
"def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\ttmp = self.head\n\t\t\twhile tmp && tmp.next != node\n\t\t\t\ttmp = tmp.next\n\t\t\tend\n\t\t\ttmp.next = node.next if tmp\n\t\tend\n\t\tself.length -= 1\n\tend",
"def delete(node)\n if node == self.head\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n node.next = nil\n return node\n end\n self.head = node.next\n node.next = nil\n return node\n end\n \n self.print\n \n node1 = self.head\n until node1.next == node do\n if node1.next == nil\n return nil # not on the list\n end\n node1 = node1.next\n end\n \n node1.next = node.next\n if node == self.tail\n self.tail = node1\n end\n\n node.next = nil\n return node\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end",
"def remove_node\n remove_node_helper(@root)\n end",
"def remove(node)\n # Traverse looking for the node\n sets = []\n prev_link = nil\n each_link do |link|\n if link[:ref_id] == node.id\n sets << [prev_link, link]\n next # in case adjacent removal node links\n end\n prev_link = link\n end\n # Now we can just do the join and we're out\n sets.each do |prev_link, the_link|\n if prev_link\n prev_link[:next_id] = the_link[:next_id]\n else\n self[:head_id] = the_link[:next_id]\n end\n # Mark removal\n element_removed!\n end\n # Return the node if any were removed\n node unless sets.empty?\n end",
"def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend",
"def del_access_node(node)\n puts \"Deleting Node with value: #{node.value} from the list\"\n if node.next != nil\n node.value = node.next.value\n node.next = node.next.next\n else\n node.value = nil\n end\n print\n end",
"def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\tp = node.prev\n\t\t\tn = node.next\n\t\t\tp&.next = n\n\t\t\tn&.prev = p\n\t\tend\n\t\tself.length -= 1\n\tend",
"def remove_node(node)\n\t\t\tif has_node?(node)\n\t\t\t\tpull_edges_of(node)\n\t\t\t\[email protected](node)\n\t\t\t\t@order -= 1\n\t\t\tend\n\t\t\tself\n\t\tend",
"def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\[email protected] = nil || element.next\n\t\t\telement\n\t\tend",
"def delete(node)\n if self.head == node\n remove_front\n elsif self.tail == node\n remove_tail\n else\n current_node = self.head\n until current_node.next == node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end",
"def delete(node)\n if self.head == node\n remove_front\n elsif self.tail == node\n remove_tail\n else\n current = self.head\n while current.next != node\n current = current.next\n end\n current.next = node.next\n node.next = nil\n end\n end",
"def remove_node(node) \n case node\n when @tail\n remove_tail\n when @head\n # this is a good candidate for a helper method!\n @head = node.next_node\n @head.prev_node = nil unless @head.nil?\n @tail = @head if @head.nil? || @head.next_node.nil?\n else\n node.prev_node.next_node = node.next_node unless node.prev_node.nil?\n node.next_node.prev_node = node.prev_node unless node.next_node.nil?\n end\n \n node\n end",
"def delete_node(list, head)\n curr = list\n while(curr.next.val != head.val)\n curr = curr.next\n end\n curr.next = head.next\n head = nil\nend",
"def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end",
"def remove_node(node)\n @nodes_being_worked_on.delete(node)\n @nodes.delete(node)\n # the last edge keeps getting ignored when you remove this, so handling the final case\n assign_node(@edges[0][1]) if @edges.size == 1\n @edges.reject! { |edge| edge.include?(node) }\n end",
"def delete(node)\n if self.head.data == node.data\n self.remove_front\n else\n temp = self.head\n while temp && (temp.next.data != node.data)\n temp = temp.next\n end\n target = temp.next\n temp.next = target.next\n if temp.next == nil\n self.tail = temp\n end\n end\n end",
"def remove_tail\n if self.head == nil\n p \"There isn't anything in the linked list\"\n elsif self.head.data == self.tail.data\n self.head = nil\n self.tail = nil\n else\n temp_node = self.head\n while temp_node.next != self.tail\n temp_node = temp_node.next\n end\n self.tail = temp_node\n end\n end",
"def delete(node)\n if self.head != nil\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n current = self.head\n while current.next != nil && current.next != node\n current = current.next\n end\n temp = current.next.next\n current.next = nil\n current.next = temp\n end\n end\n end",
"def delete(node)\n if node == self.head\n remove_front\n elsif node == self.tail\n remove_tail\n else\n last_node = self.head\n current_node = self.head.next\n while current_node != node\n if current_node == self.tail\n return nil\n else\n last_node = current_node\n current_node = current_node.next\n end\n end\n last_node.next = current_node.next\n end\n end",
"def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end",
"def delete(node)\n if @head != nil\n if @head === node\n remove_front\n elsif @tail === node\n remove_tail\n else\n current = @head\n while current != nil && current.next != node \n current = current.next\n end\n if current.next == node\n current.next = current.next.next\n end\n end\n end \n end",
"def delete(node)\n if @head == node\n remove_front\n elsif @tail == node\n remove_tail\n else\n remove_node(node)\n end\n end",
"def remove_node(node)\n return nil unless node\n previous_node = node.previous_node\n next_node = node.next_node\n previous_node.next_node = next_node if previous_node\n next_node.previous_node = previous_node if next_node\n self.head = node.next_node if node == head\n node\n end",
"def delete(node)\n if node == @head\n remove_front()\n elsif node == @tail\n remove_tail()\n else\n search_until(node)\n @current.next = node.next\n end\n end",
"def remove_item(item, list)\n\t# steps: delete the item if it exists\n\tlist.delete_if {|list_item| list_item == item.to_sym}\n\t# output: updated list\n\tlist\nend",
"def delete(node)\n if (node == @head)\n @head = node.next\n elsif (node == @tail)\n self.remove_tail\n else\n current = @head\n while (current != node)\n if (current.next == node)\n current.next = node.next\n break\n end\n current = current.next\n end\n end\n end",
"def delete_node this_node\r\n prev_node = this_node.get_prev_node\r\n next_node = this_node.get_next_node\r\n #if the deleted node is currently at the head\r\n if @head == this_node\r\n #set the head to the next node of this node\r\n @head = next_node\r\n #the head will be set to NULL if there's no node after this node (if this node is the only node in the list)\r\n end\r\n #if there's a node before this deleted node\r\n if prev_node != nil\r\n #point the next pointer of the previous node (of the deleted node) to the next node (of the deleted node)\r\n prev_node.set_next_node next_node\r\n end\r\n #if there's a node after this deleted node\r\n if next_node != nil\r\n #point the prev pointer of the next node (of the deleted node) to the previous node (of the deleted node)\r\n next_node.set_prev_node prev_node\r\n end\r\n #OPTIONAL: if the deleted node is at the tail\r\n if @tail == this_node\r\n #update the tail by pointing it to the previous node (of the deleted node)\r\n #this will return NULL if the deleted node is the only node in the list\r\n @tail = prev_node\r\n end\r\n #You can return the list so that you can chain methods\r\n return self\r\n end",
"def remove_node\n cspsearchpath.delete(@label)\n end",
"def delete(node)\n if @head.eql?(node)\n remove_front\n elsif @tail == node\n remove_tail\n else\n current = @head\n until current.next.eql?(node)\n current = current.next\n end\n current.next = node.next\n end\n end",
"def delete(node)\n if @head.data == node.data\n remove_front\n elsif @tail.data == node.data\n remove_tail\n else\n previousNode = @head\n placeholder = @head.next\n while placeholder.data != node.data\n if placeholder.next\n previousNode = placeholder\n placeholder = placeholder.next\n else\n return 'node not found'\n end\n end\n previousNode.next = placeholder.next\n end\n end",
"def pop\n return if list == nil\n\n lastElem = nil\n if list.nextNode == nil\n lastElem = list\n @list = nil\n else\n node = @list\n while (node != nil)\n if (node.nextNode != nil && node.nextNode.nextNode == nil)\n lastElem = node.nextNode\n node.nextNode = nil\n break\n end\n node = node.nextNode\n end\n end\n lastElem\n end",
"def delete(node)\n remove_node(node)\n end",
"def remove(value)\n if self.include?(value)\n if head.data == value\n remove_head(value, head)\n else\n remove_value(value, head)\n end\n else\n return nil\n end\n end",
"def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end",
"def unlink \n @lnode.unlink unless @lnode.nil?\n end",
"def delete(node)\n current = self.head\n if current == node\n self.head = current.next\n return\n else\n while current.next != nil && current.next != node\n current = current.next\n end\n current.next = current.next.next unless current.next === nil\n while current.next != nil\n current = current.next\n end\n self.tail = current\n end\n end",
"def remove(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end",
"def delete(node)\n if node.data == self.head.data\n remove_front\n elsif node.data == self.tail.data\n remove_tail\n else\n current_node = self.head\n prev_node = nil\n\n until current_node.data == node.data\n prev_node = current_node\n current_node = current_node.next\n end\n\n prev_node.next = current_node.next\n current_node.next = nil\n\n return current_node\n end\n end",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def delete(node)\n removed = nil\n if node == @head\n removed = @head\n node = @head.next\n @head = node\n elsif node == @tail\n removed = @tail\n current = @head\n until current.next == @tail\n current = current.next\n end\n @tail = current\n @tail.next = nil\n else\n current = @head\n until current.next == node\n current = current.next\n end\n link_1 = current\n until current == node\n current = current.next\n end\n link_2 = current.next\n removed = current\n link_1.next = link_2\n end\n removed\n end",
"def remove_tail\n if @head\n node_being_chkd = @head\n while node_being_chkd && (node_being_chkd.next != @tail)\n node_being_chkd = node_being_chkd.next\n end\n @tail = node_being_chkd\n @tail.next = nil if @tail\n else\n nil\n end\n end",
"def delete(node)\n if node === @tail\n remove_tail\n return\n elsif node === @head\n remove_front\n return\n else\n current_node = @head\n while current_node.next != node\n current_node = current_node.next\n end\n current_node.next = node.next\n end\n end",
"def remove_item(item)\n # raises WrongListException if item.list != self\n # TODO\n end",
"def remove(target)\n return nil if target == nil || @head == nil\n @head = @head.next if @head == target\n prev_node = find do |item|\n item.next == target\n end\n prev_node.next = prev_node.next.next if prev_node\n end",
"def remove(target)\n @head = @head.next if @head == target\n prev = find() do |item| # prev set to the node right before the node we want to remove\n item.next == target\n end\n prev.next = prev.next.next if prev # set the node before's pointer to the target node's next thereby bypassing\n end",
"def remove!(node)\n super\n key_to_node.delete(node.key)\n self\n end",
"def remove list\n list_action list, \"remove\"\n end",
"def remove_item(list, list_item)\n if list.has_key?(list_item)\n list.delete(list_item)\n else\n puts \"Item is not in list\"\n end\n p list\n list\nend",
"def remove_from_list(item,list)\n list.delete(item)\nend",
"def remove_node(index)\n\n\t\t# Start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tprev_node = nil\n\n\t\t# crawl to the index position\n\t\twhile counter < index \n\t\t\tprev_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\t# Now perform removal (cutting out current_node)\n\t\tnext_node = current_node.next\n\t\tcurrent_node.next = nil # clear the pointer\n\t\tprev_node.next = new_node\n\n\t\tputs \"Removed node at index #{index} with value: #{current_node.data}\"\n\tend",
"def remove(node)\n node = node.name if Node === node\n riak_admin 'remove', node\n end",
"def delete_node?(mid_node)\n return false if (mid_node == nil || mid_node.next == nil)\n\n # **** Important ***\n # The problem can't be solved if the given node is the last node of\n # ll.\n next_node = mid_node.next\n mid_node.data = next_node.data\n mid_node.next = next_node.next\n return true\nend",
"def remove(node)\n if link = Likewise::Link.find_by_id(key_for(node))\n remove_link(link)\n element_removed!\n element_decremented!(link[:weight])\n end\n node.context = link\n node\n end",
"def remove(node)\n if node.parent.nil?\n @root = nil\n return\n end\n if node.parent.left == node\n node.parent.left = nil\n elsif node.parent.right == node\n node.parent.right = nil\n end\n end",
"def remove_from_list(list_id, lead)\n list_operation(list_id_key(list_id), ListOperationType::REMOVE_FROM, lead.id)[:success_list_operation][:result][:success]\n end",
"def remove(value)\n if head.value == value\n @head = head.next\n else\n current_node = head.next\n prev_node = head\n while current_node\n if current_node.value == value\n prev_node.next = current_node.next\n return\n else\n prev_node = current_node\n current_node = current_node.next\n end\n end\n nil\n end\n end",
"def remove_tail\n remove_node(@tail)\n end",
"def remove_from_list_resource\n manage_list_resource(:remove)\n end",
"def delete_elem(data)\n\t\tcurr = @head\n\t\tprev = nil\n\t\twhile curr != nil do\n\t\t\tprev = curr\n\t\t\tif curr.data == data then\n\t\t\t\tprev.next_node = curr.next_node\n\t\t\t\treturn true\n\t\t\tend\n\t\t\tcurr = curr.next_node\n\t\tend\n\t\treturn false\n\tend",
"def remove_tail\n\n current_node = @head\n if @head == nil #empty lit\n return nil\n end\n if @head.next == nil #list of one\n temp = @head\n @head = nil\n @tail = nil\n return temp\n end\n while(current_node.next.next) #to traverse the list\n current_node = current_node.next\n end\n temp_two = current_node.next\n current_node.next = nil\n @tail = current_node\n return temp_two\n end",
"def delete_node\n node.destroy if node\n end",
"def remove_forced(data, _current_node = nil)\n current_node = find(data)\n parent = parent_node(data)\n parent.left = nil if parent.left && parent.left == ObjectSpace._id2ref(current_node.object_id)\n parent.right = nil if parent.right && parent.right == ObjectSpace._id2ref(current_node.object_id)\n end",
"def remove_item(list, item)\n\tlist.delete(item)\n\tlist\nend",
"def remove(list,item)\r\n\tlist.delete(item)\r\n\tlist\r\nend",
"def deletelist\n if @head == nil\n puts \"List deleted\"\n end\n\n tmp = @head\n while(@head != nil)\n tmp = tmp.next\n @head.next = nil\n @head = tmp\n end\n end",
"def remove_from_list(list, item)\n\tlist.delete(item)\nend",
"def remove(identifier)\n # we want to set the previous next as the current next so that the\n # current is forgotten from the list\n find(identifier) do |previous, current|\n if current == @first_node\n @first_node = current.next\n end\n\n previous.next = current.next\n end\n end",
"def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def list_remover(list,item) #takes 2 arguments, 1 list and name of an item\n\tlist.delete(item)\t\n\t\nend",
"def delete_node(current_node)\n\nend",
"def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end",
"def remove_item(item, list)\n\tlist.delete_if do |i|\n\t\ti == item \n\tend\nend",
"def delete(value)\r\n \r\n current = @head\r\n \r\n # if list is empty\r\n if current.nil?\r\n return\r\n end\r\n \r\n # if value is at head\r\n if current.data == value\r\n @head = current.next\r\n end\r\n \r\n # traverse list for matching value. stop when we find a match or get past the final node\r\n until current.nil? || current.data == value\r\n # if value isn't in the list, stop\r\n if current.next.nil?\r\n return\r\n # if the value matches our target value, make previous node point to node after current node\r\n elsif current.next.data == value\r\n current.next = current.next.next\r\n end\r\n current = current.next\r\n end\r\n \r\n end",
"def e31_delete(node, input)\n while node.next != nil\n if node.value == input\n node.value = node.next.value\n node.next = node.next.next\n else\n node = node.next\n end\n end #while ends\n end",
"def remove_node(head, val)\n current = head\n until current.next_node.nil?\n if head.val == val\n current.next_node = current.next_node.next_node\n end\n\n current = current.next_node\n end\n\n head\nend",
"def delete(data)\n node = find(data)\n if !node.nil?\n remove(node)\n end\n end",
"def remove(list, food_item)\n\tlist.delete(food_item)\n\tlist\nend",
"def remove(target)\n\t\tif (!@head) then return false end\n\t\tcurrent = @head\n\t\twhile (current)\n\t\t\tif (current.get_item() == target) then break end\n\t\t\tcurrent = current.get_next()\n\t\tend\n\t\t#special cases\n\t\tif (!current) then return false end\n\t\tif (current == @head) then @head = @head.get_next() end\n\t\tif (current == @tail) then @tail = @tail.get_prev() end\n\t\t\n\t\t#update pointers\n\t\tif (current.get_prev()) then current.get_prev.set_next(current.get_next()) end\n\t\tif (current.get_next()) then current.get_next.set_prev(current.get_prev()) end\n\t\t\n\t\t@size -= 1\n\t\treturn current.get_item()\n\tend"
] | [
"0.6642302",
"0.6596331",
"0.64553654",
"0.6414349",
"0.63419306",
"0.63090044",
"0.62986803",
"0.62652946",
"0.62407154",
"0.617381",
"0.61465704",
"0.60795605",
"0.6079463",
"0.6073038",
"0.60277075",
"0.60013115",
"0.594602",
"0.59304744",
"0.5924987",
"0.5914537",
"0.5893958",
"0.5893734",
"0.5856345",
"0.5830276",
"0.5816747",
"0.5812885",
"0.57933176",
"0.5770117",
"0.5761151",
"0.575641",
"0.57410043",
"0.57408375",
"0.57374334",
"0.57346034",
"0.57202256",
"0.5716018",
"0.57107025",
"0.5707985",
"0.5704239",
"0.5696731",
"0.56941754",
"0.56899524",
"0.56778777",
"0.5675009",
"0.5657542",
"0.56514966",
"0.5643259",
"0.56360716",
"0.5632037",
"0.56104547",
"0.5595953",
"0.55950207",
"0.55773187",
"0.55721813",
"0.55683327",
"0.5552159",
"0.5551346",
"0.55501515",
"0.5549346",
"0.5537158",
"0.5530429",
"0.5524972",
"0.5522518",
"0.552071",
"0.5519237",
"0.55179256",
"0.5516196",
"0.5513174",
"0.55044013",
"0.548134",
"0.54685336",
"0.5466346",
"0.5438618",
"0.5430598",
"0.5430564",
"0.54287314",
"0.5426041",
"0.54242146",
"0.5414269",
"0.5404374",
"0.53986984",
"0.53906465",
"0.5381056",
"0.5373592",
"0.53622055",
"0.53606355",
"0.5360092",
"0.53578913",
"0.5351733",
"0.53422385",
"0.5336904",
"0.5335125",
"0.5324769",
"0.53234816",
"0.53234106",
"0.5323079",
"0.5313982",
"0.53134096",
"0.5311643",
"0.53100073"
] | 0.689051 | 0 |
Determine whether the given node is included in the list. | def include?(needle)
self.each do |item|
return true if needle.equal?(item)
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(el)\n list.include?(el)\n end",
"def include?(node)\n @pathway.graph[node] ? true : false\n end",
"def include?(element)\n @element_list.include? element\n end",
"def includes?(data)\n node = @head\n include_array = []\n until node.nil?\n include_array << node.data\n node = node.next_node\n end\n include_array.include?(data)\n end",
"def contains_node?(node)\n self.any? { |arr| arr.include?(node.id)}\n end",
"def include?(aNode)\n key2node.include?(aNode)\n end",
"def includes?(data)\n list.includes?(data)\n end",
"def include?(value)\n element.include? value\n end",
"def include?(elem)\n @elements.include?(elem)\n end",
"def include?(element)\n @elements.include? element\n end",
"def include?(key)\n current = @head\n while current.next_node != nil\n return true if current.value == key\n current = current.next_node\n end\n\n return true if current.value == key\n\n false\n end",
"def include? item\n @succ.include? item\n end",
"def include?(item)\n return true\n end",
"def include?(element)\n @ary.include? element\n end",
"def include?(item)\n end",
"def include?(el)\n store.include?(el)\n end",
"def include?(item)\n return false if item.nil?\n return true\n end",
"def contains(node)\n return !(@nodes[node] == nil)\n end",
"def include?(item)\n ! get(item).nil?\n end",
"def xinclude_start?\n node_type == XINCLUDE_START\n end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(item)\n return item != nil\n end",
"def include?(item)\n self.__contains__(item).rubify\n end",
"def include?(entry)\n entries.include?(entry)\n end",
"def include?(element)\n !find_element(element).nil?\n end",
"def include?(score) \n if @root_node.nil?\n false\n else\n @root_node.include?(score)\n end\nend",
"def include?(element)\n @que.include?(element)\n end",
"def include?(value)\n return false if root.nil?\n !!root.search_for(value)\n end",
"def include?(list, search)\n return false if list.empty? && search == nil \n list.find { |elem| elem == search } == search ? true : false\nend",
"def include? item\n return index_of(item) != nil\n end",
"def include?(other)\n `#{@el}.contains(#{DOM::NODE.get_element(other)})` || other == self\n end",
"def has_node?(node)\n has_node_with_name?(node.name)\n end",
"def is_included_in?(skill)\n\t\tskill.includes.each do |inc|\n\t\t\tif inc.to_s == @skill.to_s\n\t\t\t\tskill_inc = NERO_Skill.lookup(inc)\n\t\t\t\tif !skill_inc.is_a? NERO_Skill\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tif skill_inc.limit == 1\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\tend\n\t\t\trecurse = NERO_Skill.lookup(inc)\n\t\t\tif recurse.is_a?(NERO_Skill) and self.is_included_in?(recurse)\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend",
"def include?(el)\n @cache.include?(el)\n end",
"def include? entity, user_or_id, with_pullins=true\n # Trivial accept if the entity is physically in among the list items\n return true if @list.stores? entity\n user_id = user_or_id.is_a?(Integer) ? user_or_id : user_or_id.id\n ts = TaggingServices.new entity\n # It's included if the owner or this user has tagged it with the name tag\n return true if ts.exists? @list.name_tag_id, (user_id == @list.owner_id ? user_id : [user_id, @list.owner_id])\n # If not directly tagged, it's included if it's tagged with any of the list's tags, BY ANYONE (?)\n return false unless with_pullins && @list.pullin\n ts.exists? pulled_tag_ids\n end",
"def contains list, item\n cur = list.head\n\n while cur != nil\n return true if cur.node == item\n cur = cur.nxt\n end\n\n return false\nend",
"def include?(item)\n @queue.include?(item)\n end",
"def has_node?(node)\n @node_map[node]\n end",
"def includes item\n msg = \"#{self} did not include #{item}\"\n check_if self.include?(item), msg\n end",
"def include?( object )\n has_node?( object ) ||\n has_edge?( object )\n end",
"def contains?(data)\n if @head == nil \n puts \"error: empty list\" \n end\n in_list = false\n current_node = @head\n while current_node != nil\n if current_node.value == data\n in_list = true\n end\n current_node = current_node.next_node\n end\n in_list\n end",
"def include?(item)\n return false if item.nil?\n return include_recipebook?(item) if item.recipebook?\n return false\n end",
"def logger_included?(node)\n return false if node.nil? || node.loc.nil?\n\n source = node.loc.expression.source\n # TODO: better check for the include call, this is a simple \"grep\"...\n !source.match(/include\\s+(Yast::|)Logger/).nil?\n end",
"def include?(elem)\n if elem.is_a? Liquor::Drop\n @source.include? elem.source\n else\n false\n end\n end",
"def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend",
"def scanned_node?(node)\n scanned_nodes.any? do |scanned_node|\n scanned_node.equal?(node)\n end\n end",
"def contains_node?(path)\n begin\n node(path)\n return true\n rescue ElementDoesntExist => e\n return false\n end\n end",
"def _is_in(token, list)\n return false unless list\n list.include?(token[1])\n end",
"def include?(name)\n includes?(name)\n end",
"def contains?(e, node = @head)\n return false if node.value == nil\n case e <=> node.value\n when -1 then return contains?(e, node.lchild)\n when 0 then return true\n when 1 then return contains?(e, node.rchild)\n end\n end",
"def in?(node)\n @stack.detect { |item| item.name == node.name }\n end",
"def scanned_node?(node); end",
"def contains?(given_value)\n self.traverse_list do |node|\n if node.value == given_value\n return true\n else\n return false\n end\n end\n end",
"def include_object?(object)\n if is_node?(object)\n @nodes.each { |node| return true if node == object }\n else\n @nodes.each { |node| return true if node.object == object }\n end\n\n false\n end",
"def contains?(element)\n self.each do |node| \n return true if node.value == element\n end\n return false\n end",
"def include?(arg)\n arg.is_a?(Module) ? !!included_modules.detect{ |m| m === arg } : store.include?(arg)\n end",
"def include?(*args_)\n _offset_for_args(args_) ? true : false\n end",
"def include?(value)\n each do |index, list_value|\n return true if list_value == value\n end\n return false\n end",
"def include?(arg0)\n end",
"def include?(value)\n return false if empty?\n splay(value)\n @root.value == value\n end",
"def contains?(value, node = @head)\n return false if node.nil?\n return true if node.value == value\n\n contains?(value, node.next_node)\n end",
"def include?(list,tst)\n list.each {|itm| return true if itm == tst}\n false\nend",
"def include?(fragment)\n @fragments.map(&:name).include?(fragment.name)\n end",
"def include?(key)\n # Ensure a Ruby true is returned\n item_exists(key) == true\n end",
"def include?(object)\n each {|item| return true if item == object }\n false\n end",
"def using_include(array, element)\n\tarray.include?(element)\nend",
"def haveNode?(name)\n lock\n read\n @inv.values.each { |nodes|\n if nodes.include?(name)\n unlock\n return true\n end\n }\n unlock\n false\n end",
"def includes?(participant)\n return participants.include?(participant)\n end",
"def includes?(participant)\n return participants.include?(participant)\n end",
"def includes?(participant)\n return participants.include?(participant)\n end",
"def include?(score)\n if self.root.nil?\n return false\n else\n recursive_include?(self.root, score)\n end\n end",
"def include?(data_to_find)\n exists = false\n if @head.nil?\n exists = false\n else\n exists = search(data_to_find, head)\n end\n return exists\n end",
"def include?(name)\n items.include?(coerce_name(name))\n end",
"def include?(member)\n `self.hasOwnProperty(member)`\n end",
"def included?\n @_included\n end",
"def node?\n any?(&:node?)\n end",
"def includes?(participant)\n participants.include?(participant)\n end",
"def node?\n node.present?\n end",
"def include?(item)\n ret = false\n @resources.each{ |rsc| ret = true if rsc == item }\n @authors.each{ |auth| ret = true if auth == item } unless ret \n ret\n end",
"def include?(query)\n query.chars.inject(root) do |node, c|\n node.edges[c] || break\n end\n end",
"def include?(name); end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def include?(something); end",
"def include_variable?\n @elements.any?{|elt| elt.include_variable?}\n end",
"def include?(file)\n @file_list.include?(file.basename)\n end",
"def included(descendant); end",
"def included(descendant); end",
"def exists(node)\n Arel::Nodes::Exists.new(node)\n end",
"def contains?(value)\n node = list\n while node != nil\n return true if node.value == value\n node = node.nextNode\n end\n return false\n end",
"def contains?(val,node=head)\n return nil if node.next == nil\n return true if node.data == val\n return contains?(val,node.next)\n end",
"def include?(*args)\n args.inject(true) {|val, x| val = self.single_include?(x)}\n end",
"def include?(item)\r\r\n item[:discovered]\r\r\n end",
"def include?(path)\n path_to_object(path) ? true : false\n end",
"def test_0210_includeq\n @@log.debug \"test_0210_includeq starts\" if @@log.debug?\n assert_respond_to(@list, :include?, \"test_0210_includeq_respond\")\n # Test does include\n assert(@list.include?(@bsb),\"test_0210_includeq_basic\")\n # Test does not include\n ta = Person.new(\"A\", \"B\", \"C\", 456)\n assert(@list.include?(ta) == false,\"test_0210_includeq_backwards\")\n\n @@log.debug \"test_0210_includeq ends\" if @@log.debug?\n end",
"def include? array, item\n array.include?(item)\nend",
"def include?(key)\n @item.key?(key)\n end"
] | [
"0.7507986",
"0.7331201",
"0.72192067",
"0.7134357",
"0.703894",
"0.70134133",
"0.68320674",
"0.6818113",
"0.6760324",
"0.6692242",
"0.65774333",
"0.6517273",
"0.64987206",
"0.6481585",
"0.64811957",
"0.646513",
"0.64596057",
"0.6453263",
"0.6388799",
"0.63333875",
"0.63314307",
"0.63311905",
"0.63311905",
"0.63311905",
"0.63311905",
"0.63311905",
"0.6326967",
"0.63007665",
"0.6300392",
"0.62931657",
"0.6280352",
"0.627486",
"0.62739694",
"0.625569",
"0.6244457",
"0.62155616",
"0.6204937",
"0.6192792",
"0.61788136",
"0.61701643",
"0.6146143",
"0.6143584",
"0.6143406",
"0.6140047",
"0.6124693",
"0.6110181",
"0.60938066",
"0.6068075",
"0.6062143",
"0.60582787",
"0.6055513",
"0.6053546",
"0.605247",
"0.6051151",
"0.60476184",
"0.6036722",
"0.5996623",
"0.5983865",
"0.59791875",
"0.5968935",
"0.59633094",
"0.59585744",
"0.5949331",
"0.5900449",
"0.58897537",
"0.5889683",
"0.58824635",
"0.58783644",
"0.5862936",
"0.58586526",
"0.5834822",
"0.5816185",
"0.58114684",
"0.58114684",
"0.58114684",
"0.58105814",
"0.58105165",
"0.58073676",
"0.5804357",
"0.5801768",
"0.57966727",
"0.5796293",
"0.57954514",
"0.57938117",
"0.57897514",
"0.5766393",
"0.5762963",
"0.57614547",
"0.57562363",
"0.575484",
"0.5754063",
"0.5754063",
"0.5743732",
"0.57371265",
"0.5734625",
"0.571873",
"0.57065105",
"0.56948787",
"0.5694202",
"0.56891245",
"0.56851983"
] | 0.0 | -1 |
def num_requests Request.where("receiver_id = ? AND accepted IS NULL", self.id).size end | def recommendations
User.where.not(id: self.friends).or(User.where.not(id: self.inverse_friends)).limit(5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_requests\r\n return @requests.length\r\n end",
"def number_requests\r\n\t\treturn @requests.length\r\n \tend",
"def count_of_associated_requests\n self.requests.functional.count\n end",
"def size()\n @requests.length\n end",
"def count_of_existing_requests_through_step\n req_ids = self.steps.map { |s| s.request_id }.compact.sort.uniq\n count = 0\n while (sub_req_ids = req_ids.slice!(0..(MAX_ITEMS_IN_IN_STATEMENT-1))).size > 0 do\n sub_req_models = Request.functional.find(:all, :conditions => {:id => sub_req_ids})\n count += (sub_req_models.blank? ? 0 : sub_req_models.count)\n end\n return count\n end",
"def pending_accept\n received_requests.where(confirmed: nil)\n end",
"def request_count; end",
"def submitted\n records.where(received: true).count\n end",
"def find_res_count\n res_count = 0\n self.listings.each do |listing|\n res_count += listing.reservations.where(:status => \"accepted\").count\n end\n return res_count\n end",
"def received_friend_requests\n Friendship.where(:reciever_uid => self.uid, :accepted => false)\nend",
"def all_request \n @no_of_leave=Leave.where(status:'Pending').size\n end",
"def message_count\n id = session[:userid]\n # sent_by_user = Status.filter(:owner_id => id).exclude(:recipient_id => nil).count # 1)\n # sent_to_user = Status.filter(:recipient_id => id).count\n # sent_by_user + sent_to_user\n \n # Using a single database query \n # http://sequel.rubyforge.org/rdoc/files/doc/dataset_filtering_rdoc.html => \"Using OR instead of AND\"\n Status.filter(:owner_id => id).exclude(:recipient_id => nil). # 2)\n or(:recipient_id => id).\n count\n end",
"def recieved_requests\n FriendshipRequest.where(\"requested_user_id = ?\", id)\n end",
"def queue_length\n request_queue.length\n end",
"def pending_request\n sent_requests.where(confirmed: nil)\n end",
"def received_friend_requests\n self.followers.where(\"friend_status = 'PENDING'\")\n end",
"def num_waiting\n @waiting.size\n end",
"def num_waiting\n @waiting.size\n end",
"def request_counter\n unfulfilled = Request.where(status: 0)\n fulfilled = Request.where(status: 1)\n if unfulfilled && fulfilled\n render json: {\n status: 'success',\n message: 'Your requests counter result',\n data: {\n unfulfilled: unfulfilled.length(),\n fulfilled: fulfilled.length()\n }\n },\n status: :ok\n else\n render status: :unprocessable_entity\n end\n end",
"def count_pending_actions\n # count actions pour navbar\n # les created dans le cas ou qqun a fait une résa sur ma pool\n # les accepted dans le cas ou j'ai fait une résa\n\n count = 0\n count += Booking.all.where('user_id = ? AND status = \"accepted\"', self.id).size unless @bookings.nil?\n\n Booking.all.each do |booking|\n count += 1 if booking.pool.user_id == self.id && booking.status == \"created\"\n end\n\n return count\n end",
"def prayer_requests_qty\n Rails.cache.fetch(\"prayer_requests-qty-#{id}\") do\n content_prayers.pending.count\n end\n end",
"def count_of_associated_request_templates\n self.requests.template.count\n end",
"def has_pending_requests?\n received_requests.pending.any?\n end",
"def sent_friend_requests\n Friendship.where(:sender_uid => self.uid, :accepted => false)\nend",
"def total_blocked\n (blocked_friend_ids + blocked_inverse_friend_ids + blocked_pending_inverse_friend_ids).count\n end",
"def num_answered_calls\n answered_contacts.count\n end",
"def get_counts\n #1 - @friend_count -> gets the number of current friends you have.\n @friend_count = current_user.active_friends.size\n \n #2 - @pending_count -> gets the number of pending friend requests you have.\n @pending_count = current_user.pending_friend_requests_to.map(&:friend).size\n end",
"def requestCount(book)\n\t\t@request = requests.find_by(\"book_id = ?\", book.id)\n\t\t\n\t\tif @request\n\t\t\[email protected]\n\t\telse\n\t\t\t0\n\t\tend\n\tend",
"def num_unread_messages\n return Message.where({:receiver_id => self.id, :read => false}).count\n end",
"def num_missed_calls\n missed_contacts.count\n end",
"def count_messages\r\n @messages.size\r\n end",
"def ask_count\n @asks.count\n end",
"def request_count=(_arg0); end",
"def waiting_size\n @waiting.size\n end",
"def new_messages_count\n new_messages = self.received_messages.where(:new_message => true)\n if new_messages\n return new_messages.size\n else\n return 0\n end\n end",
"def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end",
"def actual_received_count\n actual_messages.size\n end",
"def interested_users_count\n self.users.size\n end",
"def participants_size\n participants.size\n end",
"def pending_count\n @pendings.size\n end",
"def n_responses\n if Rails.configuration.comments_active then\n\t self.comments.count\n else\n 0\n end\n end",
"def approvals_count\n return 0 if self.id.nil?\n return RequestSearch.approvals_for(self, show: 'pending', per_page: 1000).count\n end",
"def how_much_more_work\n Effective::QbRequest.new_requests_for_unsynced_items.size\n end",
"def challenge_accepted_count\n self.challenges.where.not(status: \"pending\").order(updated_at: :desc).count\n end",
"def pending_count\n return @pending_count\n end",
"def count\n active_message_count || 0\n end",
"def request_size\n super || 0\n end",
"def requests_received\n friends = Friend.where(friend_id: params[:user_id], accepted: false)\n\t render json:friends\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def get_pending_requests\n r = Request.where(:assigned => self , :done => false).to_a\n return r\n end",
"def num_followers\n follower_ids = Following.where(:followed_id => self.id).pluck(:follower_id)\n follower_ids.size - 1 #don't count yourself\n end",
"def size\n retractions.size\n end",
"def limited_merge_requests_count\n @limited_merge_requests_count ||= merge_requests.limit(count_limit).count\n end",
"def pending_data_size\n get_outbound_data_size + @pending_size\n end",
"def get_no_of_users\n\t\tusers.select(:id).count\n\tend",
"def queued_messages\n @queue.length\n end",
"def request_size\n 2 + 2 + topic.length + 4 + 8 + 4\n end",
"def number_of_followers\n return_list_of_followers.size\n end",
"def total_friends\n self.invited(false).count + self.invited_by(false).count\n end",
"def unseen_memberships_count\n messages.watchable.unseen.group_by(&:membership_id).length\n end",
"def unsynchronized_size\n @available_connections.length + @checked_out_connections.length + @pending_connections.length\n end",
"def sent_friend_requests\n self.followed_users.where(\"friend_status = 'PENDING'\")\n end",
"def responses_count\n @responses_count ||= self.responses.visible.count || 0\n end",
"def hasRequest?\n !requests.empty?\n end",
"def pending_requests\n requests.keys\n end",
"def received_friends\n Friendship.where(:reciever_uid => self.uid, :accepted => true)\nend",
"def count_item\n count = 0\n @g_net.each do |followers|\n count += 1 unless !followers or followers.empty?\n end\n count\n end",
"def count(request_criteria)\n return if ::ServiceMock.disable_stubs\n yield self if block_given?\n JSON.parse(http.post('/__admin/requests/count', request_criteria).body)['count']\n end",
"def count\n MsgQ.count(@qid)\n end",
"def amountOfSubscribedEvents\r\n @subscribedEvents.length\r\n end",
"def queue_size(paypal_id)\n queue = @queue_map[paypal_id]\n if(queue.nil?)\n 0\n else\n queue.size\n end\n end",
"def friend_requests\n Friendship.where(friend_id: id, status: false)\n end",
"def number_of_followees\n return_list_of_followed_users.size\n end",
"def num_participants\n self.participants.count\n end",
"def num_participants\n self.participants.count\n end",
"def queued_messages\n @queue.length\n end",
"def invites_count\n Invite.with_survey(self).count\n end",
"def requests_sent\n friends = Friend.where(user_id: params[:user_id], accepted: false)\n\t render json:friends\n end",
"def count\n\t\[email protected]\n\tend",
"def subscriptions_count\n subscriptions.count\n end",
"def queue_count\n @queues.length\n end",
"def notification_count\n @notifications.size\n end",
"def length\n @queries.length\n end",
"def queue_count()\n @queue.length\n end",
"def message_count\n 0\n end",
"def pending_recieved_friend_requests\n friend_uids = []\n friend_uids = friend_uids + self.received_friend_requests.pluck(:sender_uid)\n return User.where(:uid => friend_uids)\nend",
"def subscriber_count\n subscribers.size\n end",
"def show\n @[email protected]\n @[email protected](status:\"accepted\").count\n end",
"def not_visitors_count\n self.not_visitors.count\n end",
"def size_without_waiters\n clients.inject(0) do |sum, element|\n sum += 1 unless element.waiting?\n sum\n end\n end",
"def call_site_count\n @call_sites.size\n end",
"def count_of_request_templates_through_steps\n req_ids = self.steps.map { |s| s.request_id }.compact.sort.uniq\n count = 0\n while (sub_req_ids = req_ids.slice!(0..(MAX_ITEMS_IN_IN_STATEMENT-1))).size > 0 do\n sub_req_models = Request.template.find(:all, :conditions => {:id => sub_req_ids})\n ids = sub_req_models.map{|my_req_template| my_req_template.request_template_id}.compact\n unarchived_templates = RequestTemplate.unarchived.extending(QueryHelper::WhereIn).where_in(\"id\", ids).all unless sub_req_models.blank?\n count += (unarchived_templates.blank? ? 0 : unarchived_templates.count)\n end\n return count\n end",
"def any_requested_booking_not_confirmed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if !booking.confirmed\n end\n true if count.positive?\n end",
"def count_user\n count = 0\n @f_net.each do |followees|\n count += 1 unless !followees or followees.empty?\n end\n count\n end",
"def count_meetings\n # TODO respond with xml, only if valid session, otherwise return nil\n team = Team.find_by_id( params[:id] )\n if team\n render json: team.meetings.collect{|row| row.id}.uniq.size\n else\n render json: 0\n end\n end",
"def counter_offer\n @request = Request.new\n @request.child_number = current_user.children.count\n end",
"def count_recipients\n count = 0\n @counters[:recipients].each_value { |cnt| count += cnt }\n count\n end",
"def pending_job_count\n\n @pending_jobs.size\n end",
"def known_ip_count\n @mutex.synchronize do\n @connections.size\n end\n end",
"def accepted_invites\n since = Time.zone.now - params[:days].to_i.days\n count = GroupInvitation.accepted\n .where('created_at > ?', since)\n .count\n respond_with json_response('accepted_invites', count)\n end"
] | [
"0.7588314",
"0.7424019",
"0.72864515",
"0.71836996",
"0.6893205",
"0.6787635",
"0.67735523",
"0.6525386",
"0.651995",
"0.65078735",
"0.64590865",
"0.6434623",
"0.6417707",
"0.63869584",
"0.6384158",
"0.63833857",
"0.6363117",
"0.6363117",
"0.6354333",
"0.63421285",
"0.63056934",
"0.6286283",
"0.62846965",
"0.62419933",
"0.6229953",
"0.6215274",
"0.6213655",
"0.6210859",
"0.61911935",
"0.61736774",
"0.61445105",
"0.61424214",
"0.6130845",
"0.61291206",
"0.61249065",
"0.6103646",
"0.6102729",
"0.60905045",
"0.60843915",
"0.6080913",
"0.6016168",
"0.6007774",
"0.5992605",
"0.5985231",
"0.5970119",
"0.59654874",
"0.59571874",
"0.5945863",
"0.5929276",
"0.5929276",
"0.59214664",
"0.59074783",
"0.5894722",
"0.5889843",
"0.588928",
"0.58891094",
"0.5862892",
"0.58604944",
"0.585446",
"0.5853103",
"0.58510125",
"0.58489215",
"0.58405334",
"0.5839691",
"0.5804206",
"0.57971734",
"0.5785209",
"0.5785054",
"0.57827324",
"0.5782099",
"0.5782031",
"0.57778156",
"0.5760061",
"0.575045",
"0.57469374",
"0.57469374",
"0.5745126",
"0.57375664",
"0.5732294",
"0.57314533",
"0.5730189",
"0.57296413",
"0.57246166",
"0.57182306",
"0.5715513",
"0.57130027",
"0.57048345",
"0.57037294",
"0.57032496",
"0.5696442",
"0.5694784",
"0.56897724",
"0.5686376",
"0.5684845",
"0.5681173",
"0.5679138",
"0.5668417",
"0.5666368",
"0.5664761",
"0.565087",
"0.5647029"
] | 0.0 | -1 |
should answered survey (merged with answers), which can be saved (send button) | def show # BROKEN layout
cookies.delete :journal_entry
@options = {:answers => true, :disabled => false, :action => "show"}
@journal_entry = JournalEntry.and_survey_answer.find(params[:id])
cookies[:journal_entry] = @journal_entry.id
@survey_answer = SurveyAnswer.and_answer_cells.find(@journal_entry.survey_answer_id)
@@surveys[@journal_entry.survey_id] ||= Survey.and_questions.find(@survey_answer.survey_id)
@survey = @@surveys[@journal_entry.survey_id]
@survey.merge_survey_answer(@survey_answer)
@page_title = "CBCL - Vis Svar: " << @survey.get_title
render :layout => 'survey' # :template => 'surveys/show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answer\n params[:answers].each do |question_id, value|\n answer = Answer.find_or_initialize_by_question_id_and_user_id(question_id, current_user.id)\n answer.content = value[:content]\n answer.save\n end if params[:answers]\n\n survey = Survey.find(params[:id])\n redirect_to survey.next_url || root_url, :notice => survey.confirmation\n end",
"def set_answers!(params)\n SurveyQuestion.with_question.find_all_by_survey_id(survey_id).each do |question| # iterate through all survey questions\n if params[question.id.to_s].blank? # if the question hasn't been answered\n remove_answer(question.id)\n else\n set_answer(question, params[question.id.to_s]) # save the answer\n end\n end\n save\n end",
"def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer\n\t\tanswer = MultipleChoiceAnswer.find(params[:mcid])\n\t\tquestionjson = answer.multiple_choice_question.audience.broadcast\n\t\t#make below JSON the broadcat once broadcast sets\n\t\tif answer.multiple_choice_question.audience.isBroadcasting(answer.multiple_choice_question)\n\t\t\t#save answer\n\t\t\trender :text => 'save'\n\t\telse\n\t\t\trender :text => 'error'\n\t\tend\n\tend",
"def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def save_choices(questionnaire_id)\n\n if params[:new_question] and params[:new_choices]\n questions = Question.find_all_by_questionnaire_id(questionnaire_id)\n i = 1\n for question in questions\n for choice_key in params[:new_choices][i.to_s].keys\n\n if choice_key == params[:new_question][i.to_s][\"weight\"]\n score = 1\n else\n score = 0\n end\n q = QuestionAdvice.new(:score => score, :advice => params[:new_choices][i.to_s][choice_key], :question_id => question.id)\n q.save\n end\n i += 1\n question.weight = 1\n question.true_false = false\n end\n end\n end",
"def start_questionnaire\n # bypassing the need for the user to select the survey - since we're launching with just one 'legislation'\n # When multiple legislations are available, this value will need to be provided by the form\n access_code = params[:survey_access_code] ||\n current_user.try(:default_jurisdiction) ||\n Survey::DEFAULT_ACCESS_CODE\n\n\n # if a dataset isn't supplied, create one for an authenticated user, or mock one for unauthenticated\n @dataset = Dataset.find_by_id(params[:dataset_id]) || (user_signed_in? ? current_user.datasets.create : Dataset.new)\n authorize! :update, @dataset\n\n # use the most recent survey\n @survey = Survey.where(:access_code => access_code).order(\"survey_version DESC\").first\n\n @response_set = ResponseSet.\n create(:survey => @survey,\n :user_id => current_user.try(:id),\n :dataset_id => @dataset.id\n )\n\n if @survey && @response_set\n session[:response_set_id] = current_user ? nil : @response_set.id\n\n if params[:source_response_set_id]\n source_response_set = ResponseSet.find(params[:source_response_set_id]) # TODO: ensure user has rights to copy the response set answers?\n @response_set.copy_answers_from_response_set!(source_response_set)\n end\n\n # flash[:notice] = t('surveyor.survey_started_success')\n redirect_to(surveyor.edit_my_survey_path(\n :survey_code => @survey.access_code, :response_set_code => @response_set.access_code))\n else\n flash[:notice] = t('surveyor.unable_to_find_that_legislation')\n redirect_to (user_signed_in? ? dashboard_path : root_path)\n end\n end",
"def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(params[:questionnaire])\n\n for qid in params[:question].keys\n question_advices = QuestionAdvice.find_all_by_question_id(qid)\n i=1\n for question_advice in question_advices\n if params[:question][qid][\"weight\"] == i.to_s\n score = 1\n else\n score = 0\n end\n i+=1\n question_advice.update_attributes(:score => score, :advice => params[:question_advice][question_advice.id.to_s][\"advice\"])\n end\n end\n save_questionnaire\n #save_choices @questionnaire.id\n end\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid]\n end",
"def answer_to_question(answer)\n @recipients = answer.question.profile.email\n @subject = \"Your question has been answered\"\n self.body = {:question => answer.question, :answer => answer,\n :profile_url => url_for(:controller => :profiles, :action => :show, :id => answer.profile_id),\n :question_url => url_for(:controller => :questions, :action => :show, :id => answer.question_id),\n }\n end",
"def answers\n request('answers')\n end",
"def set_answer\n\t\t#@answer = Survey.find(params[:id])\n\tend",
"def answers=(value)\n @answers = value\n end",
"def update_answers\n last_user_answers.each do |lua|\n lua.correct= (lua.response.to_f == self.response.to_f)\n lua.save!\n end\n end",
"def answer\n question = Question.joins(:subscriptions, :answers).first\n raise \"No subsriptions, cannot create sample\" if question.nil?\n CustomMailer.answer(question.user, question.answers.first)\n end",
"def create\n @question = Question.new(text: \"Default\")\n @answer = @question.answers.build(text: \"Answer1\", color: \"red\", score: 100)\n @answer.save\n @answer = @question.answers.build(text: \"Answer2\", color: \"green\", score: 50)\n @answer.save\n @answer = @question.answers.build(text: \"Answer3\", color: \"blue\", score: 0)\n @answer.save\n #This sets all of the default answers to have a score of 0\n GenPackage.all.each do |package|\n @answer_value = package.answer_values.build(score: 0, question_id: @question.id)\n @answer_value.save\n end\n\n #This qill try and save the question, and if it succeeds, then it alerts the use that the question had been created\n respond_to do |format|\n if @question.save\n format.html { redirect_to :planner, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: :planner }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(params[:question])\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question.problem_set_id = @problem_set.id\n @question.count = @problem_set.question_count + 1\n\n c = false\n ans = false\n\n @ans1 = Answer.new(params[:answer1]) \n @ans2 = Answer.new(params[:answer2]) \n @ans3 = Answer.new(params[:answer3]) \n @ans4 = Answer.new(params[:answer4]) \n\n if @ans1.correct or @ans2.correct or @ans3.correct or @ans4.correct\n c = true\n end\n if params[:answer1][:answer] == \"\"\n @ans1 = nil\n end\n if params[:answer2][:answer] == \"\"\n @ans2 = nil\n end\n if params[:answer3][:answer] == \"\"\n @ans3 = nil\n end\n if params[:answer4][:answer] == \"\"\n @ans4 = nil\n end\n\n if @ans1 or @ans2 or @ans3 or @ans4\n ans = true \n end\n\n respond_to do |format|\n if c and ans \n if @question.save\n @problem_set.question_count += 1\n @problem_set.save \n if @ans1\n @ans1.question_id = @question.id\n @ans1.save\n end\n \n if @ans2\n @ans2.question_id = @question.id\n @ans2.save\n end\n\n if @ans3\n @ans3.question_id = @question.id\n @ans3.save\n end\n \n if @ans4\n @ans4.question_id = @question.id\n @ans4.save\n end\n\n format.html { redirect_to(problem_set_questions_path(@problem_set), :notice => 'Question was successfully created.') }\n format.xml { render :xml => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ans1, :status => :unprocessable_entity }\n end\n end\n end",
"def save_questions(questionnaire_id)\n delete_questions questionnaire_id\n save_new_questions questionnaire_id\n \n if params[:question]\n for question_key in params[:question].keys\n begin\n if params[:question][question_key][:txt].strip.empty?\n # question text is empty, delete the question\n Question.delete(question_key)\n else\n if (@questionnaire.type == \"QuizQuestionnaire\")\n Question.update(question_key,:weight => 1, :txt => params[:question][question_key][:txt] )\n else\n Question.update(question_key, params[:question][question_key])\n end\n Question.update(question_key, params[:question][question_key])\n end\n rescue ActiveRecord::RecordNotFound \n end\n end\n end\n end",
"def question_answered(data, user, answer, _options_string)\n @user = user\n @username = @user.name\n @answer = answer\n @question_title = @answer.question.text.to_s\n @plan_title = @answer.plan.title.to_s\n @template_title = @answer.plan.template.title.to_s\n @data = data\n @recipient_name = @data['name'].to_s\n @message = @data['message'].to_s\n @answer_text = @options_string.to_s\n @helpdesk_email = helpdesk_email(org: @user.org)\n\n I18n.with_locale I18n.default_locale do\n mail(to: data['email'],\n subject: data['subject'])\n end\n end",
"def question\n @question = params[:question]\n @answer = %w[yes no].sample\n end",
"def send_survey\n Message.send_survey_to(self)\n end",
"def add_questions_answers(responses)\n content = \"\"\n responses.each do |response|\n answer = response.answer\n if !response.string_value.nil?\n content += \"<b>#{response.question.text}</b> - #{CGI::escapeHTML(response.string_value)}\\n\"\n elsif answer.text == \"Date\"\n content += \"<b>#{response.question.text}</b> - #{response.datetime_value.to_date}\\n\"\n else\n content += \"<b>#{response.question.text}</b> - #{CGI::escapeHTML(response.answer.text.to_str)}\\n\"\n end\n end\n content\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def answers\n @answers ||= {}\n end",
"def quiz\n end",
"def save_multiple_observations(concept, answers, side_effects=[])\n \n positive_answer = 'Yes'\n answers -= side_effects\n answer_options = concept.answer_options\n if concept.name.include?('Symptoms')\n positive_answer = 'Yes unknown cause'\n end\n answer_options.each{|option|\n observation = self.add_observation(option.id)\n if side_effects.include?(option.id.to_s)\n observation.value_coded = Concept.find_by_name('Yes drug induced').id\n elsif answers.include?(option.id.to_s)\n observation.value_coded = Concept.find_by_name(positive_answer).id\n else\n observation.value_coded = Concept.find_by_name('No').id\n end\n observation.save\n }\n end",
"def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end",
"def respond_save\n\t\t@poll = Poll.find(params[:id])\n\t\tif current_user.save_answers_and_respond_to!(@poll, params)\n\t\t\tredirect_to @poll, notice: \"Successfully responded to this poll.\"\n\t\telse\n\t\t\tredirect_to respond_poll_path(@poll), notice: \"Something went wrong: please try again.\"\n\t\tend\n\tend",
"def answer\n # TODO: サマリ更新ロジックをモデルに移動\n @question = Question.find(params[:id])\n @user = current_user\n @summary = Summary.find_by_user_id_and_question_id(@user[:id], @question[:id])\n @score = @user.scores.build(:question => @question, :summary_id => @summary[:id], :user_answer => params[:answer].to_i, :answer_date => Time.current)\n\n if @question.answer == @score[:user_answer]\n @correct = true\n @score.correct = true\n @summary.attributes = { :total => @summary[:total] + 1, :right => @summary[:right] + 1 }\n else\n @correct = false\n @score.correct = false\n @summary.attributes = { :total => @summary[:total] + 1 }\n end \n @summary.save!\n @score.save!\n end",
"def set_correct_answer\r\n set_question_and_answer\r\n @answer.correct = 1\r\n save_answer_and_render\r\n end",
"def create\n @survey_answers = []\n @all_values = []\n @collect_values = []\n params[:answers].each do|answer_from_user|\n answer_from_user.each {|key,value|\n @all_values << value\n @survey_answers << Answer.new(:surveyname_id => params[:surveyname_id], :question_id => key.to_i, :description => value, :user_id => current_user.id)\n store_values = validate_all_the_questions(key,value)\n @collect_values << store_values if !store_values.nil?\n }\n end\n if @all_values.length == @collect_values.length\n Answer.transaction do\n @survey_answers.each(&:save)\n end\n end\n \n #save the response to survey from user\n if (!@collect_values.blank? && (@all_values.length == @collect_values.length))\n response = Response.new\n response.user_id = current_user.id\n response.surveyname_id = params[:surveyname_id]\n response.save\n redirect_to surveynames_path, :notice => \"Successfully submitted. Thanks for responding!\"\n else\n redirect_to :back, :notice => \"Submittion Failed. Could be because of wrong inputs (or) blank inputs.\n Please re-enter values and submit again.\"\n end\n\n end",
"def ask_questions\n if request.post?\n @album = Album.find( params[:answers][:album_id])\n @user = @album.user\n @question = Question.find params[:answers][:question_id]\n Answer.create(question: @question,\n content: params[:answers][:content],\n guest: current_guest)\n logger.info \"GUEST: #{current_guest}\"\n @questions = params[:answers][:questions].gsub('[','').\n gsub(']','').\n split(',').\n map{|id| id.to_i}\n if @questions.any?\n @album_id = @album.id\n @question = Question.find(@questions.first)\n @questions = @questions[1..-1]\n respond_to do |format|\n format.js\n format.html\n end\n else\n #reset_session\n render 'guests/thank_you'\n end\n end\n end",
"def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end",
"def save\n\n quiz = frm.div(:class=>\"portletBody\").div(:index=>0).text\n pool = frm.div(:class=>\"portletBody\").div(:index=>1).text\n\n frm.button(:value=>\"Save\").click\n\n if quiz =~ /^Assessments/\n EditAssessment.new(@browser)\n elsif pool =~ /^Question Pools/\n EditQuestionPool.new(@browser)\n else\n puts \"Unexpected text: \"\n p pool\n p quiz\n end\n\n end",
"def record_answers\n self.company_id ||= fetch_company_id\n self.metric_id ||= fetch_metric_id\n Answer.where(company_id: company_id, metric_id: metric_id).where.not(id: id)\n end",
"def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end",
"def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def auto_add_answers\n\t\tperson_names = %w(john micheal jordan arya tyrion sansa khal joffrey ramsay)\n\t\tanswers = [\"Very likely\",\"Somewhat likely\",\"Neutral\",\"Somewhat unlikely\",\"Very unlikely\",\"Very satisfied\",\"Somewhat satisfied\",\"Neutral\",\"Somewhat dissatisfied\",\"Very dissatisfied\"]\n\n\t\t(1..3).to_a.each do |num|\n\t\t\tperson_name = person_names.shuffle.first\n\t\t\tanswer = answers.shuffle.first\n\t\t\tself.answers.create(person_name: person_name, answer: answer)\n\t\tend\n\tend",
"def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end",
"def build_answers\n existing_answers = answers.index_by &:question_id\n survey.questions.each do |q|\n next if existing_answers.has_key? q.id\n answers.build question: q\n end\n end",
"def save_exam_answer_for!(exam, question_answered, user_answers=[], answer=false)\n custom_exam_answer = CustomExamAnswer.find_or_create_by(custom_exam: exam, flashcard: self)\n\n custom_exam_answer.update(answered: question_answered, correct: answer, answered_correct_in_exam: answer, user_answers: user_answers)\n end",
"def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end",
"def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end",
"def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end",
"def touch_multi_choice_answer\n touch if question_type == \"MultiChoiceQuestion\"\n end",
"def record_answer(knowledge_idurl, question_idurl, choice_idurls_ok)\n answer = Answer.new(:knowledge_idurl => knowledge_idurl,\n :question_idurl => question_idurl,\n :choice_idurls_ok => choice_idurls_ok,\n :time_stamp => Time.now)\n (hash_answered_question_answers[question_idurl] ||= []) << answer\n answers << answer\n answer\n end",
"def grade\n @question = self.question\n #only grade if they've responded\n if self.responded == true\n self.correct = (response == self.question.solution) \n self.blank = self.response == nil\n end\n self.save\n end",
"def create\n if (params[:question]!=nil)\n @question = Question.new(params[:question])\n @question.subject_id=session[:subjectid] \n else\n @question = Question.new\n end \n \n respond_to do |format|\n if @question.save\n format.html { redirect_to(@question, :notice => 'Question was successfully created.') }\n format.xml { render :xml => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n \n end\n \n if (params[:A]!=nil)\n @choices = Choice.new()\n @choices.value = params[:A]\n @[email protected]\n @choices.save \n end\n if (params[:B]!=nil)\n @choices = Choice.new()\n @choices.value = params[:B]\n @[email protected]\n @choices.save \n end\n if (params[:C]!=nil)\n @choices = Choice.new()\n @choices.value = params[:C]\n @[email protected]\n @choices.save \n end\n \n @choices = Choice.new()\n @choices.value = @question.answer\n @[email protected]\n @choices.save \n \n end",
"def save_user_responses(resp)\n @response = Response.find(resp[:id])\n @question = @response.question\n resp_val_string = Response::EMPTY_RESPONSE_VALUE\n if (@question.question_type == Question::TYPES['short_answer'])\n resp_val_string = resp[:response_value]\n elsif (@question.question_type == Question::TYPES['multiple_choice'] || @question.question_type == Question::TYPES['scale'])\n # look through the multiple choice options and see which one is selected\n # note: for now these are implemented in the same way. in the future, scale may be a slider.\n resp_val_string = resp[:response_value]\n elsif (@question.question_type == Question::TYPES['multiple_select'])\n # look through the multiple select options and see which one(s) are selected\n\t @option_count = 0\n\t @option_arr = []\n\t while(@option_count < @response.question.question_options.length)\n\t\tputs \"** OPTION \" + @option_count.to_s + \" ***\"\n\t\t@index = @option_count.to_s\n\t\tif(resp[\"response_values\"][@index] != \"\")\n\t\t\t@option_arr << resp[\"response_values\"][@index]\n\t\tend\n\t\t@option_count += 1\n\t end\n resp_val_string = @option_arr.join(\",\")\n end\n \n puts \"RESPONSE VALUE STRING: #{resp_val_string}\"\n \n if (resp_val_string == \"\")\n return false\n else\n # update the stuff here\n @response.response_value = resp_val_string\n @response.save!\n return true\n end\n end",
"def chose_correct_answer\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/questions/#{@answer.question.id}\")\n subject = \"[bootcamp] #{@answer.receiver.login_name}さんの質問【 #{@answer.question.title} 】で#{@answer.sender.login_name}さんの回答がベストアンサーに選ばれました。\"\n mail to: @user.email, subject: subject\n end",
"def add_answer(ans_attr)\n return nil if answers.find_by_question_id(ans_attr[:question_id])\n ans = answers.build(ans_attr)\n if ans.question_option_id && option = ans.question.options.find(ans.question_option_id)\n ans.points = option.points_to_award\n ans.correct = option.correct?\n ans.entry_id = option.entry_id\n end \n ans.save\n reload\n ans\n end",
"def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(questionnaire_params)\n for qid in params[:question].keys\n @question = Question.find(qid)\n @question.txt = params[:question][qid.to_sym][:txt]\n @question.save\n @quiz_question_choices = QuizQuestionChoice.where(question_id: qid)\n i=1\n for quiz_question_choice in @quiz_question_choices\n choose_question_type(i, quiz_question_choice)\n i+=1\n end\n end\n end\n redirect_to controller: 'submitted_content', action: 'view', id: params[:pid]\n end",
"def answers\n [answer_1, answer_2]\n end",
"def test_AnswerQuestionsFromQuestionSet\n randomName = SecureRandom.hex(4)\n randomReq = SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n current_url = $browser.current_url\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).displayed?\n } \n \n # Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n elementText = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_TEXT_XPATH)\n if elementText.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_TEXT_XPATH).click\n end\n elementOptional = $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH)\n if elementOptional.attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsQuestionBuilder::QUESTION_SETS_QUESTION_BUILDER_OPTIONAL_XPATH).click\n end\n \n # Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n #Add Answers\n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n Common.click_and_load(QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH) \n \n Common.displayed(AnswerEditPage::ANSWER_EDIT_NAME_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ORDER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_SCORE_XPATH) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_1_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_1_INT\n Common.click_and_load(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_NEW_XPATH)\n Common.displayed(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH) \n \n Common.displayed(AnswerEditPage::ANSWER_EDIT_NAME_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_ORDER_XPATH) \n Common.displayed(AnswerEditPage::ANSWER_EDIT_SCORE_XPATH) \n \n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_NAME_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ANSWER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_NAME_2_TEXT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_ORDER_XPATH).send_keys AnswerEditPage::ANSWER_DATA_ORDER_2_INT\n $browser.find_element(:xpath => AnswerEditPage::ANSWER_EDIT_SCORE_XPATH).send_keys AnswerEditPage::ANSWER_DATA_SCORE_2_INT\n \n Common.click_and_load(AnswerEditPage::ANSWER_EDIT_BTN_SAVE_XPATH)\n Common.displayed(AnswerDetailPage::ANSWER_DETAIL_BACK_TO_QUESTION_XPATH)\n \n # Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n \n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # Go to Job Board\n $browser.get(HomePage::JOB_BOARD_URL)\n \n # 1 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n } \n \n \n # 2 - Answer questions\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select\").send_keys AnswerEditPage::ANSWER_DATA_NAME_1_TEXT\n \n # 3 - Click on Submit\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_BTN_SUBMIT_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n \n $browser.get(current_url)\n # Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n } \n \n assert $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_XPATH).displayed?\n }\n \n Common.click_and_load(QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_APPLICATION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n }\n assert $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_JOB_TEXT_XPATH + \"[//*[text()[contains(.,'\" + randomReq + \"')]]]\").displayed?\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n } \n \n end",
"def answer_params\n params.require(:answer).permit(:answer, :response, :survey_id, :question_id, :response_id, :user_id)\n end",
"def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def add_student_voice_surveys\n ImportedForm.create!({\n \"educator_id\"=>shs_jodi.id,\n \"student_id\"=>shs_freshman_mari.id,\n 'form_timestamp' => time_now - 2.days,\n \"form_key\"=>\"shs_what_i_want_my_teacher_to_know_mid_year\",\n 'form_url' => 'https://example.com/mid_year_survey_form_url',\n 'form_json' => {\n \"What was the high point for you in school this year so far?\"=>\"A high point has been my grade in Biology since I had to work a lot for it\",\n \"I am proud that I...\"=>\"Have good grades in my classes\",\n \"My best qualities are...\"=>\"helping others when they don't know how to do homework assignments\",\n \"My activities and interests outside of school are...\"=>\"cheering\",\n \"I get nervous or stressed in school when...\"=>\"I get a low grade on an assignment that I thought I would do well on\",\n \"I learn best when my teachers...\"=>\"show me each step of what I have to do\"\n }\n })\n ImportedForm.create!({\n \"educator_id\"=>shs_jodi.id,\n \"student_id\"=>shs_freshman_mari.id,\n 'form_timestamp' => time_now - 2.days,\n \"form_key\"=>\"shs_q2_self_reflection\",\n 'form_url' => 'https://example.com/q2_self_reflection_form_url',\n 'form_json' => {\n \"What classes are you doing well in?\"=>\"Computer Science, French\",\n \"Why are you doing well in those classes?\"=>\"I make time in my afternoon each day for doing homework and stick to it\",\n \"What courses are you struggling in?\"=>\"Nothing really\",\n \"Why are you struggling in those courses?\"=>\"I have to work really hard \",\n \"In the classes that you are struggling in, how can your teachers support you so that your grades, experience, work load, etc, improve?\"=>\"Change the way homework works, it's too much\",\n \"When you are struggling, who do you go to for support, encouragement, advice, etc?\"=>\"Being able to stay after school and work with teachers when I need help\",\n \"At the end of the quarter 3, what would make you most proud of your accomplishments in your course?\"=>\"Keeping grades high in all classes since I'm worried about college\",\n \"What other information is important for your teachers to know so that we can support you and your learning? (For example, tutor, mentor, before school HW help, study group, etc)\"=>\"Help in the morning before school\"\n }\n })\n end",
"def admin_survey_params\n params.require(:admin_survey).permit(:question, :answer_1, :answer_2, :answer_3, :answer_4, :answer_5)\n end",
"def answer_to question\n session_data(:answered)[question.id.to_s]\n end",
"def answers\n @answers ||= generate_answers\n end",
"def post_execute\n save({'answer' => @datastore['answer']})\n end",
"def post_execute\n save({'answer' => @datastore['answer']})\n end",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def answer_question(i, answer)\n @answers[i] = answer\n end",
"def update\n def answer_given(question_id)\n return (params[:answer] and params[:answer][question_id.to_s] and\n params[:answer][question_id.to_s].length > 0)\n end\n \n @resp = Response.find(params[:id])\n\n @questionnaire.questions.each do |question|\n if question.kind_of? Questions::Field\n ans = Answer.find_answer(@resp, question)\n if answer_given(question.id)\n if ans.nil?\n ans = Answer.new :question_id => question.id, :response_id => @resp.id\n end\n ans.value = params[:answer][question.id.to_s]\n ans.save\n else\n # No answer provided\n if not ans.nil?\n ans.destroy\n end\n end\n end\n end\n\n respond_to do |format|\n if @resp.update_attributes(params[:response])\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.js { redirect_to(response_url(@questionnaire, @resp, :format => \"js\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_answer\n request('answers/add')\n end",
"def no_responses\n #below is code to fix a bizarre bug. When triggered by the \"cut\" function, for some reason survey_id is erased. Have not found reason yet. Temporary fix.\n if !survey_section && self.id\n self.reload\n end\n if self.id && self.survey_section && self.survey_section.survey\n #this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.\n self.survey_section.survey.response_sets.where('test_data = ?',true).each {|r| r.destroy}\n end\n if self.id && !survey_section.survey.template && survey_section.survey.response_sets.count>0\n errors.add(:base,\"Reponses have already been collected for this survey, therefore it cannot be modified. Please create a new survey instead.\")\n return false\n end\n end",
"def response_params\n params.require(:response).permit(:survey_id,\n :answers_attributes => [:id, :answer, :question_id]\n )\n end",
"def save_new_questions(questionnaire_id)\n\n if params[:new_question]\n # The new_question array contains all the new questions\n # that should be saved to the database\n for question_key in params[:new_question].keys\n q = Question.new(params[:new_question][question_key])\n q.questionnaire_id = questionnaire_id\n if @questionnaire.type == \"QuizQuestionnaire\"\n q.weight = 1 #setting the weight to 1 for quiz questionnaire since the model validates this field\n q.true_false = false\n end\n q.save if !q.txt.strip.empty?\n end\n end\n end",
"def create\n #Check if all questions were ANSWERED\n answers = nil\n (1..60).each do |i|\n answers = answers.to_s + params[\"#{i}\"].to_s if params.key?(\"#{i}\")\n end\n if answers.present? && answers.length == 60\n session[:answers] = answers\n redirect_to interest_profilers_path\n else\n flash[:notice] = 'Please answer all the question to proceed further'\n redirect_to interest_profiler_path(1)\n end\n\n end",
"def save_all_questions\n questionnaire_id = params[:id]\n begin\n if params[:save]\n update_questionnaire_questions\n flash[:success] = 'All questions have been successfully saved!'\n end\n rescue StandardError\n flash[:error] = $ERROR_INFO\n end\n\n if params[:view_advice]\n redirect_to controller: 'advice', action: 'edit_advice', id: params[:id]\n elsif questionnaire_id\n redirect_to edit_questionnaire_path(questionnaire_id.to_sym)\n end\n end",
"def answer\n @form_data = Form.get_published_form(params[:code])\n if @form_data.nil?\n redirect_to \"/dashboard\"\n else\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end\n end",
"def ask(question)\n session[:question_id] = question.id\n session[:correct_answer] = question.answer_correct\n session[:current_answers] = [@question.answer_correct, @question.answer_wrong_1, @question.answer_wrong_2, @question.answer_wrong_3].shuffle\n end",
"def mark(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n end",
"def new_completed(questions, user)\n @user = User.last\n @responses = @user.responses\n @questions = questions\n mail( :to => \"[email protected]\",\n :cc => \"[email protected]\",\n :subject => \"Coding Challenge Submission\" )\n end",
"def no_responses\n if self.id && self.survey\n #this will be a problem if two people are editing the survey at the same time and do a survey preview - highly unlikely though.\n self.survey.response_sets.where('test_data = ?',true).each {|r| r.destroy}\n end\n if self.survey && !survey.template && survey.response_sets.count>0\n errors.add(:base,\"Reponses have already been collected for this survey, therefore it cannot be modified. Please create a new survey instead.\")\n return false\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to @quiz, notice: \"Quiz was successfully created.\" }\n format.json { render :show, status: :created, location: @quiz }\n\t\tmy_array = []\n\t\tmy_array << @quiz.option1\n\t\tmy_array << @quiz.option2\n\t\tmy_array << @quiz.option3\n\t\tmy_array << @quiz.option4\n\t\t\n\t\tcorrect_respo = my_array[@quiz.correct_response.to_i - 1]\n\t\[email protected]_response_text = correct_respo\n\t\[email protected]\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end",
"def questions\n \n end",
"def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end",
"def display_survey(survey_layout)\n warning = false\n survey_file = get_survey_path(survey_layout[SURVEY][:datafile])\n if survey_layout.has_key?(ERRORS)\n display_alert(lead: 'Error: could not load survey layout!', body: \"#{survey_layout[ERRORS]} Contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n elsif File.file?(survey_file)\n survey_data = {}\n begin\n survey_data = JSON.parse(File.read(survey_file), :symbolize_names => true)\n # Check if the user has already submitted this survey\n if survey_data.has_key?($USER.to_sym)\n display_alert(lead: 'Warning: User already submitted survey data!', body: \"#{__method__}(#{survey_file}) You appear to have **already submitted** this survey data; you may want to edit the survey.json in SVN, or contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n warning = true\n end\n rescue StandardError => e\n display_alert(lead: 'Error: parsing survey datafile!', body: \"**#{__method__}(#{survey_file}) #{e.message}**\\n\\n #{e.backtrace[0]}\")\n warning = true\n end\n else\n display_alert(lead: 'Warning: could not find survey datafile!', body: \"**#{__method__}(#{survey_file})** the data file to store survey answers was not supplied or found; contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n warning = true\n end\n\n # Emit the survey, or the default one which provides help on the survey tool\n _whimsy_panel(\"#{survey_layout[SURVEY][FORM][:title]} (user: #{$USER})\", style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n survey_layout[SURVEY][FORM][:fields].each do |field|\n _whimsy_field_chooser(field)\n end\n _div.col_sm_offset_3.col_sm_9 do\n _span.help_block id: 'submit_help' do\n _span.text_info survey_layout[SURVEY][FORM][:buttonhelp]\n _span.text_danger 'Warning! Note potential errors above.' if warning\n end\n _input.btn.btn_default type: 'submit', id: 'submit', value: survey_layout[SURVEY][FORM][:buttontext], aria_describedby: 'submit_help'\n end\n end\n end\nend",
"def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end",
"def answer\n @contest_response = get_my_latest_response(@contest.id, true)\n return play if @contest_response.completed?\n\n ans_attr = {:question_id => params[:question_id]}\n ans_attr[:question_option_id] = params[:answer][:question_option_id] if params[:answer] && 'Skip' != params[:commit] \n if ans = @contest_response.add_answer(ans_attr)\n unless ans.errors.empty?\n respond_to do |format|\n render :xml => ans.errors.to_xml and return\n end\n end\n end \n respond_to do |format|\n format.html { redirect_to contest_url(@contest.url_attributes(:action => 'play')) }\n format.js { play }\n format.xml { return render(:xml => @contest_response.to_xml(:base_url => request.host_with_port)) }\n end \n end",
"def update\n @survey = Survey.find_by_id( params[:survey_id] )\n @question = Question.find_by_id( params[:id] )\n\n if @question.update( question_params )\n if params[:commit] == \"Continue to the Next Step\"\n params[:option_num].to_i.times do\n @question.options.create # TODO: cleanup, could create empty options in db\n end\n\n redirect_to edit_survey_question_path(@survey, @question)\n else\n flash.now[:success] = \"Question Added!\"\n\n # Create new empty question for render\n @question = @survey.questions.build\n\n render :new\n end\n else\n flash.now[:error] = \"Sorry, we couldn't add that question due to errors.\"\n render :new\n end\n end",
"def survey_params\n params.require(:survey).permit(:title, :author_id, :description, :link ,questions_attributes: [:id, :order_number, :question_type, :text, :required, :obliterate, answers_attributes: [:id, :text, :taker_id]] )\n end",
"def record_answer(knowledge, quizze, question, choices_idurls_selected_ok)\n choices_idurls_selected_ok ||= []\n quizze_instance = get_latest_quizze_instance\n raise \"error\" unless quizze_instance and quizze_instance.get_quizze == quizze\n choices_ok = question.get_choice_ok_from_idurls(choices_idurls_selected_ok)\n knowledge.trigger_recommendations(quizze_instance, question, quizze.products, choices_ok, false)\n question.record_answer(self, choices_ok, false)\n end",
"def mark(_ = nil)\n publish_answers\n end",
"def survey_answers\n survey_questions.map(&:survey_answers).flatten\n end",
"def update\n @question.statement = params[:question][:statement]\n unless @question.online\n @question.level = (@chapter.section.fondation? ? 0 : params[:question][:level])\n if @question.is_qcm\n if params[:question][:many_answers] == '1'\n @question.many_answers = true\n else\n if @question.many_answers\n # Must check there is only one true\n i = 0\n @question.items.order(:id).each do |c|\n if c.ok\n if i > 0\n c.ok = false\n flash[:info] = \"Attention, il y avait plusieurs réponses correctes à cet exercice, seule la première a été gardée.\"\n c.save\n end\n i = i+1\n end\n end\n if @question.items.count > 0 && i == 0\n # There is no good answer\n flash[:info] = \"Attention, il n'y avait aucune réponse correcte à cet exercice, une réponse correcte a été rajoutée aléatoirement.\"\n @item = @question.items.order(:id).first\n @item.ok = true\n @item.save\n end\n end\n @question.many_answers = false\n end\n else\n if params[:question][:decimal] == '1'\n @question.decimal = true\n @question.answer = params[:question][:answer].gsub(\",\",\".\").to_f\n else\n @question.decimal = false\n @question.answer = params[:question][:answer].gsub(\",\",\".\").to_i\n end\n end\n end\n \n if @question.save\n redirect_to chapter_path(@chapter, :type => 5, :which => @question.id)\n else\n render 'edit'\n end\n end",
"def set_survey_answer\n @survey_answer = SurveyAnswer.find(params[:id])\n end",
"def create\n\t\n\t@exam_answer = ExamAnswer.new(exam_answer_params)\n\tif @exam_answer.exam_id == 999\n\t\t@exam_answer.exam_level = params[:exam_lv]\n\t\t@questions = Question.all.where(level: params[:exam_lv])\n\t\t@exams_questions = @questions.all.where(id: [params[:q1_id], params[:q2_id], params[:q3_id], params[:q4_id], params[:q5_id], params[:q6_id], params[:q7_id], params[:q8_id], params[:q9_id], params[:q10_id]])\n\telse\n\t\t@exam = Exam.find(@exam_answer.exam_id)\n\t\t@exam_answer.exam_level = @exam.level\n\t\t@questions = Question.all.where(level: @exam_answer.exam_level)\n\t\t@exams_questions = @questions.all.where(id: [@exam.question1, @exam.question2, @exam.question3, @exam.question4, @exam.question5, @exam.question6, @exam.question7, @exam.question8, @exam.question9, @exam.question10])\n\tend\n\t\n\t@exam_answer.user_id = current_user.id\n\t@exam_answer.ans1 = params[:q1]\n\t@exam_answer.q1 = (@exam_answer.ans1 == @exams_questions[0].answerR ? true : false)\n\t@exam_answer.ans2 = params[:q2]\n\t@exam_answer.q2 = (@exam_answer.ans2 == @exams_questions[1].answerR ? true : false)\n\t@exam_answer.ans3 = params[:q3]\n\t@exam_answer.q3 = (@exam_answer.ans3 == @exams_questions[2].answerR ? true : false)\n\t@exam_answer.ans4 = params[:q4]\n\t@exam_answer.q4 = (@exam_answer.ans4 == @exams_questions[3].answerR ? true : false)\n\t@exam_answer.ans5 = params[:q5]\n\t@exam_answer.q5 = (@exam_answer.ans5 == @exams_questions[4].answerR ? true : false)\n\t@exam_answer.ans6 = params[:q6]\n\t@exam_answer.q6 = (@exam_answer.ans6 == @exams_questions[5].answerR ? true : false)\n\t@exam_answer.ans7 = params[:q7]\n\t@exam_answer.q7 = (@exam_answer.ans7 == @exams_questions[6].answerR ? true : false)\n\t@exam_answer.ans8 = params[:q8]\n\t@exam_answer.q8 = (@exam_answer.ans8 == @exams_questions[7].answerR ? true : false)\n\t@exam_answer.ans9 = params[:q9]\n\t@exam_answer.q9 = (@exam_answer.ans9 == @exams_questions[8].answerR ? true : false)\n\t@exam_answer.ans10 = params[:q10]\n\t@exam_answer.q10 = (@exam_answer.ans10 == @exams_questions[9].answerR ? true : false)\n\t\n\trec_point = (@exam_answer.q1 ? 1:0) + (@exam_answer.q2 ? 1:0) + (@exam_answer.q3 ? 1:0) + (@exam_answer.q4 ? 1:0) + (@exam_answer.q5 ? 1:0) + (@exam_answer.q6 ? 1:0) + (@exam_answer.q7 ? 1:0) + (@exam_answer.q8 ? 1:0) + (@exam_answer.q9 ? 1:0) + (@exam_answer.q10 ? 1:0)\n\tpoints = rec_point/10.to_f\n\tif @exam_answer.exam_id == 999\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\tpoints2 = points*10.to_i\n\t\telse\n\t\t\tpoints2 = points*20.to_i\n\t\tend\n\telse\n\t\tpoints2 = points*@exam.points.to_i\n\tend\n\t@exam_answer.rec_points = points2\n\n\tif @exam_answer.exam_id == 999\n\t\ttemp = 7/10.to_f\n\t\tif params[:exam_lv] == \"Początkujący\"\n\t\t\t@min = temp*10.to_i\n\t\telse\n\t\t\t@min = temp*20.to_i\n\t\tend\n\telse\n\t\ttemp = 7/10.to_f\n\t\t@min = temp*@exam.points.to_i\n\tend\n\n\tif @exam_answer.rec_points >= @min\n\t\t@user_progress = UserProgress.find_by user_id: current_user.id\n\t\tif @exam_answer.exam_id == 999\n\t\t\tif params[:exam_lv] == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif params[:exam_lv] == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\n\n\t\telse\n\n\t\t\tif @exam.level == \"Początkujący\" && @user_progress.p10?\n\t\t\t\t@user_progress.update(poczatkujacy: true)\n\t\t\telsif @exam.level == \"Zaawansowany\" && @user_progress.z10?\n\t\t\t\t@user_progress.update(complete_all: true)\n\t\t\t\t@user_progress.update(zaawansowany: true)\n\t\t\tend\n\t\tend\n\t\tcurrent_user.increment!(:points, points2)\n\t\trespond_to do |format|\n\t\t if @exam_answer.save\n\t\t format.html { redirect_to @exam_answer, :notice => \"Zdales egzamin!.\" }\n\t\t format.json { render :show, status: :created, location: @exam_answer }\n\t\t else\n\t\t format.html { render :new }\n\t\t format.json { render json: @exam_answer.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\t\t\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to exam_list_path , :notice => \"Nie zdales egzaminu, zdobyles za malo punktow, liczba otrzymanych punktow - #{@exam_answer.rec_points} , minimum do zdania - #{@min}\" }\n\t\t format.json { render exam_list_path, status: :unprocessable_entity , location: exam_list }\n\t\tend\n\tend\nend",
"def survey_params\n\t\tparams.permit(:answer, :user_id, :datee_id) \n\tend",
"def update_multiple_answer_questions params\n #clear questions first\n self.pal_additional_areas.clear\n self.pal_participation_levels.clear\n self.help_additional_areas.clear\n self.professions.clear\n self.search_plan_types.clear\n self.npln_participation_levels.clear\n self.referral_fees.clear\n self.plan_types.clear\n self.claim_types.clear\n self.sponsor_types.clear\n self.npln_additional_areas.clear\n self.jurisdictions.clear\n self.geo_areas.clear\n\n self.pal_additional_areas << params[:pal_additional_areas].collect{|p| PalAdditionalArea[p]} if params[:pal_additional_areas]\n self.pal_participation_levels << params[:pal_participation_levels].collect{|p| PalParticipationLevel[p]} if params[:pal_participation_levels]\n self.help_additional_areas << params[:help_additional_areas].collect{|p| HelpAdditionalArea[p]} if params[:help_additional_areas]\n self.professions << Profession[params[:profession]] if (params[:profession] and !params[:profession].blank?)\n self.search_plan_types << params[:search_plan_types].collect{|p| SearchPlanType[p]} if params[:serach_plan_types]\n self.npln_participation_levels << params[:npln_participation_levels].collect{|p| NplnParticipationLevel[p]} if params[:npln_participation_levels]\n self.referral_fees << params[:referral_fees].collect{|p| ReferralFee[p]} if params[:referral_fees]\n self.plan_types << params[:plan_types].collect{|p| PlanType[p]} if params[:plan_types]\n self.claim_types << params[:claim_types].collect{|p| ClaimType[p]} if params[:claim_types]\n self.sponsor_types << params[:sponsor_types].collect{|p| SponsorType[p]} if params[:sponsor_types]\n self.npln_additional_areas << params[:npln_additional_areas].collect{|p| NplnAdditionalArea[p]} if params[:npln_additional_areas]\n self.jurisdictions << params[:jurisdictions].collect{|p| Jurisdiction[p]} if params[:jurisdictions]\n self.geo_areas << params[:geo_areas].collect{|p| GeoArea[p]} if params[:geo_areas]\n end",
"def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: \"Quiz was successfully updated.\" }\n format.json { render :show, status: :ok, location: @quiz }\n\t\tmy_array = []\n my_array << @quiz.option1\n my_array << @quiz.option2\n my_array << @quiz.option3\n my_array << @quiz.option4\n\n correct_respo = my_array[@quiz.correct_response.to_i - 1]\n @quiz.correct_response_text = correct_respo\n @quiz.save\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accepted(target, question)\n @question = question\n\n mail to: target.email, subject: \"Your answer has been accepted!\"\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(params[:answer])\n @answer.user = current_user\n @answer.score = 0\n @answer.fav = 0\n @user = User.find(@question.user_id)\n\n respond_to do |format|\n if @answer.save\n UserMailer.answer_email(@user).deliver\n format.html { redirect_to @question, notice: 'Respuesta creada correctamente.' }\n format.json { render json: @question, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sync_user_answers\n return head :ok if params[:user_answers].blank?\n\n user_exam = current_user.user_exams.find(params[:id])\n user_exam.user_answers.create! user_answers_params\n\n head :ok\n end",
"def answer(data)\n @action = Action.find_by_class_assignment_id_and_user_id(\n @session[:assignment_id], @current_user.id)\n @action_problem = action.action_problems.find_by_problem_id_and_end_time(data[:problem].id, nil)\n @assignment_answer = AssignmentAnswer.create(\n :action_problem_id => @action_problem.id,\n :problem_id => data[:problem].id, \n :answer => data[:correct] || data[:incorrect], \n :correct => data.has_key?(:correct), \n :user_id => @current_user.id, \n :class_assignment_id => @session[:assignment_id], \n :time => Time.now)\n\n #action_problem.incorrect_answers += 1 if data.has_key?(:incorrect)\n #action_problem.first_assignment_answer_id = @assignment_answer.id if action_problem.first_assignment_answer_id.nil?\n #action_problem.save!\n\n if @assignment_answer.first_response? and @assignment_answer.problem.scaffold_id.nil?\n student_id = Student.find_by_user_id(@session[:user]).id\n sa = StudentAssignment.find_or_create_by_student_id_and_class_assignment_id(student_id, @session[:assignment_id])\n sa.increment(:correct_first_answers) if data[:correct] and -1 == @session[:hint_count]\n sa.increment(:all_first_answers)\n sa.save\n end\n # Question level table\n log = QuestionLevelLog.find_by_class_assignment_id_and_user_id_and_problem_id(\n @session[:assignment_id], @current_user.id, data[:problem].id)\n unless log.nil?\n # IF FIRST RESPONSE\n if log.first_action.nil?\n log.first_response_time = @assignment_answer.time\n # if request scaffold\n if @assignment_answer.answer.nil?\n log.first_action = 2\n log.correct = 0\n # if an answer\n else\n log.first_action = 0\n log.attempt_count += 1\n log.correct = @assignment_answer.correct? ? 1:0\n log.answer = @assignment_answer.answer\n if @assignment_answer.answer.class.to_s == \"HashWithIndifferentAccess\"\n log.answer_id = @assignment_answer.answer[:id] unless @assignment_answer.answer[:id].nil?\n log.input_text = @assignment_answer.answer[:body] unless @assignment_answer.answer[:body].nil?\n else\n log.input_text = @assignment_answer.answer\n end\n end\n # NOT THE FIRST RESPONSE\n else\n # if an answer\n unless @assignment_answer.answer.nil?\n log.attempt_count += 1\n end\n end\n log.save\n end\n end",
"def create\n @question = Question.new(params[:question])\n @question.survey_id = params[:survey_id]\n respond_to do |format|\n if @question.save\n \n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @submitted_answer = SubmittedAnswer.new(submitted_answer_params)\n @question = Question.find_by_id(submitted_answer_params[:question_id])\n if @question.answers.first.name.downcase == @submitted_answer.answer.downcase\n @submitted_answer.score = 4\n else\n @submitted_answer.score = -1\n end\n\n respond_to do |format|\n if @submitted_answer.save\n format.html { redirect_to @question, notice: 'Submitted answer was successfully created.' }\n format.json { render :show, status: :created, location: @submitted_answer }\n else\n format.html { render :new }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7025898",
"0.695287",
"0.68001616",
"0.6730016",
"0.6730016",
"0.65000147",
"0.6445978",
"0.6407693",
"0.64025706",
"0.6397086",
"0.6353377",
"0.63512486",
"0.6346199",
"0.6339251",
"0.63265485",
"0.6316836",
"0.6296336",
"0.62623453",
"0.6258481",
"0.62574756",
"0.6251837",
"0.6241724",
"0.6237815",
"0.623718",
"0.62200665",
"0.6203309",
"0.61951745",
"0.61937845",
"0.61930615",
"0.61858195",
"0.61740595",
"0.6173953",
"0.61700344",
"0.61655426",
"0.6149696",
"0.61450124",
"0.61406696",
"0.61352664",
"0.6113939",
"0.61063665",
"0.61052364",
"0.6103213",
"0.60957265",
"0.6095524",
"0.6093556",
"0.6082631",
"0.60801435",
"0.60733926",
"0.60726017",
"0.606844",
"0.60671157",
"0.60616326",
"0.6060301",
"0.60539126",
"0.6048261",
"0.6047477",
"0.6043006",
"0.6037002",
"0.600671",
"0.59972835",
"0.59842896",
"0.59805393",
"0.59805393",
"0.59788674",
"0.59769285",
"0.5976674",
"0.59759283",
"0.597412",
"0.5969948",
"0.59693813",
"0.5963422",
"0.59604394",
"0.5953389",
"0.5945718",
"0.5944369",
"0.59429675",
"0.5931365",
"0.59313595",
"0.59289426",
"0.59236133",
"0.5922708",
"0.5920304",
"0.5919528",
"0.59142447",
"0.5912941",
"0.5908111",
"0.59079623",
"0.5904949",
"0.5902247",
"0.5899782",
"0.589902",
"0.58959043",
"0.58938426",
"0.5889522",
"0.5884028",
"0.58531696",
"0.5850905",
"0.5842717",
"0.5839694",
"0.5837611",
"0.5835573"
] | 0.0 | -1 |
updates survey page with dynamic data. Consider moving to separate JavascriptsController | def dynamic_data
@journal_entry = JournalEntry.find(params[:id], :include => :journal)
save_interval = current_user && current_user.login_user && 30 || 20 # change to 900, 60
save_draft_url = "/survey_answers/save_draft/#{@journal_entry.id}"
logger.info "dynamic_data: current_user: #{current_user.inspect} entry: #{@journal_entry.inspect}"
# sleep(3000)
respond_to do |format|
if current_user.nil?
format.js {
render :update do |page|
page.replace_html 'centertitle', "Du er ikke logget ind"
page.visual_effect :pulsate, 'centertitle'
page.visual_effect :blind_up, 'content_survey', :duration => 6
page.visual_effect :fade, 'surveyform', :duration => 6
page.alert "Du bliver sendt til login-siden."
page.redirect_to login_path
end
}
elsif current_user && !current_user.login_user
format.js {
render :update do |page|
page.replace_html 'centertitle', @journal_entry.journal.center.get_title
page.insert_html :bottom, 'survey_journal_info', :partial => 'surveys/survey_header_info'
page.insert_html :bottom, 'survey_fast_input', :partial => 'surveys/fast_input_button'
page.insert_html :bottom, 'back_button', :partial => 'surveys/back_button'
page.show 'save_draft'
page.show 'submit_button'
end
}
else # login users
format.js {
render :update do |page|
page.replace_html 'centertitle', @journal_entry.journal.center.get_title
page.insert_html :bottom, 'survey_journal_info', :partial => 'surveys/survey_header_info_login_user'
page.show 'save_draft'
page.show 'submit_button'
end
}
end
end
rescue RecordNotFound
render :update do |page|
logger.info "dynamic_data: fejl! #{@journal_entry.id} journal id/kode: #{@journal_entry.journal.id}/#{@journal_entry.journal.code}"
page.alert "Der er sket en fejl, du skal logge ud og ind igen", @journal_entry.journal.center.get_title
page.redirect_to logout_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @survey = Survey.find(params[:id])\n success = @survey.update_attributes(params[:survey])\n \n puts \"UPDATE: Survey:#{@survey.id} - #{@survey.name}\"\n # Load the JSON Survey form data.\n survey_questions = ActiveSupport::JSON.decode(@survey.survey_data)\n #y survey_questions\n \n update_questions(@survey, survey_questions)\n \n # Render a response.\n respond_to do |format|\n if success\n format.html { redirect_to(@survey, :notice => 'Survey was successfully updated.') }\n format.xml { head :ok }\n format.js { head :ok}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n format.js { render :json => @survey.errors, :status => :error }\n end\n end\n end",
"def update\n authorize! :update, @response_survey\n respond_to do |format|\n if @response_survey.update(response_survey_params)\n format.html { redirect_to :back }\n format.js\n else\n format.html\n format.js\n end\n end\n end",
"def index\n @survey_questions = get_survey_questions\n end",
"def index\n @survey_questions = get_survey_questions\n end",
"def update_survey\n @evaluation_template.update_survey(params)\n if @evaluation_template.save\n flash[:success] = \"Template updated.\"\n redirect_to @evaluation_template\n else\n flash.now[:error] = \"Template could not be updated.\"\n render 'show'\n end\n end",
"def create\n @s = []\n params.each do |name, value|\n if name =~ /vertical_(.+)$/\n if value =~ /radio(.+)$/\n @s << $1.to_i\n end\n end\n end\n @poll = Poll.find(Pollitem.find(@s[0].to_i).poll_id)\n for s in @s\n @survey = Survey.create(pollitem_id: s.to_i, user_id: current_user.id, poll_id: @poll.id)\n end\n\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render :show, status: :created, location: @survey }\n format.js\n else\n format.html { render :new }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def survey_page\n self\n end",
"def index\n @title = \"Survey Question Categories\"\n @survey_question_categories = SurveyQuestionCategory.all\n\n respond_to do |format|\n format.js { @set_id = params[:id] }\n end\n end",
"def show\n @my_survey = nil # MySurvey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_survey }\n end\n end",
"def index\n @survey_id = params[:survey_id]\n @survey_questions = SurveyQuestion.rank(:order_by).where(survey_id: @survey_id)\n @study = Study.where(survey_id: params[:survey_id]).first\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @survey_questions }\n end\n end",
"def show\n respond_with( @survey )\n end",
"def update\n @survey.update(survey_params)\n respond_with( [ :admin, @survey] )\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def display_survey(survey_layout)\n warning = false\n survey_file = get_survey_path(survey_layout[SURVEY][:datafile])\n if survey_layout.has_key?(ERRORS)\n display_alert(lead: 'Error: could not load survey layout!', body: \"#{survey_layout[ERRORS]} Contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n elsif File.file?(survey_file)\n survey_data = {}\n begin\n survey_data = JSON.parse(File.read(survey_file), :symbolize_names => true)\n # Check if the user has already submitted this survey\n if survey_data.has_key?($USER.to_sym)\n display_alert(lead: 'Warning: User already submitted survey data!', body: \"#{__method__}(#{survey_file}) You appear to have **already submitted** this survey data; you may want to edit the survey.json in SVN, or contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n warning = true\n end\n rescue StandardError => e\n display_alert(lead: 'Error: parsing survey datafile!', body: \"**#{__method__}(#{survey_file}) #{e.message}**\\n\\n #{e.backtrace[0]}\")\n warning = true\n end\n else\n display_alert(lead: 'Warning: could not find survey datafile!', body: \"**#{__method__}(#{survey_file})** the data file to store survey answers was not supplied or found; contact the survey owner: #{survey_layout[SURVEY][CONTACT]}.\")\n warning = true\n end\n\n # Emit the survey, or the default one which provides help on the survey tool\n _whimsy_panel(\"#{survey_layout[SURVEY][FORM][:title]} (user: #{$USER})\", style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n survey_layout[SURVEY][FORM][:fields].each do |field|\n _whimsy_field_chooser(field)\n end\n _div.col_sm_offset_3.col_sm_9 do\n _span.help_block id: 'submit_help' do\n _span.text_info survey_layout[SURVEY][FORM][:buttonhelp]\n _span.text_danger 'Warning! Note potential errors above.' if warning\n end\n _input.btn.btn_default type: 'submit', id: 'submit', value: survey_layout[SURVEY][FORM][:buttontext], aria_describedby: 'submit_help'\n end\n end\n end\nend",
"def index\n @responses = @survey.responses\n @questions = Question.all\n end",
"def index\n @survey_questions = SurveyQuestion.all\n end",
"def set_survey_form\n @survey_form = SurveyForm.includes(:questions).find(params[:id])\n end",
"def survey\n fixed_survey =\n JSON.parse File.read(Rails.root.join('app', 'data', 'survey.json'))\n\n # Set the global survey title\n fixed_survey['title'] = @posting.name\n fixed_survey['description'] = @posting.intro_text\n\n # Find the preferences page and set a preference for each PostingPosition\n preferences_page =\n fixed_survey['pages'].find do |page|\n page['name'] == 'preferences_page'\n end\n\n preferences_page['elements'][0]['rows'] = assemble_preferences_rows\n\n # Add any custom questions there may be\n custom_questions = @posting.custom_questions\n if custom_questions.respond_to? :dig\n fixed_survey['pages'].concat custom_questions['pages']\n end\n\n fixed_survey\n end",
"def index\n @survey_items = SurveyItem.all\n end",
"def show\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n format.html {redirect_to @survey_choice.question}\n format.json { render json: @survey_choice }\n format.js\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n \n end",
"def update\n @question = Question.find(params[:id])\n if @question.update_attributes(question_params)\n flash[:notice] = \"Question updated successfully.\"\n redirect_to(:action => 'show', :id => @question.id, :survey_id => @survey.id)\n else\n @surveys = Survey.all\n @page_count = Page.count\n render('edit')\n end\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def show # BROKEN layout\n cookies.delete :journal_entry\n @options = {:answers => true, :disabled => false, :action => \"show\"}\n @journal_entry = JournalEntry.and_survey_answer.find(params[:id])\n cookies[:journal_entry] = @journal_entry.id\n @survey_answer = SurveyAnswer.and_answer_cells.find(@journal_entry.survey_answer_id)\n @@surveys[@journal_entry.survey_id] ||= Survey.and_questions.find(@survey_answer.survey_id)\n @survey = @@surveys[@journal_entry.survey_id]\n @survey.merge_survey_answer(@survey_answer)\n @page_title = \"CBCL - Vis Svar: \" << @survey.get_title\n render :layout => 'survey' # :template => 'surveys/show'\n end",
"def survey\n fixed_survey =\n JSON.parse File.read(Rails.root.join('app', 'data', 'survey.json'))\n position_description_template =\n Liquid::Template.parse(\n File.read(\n Rails.root.join('app', 'data', 'position_descriptions.html')\n )\n )\n\n # Set the global survey title\n availability_desc =\n if @posting.open_date.year == @posting.close_date.year\n \"Available from #{@posting.open_date.strftime('%b %d')} to #{\n @posting.close_date.strftime('%b %d, %Y')\n }\"\n else\n \"Available from #{\n @posting.open_date.strftime('%b %d, %Y')\n } to #{@posting.close_date.strftime('%b %d, %Y')}\"\n end\n fixed_survey['title'] = \"#{@posting.name} (#{availability_desc})\"\n fixed_survey['description'] = @posting.intro_text\n\n # Find the preferences page and set a preference for each PostingPosition\n preferences_page =\n fixed_survey['pages'].find do |page|\n page['name'] == 'preferences_page'\n end\n\n preferences_question =\n preferences_page['elements'].find do |elm|\n elm['name'] == 'position_preferences'\n end\n preferences_question['rows'] = assemble_preferences_rows\n position_descriptions =\n preferences_page['elements'].find do |elm|\n elm['name'] == 'position_descriptions'\n end\n position_descriptions['html'] =\n position_description_template.render position_description_subs\n\n # Add any custom questions there may be.\n # These should show up after all fixed questions but before the comments page.\n custom_questions = @posting.custom_questions\n custom_pages =\n custom_questions.respond_to?(:dig) ? custom_questions['pages'] : []\n\n comments_page, fixed_pages =\n fixed_survey['pages'].partition do |page|\n page['name'] == 'comments_page'\n end\n\n fixed_survey['pages'] = fixed_pages + custom_pages + comments_page\n\n fixed_survey\n end",
"def update\n respond_to do |format|\n if @initial_survey.update(initial_survey_params)\n format.html { redirect_to @initial_survey, notice: 'Initial survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @initial_survey }\n else\n format.html { render :edit }\n format.json { render json: @initial_survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_survey = nil # MySurvey.find(params[:id])\n\n respond_to do |format|\n if @my_survey.update_attributes(params[:my_survey])\n format.html { redirect_to @my_survey, notice: 'My survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_for_analysis_type\n \t@selected_analysis = params[:selected_analysis]\n \t\n \trespond_to do |format|\n format.js { \n \trender :update do |page|\n \t\tpartial_used = case @selected_analysis\n \t\t\t\twhen \"Log Rank\" then \"log_rank\"\n \t\t\t\twhen \"t-Test, 1-sided\" then \"choice_of_grouping\"\n \t\t\t\twhen \"t-Test, 2-sided\" then \"two_sided_t\"\n \t\t\t\telse \"default\"\n \t\t\tend\n \t page.replace_html \"comparison_level1\", :partial=>\"outcome_analyses/partials/analyses/\"+partial_used.to_s\n \tend\n }\n end\n end",
"def index\n @survey_responses = SurveyResponse.all\n end",
"def set_survey\n @survey = Survey.find(params[:id])\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def index\n @surveys = Survey.all\n end",
"def set_survey\n\t @survey = Survey.find(params[:id])\n\t end",
"def update\n respond_to do |format|\n if @survey_item.update(survey_item_params)\n format.js {head :ok }\n format.html { redirect_to @survey_item, notice: 'Survey item was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_item }\n else\n format.html { render :edit }\n format.json { render json: @survey_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to admin_survey_path @survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @my_survey = nil # MySurvey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_survey }\n end\n end",
"def update\n if not (granted_for?('root') || granted_for('survey'))\n access_denied\n else\n \n @survey = Survey.find(params[:id])\n \n @survey.add_question(params[:new_question],\n params[:new_question_values],\n params[:question_type]) unless params[:new_question].blank?\n \n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n flash[:notice] = 'Survey was successfully updated.'\n format.html { redirect_to( edit_survey_path(@survey)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @survey.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @survey_forms = SurveyForm.all\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n # calcul et save le total de tous les questions> grades\n @sum = @survey.questions.all.sum(:grade)\n @survey.total_grade = @sum\n @survey.status = \"done\"\n @survey.save\n \n # update le total de l'event, la note global - somme des surveys \n update_event_total()\n event_status(@survey.event)\n flash[:success] = \"Le questionnaire vient d'être mis à jour.\"\n format.html { redirect_to event_path(@survey.event_id) } \n format.json { render :show, status: :ok, location: @survey }\n else\n flash.now[:warning] = \"Echec :\" + @survey.errors.full_messages.join(\" \")\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_survey.update(admin_survey_params)\n format.html { redirect_to @admin_survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_survey }\n else\n format.html { render :edit }\n format.json { render json: @admin_survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @question= Survey::Question.find(params[:question_id])\n\n @choice=Survey::Choice.new\n @choice.question=@question\n respond_to do |format|\n format.js\n format.html # new.html.erb\n format.json { render json: @survey_choice }\n end\n end",
"def set_smallsurvey\n @smallsurvey = Smallsurvey.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @survey = Survey.find_by_id(params[:survey_id])\n end",
"def index\n @survey_question_responses = SurveyQuestionResponse.all\n end",
"def update\n \n respond_to do |format|\n format.js {\n #if a request comes in as JS, we know its an AJAX call, so treat it as such. \n #the only AJAX call that is made to update is a vote, so we update the score\n new_vote = Vote.new(user_id: params[:current_user].to_i, question_id: @question.id, answer_id: nil, score: params[:votes].to_i)\n new_vote.save\n @score = Vote.where(question_id: @question.id).sum(:score)\n render :show\n }\n format.html {\n #an html request coming in to update is going to be a regular update from the form, so just update the question record\n if (@current_user.id == @question.user_id) || user_is_admin?\n @question.update(question_params)\n redirect_to course_path(Course.find(@question.course_id))\n else\n redirect_to courses_url\n end\n }\n end\n end",
"def update\n render_json_auto @survey.update_logic_control_rule(params[:id].to_i, params[:logic]) and return\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def update\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to surveys_path, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def start_questionnaire\n # bypassing the need for the user to select the survey - since we're launching with just one 'legislation'\n # When multiple legislations are available, this value will need to be provided by the form\n access_code = params[:survey_access_code] ||\n current_user.try(:default_jurisdiction) ||\n Survey::DEFAULT_ACCESS_CODE\n\n\n # if a dataset isn't supplied, create one for an authenticated user, or mock one for unauthenticated\n @dataset = Dataset.find_by_id(params[:dataset_id]) || (user_signed_in? ? current_user.datasets.create : Dataset.new)\n authorize! :update, @dataset\n\n # use the most recent survey\n @survey = Survey.where(:access_code => access_code).order(\"survey_version DESC\").first\n\n @response_set = ResponseSet.\n create(:survey => @survey,\n :user_id => current_user.try(:id),\n :dataset_id => @dataset.id\n )\n\n if @survey && @response_set\n session[:response_set_id] = current_user ? nil : @response_set.id\n\n if params[:source_response_set_id]\n source_response_set = ResponseSet.find(params[:source_response_set_id]) # TODO: ensure user has rights to copy the response set answers?\n @response_set.copy_answers_from_response_set!(source_response_set)\n end\n\n # flash[:notice] = t('surveyor.survey_started_success')\n redirect_to(surveyor.edit_my_survey_path(\n :survey_code => @survey.access_code, :response_set_code => @response_set.access_code))\n else\n flash[:notice] = t('surveyor.unable_to_find_that_legislation')\n redirect_to (user_signed_in? ? dashboard_path : root_path)\n end\n end",
"def show_only\n @options = {:show_all => true, :show_only => true, :action => 'show_answer', :validation => true}\n survey_id = params[:id].to_i\n @survey = Survey.and_questions.find(params[:id])\n @color = @survey.color\n @page_title = @survey.get_title\n # flash[:notice] = \"Denne side viser ikke et brugbart spørgeskema. Du har tilgang til besvarelser gennem journaler.\"\n render :template => 'surveys/show', :layout => \"layouts/jsurvey\"\n end",
"def survey\n expose Survey.create(@oauth_token, params[:challenge_id].strip, \n params[:data])\n end",
"def update\n respond_to do |format|\n if @smallsurvey.update(smallsurvey_params)\n format.html { redirect_to @smallsurvey, notice: 'Smallsurvey was successfully updated.' }\n format.json { render :show, status: :ok, location: @smallsurvey }\n else\n format.html { render :edit }\n format.json { render json: @smallsurvey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @page = Page.find(params[:id])\n questions = @presenter.all_questions_for_page(params[:id])\n questions.post(params[:answers], @answer_sheet)\n \n questions.save\n \n @elements = questions.elements\n \n # Save references\n if params[:reference].present?\n params[:reference].each do |id, values|\n ref = @answer_sheet.reference_sheets.find(id)\n # if the email address has changed, we have to trash the old reference answers\n ref.attributes = values\n ref.save(:validate => false)\n end\n end\n @presenter.active_page = nil\n @answer_sheet.touch\n respond_to do |format|\n format.js\n #format.html\n end\n end",
"def show\n @survey = Survey.find(@result.survey_id)\n end",
"def update\n @s = Script.find(params[:script_id], :include => [:questions])\n @interview = Interview.find(params[:id])\n\n if @interview.update_attributes(interview_params)\n render :text => 'Interview Saved'\n else\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end",
"def create\n authorize! :create_response, @survey\n @response_survey = @survey.responses.new(response_survey_params)\n @auto_vote = (params[:auto_vote] ? true : false)\n @response_survey.vote(current_user) if @auto_vote\n\n respond_to do |format|\n if @response_survey.save\n @reload = true if current_user && [email protected]_vote?(current_user)\n format.html { redirect_to :back }\n format.js\n format.json { render action: 'show', status: :created, location: @survey }\n else\n format.js\n format.html { render action: 'new' }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @survey = Survey.new\n 3.times do\n question = @survey.questions.build\n 4.times { question.choices.build }\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to root_url, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_survey_section\n @survey_section = SurveySection.find(params[:id])\n end",
"def set_survey_response\n @survey_response = SurveyResponse.find(params[:id])\n end",
"def show\n unless validate_user_for_survey\n redirect_to(main_app.root_path,\n flash: { notice: 'Sorry, You do not have access to this survey' })\n return\n end\n # The surveys are highly inaccessible via screen reader.\n # Disabling the javascript and css bypasses many of the UI features of\n # the surveys and puts all questions on display at once, but it is gets\n # around the accessibility probems.\n @accessibility_mode = true if params['accessibility'] == 'true'\n filter_inapplicable_question_groups\n render layout: 'surveys_minimal'\n end",
"def update\n\t\t@skin_survey = SkinSurvey.find params[:id]\n\t\t@skin_survey.update_attributes params[:skin_survey]\n\t\trespond_with @skin_survey\n\tend",
"def index\n @survey_instances = SurveyInstance.all\n end",
"def update\n @survey_question.update(survey_question_params)\n @survey_question = SurveyQuestion.new\n @survey_questions = SurveyQuestion.all \n # respond_to do |format|\n # if @survey_question.update(survey_question_params)\n # format.html { redirect_to @survey_question, notice: 'Survey question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @survey_question }\n # else\n # format.html { render :edit }\n # format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def show\n @user = User.find_by(id: params[:id])\n @surveys = @user.surveys.last(10)\n# @scores = surveys.map do |survey|\n# survey.calculate_footprint_by_category('food')\n# survey.calculate_footprint_by_category('transportation')\n# survey.calculate_footprint_by_category('lifestyle')\n# end\n\n if @user == current_user\n if request.xhr?\n # render :json => surveys\n else\n render 'show'\n end\n else\n redirect_to root_path\n end\n end",
"def update\n respond_to do |format|\n if @user_survey.update(user_survey_params)\n format.html { redirect_to @user_survey, notice: 'User survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_survey }\n else\n format.html { render :edit }\n format.json { render json: @user_survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @admin_surveys = Admin::Survey.all\n end",
"def update\n respond_to do |format|\n if @survey.update(update_survey_params)\n format.html { redirect_to survey_path(id: @survey.id), success: t('surveys.update') }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { redirect_to edit_survey_path(id: @survey.id), danger: @survey.errors.full_messages }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def goto_surveys\n goto_controller('Assignment Survey')\n end",
"def invite_to_survey\n @survey = current_organization.sponsored_surveys.find(params[:survey_id])\n @invitation = find_invitee_and_create_invitation(@survey)\n @invitation.send_invitation! if @invitation.valid?\n \n respond_to do |wants|\n wants.js\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@survey = Survey.new\n\t\trespond_to do |format|\n\t format.html {render html: new_survey_path}\n \t\tformat.json { render json: @survey }\n\t end\n\tend",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7150275",
"0.6779533",
"0.66367364",
"0.66367364",
"0.64643216",
"0.64399797",
"0.64377576",
"0.64189136",
"0.6370882",
"0.63076866",
"0.6300279",
"0.6299061",
"0.62817234",
"0.6221292",
"0.6205046",
"0.62032825",
"0.62008965",
"0.6194174",
"0.6185349",
"0.6176729",
"0.61694026",
"0.615985",
"0.6159389",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.6134732",
"0.61198145",
"0.61135024",
"0.61074436",
"0.6091243",
"0.60859364",
"0.60847044",
"0.60790765",
"0.60733134",
"0.60733134",
"0.60733134",
"0.60733134",
"0.60733134",
"0.60733134",
"0.6072965",
"0.607207",
"0.6060222",
"0.6059204",
"0.6034119",
"0.60286653",
"0.6028427",
"0.6027699",
"0.6007768",
"0.60065603",
"0.5996726",
"0.599201",
"0.599201",
"0.599201",
"0.599201",
"0.5988297",
"0.5981668",
"0.59793377",
"0.5976327",
"0.59729725",
"0.59729725",
"0.59729725",
"0.59729725",
"0.59729725",
"0.5964713",
"0.5957917",
"0.5952586",
"0.5948536",
"0.5942835",
"0.594039",
"0.5924544",
"0.59217376",
"0.59176564",
"0.59108955",
"0.5899554",
"0.58972335",
"0.58958447",
"0.58876085",
"0.5887394",
"0.58823174",
"0.5871319",
"0.58700234",
"0.5869458",
"0.58671325",
"0.58665055",
"0.5862978",
"0.5862492",
"0.5858692",
"0.58586484",
"0.58586484",
"0.585819",
"0.5857925",
"0.5854401"
] | 0.6160734 | 21 |
update survey_answer, journal_entry.answered_at, csv_survey_answers.age, csv_score_rapports.age | created_at, csv_answers.age | def update_date
entry = JournalEntry.find(params[:journal_entry][:id])
entry.follow_up = params[:journal_entry][:follow_up]
date_param = params[:journal_entry][:created]
if date_param.blank?
entry.save
flash[:notice] = "Opfølgning er rettet"
redirect_to journaL_path(entry.journal)
end
sep = date_param.include?("/") && "/" || date_param.include?("-") && "-"
d = date_param.split(sep).map {|p| p.to_i }
date = [d[2],d[1],d[0]]
created = Date.new(*date)
entry.update_date(created)
# age = ((created - entry.journal.birthdate).to_i / 365.25).floor
# entry.survey_answer.age = age
# entry.answered_at = created
# entry.save
# entry.survey_answer.created_at = created
# entry.survey_answer.save
# csv_score_rapport = CsvScoreRapport.find_by_survey_answer_id(entry.survey_answer_id)
# if csv_score_rapport
# csv_score_rapport.age = age if csv_score_rapport
# csv_score_rapport.created_at = created
# csv_score_rapport.save
# end
# csv_survey_answer = CsvSurveyAnswer.find_by_journal_entry_id(entry.id)
# if csv_survey_answer
# csv_survey_answer.created_at = created
# csv_survey_answer.age = age if csv_survey_answer
# csv_survey_answer.save
# end
# score_rapport = ScoreRapport.find_by_survey_answer_id(entry.survey_answer_id)
# if score_rapport
# score_rapport.age = age
# score_rapport.created_at = created
# score_rapport.save
# end
flash[:notice] = "Besvarelsesdato og opfølgning er rettet"
redirect_to journal_path(entry.journal)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateAnswer(ls,time)\n # ls is a list of list of answerd_factor_id, statistic_id pairs\n # t contains date information\n puts ls.inspect\n ls.each do |e|\n sid = e[0][1].to_i\n stat = Statistic.where(id: sid)\n\n amount = stat[0].EvalEquation(current_user.id, e)\n #if exists\n if Answer.where(user_id: current_user.id,statistic_id: sid,month: time[:month], year: time[:year]).first.present?\n Answer.where(user_id: current_user.id,statistic_id: sid,month: time[:month], year: time[:year]).first.update(:amount =>amount) #update the amount only\n else\n ans = Answer.where(amount: amount,user_id: current_user.id,statistic_id: sid,month: time[:month], year: time[:year]).create #otherwise create the field.\n end\n end\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n @create_time = args[:create_time] if args.key?(:create_time)\n @form_id = args[:form_id] if args.key?(:form_id)\n @last_submitted_time = args[:last_submitted_time] if args.key?(:last_submitted_time)\n @respondent_email = args[:respondent_email] if args.key?(:respondent_email)\n @response_id = args[:response_id] if args.key?(:response_id)\n @total_score = args[:total_score] if args.key?(:total_score)\n end",
"def update!(**args)\n @answers_value_gender = args[:answers_value_gender] if args.key?(:answers_value_gender)\n @num_answers = args[:num_answers] if args.key?(:num_answers)\n end",
"def update!(**args)\n @age_in_years = args[:age_in_years] if args.key?(:age_in_years)\n @age_of_consent_status = args[:age_of_consent_status] if args.key?(:age_of_consent_status)\n @age_range = args[:age_range] if args.key?(:age_range)\n @metadata = args[:metadata] if args.key?(:metadata)\n end",
"def update!(**args)\n @contentage_reliability = args[:contentage_reliability] if args.key?(:contentage_reliability)\n @date_exposure = args[:date_exposure] if args.key?(:date_exposure)\n @date_exposure_score = args[:date_exposure_score] if args.key?(:date_exposure_score)\n @date_vs_contentage_distribution_skew = args[:date_vs_contentage_distribution_skew] if args.key?(:date_vs_contentage_distribution_skew)\n @is_forum_qna_social_media_probability = args[:is_forum_qna_social_media_probability] if args.key?(:is_forum_qna_social_media_probability)\n @petacat_id = args[:petacat_id] if args.key?(:petacat_id)\n @unreliable_dates_score = args[:unreliable_dates_score] if args.key?(:unreliable_dates_score)\n end",
"def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @metadata = args[:metadata] if args.key?(:metadata)\n @query_record = args[:query_record] if args.key?(:query_record)\n @question = args[:question] if args.key?(:question)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @metadata = args[:metadata] if args.key?(:metadata)\n @query_record = args[:query_record] if args.key?(:query_record)\n @question = args[:question] if args.key?(:question)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @correct_answers = args[:correct_answers] if args.key?(:correct_answers)\n @general_feedback = args[:general_feedback] if args.key?(:general_feedback)\n @point_value = args[:point_value] if args.key?(:point_value)\n @when_right = args[:when_right] if args.key?(:when_right)\n @when_wrong = args[:when_wrong] if args.key?(:when_wrong)\n end",
"def update!(**args)\n @choice_question = args[:choice_question] if args.key?(:choice_question)\n @date_question = args[:date_question] if args.key?(:date_question)\n @file_upload_question = args[:file_upload_question] if args.key?(:file_upload_question)\n @grading = args[:grading] if args.key?(:grading)\n @question_id = args[:question_id] if args.key?(:question_id)\n @required = args[:required] if args.key?(:required)\n @row_question = args[:row_question] if args.key?(:row_question)\n @scale_question = args[:scale_question] if args.key?(:scale_question)\n @text_question = args[:text_question] if args.key?(:text_question)\n @time_question = args[:time_question] if args.key?(:time_question)\n end",
"def update\n puts params\n @question = Question.find(params[:id])\n if params[:commit] == 'Answer'\n @question.resolved = true\n @question.end_time = Time.now\n @question.username = current_user.email.split('@')[0]\n if @question.update(update_question_params)\n redirect_to solve_path\n end\n end\n\n if params[:commit] == 'Escalate'\n @question.escalated = true\n @escalate = @question.escalatings.create();\n @question.save\n @escalate.username = current_user.email.split('@')[0]\n @escalate.save\n redirect_to solve_path\n end \n \n end",
"def update!(**args)\n @edit_distance_ratio_stats = args[:edit_distance_ratio_stats] if args.key?(:edit_distance_ratio_stats)\n @edit_distance_stats = args[:edit_distance_stats] if args.key?(:edit_distance_stats)\n @matched_description_anchors_timegap_stats = args[:matched_description_anchors_timegap_stats] if args.key?(:matched_description_anchors_timegap_stats)\n @num_description_anchors = args[:num_description_anchors] if args.key?(:num_description_anchors)\n end",
"def update(file, survey_ids, team_id, follow_up = 0, couple = {}, do_save = false)\n\t\tputs \"no survey_ids given\" and return if !survey_ids.any?\n\t\tputs \"invalid follow_up: #{follow_up}\" and return if follow_up.to_i < 0\n\t\tputs \"invalid coupling: #{couple.inspect}\" and return if !couple.is_a?(Hash)\n\t\t\n\t\tsurveys = Survey.find(survey_ids)\n\t\tgroup = Group.find(team_id)\n\t\tcenter = group.center\n\n\t\ti = 1\n\t\tCSV.foreach(file, :headers => true, :col_sep => \";\", :row_sep => :auto) do |row|\n\t\t\tputs \"Row: #{i} #{row}\"\n\t\t\tnext if row.blank?\n\n\t\t\talt_id = row[\"alt_id\"] || row[\"Graviditetsid\"]\n\t\t\tb = row[\"birthdate\"]\n\t\t\tjournal_name = row[\"journalnavn\"] || row[\"Bnavn\"] || row[\"Navn\"]\n\t\t\tparent_name = row[\"Mnavn\"]\n\t\t\tparent_mail = row[\"Email\"] || row[\"E-mail\"]\n\t\t\tsex = row[\"gender\"] || row[\"Gender\"]\n\t\t\tsex = sex == \"d\" || sex == \"M\" || sex == \"1\" || sex == \"Dreng\" && 1 || 2\n\t\t\tnotes = row[\"Notes\"] || row[\"Noter\"] || row[\"notes\"] || row[\"noter\"]\n\t\t\tputs \"#{journal_name}: #{alt_id} #{b} sex: #{sex}\"\n\t\t\t# next\n\n\t\t\thas_twins = Journal.where(:alt_id => alt_id, :group_id => 9259).count > 1\n\n\t\t\tputs \"journal: #{journal_name}, has_twins: #{has_twins}, notes: #{notes}\"\n\t\t\tjournal = Journal.find_by_alt_id_and_group_id(alt_id, team_id)\n\t\t\tif has_twins\n\t\t\t\tputs \"TWINS: #{journal_name} #{alt_id}\"\n\t\t\t\tjournal = Journal.find_by_alt_id_and_title_and_group_id(alt_id, journal_name, team_id)\n\t\t\t\tif journal.nil?\n\t\t\t\t\tputs \"Could not find twin, check name: #{journal_name}\"\n\t\t\t\t\traise \"journal error\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tputs \"birthdate: #{b}\"\n\t\t\tbirthdate = b && get_date(b) || journal.birthdate\n\n\t\t\tif birthdate.blank?\n\t\t\t\tputs \"ERROR: no birthdate: #{row}\"\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\traise \"DateError: #{birthdate} row: #{row.inspect}\" if birthdate.year < 1980\n\n\t\t\tputs \"birthdate: #{birthdate}\"\n\t\t\targs = {\n\t\t\t\t:title => journal_name, :group_id => group.id, :center_id => group.center_id,\n\t\t\t\t:birthdate => birthdate, :parent_email => parent_mail,\n\t\t\t\t:parent_name => parent_name, :alt_id => alt_id, :nationality => \"Dansk\", :sex => sex\n\t\t\t}\n\t\t\targs[:parent_name] = parent_name unless parent_name.nil?\n\t\t\tjournal.sex = sex if journal\n\t\t\tif notes\n\t\t\t\tjournal.notes ||= \"\" \n\t\t\t\tjournal.notes += notes\n\t\t\tend\n\t\t\tjournal.update_attributes(args) if journal\n\n\t\t\tif !journal\n\t\t\t\targs[:code] = center.next_journal_code\n\t\t\t\tjournal = Journal.new(args)\n\t\t\t\tputs journal.errors.inspect if !journal.valid?\n\t\t\t\tif do_save\n\t\t\t\t\tjournal.save\n\t\t\t\t\tputs \"Saved journal: #{journal.id} #{journal.title}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tjournal.title = args[:title]\n\t\t\t\tjournal.parent_email = args[:parent_mail]\n\t\t\t\tjournal.birthdate = args[:birthdate]\n\t\t\t\tif do_save\n\t\t\t\t\tjournal.save\n\t\t\t\t\tputs \"Saved journal: #{journal.id} #{journal.title}\"\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\tnew_entries = add_surveys_and_entries(journal, surveys, follow_up, do_save)\n\t\t\tputs \"GOT entries: #{new_entries.inspect}\"\n\t\t\tconnect_entries(new_entries, couple, do_save) unless couple.blank? && do_save\n\n\t\t\ti = i + 1\n\t\tend\n\n\t\tupdate_email(file, team_id, do_save)\n\tend",
"def update\n puts \"hey, we're updating.\"\n\n scan_procedure_array = []\n scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)\n hide_date_flag_array = []\n hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)\n @hide_page_flag = 'N'\n if hide_date_flag_array.count > 0\n @hide_page_flag = 'Y'\n end\n\n @lumbarpuncture = Lumbarpuncture.where(\"lumbarpunctures.appointment_id in (select appointments.id from appointments,scan_procedures_vgroups where \n appointments.vgroup_id = scan_procedures_vgroups.vgroup_id \n and scan_procedure_id in (?))\", scan_procedure_array).find(lumbarpuncture_params[:lumbarpuncture][:id])\n\n\n\n # puts \"lp date params: #{lumbarpuncture_params[:date]}\"\n appointment_date = nil\n if !lumbarpuncture_params[:appointment][\"#{'appointment_date'}(1i)\"].blank? && !lumbarpuncture_params[:appointment][\"#{'appointment_date'}(2i)\"].blank? && !lumbarpuncture_params[:appointment][\"#{'appointment_date'}(3i)\"].blank?\n appointment_date = params[:appointment][\"#{'appointment_date'}(1i)\"] +\"-\"+lumbarpuncture_params[:appointment][\"#{'appointment_date'}(2i)\"].rjust(2,\"0\")+\"-\"+lumbarpuncture_params[:appointment][\"#{'appointment_date'}(3i)\"].rjust(2,\"0\")\n end\n \n # ok to update vitals even if other update fail\n if !vitals_params[:vital_id].blank?\n @vital = Vital.find(vitals_params[:vital_id])\n @vital.pulse = vitals_params[:pulse]\n @vital.bp_systol = vitals_params[:bp_systol]\n @vital.bp_diastol = vitals_params[:bp_diastol]\n @vital.bloodglucose = vitals_params[:bloodglucose]\n @vital.save\n else\n @vital = Vital.new\n @vital.appointment_id = @lumbarpuncture.appointment_id\n @vital.pulse = vitals_params[:pulse]\n @vital.bp_systol = vitals_params[:bp_systol]\n @vital.bp_diastol = vitals_params[:bp_diastol]\n @vital.bloodglucose = vitals_params[:bloodglucose]\n @vital.save \n end\n \n if !lumbarpuncture_params[:lookup_lumbarpuncture_id].blank?\n LookupLumbarpuncture.all.each do |lookup_lp|\n val = nil\n val = lumbarpuncture_params[:lookup_lumbarpuncture_id][lookup_lp.id.to_s].to_s\n if val.blank?\n val = \"0\" # not sure why \"\" not going to 0\n end\n sql = \"INSERT INTO lumbarpuncture_results (lumbarpuncture_id,lookup_lumbarpuncture_id,value) VALUES (\"[email protected]_s+\",\"+lookup_lp.id.to_s+\",'\"+val+\"')\n ON DUPLICATE KEY UPDATE value='\"+val+\"' \"\n ActiveRecord::Base.connection.insert sql\n \n # insert or update?\n end\n else\n # update to null or delete?\n end\n\n lp_params = lumbarpuncture_params[:lumbarpuncture]\n\n lp_params[:lpstarttime_time]= \"#{lumbarpuncture_params[:time_fields][:lpstarttime_time][:hour].to_s.rjust(2,'0')}:#{lumbarpuncture_params[:time_fields][:lpstarttime_time][:minute].to_s.rjust(2,'0')}\"\n lp_params[:lpfluidstarttime_time]= \"#{lumbarpuncture_params[:time_fields][:lpfluidstarttime_time][:hour].to_s.rjust(2,'0')}:#{lumbarpuncture_params[:time_fields][:lpfluidstarttime_time][:minute].to_s.rjust(2,'0')}\"\n lp_params[:lpendtime_time]= \"#{lumbarpuncture_params[:time_fields][:lpendtime_time][:hour].to_s.rjust(2,'0')}:#{lumbarpuncture_params[:time_fields][:lpendtime_time][:minute].to_s.rjust(2,'0')}\"\n\n # puts \"final params: #{lp_params}\"\n\n respond_to do |format|\n\n if @lumbarpuncture.update(lp_params)#params[:lumbarpuncture], :without_protection => true)\n \n @appointment = Appointment.find(@lumbarpuncture.appointment_id)\n @vgroup = Vgroup.find(@appointment.vgroup_id)\n @appointment.comment = params[:appointment][:comment]\n if !params[:appointment].nil? and !params[:appointment][:appointment_coordinator].nil?\n @appointment.appointment_coordinator = params[:appointment][:appointment_coordinator]\n end\n @appointment.appointment_date =appointment_date\n if [email protected]_id.blank?\n @participant = Participant.find(@vgroup.participant_id)\n if [email protected]?\n @appointment.age_at_appointment = ((@appointment.appointment_date - @participant.dob)/365.25).round(2)\n end\n end\n @appointment.save\n @vgroup.completedlumbarpuncture = 'yes'\n @vgroup.save\n \n \n\n format.html { redirect_to(@lumbarpuncture, :notice => 'Lumbarpuncture was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lumbarpuncture.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @file_upload_answers = args[:file_upload_answers] if args.key?(:file_upload_answers)\n @grade = args[:grade] if args.key?(:grade)\n @question_id = args[:question_id] if args.key?(:question_id)\n @text_answers = args[:text_answers] if args.key?(:text_answers)\n end",
"def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n @descartes_dot_score = args[:descartes_dot_score] if args.key?(:descartes_dot_score)\n @descartes_ranking_score = args[:descartes_ranking_score] if args.key?(:descartes_ranking_score)\n @dolphin_model_type = args[:dolphin_model_type] if args.key?(:dolphin_model_type)\n @dolphin_score = args[:dolphin_score] if args.key?(:dolphin_score)\n @edit_distance = args[:edit_distance] if args.key?(:edit_distance)\n @end_ms = args[:end_ms] if args.key?(:end_ms)\n @ensemble_score = args[:ensemble_score] if args.key?(:ensemble_score)\n @is_duplicate_of_title = args[:is_duplicate_of_title] if args.key?(:is_duplicate_of_title)\n @neon_score = args[:neon_score] if args.key?(:neon_score)\n @pointwise_normalized_gap_score = args[:pointwise_normalized_gap_score] if args.key?(:pointwise_normalized_gap_score)\n @qbst_score = args[:qbst_score] if args.key?(:qbst_score)\n @query_count = args[:query_count] if args.key?(:query_count)\n @query_doc_count = args[:query_doc_count] if args.key?(:query_doc_count)\n @question = args[:question] if args.key?(:question)\n @question_title_similarity = args[:question_title_similarity] if args.key?(:question_title_similarity)\n @question_type = args[:question_type] if args.key?(:question_type)\n @start_ms = args[:start_ms] if args.key?(:start_ms)\n @video_duration_ms = args[:video_duration_ms] if args.key?(:video_duration_ms)\n @video_title = args[:video_title] if args.key?(:video_title)\n @webref_mid = args[:webref_mid] if args.key?(:webref_mid)\n @webref_topicality_score = args[:webref_topicality_score] if args.key?(:webref_topicality_score)\n end",
"def update\n @answer_sheet = AnswerSheet.find(params[:id])\n @group = Group.find(params[:group_id])\n @survey = @group.surveys.find(params[:survey_id])\n\n # XXX: Added for quick updating of answer_sheet (dec 11, 2011)\n @answer_sheet.answer_sheet_properties.each do |p|\n pid = \"property_\" + p.id.to_s\n if !params[pid].nil?\n\tp.ocr_value = params[pid]\n\tp.save\n end\n end\n\n if @answer_sheet.update_attributes(params[:answer_sheet])\n redirect_to group_survey_answer_sheet_url(@group, @survey, @answer_sheet)\n else\n render :action => \"edit\"\n end\n end",
"def update\n raise \"need to provide the 'invitation_uuid' param\" unless params[:invitation_uuid]\n raise \"need to provide the 'answers' param\" unless params[:answers]\n raise \"need to provide the 'ways_to_communicate' param\" unless params[:ways_to_communicate]\n raise \"need to provide the 'good_times' param\" unless params[:good_times]\n\n # \"answers\"=>{\"2e6ef486-71da-4a55-a964-bc3d35b68905\"=>\"\", \"6998baeb-8137-46bf-a19c-203516e46f48\"=>\"\", \"bba75480-701b-4bca-bbd4-f9a26837897f\"=>\"\"}, \n # \"ways_to_communicate\"=>\"person phone text social email\", \n # \"invitation_uuid\"=>\"4fc4d329-be71-48bd-b318-d1dbfcff4533\", \n # \"good_times\"=>\"\", \n # \"id\"=>\"7228a166-b7fd-44d5-bef5-3473c9c44080\"}\n\n invitation = Invitation.find_by_uuid(params[:invitation_uuid])\n subject = invitation.sender\n raise \"Couldn't find the subject user\" unless subject\n subject_enrollment = subject.current_enrollment\n\n assessment = ThreeSixtyAssessment.find_unexpired_and_incomplete_assessment(subject_enrollment, invitation.recipient)\n raise \"Couldn't find the assessment for enrollment uuid #{@subject.enrollment_uuid} and recipient_identifier #{invitation.recipient_identifier}\" unless assessment\n\n # just stored as a list of the symbol values. See: ThreeSixtyAssessment.WAYS_TO_COMMUNICATE\n ways_to_communicate = params[:ways_to_communicate]\n good_times = params[:good_times]\n\n if sup = assessment.supplimental_answers.where(respondent_identifier:invitation.recipient).last\n sup.update_attributes!(ways_to_communicate:ways_to_communicate, good_times:good_times)\n else\n assessment.supplimental_answers.create!(respondent_identifier:invitation.recipient, ways_to_communicate:ways_to_communicate, good_times:good_times)\n end\n\n\n params[:answers].each do |question_uuid, answer|\n logger.info \" ANSWER: question_uuid:#{question_uuid} answer:#{answer}\"\n # next if answer == \"\" # bypass enpty answers\n\n check = Check.find_by_uuid(question_uuid)\n throw \"you must provide the uuid of the question (aka check)\" unless check\n\n assessment.responses.create!(check_uuid:check.uuid, value:answer, respondent_identifier:invitation.recipient)\n end\n\n # if we get here, then the assessment must be complete (right now, exceptions are thrown)\n track_event(current_enrollment, :completed_360_assessment, target:assessment)\n render text:\"ok\"\n rescue Exception => e\n logger.error(\"THREE SIXTY ERROR: #{e.message}\")\n raise e # TODO remove the raise when dev is stable\n #render text:\"Error: #{e.message}\"\n end",
"def update!(**args)\n @answer_order = args[:answer_order] if args.key?(:answer_order)\n @answers = args[:answers] if args.key?(:answers)\n @has_other = args[:has_other] if args.key?(:has_other)\n @high_value_label = args[:high_value_label] if args.key?(:high_value_label)\n @images = args[:images] if args.key?(:images)\n @last_answer_position_pinned = args[:last_answer_position_pinned] if args.key?(:last_answer_position_pinned)\n @low_value_label = args[:low_value_label] if args.key?(:low_value_label)\n @must_pick_suggestion = args[:must_pick_suggestion] if args.key?(:must_pick_suggestion)\n @num_stars = args[:num_stars] if args.key?(:num_stars)\n @open_text_placeholder = args[:open_text_placeholder] if args.key?(:open_text_placeholder)\n @open_text_suggestions = args[:open_text_suggestions] if args.key?(:open_text_suggestions)\n @question = args[:question] if args.key?(:question)\n @sentiment_text = args[:sentiment_text] if args.key?(:sentiment_text)\n @single_line_response = args[:single_line_response] if args.key?(:single_line_response)\n @threshold_answers = args[:threshold_answers] if args.key?(:threshold_answers)\n @type = args[:type] if args.key?(:type)\n @unit_of_measurement_label = args[:unit_of_measurement_label] if args.key?(:unit_of_measurement_label)\n @video_id = args[:video_id] if args.key?(:video_id)\n end",
"def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end",
"def update\n scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)\n# @participant = Participant.where(\" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in\n# (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) \", scan_procedure_array).find(params[:id])\n @participant = Participant.where(\" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups\n where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) \", scan_procedure_array).find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n sql = \"update participants set wrapnum = NULL where trim(wrapnum) = '' \"\n connection = ActiveRecord::Base.connection();\n results = connection.execute(sql)\n sql = \"update participants set reggieid = NULL where trim(reggieid) = '' \"\n results = connection.execute(sql)\n if @participant.dob > 365.days.ago.to_date # form is setting a default date of today sometimes\n @participant.dob = nil\n @participant.save\n end\n if [email protected]?\n @appointments = Appointment.where(\"appointments.vgroup_id in (select vgroups.id from vgroups where participant_id is not null and participant_id in (?))\", params[:id])\n @appointments.each do |appt|\n appt.age_at_appointment = ((appt.appointment_date - @participant.dob)/365.25).floor\n appt.save\n end\n end\n \n flash[:notice] = 'Participant was successfully updated.'\n format.html { redirect_to(@participant) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)\n# @participant = Participant.where(\" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_visit_memberships.enrollment_id from enrollment_visit_memberships where enrollment_visit_memberships.visit_id in\n# (select visit_id from scan_procedures_visits where scan_procedure_id in (?)))) \", scan_procedure_array).find(params[:id])\n @participant = Participant.where(\" participants.id in ( select participant_id from enrollments where enrollments.id in (select enrollment_vgroup_memberships.enrollment_id from enrollment_vgroup_memberships, scan_procedures_vgroups\n where enrollment_vgroup_memberships.vgroup_id = scan_procedures_vgroups.vgroup_id and scan_procedures_vgroups.scan_procedure_id in (?))) \", scan_procedure_array).find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n sql = \"update participants set wrapnum = NULL where trim(wrapnum) = '' \"\n connection = ActiveRecord::Base.connection();\n results = connection.execute(sql)\n sql = \"update participants set reggieid = NULL where trim(reggieid) = '' \"\n results = connection.execute(sql)\n if @participant.dob > 365.days.ago.to_date # form is setting a default date of today sometimes\n @participant.dob = nil\n @participant.save\n end\n if [email protected]?\n @appointments = Appointment.where(\"appointments.vgroup_id in (select vgroups.id from vgroups where participant_id is not null and participant_id in (?))\", params[:id])\n @appointments.each do |appt|\n appt.age_at_appointment = ((appt.appointment_date - @participant.dob)/365.25).floor\n appt.save\n end\n end\n \n flash[:notice] = 'Participant was successfully updated.'\n format.html { redirect_to(@participant) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_answers\n last_user_answers.each do |lua|\n lua.correct= (lua.response.to_f == self.response.to_f)\n lua.save!\n end\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answer = args[:answer] if args.key?(:answer)\n @faq_question = args[:faq_question] if args.key?(:faq_question)\n @match_confidence = args[:match_confidence] if args.key?(:match_confidence)\n @match_confidence_level = args[:match_confidence_level] if args.key?(:match_confidence_level)\n @source = args[:source] if args.key?(:source)\n end",
"def update!(**args)\n @petacat_scores = args[:petacat_scores] if args.key?(:petacat_scores)\n @unreliable_dates_score = args[:unreliable_dates_score] if args.key?(:unreliable_dates_score)\n @unreliable_dates_score_exposure_adjusted = args[:unreliable_dates_score_exposure_adjusted] if args.key?(:unreliable_dates_score_exposure_adjusted)\n end",
"def update\n #raise params.inspect\n @survey_report = SurveyReport.find(params[:id])\n \n respond_to do |format|\n if @survey_report.update_attributes(params[:survey_report])\n\n #raise params[:survey_report][:source_location].inspect\n @code = @survey_report[:water_source_code].split(\"/\")\n @code1 = @code[3].split(\"-\")\n @village = Admin::Village.where('village_name = ? ' , @code1[0])\n @grampanchayat = Admin::Grampanchyat.where('gram_name = ?', @code1[0])\n @habitation = Admin::Habitation.where('habitation_name = ?', @code1[1] )\n #raise @habitation.inspect\n\n if ((@grampanchayat.present? or @village.present?) and @habitation.present?)\n @survey_report.update_column(:district_level_status, 0)\n else \n @survey_report.update_column(:district_level_status, 1) \n end\n\n format.html { redirect_to @survey_report, notice: 'Survey report was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_report.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def update()\n sql = \"UPDATE members SET (name, age) = ($1, $2) WHERE id = $3\"\n values = [@name, @age, @id]\n SqlRunner.run(sql, values)\n end",
"def update\n if @submission.Scores == \"Not submitted\"\n\t\t\t# end time\n\t\t\tdate=DateTime.now\n\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t# if within time limit\n\t\t\tif date.to_time < @submission.SubmittedAt.to_time + @assessment.Duration.minutes + 5.seconds\n\t\t\t\tparms = {\"Duration\"=>(([email protected]_time)).to_i}\n\t\t\t\tscores = []\n\t\t\t\tanswers = []\n\t\t\t\t@questions = Question.where(assessment_id: @submission.assessment_id).order(:id)\n\t\t\t\t@assessment = Assessment.find(@submission.assessment_id)\n\t\t\t\t# if assessment exists\n\t\t\t\tif @assessment\n\t\t\t\t\tuser = User.find(@assessment.user_id)\n\t\t\t\t\t@creator = user.Fname + \" \" + user.Lname\n\t\t\t\tend\n\t\t\t\t# for every question of the assessment\n\t\t\t\tfor question in @questions\n\t\t\t\t\tcase question.Type\n\t\t\t\t\t# if multiple choice\n\t\t\t\t\twhen \"MCQ\"\n\t\t\t\t\t\tanswer = params[(\"MCQRadios-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# get the percentage value of that answer\n\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(answer)+answer.length+1..question.Answer.index(answer)+question.Answer[question.Answer.index(answer)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t# set the quesiton score\n\t\t\t\t\t\t\tqScore=question.Points*value/100\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if multiple answer\n\t\t\t\t\twhen \"MA\"\n\t\t\t\t\t\tanswer = params[(\"MACheckboxes-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\twrong = false\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# for each selected answer\n\t\t\t\t\t\t\tfor check in answer\n\t\t\t\t\t\t\t\t# check if wrong answer was chosen\n\t\t\t\t\t\t\t\tif wrong == false\n\t\t\t\t\t\t\t\t\tvalue = question.Answer[question.Answer.index(check)+check.length+1..question.Answer.index(check)+question.Answer[question.Answer.index(check)..].index(\"%\")-1].to_i\n\t\t\t\t\t\t\t\t\t# if answer was wrong\n\t\t\t\t\t\t\t\t\tif value == 0\n\t\t\t\t\t\t\t\t\t\twrong = true\n\t\t\t\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t# update question score\n\t\t\t\t\t\t\t\t\tqScore+=question.Points*value/100\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t# fix the score for questions with no partial marking\n\t\t\t\t\t\t\tif question.Answer.scan(/(?=100)/).count != 0\n\t\t\t\t\t\t\t\tqScore /= question.Answer.scan(/(?=100)/).count\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if partial marking was not active and the answer is not complete\n\t\t\t\t\t\tif question.Options.include?(\"PAR0\") && qScore != question.Points\n\t\t\t\t\t\t\tqScore = 0\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..question.Options.index(\"P\")-1].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t# if fill the blank\n\t\t\t\t\twhen \"FTB\"\n\t\t\t\t\t\tanswer = params[(\"FTBAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tanswerCopy = answer\n\t\t\t\t\t\ttargetAnswer = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t#if the answer is not case sensitive act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CAS0\")\n\t\t\t\t\t\t\t\ttargetAnswer = targetAnswer.upcase\n\t\t\t\t\t\t\t\tanswerCopy = answerCopy.upcase\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if multiple spaces are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"MUL1\")\n\t\t\t\t\t\t\t\tanswerCopy = answer.squeeze().strip\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t#if answers that contain the correct answer are allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"CON1\")\n\t\t\t\t\t\t\t\tif answerCopy.include?(targetAnswer)\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif answerCopy == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answerCopy != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if true false\n\t\t\t\t\twhen \"TF\"\n\t\t\t\t\t\tanswer = params[(\"TFRadio-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif question.Answer.include?(answer)\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if regular expression\n\t\t\t\t\twhen \"REG\"\n\t\t\t\t\t\tanswer = params[(\"REGAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tregex = Regexp.new question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if the answer was correct\n\t\t\t\t\t\t\tif !(answer =~ regex).nil?\n\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\t# if formula\n\t\t\t\t\twhen \"FRM\"\n\t\t\t\t\t\tvalues = eval(params[(\"FRMvalues-\"[email protected](question).to_s).to_sym])\n\t\t\t\t\t\tformula = question.Answer[question.Answer.index(\"〔\")+1..question.Answer.index(\"〕\")-1]\n\t\t\t\t\t\t# calculate the correct answer with the student variable values\n\t\t\t\t\t\tfor val in values\n\t\t\t\t\t\t\tkey, value = val\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.upcase + \"]\",value.to_s)\n\t\t\t\t\t\t\tformula = formula.gsub(\"[\" + key.downcase + \"]\",value.to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# round it\n\t\t\t\t\t\ttargetAnswer = eval(formula+\".to_f\").round(2)\n\t\t\t\t\t\tanswer = params[(\"FRMAnswer-\"[email protected](question).to_s).to_sym]\n\t\t\t\t\t\tqScore=0\n\t\t\t\t\t\t# if there was an answer\n\t\t\t\t\t\tif answer != nil\n\t\t\t\t\t\t\t# if answer error was allowed act accordingly\n\t\t\t\t\t\t\tif question.Options.include?(\"RAN1\")\n\t\t\t\t\t\t\t\trange = question.Options[question.Options.index(\"RAN1\")+5..].to_f\n\t\t\t\t\t\t\t\t# if within range\n\t\t\t\t\t\t\t\tif answer.to_f >= targetAnswer-range && answer.to_f <= targetAnswer+range\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# if answer mathces\n\t\t\t\t\t\t\t\tif answer.to_f == targetAnswer\n\t\t\t\t\t\t\t\t\tqScore = question.Points\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# if negatime marking was active apply it\n\t\t\t\t\t\tif qScore == 0 && question.Options.include?(\"NEG1\") && answer != nil\n\t\t\t\t\t\t\tqScore -= question.Options[5..].to_i\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# add score and answer to their respective array\n\t\t\t\t\t\tscores << qScore\n\t\t\t\t\t\tanswers << answer\n\t\t\t\t\tend\n\t\t\t\t\t# set the scores and answers parameters\n\t\t\t\t\tparms[\"Scores\"] = scores\n\t\t\t\t\tparms[\"Answers\"] = answers\n\t\t\t\tend\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @submission.update(parms)\n\t\t\t\t\t\[email protected]_submission_results(@assessment, @questions, @creator)\n\t\t\t\t\t\tformat.html { redirect_to \"/submissions/received\" }\n\t\t\t\t\t\tformat.json { redirect_to \"/submissions/received\" }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render :edit, status: :unprocessable_entity }\n\t\t\t\t\t\tformat.json { render json: @submission.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tredirect_to root_url\n\t\t\tend\n\t\telse\n\t\t\tredirect_to \"/submissions/duplicate\", :error => 'Failed to record the submission.'\n\t\tend\n end",
"def export_survey_answers(csv_survey_answers, survey_id)\n survey = Survey.find(survey_id)\n header = journal_csv_header.keys + ['follow_up'] + survey.variables.map {|v| v.var}\n \n csv_rows = csv_survey_answers.inject([]) do |rows,csa|\n puts \"csa.journal.nil? #{csa.inspect} #{csa.journal.inspect} sa: #{csa.survey_answer.inspect}\" if csa.journal.nil?\n\n journal_entry = JournalEntry.where(\n survey_answer_id: csa.survey_answer_id,\n center_id: csa.center_id, \n group_id: csa.team_id).first\n info = \n if !journal_entry.nil? && journal_entry.answer_info\n journal_entry.answer_info.split(\";\")\n elsif csa.journal_info\n csa.journal_info.split(\";;\")\n elsif csa.survey_answer\n csa.survey_answer.info.values\n else\n puts \"no answer_info found in journal_entry or survey_answer: #{csa.inspect} je: #{csa.journal_entry.inspect}\"\n [\"ingen info: sa_id: #{csa.survey_answer_id} csa: #{csa.inspect} \"]\n end\n\n if !csa || !csa.answer\n puts \"No csa: #{info.inspect}\"\n end\n rows << info + [FollowUp.to_value(csa.follow_up)] + (csa && csa.answer && csa.answer.split(';;') || [] )\n rows\n end\n\n output = CSV.generate(:col_sep => \";\", :row_sep => :auto, :encoding => 'utf-8') do |csv_output|\n csv_output << header\n csv_rows.each { |line| csv_output << line }\n end\n end",
"def update_personal_ratings(user_id, movie_id = nil)\n\n# criteria = Array.new\n# criteria << \"movie_id = %d\" % movie_id if movie_id\n# criteria << \"user_id = %d\" % user_id if user_id\n# w = criteria.blank? ? \"\" : \"where \" + criteria.join(\" and \")\n# sql = \"Delete from `personal_ratings` %s\" % w\n# ActiveRecord::Base.connection.execute(sql)\n\n\n criteria = Array.new\n criteria << \"votes.movie_id = %d\" % movie_id if movie_id\n criteria << \"twins.user_id = %d\" % user_id if user_id\n w = criteria.blank? ? \"\" : \"where \" + criteria.join(\" and \")\n power = 2\n rating_order_power = 1.5\n\n sql = \"REPLACE INTO `personal_ratings`\n(`user_id`,`movie_id`,`updated_at`,\n`l9_rating`,`l8_rating`,`l7_rating`,`l6_rating`,`l5_rating`,\n`l4_rating`,`l3_rating`,`l2_rating`,`l1_rating`,\n`l9_votes`,`l8_votes`,`l7_votes`,`l6_votes`,`l5_votes`,\n`l4_votes`,`l3_votes`,`l2_votes`,`l1_votes`,\n`best_rating`, `best_rating_votes_level`, `best_rating_order`,`total_votes`,\n`watched`\n)\nselect t.user_id, t.movie_id, CURRENT_TIMESTAMP,\nsum(l9_rating),sum(l8_rating),sum(l7_rating),sum(l6_rating),sum(l5_rating),\nsum(l4_rating),sum(l3_rating),sum(l2_rating),sum(l1_rating),\nsum(l9_votes),sum(l8_votes),sum(l7_votes),sum(l6_votes),sum(l5_votes),\nsum(l4_votes),sum(l3_votes),sum(l2_votes),sum(l1_votes),\nsum(rating_points_sum)/sum(vote_points_sum),\n\nif(sum(votes) > 20, ln(sum(votes)), -15),\n\nPower(sum(rating_points_sum)/sum(vote_points_sum), #{rating_order_power} ) +\nif(sum(votes) > 20, ln(sum(votes)), -15),\n\nsum(votes),\nmine.rating is not null\n\nfrom (\n select twins.user_id as user_id,\n votes.movie_id as movie_id, level as level,\n avg(rating) as rating, count(*) as votes,\n Power(10-level, ln(count(*))/ln(2.5)) * count(*) * avg(rating) as rating_points_sum,\n Power(10-level, ln(count(*))/ln(2.5)) * count(*) as vote_points_sum,\n ln(count(*))/ln(2.5) as power,\n case level when 9 then avg(rating) end as l9_rating,\n case level when 8 then avg(rating) end as l8_rating,\n case level when 7 then avg(rating) end as l7_rating,\n case level when 6 then avg(rating) end as l6_rating,\n case level when 5 then avg(rating) end as l5_rating,\n case level when 4 then avg(rating) end as l4_rating,\n case level when 3 then avg(rating) end as l3_rating,\n case level when 2 then avg(rating) end as l2_rating,\n case level when 1 then avg(rating) end as l1_rating,\n case level when 9 then count(*) end as l9_votes,\n case level when 8 then count(*) end as l8_votes,\n case level when 7 then count(*) end as l7_votes,\n case level when 6 then count(*) end as l6_votes,\n case level when 5 then count(*) end as l5_votes,\n case level when 4 then count(*) end as l4_votes,\n case level when 3 then count(*) end as l3_votes,\n case level when 2 then count(*) end as l2_votes,\n case level when 1 then count(*) end as l1_votes\n from user_twins as twins join user_votes as votes\n on twins.twin_id = votes.user_id\n %s\n group by twins.user_id, twins.level, votes.movie_id\n) as t\nleft outer join user_votes as mine on\nmine.user_id = t.user_id and mine.movie_id = t.movie_id\ngroup by user_id, movie_id\" % w\n ActiveRecord::Base.connection.execute(sql)\n\n # don't update for a single movie\n if not movie_id\n user = User.find(user_id)\n user.personal_ratings_updated_at = Time.new\n user.save\n end\n end",
"def update!(**args)\n @blog_data = args[:blog_data] if args.key?(:blog_data)\n @book_citation_data = args[:book_citation_data] if args.key?(:book_citation_data)\n @deprecated_author_obfuscated_gaia = args[:deprecated_author_obfuscated_gaia] if args.key?(:deprecated_author_obfuscated_gaia)\n @deprecated_quarantine_whitelist = args[:deprecated_quarantine_whitelist] if args.key?(:deprecated_quarantine_whitelist)\n @doc_level_spam_score = args[:doc_level_spam_score] if args.key?(:doc_level_spam_score)\n @event = args[:event] if args.key?(:event)\n @gibberish_score = args[:gibberish_score] if args.key?(:gibberish_score)\n @groups_data = args[:groups_data] if args.key?(:groups_data)\n @is_anchor_bayes_spam = args[:is_anchor_bayes_spam] if args.key?(:is_anchor_bayes_spam)\n @keyword_stuffing_score = args[:keyword_stuffing_score] if args.key?(:keyword_stuffing_score)\n @mobile_data = args[:mobile_data] if args.key?(:mobile_data)\n @original_content_score = args[:original_content_score] if args.key?(:original_content_score)\n @premium_data = args[:premium_data] if args.key?(:premium_data)\n @quarantine_info = args[:quarantine_info] if args.key?(:quarantine_info)\n @scaled_expt_indy_rank = args[:scaled_expt_indy_rank] if args.key?(:scaled_expt_indy_rank)\n @scaled_expt_indy_rank2 = args[:scaled_expt_indy_rank2] if args.key?(:scaled_expt_indy_rank2)\n @scaled_expt_indy_rank3 = args[:scaled_expt_indy_rank3] if args.key?(:scaled_expt_indy_rank3)\n @scaled_expt_spam_score_eric = args[:scaled_expt_spam_score_eric] if args.key?(:scaled_expt_spam_score_eric)\n @scaled_expt_spam_score_yoram = args[:scaled_expt_spam_score_yoram] if args.key?(:scaled_expt_spam_score_yoram)\n @scaled_indy_rank = args[:scaled_indy_rank] if args.key?(:scaled_indy_rank)\n @scaled_link_age_spam_score = args[:scaled_link_age_spam_score] if args.key?(:scaled_link_age_spam_score)\n @scaled_spam_score_eric = args[:scaled_spam_score_eric] if args.key?(:scaled_spam_score_eric)\n @scaled_spam_score_yoram = args[:scaled_spam_score_yoram] if args.key?(:scaled_spam_score_yoram)\n @spam_word_score = args[:spam_word_score] if args.key?(:spam_word_score)\n @tag_page_score = args[:tag_page_score] if args.key?(:tag_page_score)\n @tool_bar_data = args[:tool_bar_data] if args.key?(:tool_bar_data)\n @whirlpool_discount = args[:whirlpool_discount] if args.key?(:whirlpool_discount)\n @apps_link = args[:apps_link] if args.key?(:apps_link)\n @asteroid_belt_intents = args[:asteroid_belt_intents] if args.key?(:asteroid_belt_intents)\n @author_obfuscated_gaia_str = args[:author_obfuscated_gaia_str] if args.key?(:author_obfuscated_gaia_str)\n @biasingdata = args[:biasingdata] if args.key?(:biasingdata)\n @biasingdata2 = args[:biasingdata2] if args.key?(:biasingdata2)\n @body_words_to_tokens_ratio_begin = args[:body_words_to_tokens_ratio_begin] if args.key?(:body_words_to_tokens_ratio_begin)\n @body_words_to_tokens_ratio_total = args[:body_words_to_tokens_ratio_total] if args.key?(:body_words_to_tokens_ratio_total)\n @brainloc = args[:brainloc] if args.key?(:brainloc)\n @commercial_score = args[:commercial_score] if args.key?(:commercial_score)\n @compressed_quality_signals = args[:compressed_quality_signals] if args.key?(:compressed_quality_signals)\n @compressed_url = args[:compressed_url] if args.key?(:compressed_url)\n @content_attributions = args[:content_attributions] if args.key?(:content_attributions)\n @country_info = args[:country_info] if args.key?(:country_info)\n @crawl_pagerank = args[:crawl_pagerank] if args.key?(:crawl_pagerank)\n @crawler_id_proto = args[:crawler_id_proto] if args.key?(:crawler_id_proto)\n @crowdingdata = args[:crowdingdata] if args.key?(:crowdingdata)\n @dates_info = args[:dates_info] if args.key?(:dates_info)\n @desktop_interstitials = args[:desktop_interstitials] if args.key?(:desktop_interstitials)\n @domain_age = args[:domain_age] if args.key?(:domain_age)\n @events_date = args[:events_date] if args.key?(:events_date)\n @extra_data = args[:extra_data] if args.key?(:extra_data)\n @firefly_site_signal = args[:firefly_site_signal] if args.key?(:firefly_site_signal)\n @freshbox_article_scores = args[:freshbox_article_scores] if args.key?(:freshbox_article_scores)\n @freshness_encoded_signals = args[:freshness_encoded_signals] if args.key?(:freshness_encoded_signals)\n @fringe_query_prior = args[:fringe_query_prior] if args.key?(:fringe_query_prior)\n @geodata = args[:geodata] if args.key?(:geodata)\n @home_page_info = args[:home_page_info] if args.key?(:home_page_info)\n @homepage_pagerank_ns = args[:homepage_pagerank_ns] if args.key?(:homepage_pagerank_ns)\n @host_age = args[:host_age] if args.key?(:host_age)\n @host_nsr = args[:host_nsr] if args.key?(:host_nsr)\n @imagedata = args[:imagedata] if args.key?(:imagedata)\n @in_newsstand = args[:in_newsstand] if args.key?(:in_newsstand)\n @is_hotdoc = args[:is_hotdoc] if args.key?(:is_hotdoc)\n @kaltixdata = args[:kaltixdata] if args.key?(:kaltixdata)\n @knex_annotation = args[:knex_annotation] if args.key?(:knex_annotation)\n @languages = args[:languages] if args.key?(:languages)\n @last_significant_update = args[:last_significant_update] if args.key?(:last_significant_update)\n @last_significant_update_info = args[:last_significant_update_info] if args.key?(:last_significant_update_info)\n @launch_app_info = args[:launch_app_info] if args.key?(:launch_app_info)\n @live_results_data = args[:live_results_data] if args.key?(:live_results_data)\n @localized_cluster = args[:localized_cluster] if args.key?(:localized_cluster)\n @media_or_people_entities = args[:media_or_people_entities] if args.key?(:media_or_people_entities)\n @noimageframeoverlayreason = args[:noimageframeoverlayreason] if args.key?(:noimageframeoverlayreason)\n @nsr_data_proto = args[:nsr_data_proto] if args.key?(:nsr_data_proto)\n @nsr_is_covid_local_authority = args[:nsr_is_covid_local_authority] if args.key?(:nsr_is_covid_local_authority)\n @nsr_is_election_authority = args[:nsr_is_election_authority] if args.key?(:nsr_is_election_authority)\n @nsr_is_video_focused_site = args[:nsr_is_video_focused_site] if args.key?(:nsr_is_video_focused_site)\n @nsr_sitechunk = args[:nsr_sitechunk] if args.key?(:nsr_sitechunk)\n @num_urls = args[:num_urls] if args.key?(:num_urls)\n @oceandata = args[:oceandata] if args.key?(:oceandata)\n @onsite_prominence = args[:onsite_prominence] if args.key?(:onsite_prominence)\n @origin = args[:origin] if args.key?(:origin)\n @original_title_hard_token_count = args[:original_title_hard_token_count] if args.key?(:original_title_hard_token_count)\n @page_tags = args[:page_tags] if args.key?(:page_tags)\n @pagerank = args[:pagerank] if args.key?(:pagerank)\n @pagerank0 = args[:pagerank0] if args.key?(:pagerank0)\n @pagerank1 = args[:pagerank1] if args.key?(:pagerank1)\n @pagerank2 = args[:pagerank2] if args.key?(:pagerank2)\n @pageregions = args[:pageregions] if args.key?(:pageregions)\n @phildata = args[:phildata] if args.key?(:phildata)\n @product_sites_info = args[:product_sites_info] if args.key?(:product_sites_info)\n @queries_for_which_official = args[:queries_for_which_official] if args.key?(:queries_for_which_official)\n @rosetta_languages = args[:rosetta_languages] if args.key?(:rosetta_languages)\n @rs_application = args[:rs_application] if args.key?(:rs_application)\n @s3_audio_language = args[:s3_audio_language] if args.key?(:s3_audio_language)\n @saft_language_int = args[:saft_language_int] if args.key?(:saft_language_int)\n @scaled_selection_tier_rank = args[:scaled_selection_tier_rank] if args.key?(:scaled_selection_tier_rank)\n @science_doctype = args[:science_doctype] if args.key?(:science_doctype)\n @science_holdings_ids = args[:science_holdings_ids] if args.key?(:science_holdings_ids)\n @semantic_date = args[:semantic_date] if args.key?(:semantic_date)\n @semantic_date_confidence = args[:semantic_date_confidence] if args.key?(:semantic_date_confidence)\n @semantic_date_info = args[:semantic_date_info] if args.key?(:semantic_date_info)\n @serving_time_cluster_ids = args[:serving_time_cluster_ids] if args.key?(:serving_time_cluster_ids)\n @shingle_info = args[:shingle_info] if args.key?(:shingle_info)\n @smartphone_data = args[:smartphone_data] if args.key?(:smartphone_data)\n @smearing_max_total_offdomain_anchors = args[:smearing_max_total_offdomain_anchors] if args.key?(:smearing_max_total_offdomain_anchors)\n @socialgraph_node_name_fp = args[:socialgraph_node_name_fp] if args.key?(:socialgraph_node_name_fp)\n @spam_cookbook_action = args[:spam_cookbook_action] if args.key?(:spam_cookbook_action)\n @spam_muppet_signals = args[:spam_muppet_signals] if args.key?(:spam_muppet_signals)\n @spambrain_data = args[:spambrain_data] if args.key?(:spambrain_data)\n @spambrain_total_doc_spam_score = args[:spambrain_total_doc_spam_score] if args.key?(:spambrain_total_doc_spam_score)\n @spamrank = args[:spamrank] if args.key?(:spamrank)\n @spamtokens_content_score = args[:spamtokens_content_score] if args.key?(:spamtokens_content_score)\n @time_sensitivity = args[:time_sensitivity] if args.key?(:time_sensitivity)\n @title_hard_token_count_without_stopwords = args[:title_hard_token_count_without_stopwords] if args.key?(:title_hard_token_count_without_stopwords)\n @toolbar_pagerank = args[:toolbar_pagerank] if args.key?(:toolbar_pagerank)\n @top_petacat_tax_id = args[:top_petacat_tax_id] if args.key?(:top_petacat_tax_id)\n @top_petacat_weight = args[:top_petacat_weight] if args.key?(:top_petacat_weight)\n @travel_good_sites_info = args[:travel_good_sites_info] if args.key?(:travel_good_sites_info)\n @trendspam_score = args[:trendspam_score] if args.key?(:trendspam_score)\n @tundra_cluster_id = args[:tundra_cluster_id] if args.key?(:tundra_cluster_id)\n @uac_spam_score = args[:uac_spam_score] if args.key?(:uac_spam_score)\n @url_after_redirects_fp = args[:url_after_redirects_fp] if args.key?(:url_after_redirects_fp)\n @url_poisoning_data = args[:url_poisoning_data] if args.key?(:url_poisoning_data)\n @v2_knex_annotation = args[:v2_knex_annotation] if args.key?(:v2_knex_annotation)\n @video_corpus_docid = args[:video_corpus_docid] if args.key?(:video_corpus_docid)\n @video_language = args[:video_language] if args.key?(:video_language)\n @videodata = args[:videodata] if args.key?(:videodata)\n @volt_data = args[:volt_data] if args.key?(:volt_data)\n @watchpage_language_result = args[:watchpage_language_result] if args.key?(:watchpage_language_result)\n @webmirror_ecn_fp = args[:webmirror_ecn_fp] if args.key?(:webmirror_ecn_fp)\n @webref_entities = args[:webref_entities] if args.key?(:webref_entities)\n @ymyl_health_score = args[:ymyl_health_score] if args.key?(:ymyl_health_score)\n @ymyl_news_score = args[:ymyl_news_score] if args.key?(:ymyl_news_score)\n end",
"def update\n scan_procedure_array = []\n scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)\n hide_date_flag_array = []\n hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)\n @hide_page_flag = 'N'\n if hide_date_flag_array.count > 0\n @hide_page_flag = 'Y'\n end\n\n @neuropsych = Neuropsych.where(\"neuropsyches.appointment_id in (select appointments.id from appointments,scan_procedures_vgroups where \n appointments.vgroup_id = scan_procedures_vgroups.vgroup_id \n and scan_procedure_id in (?))\", scan_procedure_array).find(params[:id])\n\n appointment_date = nil\n if !params[:appointment][\"#{'appointment_date'}(1i)\"].blank? && !params[:appointment][\"#{'appointment_date'}(2i)\"].blank? && !params[:appointment][\"#{'appointment_date'}(3i)\"].blank?\n appointment_date = params[:appointment][\"#{'appointment_date'}(1i)\"] +\"-\"+params[:appointment][\"#{'appointment_date'}(2i)\"].rjust(2,\"0\")+\"-\"+params[:appointment][\"#{'appointment_date'}(3i)\"].rjust(2,\"0\")\n end\n\n=begin\n # ok to update vitals even if other update fail\n if !params[:vital_id].blank?\n @vital = Vital.find(params[:vital_id])\n @vital.pulse = params[:pulse]\n @vital.bp_systol = params[:bp_systol]\n @vital.bp_diastol = params[:bp_diastol]\n @vital.bloodglucose = params[:bloodglucose]\n @vital.save\n else\n @vital = Vital.new\n @vital.appointment_id = @neuropsych.appointment_id\n @vital.pulse = params[:pulse]\n @vital.bp_systol = params[:bp_systol]\n @vital.bp_diastol = params[:bp_diastol]\n @vital.bloodglucose = params[:bloodglucose]\n @vital.save \n end\n=end\n respond_to do |format|\n # not being used - its all appointment fields if @neuropsych.update(params[:neuropsych]) #, :without_protection => true)\n @appointment = Appointment.find(@neuropsych.appointment_id)\n @vgroup = Vgroup.find(@appointment.vgroup_id)\n @appointment.comment = params[:appointment][:comment]\n @appointment.appointment_date =appointment_date\n if !params[:appointment].nil? and !params[:appointment][:appointment_coordinator].nil?\n @appointment.appointment_coordinator = params[:appointment][:appointment_coordinator]\n end\n if [email protected]_id.blank?\n @participant = Participant.find(@vgroup.participant_id)\n if [email protected]?\n @appointment.age_at_appointment = ((@appointment.appointment_date - @participant.dob)/365.25).round(2)\n end\n end\n @appointment.save\n @vgroup.completedneuropsych = params[:vgroup][:completedneuropsych]\n if @vgroup.save\n format.html { redirect_to(@neuropsych, :notice => 'Neuropsych was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @neuropsych.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @columns = args[:columns] if args.key?(:columns)\n @shuffle_questions = args[:shuffle_questions] if args.key?(:shuffle_questions)\n end",
"def update!(**args)\n @phrase_anchor_spam_count = args[:phrase_anchor_spam_count] if args.key?(:phrase_anchor_spam_count)\n @phrase_anchor_spam_days = args[:phrase_anchor_spam_days] if args.key?(:phrase_anchor_spam_days)\n @phrase_anchor_spam_demoted = args[:phrase_anchor_spam_demoted] if args.key?(:phrase_anchor_spam_demoted)\n @phrase_anchor_spam_end = args[:phrase_anchor_spam_end] if args.key?(:phrase_anchor_spam_end)\n @phrase_anchor_spam_fraq = args[:phrase_anchor_spam_fraq] if args.key?(:phrase_anchor_spam_fraq)\n @phrase_anchor_spam_penalty = args[:phrase_anchor_spam_penalty] if args.key?(:phrase_anchor_spam_penalty)\n @phrase_anchor_spam_processed = args[:phrase_anchor_spam_processed] if args.key?(:phrase_anchor_spam_processed)\n @phrase_anchor_spam_rate = args[:phrase_anchor_spam_rate] if args.key?(:phrase_anchor_spam_rate)\n @phrase_anchor_spam_start = args[:phrase_anchor_spam_start] if args.key?(:phrase_anchor_spam_start)\n end",
"def update!(**args)\n @book_id = args[:book_id] if args.key?(:book_id)\n @discretized_citation_score = args[:discretized_citation_score] if args.key?(:discretized_citation_score)\n @previewable = args[:previewable] if args.key?(:previewable)\n @second_book_id = args[:second_book_id] if args.key?(:second_book_id)\n @second_discretized_citation_score = args[:second_discretized_citation_score] if args.key?(:second_discretized_citation_score)\n end",
"def update!(**args)\n @age_years = args[:age_years] if args.key?(:age_years)\n @min_age_years = args[:min_age_years] if args.key?(:min_age_years)\n end",
"def update!(**args)\n @exam_statuses = args[:exam_statuses] if args.key?(:exam_statuses)\n @is_certified = args[:is_certified] if args.key?(:is_certified)\n @type = args[:type] if args.key?(:type)\n @user_count = args[:user_count] if args.key?(:user_count)\n end",
"def update!(**args)\n @adult = args[:adult] if args.key?(:adult)\n @porn = args[:porn] if args.key?(:porn)\n @total = args[:total] if args.key?(:total)\n end",
"def update!(**args)\n @report_compromised = args[:report_compromised] if args.key?(:report_compromised)\n @report_harassment = args[:report_harassment] if args.key?(:report_harassment)\n @report_hate = args[:report_hate] if args.key?(:report_hate)\n @report_porn = args[:report_porn] if args.key?(:report_porn)\n @report_spam = args[:report_spam] if args.key?(:report_spam)\n @serve_count = args[:serve_count] if args.key?(:serve_count)\n @time_sec = args[:time_sec] if args.key?(:time_sec)\n @yt_thumbs_down = args[:yt_thumbs_down] if args.key?(:yt_thumbs_down)\n end",
"def update!(**args)\n @answer_record = args[:answer_record] if args.key?(:answer_record)\n @confidence = args[:confidence] if args.key?(:confidence)\n @conversation_model = args[:conversation_model] if args.key?(:conversation_model)\n @metadata = args[:metadata] if args.key?(:metadata)\n @text = args[:text] if args.key?(:text)\n @text_sections = args[:text_sections] if args.key?(:text_sections)\n end",
"def update!(**args)\n @answer_record = args[:answer_record] if args.key?(:answer_record)\n @confidence = args[:confidence] if args.key?(:confidence)\n @conversation_model = args[:conversation_model] if args.key?(:conversation_model)\n @metadata = args[:metadata] if args.key?(:metadata)\n @text = args[:text] if args.key?(:text)\n @text_sections = args[:text_sections] if args.key?(:text_sections)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @query_count_by_status = args[:query_count_by_status] if args.key?(:query_count_by_status)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @query_count_by_status = args[:query_count_by_status] if args.key?(:query_count_by_status)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @query_count_by_status = args[:query_count_by_status] if args.key?(:query_count_by_status)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @query_count_by_status = args[:query_count_by_status] if args.key?(:query_count_by_status)\n end",
"def update!(**args)\n @author = args[:author] if args.key?(:author)\n @create_time = args[:create_time] if args.key?(:create_time)\n @name = args[:name] if args.key?(:name)\n @text = args[:text] if args.key?(:text)\n @top_answers = args[:top_answers] if args.key?(:top_answers)\n @total_answer_count = args[:total_answer_count] if args.key?(:total_answer_count)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upvote_count = args[:upvote_count] if args.key?(:upvote_count)\n end",
"def update!(**args)\n @author = args[:author] if args.key?(:author)\n @create_time = args[:create_time] if args.key?(:create_time)\n @name = args[:name] if args.key?(:name)\n @text = args[:text] if args.key?(:text)\n @top_answers = args[:top_answers] if args.key?(:top_answers)\n @total_answer_count = args[:total_answer_count] if args.key?(:total_answer_count)\n @update_time = args[:update_time] if args.key?(:update_time)\n @upvote_count = args[:upvote_count] if args.key?(:upvote_count)\n end",
"def update\n if @test.created_at != @test.updated_at \n respond_to do |format|\n format.html { redirect_to @test, notice: \"Cheating activity is not allowed! You have done this test!\" } # Khong cho phep user lam lai bai test da nop\n end\n else\n begin\n answers = params[:test][:answer_ids]\n score = 0\n @test.questions.each do |question|\n ans = answers[\"question_#{question.id}\"]\n if !ans.nil?\n if question.answers.where(\"answers.id = #{ans.to_i}\").first.right_answer\n score = score + 1\n end\n ## Cap nhat Answer ID da chon ##\n QuestionsTest.where(:question_id => question.id, :test_id => @test.id)\n .update_all(:chosen_answer_id => ans.to_i)\n end\n end\n ## Luu diem ##\n @test.score = score\n @test.save\n\n respond_to do |format|\n format.html { redirect_to @test }\n format.json { render :show, status: :ok, location: @test }\n end\n rescue\n @test.score = 0\n @test.save\n respond_to do |format|\n format.html { redirect_to @test }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update!(**args)\n @age_indeterminate = args[:age_indeterminate] if args.key?(:age_indeterminate)\n @csam = args[:csam] if args.key?(:csam)\n @porn = args[:porn] if args.key?(:porn)\n @racy = args[:racy] if args.key?(:racy)\n @violence = args[:violence] if args.key?(:violence)\n end",
"def update!(**args)\n @daily_clicks = args[:daily_clicks] if args.key?(:daily_clicks)\n @daily_good_clicks = args[:daily_good_clicks] if args.key?(:daily_good_clicks)\n @data_time_sec = args[:data_time_sec] if args.key?(:data_time_sec)\n @first_boosted_time_sec = args[:first_boosted_time_sec] if args.key?(:first_boosted_time_sec)\n @impressions_in_boosted_period = args[:impressions_in_boosted_period] if args.key?(:impressions_in_boosted_period)\n @latest_byline_date_sec = args[:latest_byline_date_sec] if args.key?(:latest_byline_date_sec)\n @latest_firstseen_sec = args[:latest_firstseen_sec] if args.key?(:latest_firstseen_sec)\n @num_of_articles8 = args[:num_of_articles8] if args.key?(:num_of_articles8)\n @num_of_articles_by_periods = args[:num_of_articles_by_periods] if args.key?(:num_of_articles_by_periods)\n @num_of_gambling_pages = args[:num_of_gambling_pages] if args.key?(:num_of_gambling_pages)\n @num_of_urls = args[:num_of_urls] if args.key?(:num_of_urls)\n @num_of_urls_by_periods = args[:num_of_urls_by_periods] if args.key?(:num_of_urls_by_periods)\n @recent_imp_for_quota_system = args[:recent_imp_for_quota_system] if args.key?(:recent_imp_for_quota_system)\n @site_fp = args[:site_fp] if args.key?(:site_fp)\n @total_impressions = args[:total_impressions] if args.key?(:total_impressions)\n end",
"def update!(**args)\n @exclude_fields = args[:exclude_fields] if args.key?(:exclude_fields)\n @include_fields = args[:include_fields] if args.key?(:include_fields)\n @post_scan_actions = args[:post_scan_actions] if args.key?(:post_scan_actions)\n @row_filter = args[:row_filter] if args.key?(:row_filter)\n @sampling_percent = args[:sampling_percent] if args.key?(:sampling_percent)\n end",
"def updateFoodStoreFields(prams , average)\n food = FoodStore.find(prams[:food_store_id])\n\t if food.curr_sum_ambience == nil\n\t food.update(curr_sum_ambience:0,curr_sum_price:0,curr_sum_service:0,curr_sum_food:0)\n\t end\n food.update(curr_sum:food.curr_sum + average , num_of_rating:food.num_of_rating + 1)\n \n\t food.update(curr_sum_ambience:food.curr_sum_ambience + prams[:ambience])\n food.update(curr_sum_food:food.curr_sum_food + prams[:foodquality] )\n food.update(curr_sum_price:food.curr_sum_price + prams[:pricing] )\n food.update(curr_sum_service:food.curr_sum_service + prams[:service] )\n\n food.update(ambience_average:((food.curr_sum_ambience/food.num_of_rating)*100).floor / 100.0)\n food.update(service_average:((food.curr_sum_service/food.num_of_rating)*100).floor / 100.0)\n food.update(foodquality_average:((food.curr_sum_food/food.num_of_rating)*100).floor / 100.0)\n food.update(pricing_average:((food.curr_sum_price/food.num_of_rating)*100).floor / 100.0)\n\n food.update(sarapp_rating:((food.curr_sum/food.num_of_rating)*100).floor / 100.0)\n end",
"def update!(**args)\n @max_extractive_answer_count = args[:max_extractive_answer_count] if args.key?(:max_extractive_answer_count)\n @max_extractive_segment_count = args[:max_extractive_segment_count] if args.key?(:max_extractive_segment_count)\n @num_next_segments = args[:num_next_segments] if args.key?(:num_next_segments)\n @num_previous_segments = args[:num_previous_segments] if args.key?(:num_previous_segments)\n @return_extractive_segment_score = args[:return_extractive_segment_score] if args.key?(:return_extractive_segment_score)\n end",
"def update\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n @tags = @question.tags.order(:id)\n @tag = @question.tags.build\n @taggings = Tagging.where(:tag_id => @tags.collect{|x| x.id},:question_id => params[:id]).order(:tag_id)\n @answer = @question.answers.find(params[:id])\n @user = @answer.user\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n # make other answers wrong\n if params[:answer][:correct]\n @question.answers.each do |a|\n if a != @answer\n a.correct = false\n a.save\n end\n end\n end\n format.html { render :template => 'questions/show', :answer_id=>@answer.id, :user_id=>@user.id,:question_id => @question.id, notice: 'Answer was successfully updated.'}\n #format.json { head :no_content }\n #redirect_to question_url(@question_id)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @dated_values = args[:dated_values] if args.key?(:dated_values)\n end",
"def update_rate_for_philhealth(admission_type)\n @path = \"../csv/inpatient_ordered_items.csv\" if admission_type == 'inpatient'\n @path = \"../csv/or_ordered_items.csv\" if admission_type == 'outpatient'\n\n my_file = CSV.read(@path)\n count = my_file.count\n w = []\n x = 1\n count.times do\n w << my_file[x][0]\n if x + 1 == my_file.count\n else\n x += 1\n end\n end\n\n Database.connect\n @info = []\n if admission_type == 'inpatient'\n w.each do |o|\n @info << get_item_rate(:inpatient => true, :item_code => o)\n end\n elsif admission_type == 'outpatient'\n w.each do |o|\n @info << get_item_rate(:outpatient => true, :item_code => o)\n end\n end\n\n line_arr = File.readlines(@path)\n File.open(@path, \"w\") do |f|\n line_arr = \"MSERVICE_CODE,RATE,MRP_TAG,PH_CODE,ORDER_TYPE,DESCRIPTION\"\n line_arr.each{|line| f.puts(line)}\n end\n\n @x = 0\n @info.each do |s|\n add_line_to_csv(@path, s)\n if (@x + 1) == @info.count\n else\n @x += 1\n end\n end\n end",
"def update!(**args)\n @per_doc_relevance_ratings = args[:per_doc_relevance_ratings] if args.key?(:per_doc_relevance_ratings)\n end",
"def update!(**args)\n @duration_to_predicted_time_ms = args[:duration_to_predicted_time_ms] if args.key?(:duration_to_predicted_time_ms)\n @match_score = args[:match_score] if args.key?(:match_score)\n @matched_asr_start_pos = args[:matched_asr_start_pos] if args.key?(:matched_asr_start_pos)\n @matched_asr_text = args[:matched_asr_text] if args.key?(:matched_asr_text)\n @matched_asr_time_ms = args[:matched_asr_time_ms] if args.key?(:matched_asr_time_ms)\n @matched_asr_time_ratio = args[:matched_asr_time_ratio] if args.key?(:matched_asr_time_ratio)\n @matched_asr_token_count = args[:matched_asr_token_count] if args.key?(:matched_asr_token_count)\n @matched_description_item_index_ratio = args[:matched_description_item_index_ratio] if args.key?(:matched_description_item_index_ratio)\n @matched_description_text = args[:matched_description_text] if args.key?(:matched_description_text)\n @matched_description_token_count = args[:matched_description_token_count] if args.key?(:matched_description_token_count)\n end",
"def update!(**args)\n @average_duration = args[:average_duration] if args.key?(:average_duration)\n @average_turn_count = args[:average_turn_count] if args.key?(:average_turn_count)\n @conversation_count = args[:conversation_count] if args.key?(:conversation_count)\n @conversation_count_time_series = args[:conversation_count_time_series] if args.key?(:conversation_count_time_series)\n @custom_highlighter_matches = args[:custom_highlighter_matches] if args.key?(:custom_highlighter_matches)\n @issue_matches = args[:issue_matches] if args.key?(:issue_matches)\n @issue_matches_stats = args[:issue_matches_stats] if args.key?(:issue_matches_stats)\n @smart_highlighter_matches = args[:smart_highlighter_matches] if args.key?(:smart_highlighter_matches)\n end",
"def update\n \t@answer1 = params[:input1]\n \t@answer2 = params[:input2]\n \t@answer3 = params[:input3]\n \t@answer4 = params[:input4]\n \t@answer5 = params[:input5]\n\n \t@user = current_user\n \t@score = @user.score\n \t@quizscore = 0\n \t@quiz = Quiz.find(params[:id])\n @perfects = 0\n @quiztotal = @user.quizzes_taken + 1\n \t\n\n if @quiz.check1 == @quiz.answer1\n @score = @score + 1 \n @quizscore = @quizscore + 1\n end\n if @quiz.check2 == @quiz.answer2\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n if @quiz.check3 == @quiz.answer3\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n if @quiz.check4 == @quiz.answer4\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n if @quiz.check5 == @quiz.answer5\n @score = @score + 1\n @quizscore = @quizscore + 1\n end\n\n if @quizscore == 5\n @perfects = @perfects + 1\n @user.update_attributes(perfect_scores: @perfects)\n end\n \n #Allows users to submit their quizzes for gradsing and logs the event\n if current_user.is_admin != true \n @log = Log.new\n @log.update_attributes(score: @quizscore, userid: @user.id, quizid: @quiz.id, user: @user.email,\n quiz: @quiz.name, last_sign_in_ip: @user.current_sign_in_ip, event: \"Quiz Taken\") \t\n @user.update_attributes(score: @score, quizzes_taken: @quiztotal)\n\n if @quiz.update_attributes(check1: @answer1, check2: @answer2, check3: @answer3, check4: @answer4, check5: @answer5)\n redirect_to root_path\n flash[:success] = \"You got \" + @quizscore.to_s + \"/5 correct!\"\n end\n end\n\n \n if current_user.is_admin?\n #Declares required variables for admins to update quizzes\n @name = params[:name]\n @question1 = params[:question1]\n @question2 = params[:question2]\n @question3 = params[:question3]\n @question4 = params[:question4]\n @question5 = params[:question5]\n @ans1 = params[:answer1]\n @ans2 = params[:answer2]\n @ans3 = params[:answer3]\n @ans4 = params[:answer4]\n @ans5 = params[:answer5]\n @dis11 = params[:distract11]\n @dis12 = params[:distract12]\n @dis13 = params[:distract13]\n @dis21 = params[:distract21] \n @dis22 = params[:distract22]\n @dis23 = params[:distract23]\n @dis31 = params[:distract31]\n @dis32 = params[:distract32]\n @dis33 = params[:distract33]\n @dis41 = params[:distract41]\n @dis42 = params[:distract42]\n @dis43 = params[:distract43]\n @dis51 = params[:distract51]\n @dis52 = params[:distract52]\n @dis53 = params[:distract53]\n\n #Updates quiz parameters for new questions answers and distractors\n @quiz.update_attributes(name: @name, question1: @question1, question2: @question2, question3: @question3, question4: @question4,\n question5: @question5, answer1: @ans1, answer2: @ans2, answer3: @ans3, answer4: @ans3, answer5: @ans5, distract11: @dis11, distract12: @dis12,\n distract13: @dis13, distract21: @dis21, distract22: @dis22, distract23: @dis23, distract31: @dis31, distract32: @dis32, distract33: @dis33,\n distract41: @dis41, distract42: @dis42, distract43: @dis43, distract51: @dis51, distract52: @dis52, distract53: @dis53)\n\n @log = Log.new\n @log.update_attributes(updated_by: @user.email, quizid: @quiz.id, event: \"Quiz Updated\", \n last_sign_in_ip: @user.current_sign_in_ip)\n\n redirect_to admin_panel_quizzes_path\n \n \n end\n end",
"def update!(**args)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @invitation_id = args[:invitation_id] if args.key?(:invitation_id)\n @invited_email_address = args[:invited_email_address] if args.key?(:invited_email_address)\n @state = args[:state] if args.key?(:state)\n @student_id = args[:student_id] if args.key?(:student_id)\n end",
"def update\n @lesson = Lesson.find(params[:id])\n \n score = Question.score_answers(params)\n video_watched = true\n complete = true\n \n respond_to do |format|\n if @lesson.update_attributes(:score => score, :video_watched => video_watched, :complete => complete )\n LessonResult.file_answers(params, @lesson)\n format.html { redirect_to(student_dashboard_path, :notice => 'Lesson was successfully completed.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @exam_type = args[:exam_type] if args.key?(:exam_type)\n @expiration = args[:expiration] if args.key?(:expiration)\n @last_passed = args[:last_passed] if args.key?(:last_passed)\n @passed = args[:passed] if args.key?(:passed)\n @taken = args[:taken] if args.key?(:taken)\n @warning = args[:warning] if args.key?(:warning)\n end",
"def update!(**args)\n @exam_id = args[:exam_id] if args.key?(:exam_id)\n @exam_type = args[:exam_type] if args.key?(:exam_type)\n @token = args[:token] if args.key?(:token)\n end",
"def set_training_answer(question_id, date, approver)\n get_training_answer_hash\n date = nil if date == ''\n if @training_answer_hash[question_id].nil? && date\n # Create a row for this answer\n answer = TrainingAnswer.create(_(:person_id, :training_answer) => id, _(:training_question_id, :training_answer) => question_id, \n _(:completed_at, :training_answer) => date, _(:approved_by, :training_answer) => approver)\n @training_answer_hash[question_id] = answer\n elsif date\n approved_by = approver ? approver : @training_answer_hash[question_id].approved_by\n @training_answer_hash[question_id].update_attributes({_(:completed_at, :training_answer) => date, _(:approved_by, :training_answer) => approver})\n end\n end",
"def update!(**args)\n @filter_reason = args[:filter_reason] if args.key?(:filter_reason)\n @prefiltered_passage_count = args[:prefiltered_passage_count] if args.key?(:prefiltered_passage_count)\n @title_entity_annotations = args[:title_entity_annotations] if args.key?(:title_entity_annotations)\n @total_restricted_queries = args[:total_restricted_queries] if args.key?(:total_restricted_queries)\n end",
"def update()\n sql = \"UPDATE cities SET(name, country_id, visited, rate) = ($1, $2, $3, $4) WHERE id = $5\"\n values = [@name, @country_id, @visited, @rate, @id]\n SqlRunner.run(sql, values)\n end",
"def update!(**args)\n @argued_before = args[:argued_before] if args.key?(:argued_before)\n @argued_date = args[:argued_date] if args.key?(:argued_date)\n @certiorari_court_name = args[:certiorari_court_name] if args.key?(:certiorari_court_name)\n @certiorari_relationship = args[:certiorari_relationship] if args.key?(:certiorari_relationship)\n @court_term = args[:court_term] if args.key?(:court_term)\n @decided_date = args[:decided_date] if args.key?(:decided_date)\n @filed_date = args[:filed_date] if args.key?(:filed_date)\n @memo_id = args[:memo_id] if args.key?(:memo_id)\n @modified_date = args[:modified_date] if args.key?(:modified_date)\n @syllabus = args[:syllabus] if args.key?(:syllabus)\n @court = args[:court] if args.key?(:court)\n @opinioninfo = args[:opinioninfo] if args.key?(:opinioninfo)\n @perdocketinfo = args[:perdocketinfo] if args.key?(:perdocketinfo)\n @pub = args[:pub] if args.key?(:pub)\n @unknowndate = args[:unknowndate] if args.key?(:unknowndate)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end",
"def update_quiz\n @questionnaire = Questionnaire.find(params[:id])\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid] if @questionnaire == nil\n if params['save']\n @questionnaire.update_attributes(params[:questionnaire])\n\n for qid in params[:question].keys\n question_advices = QuestionAdvice.find_all_by_question_id(qid)\n i=1\n for question_advice in question_advices\n if params[:question][qid][\"weight\"] == i.to_s\n score = 1\n else\n score = 0\n end\n i+=1\n question_advice.update_attributes(:score => score, :advice => params[:question_advice][question_advice.id.to_s][\"advice\"])\n end\n end\n save_questionnaire\n #save_choices @questionnaire.id\n end\n redirect_to :controller => 'submitted_content', :action => 'edit', :id => params[:pid]\n end",
"def update!(**args)\n @description_anchor_time_ms = args[:description_anchor_time_ms] if args.key?(:description_anchor_time_ms)\n @description_anchor_time_to_matched_time_ms = args[:description_anchor_time_to_matched_time_ms] if args.key?(:description_anchor_time_to_matched_time_ms)\n @edit_distance = args[:edit_distance] if args.key?(:edit_distance)\n @edit_distance_ratio = args[:edit_distance_ratio] if args.key?(:edit_distance_ratio)\n @matched_description_text = args[:matched_description_text] if args.key?(:matched_description_text)\n @matched_span_text = args[:matched_span_text] if args.key?(:matched_span_text)\n end",
"def update_multiple_answer_questions params\n #clear questions first\n self.pal_additional_areas.clear\n self.pal_participation_levels.clear\n self.help_additional_areas.clear\n self.professions.clear\n self.search_plan_types.clear\n self.npln_participation_levels.clear\n self.referral_fees.clear\n self.plan_types.clear\n self.claim_types.clear\n self.sponsor_types.clear\n self.npln_additional_areas.clear\n self.jurisdictions.clear\n self.geo_areas.clear\n\n self.pal_additional_areas << params[:pal_additional_areas].collect{|p| PalAdditionalArea[p]} if params[:pal_additional_areas]\n self.pal_participation_levels << params[:pal_participation_levels].collect{|p| PalParticipationLevel[p]} if params[:pal_participation_levels]\n self.help_additional_areas << params[:help_additional_areas].collect{|p| HelpAdditionalArea[p]} if params[:help_additional_areas]\n self.professions << Profession[params[:profession]] if (params[:profession] and !params[:profession].blank?)\n self.search_plan_types << params[:search_plan_types].collect{|p| SearchPlanType[p]} if params[:serach_plan_types]\n self.npln_participation_levels << params[:npln_participation_levels].collect{|p| NplnParticipationLevel[p]} if params[:npln_participation_levels]\n self.referral_fees << params[:referral_fees].collect{|p| ReferralFee[p]} if params[:referral_fees]\n self.plan_types << params[:plan_types].collect{|p| PlanType[p]} if params[:plan_types]\n self.claim_types << params[:claim_types].collect{|p| ClaimType[p]} if params[:claim_types]\n self.sponsor_types << params[:sponsor_types].collect{|p| SponsorType[p]} if params[:sponsor_types]\n self.npln_additional_areas << params[:npln_additional_areas].collect{|p| NplnAdditionalArea[p]} if params[:npln_additional_areas]\n self.jurisdictions << params[:jurisdictions].collect{|p| Jurisdiction[p]} if params[:jurisdictions]\n self.geo_areas << params[:geo_areas].collect{|p| GeoArea[p]} if params[:geo_areas]\n end",
"def update_invested\n self.invested_amount = self.investments.map(&:amount).sum\n self.goal_investment = 0 unless self.goal_investment\n self.equity_offered = 0 unless self.equity_offered\n self.save\n end",
"def update!(**args)\n @added_by_close_answers = args[:added_by_close_answers] if args.key?(:added_by_close_answers)\n @additional_explained_range = args[:additional_explained_range] if args.key?(:additional_explained_range)\n @begin = args[:begin] if args.key?(:begin)\n @begin_token_index = args[:begin_token_index] if args.key?(:begin_token_index)\n @compound_mention = args[:compound_mention] if args.key?(:compound_mention)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @debug_info = args[:debug_info] if args.key?(:debug_info)\n @detailed_mention_scores = args[:detailed_mention_scores] if args.key?(:detailed_mention_scores)\n @end = args[:end] if args.key?(:end)\n @end_token_index = args[:end_token_index] if args.key?(:end_token_index)\n @eval_info = args[:eval_info] if args.key?(:eval_info)\n @interpretation_number = args[:interpretation_number] if args.key?(:interpretation_number)\n @is_implicit = args[:is_implicit] if args.key?(:is_implicit)\n @lexical_annotation = args[:lexical_annotation] if args.key?(:lexical_annotation)\n @low_confidence = args[:low_confidence] if args.key?(:low_confidence)\n @matching_text = args[:matching_text] if args.key?(:matching_text)\n @name_metadata = args[:name_metadata] if args.key?(:name_metadata)\n @non_locational_score = args[:non_locational_score] if args.key?(:non_locational_score)\n @per_mention_lightweight_token = args[:per_mention_lightweight_token] if args.key?(:per_mention_lightweight_token)\n @personalization_context_outputs = args[:personalization_context_outputs] if args.key?(:personalization_context_outputs)\n @prior_probability = args[:prior_probability] if args.key?(:prior_probability)\n @reference_score = args[:reference_score] if args.key?(:reference_score)\n @resolution_score = args[:resolution_score] if args.key?(:resolution_score)\n @stuff = args[:stuff] if args.key?(:stuff)\n @subsegment_index = args[:subsegment_index] if args.key?(:subsegment_index)\n @time_offset_confidence = args[:time_offset_confidence] if args.key?(:time_offset_confidence)\n @time_offset_ms = args[:time_offset_ms] if args.key?(:time_offset_ms)\n @trusted_name_confidence = args[:trusted_name_confidence] if args.key?(:trusted_name_confidence)\n end",
"def update_stats!\n options = {\n biomes_explored: explore_all_biome_progress,\n leave_game: (stat.leave_game rescue 0),\n deaths: (stat.deaths rescue 0),\n mob_kills: (stat.mob_kills rescue 0),\n time_since_death: (stat.time_since_death rescue 0),\n player_kills: (stat.player_kills rescue 0),\n shall_update_stats: false\n }\n \n update_columns(options) if persisted? # no AR callbacks\n end",
"def update\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n if @submission.update_attributes(params[:submission])\n flag = true\n @submission.score = 0 \n @submission.submitted_answers.each do |answer|\n if answer.points\n @submission.score += answer.points\n flag = false\n end\n end\n if flag == true\n @submission.score=nil\n end\n @submission.save\n format.html { redirect_to @submission, notice: 'Submission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n if params[:question][:answer].present?\n @question.answered_by = current_user.id\n @question.answered_at = Time.zone.now if @question.answered_at.nil?\n end\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @completed_analyses_count = args[:completed_analyses_count] if args.key?(:completed_analyses_count)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @failed_analyses_count = args[:failed_analyses_count] if args.key?(:failed_analyses_count)\n @request = args[:request] if args.key?(:request)\n @total_requested_analyses_count = args[:total_requested_analyses_count] if args.key?(:total_requested_analyses_count)\n end",
"def update!(**args)\n @completed_analyses_count = args[:completed_analyses_count] if args.key?(:completed_analyses_count)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @failed_analyses_count = args[:failed_analyses_count] if args.key?(:failed_analyses_count)\n @request = args[:request] if args.key?(:request)\n @total_requested_analyses_count = args[:total_requested_analyses_count] if args.key?(:total_requested_analyses_count)\n end",
"def approve\n # raise @user.inspect\n @initiatives = Initiative.find(params[:id])\n @initiatives.is_approved = [email protected]_approved?\n @initiatives.update_column(:is_approved,true) \n # if @initiatives.is_approved\n @user= User.find_by_id(@initiatives.user_id)\n reputation_count = @user.reputation\n @initiatives1 = @user.update_column(:reputation,reputation_count+10)\n # end\n @initiatives.save!\n \n redirect_to :back\n end",
"def update_attributes(attributes = {}, user)\n Rails.logger.debug \"Call to poll.update_attributes\"\n self.answers=Util.arraystring_to_csv(attributes[:answers])\n if self.valid? #Validate if the Poll object is valid\n Rails.logger.debug \"The poll is valid!\"\n #Create a raw poll object\n poll_req = { 'question'=>attributes[:question],\n 'answers'=>Util.arraystring_to_csv(attributes[:answers]),#Turn the answers array in string form to a comma separated string\n 'start'=> Util.date_to_epoch(attributes[:start_date]), #Turn the start_date to epoch\n 'duration'=> attributes[:duration].to_i*60000, #Turn minutes to milliseconds\n 'ownerId'=> self.owner_id,\n 'creatorId'=> self.creator_id,\n } \n reqUrl = \"/api/poll/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_put_request(reqUrl,poll_req,user['email'],user['password']) #Make the PUT call to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n poll = Poll.rest_to_poll(rest_response.body)\n return true, poll #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n else\n Rails.logger.debug self.errors.full_messages\n return false, self.errors.full_messages #Return invalid object error\n end\n end",
"def update!(**args)\n @answer_score = args[:answer_score] if args.key?(:answer_score)\n @navboost_query = args[:navboost_query] if args.key?(:navboost_query)\n @passage_coverage = args[:passage_coverage] if args.key?(:passage_coverage)\n @passage_type = args[:passage_type] if args.key?(:passage_type)\n @query_passage_idx = args[:query_passage_idx] if args.key?(:query_passage_idx)\n @similarity_method = args[:similarity_method] if args.key?(:similarity_method)\n @similarity_score = args[:similarity_score] if args.key?(:similarity_score)\n @snippet_coverage = args[:snippet_coverage] if args.key?(:snippet_coverage)\n end",
"def update!(**args)\n @annotation_id = args[:annotation_id] if args.key?(:annotation_id)\n @answer_feedback = args[:answer_feedback] if args.key?(:answer_feedback)\n @article_suggestion = args[:article_suggestion] if args.key?(:article_suggestion)\n @conversation_summarization_suggestion = args[:conversation_summarization_suggestion] if args.key?(:conversation_summarization_suggestion)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dialogflow_interaction = args[:dialogflow_interaction] if args.key?(:dialogflow_interaction)\n @end_boundary = args[:end_boundary] if args.key?(:end_boundary)\n @faq_answer = args[:faq_answer] if args.key?(:faq_answer)\n @smart_compose_suggestion = args[:smart_compose_suggestion] if args.key?(:smart_compose_suggestion)\n @smart_reply = args[:smart_reply] if args.key?(:smart_reply)\n @start_boundary = args[:start_boundary] if args.key?(:start_boundary)\n end",
"def update!(**args)\n @annotation_id = args[:annotation_id] if args.key?(:annotation_id)\n @answer_feedback = args[:answer_feedback] if args.key?(:answer_feedback)\n @article_suggestion = args[:article_suggestion] if args.key?(:article_suggestion)\n @conversation_summarization_suggestion = args[:conversation_summarization_suggestion] if args.key?(:conversation_summarization_suggestion)\n @create_time = args[:create_time] if args.key?(:create_time)\n @dialogflow_interaction = args[:dialogflow_interaction] if args.key?(:dialogflow_interaction)\n @end_boundary = args[:end_boundary] if args.key?(:end_boundary)\n @faq_answer = args[:faq_answer] if args.key?(:faq_answer)\n @smart_compose_suggestion = args[:smart_compose_suggestion] if args.key?(:smart_compose_suggestion)\n @smart_reply = args[:smart_reply] if args.key?(:smart_reply)\n @start_boundary = args[:start_boundary] if args.key?(:start_boundary)\n end",
"def update()\n #connect to db\n db = PG.connect({ dbname: \"bounty_hunters\", host: \"localhost\" })\n #write big SQL statement string\n sql = \"UPDATE bounties\n SET\n (\n name,\n species,\n bounty_value,\n favourite_weapon\n ) =\n (\n $1, $2, $3, $4\n )\n WHERE id = $5\"\n\n #make array of values for prepared statement\n values = [@name, @species, @bounty_value, @favourite_weapon, @id]\n #prepare statement\n db.prepare(\"update\", sql)\n #run statement with db\n db.exec_prepared(\"update\", values)\n #close link to db\n db.close()\n end",
"def update(attr_hash)\n # Prevent update of id field\n attr_hash.reject! { |k, v| k == :id || k == \"id\" }\n csv_table = CSV.table(table_path, converters: CONVERTERS)\n old_row = csv_table.find { |row| row.field(:id) == id }\n new_row = CSV::Row.new(old_row.headers, old_row.fields)\n\n # Assign new values to the row by param name (which should be a field name)\n attr_hash.each { |k, v| new_row[k] = v }\n # Delete the old_row\n csv_table = CSV.table(table_path, converters: CONVERTERS)\n csv_table.delete_if do |row|\n row == old_row\n end\n csv_table << new_row\n # Write the csv_table to a file, replacing the original\n File.open(table_path, 'w') do |f| # w => write-only\n f.write(csv_table.to_csv)\n end\n # Note: AR returns true if successful, false if not.\n # If AR is successful, it updates the receiving instance's attributes.\n # This returns a new instance with the variables on success.\n new_row ? self.class.new(new_row.to_hash) : false\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @item_count_by_status = args[:item_count_by_status] if args.key?(:item_count_by_status)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @item_count_by_status = args[:item_count_by_status] if args.key?(:item_count_by_status)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @item_count_by_status = args[:item_count_by_status] if args.key?(:item_count_by_status)\n end",
"def update!(**args)\n @date = args[:date] if args.key?(:date)\n @item_count_by_status = args[:item_count_by_status] if args.key?(:item_count_by_status)\n end",
"def update_csv\n CSV.open(@csv_file, \"w\") do |csv|\n csv << [\"id\", \"name\", \"password\", \"title\"]\n @data.each do |record|\n csv << [record.id, record.name, record.password, record.title]\n end\n end\n end",
"def update!(**args)\n @added_by_close_answers = args[:added_by_close_answers] if args.key?(:added_by_close_answers)\n @annotated_span = args[:annotated_span] if args.key?(:annotated_span)\n @attribute_id = args[:attribute_id] if args.key?(:attribute_id)\n @cluster_id = args[:cluster_id] if args.key?(:cluster_id)\n @cluster_set_score = args[:cluster_set_score] if args.key?(:cluster_set_score)\n @cluster_sibling_mid = args[:cluster_sibling_mid] if args.key?(:cluster_sibling_mid)\n @collection_membership = args[:collection_membership] if args.key?(:collection_membership)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @deprecated_equivalent_mids = args[:deprecated_equivalent_mids] if args.key?(:deprecated_equivalent_mids)\n @deprecated_mdvc_supporting_mid = args[:deprecated_mdvc_supporting_mid] if args.key?(:deprecated_mdvc_supporting_mid)\n @display_name = args[:display_name] if args.key?(:display_name)\n @entity_number = args[:entity_number] if args.key?(:entity_number)\n @entity_relationship = args[:entity_relationship] if args.key?(:entity_relationship)\n @entity_source_data = args[:entity_source_data] if args.key?(:entity_source_data)\n @freebase_mid = args[:freebase_mid] if args.key?(:freebase_mid)\n @gaia_id = args[:gaia_id] if args.key?(:gaia_id)\n @global_product_cluster_id = args[:global_product_cluster_id] if args.key?(:global_product_cluster_id)\n @interpretation_number = args[:interpretation_number] if args.key?(:interpretation_number)\n @is_mdvc_dimension = args[:is_mdvc_dimension] if args.key?(:is_mdvc_dimension)\n @is_nimble_annotation = args[:is_nimble_annotation] if args.key?(:is_nimble_annotation)\n @location = args[:location] if args.key?(:location)\n @location_type = args[:location_type] if args.key?(:location_type)\n @low_confidence = args[:low_confidence] if args.key?(:low_confidence)\n @matched_lightweight_token = args[:matched_lightweight_token] if args.key?(:matched_lightweight_token)\n @mdvc_child = args[:mdvc_child] if args.key?(:mdvc_child)\n @mdvc_verticals = args[:mdvc_verticals] if args.key?(:mdvc_verticals)\n @merged_implied_entity = args[:merged_implied_entity] if args.key?(:merged_implied_entity)\n @merlot_category = args[:merlot_category] if args.key?(:merlot_category)\n @other_metadata = args[:other_metadata] if args.key?(:other_metadata)\n @oyster_id = args[:oyster_id] if args.key?(:oyster_id)\n @personal_summary_node_child = args[:personal_summary_node_child] if args.key?(:personal_summary_node_child)\n @product_line_id = args[:product_line_id] if args.key?(:product_line_id)\n @reference_score = args[:reference_score] if args.key?(:reference_score)\n @related_entity = args[:related_entity] if args.key?(:related_entity)\n @resolution_score = args[:resolution_score] if args.key?(:resolution_score)\n @source_type_list = args[:source_type_list] if args.key?(:source_type_list)\n @sub_cluster = args[:sub_cluster] if args.key?(:sub_cluster)\n end",
"def update!(**args)\n @ad_group = args[:ad_group] if args.key?(:ad_group)\n @age_range = args[:age_range] if args.key?(:age_range)\n @bid_modifier = args[:bid_modifier] if args.key?(:bid_modifier)\n @cpc_bid_micros = args[:cpc_bid_micros] if args.key?(:cpc_bid_micros)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @criterion_id = args[:criterion_id] if args.key?(:criterion_id)\n @effective_cpc_bid_micros = args[:effective_cpc_bid_micros] if args.key?(:effective_cpc_bid_micros)\n @engine_id = args[:engine_id] if args.key?(:engine_id)\n @engine_status = args[:engine_status] if args.key?(:engine_status)\n @final_url_suffix = args[:final_url_suffix] if args.key?(:final_url_suffix)\n @final_urls = args[:final_urls] if args.key?(:final_urls)\n @gender = args[:gender] if args.key?(:gender)\n @keyword = args[:keyword] if args.key?(:keyword)\n @labels = args[:labels] if args.key?(:labels)\n @last_modified_time = args[:last_modified_time] if args.key?(:last_modified_time)\n @listing_group = args[:listing_group] if args.key?(:listing_group)\n @location = args[:location] if args.key?(:location)\n @negative = args[:negative] if args.key?(:negative)\n @position_estimates = args[:position_estimates] if args.key?(:position_estimates)\n @quality_info = args[:quality_info] if args.key?(:quality_info)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n @tracking_url_template = args[:tracking_url_template] if args.key?(:tracking_url_template)\n @type = args[:type] if args.key?(:type)\n @user_list = args[:user_list] if args.key?(:user_list)\n @webpage = args[:webpage] if args.key?(:webpage)\n end",
"def update\n self.params[:user_submit][:user_answers_attributes].each do |key,value|\n params[:user_submit][:user_answers_attributes][key] = params[:user_submit][:user_answers_attributes][key].merge(:user_id => current_user.id)\n end\n @user_submit = UserSubmit.find(params[:id])\n @user_submit.update_attributes(params[:user_submit])\n @user_submit.user = current_user\n #@user_submit.exam_id = @examid\n respond_to do |format|\n @user_submit.locked = 1\n @user_submit.grade = @user_submit.exam.calc_grade(@user_submit)\n if @user_submit.save\n @user_submit.exam.locked = 1\n @user_submit.exam.save\n @user_submit.exam.questions.each do |useq|\n useq.locked = 1\n useq.answers.each do |uqa|\n uqa.locked = 1\n uqa.save\n end\n end\n \n format.html { redirect_to exams_url, notice: 'User submit was successfully created.' }\n format.json { render json: @user_submit, status: :created, location: @user_submit }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @user_submit.errors, status: :unprocessable_entity }\n format.html { redirect_to exams_url, notice: 'NOTICE! You may only submit answers for this exam once. See your instructor for permission to re-take the exam.' }\n end\n end\n end",
"def update_and_unlock(options = {})\n mac_addrs = MacAddress.all(:conditions => {:group_id => options[:group_id]})\n group = Group.find(options[:group_id])\n param_list = []\n CSV::Reader.parse(options[:csv], \"\\t\") do |row|\n ip_addr = nil\n # ip address selection\n if row[3].nil?\n ip_addr = Network.next_ip(group.user)\n else\n ip_addr = IPAddr.new(row[3])\n end\n # get older entry\n match_mac_addrs, mac_addrs = mac_addrs.partition {|item| item.hostname == row[0] && item.mac_addr == row[1]}\n if match_mac_addrs.size == 0\n ip_param = ip_addr.ipv4? ? {:ipv4_addr => ip_addr.to_s} : {:ipv6_addr => ip_addr.to_s}\n params = {:group_id => options[:group_id], :hostname => row[0], :mac_addr => row[1], :description => row[2], :vlan_id => row[4].to_i}.merge(ip_param)\n param_list << params\n logger.info(\"create entry: #{row[1]}\")\n else\n mac_addr = match_mac_addrs.first\n mac_addr.hostname = row[0]\n mac_addr.mac_addr = row[1]\n mac_addr.description = row[2]\n mac_addr.vlan_id = row[4]\n if ip_addr.ipv4?\n mac_addr.ipv4_addr = ip_addr.to_s\n else\n mac_addr.ipv6_addr = ip_addr.to_s\n end\n mac_addr.save\n logger.info(\"update entry: #{row[1]}\")\n end\n end\n # The rest entries are deleted in the uploaded CSV file\n mac_addrs.each do |mac_addr|\n mac_addr.destroy\n end\n param_list.each do |params|\n mac_address = MacAddress.create(params)\n mac_address.location_ids = group.location_ids\n mac_address.save\n end\n unlock(options[:group_id])\n end",
"def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end"
] | [
"0.6230133",
"0.58326024",
"0.5832444",
"0.58173835",
"0.5680395",
"0.56374854",
"0.56374854",
"0.5615608",
"0.56051624",
"0.5558463",
"0.5546829",
"0.5539872",
"0.5533647",
"0.55181533",
"0.55128765",
"0.55125326",
"0.5503305",
"0.5495543",
"0.5476523",
"0.54755694",
"0.54755694",
"0.54689604",
"0.5450616",
"0.54501015",
"0.54501015",
"0.54501015",
"0.5440571",
"0.54333055",
"0.54279554",
"0.5427387",
"0.5416575",
"0.5405407",
"0.5399409",
"0.5377318",
"0.5376933",
"0.53768635",
"0.5373008",
"0.53700966",
"0.5365626",
"0.536551",
"0.53624165",
"0.53615814",
"0.535153",
"0.535153",
"0.5350035",
"0.5350035",
"0.5350035",
"0.5350035",
"0.5343931",
"0.5343931",
"0.53435415",
"0.5341603",
"0.5334791",
"0.53237444",
"0.53233856",
"0.53121305",
"0.5278999",
"0.5277016",
"0.52692676",
"0.5269179",
"0.5267932",
"0.5261835",
"0.52606225",
"0.52592474",
"0.5256101",
"0.5256058",
"0.5243481",
"0.5241212",
"0.5236665",
"0.5235163",
"0.5235106",
"0.5234847",
"0.5234847",
"0.52257526",
"0.5224274",
"0.52241224",
"0.5220559",
"0.52167636",
"0.52157223",
"0.52060497",
"0.52029824",
"0.5201616",
"0.5201616",
"0.52008575",
"0.5200591",
"0.52000195",
"0.5197032",
"0.5197032",
"0.5196632",
"0.5193117",
"0.5190208",
"0.5190208",
"0.5190208",
"0.5190208",
"0.5189731",
"0.5189006",
"0.5188838",
"0.518108",
"0.5180867",
"0.5179874"
] | 0.6391308 | 0 |
GET /post302s/1 GET /post302s/1.xml | def show
@post302 = Post302.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post302 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend",
"def redirects; end",
"def handle_302_found(response,request_url,redirects)\n raise \"Too many redirects followed to redirect again for 302 response: followed (#{redirects}) redirects while retrieving #{request_url}\" unless redirects > 0\n handle_301_moved_permanantly(response,request_url,redirects)\n end",
"def create\n @post302 = Post302.new(params[:post302])\n\n respond_to do |format|\n if @post302.save\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }\n format.xml { render :xml => @post302, :status => :created, :location => @post302 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @post302 = Post302.find(params[:id])\n @post302.destroy\n\n respond_to do |format|\n format.html { redirect_to(post302s_url) }\n format.xml { head :ok }\n end\n end",
"def follow_redirect\n get extract_redirection_url\n end",
"def follow_get_redirection(&block); end",
"def follow_redirections\n self.url = RequestHelper.add_scheme(RequestHelper.decode_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && RequestHelper::REDIRECT_HTTP_CODES.include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url(self.url)\n code = response.code\n\n if RequestHelper::REDIRECT_HTTP_CODES.include?(code)\n redirect_url = self.url_from_location(response, path)\n self.url = redirect_url if redirect_url\n end\n end\n end",
"def follow_redirect?; end",
"def update\n @post302 = Post302.find(params[:id])\n\n respond_to do |format|\n if @post302.update_attributes(params[:post302])\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n response = Net::HTTP.get_response(URI(uri_str))\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n # print redirect\n redirected_to = location\n fetch(location, limit - 1)\n return redirected_to\n else\n response.value\n end\nend",
"def follow_redirections\n self.url = self.add_scheme(decoded_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && %w(301 302).include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url\n code = response.code\n self.set_url_from_location(response, path)\n end\n end",
"def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def follow_redirect!\n unless last_response.redirect?\n raise Error, 'Last response was not a redirect. Cannot follow_redirect!'\n end\n\n if last_response.status == 307\n request_method = last_request.request_method\n params = last_request.params\n else\n request_method = 'GET'\n params = {}\n end\n\n # Compute the next location by appending the location header with the\n # last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2\n # Adding two absolute locations returns the right-hand location\n next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])\n\n custom_request(\n request_method,\n next_location.to_s,\n params,\n 'HTTP_REFERER' => last_request.url,\n 'rack.session' => last_request.session,\n 'rack.session.options' => last_request.session_options\n )\n end",
"def fetch\n response = get_request\n # Permanent redirects should get pushed up into the feed.\n request.parse_response(response)\n request\n end",
"def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend",
"def max_redirects; end",
"def test_1\n\n res = get \"http://localhost:7777/things\", :no_redirections => true\n assert_equal 303, res.code.to_i\n\n res = get(\"http://localhost:7777/things\", :noredir => true)\n assert_equal 303, res.code.to_i\n\n expect 200, {}, get(\"http://localhost:7777/items\", :noredir => true)\n end",
"def follow_redirection(&block); end",
"def redirect_ok=(follow); end",
"def get_response(uri, limit = 5)\n response = Net::HTTP.get_response(URI(uri))\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n get_response(location, limit - 1)\n else\n response.value\n end\nend",
"def get_response(uri, limit = 10)\n response = Net::HTTP.get_response(uri)\n case response\n when Net::HTTPRedirection\n if limit == 0\n response\n else\n get_response(URI.parse(response['location']), limit - 1)\n end\n else\n response\n end\nend",
"def index\n @redirects = Redirect.all\n @redirects_only_on_api = fetch_redirects_of_api\n end",
"def tag; 'RedirectMatch permanent'; end",
"def fetch\n headers = {\n \"User-Agent\" => \"#{HTTP::Request::USER_AGENT} (rubyland aggregator)\"\n }\n\n unless refresh == :hard\n if db_feed.http_etag\n headers[\"If-None-Match\"] = db_feed.http_etag\n end\n if db_feed.http_last_modified\n headers['If-Modified-Since'] = db_feed.http_last_modified\n end\n end\n\n # Loop redirects, marking new permanent url if all 304s\n tries = 0\n fetch_url = feed_url\n new_url = nil\n response = nil\n permanent_new_url = nil\n all_301s = true\n\n while tries < max_redirects\n tries += 1\n response = HTTP.use(:auto_inflate).headers(headers).get(fetch_url)\n\n if HTTP::Redirector::REDIRECT_CODES.include? response.status\n if response.status != 301\n all_301s = false\n end\n fetch_url = response.headers[\"Location\"]\n else\n break\n end\n end\n\n return response, (tries > 1 && all_301s ? fetch_url : nil)\n end",
"def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end",
"def url_response(url, max_redirects=6, timeout=7)\n response = nil\n parsed_page = nil\n seen = Set.new\n loop do\n url = URI.parse(url)\n break if seen.include? url.to_s\n break if seen.size > max_redirects\n seen.add(url.to_s)\n # initialize our http connection\n http = Net::HTTP.new(url.host, url.port)\n http.open_timeout = timeout\n http.read_timeout = timeout\n\n # Determine path to access\n # Treat an empty path as \"/\"\n path = (url.path.nil? or url.path.empty?) ? \"/\" : url.path\n # Append querystring to path if found\n path = path + \"?\" + url.query if !url.query.nil?\n\n # Initialize our HTTP request\n req = Net::HTTP::Get.new(path)\n\n # Handle HTTPS as needed\n if url.instance_of? URI::HTTPS\n http.use_ssl=true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n # Get back the response (i.e. actually perform request)\n response = http.request(req)\n if response.kind_of?(Net::HTTPRedirection)\n url = response['location']\n parsed_page = nil\n elsif response.kind_of?(Net::HTTPSuccess)\n # Parse the HTML using Nokogiri\n parsed_page = Nokogiri::HTML(response.body)\n # Check for a <meta http-equiv=\"refresh\"> type of redirect\n # If found, we will parse out the redirect URL and load it\n # NOTE: The following is a case insensitive XPATH search for <meta http-equiv=\"refresh\">\n # returning the value of the \"content\" attribute.\n meta_refresh = parsed_page.xpath(\"//meta[translate(\n @http-equiv, \n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', \n 'abcdefghijklmnopqrstuvwxyz'\n ) = 'refresh'\n ]/@content\").to_s\n # Attempt to parse out a URL=\"\" from @content attribute\n if meta_refresh and result = meta_refresh.match(/URL=(.+)/i)\n # Found a redirect URL, we'll load that one next in our loop\n url = result.captures[0].gsub(/['\"]/, '')\n parsed_page = nil\n else # Otherwise, we have a valid response & parsed page\n break\n end\n else # Else, response was an error (4xx or 5xx)\n break\n end\n end\n\n # return final URL response (after redirects)\n # AND the parsed page (from Nokogiri)\n return url, response, parsed_page\nend",
"def follow_redirect!(**args); end",
"def resolve_redirects_n_read(id)\n (prefix1, prefix2) = make_path_prefix(id)\n fname = @enwiki_dir + \"/\" + prefix1 + \"/\" + prefix2 + \"/#{id}.xml\"\n s = File.open(fname, \"r:UTF-8\").read\n if s =~ /#REDIRECT \\[\\[(.*?)\\]\\]/\n # If there is a \"#\" in the redirect title, remove stuff after it\n new_title = $1.gsub /#.*/, ''\n # Get article id for the new title\n new_id = get_article_id(new_title)\n return nil if new_id.nil?\n resolve_redirects_n_read(new_id)\n else\n return s\n end\n end",
"def passive\n\t# make a matches array\n\tm=[]\n\t\n\t# If the HTTP status is 302 and the redirection location is /admin/genericcms.php then match\n\tif @status.to_s =~ /^302$/ and @headers[\"location\"] =~ /^\\/admin\\/genericcms\\.php$/\n\t\tm << { :name => \"302 redirection to /admin/genericcms.php\" }\n\tend\n\n\t# You can add debugging and check the value of variables\n\t# pp @status\n\t# pp @headers\n\t\n\t# return the matches array, even if it's empty\n\tm\nend",
"def content_get\n # compress GET requests to try and stay under that 8KB request limit\n deflated_request = Zlib::Deflate.deflate(@request, 9)[2..-5]\n # strict_encode64() isn't available? sub out the newlines\n @request_params[\"SAMLRequest\"] = Base64.encode64(deflated_request).gsub(/\\n/, \"\")\n \n Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n uri = Addressable::URI.parse(@URL)\n if uri.query_values == nil\n uri.query_values = @request_params\n else\n # solution to stevenwilkin's parameter merge\n uri.query_values = @request_params.merge(uri.query_values)\n end\n url = uri.to_s\n #Logging.debug \"Sending to URL #{url}\"\n return url\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def check_response(response)\n case response\n when Net::HTTPSuccess then\n #puts response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n puts response.value\n end\nend",
"def resolve_redirects(id, level)\n return nil if level > 5\n \n (prefix1, prefix2) = make_path_prefix(id)\n fname = @enwiki_dir + \"/\" + prefix1 + \"/\" + prefix2 + \"/#{id}.xml\"\n s = File.open(fname, \"r:UTF-8\").read\n if s =~ /#REDIRECT \\[\\[(.*?)\\]\\]/\n # If there is a \"#\" in the redirect title, remove stuff after it\n new_title = $1.gsub /#.*/, ''\n # Get article id for the new title\n new_id = get_article_id(new_title)\n return nil if new_id.nil?\n return resolve_redirects(new_id, level+1)\n else\n return id\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def content_get\n\t\t\t# compress GET requests to try and stay under that 8KB request limit\n\t\t\tdeflated_request = Zlib::Deflate.deflate(@request, 9)[2..-5]\n\t\t\t# strict_encode64() isn't available? sub out the newlines\n\t\t\t@request_params[\"SAMLRequest\"] = Base64.encode64(deflated_request).gsub(/\\n/, \"\")\n\t\t\t\n\t\t\tLogging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n\t\t\turi = Addressable::URI.parse(@URL)\n\t\t\turi.query_values = @request_params\n\t\t\turl = uri.to_s\n\t\t\t#url = @URL + \"?SAMLRequest=\" + @request_params[\"SAMLRequest\"]\n\t\t\tLogging.debug \"Sending to URL #{url}\"\n\t\t\treturn url\n\t\tend",
"def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n end\nend",
"def do_post_redirect(post_redirect)\n uri = post_redirect.uri\n\n session[:post_redirect_token] = post_redirect.token\n\n # XXX what is the built in Ruby URI munging function that can do this\n # choice of & vs. ? more elegantly than this dumb if statement?\n if uri.include?(\"?\")\n if uri.include?(\"#\")\n uri.sub!(\"#\", \"&post_redirect=1#\")\n else\n uri += \"&post_redirect=1\"\n end\n else\n if uri.include?(\"#\")\n uri.sub!(\"#\", \"?post_redirect=1#\")\n else\n uri += \"?post_redirect=1\"\n end\n end\n redirect_to uri\n end",
"def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end",
"def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n response.value\n end\nend",
"def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n response.value\n end\nend",
"def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end",
"def redirect(uri, verb = T.unsafe(nil)); end",
"def fetch(url)\n begin\n uri = URI.parse(url)\n if !uri.is_a?(URI::HTTP)\n \t return\n end\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = (http.port == 443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n res = http.request(request)\n\n case res\n when Net::HTTPSuccess then\n\t puts \"#{res.code}: #{url}\"\n when Net::HTTPRedirection then\n \t redirect = res['location']\n\t puts \"#{res.code}: #{url}\"\n\t fetch redirect\n else\n\t puts \"#{res.code}: #{url}\"\n end\n rescue\n end\nend",
"def fetch(uri_str, limit = 10)\n raise ArgumentError, 'HTTP redirect too deep' if limit == 0\n\n if FARENHEIT and uri_str =~ FIVEDAY\n uri_str = uri_str.dup\n uri_str[FIVEDAY] = '5day_f.shtml'\n end\n\n response = Net::HTTP.get_response(URI.parse(uri_str))\n case response\n when Net::HTTPSuccess then response\n when Net::HTTPRedirection then fetch(response['location'], limit - 1)\n else\n response.error!\n end\nend",
"def redirect(url); end",
"def redirect_to(url)\n response = Rack::Response.new\n response.redirect(url, 301) # moved permanently\n response.finish\n response.to_a\n end",
"def fetch(uri_str, limit = 10)\n raise TooManyRedirectsError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n fetch(response['location'], limit - 1)\n else\n response.value\n end\nend",
"def fetch(uri_str, limit = 10)\n raise TooManyRedirectsError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n fetch(response['location'], limit - 1)\n else\n response.value\n end\nend",
"def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend",
"def chase_redirect(url)\n u = URI.parse(url)\n (0..9).each do\n opts = { use_ssl: u.scheme == 'https',\n ca_file: Chef::Config[:ssl_ca_file] }\n resp = Net::HTTP.start(u.host, u.port, opts) { |h| h.head(u.to_s) }\n return u.to_s unless resp.is_a?(Net::HTTPRedirection)\n u = URI.parse(resp['location'])\n end\n nil\n end",
"def http_get_with_redirect(url:, limit: 5, verify_mode: OpenSSL::SSL::VERIFY_PEER)\n limit = Integer(limit)\n raise ArgumentError, 'limit cannot be negative' if limit < 0\n raise 'too many HTTP redirects' if limit.zero?\n\n # configure Net::HTTP\n http = Net::HTTP.new(url.host, url.port)\n http.open_timeout = fetch :http_open_timeout\n http.read_timeout = fetch :http_read_timeout\n if url.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = verify_mode\n end\n request = Net::HTTP::Get.new(url.path) # build request\n response = http.request(request) # call url\n if response.is_a? Net::HTTPRedirection\n # Does not handle multiple redirects. Code/idea from http://stackoverflow.com/a/7210600/1796645\n location = URI.parse(response.header['location'])\n info \"redirected to #{location}\"\n response = http_get_with_redirect(url: location, limit: limit - 1, verify_mode: verify_mode)\n end\n response\n end",
"def forward(req)\n return nil if req.nil?\n\n # Parse request elements\n host = 'dojo.nplusplus.ninja'\n path = req.request_uri.path\n path.sub!(/\\/[^\\/]+/, '') if path[/\\/(.+?)\\//, 1] != 'prod'\n body = req.body\n\n # Create request\n uri = URI.parse(\"https://#{host}#{path}?#{req.query_string}\")\n case req.request_method.upcase\n when 'GET'\n new_req = Net::HTTP::Get.new(uri)\n when 'POST'\n new_req = Net::HTTP::Post.new(uri)\n else\n return nil\n end\n\n # Add headers and body (clean default ones first)\n new_req.to_hash.keys.each{ |h| new_req.delete(h) }\n req.header.each{ |k, v| new_req[k] = v[0] }\n new_req['host'] = host\n new_req.body = body\n\n # Execute request\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 5){ |http|\n http.request(new_req)\n }\n res.code.to_i != 200 ? nil : res.body\nrescue => e\n lex(e, 'Failed to forward request to Metanet')\n nil\nend",
"def index\n @redirects = Redirect.all\n end",
"def http_get_auth_resource(location, username,password, depth)\n\n unless depth > 0\n @task_result.logger.log_error \"Too many redirects\"\n exit\n end\n\n uri = URI.parse(location)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri,{\"User-Agent\" => \"Intrigue!\"})\n request.basic_auth(username,password)\n response = http.request(request)\n\n if response == Net::HTTPRedirection\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n elsif response == Net::HTTPMovedPermanently\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n else\n @task_result.logger.log \"Got response: #{response}\"\n end\n\n response\n end",
"def do_request(verb, path, body = nil, headers = {}, limit = 10)\n raise SwordException, 'HTTP redirection is too deep...cannot retrieve requested path: ' + path if limit == 0\n response = request(verb, path, body, headers)\n #determine response\n case response\n when Net::HTTPSuccess then response\n when Net::HTTPRedirection then do_request(verb, response['location'], body, headers, limit - 1)\n else\n response.error!\n end\n end",
"def ensure_redirect response, url_matcher\n expect(response.code).to eq('301').or eq('302')\n expect(response.header['location']).to match url_matcher\n # href = document(response.body).css('a').attr('href').value\n # expect(href).to match url_matcher\n response.header['location']\n end",
"def recover(aspect)\n #get http://server/reports/<aspect>/\n ph,pt,pu,pp = html_proxy\n prox = Net::HTTP::Proxy(ph,pt,pu,pp)\n puts \"Opened Proxy #{prox.inspect}\"\n prox.start(@server, @html_port) do |h|\n puts \"Get\"\n #post2 does not raise exceptions.\n #aspect id (3) is bogus.\n response = h.get('/reports/3')\n puts \"got response\"\n \n puts \"done.\"\n end\n puts \"On way out\"\n end",
"def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end",
"def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end",
"def get_xml(params = {:format => :xml, :action => :query})#TODO put these in so that they're default and not lost when we pass stuff in...\n url = _form_url(params)\n \n #TODO wonder if I should make a generic library for external url requests, to standardize the header/etc?\n #requests without user-agents are refused. See:\n #http://www.mooduino.co.uk/2010/04/wikipedia-api-user-agent-string-in-php.html\n retries = 2\n begin\n http = Net::HTTP.new(WIKI_API_SERVER) #en.wikipedia.org\n resp = http.request_get(WIKI_API_PATH + url, 'User-Agent' => 'WikipediaAntiSpamBot/0.1 (+hincapie.cis.upenn.edu)')\n \n raise \"POST FAILED:\" + resp.inspect unless resp.is_a? Net::HTTPOK or resp.is_a? Net::HTTPFound\n #retry if resp.body.to_s.empty?\n resp.body\n rescue Net::HTTPBadResponse, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::ECONNREFUSED, SocketError, \n Timeout::Error, Errno::EINVAL, EOFError, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n if retries > 0\n retries -= 1\n retry\n else\n raise Exception.new(\"Connection timed out after more than 3 retries: #{e}\")\n end\n end\nend",
"def follow_redirect(response)\n raise MalformedServerResponse.new(self, response) unless response.header.location\n if response.moved_permanently?\n new_uri = response.header.location\n logger.info(\" Permanently redirected to #{new_uri} - Storing new location.\")\n resource.update_uri new_uri\n @header.host = resource.host\n response = fetch_response\n elsif response.see_other? # Always use GET for this redirect, regardless of initial method\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n response = Request.new(:get, redirected_resource, body, header).fetch_response\n else\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n logger.info(\" Redirected to #{redirected_resource.uri} - Caching new location.\")\n response = Request.new(method, redirected_resource, body, header).fetch_response\n end\n end",
"def fetch(url, limit = 10)\n raise ArgumentError, \"HTTP Redirect too deep\" if limit.zero?\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPSuccess\n res.body\n when Net::HTTPRedirection\n fetch(res['location'], limit - 1)\n else\n raise ArgumentError, res.error!\n end\n end",
"def follow_redirect=(follow); end",
"def print_my_recent_bookmarks(username, password)\n # Make the HTTPS request.\n response = open('https://api.del.icio.us/v1/posts/recent',\n :http_basic_authentication => [username, password])\n\n # Read the response entity-body as an XML document.\n xml = response.read\n\n # Turn the document into a data structure.\n document = REXML::Document.new(xml)\n\n # For each bookmark...\n REXML::XPath.each(document, \"/posts/post\") do |e|\n # Print the bookmark's description and URI\n puts \"#{e.attributes['description']}: #{e.attributes['href']}\"\n end\nend",
"def redirect_clickthroughs\n if (params[:ct])\n params.delete :ct\n headers[\"Status\"] = \"301 Moved Permanently\"\n redirect_to params, :status => 301\n end\n return true\n end",
"def new\n @post306 = Post306.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post306 }\n end\n end",
"def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end",
"def test_srpm_changelog_url\n get '/srpm/Sisyphus/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/Sisyphus/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch51/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/5.1/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/p5/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/Platform5/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch41/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/4.1/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n\n get '/srpm/Branch4/glibc/changelog'\n assert_equal 'http://packages.altlinux.org/ru/4.0/srpms/glibc/changelog', last_response.location\n assert_equal 301, last_response.status\n end",
"def fetch( uri_str, limit = 10 )\n # You should choose better exception.\n raise ArgumentError, 'HTTP redirect too deep' if limit == 0\n response = get_response(URI.parse(uri_str))\n case response\n when Net::HTTPSuccess then response\n when Net::HTTPRedirection then fetch(response['location'], limit - 1)\n else\n response.error!\n end\n end",
"def visit\n remote_url = File.join(Rails.configuration.application_root_url, \"people/#{rubydora_object.pid}\")\n RestClient.get(remote_url, content_type: :html, accept: :html, verify_ssl: OpenSSL::SSL::VERIFY_NONE) do |response, request, result, &block|\n if [301, 302, 307].include? response.code\n response.follow_redirection(request, result, &block)\n else\n response.return!(request, result, &block)\n end\n end\n end",
"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",
"def http_fetch(uri_str, limit = 3)\n raise ArgumentError, 'HTTP redirect too deep' if limit <= 0\n\n uri = URI.parse(uri_str)\n request = Net::HTTP::Get.new(uri.path, {'User-Agent' => 'MetaBroadcast image resizer'})\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') { |http| http.request(request) }\n\n case response\n when Net::HTTPRedirection then http_fetch(response['location'], limit - 1)\n else\n response\n end\nend",
"def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end",
"def forward(data)\n timestamp = Time.now\n http = Net::HTTP.new(url.host, url.port)\n \n http.read_timeout = http_read_timeout\n http.open_timeout = http_open_timeout\n \n \n request = Net::HTTP::Post.new(url.request_uri)\n request['Authorization'] = Authorization.new(data, timestamp).header\n request['Content-Type'] = 'application/octet-stream'\n request.body = data\n \n if secure\n http.use_ssl = true\n http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n http.use_ssl = false\n end\n \n response = nil\n \n begin\n response = http.request(request)\n rescue Exception => e\n puts \"Timeout while connecting to the Sentry server\"\n end\n end",
"def test_redirection_location\n process :redirect_internal\n assert_equal 'http://test.host/nothing', @response.redirect_url\n\n process :redirect_external\n assert_equal 'http://www.rubyonrails.org', @response.redirect_url\n end",
"def article(name)\n redirect R(PostController, name), :status => 301\n end",
"def redirect_to_api\n cache_duration 3600\n redirect \"http://#{ DropFetcher.base_uri }#{ request.path }\", 301\n end",
"def get_web_document(url)\n uri = URI.parse(url)\n response = Net::HTTP.get_response(uri)\n\n case response \n when Net::HTTPSuccess\n return response.body\n when Net::HTTPRedirection\n return get_web_document(response['Location'])\n else\n return nil\n end\nend",
"def update_permanent_uri(options={})\n for uri, response in @redirects\n break if response.status != \"301\"\n self.resource.permanent_uri =\n Addressable::URI.parse(response.headers[\"Location\"])\n end\n end",
"def posts\n @url = MYHOST + \"/api/posts/all\"\n\n\n @respuesta = HTTParty.get(\n @url.to_str\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end",
"def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end",
"def test_offers\r\n get :offers, :id => 5072\r\n assert_response 301\r\n assert_redirected_to '/Ear-Force-X2-Wireless-Headphones-for-Xbox-reviews'\r\n end",
"def fetch(uri_str, limit = 10)\n # You should choose better exception.\n raise ArgumentError, 'HTTP redirect too deep' if limit == 0\n\n response = Net::HTTP.get_response(URI.parse(uri_str))\n case response\n when Net::HTTPSuccess then response\n when Net::HTTPRedirection then fetch(response['location'], limit - 1)\n else\n response.error!\n end\n end",
"def save_webpage_redirects\n redirections.each do |redirection|\n redirect_url = redirection.headers[:location]\n webpage_redirect = WebpageRedirect.new(url: redirect_url)\n @webpage_response.webpage_redirects << webpage_redirect\n end\n end",
"def parse(uri, response, body); end",
"def http_peek(url)\n @log.debug \"http_peek... #{url}\"\n uri = Addressable::URI.parse url\n if uri.port\n http = Net::HTTP.new(uri.host, uri.port)\n else\n http = Net::HTTP.new(uri.host,\n Addressable::URI.port_mapping[uri.scheme])\n end\n http.open_timeout = 5\n\n # Unfortunately the net/http(s) API can't seem to do this for us,\n # even if we require net/https from the beginning (ruby 1.8)\n if uri.scheme == \"https\"\n require 'net/https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if bot.config[\"log_level\"] == \"debug\"\n http.set_debug_output $stderr\n end\n\n begin\n res = http.start { |http|\n @log.debug \"http.start, http object: \" + \n PP.singleline_pp(http, '')\n req = Net::HTTP::Get.new(uri.request_uri,\n { 'User-Agent' => 'campfire-bot/20110709 ' +\n '(x86_64-unknown-linux-gnu) ruby-stdlib-net/1.8.7' })\n\n if uri.user != nil && uri.user != \"\" &&\n uri.password != nil && uri.password != \"\"\n req.basic_auth uri.user, uri.password\n end\n\n response = http.request req\n @log.debug \"http.start, response: \" + \n PP.singleline_pp(response, '')\n response\n }\n\n rescue Exception => e\n @log.error \"Exception... #{e.class.name}, #{e.message}\"\n end\n\n case res\n when Net::HTTPRedirection\n uri.merge({ :host => res.header['Location'] })\n @log.debug \"following HTTPRedirection... res: #{res}, uri: \" +\n \"#{uri.omit(:user, :password)}, header: #{res.header['Location']}\"\n [res.header['Location'], res]\n\n else # Net::HTTPSuccess or error\n @log.debug \"proper non-redirected location... res: #{res}, uri: #{uri.omit(:user, :password)}\"\n [url, res]\n end\n end",
"def check_redirect\n url = \"http://autodiscover.#{@domain}/autodiscover/autodiscover.svc\"\n begin\n res = HTTPClient.head(url)\n rescue\n return nil\n end\n return nil unless res.status_code == 302\n @redirect = res.header[\"Location\"][0]\n end",
"def filter_redirect; end",
"def filter_redirect; end",
"def post(service, payload)\n @resource[service].post(payload) { |response, request, result, &block|\n if [301, 302, 307].include?(response.code)\n response.follow_redirection(request, result, &block)\n else\n response.return!(request, result, &block)\n end\n }\n end",
"def redirect_url (response)\r\n\tif response.nil?\r\n\t\treturn\r\n\tend\r\n\tif response == ''\r\n\t\treturn\r\n\tend\r\n if response['location'].nil?\r\n response.body.match(/<a href=\\\"([^>]+)\\\">/i)[1]\r\n else\r\n response['location']\r\n end\r\n end",
"def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end",
"def request(path, parameters = {}, second_try = false)\n response = post(path, convert_body(parameters), \"Content-Type\" => content_type)\n \n if DEBUG\n puts \"Reponse:\"\n puts response.body\n end\n \n if response.code.to_i / 100 == 2\n result = XmlSimple.xml_in(response.body, 'keeproot' => true,\n 'contentkey' => '__content__', 'forcecontent' => true)\n typecast_value(result)\n elsif response.code == \"302\" && !second_try\n connect!(@url, !@use_ssl)\n request(path, parameters, true)\n else\n raise \"#{response.message} (#{response.code})\"\n end\n end",
"def http_redirect?\n @get_resp.kind_of?(Net::HTTPRedirection)\n end",
"def http_redirect?\n @get_resp.kind_of?(Net::HTTPRedirection)\n end",
"def redirect?\n\t\t\thttp_response = Net::HTTP.get_response(URI.parse(@page[:url]))\n\t\t\thttp_response == Net::HTTPRedirection\n\t\trescue Net::HTTPBadResponse\n\t\t\t# Dont do anything, as it is supposed to be raised.\n\t\tend",
"def fwd\n\n url_id = params[:id]\n \n if !url_id.nil? && !url_id.empty?\n link_id = Base32::Crockford.decode(url_id)\n else\n # It will be catched by the next block now\n link_id = -1\n end\n \n begin\n link = Link.find(link_id)\n redirect_to_full_url(link.url, 301)\n rescue ActiveRecord::RecordNotFound\n redirect_to :controller => \"links\", :action => \"new\"\n end\n\n end"
] | [
"0.6549692",
"0.64149165",
"0.62923175",
"0.62308323",
"0.60587853",
"0.5903428",
"0.58748364",
"0.58030635",
"0.5652155",
"0.5641995",
"0.5627749",
"0.5627476",
"0.5604831",
"0.56004226",
"0.5590861",
"0.5518629",
"0.5481308",
"0.5477773",
"0.5472376",
"0.54668015",
"0.54580384",
"0.5436013",
"0.54294074",
"0.5422133",
"0.54164803",
"0.540966",
"0.5397245",
"0.5375987",
"0.5374565",
"0.5367886",
"0.53569055",
"0.53560215",
"0.5355423",
"0.5350302",
"0.53385586",
"0.53292185",
"0.5323168",
"0.53223825",
"0.53195894",
"0.5318296",
"0.5306766",
"0.5298935",
"0.5298935",
"0.52712446",
"0.525807",
"0.52453",
"0.52301",
"0.52245384",
"0.5222046",
"0.5210621",
"0.5210621",
"0.5194003",
"0.51604575",
"0.5158207",
"0.5156604",
"0.5144233",
"0.5117107",
"0.5084682",
"0.5083497",
"0.5078274",
"0.50774133",
"0.50774133",
"0.50757045",
"0.50583696",
"0.5047043",
"0.5046261",
"0.5038777",
"0.50335044",
"0.50331277",
"0.50291824",
"0.5028731",
"0.50194246",
"0.50187904",
"0.5014507",
"0.50108504",
"0.499798",
"0.4996074",
"0.49936098",
"0.49907237",
"0.49866474",
"0.49849385",
"0.49706602",
"0.4960222",
"0.4947779",
"0.49429438",
"0.49403408",
"0.4938428",
"0.49352232",
"0.4921008",
"0.4919593",
"0.49049395",
"0.49049395",
"0.48993748",
"0.48905003",
"0.48865414",
"0.4880205",
"0.48736715",
"0.48736715",
"0.48671773",
"0.4856028"
] | 0.6360954 | 2 |
GET /post302s/new GET /post302s/new.xml | def new
@post302 = Post302.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post302 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @post302 = Post302.new(params[:post302])\n\n respond_to do |format|\n if @post302.save\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }\n format.xml { render :xml => @post302, :status => :created, :location => @post302 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @post306 = Post306.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post306 }\n end\n end",
"def show\n @post302 = Post302.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @post377 = Post377.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post377 }\n end\n end",
"def new\n @post404 = Post404.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post404 }\n end\n end",
"def new\n @post310 = Post310.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post310 }\n end\n end",
"def new\n @post322 = Post322.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post322 }\n end\n end",
"def new\n @post227 = Post227.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post227 }\n end\n end",
"def new\n @post260 = Post260.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post260 }\n end\n end",
"def new\n @post110 = Post110.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post110 }\n end\n end",
"def new\n @post101 = Post101.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post101 }\n end\n end",
"def new\n @post305 = Post305.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post305 }\n end\n end",
"def new\n @post366 = Post366.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post366 }\n end\n end",
"def new\n @post275 = Post275.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post275 }\n end\n end",
"def new\n @post321 = Post321.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post321 }\n end\n end",
"def new\n @post326 = Post326.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post326 }\n end\n end",
"def new\n @post183 = Post183.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post183 }\n end\n end",
"def new\n @post295 = Post295.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post295 }\n end\n end",
"def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\n end\n end",
"def new\n @post230 = Post230.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post230 }\n end\n end",
"def new\n @post350 = Post350.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post350 }\n end\n end",
"def new\n @post182 = Post182.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post182 }\n end\n end",
"def new\n @post405 = Post405.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post405 }\n end\n end",
"def new\n @post130 = Post130.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post130 }\n end\n end",
"def new\n @post339 = Post339.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post339 }\n end\n end",
"def new\n @post272 = Post272.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post272 }\n end\n end",
"def new\n @post360 = Post360.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post360 }\n end\n end",
"def new\n @post231 = Post231.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post231 }\n end\n end",
"def new\n @post120 = Post120.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post120 }\n end\n end",
"def new\n respond_to do |wants|\n wants.html { redirect_to pretty_post_url(@post) + '#comments' }\n wants.xml { render :xml => @comment }\n end\n end",
"def new\n @post341 = Post341.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post341 }\n end\n end",
"def new\n @post217 = Post217.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post217 }\n end\n end",
"def new\n @post342 = Post342.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post342 }\n end\n end",
"def new\n @post318 = Post318.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post318 }\n end\n end",
"def new\n @post402 = Post402.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post402 }\n end\n end",
"def new\n @post335 = Post335.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post335 }\n end\n end",
"def new\n @post297 = Post297.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post297 }\n end\n end",
"def new\n @post122 = Post122.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post122 }\n end\n end",
"def new\n @post370 = Post370.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post370 }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @post290 = Post290.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post290 }\n end\n end",
"def new\n @post150 = Post150.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post150 }\n end\n end",
"def new\n @post50 = Post50.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post50 }\n end\n end",
"def new\n @post423 = Post423.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post423 }\n end\n end",
"def new\n @post332 = Post332.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post332 }\n end\n end",
"def new\n @post362 = Post362.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post362 }\n end\n end",
"def new\n @post194 = Post194.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post194 }\n end\n end",
"def new\n @post445 = Post445.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post445 }\n end\n end",
"def new\n @post284 = Post284.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post284 }\n end\n end",
"def new\n @post41 = Post41.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post41 }\n end\n end",
"def destroy\n @post302 = Post302.find(params[:id])\n @post302.destroy\n\n respond_to do |format|\n format.html { redirect_to(post302s_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @post253 = Post253.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post253 }\n end\n end",
"def new\n @post33 = Post33.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post33 }\n end\n end",
"def new\n @post133 = Post133.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post133 }\n end\n end",
"def new\n @post109 = Post109.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post109 }\n end\n end",
"def new\n @post184 = Post184.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post184 }\n end\n end",
"def new\n @post252 = Post252.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post252 }\n end\n end",
"def new\n @post134 = Post134.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post134 }\n end\n end",
"def new\n @post267 = Post267.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post267 }\n end\n end",
"def new\n @post316 = Post316.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post316 }\n end\n end",
"def new\n @post81 = Post81.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post81 }\n end\n end",
"def new\n @post174 = Post174.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post174 }\n end\n end",
"def new\n @post197 = Post197.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post197 }\n end\n end",
"def new\n @post221 = Post221.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post221 }\n end\n end",
"def new\n @post251 = Post251.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post251 }\n end\n end",
"def new\n @post246 = Post246.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post246 }\n end\n end",
"def new\n @post262 = Post262.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post262 }\n end\n end",
"def update\n @post302 = Post302.find(params[:id])\n\n respond_to do |format|\n if @post302.update_attributes(params[:post302])\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @post78 = Post78.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post78 }\n end\n end",
"def new\n @post287 = Post287.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post287 }\n end\n end",
"def new\n @post65 = Post65.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post65 }\n end\n end",
"def new\n @post191 = Post191.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post191 }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def new\n @post129 = Post129.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post129 }\n end\n end",
"def new\n @post364 = Post364.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post364 }\n end\n end",
"def new\n @post407 = Post407.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post407 }\n end\n end",
"def new\n @post228 = Post228.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post228 }\n end\n end",
"def new\n @post193 = Post193.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post193 }\n end\n end",
"def new\n @post245 = Post245.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post245 }\n end\n end",
"def new\n @post117 = Post117.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post117 }\n end\n end",
"def new\n @post257 = Post257.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post257 }\n end\n end",
"def new\n @post106 = Post106.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post106 }\n end\n end",
"def new\n @post358 = Post358.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post358 }\n end\n end",
"def new\n @post273 = Post273.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post273 }\n end\n end",
"def new\n @post493 = Post493.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post493 }\n end\n end",
"def new\n @post470 = Post470.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post470 }\n end\n end",
"def new\n @post55 = Post55.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post55 }\n end\n end",
"def new\n @post99 = Post99.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post99 }\n end\n end",
"def new\n @post409 = Post409.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post409 }\n end\n end",
"def redirects; end",
"def new\n @post139 = Post139.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post139 }\n end\n end",
"def new\n @post385 = Post385.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post385 }\n end\n end",
"def new\n @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end",
"def new\n @post215 = Post215.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post215 }\n end\n end",
"def new\n @post276 = Post276.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post276 }\n end\n end",
"def new\n @post489 = Post489.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post489 }\n end\n end",
"def new\n @post125 = Post125.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post125 }\n end\n end",
"def new\n @post77 = Post77.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post77 }\n end\n end",
"def new\n @post196 = Post196.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post196 }\n end\n end"
] | [
"0.72212535",
"0.65230787",
"0.6439",
"0.6321765",
"0.6261677",
"0.62541753",
"0.62162423",
"0.6197615",
"0.61881196",
"0.6173761",
"0.61640406",
"0.6133067",
"0.6119894",
"0.6119476",
"0.6112073",
"0.61101675",
"0.61096144",
"0.60991657",
"0.6096511",
"0.6085207",
"0.6083968",
"0.60796493",
"0.6074047",
"0.6066511",
"0.60655916",
"0.6052946",
"0.6051749",
"0.60408384",
"0.6035592",
"0.60285956",
"0.6028539",
"0.602817",
"0.6027077",
"0.6023603",
"0.60153264",
"0.60133344",
"0.60064185",
"0.6004716",
"0.60037595",
"0.6002491",
"0.60018647",
"0.6001714",
"0.5994182",
"0.599367",
"0.5982314",
"0.59750223",
"0.59642994",
"0.59597886",
"0.59458375",
"0.59444606",
"0.5941097",
"0.5940165",
"0.5939901",
"0.59360576",
"0.5934702",
"0.59263647",
"0.5925459",
"0.592497",
"0.592151",
"0.59201753",
"0.59191984",
"0.59173465",
"0.59160185",
"0.5914098",
"0.59102625",
"0.59091026",
"0.59085363",
"0.5901042",
"0.59002995",
"0.5899588",
"0.58980554",
"0.5894037",
"0.5894011",
"0.5887609",
"0.5886127",
"0.58856684",
"0.58856",
"0.588435",
"0.5883612",
"0.58812547",
"0.58808285",
"0.5877034",
"0.58735526",
"0.5873356",
"0.5868961",
"0.58652246",
"0.5864979",
"0.58636874",
"0.5851218",
"0.58510983",
"0.5847727",
"0.5847364",
"0.5844657",
"0.584268",
"0.5837937",
"0.583754",
"0.58339226",
"0.583215",
"0.5830034",
"0.58261675"
] | 0.7872124 | 0 |
POST /post302s POST /post302s.xml | def create
@post302 = Post302.new(params[:post302])
respond_to do |format|
if @post302.save
format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }
format.xml { render :xml => @post302, :status => :created, :location => @post302 }
else
format.html { render :action => "new" }
format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def handle_302_found(response,request_url,redirects)\n raise \"Too many redirects followed to redirect again for 302 response: followed (#{redirects}) redirects while retrieving #{request_url}\" unless redirects > 0\n handle_301_moved_permanantly(response,request_url,redirects)\n end",
"def redirects; end",
"def update\n @post302 = Post302.find(params[:id])\n\n respond_to do |format|\n if @post302.update_attributes(params[:post302])\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @post302 = Post302.find(params[:id])\n @post302.destroy\n\n respond_to do |format|\n format.html { redirect_to(post302s_url) }\n format.xml { head :ok }\n end\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend",
"def post_form(params, url, wait_for_next_state=nil, wait_before_post=nil)\n if wait_before_post != nil and wait_before_post.is_a? Integer\n 0.upto wait_before_post do |value|\n sleep(1)\n print \".\"\n end\n end\n validate_params(params, url)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.request_uri)\n if @atl_token != \"\"\n params[\"atl_token\"] = @atl_token\n end\n req.set_form_data(params)\n req['Cookie'] = get_cookie\n use_ssl = false\n if uri.instance_of? URI::HTTPS\n use_ssl = true\n end\n if @host_url \n req.add_field(\"Host\", @host_url)\n end\n Net::HTTP.start(uri.hostname, uri.port, use_ssl: use_ssl, verify_mode: OpenSSL::SSL::VERIFY_NONE, :read_timeout => 1000) do |http|\n response = http.request(req)\n puts \"Response: #{response.inspect}\".yellow\n puts \"Location: #{response['location'].to_s}\".yellow\n puts \"Current : #{@url}#{get_current_url}\".yellow\n # puts \"BODY: #{response.body}\"\n redirected = true\n if response['location'] and !\"#{@url}/#{get_current_url}\".include? response['location']\n redirection_url = compose_redirection_url(response['location'])\n @current_url = URI.parse(redirection_url).request_uri\n else\n puts \"Was not redirected, staying on page...\".yellow\n redirected = false\n end\n puts \"Redirected to: #{@current_url.to_s}\".yellow\n # future REST requests might use different response codes\n # For example a 201 might be returned where there is no content, but still a success\n # In case 200 is here there may be an error in the form, maybe add some checking\n puts \"Returned response code: #{response.code}, #{response.code.to_i != 302 and response.code.to_i != 200}\"\n if response.code.to_i != 302 and response.code.to_i != 200\n puts response.inspect.red\n puts response.body.inspect.red\n raise \"There is a problem while calling #{url} with params #{params}\"\n end\n # follow redirects, if redirected\n if redirected and redirected == true\n puts \"Doing the redirection... #{redirected}\".yellow\n get_stage_and_fetch_cookie(\"#{@url}#{get_current_url}\")\n else\n # in case the app is waiting for an event\n if wait_for_next_state != nil\n if wait_for_next_state.is_a? Integer\n actual_url = @current_url\n while wait_for_next_state > 0 and @current_url == actual_url\n puts \"Sleeping for 5, #{wait_for_next_state}\".yellow\n sleep(5)\n # this will change current_url in case of redirection\n get_stage_and_fetch_cookie(\"#{@url}\")\n wait_for_next_state = wait_for_next_state-1\n if wait_for_next_state < 0\n abort \"Waited too long, check the config...\"\n end\n end\n end\n end\n end\n puts \"Done posting #{url}\".yellow\n end\n end",
"def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end",
"def do_post_redirect(post_redirect)\n uri = post_redirect.uri\n\n session[:post_redirect_token] = post_redirect.token\n\n # XXX what is the built in Ruby URI munging function that can do this\n # choice of & vs. ? more elegantly than this dumb if statement?\n if uri.include?(\"?\")\n if uri.include?(\"#\")\n uri.sub!(\"#\", \"&post_redirect=1#\")\n else\n uri += \"&post_redirect=1\"\n end\n else\n if uri.include?(\"#\")\n uri.sub!(\"#\", \"?post_redirect=1#\")\n else\n uri += \"?post_redirect=1\"\n end\n end\n redirect_to uri\n end",
"def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end",
"def redirect_ok=(follow); end",
"def post(service, payload)\n @resource[service].post(payload) { |response, request, result, &block|\n if [301, 302, 307].include?(response.code)\n response.follow_redirection(request, result, &block)\n else\n response.return!(request, result, &block)\n end\n }\n end",
"def follow_redirect?; end",
"def follow_redirect!(**args); end",
"def save_webpage_redirects\n redirections.each do |redirection|\n redirect_url = redirection.headers[:location]\n webpage_redirect = WebpageRedirect.new(url: redirect_url)\n @webpage_response.webpage_redirects << webpage_redirect\n end\n end",
"def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end",
"def forward(data)\n timestamp = Time.now\n http = Net::HTTP.new(url.host, url.port)\n \n http.read_timeout = http_read_timeout\n http.open_timeout = http_open_timeout\n \n \n request = Net::HTTP::Post.new(url.request_uri)\n request['Authorization'] = Authorization.new(data, timestamp).header\n request['Content-Type'] = 'application/octet-stream'\n request.body = data\n \n if secure\n http.use_ssl = true\n http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n http.use_ssl = false\n end\n \n response = nil\n \n begin\n response = http.request(request)\n rescue Exception => e\n puts \"Timeout while connecting to the Sentry server\"\n end\n end",
"def follow_redirect!\n unless last_response.redirect?\n raise Error, 'Last response was not a redirect. Cannot follow_redirect!'\n end\n\n if last_response.status == 307\n request_method = last_request.request_method\n params = last_request.params\n else\n request_method = 'GET'\n params = {}\n end\n\n # Compute the next location by appending the location header with the\n # last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2\n # Adding two absolute locations returns the right-hand location\n next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])\n\n custom_request(\n request_method,\n next_location.to_s,\n params,\n 'HTTP_REFERER' => last_request.url,\n 'rack.session' => last_request.session,\n 'rack.session.options' => last_request.session_options\n )\n end",
"def follow_redirections\n self.url = self.add_scheme(decoded_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && %w(301 302).include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url\n code = response.code\n self.set_url_from_location(response, path)\n end\n end",
"def redirect_clickthroughs\n if (params[:ct])\n params.delete :ct\n headers[\"Status\"] = \"301 Moved Permanently\"\n redirect_to params, :status => 301\n end\n return true\n end",
"def follow_redirections\n self.url = RequestHelper.add_scheme(RequestHelper.decode_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && RequestHelper::REDIRECT_HTTP_CODES.include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url(self.url)\n code = response.code\n\n if RequestHelper::REDIRECT_HTTP_CODES.include?(code)\n redirect_url = self.url_from_location(response, path)\n self.url = redirect_url if redirect_url\n end\n end\n end",
"def post(path, *args)\n page.driver.post(path, *args)\n page.driver.follow_redirects!\n end",
"def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end",
"def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend",
"def follow_redirect\n get extract_redirection_url\n end",
"def post(path, query, headers, body)\n http = EventMachine::HttpRequest.new(url, http_options).post :head => headers, :path => path, :query => query, :body => body\n http.callback { puts \"forward url -> #{url}\" }\n http.errback { puts \"ERROR: failed forward to url #{url}\" }\n end",
"def redirect(url); end",
"def post (dir, data) #DIR is path to REST, Data is HASH of post data\r\n\tbegin\r\n\t\taddress=$server + dir\r\n\t\turi = URI.parse(address)\r\n\t\tdebugging \"Post URI: #{uri}, data: #{data}\"\r\n\t\trequest=Net::HTTP.post_form(uri,data)\r\n\t\tdebugging \"Response #{request}\"\r\n\t\treturn request\r\n\trescue Exception =>msg\r\n\t\tresponse={'body'=>msg,'code'=>401, 'exception' =>true}\r\n\tend\r\nend",
"def redirect_to(url)\n response = Rack::Response.new\n response.redirect(url, 301) # moved permanently\n response.finish\n response.to_a\n end",
"def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend",
"def commit(xml)\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end",
"def follow_redirect=(follow); end",
"def redirect_ok= follow\n @agent.redirect_ok = follow\n end",
"def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end",
"def tag; 'RedirectMatch permanent'; end",
"def ensure_redirect response, url_matcher\n expect(response.code).to eq('301').or eq('302')\n expect(response.header['location']).to match url_matcher\n # href = document(response.body).css('a').attr('href').value\n # expect(href).to match url_matcher\n response.header['location']\n end",
"def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end",
"def forward(req)\n return nil if req.nil?\n\n # Parse request elements\n host = 'dojo.nplusplus.ninja'\n path = req.request_uri.path\n path.sub!(/\\/[^\\/]+/, '') if path[/\\/(.+?)\\//, 1] != 'prod'\n body = req.body\n\n # Create request\n uri = URI.parse(\"https://#{host}#{path}?#{req.query_string}\")\n case req.request_method.upcase\n when 'GET'\n new_req = Net::HTTP::Get.new(uri)\n when 'POST'\n new_req = Net::HTTP::Post.new(uri)\n else\n return nil\n end\n\n # Add headers and body (clean default ones first)\n new_req.to_hash.keys.each{ |h| new_req.delete(h) }\n req.header.each{ |k, v| new_req[k] = v[0] }\n new_req['host'] = host\n new_req.body = body\n\n # Execute request\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 5){ |http|\n http.request(new_req)\n }\n res.code.to_i != 200 ? nil : res.body\nrescue => e\n lex(e, 'Failed to forward request to Metanet')\n nil\nend",
"def post_response(url, body, headers = {})\n logger.debug \"POST (response) #{url}\"\n uri = normalize_url(url)\n\n req = Net::HTTP::Post.new(uri.request_uri)\n headers.each {|k,v| req.add_field k, v}\n assign_body(req, body)\n\n http = authenticate_request(uri, req)\n response = http.request(req)\n logger.debug \"POSTED (#{response.code}) #{url}\"\n response\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def follow_redirection(&block); end",
"def max_redirects; end",
"def show\n @post302 = Post302.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def post!\n self.https.request self.http_request # Net::HTTPResponse object\n end",
"def post(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"POST #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n post_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end",
"def post(action, **args); end",
"def redirect(uri, verb = T.unsafe(nil)); end",
"def redirect_to(url)\n raise \"already built response\" if already_built_response?\n @res.status = 302\n @res[\"Location\"] = url\n @already_built_response = true\n self.session.store_session(@res)\n self.flash.store_flash(@res)\n end",
"def redirect_to(url)\n raise \"Already delivered response\" if self.already_built_response?\n res.status = 302\n res['Location'] = url\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end",
"def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def http_post(request, response)\n path = request.path\n\n # Only handling xml\n content_type = request.header('Content-Type')\n return nil unless content_type.index('application/xml') || content_type.index('text/xml')\n\n # Making sure the node exists\n begin\n node = @server.tree.node_for_path(path)\n rescue Dav::Exception::NotFound\n return nil\n end\n\n request_body = request.body_as_string\n\n # If this request handler could not deal with this POST request, it\n # will return 'null' and other plugins get a chance to handle the\n # request.\n #\n # However, we already requested the full body. This is a problem,\n # because a body can only be read once. This is why we preemptively\n # re-populated the request body with the existing data.\n request.body = request_body\n\n document_type_box = Box.new('')\n message = @server.xml.parse(request_body, request.url, document_type_box)\n document_type = document_type_box.value\n\n case document_type\n # Dealing with the 'share' document, which modified invitees on a\n # calendar.\n when \"{#{Plugin::NS_CALENDARSERVER}}share\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-calendar-share'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.update_shares(message.set, message.remove)\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n # The invite-reply document is sent when the user replies to an\n # invitation of a calendar share.\n when \"{#{Plugin::NS_CALENDARSERVER}}invite-reply\"\n\n # This only works on the calendar-home-root node.\n return true unless node.is_a?(CalendarHome)\n\n @server.transaction_type = 'post-invite-reply'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n url = node.share_reply(\n message.href,\n message.status,\n message.calendar_uri,\n message.in_reply_to,\n message.summary\n )\n\n response.status = 200\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n if url\n writer = @server.xml.writer\n writer.open_memory\n writer.start_document\n writer.start_element(\"{#{Plugin::NS_CALENDARSERVER}}shared-as\")\n writer.write(Dav::Xml::Property::Href.new(url))\n writer.end_element\n response.update_header('Content-Type', 'application/xml')\n response.body = writer.output_memory\n end\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}publish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-publish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = true\n\n # iCloud sends back the 202, so we will too.\n response.status = 202\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n when \"{#{Plugin::NS_CALENDARSERVER}}unpublish-calendar\"\n # We can only deal with IShareableCalendar objects\n return true unless node.is_a?(IShareableCalendar)\n\n @server.transaction_type = 'post-unpublish-calendar'\n\n # Getting ACL info\n acl = @server.plugin('acl')\n\n # If there's no ACL support, we allow everything\n acl.check_privileges(path, '{DAV:}write') if acl\n\n node.publish_status = false\n\n response.status = 200\n\n # Adding this because sending a response body may cause issues,\n # and I wanted some type of indicator the response was handled.\n response.update_header('X-Sabre-Status', 'everything-went-well')\n\n # Breaking the event chain\n return false\n end\n end",
"def assert_redirect(res, location)\n assert_in_array [\"301\", \"302\", \"303\", \"307\"], res.code\n assert_header res, \"Location\", location\n end",
"def passive\n\t# make a matches array\n\tm=[]\n\t\n\t# If the HTTP status is 302 and the redirection location is /admin/genericcms.php then match\n\tif @status.to_s =~ /^302$/ and @headers[\"location\"] =~ /^\\/admin\\/genericcms\\.php$/\n\t\tm << { :name => \"302 redirection to /admin/genericcms.php\" }\n\tend\n\n\t# You can add debugging and check the value of variables\n\t# pp @status\n\t# pp @headers\n\t\n\t# return the matches array, even if it's empty\n\tm\nend",
"def test_redirection\n process :redirect_internal\n assert @response.redirect?\n\n process :redirect_external\n assert @response.redirect?\n\n process :nothing\n assert [email protected]?\n end",
"def create\n @post306 = Post306.new(params[:post306])\n\n respond_to do |format|\n if @post306.save\n format.html { redirect_to(@post306, :notice => 'Post306 was successfully created.') }\n format.xml { render :xml => @post306, :status => :created, :location => @post306 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post306.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_req\n redirect_to :controller => :listings, :action => :index\n end",
"def redirect(uri)\n @response.status = 302\n @response.header['Location'] = uri\n @response.body = ''\n halt\n end",
"def test_redirection_location\n process :redirect_internal\n assert_equal 'http://test.host/nothing', @response.redirect_url\n\n process :redirect_external\n assert_equal 'http://www.rubyonrails.org', @response.redirect_url\n end",
"def redirect_ok; end",
"def redirect_ok; end",
"def update_permanent_uri(options={})\n for uri, response in @redirects\n break if response.status != \"301\"\n self.resource.permanent_uri =\n Addressable::URI.parse(response.headers[\"Location\"])\n end\n end",
"def resolve_redirects(id, level)\n return nil if level > 5\n \n (prefix1, prefix2) = make_path_prefix(id)\n fname = @enwiki_dir + \"/\" + prefix1 + \"/\" + prefix2 + \"/#{id}.xml\"\n s = File.open(fname, \"r:UTF-8\").read\n if s =~ /#REDIRECT \\[\\[(.*?)\\]\\]/\n # If there is a \"#\" in the redirect title, remove stuff after it\n new_title = $1.gsub /#.*/, ''\n # Get article id for the new title\n new_id = get_article_id(new_title)\n return nil if new_id.nil?\n return resolve_redirects(new_id, level+1)\n else\n return id\n end\n end",
"def postEntityAdd( entity_id, add_referrer_url, add_referrer_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['add_referrer_url'] = add_referrer_url\n params['add_referrer_name'] = add_referrer_name\n return doCurl(\"post\",\"/entity/add\",params)\n end",
"def redirect(url)\n headers['Location'] = url\n self.status = 302\n raise FinishRequest\n end",
"def test_post_login\n\t\tpost \"/login\"\n\t\tassert_equal 200, last_response.status\n\tend",
"def POST; end",
"def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end",
"def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end",
"def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end",
"def post(path, **args); end",
"def redirect_params\n params.require(:redirect).permit(:source, :redirect, :expiration, :status)\n end",
"def commit(action, xml)\n headers = { 'Content-Type' => 'application/x-qbmsxml',\n 'Content-length' => xml.size.to_s }\n \n # Post to server\n url = get_post_url\n @request = xml\n data = ssl_post(url, xml, headers)\n \n response = parse(action, data)\n message = message_from(response)\n \n # Post Processing - Create the Response object\n case action\n \n when 'session_ticket'\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:session_ticket]\n )\n @response\n \n else\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:transaction_id],\n :cvv_result => cvv_result(response),\n :avs_result => avs_result(response)\n ) \n end\n end",
"def handle_redirect(list, url)\n response = http_post_request(\"http://#{url}\")\n response = StringIO.new(response)\n\n while(line = response.gets)\n line = line.split(':')\n type = line[0]\n chunk_num = line[1].to_i\n hash_len = line[2].to_i\n chunk_len = line[3].to_i\n\n data = response.read(chunk_len)\n\n if(type == 'a')\n if(chunk_len == 0)\n # TODO\n end\n\n # store the chunk number in the add list\n store_add_chunk(list, chunk_num)\n\n entry_list = read_add_data(hash_len, data)\n\n # add all these prefixes\n add_entries(list, chunk_num, entry_list)\n elsif(type == 's')\n if(chunk_len == 0)\n # TODO\n end\n\n # store the chunk number in the sub list\n store_sub_chunk(list, chunk_num)\n\n entry_list = read_sub_data(hash_len, data)\n\n # delete all these prefixes\n sub_entries(list, chunk_num, entry_list)\n else\n say \"I don't know how to handle this!\"\n say line.inspect\n end\n end\n end",
"def post_request(secureNetId, secureKey, url)\n uri = URI.parse(url) # Parse the URI\n http = Net::HTTP.new(uri.host, uri.port) # New HTTP connection\n http.use_ssl = true # Must use SSL!\n req = Net::HTTP::Post.new(uri.request_uri) # HTTP POST request \n body = {} # Request body hash\n yield body # Build body of request\n req.body = body.to_json # Convert hash to json string\n req[\"Content-Type\"] = 'application/json' # JSON body\n req[\"Origin\"] = 'worldpay.com' # CORS origin\n req.basic_auth secureNetId, secureKey # HTTP basic auth\n res = http.request(req) # Make the call\n return JSON.parse(res.body) # Convert JSON to hashmap\nend",
"def redirect(client)\n header = ['HTTP/1.1 301 Moved Permanently',\n 'location: http://localhost:9292/game',\n \"date: #{Time.now.strftime('%a, %e %b %Y %H:%M:%S %z')}\",\n 'server: ruby',\n 'content-type: text/html; charset=iso-8859-1\\r\\n\\r\\n'].join(\"\\r\\n\")\n client.puts header\n end",
"def too_many_redirects\n update_code(:too_many_redirects, %i(unknown redirected))\n end",
"def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend",
"def perform_awsdirect_request(uri, body)\n res = nil\n req = get_abs_post_request(uri)\n\n if req\n req.body = body\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.read_timeout = 120\n\n puts \"sending request body:\"\n puts body\n puts \"to uri: #{uri}\"\n puts\n\n res = http.request(req)\n puts \"response code: #{res.code}\" unless res.nil?\n puts \"response body: #{res.body}\" unless res.nil?\n puts\n else\n puts \"Unable to complete the specified ABS request\"\n end\n\n res\n end",
"def redirect_ok\n @agent.redirect_ok\n end",
"def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res[\"Location\"] = url\n @res.status = 302\n @already_built_response = true\n session.store_session(@res)\n flash.store_flash(@res)\n end",
"def test_should_not_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def redirect_to(url)\n raise 'Already responded' if already_built_response?\n flash.store_flash(res)\n res['Location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end",
"def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end",
"def process_post(req, res, id)\n\t\t\t\tresponse = \"\";\ttunnel_headers = \"\";\tmod_name = \"Unknown\";\ttunnelid = nil;\n\n\t\t\t\tif req.query[\"#{PARAM_ID}\"]\n\t\t\t\t\tresponse \t= req.query[\"#{PARAM_RESPONSE}\"] \tif req.query[\"#{PARAM_RESPONSE}\"] \n\t\t\t\t\ttunnel_headers\t= req.query[\"#{PARAM_HEADERS}\"] \tif req.query[\"#{PARAM_HEADERS}\"]\n\t\t\t\t\tmod_name\t= req.query[\"#{PARAM_NAME}\"] \t\tif req.query[\"#{PARAM_NAME}\"]\n\t\t\t\t\ttunnelid\t= req.query[\"#{PARAM_RESPID}\"] \tif req.query[\"#{PARAM_RESPID}\"]\n\t\t\t\telse\t\t# Sometimes Cross-Requests aren't well understood by the Webrick server parser cause Content-Type isn't properly set by browser\n\t\t\t\t\t(req.body.split('&')).each do |p|\n\t\t\t\t\t\tresponse \t\t= $1 \t\tif (p =~ /^#{PARAM_RESPONSE}=(.*)$/)\n\t\t\t\t\t\ttunnel_headers\t\t= $1 \t\tif (p =~ /^#{PARAM_HEADERS}=(.+)$/)\n\t\t\t\t\t\tmod_name\t\t= $1 \t\tif (p =~ /^#{PARAM_NAME}=(.+)$/)\n\t\t\t\t\t\tid\t\t\t= Integer($1) \tif (p =~ /^#{PARAM_ID}=(.+)$/)\n\t\t\t\t\t\ttunnelid\t\t= $1 \t\tif (p =~ /^#{PARAM_RESPID}=(.+)$/)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tcase req.path\n\t\t\t\t\twhen /^#{self.serverURI + VICTIM_ANSWER}/\n\t\t\t\t\t\t(is_tunneled = (is_tunneled[XSSF_VICTIM_HASH[\"ID\"]] == id)) if (is_tunneled = victim_tunneled)\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (is_tunneled)\t\t\t\t\t# POST IN TUNNEL MODE\n\t\t\t\t\t\t\ttunnelid = URI.unescape(tunnelid)\n\t\t\t\t\t\t\tif(TUNNEL[tunnelid])\n\t\t\t\t\t\t\t\tTUNNEL_LOCKED.synchronize {\n\t\t\t\t\t\t\t\t\tTUNNEL[tunnelid][2] = Base64.encode64((URI.unescape(tunnel_headers)).strip)\n\t\t\t\t\t\t\t\t\tTUNNEL[tunnelid][1] = Base64.encode64(response)\n\t\t\t\n\t\t\t\t\t\t\t\t\tTUNNEL.delete(tunnelid) if ((TUNNEL[tunnelid][1].to_s).size > 10000000) \t# Deleting if more than 10Mo of data\t\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tprint_good(\"ADDING RESPONSE IN TUNNEL (#{tunnelid.to_s})\") if not (XSSF_MODE[0] =~ /^Quiet$/i)\n\t\t\t\t\t\t\t\tXSSF_RESP(res)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tXSSF_404(res)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\t\t\t\t\t\t\t\t# POST FROM A MODULE\n\t\t\t\t\t\t\tfile_id = Rex::Text.rand_text_alphanumeric(rand(20) + 10)\n\t\t\t\t\t\t\tFile.open(INCLUDED_FILES + XSSF_LOG_FILES + file_id.to_s + \".html\", 'wb') {|f| f.write((response =~ /__________(.*)__________/) ? URI.unescape(Base64.decode64($1)) : URI.unescape(response)) }\n\t\t\t\t\t\t\tcreate_log(id, file_id.to_s + \".html\", URI.unescape(mod_name).strip)\n\t\t\t\t\t\t\tprint_good(\"Response received from victim '#{id.to_s}' from module '#{URI.unescape(mod_name).strip}'\") if not (XSSF_MODE[0] =~ /^Quiet$/i)\n\t\t\t\t\t\t\tputs \"#{(response =~ /__________(.*)__________/) ? URI.unescape(Base64.decode64($1)) : URI.unescape(response)}\" if (XSSF_MODE[0] =~ /^Verbose$/i)\n\t\t\t\t\t\t\tXSSF_RESP(res)\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^#{self.serverURI + VICTIM_SAFARI}/\n\t\t\t\t\t\tXSSF_RESP(res, \"\", 200, \"OK\", {\t\n\t\t\t\t\t\t\t'Content-Type' \t=> 'text/html', \n\t\t\t\t\t\t\t'P3P' \t\t=> 'CP=\"HONK IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA\"',\n\t\t\t\t\t\t\t'Set-Cookie' \t=> \"id=#{id}; Path=/;\"})\n\t\t\t\t\t\n\t\t\t\t\telse # Other page is asked by a victim: redirect to known file or active module (This part needs cookie to be activated) \n\t\t\t\t\t\tprocess_unknown(req, res, id)\n\t\t\t\tend\n\t\t\tend",
"def redirect_to(url)\n if already_built_response?\n raise\n else\n res.status = 302\n res.header[\"location\"] = url\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end",
"def post(body)\n request = Net::HTTP::Post.new(bind_uri)\n request.body = body\n request.content_length = request.body.size\n request[\"Content-Type\"] = \"text/xml; charset=utf-8\"\n\n Jabber.debug(\"Sending POST request - #{body.strip}\")\n\n response = Net::HTTP.new(domain, port).start { |http| http.request(request) }\n\n Jabber.debug(\"Receiving POST response - #{response.code}: #{response.body.inspect}\")\n\n unless response.is_a?(Net::HTTPSuccess)\n raise Net::HTTPBadResponse, \"Net::HTTPSuccess expected, but #{response.class} was received\"\n end\n\n response\n end",
"def article(name)\n redirect R(PostController, name), :status => 301\n end",
"def redirects()\n merge(redirects: 'true')\n end",
"def post; end",
"def do_POST(req, resp)\n # Split the path into piece\n path = req.path[1..-1].split('/')\n\n # We don't want to cache catflap login page so set response headers.\n # Chrome and FF respect the no-store, while IE respects no-cache.\n resp['Cache-Control'] = 'no-cache, no-store'\n resp['Pragma'] = 'no-cache' # Legacy\n resp['Expires'] = '-1' # Microsoft advises this for older IE browsers.\n\n response_class = CfRestService.const_get 'CfRestService'\n\n raise \"#{response_class} not a Class\" unless response_class.is_a?(Class)\n\n raise HTTPStatus::NotFound unless path[1]\n\n response_method = path[1].to_sym\n # Make sure the method exists in the class\n raise HTTPStatus::NotFound unless response_class\n .respond_to? response_method\n\n if :sync == response_method\n resp.body = response_class.send response_method, req, resp, @cf\n end\n\n if :knock == response_method\n resp.body = response_class.send response_method, req, resp, @cf\n end\n\n # Remaining path segments get passed in as arguments to the method\n if path.length > 2\n resp.body = response_class.send response_method, req, resp,\n @cf, path[1..-1]\n else\n resp.body = response_class.send response_method, req, resp, @cf\n end\n raise HTTPStatus::OK\n end",
"def errorloc302(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"errorloc302 \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def redirect?\n (300..307).include?(@code)\n end",
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def is_permanent_redirect?\n @code == 301\n end",
"def redirect_to(uri_fragment)\n @headers['Status'] = '302 Moved'\n @headers['Location'] = @cgi.full_uri_for uri_fragment\n output\n end",
"def redirect_to(url)\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res.status = 302 \n # @res.set_header('Content-Type', content_type)\n @res.set_header('location', url)\n # @res.write(content) \n session.store_session(res)\n # debugger\n @already_built_response = true \n # debugger\n end \n end",
"def content_post\n # POST requests seem to bomb out when they're deflated\n # and they probably don't need to be compressed anyway\n @request_params[\"SAMLRequest\"] = Base64.encode64(@request).gsub(/\\n/, \"\")\n \n #Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n # kind of a cheesy method of building an HTML, form since we can't rely on Rails too much,\n # and REXML doesn't work well with quote characters\n str = \"<html><body onLoad=\\\"document.getElementById('form').submit();\\\">\\n\"\n str += \"<form id='form' name='form' method='POST' action=\\\"#{@URL}\\\">\\n\"\n # we could change this in the future to associate a temp auth session ID\n str += \"<input name='RelayState' value='ruby-saml' type='hidden' />\\n\"\n @request_params.each_pair do |key, value|\n str += \"<input name=\\\"#{key}\\\" value=\\\"#{value}\\\" type='hidden' />\\n\"\n #str += \"<input name=\\\"#{key}\\\" value=\\\"#{CGI.escape(value)}\\\" type='hidden' />\\n\"\n end\n str += \"</form></body></html>\\n\"\n \n #Logging.debug \"Created form:\\n#{str}\"\n return str\n end",
"def redirect_ok=(_arg0); end"
] | [
"0.6120217",
"0.5955325",
"0.5949562",
"0.59292334",
"0.5918934",
"0.5697211",
"0.56586057",
"0.55532104",
"0.5456347",
"0.54507",
"0.54414684",
"0.542774",
"0.5393097",
"0.53402615",
"0.53277475",
"0.5300678",
"0.5291032",
"0.5270065",
"0.52504176",
"0.51715666",
"0.5163437",
"0.5136957",
"0.5131464",
"0.5125092",
"0.5060705",
"0.5054792",
"0.5054526",
"0.4989599",
"0.49862328",
"0.49787015",
"0.49743298",
"0.49677804",
"0.49663758",
"0.49393478",
"0.49390355",
"0.49367848",
"0.4929718",
"0.49247563",
"0.49236566",
"0.49232662",
"0.49230105",
"0.49136555",
"0.49074146",
"0.4895066",
"0.48855543",
"0.48825416",
"0.48772693",
"0.48709604",
"0.48681605",
"0.48607844",
"0.48597836",
"0.48515594",
"0.4850865",
"0.48278993",
"0.48205924",
"0.48125648",
"0.48094591",
"0.4801461",
"0.47845915",
"0.47767964",
"0.47749403",
"0.47749403",
"0.47678143",
"0.47555465",
"0.47523862",
"0.4746522",
"0.47349274",
"0.47339952",
"0.47228035",
"0.47165683",
"0.47114652",
"0.47072268",
"0.47072122",
"0.46989194",
"0.469519",
"0.46848053",
"0.46787032",
"0.4674494",
"0.46673235",
"0.4666732",
"0.4666204",
"0.4661886",
"0.46610606",
"0.46593252",
"0.46495283",
"0.46451664",
"0.4635315",
"0.46296602",
"0.46292913",
"0.46114138",
"0.46055943",
"0.46049166",
"0.4603804",
"0.46025524",
"0.45931557",
"0.45898825",
"0.4588875",
"0.45870614",
"0.45828742",
"0.45718613"
] | 0.67140645 | 0 |
PUT /post302s/1 PUT /post302s/1.xml | def update
@post302 = Post302.find(params[:id])
respond_to do |format|
if @post302.update_attributes(params[:post302])
format.html { redirect_to(@post302, :notice => 'Post302 was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_update(uri, method: Net::HTTP::Put)\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 doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def destroy\n @post302 = Post302.find(params[:id])\n @post302.destroy\n\n respond_to do |format|\n format.html { redirect_to(post302s_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @post302 = Post302.new(params[:post302])\n\n respond_to do |format|\n if @post302.save\n format.html { redirect_to(@post302, :notice => 'Post302 was successfully created.') }\n format.xml { render :xml => @post302, :status => :created, :location => @post302 }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post302.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end",
"def update\n @post322 = Post322.find(params[:id])\n\n respond_to do |format|\n if @post322.update_attributes(params[:post322])\n format.html { redirect_to(@post322, :notice => 'Post322 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post322.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post306 = Post306.find(params[:id])\n\n respond_to do |format|\n if @post306.update_attributes(params[:post306])\n format.html { redirect_to(@post306, :notice => 'Post306 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post306.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @post326 = Post326.find(params[:id])\n\n respond_to do |format|\n if @post326.update_attributes(params[:post326])\n format.html { redirect_to(@post326, :notice => 'Post326 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post326.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @post302 = Post302.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post302 }\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end",
"def update\n @post182 = Post182.find(params[:id])\n\n respond_to do |format|\n if @post182.update_attributes(params[:post182])\n format.html { redirect_to(@post182, :notice => 'Post182 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post182.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post341 = Post341.find(params[:id])\n\n respond_to do |format|\n if @post341.update_attributes(params[:post341])\n format.html { redirect_to(@post341, :notice => 'Post341 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post341.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def override\n document_id = params[:document_id]\n document = params[:document]\n document_type = params[:document_type]\n ticket = Document.ticket(Alfresco::Document::ALFRESCO_USER, Alfresco::Document::ALFRESCO_PASSWORD)\n\n builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|\n xml.entry(:xmlns => \"http://www.w3.org/2005/Atom\",\n \"xmlns:cmisra\" => \"http://docs.oasis-open.org/ns/cmis/restatom/200908/\",\n \"xmlns:cmis\" => \"http://docs.oasis-open.org/ns/cmis/core/200908/\") {\n xml.title document.original_filename if document\n xml.summary document_type\n if document\n xml.content(:type => document.content_type) {\n xml.text Base64.encode64(document.read)\n }\n end\n }\n end\n\n url = Document::PATH + \"cmis/i/#{document_id}?alf_ticket=\" + ticket\n\n begin\n RestClient.put url, builder.to_xml, {:content_type => 'application/atom+xml;type=entry'}\n rescue => e\n Rails.logger.info \"#\"*50\n Rails.logger.info \"Error updating file\"\n Rails.logger.info e.message\n Rails.logger.info \"#\"*50\n end\n\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end",
"def update\n @post183 = Post183.find(params[:id])\n\n respond_to do |format|\n if @post183.update_attributes(params[:post183])\n format.html { redirect_to(@post183, :notice => 'Post183 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post183.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post231 = Post231.find(params[:id])\n\n respond_to do |format|\n if @post231.update_attributes(params[:post231])\n format.html { redirect_to(@post231, :notice => 'Post231 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post231.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post360 = Post360.find(params[:id])\n\n respond_to do |format|\n if @post360.update_attributes(params[:post360])\n format.html { redirect_to(@post360, :notice => 'Post360 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post360.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update\n @post275 = Post275.find(params[:id])\n\n respond_to do |format|\n if @post275.update_attributes(params[:post275])\n format.html { redirect_to(@post275, :notice => 'Post275 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post275.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post321 = Post321.find(params[:id])\n\n respond_to do |format|\n if @post321.update_attributes(params[:post321])\n format.html { redirect_to(@post321, :notice => 'Post321 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post321.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def put(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Put.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n begin\n response = http.start {|http| http.request(request) }\n rescue\n puts url\n end\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @post310 = Post310.find(params[:id])\n\n respond_to do |format|\n if @post310.update_attributes(params[:post310])\n format.html { redirect_to(@post310, :notice => 'Post310 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post310.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end",
"def update!(**args)\n @inbound_saml_configs = args[:inbound_saml_configs] if args.key?(:inbound_saml_configs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @post262 = Post262.find(params[:id])\n\n respond_to do |format|\n if @post262.update_attributes(params[:post262])\n format.html { redirect_to(@post262, :notice => 'Post262 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post262.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Put.new(uri.request_uri, headers)\n request.body = data\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n put_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end",
"def update\n @post377 = Post377.find(params[:id])\n\n respond_to do |format|\n if @post377.update_attributes(params[:post377])\n format.html { redirect_to(@post377, :notice => 'Post377 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post377.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ignore_test_update_with_wrong_http_method_redirects\n get :update, :id => test_entry.id, model_identifier => test_entry_attrs\n assert_redirected_to_index\n \n delete :update, :id => test_entry.id, model_identifier => test_entry_attrs\n assert_redirected_to_index\n end",
"def update\n @post295 = Post295.find(params[:id])\n\n respond_to do |format|\n if @post295.update_attributes(params[:post295])\n format.html { redirect_to(@post295, :notice => 'Post295 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post295.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post335 = Post335.find(params[:id])\n\n respond_to do |format|\n if @post335.update_attributes(params[:post335])\n format.html { redirect_to(@post335, :notice => 'Post335 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post335.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post120 = Post120.find(params[:id])\n\n respond_to do |format|\n if @post120.update_attributes(params[:post120])\n format.html { redirect_to(@post120, :notice => 'Post120 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post120.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def update\n @post305 = Post305.find(params[:id])\n\n respond_to do |format|\n if @post305.update_attributes(params[:post305])\n format.html { redirect_to(@post305, :notice => 'Post305 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post305.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @post362 = Post362.find(params[:id])\n\n respond_to do |format|\n if @post362.update_attributes(params[:post362])\n format.html { redirect_to(@post362, :notice => 'Post362 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post362.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(id:, url_variables:, body:)\n ensure_service_document\n end",
"def update\n @request.accept\n redirect_to posts_url\n end",
"def update\n @post260 = Post260.find(params[:id])\n\n respond_to do |format|\n if @post260.update_attributes(params[:post260])\n format.html { redirect_to(@post260, :notice => 'Post260 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post260.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def make_put_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Put.new(@uri.request_uri)\n request.body = @request_text\n @response = http.request(request)\n end\n puts \"Response is: #{get_response_code}\"\n puts \"Body is: #{@response.body}\"\n @response.body\n end",
"def update\n @post284 = Post284.find(params[:id])\n\n respond_to do |format|\n if @post284.update_attributes(params[:post284])\n format.html { redirect_to(@post284, :notice => 'Post284 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post284.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post350 = Post350.find(params[:id])\n\n respond_to do |format|\n if @post350.update_attributes(params[:post350])\n format.html { redirect_to(@post350, :notice => 'Post350 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post350.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def update\n @post287 = Post287.find(params[:id])\n\n respond_to do |format|\n if @post287.update_attributes(params[:post287])\n format.html { redirect_to(@post287, :notice => 'Post287 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post287.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post272 = Post272.find(params[:id])\n\n respond_to do |format|\n if @post272.update_attributes(params[:post272])\n format.html { redirect_to(@post272, :notice => 'Post272 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post272.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post130 = Post130.find(params[:id])\n\n respond_to do |format|\n if @post130.update_attributes(params[:post130])\n format.html { redirect_to(@post130, :notice => 'Post130 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post130.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def update\n @post110 = Post110.find(params[:id])\n\n respond_to do |format|\n if @post110.update_attributes(params[:post110])\n format.html { redirect_to(@post110, :notice => 'Post110 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post110.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post366 = Post366.find(params[:id])\n\n respond_to do |format|\n if @post366.update_attributes(params[:post366])\n format.html { redirect_to(@post366, :notice => 'Post366 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post366.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post370 = Post370.find(params[:id])\n\n respond_to do |format|\n if @post370.update_attributes(params[:post370])\n format.html { redirect_to(@post370, :notice => 'Post370 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post370.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post101 = Post101.find(params[:id])\n\n respond_to do |format|\n if @post101.update_attributes(params[:post101])\n format.html { redirect_to(@post101, :notice => 'Post101 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post101.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => '[email protected]',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def update\n @post227 = Post227.find(params[:id])\n\n respond_to do |format|\n if @post227.update_attributes(params[:post227])\n format.html { redirect_to(@post227, :notice => 'Post227 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post227.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post339 = Post339.find(params[:id])\n\n respond_to do |format|\n if @post339.update_attributes(params[:post339])\n format.html { redirect_to(@post339, :notice => 'Post339 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post339.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end",
"def put(request, response)\n write(request.body)\n Created\n end",
"def put(request, response)\n write(request.body)\n Created\n end",
"def update\n @post318 = Post318.find(params[:id])\n\n respond_to do |format|\n if @post318.update_attributes(params[:post318])\n format.html { redirect_to(@post318, :notice => 'Post318 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post318.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post193 = Post193.find(params[:id])\n\n respond_to do |format|\n if @post193.update_attributes(params[:post193])\n format.html { redirect_to(@post193, :notice => 'Post193 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post193.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end",
"def update\n @post150 = Post150.find(params[:id])\n\n respond_to do |format|\n if @post150.update_attributes(params[:post150])\n format.html { redirect_to(@post150, :notice => 'Post150 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post150.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post81 = Post81.find(params[:id])\n\n respond_to do |format|\n if @post81.update_attributes(params[:post81])\n format.html { redirect_to(@post81, :notice => 'Post81 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post81.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end",
"def update\n @post181 = Post181.find(params[:id])\n\n respond_to do |format|\n if @post181.update_attributes(params[:post181])\n format.html { redirect_to(@post181, :notice => 'Post181 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post181.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post405 = Post405.find(params[:id])\n\n respond_to do |format|\n if @post405.update_attributes(params[:post405])\n format.html { redirect_to(@post405, :notice => 'Post405 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post405.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def update\n @post174 = Post174.find(params[:id])\n\n respond_to do |format|\n if @post174.update_attributes(params[:post174])\n format.html { redirect_to(@post174, :notice => 'Post174 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post174.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_with_http_info(url_redirect_id, url_mapping, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RedirectsApi.update ...'\n end\n # verify the required parameter 'url_redirect_id' is set\n if @api_client.config.client_side_validation && url_redirect_id.nil?\n fail ArgumentError, \"Missing the required parameter 'url_redirect_id' when calling RedirectsApi.update\"\n end\n # verify the required parameter 'url_mapping' is set\n if @api_client.config.client_side_validation && url_mapping.nil?\n fail ArgumentError, \"Missing the required parameter 'url_mapping' when calling RedirectsApi.update\"\n end\n # resource path\n local_var_path = '/cms/v3/url-redirects/{urlRedirectId}'.sub('{' + 'urlRedirectId' + '}', CGI.escape(url_redirect_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(url_mapping)\n\n # return_type\n return_type = opts[:debug_return_type] || 'UrlMapping'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']\n\n new_options = opts.merge(\n :operation => :\"RedirectsApi.update\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RedirectsApi#update\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @post230 = Post230.find(params[:id])\n\n respond_to do |format|\n if @post230.update_attributes(params[:post230])\n format.html { redirect_to(@post230, :notice => 'Post230 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post230.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post342 = Post342.find(params[:id])\n\n respond_to do |format|\n if @post342.update_attributes(params[:post342])\n format.html { redirect_to(@post342, :notice => 'Post342 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post342.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post253 = Post253.find(params[:id])\n\n respond_to do |format|\n if @post253.update_attributes(params[:post253])\n format.html { redirect_to(@post253, :notice => 'Post253 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post253.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post122 = Post122.find(params[:id])\n\n respond_to do |format|\n if @post122.update_attributes(params[:post122])\n format.html { redirect_to(@post122, :notice => 'Post122 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post122.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post32 = Post32.find(params[:id])\n\n respond_to do |format|\n if @post32.update_attributes(params[:post32])\n format.html { redirect_to(@post32, :notice => 'Post32 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post32.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post41 = Post41.find(params[:id])\n\n respond_to do |format|\n if @post41.update_attributes(params[:post41])\n format.html { redirect_to(@post41, :notice => 'Post41 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post41.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post217 = Post217.find(params[:id])\n\n respond_to do |format|\n if @post217.update_attributes(params[:post217])\n format.html { redirect_to(@post217, :notice => 'Post217 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post217.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post252 = Post252.find(params[:id])\n\n respond_to do |format|\n if @post252.update_attributes(params[:post252])\n format.html { redirect_to(@post252, :notice => 'Post252 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post252.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post33 = Post33.find(params[:id])\n\n respond_to do |format|\n if @post33.update_attributes(params[:post33])\n format.html { redirect_to(@post33, :notice => 'Post33 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post33.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end",
"def update\n @post143 = Post143.find(params[:id])\n\n respond_to do |format|\n if @post143.update_attributes(params[:post143])\n format.html { redirect_to(@post143, :notice => 'Post143 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post143.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post423 = Post423.find(params[:id])\n\n respond_to do |format|\n if @post423.update_attributes(params[:post423])\n format.html { redirect_to(@post423, :notice => 'Post423 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post423.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post316 = Post316.find(params[:id])\n\n respond_to do |format|\n if @post316.update_attributes(params[:post316])\n format.html { redirect_to(@post316, :notice => 'Post316 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post316.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update #saves and redirects, saves changes\n end",
"def update\n @post297 = Post297.find(params[:id])\n\n respond_to do |format|\n if @post297.update_attributes(params[:post297])\n format.html { redirect_to(@post297, :notice => 'Post297 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post297.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end",
"def update\n respond_to do |format|\n if @target.update(target_params)\n format.html { redirect_to after_write_path }\n format.json { render :show, status: :ok, location: @target }\n end\n end\n end",
"def update\n @post251 = Post251.find(params[:id])\n\n respond_to do |format|\n if @post251.update_attributes(params[:post251])\n format.html { redirect_to(@post251, :notice => 'Post251 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post251.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.6011841",
"0.59300005",
"0.591647",
"0.57253903",
"0.5571001",
"0.5543961",
"0.5415907",
"0.5407396",
"0.5377314",
"0.53258103",
"0.5306364",
"0.530303",
"0.5289401",
"0.5247236",
"0.5246094",
"0.5211587",
"0.52012855",
"0.5182247",
"0.5178692",
"0.5175493",
"0.51650393",
"0.5164381",
"0.5163947",
"0.51625466",
"0.51593405",
"0.51555634",
"0.51541543",
"0.51483566",
"0.5147322",
"0.5145423",
"0.5121756",
"0.5117206",
"0.5116419",
"0.5102356",
"0.5100156",
"0.5096266",
"0.50909853",
"0.5090763",
"0.5074123",
"0.50680447",
"0.5066495",
"0.50491464",
"0.5048338",
"0.50473505",
"0.5046556",
"0.5045451",
"0.50392103",
"0.5024574",
"0.5024498",
"0.50239",
"0.5023633",
"0.50207424",
"0.5017969",
"0.501667",
"0.50078773",
"0.5007252",
"0.5005018",
"0.49973252",
"0.49912676",
"0.49865365",
"0.49824226",
"0.4981452",
"0.49722224",
"0.49666384",
"0.49646366",
"0.496319",
"0.49587244",
"0.4954572",
"0.4954572",
"0.4943616",
"0.49430546",
"0.49334645",
"0.4930107",
"0.49227828",
"0.49222234",
"0.49210662",
"0.49105585",
"0.49039122",
"0.49021",
"0.49008176",
"0.48937646",
"0.48836243",
"0.48803192",
"0.4879935",
"0.4876403",
"0.4860603",
"0.4857911",
"0.48577613",
"0.48571253",
"0.485102",
"0.48480174",
"0.48442292",
"0.48368162",
"0.48345983",
"0.4833748",
"0.48320824",
"0.4830259",
"0.48273942",
"0.4826914",
"0.48236853"
] | 0.65349734 | 0 |
DELETE /post302s/1 DELETE /post302s/1.xml | def destroy
@post302 = Post302.find(params[:id])
@post302.destroy
respond_to do |format|
format.html { redirect_to(post302s_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @post306 = Post306.find(params[:id])\n @post306.destroy\n\n respond_to do |format|\n format.html { redirect_to(post306s_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @post341 = Post341.find(params[:id])\n @post341.destroy\n\n respond_to do |format|\n format.html { redirect_to(post341s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post150 = Post150.find(params[:id])\n @post150.destroy\n\n respond_to do |format|\n format.html { redirect_to(post150s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n format.html { redirect_to(post445s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post182 = Post182.find(params[:id])\n @post182.destroy\n\n respond_to do |format|\n format.html { redirect_to(post182s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post321 = Post321.find(params[:id])\n @post321.destroy\n\n respond_to do |format|\n format.html { redirect_to(post321s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post194 = Post194.find(params[:id])\n @post194.destroy\n\n respond_to do |format|\n format.html { redirect_to(post194s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post350 = Post350.find(params[:id])\n @post350.destroy\n\n respond_to do |format|\n format.html { redirect_to(post350s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post322 = Post322.find(params[:id])\n @post322.destroy\n\n respond_to do |format|\n format.html { redirect_to(post322s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post470 = Post470.find(params[:id])\n @post470.destroy\n\n respond_to do |format|\n format.html { redirect_to(post470s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post275 = Post275.find(params[:id])\n @post275.destroy\n\n respond_to do |format|\n format.html { redirect_to(post275s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post193 = Post193.find(params[:id])\n @post193.destroy\n\n respond_to do |format|\n format.html { redirect_to(post193s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post251 = Post251.find(params[:id])\n @post251.destroy\n\n respond_to do |format|\n format.html { redirect_to(post251s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post318 = Post318.find(params[:id])\n @post318.destroy\n\n respond_to do |format|\n format.html { redirect_to(post318s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post184 = Post184.find(params[:id])\n @post184.destroy\n\n respond_to do |format|\n format.html { redirect_to(post184s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post110 = Post110.find(params[:id])\n @post110.destroy\n\n respond_to do |format|\n format.html { redirect_to(post110s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post405 = Post405.find(params[:id])\n @post405.destroy\n\n respond_to do |format|\n format.html { redirect_to(post405s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post326 = Post326.find(params[:id])\n @post326.destroy\n\n respond_to do |format|\n format.html { redirect_to(post326s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post50 = Post50.find(params[:id])\n @post50.destroy\n\n respond_to do |format|\n format.html { redirect_to(post50s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post120 = Post120.find(params[:id])\n @post120.destroy\n\n respond_to do |format|\n format.html { redirect_to(post120s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post413 = Post413.find(params[:id])\n @post413.destroy\n\n respond_to do |format|\n format.html { redirect_to(post413s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post181 = Post181.find(params[:id])\n @post181.destroy\n\n respond_to do |format|\n format.html { redirect_to(post181s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post101 = Post101.find(params[:id])\n @post101.destroy\n\n respond_to do |format|\n format.html { redirect_to(post101s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post174 = Post174.find(params[:id])\n @post174.destroy\n\n respond_to do |format|\n format.html { redirect_to(post174s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @post41 = Post41.find(params[:id])\n @post41.destroy\n\n respond_to do |format|\n format.html { redirect_to(post41s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post130 = Post130.find(params[:id])\n @post130.destroy\n\n respond_to do |format|\n format.html { redirect_to(post130s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post57 = Post57.find(params[:id])\n @post57.destroy\n\n respond_to do |format|\n format.html { redirect_to(post57s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post157 = Post157.find(params[:id])\n @post157.destroy\n\n respond_to do |format|\n format.html { redirect_to(post157s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post481 = Post481.find(params[:id])\n @post481.destroy\n\n respond_to do |format|\n format.html { redirect_to(post481s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post154 = Post154.find(params[:id])\n @post154.destroy\n\n respond_to do |format|\n format.html { redirect_to(post154s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post134 = Post134.find(params[:id])\n @post134.destroy\n\n respond_to do |format|\n format.html { redirect_to(post134s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post407 = Post407.find(params[:id])\n @post407.destroy\n\n respond_to do |format|\n format.html { redirect_to(post407s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post446 = Post446.find(params[:id])\n @post446.destroy\n\n respond_to do |format|\n format.html { redirect_to(post446s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post227 = Post227.find(params[:id])\n @post227.destroy\n\n respond_to do |format|\n format.html { redirect_to(post227s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post335 = Post335.find(params[:id])\n @post335.destroy\n\n respond_to do |format|\n format.html { redirect_to(post335s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post183 = Post183.find(params[:id])\n @post183.destroy\n\n respond_to do |format|\n format.html { redirect_to(post183s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post362 = Post362.find(params[:id])\n @post362.destroy\n\n respond_to do |format|\n format.html { redirect_to(post362s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post328 = Post328.find(params[:id])\n @post328.destroy\n\n respond_to do |format|\n format.html { redirect_to(post328s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post231 = Post231.find(params[:id])\n @post231.destroy\n\n respond_to do |format|\n format.html { redirect_to(post231s_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @post447 = Post447.find(params[:id])\n @post447.destroy\n\n respond_to do |format|\n format.html { redirect_to(post447s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post342 = Post342.find(params[:id])\n @post342.destroy\n\n respond_to do |format|\n format.html { redirect_to(post342s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post310 = Post310.find(params[:id])\n @post310.destroy\n\n respond_to do |format|\n format.html { redirect_to(post310s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post129 = Post129.find(params[:id])\n @post129.destroy\n\n respond_to do |format|\n format.html { redirect_to(post129s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post305 = Post305.find(params[:id])\n @post305.destroy\n\n respond_to do |format|\n format.html { redirect_to(post305s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post246 = Post246.find(params[:id])\n @post246.destroy\n\n respond_to do |format|\n format.html { redirect_to(post246s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post81 = Post81.find(params[:id])\n @post81.destroy\n\n respond_to do |format|\n format.html { redirect_to(post81s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post65 = Post65.find(params[:id])\n @post65.destroy\n\n respond_to do |format|\n format.html { redirect_to(post65s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post339 = Post339.find(params[:id])\n @post339.destroy\n\n respond_to do |format|\n format.html { redirect_to(post339s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post419 = Post419.find(params[:id])\n @post419.destroy\n\n respond_to do |format|\n format.html { redirect_to(post419s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post483 = Post483.find(params[:id])\n @post483.destroy\n\n respond_to do |format|\n format.html { redirect_to(post483s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post295 = Post295.find(params[:id])\n @post295.destroy\n\n respond_to do |format|\n format.html { redirect_to(post295s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post377 = Post377.find(params[:id])\n @post377.destroy\n\n respond_to do |format|\n format.html { redirect_to(post377s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post284 = Post284.find(params[:id])\n @post284.destroy\n\n respond_to do |format|\n format.html { redirect_to(post284s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post109 = Post109.find(params[:id])\n @post109.destroy\n\n respond_to do |format|\n format.html { redirect_to(post109s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post409 = Post409.find(params[:id])\n @post409.destroy\n\n respond_to do |format|\n format.html { redirect_to(post409s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post423 = Post423.find(params[:id])\n @post423.destroy\n\n respond_to do |format|\n format.html { redirect_to(post423s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post55 = Post55.find(params[:id])\n @post55.destroy\n\n respond_to do |format|\n format.html { redirect_to(post55s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post139 = Post139.find(params[:id])\n @post139.destroy\n\n respond_to do |format|\n format.html { redirect_to(post139s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post366 = Post366.find(params[:id])\n @post366.destroy\n\n respond_to do |format|\n format.html { redirect_to(post366s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post464 = Post464.find(params[:id])\n @post464.destroy\n\n respond_to do |format|\n format.html { redirect_to(post464s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post245 = Post245.find(params[:id])\n @post245.destroy\n\n respond_to do |format|\n format.html { redirect_to(post245s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post122 = Post122.find(params[:id])\n @post122.destroy\n\n respond_to do |format|\n format.html { redirect_to(post122s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post149 = Post149.find(params[:id])\n @post149.destroy\n\n respond_to do |format|\n format.html { redirect_to(post149s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post253 = Post253.find(params[:id])\n @post253.destroy\n\n respond_to do |format|\n format.html { redirect_to(post253s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post453 = Post453.find(params[:id])\n @post453.destroy\n\n respond_to do |format|\n format.html { redirect_to(post453s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post493 = Post493.find(params[:id])\n @post493.destroy\n\n respond_to do |format|\n format.html { redirect_to(post493s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post370 = Post370.find(params[:id])\n @post370.destroy\n\n respond_to do |format|\n format.html { redirect_to(post370s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post349 = Post349.find(params[:id])\n @post349.destroy\n\n respond_to do |format|\n format.html { redirect_to(post349s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post436 = Post436.find(params[:id])\n @post436.destroy\n\n respond_to do |format|\n format.html { redirect_to(post436s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post33 = Post33.find(params[:id])\n @post33.destroy\n\n respond_to do |format|\n format.html { redirect_to(post33s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post72 = Post72.find(params[:id])\n @post72.destroy\n\n respond_to do |format|\n format.html { redirect_to(post72s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post78 = Post78.find(params[:id])\n @post78.destroy\n\n respond_to do |format|\n format.html { redirect_to(post78s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post267 = Post267.find(params[:id])\n @post267.destroy\n\n respond_to do |format|\n format.html { redirect_to(post267s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post125 = Post125.find(params[:id])\n @post125.destroy\n\n respond_to do |format|\n format.html { redirect_to(post125s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post360 = Post360.find(params[:id])\n @post360.destroy\n\n respond_to do |format|\n format.html { redirect_to(post360s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post74 = Post74.find(params[:id])\n @post74.destroy\n\n respond_to do |format|\n format.html { redirect_to(post74s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post260 = Post260.find(params[:id])\n @post260.destroy\n\n respond_to do |format|\n format.html { redirect_to(post260s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post191 = Post191.find(params[:id])\n @post191.destroy\n\n respond_to do |format|\n format.html { redirect_to(post191s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post272 = Post272.find(params[:id])\n @post272.destroy\n\n respond_to do |format|\n format.html { redirect_to(post272s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post358 = Post358.find(params[:id])\n @post358.destroy\n\n respond_to do |format|\n format.html { redirect_to(post358s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post451 = Post451.find(params[:id])\n @post451.destroy\n\n respond_to do |format|\n format.html { redirect_to(post451s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post54 = Post54.find(params[:id])\n @post54.destroy\n\n respond_to do |format|\n format.html { redirect_to(post54s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post402 = Post402.find(params[:id])\n @post402.destroy\n\n respond_to do |format|\n format.html { redirect_to(post402s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post156 = Post156.find(params[:id])\n @post156.destroy\n\n respond_to do |format|\n format.html { redirect_to(post156s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post471 = Post471.find(params[:id])\n @post471.destroy\n\n respond_to do |format|\n format.html { redirect_to(post471s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post168 = Post168.find(params[:id])\n @post168.destroy\n\n respond_to do |format|\n format.html { redirect_to(post168s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post75 = Post75.find(params[:id])\n @post75.destroy\n\n respond_to do |format|\n format.html { redirect_to(post75s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post196 = Post196.find(params[:id])\n @post196.destroy\n\n respond_to do |format|\n format.html { redirect_to(post196s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post197 = Post197.find(params[:id])\n @post197.destroy\n\n respond_to do |format|\n format.html { redirect_to(post197s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post297 = Post297.find(params[:id])\n @post297.destroy\n\n respond_to do |format|\n format.html { redirect_to(post297s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post459 = Post459.find(params[:id])\n @post459.destroy\n\n respond_to do |format|\n format.html { redirect_to(post459s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post489 = Post489.find(params[:id])\n @post489.destroy\n\n respond_to do |format|\n format.html { redirect_to(post489s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post117 = Post117.find(params[:id])\n @post117.destroy\n\n respond_to do |format|\n format.html { redirect_to(post117s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post371 = Post371.find(params[:id])\n @post371.destroy\n\n respond_to do |format|\n format.html { redirect_to(post371s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post215 = Post215.find(params[:id])\n @post215.destroy\n\n respond_to do |format|\n format.html { redirect_to(post215s_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.68401355",
"0.67884856",
"0.67702645",
"0.6734704",
"0.67324454",
"0.6721978",
"0.66853327",
"0.666699",
"0.66553324",
"0.6646322",
"0.66428",
"0.6632472",
"0.6623396",
"0.66042864",
"0.65998757",
"0.6596214",
"0.65933204",
"0.6580198",
"0.6576345",
"0.6572139",
"0.65670204",
"0.6566569",
"0.6563663",
"0.65610486",
"0.65605974",
"0.65559554",
"0.65555966",
"0.6553641",
"0.6543317",
"0.65431994",
"0.65407956",
"0.6540575",
"0.65396196",
"0.6539175",
"0.65329975",
"0.6525316",
"0.6525055",
"0.65231395",
"0.6522226",
"0.6520256",
"0.65176636",
"0.6515726",
"0.6515306",
"0.65094197",
"0.65055305",
"0.65035176",
"0.6499273",
"0.64974254",
"0.64962274",
"0.64959466",
"0.64916563",
"0.64913076",
"0.649082",
"0.64828557",
"0.6479537",
"0.6478746",
"0.6477766",
"0.647739",
"0.6470731",
"0.6470598",
"0.6469616",
"0.6469161",
"0.64671844",
"0.6466892",
"0.6465071",
"0.6464373",
"0.6464144",
"0.64612156",
"0.645983",
"0.6456908",
"0.6449007",
"0.6448983",
"0.6443476",
"0.64433795",
"0.64420015",
"0.64410436",
"0.6439511",
"0.64362836",
"0.6432456",
"0.6431904",
"0.6427179",
"0.64258647",
"0.6423231",
"0.6422492",
"0.64221925",
"0.642115",
"0.6418496",
"0.6418034",
"0.64163953",
"0.64130265",
"0.64044",
"0.64031786",
"0.63976324",
"0.63967276",
"0.6396649",
"0.6392203",
"0.6391035",
"0.6389834",
"0.6387938",
"0.6386573"
] | 0.73653924 | 0 |
Sets the number of columns defined in TotalSpaces2 for the main display. This does not change the actual number of desktops present, you should call add_desktops or remove_desktops as appropriate after changing the number of columns. TotalSpaces2.set_grid_columns(3) | def set_grid_columns(columns)
TSApi.tsapi_setDefinedColumnsOnDisplay(columns, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_grid_dimensions(row_count, col_count)\n \n # Forbid resetting grid dimensions\n if @grid_dimensions_set\n Vizkit.warn(\"Error: You may set grid dimensions before configuration only.\")\n return\n else\n @grid_dimensions_set = true\n end\n \n # Remove all parent widgets from grid.\n child = nil\n while(child = @grid.take_at(0)) \n widget = child.widget\n widget.set_parent(nil)\n widget = nil\n child = nil\n end\n \n # Generate container widgets with label if not yet existent\n counter = 0\n for row in 0..row_count-1 do\n for col in 0..col_count-1 do\n container = nil\n if not @container_hash[counter]\n widget_pos = (row * col_count) + col\n container = ContainerWidget.new(widget_pos)\n @container_hash[counter] = container\n else\n container = @container_hash[counter]\n end\n \n # Add parent widget to grid\n @grid.add_widget(container, row, col) # TODO does this make @grid the parent of the widget?\n container.show\n counter = counter + 1\n end\n end\n \n # Delete useless container widgets if any\n @container_hash.delete_if {|pos, conatiner| pos >= counter}\n \n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def start_columns(size = 2, gutter = 10)\n # Start from the current y-position; make the set number of columns.\n return false if @columns_on\n\n @columns = {\n :current => 1,\n :bot_y => @y\n }\n @columns_on = true\n # store the current margins\n @columns[:left] = @left_margin\n @columns[:right] = @right_margin\n @columns[:top] = @top_margin\n @columns[:bottom] = @bottom_margin\n # Reset the margins to suit the new columns. Safe enough to assume the\n # first column here, but start from the current y-position.\n @top_margin = @page_height - @y\n @columns[:size] = size || 2\n @columns[:gutter] = gutter || 10\n w = absolute_right_margin - absolute_left_margin\n @columns[:width] = (w - ((size - 1) * gutter)) / size.to_f\n @right_margin = @page_width - (@left_margin + @columns[:width])\n end",
"def columns; IO.console.winsize[1] rescue 80; end",
"def switch_windows\n tv = @form.by_name[\"tv\"]\n list = @form.by_name[\"mylist\"]\n if tv.col > 0\n tv.col = 0\n tmp = tv.width\n list.col = tmp + 1\n else\n list.col = 0\n tv.col = list.width + 1\n end\nend",
"def setNbGrids(nbGrids)\n\t\t@nbGames = nbGrids\n\t\treturn self\n\tend",
"def append_width(required_col)\n diff = required_col - @screen_size[1] + 1\n @screen.each.with_index do |row, i|\n @screen[i] = row + Array.new(diff)\n end\n @screen_size[1] += diff\n end",
"def columns=(n)\n @columns = n\n end",
"def columns=(integer); end",
"def screen_size=(new_screen_size)\n\t try_set_screen\n Klass.setScreenSize(@handle, Phidgets::FFI::TextLCDScreenSizes[new_screen_size])\n\t \n\t load_rows(@index) #readjust screen rows\n new_screen_size\n end",
"def setwsviewport(*)\n super\n end",
"def create_shop_viewports\n @shop_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)\n @item_number_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)\n @item_number_viewport.z = @shop_viewport.z + 1\n end",
"def update_dimensions\n spacer=@hex_width # 3-char space between areas\n ui_width = @addr_width + (spacer*4) # addr sp sp hex sp ascii sp\n\n @columns = (client_size.width - ui_width) / (@hex_width + @asc_width*2)\n @columns = 1 if @columns < 1\n @rows = (@data.size / @columns)+1\n\n # calculate hex/ascii area boundaries\n @hex0 = @addr_width + spacer*2\n @hexN = @hex0 + (@columns * (@hex_width+@asc_width))\n @asc0 = @hexN + spacer\n @ascN = @asc0 + (@columns * @asc_width)\n @row_width = @ascN - @addr_width - @hex_width\n\n # update scroll-bar info\n old_pos=first_visible_line\n set_line_count(@rows)\n scroll_to_line(old_pos)\n end",
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def screen_settings\n # TODO these need to become part of our new full_indexer class, not hang about separately.\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n # this depends now on textpad size not screen size TODO FIXME\n $grows = $glines - 1\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def draw_table_six_columns(table_info, width_columns = [100, 100, 100, 90, 90, 40])\n table (table_info) do\n columns(0..5).border_width = 1\n columns(0..5).size = 7\n self.column_widths = width_columns\n end\n end",
"def initialize\n\t\t @grid = []\n\t\t 9.times { @grid << \" \" }\n\t\tend",
"def _print_more_columns_marker tf\n tf = false\n if @pmincol + @display_w < @pad_w\n tf = true\n end\n marker = tf ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE\n h = @display_h; w = @display_w\n r = @orig_top\n c = @orig_left\n @target_window.mvwaddch r+h, c+w-2, marker\n #\n # show if columns to left or not\n marker = @pmincol > 0 ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE\n @target_window.mvwaddch r+h, c+1, marker\n end",
"def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end",
"def widths_reset\n @width = GroupLayout::DEFAULT_SIZE\n @max = GroupLayout::DEFAULT_SIZE\n end",
"def set_screen_max_row_col mr, mc\n $log.debug \"#{@name} set_screen_max_row_col #{mr},#{mc}. earlier #{@screen_maxrow}, #{@screen_maxcol} \"\n # added || check on 2010-01-09 18:39 since crashing if mr > sh + top ..\n # I removed the check, since it results in a blank area on screen since the \n # widget has not expanded itself. Without the check it will crash on copywin so you\n # should increase widget size or disallow calling this in this situation.\n if mr > (@sheight + @top -1 -@pminrow)\n $log.warn \" ->>> ** set_screen_max_row_col #{mr} > #{@sheight} + #{@top} -1 - #{@pminrow} ** \"\n $log.warn \" ->>> can result in error in copy_win or in some rows not displaying\"\n return # some situations actually require this ...\n end unless mr.nil?\n @screen_maxrow = mr unless mr.nil? # || mr > (@sheight + @top -1 -@pminrow)\n @screen_maxcol = mc unless mc.nil?\n end",
"def set_grid_columns_on_display(columns, display_id)\n TSApi.tsapi_setDefinedColumnsOnDisplay(columns, display_id)\n end",
"def addcol num\n return if @col.nil? || @col == -1\n @col += num\n @window.wmove @row, @col\n ## 2010-01-30 23:45 exchange calling parent with calling this forms setrow\n # since in tabbedpane with table i am not gietting this forms offset. \n setrowcol nil, col\n end",
"def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end",
"def demoExplorerSmallIcons(t)\n demoExplorerList(t)\n t.configure(:orient=>:horizontal, :xscrollincrement=>0)\n t.column_configure(0, :width=>'', :stepwidth=>110, :widthhack=>false)\nend",
"def initialize(x, y, width, height, items, dataview=nil)\n super(x, y, width, height)\n @column_max = 2\n @ucItemsList = []\n window_update(items, dataview)\n self.index = 0\n end",
"def screen_settings\n @glines, @gcols = `stty size`.split.map(&:to_i)\n # @glines = `tput lines`.to_i\n # @gcols = `tput cols`.to_i\n @grows = @glines - 3\n # @pagesize = 60\n # @gviscols = 3\n @pagesize = @grows * @gviscols\nend",
"def columns\n layout_text.blank? ? 12 : layout[0].size\n end",
"def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def screen_settings\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n $grows = $glines - 3\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def column_space(); @column_space; end",
"def columns\n gtk_instance.columns\n end",
"def set_board\n\t\t(1..@disks).each do |disk|\n\t\t\t@pegs[0].unshift disk\n\t\tend\n\tend",
"def init_white_panel!\n grid.cells[grid.pos] = 1\n end",
"def col_max; (contents_width / (MA_IconItemList::RECT_WIDTH + spacing)); end",
"def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end",
"def initialize\n @grid = []\n (0..5).each do |row|\n @grid[row] = []\n (0..6).each do |col|\n @grid[row][col] = \"_ \"\n end\n end\n end",
"def width\n cols\n end",
"def set_cols(visible, list)\n @rows = 1 if visible\n @cols = (depends_on & list).find_all { |u| u.visible }.inject(0) { |s, v| s + (v.cols || 0) }\n @cols = 1 if @cols == 0 and visible\n end",
"def columns_incdec howmany\n @gviscols += howmany.to_i\n @gviscols = 1 if @gviscols < 1\n @gviscols = 6 if @gviscols > 6\n @pagesize = @grows * @gviscols\nend",
"def initiate_grid\n new_grid = []\n @width.times do |x|\n new_grid[x] = []\n @height.times do |y|\n new_grid[x][y] = 0\n end\n end\n new_grid\n end",
"def build_table (number)\n @main_table.each{|child| @main_table.remove(child)}\n if number<=3\n @main_table.n_columns = number\n @main_table.n_rows = 1\n i = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n text.editable = false\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n @main_table.attach(scrolled,i,i+1,0,1)\n @main_table.show_all\n i+=1\n end\n else\n @main_table.n_rows = 2\n @main_table.n_columns = (number+1)/2\n i = 0\n fil = col = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n #Fils the first row. The fil variable acts like a controller. When it changes, the row has changed.\n if (col < @main_table.n_columns && fil == 0)\n @main_table.attach(scrolled,col,col+1,0,1)\n col+=1\n if col==@main_table.n_columns #All the columns have been filled. We change rows\n fil = 1; col = 0 #Restart the columns index\n end\n else #Second row statrs here\n @main_table.attach(scrolled,col,col+1,1,2)\n col+=1\n end\n @main_table.show_all\n i+=1\n end\n end\n end",
"def build_grid\n header = [\" \", \" a \", \" b \", \" c \", \" d \", \" e \", \" f \", \" g \", \" h \"]\n grid_display = @board.grid.map.with_index do |row, index|\n [8 - index] + build_row(row, index)\n end\n grid_display.unshift(header)\n end",
"def insert_columns(add_count)\n add_count.times do\n new_column = self.columns.create(:jivepage => jivepage)\n new_column.create_box!(\"textblock\", 1, \n :content => \"Click here to change text.\") if new_column.first?\n end\n end",
"def gridmaxwidths ()\n # write a media query for each breakpoint\n $g = 0\n items = MEASURES\n $LEN = items.length\n $buffer = \"\"\n\n until $g == $LEN\n if $g == 0\n $NAME = 0\n $NAMETXT = \"default\"\n else\n $NAME = \"$bp-\" + items[$g]['NAME']\n $NAMETXT = $NAME\n end\n $FROM = items[$g]['FROM']\n $MAXW = items[$g]['MAXW']\n $buffer += \"\n /* #$NAMETXT breakpoint (#$FROM) */\n @media (min-width: #$NAME){\n .wrapbox {\n max-width: #$MAXW; \n }\n }\n \"\n\n $g += 1\n end\n\n return $buffer\nend",
"def grid_page_size\n GRID_PAGE_SIZE\n end",
"def column_width(n=0)\n sg = 0\n if n.zero?\n n = g_total_cols\n sg = g_side_gutter_width\n end\n (n*g_col_width) + ((n - 1)*g_gutter_width).ceil + (sg*2)\n end",
"def draw_table_five_columns(table_info, width_columns = [100, 100, 100, 70, 130])\n table (table_info) do\n columns(0..4).border_width = 1\n columns(0..4).size = 9\n self.column_widths = width_columns\n end\n end",
"def display_grid\n # variables for grid display\n @grid = \" A B C \\n\" \\\n \"1 #{@a1} | #{@b1} | #{@c1} \\n\" \\\n \" ---+---+--- \\n\" \\\n \"2 #{@a2} | #{@b2} | #{@c2} \\n\" \\\n \" ---+---+--- \\n\" \\\n \"3 #{@a3} | #{@b3} | #{@c3} \\n\"\n end",
"def create_columns\n (column_count.to_i - columns.size).times { columns.create(position: columns.size) }\n end",
"def new_board_grid\n unicode = 65\n @board_matrix.each do |array|\n @board_matrix.each_with_index do |_element, i|\n array[i] = \" #{unicode.chr} \"\n unicode += 1\n end\n end\n end",
"def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end",
"def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n super(@win)\n @title_prefix = title_prefix\n set_max_contents_len(cols)\n end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def column_space=(val)\n @column_space = val\n update_xy\n end",
"def set_column_spaces_occupied(coordinate1, coordinate2)\n get_column_spaces_between(coordinate1, coordinate2).each do |coordinate|\n set_space_occupied(coordinate)\n end\n end",
"def setup_grid\n empty_rows\n [:white, :light_yellow].each do |color|\n back_rows(color)\n pawn_rows(color)\n end\n end",
"def setItems(list, list_size, numbers)\n if self.createItemList(numbers, list, list_size) <= 0\n return\n end\n\n # Clean up the display.\n (0...@view_size).each do |x|\n Draw.writeBlanks(@win, 1, x, CDK::HORIZONTAL, 0, @box_width - 2);\n end\n\n self.setViewSize(list_size)\n self.setPosition(0)\n @left_char = 0\n end",
"def copy_pad_to_win\n # check that we don't exceed other windows height/maxrow\n smr = smaxrow()\n # SHIT, this means the otherwin has to be a Pad, cannot be a window\n osw = @otherwin.width\n osh = @otherwin.height\n osh = @height if osh == 0 # root window has 0\n osw = @width if osw == 0 # root window has 0\n osmr = @otherwin.smaxrow() rescue osh # TRYING for windows\n osmc = @otherwin.smaxcol() rescue osw\n if smr >= osmr\n $log.debug \" adjusted smr from #{smr} to #{osmr} -1 causing issues in viewfooter\"\n smr = osmr-1 # XXX causing issues in viewport, wont print footer with this\n end\n if smr > @sheight + @top -1 -@pminrow # 2010-01-17 13:27 \n smr = @sheight + @top -1 -@pminrow \n $log.debug \" adjusted smr to #{smr} to prevent crash \"\n end\n smc = smaxcol()\n $log.debug \" SMC original = #{smc} \"\n if smc >= osmc\n smc = osmc-1\n smc = @width # XXX ??? THIS WAS WORKING< but throwing error in viewport case\n smc = [osmc-1, @width].min # yet another hack\n $log.debug \" SMC o-1 #{osmc-1} wdth #{@width}, smc #{smc} \"\n end\n ### XXX commented out since it doesn't let a comp print fully if widget expanded (splitpane)\n #smc = osw -1 if smc >= osw; # added 2009-11-02 17:01 for tabbedpanes\n\n # dang, this is coming up a lot. 2010-01-16 20:34 \n # the second scrollpane was one row too large in testsplit3a.rb\n if smr - @top > @padheight\n $log.debug \" fixing smr to padheight 2010-01-16 20:35 HOPE THIS DOESNT BREAK ANYTHING\"\n smr = @padheight\n end\n @pminrow = 0 if @pminrow < 0\n @pmincol = 0 if @pmincol < 0\n $log.debug \" COPYING #{self.name} to #{@otherwin.name} \"\n $log.debug \" calling copy pad #{@pminrow} #{@pmincol}, #{@top} #{@left}, #{smr} #{smc} self #{self.name} \"\n $log.debug \" calling copy pad H: #{@height} W: #{@width}, PH #{@padheight} PW #{@padwidth} WIN:#{@window} \"\n# $log.debug \" -otherwin target copy pad #{@otherwin.pminrow} #{@otherwin.pmincol}, #{@otherwin.top} #{@otherwin.left}, #{osmr} #{osmc} OTHERWIN:#{@otherwin.name} \"\n ret=\"-\"\n #if ret == -1\n#x XXX $log.debug \" #{ret} otherwin copy pad #{@otherwin.pminrow} #{@otherwin.pmincol}, #{@otherwin.top} #{@otherwin.left}, #{osmr} #{osmc} \"\n $log.debug \" #{ret} otherwin copy pad H: #{osh} W: #{osw}\"\n if @top >= osh\n $log.debug \" #{ret} ERROR top exceeds other ht #{@top} H: #{osh} \"\n end\n if @left >= osw\n $log.debug \" #{ret} ERROR left exceeds other wt #{@left} W: #{osw} \"\n end\n if smr >= osh\n $log.debug \" #{ret} ERROR smrow exceeds other ht #{smr} H: #{osh} \"\n smr = osh() -1 # testing 2010-01-31 21:47 , again 2010-02-05 20:22 \n end\n if smc >= osw\n $log.debug \" #{ret} ERROR smcol exceeds other wt #{smc} W: #{osw} \"\n end\n if smc - @left > @padwidth\n $log.debug \" #{ret} ERROR smcol - left exceeds padwidth #{smc}- #{@left} PW: #{@padwidth} \"\n end\n if smr - @top > @padheight\n $log.debug \" #{ret} ERROR smr - top exceeds padheight #{smr}- #{@top} PH: #{@padheight} \"\n end\n ret = @window.copywin(@otherwin.get_window,@pminrow,@pmincol, @top, @left, smr, smc, 0)\n $log.debug \" copywin ret #{ret} \"\n # 2010-01-11 19:42 one more cause of -1 coming is that padheight (actual height which never\n # changes unless pad increases) or padwidth is smaller than area being printed. Solution: increase \n # buffer by increasing widgets w or h. smc - left should not exceed padwidth. smr-top should not\n # exceed padheight\n #end\n @modified = false\n return ret\n end",
"def printGrid(number_of_pieces)\n size = number_of_pieces.to_s.length\n print_horizontal_line((size+1) * @width + 1)\n \n (@height - 1).downto(0) do |hIdx|\n print '|'\n @width.times do |wIdx|\n print fixed_string(@grid[wIdx][hIdx].to_s, size)\n print ' ' if wIdx < @width - 1\n end\n print '|'\n print \"\\n\"\n end\n \n print_horizontal_line((size+1) * @width + 1)\n end",
"def set_cell_count\n cell_count = self.all_cells_array.size\n Rails.logger.info \"Setting cell count in #{self.name} to #{cell_count}\"\n self.update(cell_count: cell_count)\n Rails.logger.info \"Cell count set for #{self.name}\"\n end",
"def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end",
"def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end",
"def calculate_columns!\n\n\n\n span_count = columns_span_count\n\n\n\n columns_count = children.size\n\n\n\n\n\n\n\n all_margins_width = margin_size * (span_count - 1)\n\n\n\n column_width = (100.00 - all_margins_width) / span_count\n\n\n\n\n\n\n\n columns.each_with_index do |column, i|\n\n\n\n is_last_column = i == (columns_count - 1)\n\n\n\n column.set_column_styles(column_width, margin_size, is_last_column)\n\n\n\n end\n\n\n\n end",
"def _window_size\n unless @window_size\n rows = `tput lines`\n cols = `tput cols`\n @window_size = [cols.chomp.to_i, rows.chomp.to_i]\n end\n @window_size\n end",
"def intefy!\n @num_cols = @num_cols.to_i\n @col_width = @col_width.to_i\n @gutter = @gutter.to_i\n end",
"def test_alignCenter\n w = Window_Selectable_Implemented.new(160,128,160,128,$data_items.compact, 24, true, 24, 1)\n @windows.push(w)\n end",
"def initialize (width=7)\n @grid = Array.new(width) {[]}\n\n end",
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def resize\n # We need to nuke ncurses to pick up the new dimensions\n Curses.def_prog_mode\n Curses.close_screen\n Curses.reset_prog_mode\n height, width = Curses.dimensions\n \n # Resize tabs \n @tabs.resize(\n :width => width,\n :height => height\n )\n @tabs.render\n end",
"def reset!\n # can't set it to cells for some reason\n @cells = Array.new(grid_size) { Array.new(grid_size, \" \")}\n end",
"def spawn_panes(num)\n main.number_of_panes = num\n @current_row = @current_page = 0\n end",
"def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end",
"def update_local_window_size(size); end",
"def clear_board\n @board_spaces = ((1..9).to_a).product([\" \"]).to_h\n end",
"def display \n system(\"clear\") || system(\"cls\")\n\n grid = content.split(\"\\n\")\n print \" \" # make grid line up\n grid.length.times{|num| print \" #{num + 1}\"}\n grid.length.times{|row|\n puts \"\"\n print (65+row).chr + \" \"\n grid[row].length.times{|col|\n print grid[row][col] \n }\n }\n puts \"\"\n end",
"def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end",
"def draw_columns\n @sections[:body][:fields].each do |field, settings|\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }).symbolize_keys!)]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n draw_line(@posY + @sections[:body][:settings][:height]/2)\n field = settings[2][:column] || field.to_s.split('_').inject('') do |str, part|\n str << part.camelize << \" \"\n end\n draw_text field, settings\n end\n draw_line(@posY - @sections[:body][:settings][:height]/2)\n set_pos_y @sections[:body][:settings][:height]\n end",
"def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end",
"def fill_col_widths(picklist_column_widths)\n # populate width of dropdown columns by the length of their contents\n @col_widths.each do |category, widths|\n sum = 0\n widths.each_with_index do |w, i|\n if w.nil?\n @col_widths[category][i] = picklist_column_widths.shift\n end\n sum += @col_widths[category][i]\n end\n if category.to_s.length + 2 > sum\n width_factor = (category.to_s.length + 2).to_f / sum.to_f\n widths.each_index do |i|\n @col_widths[category][i] *= width_factor\n end\n end\n end\n end",
"def make_grid\n @grid = Array.new(4){Array.new(4)}\n end",
"def default_grid\n Array.new(7) { Array.new(6) { Cell.new } }\n end",
"def create_grid\n @grid = {\"1a\" => \" \", \"1b\" => \" \", \"1c\" => \" \", \"1d\" => \" \", \"1e\" => \" \",\n \"2a\" => \" \", \"2b\" => \" \", \"2c\" => \" \", \"2d\" => \" \", \"2e\" => \" \",\n \"3a\" => \" \", \"3b\" => \" \", \"3c\" => \" \", \"3d\" => \" \", \"3e\" => \" \",\n \"4a\" => \" \", \"4b\" => \" \", \"4c\" => \" \", \"4d\" => \" \", \"4e\" => \" \",\n \"5a\" => \" \", \"5b\" => \" \", \"5c\" => \" \", \"5d\" => \" \", \"5e\" => \" \"}\n end",
"def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end",
"def grid_header_rows\n 1\n end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def columns\n IO.console.winsize.last\n end",
"def draw_table_four_columns(table_info, width_columns = [130, 130, 130, 130])\n table (table_info) do\n columns(0..3).border_width = 1\n columns(0..3).size = 8\n self.column_widths = width_columns\n end\n end",
"def window_width; QuestData::LIST_WINDOW_WIDTH; end",
"def window_width; QuestData::LIST_WINDOW_WIDTH; end",
"def set_form_col col1=0 #:nodoc:\n @cols_panned ||= 0 \n # editable listboxes will involve changing cursor and the form issue\n ## added win_col on 2010-01-04 23:28 for embedded forms BUFFERED TRYING OUT\n #[email protected]\n win_col = 0 \n col2 = win_col + @col + @col_offset + col1 + @cols_panned + @left_margin\n $log.debug \" set_form_col in rlistbox #{@col}+ left_margin #{@left_margin} ( #{col2} ) \"\n setrowcol nil, col2 \n end",
"def set_screen_row_col top, left=-1\n @top = top\n @left = left unless left < 0\n end",
"def attributes\n super.merge({\n :screens => screens.size\n\t })\n end",
"def create_grid\n spaces = create_spaces\n assign_spaces_to_rows.map do |row|\n row.each.with_index do |coordinates, index|\n row[index] = {coordinates => spaces[coordinates]}\n end\n end\n end",
"def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end",
"def second_main_column_cols\n if user_signed_in?\n 'col-10 p-0'\n else\n 'col-12 p-0'\n end\n end",
"def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n @title_prefix = title_prefix\n @max_contents_len = @win.maxx - 3 # 2 for borders\n end",
"def default_grid\n Array.new(3) { Array.new(3) {Cell.new} }\n end",
"def show_grid=(value)\n old = @show_grid\n @show_grid = value\n if old != @show_grid\n @array.each do |tile|\n if @show_grid\n if !tile.sprites[999]\n tile.sprites[999] = Sprite.new($visuals.viewport, {special: true})\n tile.sprites[999].set_bitmap(GRIDBITMAP)\n tile.sprites[999].x = tile.sprites[0].x\n tile.sprites[999].y = tile.sprites[0].y\n tile.sprites[999].z = 999\n end\n else\n if tile.sprites[999]\n tile.sprites[999].dispose\n tile.sprites.delete(999)\n end\n end\n end\n end\n end"
] | [
"0.57499975",
"0.57351977",
"0.5553342",
"0.54429096",
"0.53897727",
"0.5343184",
"0.5292715",
"0.52680224",
"0.5255623",
"0.52552164",
"0.52504885",
"0.52255446",
"0.52213967",
"0.5198733",
"0.51953804",
"0.5178039",
"0.51529235",
"0.5151116",
"0.5140587",
"0.5122981",
"0.50974405",
"0.5093716",
"0.50934637",
"0.5080253",
"0.5076293",
"0.5070771",
"0.5057732",
"0.50487316",
"0.5042662",
"0.5042662",
"0.5033114",
"0.5027977",
"0.5019634",
"0.5013365",
"0.50131196",
"0.5013001",
"0.5009895",
"0.49962944",
"0.49954972",
"0.49852422",
"0.4953926",
"0.49474627",
"0.4933864",
"0.49157405",
"0.4914784",
"0.49062973",
"0.49029532",
"0.49014002",
"0.48898792",
"0.48862448",
"0.48640308",
"0.48632693",
"0.48608243",
"0.48577705",
"0.4854904",
"0.48505196",
"0.48438358",
"0.4840359",
"0.48369363",
"0.48352194",
"0.48140302",
"0.48134956",
"0.4802089",
"0.479382",
"0.4791316",
"0.47896194",
"0.47844732",
"0.4781918",
"0.4774601",
"0.47639972",
"0.47451922",
"0.47430658",
"0.47420552",
"0.47367904",
"0.4732726",
"0.47255352",
"0.472462",
"0.47240895",
"0.47181466",
"0.47156844",
"0.4715203",
"0.47138128",
"0.47136825",
"0.47105646",
"0.4710303",
"0.47100863",
"0.47098866",
"0.4698228",
"0.46944785",
"0.46781316",
"0.46781316",
"0.467228",
"0.4665245",
"0.466377",
"0.4661445",
"0.46538186",
"0.46453884",
"0.46416196",
"0.4637069",
"0.46286026"
] | 0.5647578 | 2 |
Sets the number of columns defined in TotalSpaces2. This does not change the actual number of desktops present, you should call add_desktops_on_display or remove_desktops_on_display as appropriate after changing the number of columns. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.set_grid_columns_on_display(3, display_id) | def set_grid_columns_on_display(columns, display_id)
TSApi.tsapi_setDefinedColumnsOnDisplay(columns, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_grid_columns(columns)\n TSApi.tsapi_setDefinedColumnsOnDisplay(columns, 0)\n end",
"def columns=(n)\n @columns = n\n end",
"def columns=(integer); end",
"def set_cols(visible, list)\n @rows = 1 if visible\n @cols = (depends_on & list).find_all { |u| u.visible }.inject(0) { |s, v| s + (v.cols || 0) }\n @cols = 1 if @cols == 0 and visible\n end",
"def start_columns(size = 2, gutter = 10)\n # Start from the current y-position; make the set number of columns.\n return false if @columns_on\n\n @columns = {\n :current => 1,\n :bot_y => @y\n }\n @columns_on = true\n # store the current margins\n @columns[:left] = @left_margin\n @columns[:right] = @right_margin\n @columns[:top] = @top_margin\n @columns[:bottom] = @bottom_margin\n # Reset the margins to suit the new columns. Safe enough to assume the\n # first column here, but start from the current y-position.\n @top_margin = @page_height - @y\n @columns[:size] = size || 2\n @columns[:gutter] = gutter || 10\n w = absolute_right_margin - absolute_left_margin\n @columns[:width] = (w - ((size - 1) * gutter)) / size.to_f\n @right_margin = @page_width - (@left_margin + @columns[:width])\n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def columns_incdec howmany\n @gviscols += howmany.to_i\n @gviscols = 1 if @gviscols < 1\n @gviscols = 6 if @gviscols > 6\n @pagesize = @grows * @gviscols\nend",
"def set_grid_dimensions(row_count, col_count)\n \n # Forbid resetting grid dimensions\n if @grid_dimensions_set\n Vizkit.warn(\"Error: You may set grid dimensions before configuration only.\")\n return\n else\n @grid_dimensions_set = true\n end\n \n # Remove all parent widgets from grid.\n child = nil\n while(child = @grid.take_at(0)) \n widget = child.widget\n widget.set_parent(nil)\n widget = nil\n child = nil\n end\n \n # Generate container widgets with label if not yet existent\n counter = 0\n for row in 0..row_count-1 do\n for col in 0..col_count-1 do\n container = nil\n if not @container_hash[counter]\n widget_pos = (row * col_count) + col\n container = ContainerWidget.new(widget_pos)\n @container_hash[counter] = container\n else\n container = @container_hash[counter]\n end\n \n # Add parent widget to grid\n @grid.add_widget(container, row, col) # TODO does this make @grid the parent of the widget?\n container.show\n counter = counter + 1\n end\n end\n \n # Delete useless container widgets if any\n @container_hash.delete_if {|pos, conatiner| pos >= counter}\n \n end",
"def setNbGrids(nbGrids)\n\t\t@nbGames = nbGrids\n\t\treturn self\n\tend",
"def create_columns\n (column_count.to_i - columns.size).times { columns.create(position: columns.size) }\n end",
"def insert_columns(add_count)\n add_count.times do\n new_column = self.columns.create(:jivepage => jivepage)\n new_column.create_box!(\"textblock\", 1, \n :content => \"Click here to change text.\") if new_column.first?\n end\n end",
"def draw_table_six_columns(table_info, width_columns = [100, 100, 100, 90, 90, 40])\n table (table_info) do\n columns(0..5).border_width = 1\n columns(0..5).size = 7\n self.column_widths = width_columns\n end\n end",
"def set_cell_count\n cell_count = self.all_cells_array.size\n Rails.logger.info \"Setting cell count in #{self.name} to #{cell_count}\"\n self.update(cell_count: cell_count)\n Rails.logger.info \"Cell count set for #{self.name}\"\n end",
"def column_width(n=0)\n sg = 0\n if n.zero?\n n = g_total_cols\n sg = g_side_gutter_width\n end\n (n*g_col_width) + ((n - 1)*g_gutter_width).ceil + (sg*2)\n end",
"def screen_size=(new_screen_size)\n\t try_set_screen\n Klass.setScreenSize(@handle, Phidgets::FFI::TextLCDScreenSizes[new_screen_size])\n\t \n\t load_rows(@index) #readjust screen rows\n new_screen_size\n end",
"def columns; IO.console.winsize[1] rescue 80; end",
"def cols(value)\n @page_cols_num = value.to_i\n end",
"def append_width(required_col)\n diff = required_col - @screen_size[1] + 1\n @screen.each.with_index do |row, i|\n @screen[i] = row + Array.new(diff)\n end\n @screen_size[1] += diff\n end",
"def calculate_columns!\n\n\n\n span_count = columns_span_count\n\n\n\n columns_count = children.size\n\n\n\n\n\n\n\n all_margins_width = margin_size * (span_count - 1)\n\n\n\n column_width = (100.00 - all_margins_width) / span_count\n\n\n\n\n\n\n\n columns.each_with_index do |column, i|\n\n\n\n is_last_column = i == (columns_count - 1)\n\n\n\n column.set_column_styles(column_width, margin_size, is_last_column)\n\n\n\n end\n\n\n\n end",
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def columns=(columns)\n resize_field @rows, columns\n end",
"def columns\n layout_text.blank? ? 12 : layout[0].size\n end",
"def switch_windows\n tv = @form.by_name[\"tv\"]\n list = @form.by_name[\"mylist\"]\n if tv.col > 0\n tv.col = 0\n tmp = tv.width\n list.col = tmp + 1\n else\n list.col = 0\n tv.col = list.width + 1\n end\nend",
"def _print_more_columns_marker tf\n tf = false\n if @pmincol + @display_w < @pad_w\n tf = true\n end\n marker = tf ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE\n h = @display_h; w = @display_w\n r = @orig_top\n c = @orig_left\n @target_window.mvwaddch r+h, c+w-2, marker\n #\n # show if columns to left or not\n marker = @pmincol > 0 ? Ncurses::ACS_CKBOARD : Ncurses::ACS_HLINE\n @target_window.mvwaddch r+h, c+1, marker\n end",
"def draw_table_five_columns(table_info, width_columns = [100, 100, 100, 70, 130])\n table (table_info) do\n columns(0..4).border_width = 1\n columns(0..4).size = 9\n self.column_widths = width_columns\n end\n end",
"def column_width n\n column_widths[n] || 0\n end",
"def lnbsetColumnsPos _args\n \"lnbsetColumnsPos _args;\" \n end",
"def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end",
"def ListView_SetColumnWidth(hwnd, iCol, cx)\n send_listview_message(hwnd, :SETCOLUMNWIDTH, wparam: iCol, lparam: MAKELPARAM(cx, 0))\n end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def column_count\n @stkw_config[:max_col]\n end",
"def create_column_list\n for columnID in 1..Battery.num_columns do\n column = Column.new(columnID)\n column.create_elevator_list()\n column.create_call_buttons()\n\n @column_list.append(column)\n end\n end",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def intefy!\n @num_cols = @num_cols.to_i\n @col_width = @col_width.to_i\n @gutter = @gutter.to_i\n end",
"def fill_col_widths(picklist_column_widths)\n # populate width of dropdown columns by the length of their contents\n @col_widths.each do |category, widths|\n sum = 0\n widths.each_with_index do |w, i|\n if w.nil?\n @col_widths[category][i] = picklist_column_widths.shift\n end\n sum += @col_widths[category][i]\n end\n if category.to_s.length + 2 > sum\n width_factor = (category.to_s.length + 2).to_f / sum.to_f\n widths.each_index do |i|\n @col_widths[category][i] *= width_factor\n end\n end\n end\n end",
"def set_screen_max_row_col mr, mc\n $log.debug \"#{@name} set_screen_max_row_col #{mr},#{mc}. earlier #{@screen_maxrow}, #{@screen_maxcol} \"\n # added || check on 2010-01-09 18:39 since crashing if mr > sh + top ..\n # I removed the check, since it results in a blank area on screen since the \n # widget has not expanded itself. Without the check it will crash on copywin so you\n # should increase widget size or disallow calling this in this situation.\n if mr > (@sheight + @top -1 -@pminrow)\n $log.warn \" ->>> ** set_screen_max_row_col #{mr} > #{@sheight} + #{@top} -1 - #{@pminrow} ** \"\n $log.warn \" ->>> can result in error in copy_win or in some rows not displaying\"\n return # some situations actually require this ...\n end unless mr.nil?\n @screen_maxrow = mr unless mr.nil? # || mr > (@sheight + @top -1 -@pminrow)\n @screen_maxcol = mc unless mc.nil?\n end",
"def draw_columns\n @sections[:body][:fields].each do |field, settings|\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }).symbolize_keys!)]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n draw_line(@posY + @sections[:body][:settings][:height]/2)\n field = settings[2][:column] || field.to_s.split('_').inject('') do |str, part|\n str << part.camelize << \" \"\n end\n draw_text field, settings\n end\n draw_line(@posY - @sections[:body][:settings][:height]/2)\n set_pos_y @sections[:body][:settings][:height]\n end",
"def addcol num\n return if @col.nil? || @col == -1\n @col += num\n @window.wmove @row, @col\n ## 2010-01-30 23:45 exchange calling parent with calling this forms setrow\n # since in tabbedpane with table i am not gietting this forms offset. \n setrowcol nil, col\n end",
"def column_width=(value)\n @column_width = value\n end",
"def size_column_headings\n $sized_column_headings = []\n if $column_widths\n $column_headings.zip($column_widths) do |h, w| \n $sized_column_headings << h.slice(0, w)\n end\n end\nend",
"def columns=(arr)\n @columns = arr\n update_height\n end",
"def columns\n gtk_instance.columns\n end",
"def columns=(array)\n #$log.debug \"tabular got columns #{array.count} #{array.inspect} \" if $log\n @columns = array\n @columns.each_with_index { |e,i| \n #@chash[i] = ColumnInfo.new(c, c.to_s.length) \n c = get_column(i)\n c.name = e\n c.width = e.to_s.length\n #@chash[i] = c\n #@cw[i] ||= c.to_s.length\n #@calign[i] ||= :left # 2011-09-27 prevent setting later on\n }\n end",
"def grid_page_size\n GRID_PAGE_SIZE\n end",
"def build_table (number)\n @main_table.each{|child| @main_table.remove(child)}\n if number<=3\n @main_table.n_columns = number\n @main_table.n_rows = 1\n i = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n text.editable = false\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n @main_table.attach(scrolled,i,i+1,0,1)\n @main_table.show_all\n i+=1\n end\n else\n @main_table.n_rows = 2\n @main_table.n_columns = (number+1)/2\n i = 0\n fil = col = 0\n while i<number\n text = @texts[i]\n scrolled = @scrolls[i]\n if text == nil\n scrolled = Gtk::ScrolledWindow.new\n text = Gtk::TextView.new\n text.name = \"txtNumber#{i+1}\"\n scrolled.name = \"scrollNumber#{i+1}\"\n scrolled.add(text)\n scrolled.show_all\n @texts[i] = text\n @scrolls[i] = scrolled\n end\n #Fils the first row. The fil variable acts like a controller. When it changes, the row has changed.\n if (col < @main_table.n_columns && fil == 0)\n @main_table.attach(scrolled,col,col+1,0,1)\n col+=1\n if col==@main_table.n_columns #All the columns have been filled. We change rows\n fil = 1; col = 0 #Restart the columns index\n end\n else #Second row statrs here\n @main_table.attach(scrolled,col,col+1,1,2)\n col+=1\n end\n @main_table.show_all\n i+=1\n end\n end\n end",
"def columns=(value)\n @columns = value\n end",
"def column_space(); @column_space; end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def widths_reset\n @width = GroupLayout::DEFAULT_SIZE\n @max = GroupLayout::DEFAULT_SIZE\n end",
"def column_space=(val)\n @column_space = val\n update_xy\n end",
"def update_dimensions\n spacer=@hex_width # 3-char space between areas\n ui_width = @addr_width + (spacer*4) # addr sp sp hex sp ascii sp\n\n @columns = (client_size.width - ui_width) / (@hex_width + @asc_width*2)\n @columns = 1 if @columns < 1\n @rows = (@data.size / @columns)+1\n\n # calculate hex/ascii area boundaries\n @hex0 = @addr_width + spacer*2\n @hexN = @hex0 + (@columns * (@hex_width+@asc_width))\n @asc0 = @hexN + spacer\n @ascN = @asc0 + (@columns * @asc_width)\n @row_width = @ascN - @addr_width - @hex_width\n\n # update scroll-bar info\n old_pos=first_visible_line\n set_line_count(@rows)\n scroll_to_line(old_pos)\n end",
"def setOptions(iDisplayedList)\n @DisplayedList = iDisplayedList\n set_item_count(@DisplayedList.size)\n # Refresh everything\n refresh_items(0, item_count)\n # Rearrange columns widths\n set_column_width(0, 20)\n set_column_width(1, Wx::LIST_AUTOSIZE)\n set_column_width(2, Wx::LIST_AUTOSIZE)\n # Compute minimal size\n self.min_size = [ [ column_width(0) + column_width(1) + column_width(2) + 8, 200 ].min, 0 ]\n # Resize\n lOldSize = self.parent.size\n self.parent.fit\n self.parent.size = lOldSize\n end",
"def set_rows_per_page\n if params[:iDisplayLength].present?\n @rows_per_page = (params[:iDisplayLength] or \"20\").to_i\n elsif cookies[:iDisplayLength].present?\n @rows_per_page = cookies[:iDisplayLength].to_i\n else\n @rows_per_page = 20\n end\n cookies[:iDisplayLength] = @rows_per_page\n end",
"def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end",
"def columns=(value)\n return if @columns == value\n @columns = value\n refresh\n end",
"def create_shop_viewports\n @shop_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)\n @item_number_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)\n @item_number_viewport.z = @shop_viewport.z + 1\n end",
"def insert_columns( before, number=1 )\n a = Array.new( number, nil )\n before = col_index( before ) - 1\n @data.map! { |row| row.insert( before, *a ) }\n calc_dimensions\n end",
"def column_count\n is_container? ? get_content_param_by_key( :model_count_in_row ) : 0\n end",
"def width\n cols\n end",
"def gridmaxwidths ()\n # write a media query for each breakpoint\n $g = 0\n items = MEASURES\n $LEN = items.length\n $buffer = \"\"\n\n until $g == $LEN\n if $g == 0\n $NAME = 0\n $NAMETXT = \"default\"\n else\n $NAME = \"$bp-\" + items[$g]['NAME']\n $NAMETXT = $NAME\n end\n $FROM = items[$g]['FROM']\n $MAXW = items[$g]['MAXW']\n $buffer += \"\n /* #$NAMETXT breakpoint (#$FROM) */\n @media (min-width: #$NAME){\n .wrapbox {\n max-width: #$MAXW; \n }\n }\n \"\n\n $g += 1\n end\n\n return $buffer\nend",
"def initialize(x, y, width, height, items, dataview=nil)\n super(x, y, width, height)\n @column_max = 2\n @ucItemsList = []\n window_update(items, dataview)\n self.index = 0\n end",
"def draw_table_four_columns(table_info, width_columns = [130, 130, 130, 130])\n table (table_info) do\n columns(0..3).border_width = 1\n columns(0..3).size = 8\n self.column_widths = width_columns\n end\n end",
"def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end",
"def _window_size\n unless @window_size\n rows = `tput lines`\n cols = `tput cols`\n @window_size = [cols.chomp.to_i, rows.chomp.to_i]\n end\n @window_size\n end",
"def cols\n @size\n end",
"def get_col_widths()\n w_name = 0\n w_serial = 0\n\n $devices[:connected].each { |dev|\n next if dev[:disabled]\n next if not is_selected(dev)\n\n l_name = dev[:name].length\n w_name = l_name if l_name > w_name\n\n if $verbose\n l_serial = dev[:serial].length\n w_serial = l_serial if l_serial > w_serial\n end\n }\n\n if $verbose\n return [ w_name, w_serial + 1 ]\n end\n return w_name\nend",
"def setItems(list, list_size, numbers)\n if self.createItemList(numbers, list, list_size) <= 0\n return\n end\n\n # Clean up the display.\n (0...@view_size).each do |x|\n Draw.writeBlanks(@win, 1, x, CDK::HORIZONTAL, 0, @box_width - 2);\n end\n\n self.setViewSize(list_size)\n self.setPosition(0)\n @left_char = 0\n end",
"def with_column_models_count\n # Drop the last row (the corresponding instances of the {ActsAsTable::ColumnModel} class).\n @with_column_models_count ||= Hash.for(@column_models, @header_names_with_padding).to_array[0..-2]\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def width\n @columns * @block_size\n end",
"def setwsviewport(*)\n super\n end",
"def sh_set_lines_and_columns(lines, cols)\r\n ENV[\"LINES\"] = lines.to_s\r\n ENV[\"COLUMNS\"] = cols.to_s\r\n end",
"def columns\n @columns || 150\n end",
"def demoExplorerSmallIcons(t)\n demoExplorerList(t)\n t.configure(:orient=>:horizontal, :xscrollincrement=>0)\n t.column_configure(0, :width=>'', :stepwidth=>110, :widthhack=>false)\nend",
"def column_count\n visible_column_names().count\n end",
"def defaults # :nodoc:\n self.columns.length.times { |idx|\n }\n end",
"def update_height\n @height = max_column.size if max_column.size > @height\n end",
"def blue_screen_count=(value)\n @blue_screen_count = value\n end",
"def screen_settings\n # TODO these need to become part of our new full_indexer class, not hang about separately.\n $glines=%x(tput lines).to_i\n $gcols=%x(tput cols).to_i\n # this depends now on textpad size not screen size TODO FIXME\n $grows = $glines - 1\n $pagesize = 60\n #$gviscols = 3\n $pagesize = $grows * $gviscols\nend",
"def card_ncolumns\n 0\n end",
"def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end",
"def columns\n IO.console.winsize.last\n end",
"def set_column_spaces_occupied(coordinate1, coordinate2)\n get_column_spaces_between(coordinate1, coordinate2).each do |coordinate|\n set_space_occupied(coordinate)\n end\n end",
"def set_column(*args)\n data = args\n cell = data[0]\n\n # Check for a cell reference in A1 notation and substitute row and column\n if cell =~ /^\\D/\n data = substitute_cellref(*args)\n\n # Returned values $row1 and $row2 aren't required here. Remove them.\n data.shift # $row1\n data.delete_at(1) # $row2\n end\n\n return if data.size < 3 # Ensure at least $firstcol, $lastcol and $width\n return if data[0].nil? # Columns must be defined.\n return if data[1].nil?\n\n # Assume second column is the same as first if 0. Avoids KB918419 bug.\n data[1] = data[0] if data[1] == 0\n\n # Ensure 2nd col is larger than first. Also for KB918419 bug.\n data[0], data[1] = data[1], data[0] if data[0] > data[1]\n\n # Limit columns to Excel max of 255.\n data[0] = ColMax - 1 if data[0] > ColMax - 1\n data[1] = ColMax - 1 if data[1] > ColMax - 1\n\n @colinfo.push(data)\n\n # Store the col sizes for use when calculating image vertices taking\n # hidden columns into account. Also store the column formats.\n #\n firstcol, lastcol, width, format, hidden = data\n\n width ||= 0 # Ensure width isn't undef.\n hidden ||= 0\n width = 0 if hidden > 1 # Set width to zero if col is hidden\n\n (firstcol .. lastcol).each do |col|\n @col_sizes[col] = width\n @col_formats[col] = format unless format.nil?\n end\n end",
"def printGrid(number_of_pieces)\n size = number_of_pieces.to_s.length\n print_horizontal_line((size+1) * @width + 1)\n \n (@height - 1).downto(0) do |hIdx|\n print '|'\n @width.times do |wIdx|\n print fixed_string(@grid[wIdx][hIdx].to_s, size)\n print ' ' if wIdx < @width - 1\n end\n print '|'\n print \"\\n\"\n end\n \n print_horizontal_line((size+1) * @width + 1)\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def setup_display\n gameboard.build_display\n build_white_side\n build_black_side\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def init_white_panel!\n grid.cells[grid.pos] = 1\n end",
"def columns(n, context=0, from=g_from_direction)\n to = opposite_position(from)\n\n # the column is floated left\n float(from)\n \n mixin({\n # the width of the column is set as a percentage of the context\n width: column_percent(n, context),\n # the right gutter is added as a percentage of the context\n \"margin_#{to}\" => gutter(context)\n })\n end",
"def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end",
"def set_board\n\t\t(1..@disks).each do |disk|\n\t\t\t@pegs[0].unshift disk\n\t\tend\n\tend",
"def screen_settings\n @glines, @gcols = `stty size`.split.map(&:to_i)\n # @glines = `tput lines`.to_i\n # @gcols = `tput cols`.to_i\n @grows = @glines - 3\n # @pagesize = 60\n # @gviscols = 3\n @pagesize = @grows * @gviscols\nend",
"def set_width_and_length\n footprint = @total_floor_area / num_stories.to_f\n @width = Math.sqrt(footprint / @ns_to_ew_ratio)\n @length = footprint / @width\n end",
"def new_board_grid\n unicode = 65\n @board_matrix.each do |array|\n @board_matrix.each_with_index do |_element, i|\n array[i] = \" #{unicode.chr} \"\n unicode += 1\n end\n end\n end",
"def show_grid=(value)\n old = @show_grid\n @show_grid = value\n if old != @show_grid\n @array.each do |tile|\n if @show_grid\n if !tile.sprites[999]\n tile.sprites[999] = Sprite.new($visuals.viewport, {special: true})\n tile.sprites[999].set_bitmap(GRIDBITMAP)\n tile.sprites[999].x = tile.sprites[0].x\n tile.sprites[999].y = tile.sprites[0].y\n tile.sprites[999].z = 999\n end\n else\n if tile.sprites[999]\n tile.sprites[999].dispose\n tile.sprites.delete(999)\n end\n end\n end\n end\n end",
"def display_w(*val)\n if val.empty?\n return @display_w\n else\n #raise ArgumentError \"display_h should be ... \" if val[0] ...\n oldvalue = @display_w\n @display_w = val[0]\n @display_w = [@display_w, @target_window.width - 2].min unless @target_window.width == 0\n $log.debug \"XXX:set display_w to #{@display_w} \"\n #fire_property_handler(:display_h, oldvalue, @display_h)\n end\n self\n end",
"def col_max; (contents_width / (MA_IconItemList::RECT_WIDTH + spacing)); end",
"def screen_width(out=STDERR)\n default_width = ENV['COLUMNS'] || 76\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if out.ioctl(tiocgwinsz, data) >= 0 then\n rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end"
] | [
"0.6480799",
"0.6065957",
"0.57874715",
"0.5679564",
"0.56277114",
"0.55837053",
"0.5569885",
"0.55534035",
"0.55436236",
"0.5448767",
"0.5390982",
"0.53886837",
"0.5314076",
"0.5309804",
"0.5278624",
"0.5226935",
"0.52188313",
"0.520026",
"0.519874",
"0.51839453",
"0.51809144",
"0.5179563",
"0.5155386",
"0.5154279",
"0.51298785",
"0.5101934",
"0.5090902",
"0.5065071",
"0.505855",
"0.5041739",
"0.5037278",
"0.50287664",
"0.49864942",
"0.497862",
"0.49752262",
"0.49579474",
"0.49575815",
"0.494087",
"0.49381822",
"0.49061376",
"0.4893411",
"0.4892994",
"0.48910576",
"0.48875168",
"0.48874164",
"0.48752838",
"0.48734143",
"0.48663244",
"0.48630926",
"0.48589376",
"0.48589072",
"0.48484898",
"0.4828029",
"0.48254555",
"0.48129305",
"0.480463",
"0.48034513",
"0.48026058",
"0.47924495",
"0.47742337",
"0.47677895",
"0.47632694",
"0.47508642",
"0.47504255",
"0.4733171",
"0.47289538",
"0.4724095",
"0.4712983",
"0.47085267",
"0.47001278",
"0.4699053",
"0.46955264",
"0.46950337",
"0.46919632",
"0.4686295",
"0.4679579",
"0.46712196",
"0.46640503",
"0.4659144",
"0.46543565",
"0.4650339",
"0.46462896",
"0.46450362",
"0.46443117",
"0.46399823",
"0.4638816",
"0.46335372",
"0.46319303",
"0.46202746",
"0.46135733",
"0.46094188",
"0.46094102",
"0.46040463",
"0.46004298",
"0.45990336",
"0.45949715",
"0.45932192",
"0.45891383",
"0.45881796",
"0.45852867"
] | 0.64236224 | 1 |
Command TotalSpaces2 to switch to the given space number on the main display. Returns false if the space number was invalid. The on_space_change notification will be sent. TotalSpaces2.move_to_space(1) | def move_to_space(space_number)
TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res = server.invoke_command(\"move-window -s #{identifier} -t #{target}\")\n if res =~ /^can't move window: index in use: \\d+/\n raise IndexInUse, [new_session, new_number]\n end\n @session = new_session\n @number = new_number\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def computer_key_move(spaces, check1, check2, check3)\n\n if spaces[check1] == \" \"\n spaces[check1] = \"O\"\n elsif spaces[check2] == \" \"\n spaces[check2] = \"O\"\n elsif spaces[check3] == \" \"\n spaces[check3] = \"O\"\n end\nend",
"def decrease_spaces()\n @spaces -= 1\n end",
"def _Space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_Space unless _tmp\n return _tmp\n end",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def increase_spaces()\n @spaces += 1\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def is_space_free(board, move) \n return board[move] == ' '\nend",
"def player_turn\n begin\n puts \"Please choose a space (1 - 9)\"\n player_move = gets.chomp.to_i\n end until player_move.class == Fixnum && ((1..9).to_a).include?(player_move) && @active_spaces[player_move] == \" \"\n self.active_spaces[player_move] = \"X\"\n puts \"You chose space #{player_move}!\"\n game_board.show_board\n end",
"def move_player2 (choice_case)\n symbole_player2 = @player2.symbole\n @board.move_player2(choice_case, symbole_player2) \n @@game_count+=1\n end",
"def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n return _tmp\n end",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n _tmp = apply(:_eol)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end",
"def computer_turn\n begin\n computer_move = (1..9).to_a.sample\n end until active_spaces[computer_move] == \" \"\n puts \"\\nThe Computer makes a move, choosing space #{computer_move}...\\n\\n\" \n self.active_spaces[computer_move] = \"O\"\n game_board.show_board\n end",
"def _spaces\n _save = self.pos\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n if _tmp\n while true\n \n _save2 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save2\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save\n end\n set_failed_rule :_spaces unless _tmp\n return _tmp\n end",
"def move_to(n)\n cd(n)\n end",
"def do_space_steps(info)\n old_dt = info.dt\n info.dt = DT\n SUBSTEPS.times do \n fire :update_space, info\n @space_holder.step DT\n end\n info.dt = old_dt\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def update\n raise User::NotAuthorized, '수정할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.update_attributes(space_params)\n\n broadcast_update_space(@space)\n end",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def do_command2\n $game_temp.num_input_start = GameData::MAX_LEVEL\n $game_temp.num_input_variable_id = Yuki::Var::TMP1\n $game_temp.num_input_digits_max = 3\n display_message(ext_text(8997, 27))\n @wanted_data[1] = $game_variables[Yuki::Var::TMP1] if $game_variables[Yuki::Var::TMP1] > 0\n $game_temp.num_input_start = GameData::MAX_LEVEL\n $game_temp.num_input_variable_id = Yuki::Var::TMP1\n $game_temp.num_input_digits_max = 3\n display_message(ext_text(8997, 28))\n @wanted_data[2] = $game_variables[Yuki::Var::TMP1] if $game_variables[Yuki::Var::TMP1] >= @wanted_data[1]\n end",
"def command_unit2\n @command_window.deactivate\n activate_c2\n end",
"def map_space\n Vim.command('imap <Space> <C-R>=DeliminatorSpace()<CR>')\n end",
"def update\n respond_to do |format|\n if @space.update(space_params)\n format.html { redirect_to @space, notice: \"Space was successfully updated.\" }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def column_space=(val)\n @column_space = val\n update_xy\n end",
"def o_board_change (num)\n def space_check (space,board_state)\n if board_state.include?(space)\n return true\n else\n puts \"You've entered an invalid space option.\"\n $i -= 1\n return false\n end\n end\n \n puts \" #{num[0]} | #{num[1]} | #{num[2]}\\n-----------\\n #{num[3]} | #{num[4]} | #{num[5]}\\n-----------\\n #{num[6]} | #{num[7]} | #{num[8]}\"\n \n puts \"Player one, please choose a location for your O.\"\n \n o = gets.chomp\n o_int = o.to_i\n \n if space_check(o_int,num) == true\n space_index = num.index(o_int)\n num[space_index] = \"O\"\n $j = 0\n end\n return num\n end",
"def place_x(space)\n \tchoice = to_space_sym(space)\n \t@spaces[choice] = \"X\"\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def move(number)\n @position += number\n if @position < 32\n puts \"You moved #{number} steps forward\"\n end\n sleep(1)\n landed_on_which_panel(@position)\n end",
"def space_available?(space)\n \t@spaces[to_space_sym(space)] == \" \" ? true : false\n end",
"def move_page(num)\n add_actions \"MovePage(#{num})\"\n end",
"def reserve_space space\n return if self.last and self.last.id >= space\n\n o = self.new\n o.id= space\n o.save_without_alter_ego\n o.delete\n return\n end",
"def change_space(namespace)\n update!(name: namespace)\n end",
"def update\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n if @space.update(space_params)\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def make_human_move(player, space)\n self.board[space] = player.symbol\n self.board.save\n end",
"def set_column_spaces_occupied(coordinate1, coordinate2)\n get_column_spaces_between(coordinate1, coordinate2).each do |coordinate|\n set_space_occupied(coordinate)\n end\n end",
"def rename_tablespace(old_name, new_name)\n execute(\"ALTER TABLESPACE #{quote_tablespace(old_name)} RENAME TO #{quote_tablespace(new_name)};\")\n end",
"def open_space?(spot)\n !@occupied_spaces.key?(spot)\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def space(space_id)\n return spaces[space_id] if spaces[space_id]\n\n unless (table_record = data_dictionary.table_by_space_id(space_id))\n raise \"Table with space ID #{space_id} not found\"\n end\n\n add_table(table_record[\"NAME\"])\n\n spaces[space_id]\n end",
"def place_o(space)\n \tchoice = to_space_sym(space)\n \t@spaces[choice] = \"O\"\n end",
"def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\f\")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\v\")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end",
"def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend",
"def update\n logger.info(params)\n @space = Space.find(params[:id])\n respond_to do |format|\n if @space.update(space_params)\n flash[:info] = \"空间更新成功!\"\n format.html { redirect_to @space }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def second_move() \r\n\t\tif first_move == false && board[4].class = Fixnum\r\n\t\t\tboard[4] = marker\r\n\t\telse\r\n\t\t\tcorner\r\n\t\tend\r\n\tend",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def is_valid_space?(state, move, turn)\n board = JSON.parse(state)\n src, dst = move \n \n # Get the piece that is going to be\n # moved \n srcpiece = board[src[0]][src[1]]\n dstpiece = board[dst[0]][dst[1]]\n \n # Make sure the src piece is the\n # same as the turn and the destination\n # is an empty space\n if srcpiece.downcase != turn or dstpiece != ' '\n return false \n end\n\n return true \n end",
"def move_to(new_position)\n if range.include? new_position\n reorder(position, new_position)\n update_column(:position, new_position)\n end\n end",
"def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end",
"def ask_move\n puts \"#{current_player.name}: Enter a number between 1 and 9\"\n print \">\"\n end",
"def second_move() \n\t\tif first_move == false && board[4].class = Fixnum\n\t\t\tboard[4] = marker\n\t\telse\n\t\t\tcorner\n\t\tend\n\tend",
"def user_select_space(board)\n puts \"Select a space (1 - 9)\"\n user_selection = gets.chomp.to_i\n while !empty_spaces(board).keys.include?(user_selection)\n puts \"That space is taken! Please select another space (1 - 9)\"\n user_selection = gets.chomp.to_i\n end\n board[user_selection] = 'X'\nend",
"def should_space(left, right)\n true\n end",
"def update\n @space_form = Space::Form.new(space: @space,\n user: current_user,\n attributes: space_params)\n\n authorize @space, :update?\n\n respond_to do |format|\n if @space_form.save\n format.html { redirect_to space_pages_path(@space_form.space), notice: 'Space was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_form.space }\n else\n format.html { render :edit }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def set_space_unit(key, value)\n\t@space_units_values[key] = value\nend",
"def accept_space(space)\n space.active! if space.accepted? # always true for private_type spaces\n space.save!\n end",
"def update\n \n @space = Space.find(params[:id])\n @space.update(space_params)\n \n if @space.save\n redirect_to @space, notice: 'El Espacio fue actualizado satisfactoriamente'\n else\n render :edit\n end\n \n end",
"def check_for_open_board\n active_spaces.values.include?(\" \")\n end",
"def create\n @spaces_mine = Space.mine(current_user.id)\n raise Space::NotAllowed, '공간 생성 한도를 초과했습니다.' if over_space_limit\n @space = Space.new(space_params.merge(user_id: current_user.id))\n @space.save\n flash.now[:error] = @space.errors.messages[:url] if @space.errors.any?\n broadcast_create_space(@space)\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"def printSpaces(name,space)\n if name\n name.size.upto (space) do\n print \"\\s\"\n end\n else\n 0.size.upto (space) do\n print \"\\s\"\n end\n end\nend",
"def to_space_sym(num)\n \tspace = \"space_#{num}\".to_sym\n end",
"def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend",
"def move_to(x, y)\n super(x, y)\n update_memory!(self.memory)\n end",
"def move(x, y)\n start_time = Time.now\n xdotool \"windowmove #{@id} #{x} #{y}\"\n # Inconsistencies exist between xwininfo and xdotool.\n # \"xdotool windowmove\" is local to the selected monitor, not reflecting the\n # true coordinates of the X session. Using the screen geometry determined,\n # we can get around this.\n while [x+$screen_geometry[0][0], y+$screen_geometry[0][1]] != get_position(@id)\n puts \"#{get_position(@id)}\"\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not react - are you running a tiling window manager? Exiting...\") if Time.now - start_time > 2\n end\n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def update\n respond_to do |format|\n if @space.update(space_params)\n format.html { redirect_to @space, notice: 'Space was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def print_space(location_relative_to_msg)\n odd_height_correction = \n (vertical_blank_space.odd? && location_relative_to_msg == :after ? 1 : 0)\n puts \"\\n\" * ((vertical_blank_space / 2) + odd_height_correction)\n end",
"def _space\n\n begin # choice\n _tmp = match_string(\" \")\n break if _tmp\n _tmp = match_string(\"\\t\")\n break if _tmp\n _tmp = apply(:_eol)\n end while false # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end",
"def system_space\n spaces[SYSTEM_SPACE_ID]\n end",
"def edit_space(description)\n update!(description: description)\n end"
] | [
"0.67794645",
"0.6774059",
"0.65374786",
"0.63984084",
"0.63631827",
"0.60728097",
"0.54985917",
"0.541382",
"0.5356555",
"0.53110063",
"0.52830863",
"0.52224225",
"0.5218815",
"0.52141035",
"0.52128756",
"0.51518625",
"0.5148263",
"0.5148263",
"0.5148263",
"0.5148263",
"0.5148263",
"0.5146985",
"0.5127203",
"0.510677",
"0.510261",
"0.50412416",
"0.5036013",
"0.50040835",
"0.5002264",
"0.5000103",
"0.49997267",
"0.49997267",
"0.49541727",
"0.49496382",
"0.49432525",
"0.49346972",
"0.49338457",
"0.49027434",
"0.48904854",
"0.48656717",
"0.48619136",
"0.48583636",
"0.48507416",
"0.48271197",
"0.48214477",
"0.48154855",
"0.47953123",
"0.4789909",
"0.4787301",
"0.4772916",
"0.47688",
"0.47513193",
"0.47496107",
"0.47460622",
"0.474531",
"0.47378886",
"0.47266144",
"0.4714259",
"0.4714259",
"0.4701549",
"0.4699001",
"0.46988708",
"0.4685895",
"0.46786705",
"0.4678311",
"0.46762538",
"0.46610698",
"0.46592394",
"0.46586147",
"0.46581972",
"0.46567762",
"0.4647733",
"0.4644339",
"0.46405149",
"0.46317717",
"0.463109",
"0.46235532",
"0.4618371",
"0.46137294",
"0.46112207",
"0.46019563",
"0.45949423",
"0.4594657",
"0.45934445",
"0.45892188",
"0.45828244",
"0.45786825",
"0.4577909",
"0.4573807",
"0.45700723",
"0.45663202",
"0.45634666",
"0.4563404",
"0.45633674",
"0.45621982",
"0.4557412",
"0.4556591",
"0.45563036",
"0.4556275",
"0.45550767"
] | 0.7209901 | 0 |
Command TotalSpaces2 to switch to the given space number. Returns false if the space number was invalid. The on_space_change notification will be sent. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.move_to_space_on_Display(1, display_id) | def move_to_space_on_display(space_number, display_id)
TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def set_name_for_space_on_display(space_number, name, display_id)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id)\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res = server.invoke_command(\"move-window -s #{identifier} -t #{target}\")\n if res =~ /^can't move window: index in use: \\d+/\n raise IndexInUse, [new_session, new_number]\n end\n @session = new_session\n @number = new_number\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def computer_key_move(spaces, check1, check2, check3)\n\n if spaces[check1] == \" \"\n spaces[check1] = \"O\"\n elsif spaces[check2] == \" \"\n spaces[check2] = \"O\"\n elsif spaces[check3] == \" \"\n spaces[check3] = \"O\"\n end\nend",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def set_space_type\n @space_type = SpaceType.find(params[:id])\n end",
"def set_space_reservation\n @space_reservation = SpaceReservation.find(params[:id])\n end",
"def decrease_spaces()\n @spaces -= 1\n end",
"def update\n raise User::NotAuthorized, '수정할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.update_attributes(space_params)\n\n broadcast_update_space(@space)\n end",
"def player_turn\n begin\n puts \"Please choose a space (1 - 9)\"\n player_move = gets.chomp.to_i\n end until player_move.class == Fixnum && ((1..9).to_a).include?(player_move) && @active_spaces[player_move] == \" \"\n self.active_spaces[player_move] = \"X\"\n puts \"You chose space #{player_move}!\"\n game_board.show_board\n end",
"def set_name_for_space(space_number, name)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0)\n end",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def is_space_free(board, move) \n return board[move] == ' '\nend",
"def computer_turn\n begin\n computer_move = (1..9).to_a.sample\n end until active_spaces[computer_move] == \" \"\n puts \"\\nThe Computer makes a move, choosing space #{computer_move}...\\n\\n\" \n self.active_spaces[computer_move] = \"O\"\n game_board.show_board\n end",
"def set_office_space\n @office_space = OfficeSpace.find(params[:id])\n end",
"def move_to(n)\n cd(n)\n end",
"def update\n respond_to do |format|\n if @space.update(space_params)\n format.html { redirect_to @space, notice: \"Space was successfully updated.\" }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_space(description)\n update!(description: description)\n end",
"def make_human_move(player, space)\n self.board[space] = player.symbol\n self.board.save\n end",
"def move_player2 (choice_case)\n symbole_player2 = @player2.symbole\n @board.move_player2(choice_case, symbole_player2) \n @@game_count+=1\n end",
"def move(number)\n @position += number\n if @position < 32\n puts \"You moved #{number} steps forward\"\n end\n sleep(1)\n landed_on_which_panel(@position)\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def command_unit2\n @command_window.deactivate\n activate_c2\n end",
"def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def move(x, y)\n start_time = Time.now\n xdotool \"windowmove #{@id} #{x} #{y}\"\n # Inconsistencies exist between xwininfo and xdotool.\n # \"xdotool windowmove\" is local to the selected monitor, not reflecting the\n # true coordinates of the X session. Using the screen geometry determined,\n # we can get around this.\n while [x+$screen_geometry[0][0], y+$screen_geometry[0][1]] != get_position(@id)\n puts \"#{get_position(@id)}\"\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not react - are you running a tiling window manager? Exiting...\") if Time.now - start_time > 2\n end\n end",
"def move_to_sys\n # Make sure you got the correct SYSTEM Account Name no matter the OS Language\n local_sys = resolve_sid('S-1-5-18')\n system_account_name = \"#{local_sys[:domain]}\\\\#{local_sys[:name]}\"\n\n # Processes that can Blue Screen a host if migrated in to\n dangerous_processes = ['lsass.exe', 'csrss.exe', 'smss.exe']\n\n print_status('Migrating to process owned by SYSTEM')\n session.sys.process.processes.each do |p|\n # Check we are not migrating to a process that can BSOD the host\n next if dangerous_processes.include?(p['name'])\n\n next if p['pid'] == session.sys.process.getpid\n\n next unless p['user'] == system_account_name\n\n print_status(\"Migrating to #{p['name']}\")\n session.core.migrate(p['pid'])\n print_good(\"Successfully migrated to #{p['name']}\")\n return\n end\n end",
"def _Space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_Space unless _tmp\n return _tmp\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def increase_spaces()\n @spaces += 1\n end",
"def reserve_space space\n return if self.last and self.last.id >= space\n\n o = self.new\n o.id= space\n o.save_without_alter_ego\n o.delete\n return\n end",
"def change_space(namespace)\n update!(name: namespace)\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def create\n @spaces_mine = Space.mine(current_user.id)\n raise Space::NotAllowed, '공간 생성 한도를 초과했습니다.' if over_space_limit\n @space = Space.new(space_params.merge(user_id: current_user.id))\n @space.save\n flash.now[:error] = @space.errors.messages[:url] if @space.errors.any?\n broadcast_create_space(@space)\n end",
"def do_space_steps(info)\n old_dt = info.dt\n info.dt = DT\n SUBSTEPS.times do \n fire :update_space, info\n @space_holder.step DT\n end\n info.dt = old_dt\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def o_board_change (num)\n def space_check (space,board_state)\n if board_state.include?(space)\n return true\n else\n puts \"You've entered an invalid space option.\"\n $i -= 1\n return false\n end\n end\n \n puts \" #{num[0]} | #{num[1]} | #{num[2]}\\n-----------\\n #{num[3]} | #{num[4]} | #{num[5]}\\n-----------\\n #{num[6]} | #{num[7]} | #{num[8]}\"\n \n puts \"Player one, please choose a location for your O.\"\n \n o = gets.chomp\n o_int = o.to_i\n \n if space_check(o_int,num) == true\n space_index = num.index(o_int)\n num[space_index] = \"O\"\n $j = 0\n end\n return num\n end",
"def cancel_on_space_change\n $tsapi_on_space_change_block = nil\n TSApi.tsapi_unsetSpaceWillChangeCallback\n end",
"def accept_space(space)\n space.active! if space.accepted? # always true for private_type spaces\n space.save!\n end",
"def update\n \n @space = Space.find(params[:id])\n @space.update(space_params)\n \n if @space.save\n redirect_to @space, notice: 'El Espacio fue actualizado satisfactoriamente'\n else\n render :edit\n end\n \n end",
"def update\n logger.info(params)\n @space = Space.find(params[:id])\n respond_to do |format|\n if @space.update(space_params)\n flash[:info] = \"空间更新成功!\"\n format.html { redirect_to @space }\n format.json { render :show, status: :ok, location: @space }\n else\n format.html { render :edit }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def column_space=(val)\n @column_space = val\n update_xy\n end",
"def update\n group = Group.find(params[:group_id])\n unless @current_user.id == group.user_id\n return render json: { message: \"You are not permitted to perform this operation.\" }, status: :forbidden\n end\n if @space.update(space_params)\n render json: @space, status: :created\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def move_page(num)\n add_actions \"MovePage(#{num})\"\n end",
"def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend",
"def place_x(space)\n \tchoice = to_space_sym(space)\n \t@spaces[choice] = \"X\"\n end",
"def space(space_id)\n return spaces[space_id] if spaces[space_id]\n\n unless (table_record = data_dictionary.table_by_space_id(space_id))\n raise \"Table with space ID #{space_id} not found\"\n end\n\n add_table(table_record[\"NAME\"])\n\n spaces[space_id]\n end",
"def update\n respond_to do |format|\n old_name = @space_type.name\n if @space_type.update(space_type_params)\n @space_type.spaces.each { |s| s.touch }\n format.html { redirect_to @space_type, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n return _tmp\n end",
"def is_valid_space?(state, move, turn)\n board = JSON.parse(state)\n src, dst = move \n \n # Get the piece that is going to be\n # moved \n srcpiece = board[src[0]][src[1]]\n dstpiece = board[dst[0]][dst[1]]\n \n # Make sure the src piece is the\n # same as the turn and the destination\n # is an empty space\n if srcpiece.downcase != turn or dstpiece != ' '\n return false \n end\n\n return true \n end",
"def move_to(new_position)\n if range.include? new_position\n reorder(position, new_position)\n update_column(:position, new_position)\n end\n end",
"def update_space_in_system(slug, body, headers=default_headers)\n @logger.info(\"Updating Space \\\"#{slug}\\\"\")\n put(\"#{@api_url}/spaces/#{slug}\", body, headers)\n end",
"def _space\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\" \")\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"\\t\")\n break if _tmp\n self.pos = _save\n _tmp = apply(:_eol)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_space unless _tmp\n return _tmp\n end",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def rename_tablespace(old_name, new_name)\n execute(\"ALTER TABLESPACE #{quote_tablespace(old_name)} RENAME TO #{quote_tablespace(new_name)};\")\n end",
"def _spaces\n _save = self.pos\n\n _save1 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save1\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save1\n break\n end # end choice\n\n if _tmp\n while true\n \n _save2 = self.pos\n while true # choice\n _tmp = apply(:_space)\n break if _tmp\n self.pos = _save2\n _tmp = apply(:_comment)\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save\n end\n set_failed_rule :_spaces unless _tmp\n return _tmp\n end",
"def unit_move_tb(x,y)\n @tb_event.flash_soft_tb = false if @tb_event\n give_move_command(@tb_event)\n @tb_event.tb_unit.used_action(:move, @tb_event.tb_unit.move)\n @showing_temp_hls = false\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def update\n respond_to do |format|\n if @space.update(space_params)\n format.html { redirect_to @space, notice: 'Space was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def move_to(x, y)\n @x, @y = x, y\n @gui.move_to(x, y)\n self\n end",
"def system_space\n spaces[SYSTEM_SPACE_ID]\n end",
"def move(key, db)\n send_command([:move, key, db], &Boolify)\n end",
"def set_space_cat\n @space_cat = SpaceCat.find(params[:id])\n end",
"def map_space\n Vim.command('imap <Space> <C-R>=DeliminatorSpace()<CR>')\n end",
"def move_home_x\n $status.info_target_x = 0\n execute_command('F11', true, false)\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def space?\n room_type == 'm.space'\n rescue MatrixSdk::MatrixForbiddenError, MatrixSdk::MatrixNotFoundError\n nil\n end",
"def movedeck_to(direction)\r\n @log.debug \"gfx: Move deck to #{direction}\"\r\n model_canvas_gfx = @gfx_res.model_canvas_gfx\r\n \r\n img_coperto = @gfx_res.get_cardsymbolimage_of(:coperto)\r\n #img_opponent_deck = @image_gfx_resource[:card_opp_img]\r\n \r\n x_deck_start = model_canvas_gfx.info[:canvas][:width] - (img_coperto.width + 30)\r\n y_deck_start = 10\r\n if direction == :sud\r\n y_deck_start = (model_canvas_gfx.info[:canvas][:height] - (img_coperto.height)) \r\n end\r\n \r\n model_canvas_gfx.info[:deck_info][:position] = {:x_deck_start => x_deck_start, :y_deck_start => y_deck_start }\r\n \r\n \r\n end",
"def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end",
"def move(y, x)\n Ncurses.wmove(pointer, y, x)\n end",
"def update\n respond_to do |format|\n if @office_space.update(office_space_params)\n format.html { redirect_to @office_space, notice: 'Office space was successfully updated.' }\n format.json { render :show, status: :ok, location: @office_space }\n else\n format.html { render :edit }\n format.json { render json: @office_space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"def update\n @space = Space.find(params[:id])\n \n respond_to do |format|\n if @space.update_attributes(params[:space])\n format.html { redirect_to @space, notice: 'Space was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @space.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @space_form = Space::Form.new(space: @space,\n user: current_user,\n attributes: space_params)\n\n authorize @space, :update?\n\n respond_to do |format|\n if @space_form.save\n format.html { redirect_to space_pages_path(@space_form.space), notice: 'Space was successfully updated.' }\n format.json { render :show, status: :ok, location: @space_form.space }\n else\n format.html { render :edit }\n format.json { render json: @space_form.errors, status: :unprocessable_entity }\n end\n end\n end",
"def swap_with(window)\n server.invoke_command \"swap-window -s #{identifier} -t #{window.identifier}\"\n end",
"def lock_spacetime\n\t\tbroadcast_message :lock_spacetime, {\n\t\t\tid: message[:space_time_id]\n\t\t}\n\tend",
"def make_move(board, display)\n new_pos = nil\n until new_pos\n display.render\n new_pos = display.cursor.get_input\n end\n new_pos\n end",
"def set_parking_space\n @parking_space = ParkingSpace.find(params[:parking_space_id])\n end"
] | [
"0.7483297",
"0.7446562",
"0.7297412",
"0.70637596",
"0.68068033",
"0.65397274",
"0.5806738",
"0.56229657",
"0.55475396",
"0.55475396",
"0.55475396",
"0.55475396",
"0.55475396",
"0.5546392",
"0.5512218",
"0.55027515",
"0.5498527",
"0.5412345",
"0.53761727",
"0.5375988",
"0.5375988",
"0.53446233",
"0.5314851",
"0.531133",
"0.5167805",
"0.5125293",
"0.5125293",
"0.49862427",
"0.49801734",
"0.49729407",
"0.49689373",
"0.49665102",
"0.49585637",
"0.49512276",
"0.4913173",
"0.4910266",
"0.4907894",
"0.483806",
"0.4836355",
"0.48333722",
"0.48266235",
"0.48256308",
"0.48181322",
"0.4816906",
"0.48166224",
"0.48158228",
"0.47997728",
"0.478777",
"0.47841033",
"0.4773526",
"0.47710025",
"0.47613606",
"0.47515565",
"0.47336",
"0.47328785",
"0.47325304",
"0.47321266",
"0.4729809",
"0.47132802",
"0.47118902",
"0.47104168",
"0.4710206",
"0.47081143",
"0.47025698",
"0.46996877",
"0.46889645",
"0.46726125",
"0.4667157",
"0.4666526",
"0.46367997",
"0.46337134",
"0.4613296",
"0.46110487",
"0.46075812",
"0.45846164",
"0.4580359",
"0.4580172",
"0.45801395",
"0.4577683",
"0.45752594",
"0.45628437",
"0.45628002",
"0.4553544",
"0.45513058",
"0.4551099",
"0.45432457",
"0.45420235",
"0.4541472",
"0.45390096",
"0.45316964",
"0.4525035",
"0.45225877",
"0.45200095",
"0.45154202",
"0.45028803",
"0.44970956",
"0.4495629",
"0.44916117",
"0.4487198",
"0.448636"
] | 0.78626525 | 0 |
Set the name for a space on the main display. Note that using this command will cause a layout change notification to be sent if the new name was different from that previously set. The maximum length for a name is 255 bytes. TotalSpaces2.set_name_for_space(1, "Home") | def set_name_for_space(space_number, name)
TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home_name=(n)\n @home_name = n\n end",
"def set_name_for_space_on_display(space_number, name, display_id)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id)\n end",
"def changeName\r\n\t\tcheckSpace\r\n\tend",
"def change_space(namespace)\n update!(name: namespace)\n end",
"def set_name\n @rename_window.text = @info_window.name\n @rename_window.open\n @rename_window.activate\n end",
"def set_name name\n\t\t\t@name = name.gsub \" (#{@addr})\", ''\n\t\tend",
"def new_name(new_name)\n @name = new_name\n end",
"def name=(name)\n raise ArgumentError.new('El nombre deberia conteniar al menos dos palabras') unless name =~ /\\w+\\s+\\w+.*$/\n @name = name\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def name=(name)\n if not name.nil? and name.length != 0\n @name = name\n write_settings\n else\n $stderr.puts \"You must use a full name\"\n end\n end",
"def name=(new_name)\n name_parts = new_name.split(' ')\n\n self.first_name = name_parts.shift.to_s\n self.last_name = name_parts.pop.to_s\n self.middle_name = name_parts.join(' ')\n end",
"def set_name\n @appname = \"Bike London\"\n end",
"def name=(name)\n\t\t@new_name = name\n\tend",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def name= new_name\n @gapi.update! name: String(new_name)\n end",
"def share_name=(new_name)\n @share_edit_args += [ \"-n\", new_name ]\n end",
"def rename_tablespace(old_name, new_name)\n execute(\"ALTER TABLESPACE #{quote_tablespace(old_name)} RENAME TO #{quote_tablespace(new_name)};\")\n end",
"def name=(new_name)\n\t\t@name = new_name\n\tend",
"def smb_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-S\", new_name ]\n end",
"def name=(name)\r\n @name = name.capitalize\r\n end",
"def set_NewName(value)\n set_input(\"NewName\", value)\n end",
"def set_NewName(value)\n set_input(\"NewName\", value)\n end",
"def setName(n)\n @name = n\n end",
"def changeworkspacename\n retrievehome\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def set_name(name)\n\t\tfirst_name, last_name = name.split(/\\s+/)\n\t\tset_first_name(first_name)\n\t\tset_last_name(last_name)\n\tend",
"def middle_name_set(name)\n self.middlename.set name\n end",
"def name= (new_name)\n @name = new_name\n end",
"def set_name\n @name = session[:name]\n if @name.nil?\n @name = session[:name] = Haikunator.haikunate\n end\n end",
"def name=(n)\n @name = n.capitalize\n end",
"def set_name()\n # @name = Prompt for Name\n print \"[#{@colour}] Enter your name: \"\n @name = gets.strip\n\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def set_name(a_name)\n @name = a_name\n end",
"def name=(name)\n @content[pn(:Name)] = name\n end",
"def set_application_name(name)\n __remote_control_command(\"setScApplicationName\", [name,])\n end",
"def set_name(uuid, new_name)\n execute_prlctl('set', uuid, '--name', new_name)\n end",
"def afp_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-A\", new_name ]\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def name=(name)\n tinycache_adapter.write(:name, name)\n client.api.set_room_name(id, name)\n name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def no_space name\n raise \"space is a reserved name\" if name == :space\n name\n end",
"def name_setter(new_name)\n @name = new_name\n end",
"def space=(space)\n #This is a stub, used for indexing\n end",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def name=(name)\n\t\tself.sname = name\n\tend",
"def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end",
"def setSpace(astro)\n\t\tsetRawString.(astro.to_s)\n\tend",
"def set_name(name)\n @name = name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def set_tab(name, namespace = nil)\n tab_stack[namespace || :default] = name\n end",
"def name=(new_name)\n @name = new_name\n end",
"def enter_name(name)\n return @player_name = 'Anonymus' if name.empty?\n\n @player_name = name[0...18]\n end",
"def name=(value)\r\n @name = name\r\n # This Api wasn't added until proj 9.1\r\n if defined?(Api.proj_area_set_name)\r\n Api.proj_area_set_name(self, value)\r\n end\r\n end",
"def name=(name)\n\t\tif name == \"\"\n\t\t\traise \"Name can't be blank!\" # Report an error if the name is blank\n\t\tend\n\t\t@name = name # Store the name in an instance variable\n\tend",
"def ftp_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-F\", new_name ]\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def setSpace(astro)\n\t\tsetRawString(astro.to_s)\n\tend",
"def setSpace(astro)\n\t\tsetRawString(astro.to_s)\n\tend",
"def printSpaces(name,space)\n if name\n name.size.upto (space) do\n print \"\\s\"\n end\n else\n 0.size.upto (space) do\n print \"\\s\"\n end\n end\nend",
"def set_space\n @space = Space.find(params[:id])\n end",
"def name=(value)\n @name = value.to_s.strip\n end",
"def name=(name)\n name = name.to_s.remove_underscores.singularize\n @name = Unit.use_superscript_characters? ? name.with_superscript_characters : name.without_superscript_characters\n end",
"def name=(new_name)\n raise ArgumentError if new_name.nil?\n end",
"def setTargetName(text)\n @targetNameEntry.enterText(text) if not text.nil?\n # press TAB on keyboard to set the target name\n type(waitForObject(@targetNameEntry.symbolicName), \"<Tab>\")\n return self\n end",
"def printSpaces(name,space)\n if name\n print name\n name.size.upto (space) do\n print \"\\s\"\n end\n else\n 0.size.upto (space) do\n print \"\\s\"\n end\n end\nend",
"def name=(new_name)\n if new_name != self.name\n self.old_name = self.name\n self.write_attribute(:name, new_name)\n end\n end",
"def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end",
"def name_with_spaces\n (' ' + self.name + ' ').html_safe\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def name=(new_name)\n @name=new_name\n end",
"def set(name)\n @name = name\n self\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def set_ScreenName1(value)\n set_input(\"ScreenName1\", value)\n end",
"def name=(name)\n\t\t@name = name\n\t\tself\n\tend",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def name= new_name\n @name = new_name\n end",
"def create_name_text\n Text.new(0, @name_window, 0, -Text::Util::FOY, 0, default_line_height, '')\n end",
"def name= new_name\n patch_gapi! name: new_name\n end"
] | [
"0.66215265",
"0.6485476",
"0.6408985",
"0.6023407",
"0.5976263",
"0.59232134",
"0.58171034",
"0.5785348",
"0.5760498",
"0.57510954",
"0.57435024",
"0.5672328",
"0.5667304",
"0.56596595",
"0.56539947",
"0.5625127",
"0.5606262",
"0.55691904",
"0.55521786",
"0.55503356",
"0.555002",
"0.555002",
"0.5546402",
"0.55439276",
"0.55390835",
"0.55390835",
"0.5532586",
"0.5508798",
"0.5479069",
"0.5470315",
"0.54633856",
"0.54627377",
"0.5448329",
"0.5448329",
"0.5448329",
"0.5448329",
"0.5448329",
"0.5448329",
"0.5448329",
"0.5448329",
"0.54473364",
"0.5439797",
"0.5436572",
"0.54363763",
"0.5428987",
"0.5418665",
"0.54128546",
"0.5412672",
"0.5411909",
"0.5411909",
"0.5411909",
"0.54110825",
"0.54110825",
"0.54110825",
"0.54110825",
"0.5408808",
"0.5404186",
"0.5396805",
"0.5387125",
"0.5386947",
"0.537655",
"0.53765285",
"0.5369029",
"0.5358094",
"0.5344732",
"0.5336296",
"0.5336296",
"0.5335756",
"0.5335329",
"0.5333565",
"0.5325618",
"0.5325142",
"0.5316666",
"0.53137356",
"0.53137356",
"0.53137356",
"0.53137356",
"0.53137356",
"0.53137344",
"0.53137344",
"0.53131294",
"0.5312688",
"0.53084177",
"0.5303712",
"0.5303165",
"0.530195",
"0.5277334",
"0.52741075",
"0.5271176",
"0.52640057",
"0.52621907",
"0.5260269",
"0.52396977",
"0.5236445",
"0.52361584",
"0.52351004",
"0.52334684",
"0.52316684",
"0.5224519",
"0.52209824"
] | 0.7430568 | 0 |
Set the name for a space. Note that using this command will cause a layout change notification to be sent if the new name was different from that previously set. The maximum length for a name is 255 bytes. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.set_name_for_space_on_display(1, "Home", display_id) | def set_name_for_space_on_display(space_number, name, display_id)
TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name_for_space(space_number, name)\n TSApi.tsapi_setNameForSpaceOnDisplay(space_number, name, 0)\n end",
"def home_name=(n)\n @home_name = n\n end",
"def changeName\r\n\t\tcheckSpace\r\n\tend",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def name=(display_name)\r\n\t\t\t`#{BITS::BITSADMIN} /setdisplayname {#{@id}} \\\"#{display_name}\\\"`\r\n\t\tend",
"def set_name\n @rename_window.text = @info_window.name\n @rename_window.open\n @rename_window.activate\n end",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end",
"def set_name name\n\t\t\t@name = name.gsub \" (#{@addr})\", ''\n\t\tend",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def change_space(namespace)\n update!(name: namespace)\n end",
"def setName(n)\n @name = n\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_ScreenName(value)\n set_input(\"ScreenName\", value)\n end",
"def set_name\n @appname = \"Bike London\"\n end",
"def set_displayname(path,display_name)\n result = $evm.instance_set_display_name(path, display_name)\n return result\n end",
"def new_name(new_name)\n @name = new_name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_name\n @name = session[:name]\n if @name.nil?\n @name = session[:name] = Haikunator.haikunate\n end\n end",
"def set_ScreenName1(value)\n set_input(\"ScreenName1\", value)\n end",
"def name= new_name\n @gapi.update! name: String(new_name)\n end",
"def name=(new_name)\n name_parts = new_name.split(' ')\n\n self.first_name = name_parts.shift.to_s\n self.last_name = name_parts.pop.to_s\n self.middle_name = name_parts.join(' ')\n end",
"def name=(name)\n raise ArgumentError.new('El nombre deberia conteniar al menos dos palabras') unless name =~ /\\w+\\s+\\w+.*$/\n @name = name\n end",
"def smb_name=(new_name)\n return if new_name == @resource.should(:share_name)\n @share_edit_args += [ \"-S\", new_name ]\n end",
"def name=(name)\n if not name.nil? and name.length != 0\n @name = name\n write_settings\n else\n $stderr.puts \"You must use a full name\"\n end\n end",
"def set_name(uuid, new_name)\n execute_prlctl('set', uuid, '--name', new_name)\n end",
"def middle_name_set(name)\n self.middlename.set name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end",
"def set_Name(value)\n set_input(\"Name\", value)\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def set_NewName(value)\n set_input(\"NewName\", value)\n end",
"def set_NewName(value)\n set_input(\"NewName\", value)\n end",
"def display_name=(str)\n unless str.nil? || str.kind_of?(String)\n raise ArgumentError, 'not a string'\n end\n @display_name = str\n @display_name = nil if @display_name == ''\n end",
"def display_name=(name)\n @display_name ||= name\n end",
"def display_name=(display_name)\n if !display_name.nil? && display_name.to_s.length > 255\n fail ArgumentError, 'invalid value for \"display_name\", the character length must be smaller than or equal to 255.'\n end\n\n @display_name = display_name\n end",
"def display_name=(display_name)\n if !display_name.nil? && display_name.to_s.length > 255\n fail ArgumentError, 'invalid value for \"display_name\", the character length must be smaller than or equal to 255.'\n end\n\n @display_name = display_name\n end",
"def name=(n)\n @name = n.capitalize\n end",
"def share_name=(new_name)\n @share_edit_args += [ \"-n\", new_name ]\n end",
"def changeworkspacename\n retrievehome\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end",
"def display_name=(value)\n @display_name = value\n end"
] | [
"0.7669021",
"0.6507637",
"0.6115902",
"0.6037224",
"0.6016562",
"0.60126317",
"0.5878414",
"0.5840199",
"0.58168834",
"0.57529753",
"0.57074565",
"0.5701779",
"0.5652545",
"0.5632509",
"0.5632509",
"0.5632509",
"0.5632509",
"0.5632509",
"0.5631495",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5623806",
"0.5622957",
"0.5622957",
"0.5622957",
"0.5622409",
"0.5622409",
"0.5622409",
"0.5622409",
"0.5622409",
"0.5622409",
"0.56073946",
"0.5591238",
"0.55758107",
"0.55728954",
"0.55728954",
"0.55728954",
"0.55728954",
"0.55728954",
"0.55728954",
"0.55728954",
"0.55728954",
"0.5572229",
"0.5567902",
"0.5556325",
"0.55558896",
"0.55547655",
"0.5547223",
"0.55455",
"0.5535666",
"0.5512552",
"0.55119336",
"0.55107766",
"0.55107766",
"0.55107766",
"0.55100715",
"0.55100715",
"0.55100715",
"0.55100715",
"0.55081236",
"0.5495877",
"0.54879963",
"0.54806185",
"0.54806185",
"0.5470596",
"0.54696554",
"0.54623306",
"0.54623306",
"0.54613143",
"0.5460659",
"0.545456",
"0.5454533",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582",
"0.5443582"
] | 0.7571915 | 1 |
Cancel the on_space_change notification. | def cancel_on_space_change
$tsapi_on_space_change_block = nil
TSApi.tsapi_unsetSpaceWillChangeCallback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def destroy\n raise User::NotAuthorized, '삭제할 권한이 없습니다.' unless @space.updatable_by?(current_user)\n @space.destroy\n\n broadcast_delete_space(@space)\n end",
"def on_cancel\n\n doc = fetch(fei)\n\n return unless doc\n\n r = @context.storage.delete(doc)\n\n on_cancel(fei, flavour) if r != nil\n end",
"def cancel\n self.class.cancel(self)\n end",
"def cancel\n end",
"def cancel\n end",
"def cancel\n super\n end",
"def cancel\n super\nend",
"def cancel; end",
"def cancel; end",
"def cancel!\n @callback = nil\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n state_change(:cancel) if transition.trigger?(:cancel)\n add_cancel_notifications\n run\n clear_state_notifications\n end",
"def cancel\n super\n end",
"def cancel\n # clear the Gtk::Entry\n @search_entry.set_text(\"\")\n\n # Colorize the Gtk::Entry\n state(CLEAR)\n\n # Refresh the modules treeview\n $gtk2driver.module_tree.refresh\n\n # Register the current state\n @@state = CLEAR\n end",
"def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel!; end",
"def onCancel(flag, view)\n self.reset(view)\n end",
"def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end",
"def cancel_command()\n @command_window.active = true\n @party_order_window.clean_indexes()\n @party_order_window.active = false\n @party_order_window.index = -1\n @battle_formations_window.active = false\n @battle_formation_details_window.window_update(nil)\n @battle_formation_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end",
"def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end",
"def cancel_command()\n @command_window.active = true\n @optimize_modes_window_headers.visible = false\n @optimize_modes_window.active = false\n @optimize_modes_window.visible = false\n @status_window.window_update(nil, nil)\n @status_window.active = false\n @status_window.visible = false\n @remove = false\n @equip_window.active = false\n @equip_details_window.window_update(nil)\n @equip_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end",
"def cancel_attack\n @windows[Win_Status].clear_dmg_preview\n @cursor.active = true \n end",
"def cancel!\n\t\t\t\t# The simplest way to keep track of cancelled status is to nullify the\n\t\t\t\t# callback. This should also be optimal for garbage collection.\n\t\t\t\t@callback = nil\n\t\t\tend",
"def cancel_skill \n @windows[Win_Confirm].reset_commands \n @cursor.active = true\n end",
"def cancel()\n @callback = nil\n @cancelled = true\n end",
"def cancel\n # Context is already cleared in before_action\n end",
"def cancel_command()\n @command_window.active = true\n end",
"def cancel!\n # Context is already cleared in action_for_message\n end",
"def cancel_on_layout_change\n $tsapi_on_layout_change_block = nil\n TSApi.tsapi_unsetLayoutChangedCallback\n end",
"def on_cancel_select\n @tb_item = nil\n $game_temp.tb_item = nil\n move_pos_off\n end",
"def cancel\n @error = :cancelled\n end",
"def cancel_batch\n @batch = nil\n end",
"def cancel!\n # The simplest way to keep track of cancelled status is to nullify the\n # callback. This should also be optimal for garbage collection.\n @callback = nil\n end",
"def cancel\n self.update_status :cancelled\n end",
"def onCancel(flag, view)\n self.reset(view)\nend",
"def cancel_event(msg = nil)\n raise CallbackError.new(msg)\n end",
"def on_item_cancel; item_cancel(@item_window, @category_window); end",
"def cancel\n # Define this later\n end",
"def number_cancel_command_input\r\n # Branch by command window cursor position\r\n case @command_window.command\r\n when SDK::Scene_Commands::Scene_Shop::Buy # buy\r\n # Change windows to buy mode\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n when SDK::Scene_Commands::Scene_Shop::Sell # sell\r\n # Change windows to sell mode\r\n @sell_window.active = true\r\n @sell_window.visible = true\r\n @status_window.visible = false\r\n end\r\n end",
"def cancel_notification\n # \"Silent\" notifications are things like an agent's action queue\n # being empty so it cancels its intention. These are normal\n # operation and nobody is likely to need notification every\n # tick that they didn't ask to do anything so they didn't.\n return if @cancelled_info && @cancelled_info[\"silent\"]\n item = @engine.item_by_name(@name)\n @engine.send_notification({ reason: @cancelled_reason, by: @cancelled_by, id: @intention_id, intention_type: self.class.to_s },\n type: Demiurge::Notifications::IntentionCancelled, zone: item.zone_name, location: item.location_name, actor: item.name,\n include_context: true)\n end",
"def kill\n stop_propagation\n prevent_default\n end",
"def disposing(ev)\n end",
"def cancel\n @active = false\n\t\t\[email protected]_sorted self\n end",
"def cancel!\n self.service.deleteObject()\n end",
"def cancel!\n self.service.deleteObject()\n end",
"def cancel_reservations_in_my_range\n \tself.conflicts.each { |o| o.cancel }\t\n\tend",
"def on_delete(_event)\n self.tabcount = 0\n update_only if update_on_change\n end",
"def cancel_callback\n Interface::midiin_cancel_callback(@midiin)\n end",
"def decrease_spaces()\n @spaces -= 1\n end",
"def cancel\n @order.cancel\n render_update @order\n end",
"def abort_current_edit\n ensure_active_edit!\n\n call_google_api { android_publisher.delete_edit(current_package_name, current_edit.id) }\n\n self.current_edit = nil\n self.current_package_name = nil\n end",
"def on_item_cancel2; item_cancel(@item_window2, @category_window2); end",
"def cancel\n @observer.cancel if @observer\n if @is_leader\n @timer.cancel\n @is_leader = false\n @client.delete(@path)\n end\n return\n end",
"def terminate\n result = Cybersource.unstore(\";#{subscription_id}\",:order_id => \"#{order_id}\")\n if result.success == true\n self.update_attributes({:state => \"delete\", :note => \"User Requested Deletion\"})\n end\n end",
"def cancelTimer\n self.log(\"Globaler Timer wurde abgebrochen\")\n if Global.timer\n Global.timer.invalidate\n Global.timer = nil\n Global.timer_path = nil\n Global.timer_slot = nil\n end\n end",
"def cancel\n @queue.each {|action|\n action.stop\n }\n @queue.clear\n unless @current_action == nil\n @current_action.stop\n @current_action = nil\n end\n end",
"def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend",
"def process_cancel\n Sound.play_cancel\n Input.update\n deactivate if @symbol.nil?\n @symbol = nil\n call_cancel_handler\n end",
"def cancel\n return unless @running\n @running = false\n end",
"def cancel\n set_params\n show_translation\n end",
"def cancel_current_tuple_entry\n current_tuple_entry.cancel if current_tuple_entry\n end",
"def after_cancel\n AdminMailer.cancel_notification(self).deliver\n self.update_attributes(:batch_id => nil)\n self.event.find_empty_batch.waitlist_allocation\n end",
"def cancel\n @timers.cancel self\n end",
"def cancel\n @timers.cancel self\n end",
"def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end",
"def cancel\n self.break_condition = 1\n end",
"def Abort\n Popup.ReallyAbort(GetModified())\n end",
"def cancel(*args)\n commit('cancel', *args)\n end",
"def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end",
"def handle_cancel_pressed(room, events)\n if room.next_start && room.next_end && room.next_start < Time.now && room.next_end > Time.now\n cur_event = events.find{|event| event.start_time == room.next_start && event.title == room.next_desc}\n if cur_event\n puts \"Room #{room.room_name}: Cancelling current reso\"\n cur_event.delete\n events.delete(cur_event)\n #TODO may wish to delete the event for all attendees as well\n else\n #TODO Unexpected Error\n puts \"Room #{room.room_name}: Couldn't find event #{room.next_desc} at #{room.next_start} reserved by #{room.next_reserved_by}\"\n end\n else\n #TODO Unexpected Error\n puts \"Room #{room.room_name}: No event to cancel. Shouldn't have gotten to this point.\"\n end\n end",
"def cancel\n\n get_expression_pool.cancel(@children[0]) if @applied_workitem\n\n unschedule_timeout(nil)\n\n trigger_on_cancel # if any\n\n #super\n @applied_workitem\n end",
"def cancel!\n update(request_cancelled: true)\n end",
"def unlock_spacetime\n\t\tbroadcast_message :unlock_spacetime, {\n\t\t\tid: message[:space_time_id]\n\t\t}\n\tend",
"def discard!\n update!(adjustment: 0)\n end",
"def cancel_command()\n # Switch Window\n @list_window.active = true\n @list_window.visible = true\n @content_window.active = false\n end",
"def cancel(billing_key)\n raise MethodNotImplemented\n end",
"def cancel\n # send the INT signal to all children\n Process.kill(\"INT\", -pid)\n end",
"def on_gold_cancel\n Sound.play_cancel\n if @storage_category == false && @storage_gold == true\n @command_window.activate\n else\n start_category_selection\n end\n @gold_window.hide\n end",
"def cancel()\n if current_user.state == 'requesting'\n current_user.change_state('online')\n else\n # Notify student that he is not in requesting state\n msg = I18n.t('students.errors.appointment.cancel')\n MessageBroadcastJob.perform_later(msg, 'error',\n student_id: current_user.id)\n end\n end"
] | [
"0.5200666",
"0.5200666",
"0.5200666",
"0.51932776",
"0.51841074",
"0.5148234",
"0.5112529",
"0.5112529",
"0.510946",
"0.50615185",
"0.5046747",
"0.5046747",
"0.5046178",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.5045477",
"0.504012",
"0.50388885",
"0.5034678",
"0.49954078",
"0.49696437",
"0.49696437",
"0.49518105",
"0.49418116",
"0.4895317",
"0.4890432",
"0.48866633",
"0.48800755",
"0.487411",
"0.4864358",
"0.48634717",
"0.4860466",
"0.48594195",
"0.48565638",
"0.4850726",
"0.48344442",
"0.4834142",
"0.48326856",
"0.48316598",
"0.47936806",
"0.47804174",
"0.476545",
"0.47515675",
"0.47456163",
"0.47440246",
"0.4724427",
"0.4718171",
"0.46993965",
"0.46915784",
"0.46844476",
"0.46799925",
"0.46799925",
"0.46799678",
"0.4677075",
"0.46734348",
"0.46655488",
"0.4656387",
"0.46561846",
"0.46507636",
"0.46496212",
"0.4643936",
"0.46352646",
"0.46339664",
"0.4631791",
"0.46203774",
"0.4618438",
"0.46143633",
"0.46115026",
"0.45868662",
"0.45819756",
"0.45753834",
"0.45742744",
"0.4572411",
"0.45713335",
"0.45712262",
"0.4564745",
"0.45632908",
"0.4561253",
"0.45582187",
"0.45578063",
"0.45565438",
"0.45538083",
"0.45532396",
"0.45490798",
"0.45466456",
"0.4514689"
] | 0.845955 | 0 |
Cancel the layout change notification | def cancel_on_layout_change
$tsapi_on_layout_change_block = nil
TSApi.tsapi_unsetLayoutChangedCallback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onCancel(flag, view)\n self.reset(view)\n end",
"def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end",
"def onCancel(flag, view)\n self.reset(view)\nend",
"def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend",
"def uninstall\n self.installed_view.removeConstraint(self.layout_constraint)\n self.layout_constraint = nil\n self.installed_view = nil\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def ignore_layout(&block)\n @ignore_layout = block\n end",
"def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end",
"def cancel_command()\n @command_window.active = true\n @optimize_modes_window_headers.visible = false\n @optimize_modes_window.active = false\n @optimize_modes_window.visible = false\n @status_window.window_update(nil, nil)\n @status_window.active = false\n @status_window.visible = false\n @remove = false\n @equip_window.active = false\n @equip_details_window.window_update(nil)\n @equip_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end",
"def on_category_cancel\n @command_window.activate\n #@dummy_window.show\n @category_window.hide\n @sell_window.hide\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def Abort\n Popup.ReallyAbort(GetModified())\n end",
"def cancel_command()\n # Switch Window\n @list_window.active = true\n @list_window.visible = true\n @content_window.active = false\n end",
"def cancel\n super\nend",
"def cancel_button_clicked\n\t\t\t@path = nil\n\t\t\tclose_and_cleanup\n\t\tend",
"def buttonCancel__clicked(*a)\n @builder[:window1].destroy\n end",
"def on_item_cancel; item_cancel(@item_window, @category_window); end",
"def cancel_command()\n @command_window.active = true\n @party_order_window.clean_indexes()\n @party_order_window.active = false\n @party_order_window.index = -1\n @battle_formations_window.active = false\n @battle_formation_details_window.window_update(nil)\n @battle_formation_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = true\n end",
"def set_layout_to_none\n options[:layout] = false\n end",
"def cancel\n state_change(:cancel) if transition.trigger?(:cancel)\n add_cancel_notifications\n run\n clear_state_notifications\n end",
"def cancel\n # clear the Gtk::Entry\n @search_entry.set_text(\"\")\n\n # Colorize the Gtk::Entry\n state(CLEAR)\n\n # Refresh the modules treeview\n $gtk2driver.module_tree.refresh\n\n # Register the current state\n @@state = CLEAR\n end",
"def ListView_CancelEditLabel(hwnd) send_listview_message(hwnd, :CANCELEDITLABEL) end",
"def cancel_frame\n end",
"def exempt_from_layout?\n false\n end",
"def on_item_cancel2; item_cancel(@item_window2, @category_window2); end",
"def cancel\n self.class.cancel(self)\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def on_workflow_cancel\n restore_status\n end",
"def destroy\n @layout = Layout.with_permissions_to(:destroy).find(params[:id])\n @layout.destroy\n\n respond_to do |format|\n format.html { redirect_to(layouts_url) }\n format.xml { head :ok }\n end\n end",
"def disable_layout\n facet_params[:modal] == 'on' ? {layout: false} : {}\n end",
"def cancel\n end",
"def cancel\n end",
"def destroy\n @widget_layout = WidgetLayout.find(params[:id])\n @widget_layout.destroy\n respond_to do |format|\n format.html { redirect_to(widget_layouts_url) }\n format.xml { head :ok }\n end\n end",
"def cancel\n # Define this later\n end",
"def on_uio_cancel\n @unit_list_swap_items.hide\n @basic_text_win.hide\n deactivate_all_but(@place_coms)\n @place_coms.activate\n @place_coms.show\n end",
"def disown(w)\n super(w)\n DOM.changeToStaticPositioning(w.getElement)\n end",
"def on_window1_destroy\n\t\tdestroy_window\n\tend",
"def dispose\n @skillbar.dispose_layout\n super\n end",
"def setNoLayout(value)\n @fields['no_layout'] = value\n self\n end",
"def cancel; end",
"def cancel; end",
"def cancel\n set_params\n show_translation\n end",
"def reset_window\n end",
"def cancel_command()\n @command_window.active = true\n end",
"def handle_external_workflow_execution_cancel_requested(event)\n # NOOP\n end",
"def no_layout?; end",
"def on_pou_cancel\n @unit_list_swap_items.show\n @unit_list_swap_items.select(0)\n deactivate_all_but(@unit_list_swap_items)\n @unit_list_swap_items.activate\n @unit_list_swap_items.refresh\n @basic_text_win.show\n @party_or_unit_win.hide\n end",
"def after_cancel\n AdminMailer.cancel_notification(self).deliver\n self.update_attributes(:batch_id => nil)\n self.event.find_empty_batch.waitlist_allocation\n end",
"def default_layout\n @user = User.current\n # remove block in all groups\n @user.pref[:my_page_layout] = nil\n @user.pref.save\n redirect_to :action => 'page_layout'\n end",
"def cancel_command()\n @command_window.active = true\n @command_window.visible = true\n @buy_window.active = false\n @buy_window.visible = false\n @buy_window.reset_number_select()\n @buy_window.index = 0\n @sell_window.active = false\n @sell_window.visible = false\n @sell_window.reset_number_select()\n @sell_window.index = 0\n @status_window.visible = false\n @status_window.window_item_update(nil)\n @item_details_window.window_update(nil)\n @item_details_window.visible = false\n @help_window.window_update(\"\")\n @help_window.visible = false\n @transaction_window.visible = false\n @transaction_window.window_update(nil, nil)\n end",
"def cancel_current_tuple_entry\n current_tuple_entry.cancel if current_tuple_entry\n end",
"def leave_handler(view, event)\n hide_me()\n end",
"def cancel_todo todo_content\n switch_to_man_frame \n sleep 2\n cancel_todo_data_list todo_content\n sleep 2\n switch_out_frame\n end",
"def cancel_on_space_change\n $tsapi_on_space_change_block = nil\n TSApi.tsapi_unsetSpaceWillChangeCallback\n end",
"def cancel\n # Context is already cleared in before_action\n end",
"def cancel\n self.update_status :cancelled\n end",
"def cancel\n self.model = nil\n page._new_article = false\n end",
"def set_layout\n @layoutme = 1\n end",
"def layout=(value)\n return if @default_layout == value && @layout == value\n @default_layout = value\n @layout = value\n refresh\n end",
"def forget(element_id)\n unless is_parent_layout?\n return parent_layout.remove(element_id)\n end\n removed = nil\n context(self.view) do\n removed = all(element_id)\n @elements[element_id] = nil\n end\n removed\n end",
"def on_buy_cancel\n @command_window.activate\n #@dummy_window.show\n @buy_window.hide\n @status_window.hide\n @status_window.item = nil\n @help_window.clear\n end",
"def cancel_btn\n\t\ttouch(\"* id:'action_bar_up_navigation'\")\n\t\twait_for_animate_3sec\n\t\t#wait_for_elements_exist(\"* id:'PopoverDismissRegion'\")\n\t\t# touch \"* id:'PopoverDismissRegion'\"\n\tend",
"def command_cancel\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(5)\r\n end",
"def cancel!\n @callback = nil\n end",
"def remove_component()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.LayoutEditor_remove_component(@handle.ptr)\n end",
"def alert_close\n MenuControllerContracts.invariant(self)\n @alert_view = nil\n MenuControllerContracts.invariant(self)\n end",
"def cancel!; end",
"def reset_layout layout\n @layout = layout # 2010-02-13 22:23 \n @height = layout[:height]\n @width = layout[:width]\n @top = layout[:top]\n @left = layout[:left]\n end",
"def visual_block_clear\n if @visual_block_start\n star = [@visual_block_start, @cursor].min\n fin = [@visual_block_start, @cursor].max\n remove_from_selection @view[star..fin]\n end\n @visual_block_start = nil\n @toggles[:visual_mode] = @visual_mode = false\n @mode = nil if @mode == 'VIS'\n # is this the right place to put this ??? 2019-04-16 -\n clean_selected_files\nend",
"def _implied_layout_name; end",
"def suppress_recreate\n self.suppress_recreate_trigger = true\n end",
"def cancel!\n # Context is already cleared in action_for_message\n end",
"def show_reminder\n render :layout => false\n end",
"def cancel\n self.break_condition = 1\n end",
"def kopal_layout_before_body_close\n\n end",
"def unconfigure\n root_notifier.unconfigure\n end",
"def destroy\n @maker_layout.destroy\n respond_to do |format|\n format.html { redirect_to maker_layouts_url, notice: 'Maker layout was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_layout = PageLayout.find(params[:id])\n @page_layout.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_layouts_url) }\n format.xml { head :ok }\n end\n end",
"def on_btn_Cancel_clicked(widget)\n @db.close unless @db.nil?\n Gtk.main_quit\n end"
] | [
"0.6553298",
"0.6476466",
"0.6429745",
"0.61539626",
"0.57015985",
"0.5637399",
"0.5637399",
"0.5637399",
"0.56311345",
"0.56242657",
"0.5615695",
"0.5611285",
"0.5603243",
"0.559045",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55856735",
"0.55507386",
"0.5533674",
"0.54590183",
"0.5453379",
"0.53820944",
"0.53789365",
"0.5343579",
"0.53291684",
"0.5324873",
"0.5309706",
"0.52802104",
"0.5270505",
"0.5262459",
"0.5254608",
"0.5248915",
"0.5233875",
"0.5233875",
"0.5233621",
"0.5224206",
"0.5222282",
"0.5220759",
"0.5220759",
"0.52003807",
"0.5181624",
"0.51542586",
"0.51521355",
"0.5138006",
"0.5132204",
"0.5131119",
"0.51279336",
"0.51279336",
"0.5127477",
"0.5125446",
"0.5122734",
"0.50856894",
"0.5085574",
"0.5075895",
"0.5040939",
"0.50386095",
"0.50122154",
"0.5004637",
"0.49953508",
"0.4984372",
"0.49765292",
"0.49751937",
"0.4974882",
"0.49632356",
"0.4962065",
"0.49342367",
"0.49330938",
"0.4924548",
"0.49230593",
"0.49065095",
"0.48906556",
"0.48649168",
"0.4862913",
"0.48574844",
"0.48386395",
"0.48305106",
"0.48101354",
"0.48069093",
"0.4797064",
"0.47928038",
"0.47903377",
"0.47844166",
"0.4779238",
"0.4775075",
"0.47615305",
"0.47603074"
] | 0.800208 | 0 |
Move a window to a given space The window_id parameter must be fetched using window_list. Returns false if the space_number or window_id is invalid. | def move_window_to_space(window_id, space_number)
TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res = server.invoke_command(\"move-window -s #{identifier} -t #{target}\")\n if res =~ /^can't move window: index in use: \\d+/\n raise IndexInUse, [new_session, new_number]\n end\n @session = new_session\n @number = new_number\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def move(x, y)\n start_time = Time.now\n xdotool \"windowmove #{@id} #{x} #{y}\"\n # Inconsistencies exist between xwininfo and xdotool.\n # \"xdotool windowmove\" is local to the selected monitor, not reflecting the\n # true coordinates of the X session. Using the screen geometry determined,\n # we can get around this.\n while [x+$screen_geometry[0][0], y+$screen_geometry[0][1]] != get_position(@id)\n puts \"#{get_position(@id)}\"\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not react - are you running a tiling window manager? Exiting...\") if Time.now - start_time > 2\n end\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def move_first_window_or_create_new(window)\n if window == windows.first\n move_window(window.index)\n else\n new_window(window)\n end\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def switch_window(new_window, coords: {})\n @window = new_window\n move(coords[:y], coords[:x]) unless coords.empty?\n end",
"def is_valid_space?(state, move, turn)\n board = JSON.parse(state)\n src, dst = move \n \n # Get the piece that is going to be\n # moved \n srcpiece = board[src[0]][src[1]]\n dstpiece = board[dst[0]][dst[1]]\n \n # Make sure the src piece is the\n # same as the turn and the destination\n # is an empty space\n if srcpiece.downcase != turn or dstpiece != ' '\n return false \n end\n\n return true \n end",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def window_exist?(id)\n raise WindowError, \"Window #{id} doesn't exist\" unless @windows.key?(id)\n\n true\n end",
"def remove_window(id)\n window_exist?(id)\n @windows.delete(id)\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def move\n return false if @position.nil?\n \n movements = { north: { x: 0, y: 1 }, east: { x: 1, y: 0 }, south: { x: 0, y: -1 }, west: { x: -1, y: 0 } }\n position, movement = @position, movements[@direction]\n\n return false unless valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n \n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n true\n end",
"def swap_with(window)\n server.invoke_command \"swap-window -s #{identifier} -t #{window.identifier}\"\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def switch_window\n current_window = window\n wins = windows\n wait_until { (wins = windows) && wins.size > 1 } if wins.size == 1\n raise StandardError, 'Unable to determine which window to switch to' if wins.size > 2\n\n wins.find { |w| w != current_window }.use\n window\n end",
"def move(key, db)\n send_command([:move, key, db], &Boolify)\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def move_to(id, x, y, w=false, no_t = false)\n RME::deprecated_command(\"move_to\", \"use 'event_move_to' or 'player_move_to'\")\n event(id).move_to_position(x, y, w, no_t)\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def move_window_to(point_x, point_y)\n driver.manage.window.move_to(point_x, point_y)\n end",
"def move_valid_for?(player_id)\n return false if last_player_id == player_id\n\n true\n end",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1}\n when :east\n movement = { x: 1, y: 0}\n when :south\n movement = { x: 0, y: -1}\n when :west\n movement = { x: -1, y: 0}\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1 }\n when :east\n movement = { x: 1, y: 0 }\n when :south\n movement = { x: 0, y: -1 }\n when :west\n movement = { x: -1, y: 0 }\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n # binding.pry\n # input.to_i.between?(1, 9) && position(input) == \" \"\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def move!(move = {})\n raise GameNotStarted, 'this game is not running' unless started?\n\n raise InvalidPlayerMove, 'this player is not authorized for this move' unless move_valid_for?(current_mover.id)\n\n if board.move!(move.fetch(:y_axis).to_i, move.fetch(:x_axis).to_i, current_mover.id)\n move.merge!(player_id: current_mover.id)\n self.board.moves.create!(move)\n\n update_columns({last_player_id: current_mover.id})\n else\n return false\n end\n\n # checking out for possible result!\n game_over?\n\n true\n end",
"def test_moveTo_Inside_Right\n w = Window_Base.new(740, 100, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(300, 100)\n return true\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def set_window\n @window = Window.find(params[:id])\n end",
"def set_window\n @window = Window.find(params[:id])\n end",
"def switch_to_window(loc)\n if loc[0..3] == 'url=' or loc[0..5] == 'title='\n @browser.window(parse_location(loc)).use\n else\n # assume loc is an integer\n # since Robot Framework sends all args as text, the above check for\n # \"url=\" and \"title=\" is the best we can do to ensure argument correctness\n loc = loc.to_i\n # the number of the window\n # user-facing numbers are 1-based, internal we use 0-based because @browser.windows\n # is a Ruby array, so minus 1\n @window_id = loc - 1\n if @window_id == -1\n # either the user has been too smart for his/her own good and thinks the windows are 0-based,\n # or they've entered text that doesn't match 'url=' or 'title=', in which case\n # the above loc.to_i will make loc equal 0\n raise(ArgumentError, \"You must provide the url or title of the window in the format 'url=' or 'title=', or you must provide the number of the window, starting with 1 for the first window opened.\")\n end\n # this will throw its own error if the index is out of range\n @browser.windows[loc].use\n end\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def move(to,board)\n if self.legal?(to,board)\n @coords = to\n @moved = true\n else\n return false\n end\n end",
"def valid_move?(move)\n move = move.to_i if move.is_a? String\n return false unless move.is_a? Integer\n move.between?(1, 9) && !position_taken?(move-1) \n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def add_window(id, x, y, width, height, **args)\n raise WindowError, \"Window #{id} already exists\" if @windows.key?(id)\n\n @windows[id] = Window.new(self, id, x, y, width, height, **args)\n end",
"def position_taken?(board, space)\n\tif (board[space] == \"\") || (board[space] == \" \") || (board[space] == nil)\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def duplicate_space(space, source_space_id)\n return if source_space_id.nil?\n\n source_space = Space.find(source_space_id)\n\n space_copier = CopyService::SpaceCopier.new(api: api, user: user)\n space_copier.copy(space, source_space)\n end",
"def move_browser(x_position, y_position)\n x_position ? x_position : x_position = 0\n y_position ? y_position : y_position = 0\n\n @log.info('Moving the browser to: ' + x_position.to_s + ', ' + y_position.to_s)\n @driver.manage.window.move_to(x_position, y_position)\n end",
"def move_browser(x_position, y_position)\n x_position ? x_position : x_position = 0\n y_position ? y_position : y_position = 0\n\n @log.info('Moving the browser to: ' + x_position.to_s + ', ' + y_position.to_s)\n @driver.manage.window.move_to(x_position, y_position)\n end",
"def move(x, y, width = -1, height = -1)\n Window.functions[__method__] ||= AU3_Function.new(\"WinMove\", 'SSLLLL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, x, y, width, height)\n nil\n end",
"def mvwin(y, x)\n Ncurses.mvwin(pointer, y, x)\n end",
"def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def update\n if @window.update(window_params)\n redirect_to @window, notice: 'Window was successfully updated.'\n else\n render :edit\n end\n end",
"def move\n @dungeon.set_next_room( params[:direction].to_sym)\n if @dungeon_instance.update(dungeon_data: @dungeon.to_json)\n redirect_to dungeon_instance_play_path( @dungeon_instance )\n end\n end",
"def move_piece(start, dest)\n\n determine_moves(start)\n\n #puts \"dest movem valid?: #{@spaces[start].moveset.include?(dest)}\"\n\n #puts \"dest atack valid?: #{@spaces[start].attackset.include?(dest)}\"\n return false if @spaces[start].color != @player || \n @spaces[start].moveset.include?(dest).! and @spaces[start].attackset.include?(dest).!\n\n #TODO #return false if in_check\n\n @spaces[dest] = @spaces[start]\n\n @spaces[dest].location = dest\n\n @spaces[start] = nil\n\n return true\n\n end",
"def test_moveTo_Outside_Right\n w = Window_Base.new(300, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(740, 150)\n return true\n end",
"def valid_move?(position)\n if is_number?(position)\n if position.to_i.between?(0, 10)\n if position_taken?(position.to_i-1)\n false\n else\n true\n end\n else \n false\n end\n else\n false\n end\n end",
"def switch_to_other_window\n @window_id = (@window_id - 1).abs\n if @window_id != 0 and @window_id !=1\n puts @window_id\n raise(Exception::WindowMatchError, \"You cannot use this keyword when more than 2 windows are open; you must use 'Switch To Window', 'Switch to Next Window', or 'Switch to Previous Window'\")\n end\n\n @browser.windows[@window_id].use\n end",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def move(xplace, yplace, relative, refresh_flag)\n current_x = @win.getbegx\n current_y = @win.getbegy\n xpos = xplace\n ypos = yplace\n\n # If this is a relative move, then we will adjust where we want\n # to move to.\n if relative\n xpos = @win.getbegx + xplace\n ypos = @win.getbegy + yplace\n end\n\n # Adjust the window if we need to.\n xtmp = [xpos]\n ytmp = [ypos]\n CDK.alignxy(@screen.window, xtmp, ytmp, @box_width, @box_height)\n xpos = xtmp[0]\n ypos = ytmp[0]\n\n # Get the difference\n xdiff = current_x - xpos\n ydiff = current_y - ypos\n\n # Move the window to the new location.\n CDK.moveCursesWindow(@win, -xdiff, -ydiff)\n CDK.moveCursesWindow(@shadow_win, -xdiff, -ydiff)\n\n # Thouch the windows so they 'move'.\n CDK::SCREEN.refreshCDKWindow(@screen.window)\n\n # Redraw the window, if they asked for it.\n if refresh_flag\n self.draw(@box)\n end\n end",
"def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end",
"def valid_move?(input)\n return false if input.to_i < 1 || input.to_i > 9\n taken?(input) == false\n end",
"def castle_move\r\n return false if @sx.abs != 2\r\n # If the king is moving two spaces to the left:\r\n if @x1 < @x0\r\n @target_rook = game.pieces.where(x_position: 1, y_position: @y0).first\r\n # If the king is moving two spaces to the right:\r\n else\r\n @target_rook = game.pieces.where(x_position: 8, y_position: @y0).first\r\n end\r\n return false if @target_rook.nil?\r\n # Neither the king nor the rook have moved:\r\n return false if !first_move? || !@target_rook.first_move?\r\n # Move the rook to the other side of the moved king:\r\n if @target_rook.x_position == 1\r\n @target_rook.update_attributes(x_position: 4)\r\n Move.create(game_id: game.id, piece_id: @target_rook.id, move_count: 1, old_x: 1, new_x: 4, old_y: @y0, new_y: @y0)\r\n else\r\n @target_rook.update_attributes(x_position: 6)\r\n Move.create(game_id: game.id, piece_id: @target_rook.id, move_count: 1, old_x: 8, new_x: 6, old_y: @y0, new_y: @y0)\r\n end\r\n true\r\n end",
"def space(space_id)\n return spaces[space_id] if spaces[space_id]\n\n unless (table_record = data_dictionary.table_by_space_id(space_id))\n raise \"Table with space ID #{space_id} not found\"\n end\n\n add_table(table_record[\"NAME\"])\n\n spaces[space_id]\n end",
"def move(to, reason = nil, movetalk = true, noredirect = nil) \n #require login\n @site.login\n result = @site.query_prop_info(@normtitle, nil, 'move') \n token = result['query']['pages']['page']['movetoken']\n result = @site.move(@normtitle, nil, to, token, reason, movetalk, nil, noredirect)\n if result.key?('error')\n raise RbmediawikiError, \"#{title}: \"+result['error']['code']\n else\n return true\n end\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def spritesheet_move?(id)\n spritesheets[id].move?\n end",
"def valid_move?(board, position)\n if position.between?(0,9) && board[position] == \" \"\n return true\n end\nend",
"def test_moveTo_Outside_Left\n w = Window_Base.new(0, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(-100, 150)\n return true\n end",
"def winning_move\n win_combo = WIN_COMBINATIONS.find do |combo|\n (@board.cells[combo[0]] == @token && @board.cells[combo[1]] == @token && @board.cells[combo[2]] == \" \") || (@board.cells[combo[0]] == @token && @board.cells[combo[2]] == @token && @board.cells[combo[1]] == \" \") || (@board.cells[combo[1]] == @token && @board.cells[combo[2]] == @token && @board.cells[combo[0]] == \" \")\n end\n if win_combo != nil\n win_cell = win_combo.find do |spot|\n @board.cells[spot] == \" \"\n end\n end\n end",
"def move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end",
"def move_to(dest_file)\n\t\treturn false if !exist?\n\t\t\n\t\treturn false if !dest_file.path.create_structure\n\n\t\treturn false if !FileManager.move(@path,dest_file.path)\n\n\t\treturn true\n\tend",
"def valid_move?(location)\n location.to_i.between?(1,9) && !taken?(location)\n end",
"def is_winning_move_for?(color, column)\n copy_grid = Marshal.load( Marshal.dump(self) ) #deep copy\n copy_grid.drop_in_column(color, column)\n copy_grid.winning_state?\n end",
"def make_move(symbol, row, column)\n if(symbol != @@X_SYMBOL && symbol != @@O_SYMBOL)\n raise ArgumentError, \"symbol must either be an X or an O\"\n end\n\n if(@board[row][column] != @@X_SYMBOL && @board[row][column] != @@O_SYMBOL)\n @board[row][column] = symbol\n return true\n end\n return false\n end",
"def computer_key_move(spaces, check1, check2, check3)\n\n if spaces[check1] == \" \"\n spaces[check1] = \"O\"\n elsif spaces[check2] == \" \"\n spaces[check2] = \"O\"\n elsif spaces[check3] == \" \"\n spaces[check3] = \"O\"\n end\nend",
"def valid_move?(input)\n if input.to_i.between?(1, 9)\n if taken?(input)\n return false\n end\n return true\n end\n return false\n end",
"def move(key, db)\n node_for(key).move(key, db)\n end",
"def test_moveTo_Inside_Left\n w = Window_Base.new(-100, 100, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(0, 100)\n return true\n end",
"def player_turn\n begin\n puts \"Please choose a space (1 - 9)\"\n player_move = gets.chomp.to_i\n end until player_move.class == Fixnum && ((1..9).to_a).include?(player_move) && @active_spaces[player_move] == \" \"\n self.active_spaces[player_move] = \"X\"\n puts \"You chose space #{player_move}!\"\n game_board.show_board\n end",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n end",
"def valid_move?\n\t\t# Now let's make sure all of the moves are valid.\n\t\t# I'll do this by seeing if the sorted version of each\n\t\t# column equals the @board version.\n\t\ttemp_board = Marshal.load(Marshal.dump(@board))\n\t\ttemp = temp_board[@move_from].shift\n\t\ttemp_board[@move_to].unshift(temp)\n\n\t\ttemp_board.each do |column|\n\t\t\tif column.sort != column\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t# If they all pass, we're good!\n\t\treturn true\n\tend",
"def move(key, index)\n timeout_retry(3, 3){\n write \"MOVE #{index}\\r\\n\"\n case integer_reply\n when 1\n true\n when 0\n false\n when -3\n raise RedisError, \"destination db same as source db\"\n when -4\n raise RedisError, \"db index if out of range\"\n end\n }\n end"
] | [
"0.71380687",
"0.65211385",
"0.5892226",
"0.5865455",
"0.58550644",
"0.57853323",
"0.56763864",
"0.56398386",
"0.5562855",
"0.5517389",
"0.55158377",
"0.53663987",
"0.5365342",
"0.5238219",
"0.521678",
"0.5127838",
"0.50720066",
"0.50328624",
"0.50002134",
"0.49600253",
"0.49384776",
"0.49353576",
"0.4843246",
"0.4835981",
"0.4805208",
"0.48004857",
"0.4790538",
"0.47860578",
"0.4777167",
"0.47766408",
"0.47401705",
"0.4728656",
"0.47231388",
"0.4650101",
"0.464225",
"0.4637537",
"0.4632027",
"0.4632027",
"0.4632027",
"0.4632027",
"0.4632027",
"0.4631426",
"0.46174997",
"0.46033844",
"0.46033844",
"0.46033844",
"0.45999116",
"0.45999116",
"0.45945907",
"0.4574649",
"0.45719004",
"0.45718345",
"0.45679724",
"0.45609897",
"0.45579654",
"0.45563287",
"0.45556098",
"0.45506233",
"0.45506233",
"0.4548743",
"0.4533202",
"0.45331317",
"0.45197502",
"0.45197502",
"0.45194113",
"0.45191836",
"0.4515156",
"0.450965",
"0.45052227",
"0.44922367",
"0.4487419",
"0.44819167",
"0.44721377",
"0.4466758",
"0.44636598",
"0.4449382",
"0.44373333",
"0.44348788",
"0.4431975",
"0.4431265",
"0.44296974",
"0.44277406",
"0.44274408",
"0.44271857",
"0.44271585",
"0.4426604",
"0.44201753",
"0.44143248",
"0.44142908",
"0.44128963",
"0.44115803",
"0.44023302",
"0.44019735",
"0.439505",
"0.43885466",
"0.43864858",
"0.43823993",
"0.43821165",
"0.43774262",
"0.43716893"
] | 0.77395153 | 0 |
Move a window to a given space on the main display The window_id parameter must be fetched using window_list. Returns false if the space_number or window_id is invalid. | def move_window_to_space_on_display(window_id, space_number, display_id)
TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res = server.invoke_command(\"move-window -s #{identifier} -t #{target}\")\n if res =~ /^can't move window: index in use: \\d+/\n raise IndexInUse, [new_session, new_number]\n end\n @session = new_session\n @number = new_number\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move(x, y)\n start_time = Time.now\n xdotool \"windowmove #{@id} #{x} #{y}\"\n # Inconsistencies exist between xwininfo and xdotool.\n # \"xdotool windowmove\" is local to the selected monitor, not reflecting the\n # true coordinates of the X session. Using the screen geometry determined,\n # we can get around this.\n while [x+$screen_geometry[0][0], y+$screen_geometry[0][1]] != get_position(@id)\n puts \"#{get_position(@id)}\"\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not react - are you running a tiling window manager? Exiting...\") if Time.now - start_time > 2\n end\n end",
"def switch_window(new_window, coords: {})\n @window = new_window\n move(coords[:y], coords[:x]) unless coords.empty?\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def move_first_window_or_create_new(window)\n if window == windows.first\n move_window(window.index)\n else\n new_window(window)\n end\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def swap_with(window)\n server.invoke_command \"swap-window -s #{identifier} -t #{window.identifier}\"\n end",
"def switch_window\n current_window = window\n wins = windows\n wait_until { (wins = windows) && wins.size > 1 } if wins.size == 1\n raise StandardError, 'Unable to determine which window to switch to' if wins.size > 2\n\n wins.find { |w| w != current_window }.use\n window\n end",
"def remove_window(id)\n window_exist?(id)\n @windows.delete(id)\n end",
"def window_exist?(id)\n raise WindowError, \"Window #{id} doesn't exist\" unless @windows.key?(id)\n\n true\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def move_window_to(point_x, point_y)\n driver.manage.window.move_to(point_x, point_y)\n end",
"def mvwin(y, x)\n Ncurses.mvwin(pointer, y, x)\n end",
"def is_valid_space?(state, move, turn)\n board = JSON.parse(state)\n src, dst = move \n \n # Get the piece that is going to be\n # moved \n srcpiece = board[src[0]][src[1]]\n dstpiece = board[dst[0]][dst[1]]\n \n # Make sure the src piece is the\n # same as the turn and the destination\n # is an empty space\n if srcpiece.downcase != turn or dstpiece != ' '\n return false \n end\n\n return true \n end",
"def test_moveTo_Inside_Right\n w = Window_Base.new(740, 100, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(300, 100)\n return true\n end",
"def switch_to_other_window\n @window_id = (@window_id - 1).abs\n if @window_id != 0 and @window_id !=1\n puts @window_id\n raise(Exception::WindowMatchError, \"You cannot use this keyword when more than 2 windows are open; you must use 'Switch To Window', 'Switch to Next Window', or 'Switch to Previous Window'\")\n end\n\n @browser.windows[@window_id].use\n end",
"def switch_to_window(loc)\n if loc[0..3] == 'url=' or loc[0..5] == 'title='\n @browser.window(parse_location(loc)).use\n else\n # assume loc is an integer\n # since Robot Framework sends all args as text, the above check for\n # \"url=\" and \"title=\" is the best we can do to ensure argument correctness\n loc = loc.to_i\n # the number of the window\n # user-facing numbers are 1-based, internal we use 0-based because @browser.windows\n # is a Ruby array, so minus 1\n @window_id = loc - 1\n if @window_id == -1\n # either the user has been too smart for his/her own good and thinks the windows are 0-based,\n # or they've entered text that doesn't match 'url=' or 'title=', in which case\n # the above loc.to_i will make loc equal 0\n raise(ArgumentError, \"You must provide the url or title of the window in the format 'url=' or 'title=', or you must provide the number of the window, starting with 1 for the first window opened.\")\n end\n # this will throw its own error if the index is out of range\n @browser.windows[loc].use\n end\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def window_by_id(id)\n @windows.ID(id)\n end",
"def move_to(id, x, y, w=false, no_t = false)\n RME::deprecated_command(\"move_to\", \"use 'event_move_to' or 'player_move_to'\")\n event(id).move_to_position(x, y, w, no_t)\n end",
"def set_window\n @window = Window.find(params[:id])\n end",
"def set_window\n @window = Window.find(params[:id])\n end",
"def move_browser(x_position, y_position)\n x_position ? x_position : x_position = 0\n y_position ? y_position : y_position = 0\n\n @log.info('Moving the browser to: ' + x_position.to_s + ', ' + y_position.to_s)\n @driver.manage.window.move_to(x_position, y_position)\n end",
"def move_browser(x_position, y_position)\n x_position ? x_position : x_position = 0\n y_position ? y_position : y_position = 0\n\n @log.info('Moving the browser to: ' + x_position.to_s + ', ' + y_position.to_s)\n @driver.manage.window.move_to(x_position, y_position)\n end",
"def window(id)\n if block_given?\n original = begin\n @bridge.window_handle\n rescue Error::NoSuchWindowError\n nil\n end\n\n unless @bridge.window_handles.include? id\n raise Error::NoSuchWindowError, \"The specified identifier '#{id}' is not found in the window handle list\"\n end\n\n @bridge.switch_to_window id\n\n begin\n returned = yield\n ensure\n current_handles = @bridge.window_handles\n original = current_handles.first unless current_handles.include? original\n @bridge.switch_to_window original\n returned\n end\n else\n @bridge.switch_to_window id\n end\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def move(x, y, width = -1, height = -1)\n Window.functions[__method__] ||= AU3_Function.new(\"WinMove\", 'SSLLLL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, x, y, width, height)\n nil\n end",
"def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"def test_moveTo_Outside_Left\n w = Window_Base.new(0, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(-100, 150)\n return true\n end",
"def move(key, db)\n send_command([:move, key, db], &Boolify)\n end",
"def test_moveTo_Outside_Right\n w = Window_Base.new(300, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(740, 150)\n return true\n end",
"def move(xplace, yplace, relative, refresh_flag)\n windows = [@screen.window]\n (0...@menu_items).each do |x|\n windows << @title_win[x]\n end\n self.move_specific(xplace, yplace, relative, refresh_flag,\n windows, [])\n end",
"def switch_to_window(id)\n driver.switch_to.window(id)\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def test_moveTo_Inside_Left\n w = Window_Base.new(-100, 100, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(0, 100)\n return true\n end",
"def add_window(id, x, y, width, height, **args)\n raise WindowError, \"Window #{id} already exists\" if @windows.key?(id)\n\n @windows[id] = Window.new(self, id, x, y, width, height, **args)\n end",
"def move(xplace, yplace, relative, refresh_flag)\n current_x = @win.getbegx\n current_y = @win.getbegy\n xpos = xplace\n ypos = yplace\n\n # If this is a relative move, then we will adjust where we want\n # to move to.\n if relative\n xpos = @win.getbegx + xplace\n ypos = @win.getbegy + yplace\n end\n\n # Adjust the window if we need to.\n xtmp = [xpos]\n ytmp = [ypos]\n CDK.alignxy(@screen.window, xtmp, ytmp, @box_width, @box_height)\n xpos = xtmp[0]\n ypos = ytmp[0]\n\n # Get the difference\n xdiff = current_x - xpos\n ydiff = current_y - ypos\n\n # Move the window to the new location.\n CDK.moveCursesWindow(@win, -xdiff, -ydiff)\n CDK.moveCursesWindow(@shadow_win, -xdiff, -ydiff)\n\n # Thouch the windows so they 'move'.\n CDK::SCREEN.refreshCDKWindow(@screen.window)\n\n # Redraw the window, if they asked for it.\n if refresh_flag\n self.draw(@box)\n end\n end",
"def test_moveTo_Inside_Top\n w = Window_Base.new(100, -50, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(100, 100)\n return true\n end",
"def reposition_window\n config = MARW_CONFIGURATION\n self.x = config[:window_x] == -1 ? (Graphics.width - window_width) / 2 : config[:window_x]\n self.y = 0\n end",
"def switch_to_next_window\n @window_id += 1\n if @window_id >= @browser.windows.count\n # wrap back to the first\n @window_id = 0\n end\n\n @browser.windows[@window_id].use\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def move\n return false if @position.nil?\n \n movements = { north: { x: 0, y: 1 }, east: { x: 1, y: 0 }, south: { x: 0, y: -1 }, west: { x: -1, y: 0 } }\n position, movement = @position, movements[@direction]\n\n return false unless valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n \n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n true\n end",
"def update\n if @window.update(window_params)\n redirect_to @window, notice: 'Window was successfully updated.'\n else\n render :edit\n end\n end",
"def select_window window_id\r\n command 'selectWindow', window_id||'null'\r\n end",
"def select_window window_id\r\n command 'selectWindow', window_id||'null'\r\n end",
"def test_moveTo_Outside_Top\n w = Window_Base.new(100, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(100, -50)\n return true\n end",
"def moveToEditPosition(new_position)\n return @field_win.wmove(0, @field_width - new_position - 1)\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def move_valid_for?(player_id)\n return false if last_player_id == player_id\n\n true\n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def test_moveTo_Inside_Bottom\n w = Window_Base.new(200, 530, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(200, 100)\n return true\n end",
"def move(y, x)\n Ncurses.wmove(pointer, y, x)\n end",
"def make_move(board, display)\n new_pos = nil\n until new_pos\n display.render\n new_pos = display.cursor.get_input\n end\n new_pos\n end",
"def test_moveTo_Outside_Bottom\n w = Window_Base.new(200, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(200, 530)\n return true\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def move(xplace, yplace, relative, refresh_flag)\n windows = [@win]\n\n (0..@vrows).each do |x|\n (0..@vcols).each do |y|\n windows << @cell[x][y]\n end\n end\n\n windows << @shadow_win\n self.move_specific(xplace, yplace, relative, refresh_flag,\n windows, [])\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n # binding.pry\n # input.to_i.between?(1, 9) && position(input) == \" \"\n end",
"def player_turn\n begin\n puts \"Please choose a space (1 - 9)\"\n player_move = gets.chomp.to_i\n end until player_move.class == Fixnum && ((1..9).to_a).include?(player_move) && @active_spaces[player_move] == \" \"\n self.active_spaces[player_move] = \"X\"\n puts \"You chose space #{player_move}!\"\n game_board.show_board\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def move(xplace, yplace, relative, refresh_flag)\n windows = [@win, @field_win, @label_win, @shadow_win]\n self.move_specific(xplace, yplace, relative, refresh_flag,\n windows, [])\n end",
"def move(xplace, yplace, relative, refresh_flag)\n windows = [@win, @list_win, @shadow_win, @scrollbar_win]\n self.move_specific(xplace, yplace, relative, refresh_flag,\n windows, [])\n end",
"def move(xplace, yplace, relative, refresh_flag)\n windows = [@win, @label_win, @field_win, @shadow_win]\n self.move_specific(xplace, yplace, relative, refresh_flag,\n windows, [])\n end",
"def valid_move?(board, position)\n if position.between?(0,9) && board[position] == \" \"\n return true\n end\nend",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def switch_to_new_window(window)\t\r\n\t\t\t# Switch to new window\r\n\t\t\t#new_window = @driver.window_handles.last\r\n\t\t\[email protected]_to.window(window)\r\n\t\tend",
"def make_human_move(player, space)\n self.board[space] = player.symbol\n self.board.save\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def set_win\n @win = Win.find(params[:id])\n end",
"def move_char(new_y, new_x,world)\n\t\tif(world.world_map[new_y][new_x]==\"[ ]\") #If the new space is empty, the character moves.\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ ]\" #Empties the spot where the character used to be.\n\t\t\t@x_position = new_x #Stores the new x value\n\t\t\t@y_position = new_y #Stores the new y value\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ \\u263B ]\" #Places the character in the new location\n\t\t\treturn true\n\t\telsif(world.world_map[new_y][new_x]==\"[ ↂ ]\") #If the space has this unicode symbol...\n\t\t\trepl_story_game() #run the repl_story_game.\n\t\t\treturn false\n\t\telse #If the space is occupied, the character does not move.\n\t\t\treturn false\n\t\tend\n\tend",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1}\n when :east\n movement = { x: 1, y: 0}\n when :south\n movement = { x: 0, y: -1}\n when :west\n movement = { x: -1, y: 0}\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1 }\n when :east\n movement = { x: 1, y: 0 }\n when :south\n movement = { x: 0, y: -1 }\n when :west\n movement = { x: -1, y: 0 }\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def open_window url, window_id\r\n command 'openWindow', url, window_id\r\n end",
"def spritesheet_move?(id)\n spritesheets[id].move?\n end",
"def winning_move\n win_combo = WIN_COMBINATIONS.find do |combo|\n (@board.cells[combo[0]] == @token && @board.cells[combo[1]] == @token && @board.cells[combo[2]] == \" \") || (@board.cells[combo[0]] == @token && @board.cells[combo[2]] == @token && @board.cells[combo[1]] == \" \") || (@board.cells[combo[1]] == @token && @board.cells[combo[2]] == @token && @board.cells[combo[0]] == \" \")\n end\n if win_combo != nil\n win_cell = win_combo.find do |spot|\n @board.cells[spot] == \" \"\n end\n end\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def set_space\n @space = Space.find(params[:id])\n end",
"def position_taken?(board, space)\n\tif (board[space] == \"\") || (board[space] == \" \") || (board[space] == nil)\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def make_move(board, display)\n winning_moves = find_winning_moves(board)\n return winning_moves.sample unless winning_moves.empty?\n empty_spaces(board).sample\n end",
"def putwin(file)\n Ncurses.putwin(file)\n end",
"def move\n @dungeon.set_next_room( params[:direction].to_sym)\n if @dungeon_instance.update(dungeon_data: @dungeon.to_json)\n redirect_to dungeon_instance_play_path( @dungeon_instance )\n end\n end",
"def move(to,board)\n if self.legal?(to,board)\n @coords = to\n @moved = true\n else\n return false\n end\n end",
"def show_target_window(right)\n @item_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n heigth_remain = (480 - @target_window.height)/2\n @target_window.y = heigth_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end",
"def show_target_window(right)\n @item_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n heigth_remain = (480 - @target_window.height)/2\n @target_window.y = heigth_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end",
"def window(windowTitle, timeout = 0)\n $marathon.window(windowTitle, timeout)\n return true\nend"
] | [
"0.80645144",
"0.6797437",
"0.6611871",
"0.64104223",
"0.62135607",
"0.61805105",
"0.61400187",
"0.61280125",
"0.59365577",
"0.5893151",
"0.5538876",
"0.54859734",
"0.54701316",
"0.5466194",
"0.5423151",
"0.53313196",
"0.5321003",
"0.52708215",
"0.5143366",
"0.5132162",
"0.51136833",
"0.50848055",
"0.5083902",
"0.5083902",
"0.5083902",
"0.50350654",
"0.5026785",
"0.5026785",
"0.5019951",
"0.5019951",
"0.5017329",
"0.50165695",
"0.5012174",
"0.49972457",
"0.4994531",
"0.4992702",
"0.49847263",
"0.4975434",
"0.49640557",
"0.49639162",
"0.49520212",
"0.49325448",
"0.49210817",
"0.49106398",
"0.49063656",
"0.48758534",
"0.4866976",
"0.48616433",
"0.48477358",
"0.4839113",
"0.48362908",
"0.479949",
"0.4791727",
"0.4791727",
"0.47885787",
"0.47877452",
"0.477933",
"0.47732103",
"0.47457957",
"0.47447038",
"0.47436908",
"0.4709571",
"0.4706957",
"0.46895015",
"0.46888947",
"0.46866694",
"0.46779606",
"0.4627187",
"0.4624861",
"0.4624861",
"0.4624861",
"0.4624861",
"0.4624861",
"0.46248585",
"0.46183553",
"0.46153888",
"0.4586199",
"0.45838514",
"0.45782617",
"0.457723",
"0.45598432",
"0.4558418",
"0.45511502",
"0.45437077",
"0.45348844",
"0.4530722",
"0.45282602",
"0.45236886",
"0.45194972",
"0.4513257",
"0.4513257",
"0.4512807",
"0.45058385",
"0.45057216",
"0.45052567",
"0.45032582",
"0.4494898",
"0.4490789",
"0.4490789",
"0.4487389"
] | 0.7871263 | 1 |
Move space to a new position in the grid on the main display. Returns false if the space_number or position_number is not valid. TotalSpaces2.move_space_to_position(4, 2) | def move_space_to_position(space_number, position_number)
TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def move_to(new_position)\n if range.include? new_position\n reorder(position, new_position)\n update_column(:position, new_position)\n end\n end",
"def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end",
"def move\n return false if @position.nil?\n \n movements = { north: { x: 0, y: 1 }, east: { x: 1, y: 0 }, south: { x: 0, y: -1 }, west: { x: -1, y: 0 } }\n position, movement = @position, movements[@direction]\n\n return false unless valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n \n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n true\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def valid_move?(row, position)\n # need to shortcirtuit for position\n cells[row] && cells[row][position] == \" \"\n end",
"def moveToEditPosition(new_position)\n return @field_win.wmove(0, @field_width - new_position - 1)\n end",
"def valid_move?(position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<[email protected] && !position_taken?(position))\n return true\n end\n return false\n end",
"def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end",
"def valid_move?(position)\n if is_number?(position)\n if position.to_i.between?(0, 10)\n if position_taken?(position.to_i-1)\n false\n else\n true\n end\n else \n false\n end\n else\n false\n end\n end",
"def position_taken? (board, numeric_position)\n board[numeric_position - 1] == \" \"\nend",
"def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def move_to(pos)\n if (@current_pos != nil && @current_pos == pos)\n return\n end\n if pos == 5\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end\n if [1, 2, 3].include?(pos)#bottom\n self.y = Graphics.height - self.height\n if @win_help != nil\n self.y -= @win_help.height\n end\n end\n if [1, 4, 7].include?(pos)#left\n self.x = 0\n end\n if [7, 8, 9].include?(pos)#top\n self.y = 0\n end\n if [3, 6, 9].include?(pos)#right\n self.x = Graphics.width - self.width\n end\n @current_pos = pos\n end",
"def valid_move?(board, position)\n position = position.to_i\n if(position.between?(1,9))\n position -=1\n if(position_taken?(board, position))\n false\n else\n true\n end\n end\nend",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def valid_move?(board, position)\n if position.between?(0,9) && board[position] == \" \"\n return true\n end\nend",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def grid_move(new_grid_pos)\n @grid_pos = new_grid_pos\n @ori_x = original_x\n @ori_y = original_y\n self.battle_phase = :move\n end",
"def validEditPosition(new_position)\n if new_position <= 0 || new_position >= @field_width\n return false\n end\n if self.moveToEditPosition(new_position) == Ncurses::ERR\n return false\n end\n ch = @field_win.winch\n if ch.chr != ' '\n return true\n end\n if new_position > 1\n # Don't use recursion - only one level is wanted\n if self.moveToEditPosition(new_position - 1) == Ncurses::ERR\n return false\n end\n ch = @field_win.winch\n return ch.chr != ' '\n end\n return false\n end",
"def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend",
"def move\n return unless placed?\n # We know place() will already ignore invalid placements, so just advance\n # the robot and let it fail silently if those positions are not on the board\n place(*next_position, direction)\n end",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1}\n when :east\n movement = { x: 1, y: 0}\n when :south\n movement = { x: 0, y: -1}\n when :west\n movement = { x: -1, y: 0}\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def valid_move?(new_x, new_y)\n true\n end",
"def position?(row, col)\n @move.key?([row, col])\n end",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1 }\n when :east\n movement = { x: 1, y: 0 }\n when :south\n movement = { x: 0, y: -1 }\n when :west\n movement = { x: -1, y: 0 }\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def valid_move? index_position \n index_position < 9 && !position_taken?(index_position)\n end",
"def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend",
"def move(start_pos, end_pos)\n return false unless valid_move?(start_pos, end_pos)\n\n moving_piece = piece_at(start_pos)\n\n @grid[end_pos[0]][end_pos[1]] = moving_piece\n @grid[start_pos[0]][start_pos[1]] = nil\n\n moving_piece.moved = true if moving_piece.is_a?(Pawn)\n true\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def valid_move?(board,position)\n\tif position.to_i.between?(1, 10) && empty_position?(board, position.to_i)\n\t\t\treturn true \n\telse\n\t\treturn false \n\tend\nend",
"def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def valid_move?(position) ### changed from index to position - ER 2017\n\n if (position > 9) || (position < 0) #if index (position on board entered by user) is greater than 9 or less than 0, return false\n false\n elsif position_taken?(position) ###otherwise, if position on board is taken, return false\n false\n else position.between?(0, 8) ###finally, if the position isn't taken, and the index (position on board entered by user) is between 0 and 8, return true\n true\n end # end if...elsif statements\n end",
"def input_move(column, player)\n placed = false\n return false unless (1..width).include?(column)\n\n grid.reverse_each do |row|\n if row[column - 1] == empty_cell && placed == false\n row[column - 1] = player\n placed = true\n end\n end\n placed\n end",
"def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.update_board(from, to, @color)\n\t\t\tputs \"#{input} is either not a valid input or unavailable. Please try again.\"\n\t\t\tprintf \"Make your move: \"\n\t\t\tinput = gets.chomp\n\t\t\tfrom = input[0..1]\n\t\t\tto = input[2..3]\n\t\tend\n end",
"def position_taken?(move_index)\r\n if @board[move_index] == \" \"\r\n false\r\n else\r\n true\r\n end\r\n end",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def valid_move?(board, position)\n position = position.to_i\n \n if !(position_taken?(board, position-1)) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend",
"def valid_move?(index)\n if position_taken?(index)\n false\n elsif index < 0 || index > 8\n false\n else\n true \n end\n end",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend",
"def position_taken?(position)\n !(@board[position.to_i] == \" \") \n end",
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend",
"def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend",
"def move_char(new_y, new_x,world)\n\t\tif(world.world_map[new_y][new_x]==\"[ ]\") #If the new space is empty, the character moves.\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ ]\" #Empties the spot where the character used to be.\n\t\t\t@x_position = new_x #Stores the new x value\n\t\t\t@y_position = new_y #Stores the new y value\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ \\u263B ]\" #Places the character in the new location\n\t\t\treturn true\n\t\telsif(world.world_map[new_y][new_x]==\"[ ↂ ]\") #If the space has this unicode symbol...\n\t\t\trepl_story_game() #run the repl_story_game.\n\t\t\treturn false\n\t\telse #If the space is occupied, the character does not move.\n\t\t\treturn false\n\t\tend\n\tend",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def valid_move?(board, position)\n position = position.to_i - 1\n position_taken?(board, position) == false && position.between?(0,8) == true\nend",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n # binding.pry\n # input.to_i.between?(1, 9) && position(input) == \" \"\n end",
"def valid_move?(board,position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=board.length && !position_taken?(board,position))\n return true\n end\n return false\nend",
"def valid_move?(board, new_index)\n if 8 < new_index || new_index < 0\n return false\n elsif position_taken?(board, new_index) == true\n return false\n else\n return true\n end\nend",
"def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend",
"def move(to,board)\n if self.legal?(to,board)\n @coords = to\n @moved = true\n else\n return false\n end\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end",
"def valid_move?(board, index)\n if index.between?(0, 8) && board[index] == \" \"\n true\n else position_taken?(board, index) == nil && board[index] == \"X\"\n false\n end\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def position_taken?(board, space)\n\tif (board[space] == \"\") || (board[space] == \" \") || (board[space] == nil)\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def valid_move?(board, position)\n position = position.to_i\n \n if (position_taken?(board, position) ==false) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n if board[(position.to_i - 1)] == \" \"\n false\n else\n true\n end\nend",
"def valid_move?(board, position)\n if position_taken?(board, position) == false && position.to_i.between?(0,8)\n true\n else\n false\n end\n end",
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend",
"def valid_move?(position)\n position && @maze[position] != \"*\" && @times_visited[position] < 2 && position[0] < @maze.maze.length && position[1] < find_max_row_length \n end",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def changed_position(new_position)\n @valid_moves = bishop_valid_moves(new_position)\n end",
"def valid_move?(board,position)\n position = position.to_i #convert string to integer\n position = position-1 #translate position to array location\n\n if position >= 0 and position < 9 #check for legal position\n if board[position].strip.empty?\n return true\n elsif position_taken?(board,position)\n return false #position is occupied\n end\n else\n return false #illegal position\n end\nend",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def valid_move?(board, position)\n !position_taken?(board, position) && position.between?(0,8)\nend",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n\nend",
"def valid_move?(board, position)\n if !(position_taken?(board, position)) && position.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n\ta = board[position.to_i - 1]\n\tif a != \" \"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def make_move(board, display)\n new_pos = nil\n until new_pos\n display.render\n new_pos = display.cursor.get_input\n end\n new_pos\n end",
"def move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end",
"def valid_move?(index)\r\n if (index>=0 && index<9) && !position_taken?(index)\r\n return true\r\n end\r\n end",
"def valid_move?(board, position)\n index = position.to_i\n if position_taken?(board, index) == false && index.between?(0, 8)\n return true\n else\n return false\n end\nend",
"def move(board, position)\n board.place_move(position, @play_symbol)\n end"
] | [
"0.7345556",
"0.70695674",
"0.6993478",
"0.6809427",
"0.6794172",
"0.6789958",
"0.67232746",
"0.67206734",
"0.6659641",
"0.6518978",
"0.6413597",
"0.6403341",
"0.6389916",
"0.6382818",
"0.6381655",
"0.6354069",
"0.6308633",
"0.6292757",
"0.6283047",
"0.62776273",
"0.62717736",
"0.6270385",
"0.62687165",
"0.62607175",
"0.6226116",
"0.62162507",
"0.621579",
"0.6206685",
"0.62019306",
"0.6195256",
"0.61952084",
"0.61884254",
"0.618631",
"0.61855",
"0.6180457",
"0.6177856",
"0.6171569",
"0.61704016",
"0.61696625",
"0.6148403",
"0.6145562",
"0.6145227",
"0.6140477",
"0.6135346",
"0.6124869",
"0.61148185",
"0.6111721",
"0.61106783",
"0.61047643",
"0.6101626",
"0.6084619",
"0.6084606",
"0.60789126",
"0.6069426",
"0.60665226",
"0.60643977",
"0.6063592",
"0.60542214",
"0.6048003",
"0.6044083",
"0.6043567",
"0.60432494",
"0.6036894",
"0.60362136",
"0.6035872",
"0.6033703",
"0.60247636",
"0.60001194",
"0.59970206",
"0.59959203",
"0.59917",
"0.5990427",
"0.5986726",
"0.5984586",
"0.59840536",
"0.5976141",
"0.59754777",
"0.5973093",
"0.5971298",
"0.59551674",
"0.59469616",
"0.5944942",
"0.5944321",
"0.59423846",
"0.5942376",
"0.59417504",
"0.59379977",
"0.5934794",
"0.5925973",
"0.5918673",
"0.5916452",
"0.5910878",
"0.5909539",
"0.5904669",
"0.5904161",
"0.5903626",
"0.590331",
"0.5899688",
"0.58973145",
"0.58800393"
] | 0.7570759 | 0 |
Move space to a new position in the grid. Spaces can only be moved within their own display. Returns false if the space_number or position_number is not valid. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.move_space_to_position_on_display(4, 2, display_id) | def move_space_to_position_on_display(space_number, position_number, display_id)
TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)\n TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def move_to(new_position)\n if range.include? new_position\n reorder(position, new_position)\n update_column(:position, new_position)\n end\n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end",
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def make_move(board, display)\n new_pos = nil\n until new_pos\n display.render\n new_pos = display.cursor.get_input\n end\n new_pos\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def moveToEditPosition(new_position)\n return @field_win.wmove(0, @field_width - new_position - 1)\n end",
"def move\n return false if @position.nil?\n \n movements = { north: { x: 0, y: 1 }, east: { x: 1, y: 0 }, south: { x: 0, y: -1 }, west: { x: -1, y: 0 } }\n position, movement = @position, movements[@direction]\n\n return false unless valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n \n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n true\n end",
"def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def validEditPosition(new_position)\n if new_position <= 0 || new_position >= @field_width\n return false\n end\n if self.moveToEditPosition(new_position) == Ncurses::ERR\n return false\n end\n ch = @field_win.winch\n if ch.chr != ' '\n return true\n end\n if new_position > 1\n # Don't use recursion - only one level is wanted\n if self.moveToEditPosition(new_position - 1) == Ncurses::ERR\n return false\n end\n ch = @field_win.winch\n return ch.chr != ' '\n end\n return false\n end",
"def valid_move?(row, position)\n # need to shortcirtuit for position\n cells[row] && cells[row][position] == \" \"\n end",
"def valid_move?(position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<[email protected] && !position_taken?(position))\n return true\n end\n return false\n end",
"def position_taken? (board, numeric_position)\n board[numeric_position - 1] == \" \"\nend",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def valid_move?(position)\n if is_number?(position)\n if position.to_i.between?(0, 10)\n if position_taken?(position.to_i-1)\n false\n else\n true\n end\n else \n false\n end\n else\n false\n end\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def valid_move?(position)\n !taken?(position) && position.to_i >0 && position.to_i <=9\n end",
"def valid_move?(new_x, new_y)\n true\n end",
"def move\n return unless placed?\n # We know place() will already ignore invalid placements, so just advance\n # the robot and let it fail silently if those positions are not on the board\n place(*next_position, direction)\n end",
"def move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end",
"def move(start_pos, end_pos)\n return false unless valid_move?(start_pos, end_pos)\n\n moving_piece = piece_at(start_pos)\n\n @grid[end_pos[0]][end_pos[1]] = moving_piece\n @grid[start_pos[0]][start_pos[1]] = nil\n\n moving_piece.moved = true if moving_piece.is_a?(Pawn)\n true\n end",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def valid_move?(board, position)\n position = position.to_i\n if(position.between?(1,9))\n position -=1\n if(position_taken?(board, position))\n false\n else\n true\n end\n end\nend",
"def valid_move?(board, position)\n if position.between?(0,9) && board[position] == \" \"\n return true\n end\nend",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1}\n when :east\n movement = { x: 1, y: 0}\n when :south\n movement = { x: 0, y: -1}\n when :west\n movement = { x: -1, y: 0}\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def input_move(column, player)\n placed = false\n return false unless (1..width).include?(column)\n\n grid.reverse_each do |row|\n if row[column - 1] == empty_cell && placed == false\n row[column - 1] = player\n placed = true\n end\n end\n placed\n end",
"def valid_move?(position)\n if !position_taken?(position) && position.between?(0,8)\n true\n else\n false\n end\n end",
"def valid_move?(position)\r\n @index = position.to_i-1\r\n if @index.between?(0,8) && !position_taken?(@index)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def move\n return false if @position.nil?\n\n position = @position\n movement = nil\n\n case @direction\n when :north\n movement = { x: 0, y: 1 }\n when :east\n movement = { x: 1, y: 0 }\n when :south\n movement = { x: 0, y: -1 }\n when :west\n movement = { x: -1, y: 0 }\n end\n\n moved = true\n\n if valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n else\n moved = false\n end\n\n moved\n end",
"def valid_move?(position)\n index=position.to_i - 1\n index.between?(0, 8) && !(position_taken?(index))\n end",
"def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def valid_move?(board, position)\n position = position.to_i\n return false if !valid_position?(position)\n return false if position_taken?(board, position)\n return true\nend",
"def valid_move?(position)\n position.between?(0,8) && !position_taken?(position)\n end",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def valid_move? index_position \n index_position < 9 && !position_taken?(index_position)\n end",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def validate_computer_position(position)\n if $grid_hash[position] == ' '\n \t$confirmed_piece = position\n return true\n else\n comp_turn\n end\nend",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res = server.invoke_command(\"move-window -s #{identifier} -t #{target}\")\n if res =~ /^can't move window: index in use: \\d+/\n raise IndexInUse, [new_session, new_number]\n end\n @session = new_session\n @number = new_number\n end",
"def valid_move?(input)\n input.to_i.between?(1, 9) && !taken?(input)\n # binding.pry\n # input.to_i.between?(1, 9) && position(input) == \" \"\n end",
"def valid_move?(board, position)\n indexed_position = position.to_i - 1\n indexed_position.between?(0,8) && !position_taken?(board, indexed_position)\nend",
"def valid_move?(input_position)\n num = self.convert_to_i(input_position)\n num.between?(1, 9) && !self.taken?(num)\n end",
"def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.update_board(from, to, @color)\n\t\t\tputs \"#{input} is either not a valid input or unavailable. Please try again.\"\n\t\t\tprintf \"Make your move: \"\n\t\t\tinput = gets.chomp\n\t\t\tfrom = input[0..1]\n\t\t\tto = input[2..3]\n\t\tend\n end",
"def valid_move?(board, position)\n position = (position.to_i - 1)\n\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n else false\n end\nend",
"def valid_move?(board, position)\n position.to_i.between?(1,9) && !position_taken?(board, position.to_i-1)\nend",
"def grid_move(new_grid_pos)\n @grid_pos = new_grid_pos\n @ori_x = original_x\n @ori_y = original_y\n self.battle_phase = :move\n end",
"def valid_move?(board,position)\n\tif position.to_i.between?(1, 10) && empty_position?(board, position.to_i)\n\t\t\treturn true \n\telse\n\t\treturn false \n\tend\nend",
"def position?(row, col)\n @move.key?([row, col])\n end",
"def position_taken?(position)\n !(@board[position.to_i] == \" \") \n end",
"def valid_move?(board, position)\n position = position.to_i - 1\n if position.between?(0, 8) && !position_taken?(board, position)\n true\n end\nend",
"def position_taken?(move_index)\r\n if @board[move_index] == \" \"\r\n false\r\n else\r\n true\r\n end\r\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def valid_move?(board, position)\n # position = position.to_i \n position.to_i. between?(1, 9) && !position_taken?(board, position.to_i-1)\nend",
"def valid_move?(board, position)\n position = position.to_i\n \n if !(position_taken?(board, position-1)) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def move(to,board)\n if self.legal?(to,board)\n @coords = to\n @moved = true\n else\n return false\n end\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def move_char(new_y, new_x,world)\n\t\tif(world.world_map[new_y][new_x]==\"[ ]\") #If the new space is empty, the character moves.\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ ]\" #Empties the spot where the character used to be.\n\t\t\t@x_position = new_x #Stores the new x value\n\t\t\t@y_position = new_y #Stores the new y value\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ \\u263B ]\" #Places the character in the new location\n\t\t\treturn true\n\t\telsif(world.world_map[new_y][new_x]==\"[ ↂ ]\") #If the space has this unicode symbol...\n\t\t\trepl_story_game() #run the repl_story_game.\n\t\t\treturn false\n\t\telse #If the space is occupied, the character does not move.\n\t\t\treturn false\n\t\tend\n\tend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def valid_move? (board, position)\n position = position.to_i - 1\n (position.between?(0,8)) && (position_taken?(board, position) == false)\nend",
"def horizontal_move?(x_position, x, y_position, y)\n x_position != x && y_position == y\n end",
"def move_to(pos)\n if (@current_pos != nil && @current_pos == pos)\n return\n end\n if pos == 5\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end\n if [1, 2, 3].include?(pos)#bottom\n self.y = Graphics.height - self.height\n if @win_help != nil\n self.y -= @win_help.height\n end\n end\n if [1, 4, 7].include?(pos)#left\n self.x = 0\n end\n if [7, 8, 9].include?(pos)#top\n self.y = 0\n end\n if [3, 6, 9].include?(pos)#right\n self.x = Graphics.width - self.width\n end\n @current_pos = pos\n end",
"def make_move(symbol, row, column)\n if(symbol != @@X_SYMBOL && symbol != @@O_SYMBOL)\n raise ArgumentError, \"symbol must either be an X or an O\"\n end\n\n if(@board[row][column] != @@X_SYMBOL && @board[row][column] != @@O_SYMBOL)\n @board[row][column] = symbol\n return true\n end\n return false\n end",
"def valid_move?(board,position)\n if position.to_i.between?(1,9) && !position_taken?(board,position.to_i-1)\n true\n else\n end\nend",
"def changed_position(new_position)\n @valid_moves = bishop_valid_moves(new_position)\n end",
"def place(x, y, direction_to_face)\n # Check if we're working with a valid destination\n if @table.valid_destination x, y \n # Set our new position instance variable values\n @current_position[:x] = x\n @current_position[:y] = y\n @current_position[:direction] = direction_to_face\n\n puts \"Toy Robot placed at (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}\"\n\n return true\n else\n puts \"Invalid placement given, please specify a valid place within the range of the table in the format X, Y e.g. PLACE 1, 2\" \n return false\n end\n end",
"def valid_move?(position) ### changed from index to position - ER 2017\n\n if (position > 9) || (position < 0) #if index (position on board entered by user) is greater than 9 or less than 0, return false\n false\n elsif position_taken?(position) ###otherwise, if position on board is taken, return false\n false\n else position.between?(0, 8) ###finally, if the position isn't taken, and the index (position on board entered by user) is between 0 and 8, return true\n true\n end # end if...elsif statements\n end",
"def valid_move?(board,position)\n if !position.is_a?(Integer)\n position = position.to_i\n end\n if(position>=1 && position<=board.length && !position_taken?(board,position))\n return true\n end\n return false\nend",
"def valid_move?(board,position)\n position=position.to_i-1\n if position.between?(0,8) && !position_taken?(board, position)\n true\n else\n false\n end\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end",
"def valid_move?(board, position)\n position.between?(0, 8) && !position_taken?(board, position)\nend",
"def move\n if inside_table?(next_move_x_y(next_move))\n update_position!(next_move_x_y(next_move))\n else\n almost_die\n end\n end",
"def valid_move?(location)\n location.to_i.between?(1,9) && !position_taken?(location.to_i-1)\n end",
"def position_taken?(board, space)\n\tif (board[space] == \"\") || (board[space] == \" \") || (board[space] == nil)\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def valid_move?(index)\n if position_taken?(index)\n false\n elsif index < 0 || index > 8\n false\n else\n true \n end\n end",
"def move(number)\n @position += number\n if @position < 32\n puts \"You moved #{number} steps forward\"\n end\n sleep(1)\n landed_on_which_panel(@position)\n end",
"def valid_move?(board, position)\n if position.to_i>=1 && position.to_i<=9 && !position_taken?(board, position.to_i-1)\n return true\n else\n return false\n end\nend",
"def valid_move?(board, position)\n position = position.to_i - 1\n position_taken?(board, position) == false && position.between?(0,8) == true\nend",
"def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend",
"def move_to(dest_position)\n return if self.orderable_position == dest_position\n\n pos = orderable_attribute\n con = orderable_condition\n\n self.class.transaction do\n if orderable_position < dest_position\n adj = \"#{pos} = #{pos} - 1\"\n con = con + [ \"#{pos} > #{orderable_position}\", \"#{pos} <= #{dest_position}\" ]\n else\n adj = \"#{pos} = #{pos} + 1\"\n con = con + [ \"#{pos} < #{orderable_position}\", \"#{pos} >= #{dest_position}\" ]\n end\n self.class.update( adj, :condition => con.join(' AND ') )\n self.orderable_position = dest_position\n update_attribute(orderable_attribute)\n end\n\n self\n end",
"def valid_move?(board, position)\n position = position.to_i\n \n if (position_taken?(board, position) ==false) && position.between?(1,9)\n return true\n else\n return false\n end\nend",
"def position_taken?(board, position)\n if board[(position.to_i - 1)] == \" \"\n false\n else\n true\n end\nend",
"def valid_move?(index)\n\t\tindex < 9 && !position_taken?(index) ? true : false\n\tend",
"def valid_move?(board, index)\n if index.between?(0, 8) && board[index] == \" \"\n true\n else position_taken?(board, index) == nil && board[index] == \"X\"\n false\n end\nend",
"def valid_move?(board, position)\n position_taken?(board, position) == false && position.between?(0, 8) ? true : false\nend"
] | [
"0.7740621",
"0.73314995",
"0.7271876",
"0.67355883",
"0.6600612",
"0.65086293",
"0.64791816",
"0.6478934",
"0.64209586",
"0.63598627",
"0.6342338",
"0.63348615",
"0.62164384",
"0.6209217",
"0.61665946",
"0.6141446",
"0.6128524",
"0.60923576",
"0.60510427",
"0.60484475",
"0.59961164",
"0.5982208",
"0.5967519",
"0.59641397",
"0.5924189",
"0.59195226",
"0.59118205",
"0.5897912",
"0.5876802",
"0.5875681",
"0.58677846",
"0.5852417",
"0.5842835",
"0.5841701",
"0.5827501",
"0.582371",
"0.58158344",
"0.58126724",
"0.58077157",
"0.5803793",
"0.58029467",
"0.57988137",
"0.57975036",
"0.5793071",
"0.5782403",
"0.57782066",
"0.5768047",
"0.57652867",
"0.57652736",
"0.5759912",
"0.5732841",
"0.5729132",
"0.57174397",
"0.5717423",
"0.5715581",
"0.5699347",
"0.5697141",
"0.56891185",
"0.5685787",
"0.5678592",
"0.56703824",
"0.5667168",
"0.5666898",
"0.5657629",
"0.5654117",
"0.56524444",
"0.56518525",
"0.5635651",
"0.5633169",
"0.56297857",
"0.562782",
"0.56218946",
"0.56218606",
"0.5618788",
"0.56187075",
"0.56139773",
"0.56112343",
"0.56003046",
"0.5596093",
"0.5589945",
"0.5585349",
"0.55849355",
"0.55817467",
"0.5581449",
"0.5577343",
"0.5572402",
"0.5571517",
"0.5570231",
"0.55652875",
"0.5554564",
"0.55474174",
"0.5543457",
"0.55433017",
"0.5530709",
"0.552853",
"0.5527471",
"0.55267495",
"0.5520978",
"0.5519554",
"0.55109996"
] | 0.7992506 | 0 |
Move space to a new position on another screen. This won't work if you do not have displays have separate spaces enabled. Returns false if any parameters are not valid. display_id = TotalSpaces2.main_display[:display_id] display2_id = TotalSpaces2.display_list[1][:display_id] TotalSpaces2.move_space_on_display_to_position_on_display(2, display_id, 1, display2_id) | def move_space_on_display_to_position_on_display(space_number, from_display_id, position_number, to_display_id)
TSApi.tsapi_moveSpaceOnDisplayToPositionOnDisplay(space_number, from_display_id, position_number, to_display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_space_to_position_on_display(space_number, position_number, display_id)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, display_id)\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def move_space_to_position(space_number, position_number)\n TSApi.tsapi_moveSpaceToPositionOnDisplay(space_number, position_number, 0)\n end",
"def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def make_move(board, display)\n new_pos = nil\n until new_pos\n display.render\n new_pos = display.cursor.get_input\n end\n new_pos\n end",
"def move(x, y)\n start_time = Time.now\n xdotool \"windowmove #{@id} #{x} #{y}\"\n # Inconsistencies exist between xwininfo and xdotool.\n # \"xdotool windowmove\" is local to the selected monitor, not reflecting the\n # true coordinates of the X session. Using the screen geometry determined,\n # we can get around this.\n while [x+$screen_geometry[0][0], y+$screen_geometry[0][1]] != get_position(@id)\n puts \"#{get_position(@id)}\"\n abort(\"*** #{File.basename(__FILE__)}: Window #{@id} did not react - are you running a tiling window manager? Exiting...\") if Time.now - start_time > 2\n end\n end",
"def move_to_position(x, y)\n return false if (@position.x - x).abs < 1 && (@position.y - y).abs < 1\n puts \"MOVE #{x} #{y}\"\n true\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def move\n # Check that we have been placed\n if self.placed?\n # Create a new version to hold our new position for validation later\n new_position = @current_position.dup\n \n # Get our direction constant to establish whether we want to operate on the X or Y co-ordinate and whether to subtract or add based on direction\n direction_constant = self.get_direction_constant\n\n # Calculate our new position operating on the correct coordinate with the correct operation using the constants we have on the class\n new_position[direction_constant[:coordinate]] = new_position[direction_constant[:coordinate]] + direction_constant[:operation_value] \n # Check if the new position is valid move to this position\n if @table.valid_destination new_position[:x], new_position[:y]\n # Set our new valid position\n @current_position = new_position \n puts \"The Toy Robot has moved to (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}...\"\n else\n puts \"The Toy Robot cannot move any further, position unchanged, skipping command...\"\n return false\n end\n else\n puts \"The Toy Robot has not been placed, skipping command...\"\n return false\n end\n end",
"def move\n position_after_move = @position.new_coordinates_for_step_size(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n #ignore the command if robot is being out off tabletop\n if(@table_top.has_within_bounds?(position_after_move))\n @position = @position.new_coordinates_for(@direction.step_size_for_x_axis, @direction.step_size_for_y_axis)\n\n end\n end",
"def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end",
"def move(new_session, new_number)\n return if @session == new_session && @number == new_number\n target = \"%s:%s\" % [new_session.identifier, new_number]\n\n res = server.invoke_command(\"move-window -s #{identifier} -t #{target}\")\n if res =~ /^can't move window: index in use: \\d+/\n raise IndexInUse, [new_session, new_number]\n end\n @session = new_session\n @number = new_number\n end",
"def place\n next_move = {x: command.arguments[:x], y: command.arguments[:y]}\n if inside_table?(next_move_x_y(next_move, false))\n update_position!(next_move_x_y(next_move, false))\n update_direction!\n else\n almost_die\n end\n end",
"def move(space)\n @board.move(@current_player, space)\n @state = \n if @board.winning?\n :win\n elsif @board.full?\n :draw\n else\n @current_player = @current_player.opponent\n :continue\n end\n rescue InvalidSpaceException\n :continue\n end",
"def move(y, x)\n Ncurses.wmove(pointer, y, x)\n end",
"def move_absolute(acc, dec, ve, pos) \n Process.spawn \"screen -S usbserial -X stuff 'AC#{acc} DE#{dec} VE#{ve} DA#{pos} GO\\n'\"\n puts \"screen -S usbserial -X stuff 'AC#{acc} DE#{dec} VE#{ve} DA#{pos} GO\\n'\"\n end",
"def move_to(x, y)\n @x, @y = x, y\n @gui.move_to(x, y)\n self\n end",
"def move_position(num_spaces = 1, for_blinds = false)\n\t\tif num_spaces > 1\n\t\t\tnum_spaces.times { move_position }\n\t\telse\n\t\t\t@current_position = person_in_spot(@current_position + 1)\n\t\t\tp = @seats[@current_position]\n\t\t\tif !for_blinds and @hands.size > @max_can_win.size\n\t\t\t\tmove_position if [email protected]?(p) or @max_can_win.keys.include?(p)\n\t\t\tend\n\t\tend\n\tend",
"def move_to(x, y); end",
"def unit_move_tb(x,y)\n @tb_event.flash_soft_tb = false if @tb_event\n give_move_command(@tb_event)\n @tb_event.tb_unit.used_action(:move, @tb_event.tb_unit.move)\n @showing_temp_hls = false\n end",
"def set_screen_postion(start_pos, reset = false)\n position = reset ? [$game_player.x,$game_player.y] : start_pos \n pos = set_screen_move_postion(position)\n set_screen(pos[0], $game_map.display_x, true)\n set_screen(pos[1], $game_map.display_y, false)\n end",
"def moveToEditPosition(new_position)\n return @field_win.wmove(0, @field_width - new_position - 1)\n end",
"def move_browser(x_position, y_position)\n x_position ? x_position : x_position = 0\n y_position ? y_position : y_position = 0\n\n @log.info('Moving the browser to: ' + x_position.to_s + ', ' + y_position.to_s)\n @driver.manage.window.move_to(x_position, y_position)\n end",
"def move_browser(x_position, y_position)\n x_position ? x_position : x_position = 0\n y_position ? y_position : y_position = 0\n\n @log.info('Moving the browser to: ' + x_position.to_s + ', ' + y_position.to_s)\n @driver.manage.window.move_to(x_position, y_position)\n end",
"def move_to(pos)\n if (@current_pos != nil && @current_pos == pos)\n return\n end\n if pos == 5\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end\n if [1, 2, 3].include?(pos)#bottom\n self.y = Graphics.height - self.height\n if @win_help != nil\n self.y -= @win_help.height\n end\n end\n if [1, 4, 7].include?(pos)#left\n self.x = 0\n end\n if [7, 8, 9].include?(pos)#top\n self.y = 0\n end\n if [3, 6, 9].include?(pos)#right\n self.x = Graphics.width - self.width\n end\n @current_pos = pos\n end",
"def execute\n return unless @robot.placed?\n\n original_position = @robot.position\n new_position = original_position.dup\n new_position.move\n\n @robot.position = new_position if @table.position_valid?(new_position)\n end",
"def move_to_position(new_position)\n old_position = self.send(position_column)\n unless new_position == old_position\n if new_position < old_position\n # Moving higher in the list (up) \n new_position = [1, new_position].max\n increment_positions_between(new_position, old_position - 1)\n else\n # Moving lower in the list (down)\n new_position = [bottom_position_in_list(self).to_i, new_position].min\n decrement_positions_between(old_position + 1, new_position)\n end\n self.update_attribute(position_column, new_position)\n end\n end",
"def move_to(new_position)\n if range.include? new_position\n reorder(position, new_position)\n update_column(:position, new_position)\n end\n end",
"def move_to(end_pos)\n if @board[end_pos].nil?\n @board.moves_since_capture += 1\n else\n @board.moves_since_capture = 0\n end\n\n @board[end_pos] = self\n @board[self.position] = nil\n self.position = end_pos\n end",
"def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end",
"def make_human_move(player, space)\n self.board[space] = player.symbol\n self.board.save\n end",
"def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.update_board(from, to, @color)\n\t\t\tputs \"#{input} is either not a valid input or unavailable. Please try again.\"\n\t\t\tprintf \"Make your move: \"\n\t\t\tinput = gets.chomp\n\t\t\tfrom = input[0..1]\n\t\t\tto = input[2..3]\n\t\tend\n end",
"def check_move?(new_position)\n if new_position[0].between?(0,7) &&\n new_position[1].between?(0,7) &&\n !space_full?(new_position)\n return true\n end\n false\n end",
"def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end",
"def move\n if @placed\n position = @face.move(@x, @y)\n x = position[0]\n y = position[1]\n if @table.validate(x, y)\n @x = x\n @y = y\n end\n end\n end",
"def move_if_necessary(x, y)\n return if textcursor.left == x && textcursor.top == y\n move_textcursor(x, y)\n end",
"def turn\n move = self.current_player.move(self.board)\n # binding.pry\n if self.board.valid_move?(move)\n self.board.update(move, self.current_player)\n else\n puts \"Invalid entry. Please enter a valid space number 1-9.\"\n self.turn\n end\n end",
"def move_to(x, y)\n cur_page.move_to(x, y)\n end",
"def place(x, y, direction_to_face)\n # Check if we're working with a valid destination\n if @table.valid_destination x, y \n # Set our new position instance variable values\n @current_position[:x] = x\n @current_position[:y] = y\n @current_position[:direction] = direction_to_face\n\n puts \"Toy Robot placed at (#{@current_position[:x]}, #{@current_position[:y]}) facing #{@current_position[:direction]}\"\n\n return true\n else\n puts \"Invalid placement given, please specify a valid place within the range of the table in the format X, Y e.g. PLACE 1, 2\" \n return false\n end\n end",
"def move\n return unless placed?\n # We know place() will already ignore invalid placements, so just advance\n # the robot and let it fail silently if those positions are not on the board\n place(*next_position, direction)\n end",
"def execute\n if @robot.placed?\n new_position = @robot.current_position.go_to(@robot.current_position.direction)\n\n @robot.current_position = new_position if @table.position_is_valid?(new_position)\n end\n end",
"def move\n\t\treturn \"INVALID COMMANDS, YOU CAN NOT MAKE THE ROBOT FALL OFF THE TABLE\" unless is_valid_move?\n\t\tcase @direction\n\t\twhen \"east\"\n\t\t\t@x_coordinate += 1\n\t\twhen \"west\"\n\t\t\t@x_coordinate -= 1\n\t\twhen \"south\"\n\t\t\t@y_coordinate -= 1\n\t\twhen \"north\"\n\t\t\t@y_coordinate += 1\n\t\telse\n\t\tend\n\t\ttrue\n\tend",
"def computer_key_move(spaces, check1, check2, check3)\n\n if spaces[check1] == \" \"\n spaces[check1] = \"O\"\n elsif spaces[check2] == \" \"\n spaces[check2] = \"O\"\n elsif spaces[check3] == \" \"\n spaces[check3] = \"O\"\n end\nend",
"def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end",
"def test_first_move_places_x_on_board\n @game.move(1, 1)\n assert @game.spaces.include?('X')\n end",
"def valid_move?(position)\n position.to_i.between?(1,9) && @board[position.to_i - 1] == \" \"\n end",
"def move_char(new_y, new_x,world)\n\t\tif(world.world_map[new_y][new_x]==\"[ ]\") #If the new space is empty, the character moves.\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ ]\" #Empties the spot where the character used to be.\n\t\t\t@x_position = new_x #Stores the new x value\n\t\t\t@y_position = new_y #Stores the new y value\n\t\t\tworld.world_map[@y_position][@x_position] = \"[ \\u263B ]\" #Places the character in the new location\n\t\t\treturn true\n\t\telsif(world.world_map[new_y][new_x]==\"[ ↂ ]\") #If the space has this unicode symbol...\n\t\t\trepl_story_game() #run the repl_story_game.\n\t\t\treturn false\n\t\telse #If the space is occupied, the character does not move.\n\t\t\treturn false\n\t\tend\n\tend",
"def misplaced_space?\n space && (space_id != space.space_id)\n end",
"def commit_move?(piece, desired_space)\n get_travel_path(piece, desired_space)\n valid_move?(piece, desired_space)\n end",
"def update_position!(next_move)\n table.x = next_move[:x]\n table.y = next_move[:y]\n end",
"def move(number)\n @position += number\n if @position < 32\n puts \"You moved #{number} steps forward\"\n end\n sleep(1)\n landed_on_which_panel(@position)\n end",
"def MOVE\n x,y = Karel.coordinates_after_move_from(karel_instance.direction,*world_instance.karel)\n world_instance.karel=[x,y]\n debug_command('MOVE')\n end",
"def move_to(xx, yy)\n @x = xx\n @y = yy\n normalize\n end",
"def move(x, y, width = -1, height = -1)\n Window.functions[__method__] ||= AU3_Function.new(\"WinMove\", 'SSLLLL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, x, y, width, height)\n nil\n end",
"def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if movetype == :shortcastle or movetype ==:longcastle\r\n move_castle(start_item, end_item)\r\n elsif movetype == :enpassant\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n else\r\n BoardInfoItem.exchange(start_item, end_item)\r\n end\r\n @last_moved_item = end_item\r\n \r\n end",
"def move_to(x, y)\n super(x, y)\n update_memory!(self.memory)\n end",
"def valid_move?(new_x, new_y)\n true\n end",
"def move_to (x, y)\n @x, @y = x, y\n end",
"def moveTo x, y\n\n\tend",
"def move_to(id, x, y, w=false, no_t = false)\n RME::deprecated_command(\"move_to\", \"use 'event_move_to' or 'player_move_to'\")\n event(id).move_to_position(x, y, w, no_t)\n end",
"def second_move() \r\n\t\tif first_move == false && board[4].class = Fixnum\r\n\t\t\tboard[4] = marker\r\n\t\telse\r\n\t\t\tcorner\r\n\t\tend\r\n\tend",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def move(start_pos, end_pos)\n return false unless valid_move?(start_pos, end_pos)\n\n moving_piece = piece_at(start_pos)\n\n @grid[end_pos[0]][end_pos[1]] = moving_piece\n @grid[start_pos[0]][start_pos[1]] = nil\n\n moving_piece.moved = true if moving_piece.is_a?(Pawn)\n true\n end",
"def slide_move!(end_pos)\n board[end_pos] = self\n board.set_to_empty(self.pos)\n self.pos = end_pos\n end",
"def move_window_to(point_x, point_y)\n driver.manage.window.move_to(point_x, point_y)\n end",
"def move_cursor(input)\n\n if input == 'w'\n dx,dy = [-1,0]\n elsif input == 's'\n dx,dy = [1,0]\n elsif input == 'a'\n dx,dy = [0,-1]\n elsif input == 'd'\n dx,dy = [0,1]\n elsif input == 'q'\n exit\n end\n\n\n x, y = [cursor[0] + dx, cursor[1] + dy]\n #returns cursor position, doesn't return a new cursor UNLESS x, and y are between 0 and 7, valid board spaces\n self.cursor = ([x, y].all? { |i| i.between?(0, 7) } ? [x, y] : self.cursor)\n end",
"def move!(end_pos)\n board.remove_piece(pos)\n\n if (pos[0] - end_pos[0]).abs == 2\n board.remove_piece(jumped_place(end_pos))\n end\n\n self.pos = end_pos\n board.place_piece(self, end_pos)\n\n maybe_promote\n end",
"def second_move() \n\t\tif first_move == false && board[4].class = Fixnum\n\t\t\tboard[4] = marker\n\t\telse\n\t\t\tcorner\n\t\tend\n\tend",
"def move(current_position, desired_square)\n board.move(current_position, desired_square, current_player)\n end",
"def move_onto(a, b)\n reveal(a)\n reveal(b)\n move_single(a, b)\n end",
"def space_available?(board, move)\n board[move.to_i] == \"\"\n end",
"def move\n return false if @position.nil?\n \n movements = { north: { x: 0, y: 1 }, east: { x: 1, y: 0 }, south: { x: 0, y: -1 }, west: { x: -1, y: 0 } }\n position, movement = @position, movements[@direction]\n\n return false unless valid_position?(position[:x] + movement[:x], position[:y] + movement[:y])\n \n @position = { x: position[:x] + movement[:x], y: position[:y] + movement[:y] }\n true\n end",
"def move\n start_show_thinking\n @board.move(best_moves.first)\n stop_show_thinking\n board.last_move\n end",
"def move(board, position)\n board.place_move(position, @play_symbol)\n end",
"def move\n return false unless on_the_table?\n\n next_x, next_y = facing.next_move_position(x, y)\n unless falls_off?(next_x, next_y)\n self.x = next_x\n self.y = next_y\n true\n else\n false\n end\n end",
"def do_move()\n\n loop do\n # prompt or retreive for initial position\n if @first_move\n initialPos = prompt_for_postion(\"[#{@name}] Initial position: \")\n else\n initialPos = @last_location\n end\n\n # prompt for new position\n newPos = prompt_for_postion(\"[#{@name}] New position: \")\n\n # complete action using positions\n action = @current_board.action(newPos, initialPos, @colour)\n\n # respond to action result\n case (action)\n when :E, :P\n @first_move = true\n @last_location = [0,0]\n return action\n when :A, :W\n @last_location = newPos\n @first_move = false\n return action\n end\n end\n end",
"def move(pos1, pos2)\n begin\n p = self[pos1]\n if p\n @moves = p\n @target = self[pos2]\n elsif moves(pos2)\n self[pos1], self[pos2] = self[pos2], self[pos1]\n p\n end\n end\n end",
"def move(position_from, position_to, color)\n if valid?(position_from, position_to, color)\n self[position_from].move!(position_to)\n end\n end",
"def move_to!(new_x, new_y, real_move = true)\n return false unless game.current_player == color\n return false unless valid_move?(new_x, new_y)\n\n if (destination_piece = game.piece_at(new_x, new_y))\n return capture_piece!(new_x, new_y, destination_piece, real_move)\n end\n\n update_piece_attributes(new_x, new_y, real_move)\n end",
"def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend",
"def move(left, top)\n # no-op\n end",
"def move(to,board)\n if self.legal?(to,board)\n @coords = to\n @moved = true\n else\n return false\n end\n end",
"def move_home_x\n $status.info_target_x = 0\n execute_command('F11', true, false)\n end",
"def user_move(one,two,some_array) \n include FormatBoard\n \n if some_array[one][two] == nil\n some_array[one][two] = 1\n\t puts;puts;puts;center2;print \" \";print \"YOUR MOVE\"\n puts;center2;print \" \";5.times{print \"_ \"}\n\t \n else\n puts \"That space is already taken. Pick somewhere else.\"\n\tnew_input_array = prompt_for_move\n\tnew_row = new_input_array[0].to_i - 1\n\tnew_col = new_input_array[1].to_i - 1\n\tuser_move(new_row,new_col,some_array)\n end\n \n some_array\nend",
"def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end",
"def set_position\n if params[:new_position].present? and params[:old_position].present?\n Top.update_position(params[:new_position], params[:old_position])\n head :ok\n else\n head :bad_request\n end\n end",
"def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend",
"def move(s, x, y, isTextMode)\n if isTextMode\n puts \"# move(sp, #{x}, #{y})\"\n puts \"PA#{x.to_i()},#{y.to_i()};\"\n else\n s.puts \"PA#{x.to_i()},#{y.to_i()};\"\n end\nend",
"def move_to(x, y); puts \"\\e[#{y};#{x}G\" end",
"def player_turn\n begin\n puts \"Please choose a space (1 - 9)\"\n player_move = gets.chomp.to_i\n end until player_move.class == Fixnum && ((1..9).to_a).include?(player_move) && @active_spaces[player_move] == \" \"\n self.active_spaces[player_move] = \"X\"\n puts \"You chose space #{player_move}!\"\n game_board.show_board\n end",
"def make_move start_pos, end_pos\n piece = get_board_piece(start_pos)\n @board[end_pos[0]][end_pos[1]] = piece\n piece.position = end_pos\n @board[start_pos[0]][start_pos[1]] = nil\n end",
"def move_to(x, y)\n object.x = x\n object.y = y\n end",
"def standard_move?(x_des, y_des)\n y_chg = (y_des.to_i - y_position).abs\n x_chg = (x_des.to_i - x_position).abs\n x_chg == 0 && ( y_chg == 1 ||\n ( first_move_pawn? && move_forward_two?(x_des, y_des) ) )\n end",
"def move\n if $window.button_down?(Gosu::KbD)\n @facing = :right\n @x += speed unless out_of_bounds?(@x + speed, @y)\n end\n \n if $window.button_down?(Gosu::KbA)\n @facing = :left\n @x -= speed unless out_of_bounds?(@x - speed, @y)\n end\n \n if $window.button_down?(Gosu::KbW)\n @facing = :up\n @y -= speed unless out_of_bounds?(@x, @y - speed)\n end\n \n if $window.button_down?(Gosu::KbS)\n @facing = :down\n @y += speed unless out_of_bounds?(@x, @y + speed)\n end\n \n sprinting?\n end",
"def move(board, position , player= \"X\" )\n\tposition = position.to_i\n\tboard[position -1] = player\n\tdisplay_board(board)\nend",
"def moveto(x, y)\n super(x, y)\n @move_update.clear\n end",
"def move(x_pos, y_pos, type)\n # convert y_pos and x_pos to proper array index integer!\n y_pos = y_pos.ord - 65\n x_pos = x_pos.to_i - 1\n\n # inputs move of type Z at X,Y (if not illegal!)\n return false unless @board[x_pos][y_pos].type == TYPE_EMPTY\n\n @board[x_pos][y_pos].type = type\n true\n end",
"def move( x, y=nil )\n self.dup.move!(x, y)\n end"
] | [
"0.79717374",
"0.77973783",
"0.73388463",
"0.6965127",
"0.69021106",
"0.6571451",
"0.6274849",
"0.6184589",
"0.61284095",
"0.61111426",
"0.6009155",
"0.5993963",
"0.5879582",
"0.58258116",
"0.5806621",
"0.57327735",
"0.572874",
"0.5727635",
"0.5725887",
"0.5724171",
"0.5708598",
"0.56966805",
"0.5689544",
"0.56781673",
"0.5674063",
"0.5674063",
"0.56462985",
"0.5638101",
"0.5637333",
"0.5588693",
"0.55840784",
"0.55776906",
"0.5570967",
"0.5564168",
"0.55625373",
"0.5548135",
"0.55437034",
"0.5543206",
"0.5539321",
"0.550743",
"0.5503155",
"0.54994184",
"0.54959136",
"0.5492861",
"0.5490476",
"0.54870105",
"0.548371",
"0.54659563",
"0.54626095",
"0.5458736",
"0.5455116",
"0.5434621",
"0.5429325",
"0.54226834",
"0.54207027",
"0.5396195",
"0.53825045",
"0.5375211",
"0.5369049",
"0.53668064",
"0.53664774",
"0.5365137",
"0.5357941",
"0.5352361",
"0.53461546",
"0.5320893",
"0.531611",
"0.5313452",
"0.53102225",
"0.5300437",
"0.5296345",
"0.529496",
"0.52873784",
"0.52827334",
"0.5280474",
"0.52802753",
"0.5272111",
"0.52667016",
"0.5259584",
"0.5259044",
"0.5250724",
"0.5248746",
"0.52455646",
"0.5243721",
"0.52401257",
"0.52284956",
"0.5222559",
"0.521855",
"0.5214391",
"0.52143383",
"0.52109355",
"0.52081203",
"0.520451",
"0.519825",
"0.51951814",
"0.5194846",
"0.5191905",
"0.5189477",
"0.51819825",
"0.517953"
] | 0.8166593 | 0 |
Add desktops There can be at most 16 desktops unless the display has collected some when a secondary display has been unplugged. Returns true on success, false if number_to_add was zero, or would result in more than 16 desktops. The on_layout_change notification will be sent if a changed was made. TotalSpaces2.add_desktops(1) | def add_desktops(number_to_add)
TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def desktops\n @desktops ||= if available?\n Libatspi.get_desktop_count.times.map do |idx|\n Desktop.new(Libatspi.get_desktop(idx))\n end\n else\n []\n end\n end",
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def cmd_setdesktop(*args)\n\t\tif(args.length == 0)\n\t\t\tprint_line(\"Usage: setdesktop [workstation\\\\\\\\desktop]\")\n\t\t\treturn\n\t\tend\n\t\t\n\t\tprint_line(\"Changing to desktop #{args[0]}\")\n\t\tclient.ui.set_desktop(*args)\n\t\treturn true\n\tend",
"def desktop?\n false # FIXME\n end",
"def desktop?\n true # Not nice, but if you're running desktopbrowser, assume running desktop\n end",
"def for_desktop?\n for_terminal == TerminalEnum.desktop\n end",
"def desktop?\n !is_mobile_device? && !is_tablet_device?\n end",
"def cmd_setdesktop( *args )\n\t\t\n\t\tswitch = false\n\t\tdsession = -1\n\t\tdstation = 'WinSta0'\n\t\tdname = 'Default'\n\t\t\n\t\tsetdesktop_opts = Rex::Parser::Arguments.new(\n\t\t\t\"-h\" => [ false, \"Help Banner.\" ],\n\t\t\t#\"-s\" => [ true, \"The session (Default: '#{dsession}')\" ],\n\t\t\t\"-w\" => [ true, \"The window station (Default: '#{dstation}')\" ],\n\t\t\t\"-n\" => [ true, \"The desktop name (Default: '#{dname}')\" ],\n\t\t\t\"-i\" => [ true, \"Set this desktop as the interactive desktop (Default: '#{switch}')\" ]\n\t\t)\n\t\t\n\t\tsetdesktop_opts.parse( args ) { | opt, idx, val |\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint_line( \"Usage: setdesktop [options]\\n\" )\n\t\t\t\t\tprint_line( \"Change the meterpreters current desktop.\" )\n\t\t\t\t\tprint_line( setdesktop_opts.usage )\n\t\t\t\t\treturn\n\t\t\t\t#when \"-s\"\n\t\t\t\t# dsession = val.to_i\n\t\t\t\twhen \"-w\"\n\t\t\t\t\tdstation = val\n\t\t\t\twhen \"-n\"\n\t\t\t\t\tdname = val\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tswitch = true if ( val =~ /^(t|y|1)/i )\n\t\t\tend\n\t\t}\n\t\t\n\t\tif( client.ui.set_desktop( dsession, dstation, dname, switch ) )\n\t\t\tprint_line( \"#{ switch ? 'Switched' : 'Changed' } to desktop #{dstation}\\\\#{dname}\" )\n\t\telse\n\t\t\tprint_line( \"Failed to #{ switch ? 'switch' : 'change' } to desktop #{dstation}\\\\#{dname}\" )\n\t\tend\n\t\t\n\t\treturn true\n\tend",
"def add_screening(new_screening:)\n raise 'cannot add overlaping screening' if overlaps?(new_screening)\n Screening.create(new_screening)\n end",
"def IsGraphicalDesktop\n # Get patterns set for installation during desktop selection\n # (see DefaultDesktop::packages_proposal_ID_patterns for the first argument)\n pt = PackagesProposal.GetResolvables(\"DefaultDesktopPatterns\", :pattern)\n Builtins.contains(pt, \"x11\")\n end",
"def desktop_request?\n !mobile_request?\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def test_default\n w = Window_ItemDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end",
"def add_screens(screenarray)\n @sequence += screenarray\n end",
"def test_default\n w = Window_EquipDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end",
"def test_default\n w = Window_Scrollable.new(0,0,640,96)\n @windows.push(w)\n return true\n end",
"def cmd_getdesktop(*args)\n\t\t\n\t\tdesktop = client.ui.get_desktop\n\t\t\n\t\tsession = desktop['session'] == 0xFFFFFFFF ? '' : \"Session #{desktop['session'].to_s}\\\\\"\n\t\t\n\t\tprint_line( \"#{session}#{desktop['station']}\\\\#{desktop['name']}\" )\n\t\t\n\t\treturn true\n\tend",
"def append_width(required_col)\n diff = required_col - @screen_size[1] + 1\n @screen.each.with_index do |row, i|\n @screen[i] = row + Array.new(diff)\n end\n @screen_size[1] += diff\n end",
"def screen_size=(new_screen_size)\n\t try_set_screen\n Klass.setScreenSize(@handle, Phidgets::FFI::TextLCDScreenSizes[new_screen_size])\n\t \n\t load_rows(@index) #readjust screen rows\n new_screen_size\n end",
"def open_desktop\n Log.add_info(request, params.inspect)\n\n user = @login_user\n\n is_config_desktop = false\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n is_config_desktop = true\n end\n\n @toys = Toy.get_for_user(user)\n\n if is_config_desktop\n @toys.delete_if {|toy|\n ret = false\n if toy.xtype == Toy::XTYPE_FOLDER\n begin\n folder = Folder.find(toy.target_id)\n ret = folder.my_folder?\n rescue\n end\n elsif toy.xtype == Toy::XTYPE_POSTLABEL\n ret = true\n end\n ret == true\n }\n end\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n @ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n end\n\n @desktop = Desktop.get_for(user)\n\n render(:partial => 'ajax_get_desktop', :layout => false)\n end",
"def add_space(address, size)\n if size <= 0\n PEROBS.log.fatal \"Size (#{size}) must be larger than 0.\"\n end\n # The following check is fairly costly and should never trigger unless\n # there is a bug in the PEROBS code. Only use this for debugging.\n #if has_space?(address, size)\n # PEROBS.log.fatal \"The space with address #{address} and size \" +\n # \"#{size} can't be added twice.\"\n #end\n root.add_space(address, size)\n end",
"def init_vnc_screens(*names)\n nodes = names.size == 0 ? @nodes : @nodes.select { |name| names.include? name }\n if @vnc_initialized\n return false\n end\n address_array = nodes.map do |name, el|\n a = \"#{config[:opennebula_ip]}:#{5900 + el.id}\"\n debug \"Node address: #{a}\"\n a\n end\n if address_array.empty?\n return false\n end\n initVNCPool(*address_array)\n nodes.each_with_index do |(name, el), index|\n el.set_vnc_screen($VNC_SCREEN_POOL[index])\n end\n @vnc_initialized = true\n end",
"def dpms_screen_is_on?\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n result = `xset -q 2>&1`\n rescue Errno::ENOENT\n return :unknown\n end\n if ($?.exitstatus != 0)\n return :unknown\n end\n if result.include? \"Monitor is On\"\n return true\n elsif result.include? \"Monitor is Off\"\n return false\n else\n return :unknown\n end\n end",
"def add_measure(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_measure_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end",
"def add_screen(screenhash)\n s = Shellplay::Screen.new\n s.import(screenhash)\n @sequence << s\n end",
"def dpms_force_screen_on\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n `xset dpms force on`\n rescue Errno::ENOENT\n return false\n end\n if $?.exitstatus != 0\n return false\n end\n\n # Required if the screen was turned off with DPMS and the\n # screensaver has not been disabled:\n begin\n `xset s reset`\n rescue Errno::ENOENT #unlikely, but still...\n return false\n end\n if $?.exitstatus != 0\n return false\n end\n end",
"def add_physical_disks\n add_collection(physical_infra, :physical_disks) do |builder|\n builder.add_properties(\n :manager_ref => %i(physical_storage ems_ref),\n :manager_ref_allowed_nil => %i(ems_ref)\n )\n end\n end",
"def add_or_update(monitor)\n @monitors[monitor.monitor_instance_id] = monitor\n end",
"def mini?\n (screen_size == Deliver::AppScreenshot::ScreenSize::IOS_35)\n end",
"def create_optional_windows\n @macmm_optional_windows = []\n $game_system.macmm_optional_windows.reverse.each { |sym|\n cw = MA_CustomizableMenu::CUSTOM_WINDOWS[sym]\n if cw.nil?\n manual_custom_window(sym)\n else\n auto_custom_window(sym)\n end\n }\n end",
"def windows?\n @windows\n end",
"def any_space?(volume_to_add)\n if current_space > volume_to_add.to_i\n true\n else\n puts 'Can\\'t add parcel. Too Big'\n false\n end\n end",
"def insert_mounted_app(mounter)\n Padrino.mounted_apps.push(mounter) unless Padrino.mounted_apps.include?(mounter)\n end",
"def screen(screen_id, &blk)\n screen = Nimo::Screen.new(screen_id, @game_window, @resources)\n screen.instance_eval(&blk) if block_given?\n @game_window.add_screen(screen_id, screen)\n end",
"def monitor_apps(startup_check = false)\n # Always reset\n @mem_usage = 0\n VCAP::Component.varz[:running_apps] = []\n\n if (no_monitorable_apps? && !startup_check)\n EM.add_timer(MONITOR_INTERVAL) { monitor_apps(false) }\n return\n end\n\n pid_info = {}\n user_info = {}\n start = Time.now\n\n # BSD style ps invocation\n ps_start = Time.now\n process_statuses = `ps axo pid=,ppid=,pcpu=,rss=,user=`.split(\"\\n\")\n ps_elapsed = Time.now - ps_start\n @logger.warn(\"Took #{ps_elapsed}s to execute ps. (#{process_statuses.length} entries returned)\") if ps_elapsed > 0.25\n process_statuses.each do |process_status|\n parts = process_status.lstrip.split(/\\s+/)\n pid = parts[PID_INDEX].to_i\n pid_info[pid] = parts\n (user_info[parts[USER_INDEX]] ||= []) << parts if (@secure && parts[USER_INDEX] =~ SECURE_USER)\n end\n\n # This really, really needs refactoring, but seems like the least intrusive/failure-prone way\n # of making the du non-blocking in all but the startup case...\n du_start = Time.now\n if startup_check\n du_all_out = `cd #{@apps_dir}; du -sk * 2> /dev/null`\n monitor_apps_helper(startup_check, start, du_start, du_all_out, pid_info, user_info)\n else\n du_proc = proc do |p|\n p.send_data(\"cd #{@apps_dir}\\n\")\n p.send_data(\"du -sk * 2> /dev/null\\n\")\n p.send_data(\"exit\\n\")\n end\n\n cont_proc = proc do |output, status|\n monitor_apps_helper(startup_check, start, du_start, output, pid_info, user_info)\n end\n\n EM.system('/bin/sh', du_proc, cont_proc)\n end\n end",
"def add_to_host\n raise \"Unknown guest host! You must set current_host_id before creating\" unless current_host_id > 0\n user = User.find(current_host_id) # Raise error if not found\n user.add_guest(self, @circle)\n self.is_emergency_contact_for(user) if @emergency_contact\n true\n end",
"def update!(**args)\n @distinct_screens = args[:distinct_screens] if args.key?(:distinct_screens)\n @screen_ids = args[:screen_ids] if args.key?(:screen_ids)\n end",
"def update!(**args)\n @distinct_screens = args[:distinct_screens] if args.key?(:distinct_screens)\n @screen_ids = args[:screen_ids] if args.key?(:screen_ids)\n end",
"def screen_is_on?\n dpms_screen_is_on?\n end",
"def add_menu_window(win, index = -1)\n remove_menu_window(win)\n $game_system.macmm_optional_windows.insert(index, win)\n end",
"def lock_screen\n print_status(\"Locking the desktop...\")\n lock_info = session.railgun.user32.LockWorkStation()\n if lock_info[\"GetLastError\"] == 0\n print_status(\"Screen has been locked\")\n else\n print_error(\"Screen lock failed\")\n end\n end",
"def update\n if @screen\n \n bar_length = @length\n \n if @length < 1\n bar_length = @length * 120\n end\n \n response = @screen.client.send_command( Command.new( \"widget_set #{@screen.id} #{self.id} #{@x} #{@y} \\\"#{bar_length}\\\"\" ) )\n \n if response.successful?\n @screen.client.add_message( \"Widget '#{@id}' was successfully updated\" )\n return true\n else\n @screen.client.add_message( \"Error: Widget '#{@id}' was NOT successfully updated (#{response.message})\" )\n return true\n end\n else\n @screen.client.add_message( \"Error: Cannot update Widget '#{@id}' until it is attached to a screen\" )\n return false\n end\n end",
"def resize_to_desktop\n page.driver.browser.manage.window.resize_to(1280, 743)\n end",
"def is_desktop_browser?\n !Handset.is_mobile? request.user_agent\n end",
"def AddMountPointsForWinParts(partitions, primary, max_prim, foreign_nr)\n partitions = deep_copy(partitions)\n return if !Arch.i386 && !Arch.ia64 && !Arch.x86_64\n\n foreign_ids = \"CDEFGHIJKLMNOPQRSTUVW\"\n\n Builtins.foreach(partitions) do |partition|\n new_partition = deep_copy(partition)\n fsid = Ops.get_integer(partition, \"fsid\", Partitions.fsid_native)\n partnum = 0\n if Builtins.haskey(partition, \"nr\") &&\n Ops.is_integer?(Ops.get(partition, \"nr\", 0))\n partnum = Ops.get_integer(partition, \"nr\", 0)\n end\n if !Builtins.haskey(partition, \"mount\") &&\n !Ops.get_boolean(partition, \"delete\", false) &&\n Ops.less_or_equal(partnum, max_prim) == primary &&\n Ops.less_than(foreign_nr.value, 24) &&\n Partitions.IsDosWinNtPartition(fsid) &&\n !Arch.ia64 &&\n !IsEfiPartition(partition) &&\n Ops.greater_or_equal(\n Ops.get_integer(partition, \"size_k\", 0),\n 1024 * 1024\n ) &&\n Builtins.contains(\n [:vfat, :ntfs],\n Ops.get_symbol(partition, \"used_fs\", :none)\n )\n Ops.set(\n new_partition,\n \"fstopt\",\n FileSystems.DefaultFstabOptions(partition)\n )\n if Builtins.contains(Partitions.fsid_dostypes, fsid)\n Ops.set(\n new_partition,\n \"mount\",\n Ops.add(\n \"/dos/\",\n Builtins.substring(foreign_ids, foreign_nr.value, 1)\n )\n )\n foreign_nr.value = Ops.add(foreign_nr.value, 1)\n else\n Ops.set(\n new_partition,\n \"mount\",\n Ops.add(\n \"/windows/\",\n Builtins.substring(foreign_ids, foreign_nr.value, 1)\n )\n )\n foreign_nr.value = Ops.add(foreign_nr.value, 1)\n end\n ChangeVolumeProperties(new_partition)\n Builtins.y2milestone(\"win part %1\", new_partition)\n end\n end\n\n nil\n end",
"def triple_density?\n (screen_size == Deliver::AppScreenshot::ScreenSize::IOS_55 || screen_size == Deliver::AppScreenshot::ScreenSize::IOS_58)\n end",
"def memory_mgmt_demo(screen, button)\n\n $instruct1 = screen.get_named_widget(\"Instruct1\")\n $instruct2 = screen.get_named_widget(\"Instruct2\")\n $instruct3 = screen.get_named_widget(\"Instruct3\")\n $instruct4 = screen.get_named_widget(\"Instruct4\")\n $instruct5 = screen.get_named_widget(\"Instruct5\")\n $instruct6 = screen.get_named_widget(\"Instruct6\")\n $instruct7 = screen.get_named_widget(\"Instruct7\")\n\n if (button == \"INFO\")\n \n display(\"CFS_KIT MEMORY_MGMT_DEMO_INFO_SCREEN\",500,50) \n\n elsif (button == \"NEXT\")\n \n $mmd_step += 1\n $mmd_demo = 0\n \n if ($mmd_step <= MMD_LAST_STEP)\n mmd_set_instruct_text($mmd_step)\n end\n\n case $mmd_step\n when 1\n display(\"CFS_KIT MEMORY_MGMT_SCREEN\",1500,50) \n display(\"MD DWELL_PKT_SCREEN\",50,50) \n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME MM, BITMASK 0x01\") # Enable debug events\n wait (1)\n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME MD, BITMASK 0x01\") # Enable debug events\n when 2..MMD_LAST_STEP\n # Keep case statement for maintenance\n else\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME MM, BITMASK 0x01\") # Disable debug events\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME MD, BITMASK 0x01\") # Disable debug events\n $mmd_step = 0\n clear(\"CFS_KIT MEMORY_MGMT_SCREEN\") \n clear(\"MD DWELL_PKT_SCREEN\") \n clear(\"CFS_KIT MEMORY_MGMT_DEMO_SCREEN\")\n clear(\"CFS_KIT MEMORY_MGMT_DEMO_INFO_SCREEN\")\n \n end # Step Case\n \n elsif (button == \"DEMO\")\n \n case $mmd_step\n\n # Lookup a symbol\n when 1\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"LOOKUP_SYMBOL with SYMBOL_NAME #{MMD_SYMBOL}\")\n # Don't increment mmd_demo; okay if user repeatedly sends lookup cmd\n end\n \n # Jam Dwell table and start a dwell\n when 2\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 1, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 2, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 3, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W2}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 4, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W3}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"SET_SIGNATURE with TABLE_ID 1, PAD_16 0, SIGNATURE 'Memory Management Demo'\")\n $mmd_demo += 1\n elsif ($mmd_demo == 1)\n Osk::flight.send_cmd(\"MD\",\"START_DWELL with TABLE_MASK 0x0001\")\n # Don't increment mmd_demo; okay if user repeatedly sends start dwell cmd. \n end\n\n # 3 - Poke, Peek, and dump in event \n when 3\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0x01020304, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0x05060708, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0X090A0B0C, ADDR_OFFSET #{MMD_OFFSET_W2}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0x0D0E0F10, ADDR_OFFSET #{MMD_OFFSET_W3}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n $mmd_demo += 1\n elsif ($mmd_demo == 1)\n Osk::flight.send_cmd(\"MM\",\"PEEK_MEM with DATA_SIZE 8, MEM_TYPE 1, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"PEEK_MEM with DATA_SIZE 16, MEM_TYPE 1, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"PEEK_MEM with DATA_SIZE 32, MEM_TYPE 1, ADDR_OFFSET #{MMD_OFFSET_W2}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n $mmd_demo += 1\n elsif ($mmd_demo == 2)\n Osk::flight.send_cmd(\"MM\",\"DUMP_IN_EVENT with MEM_TYPE 1, NUM_BYTES 8, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n # Don't increment mmd_demo and repeatedly send send dump in event. \n end\n\n # 4 - Dump memory to a file and transfer file to the ground\n when 4\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"DUMP_MEM_TO_FILE with MEM_TYPE 1, NUM_BYTES 16, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}, FILENAME #{MMD_FLT_PATH_FILENAME}\")\n $mmd_demo += 1\n elsif ($mmd_demo == 1)\n Osk::system.file_transfer.get(MMD_FLT_PATH_FILENAME,MMD_GND_PATH_FILENAME)\n # Don't increment mmd_demo; okay to repeat last command\n end\n\n # 5 - Display memory dump file using COSMOS table manager tool\n when 5\n if ($mmd_demo == 0)\n Cosmos.run_process(\"ruby tools/TableManager\")\n $mmd_demo += 1\n end\n\n # 6 - Fill memory with pattern from command\n when 6\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"FILL_MEM with MEM_TYPE 1, NUM_BYTES 8, FILL_PATTERN #{MMD_PAT_A0}, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n # Don't increment mmd_demo; okay to repeat last command\n end\n\n # 7 = Load memory from dump file to restore values\n when 7\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"LOAD_MEM_FROM_FILE with FILENAME #{MMD_FLT_PATH_FILENAME}\")\n # Don't increment mmd_demo; okay to repeat last command\n end\n end # Step Case\n end # Demo\n \nend",
"def g750_host? url\n return url.include? G750_HOST[:desktop]\n end",
"def add_container(name, dimensions, max_tower_count)\n container = Container.new(name, dimensions, (max_tower_count || :unlimited))\n\n pile = find_pile_for(container)\n\n if pile\n pile.add(container)\n else\n pile = Pile.new(@dimensions)\n pile.add(container)\n if pile_fits?(pile)\n @piles << pile\n else\n return false\n end\n end\n\n true\n end",
"def multiple_devices?\n\ttrue if devices.size > 1\nend",
"def get_screen_size\r\n #obtenemos el tamaño de la ventana\r\n data_size_device = adb_exec(\"shell wm size\")\r\n size = Array.new\r\n size_device = { :width => nil, :height => nil }\r\n\r\n#we scan the existing numbers and store them in an array\r\n for i in 0..(data_size_device.size - 1)\r\n p data_size_device[i].to_s\r\n if data_size_device[i].to_s.include? 'size'\r\n data_size_device[i].to_s.scan(/\\d+/) do |number|\r\n size.push number\r\n end\r\n break\r\n end\r\n end\r\n\r\n size_device = { :width => size[0].to_s.to_i, :height => size[1].to_s.to_i }\r\n\r\nrescue Exception => e\r\n raise \"get_screen_size => Could not get screen size.\\nException => #{e.message}\"\r\n\r\nend",
"def test_line_width\n w = Window_Selectable_Implemented.new(480,0,160,128,$data_items.compact, 24, true, 24)\n @windows.push(w)\n end",
"def add_multiple_screeners\n\n @notice = \"\"\n @screener_playlist = ScreenerPlaylist.find(params[:playlist_id])\n screener_ids = params[:screener_ids]\n\n screener_ids.each do |screener_id|\n @screener_playlist_item_position = ScreenerPlaylistItem.where(\"screener_playlist_id=?\", params[:playlist_id])\n .order(\"position ASC\")\n .find(:last)\n @screener_playlist_item_position = @screener_playlist_item_position.nil? ? 1 : @screener_playlist_item_position.position + 1\n @screener_playlist_item = ScreenerPlaylistItem.new(screener_playlist_id: params[:playlist_id],\n screener_id: screener_id,\n position: @screener_playlist_item_position)\n\n @screener_to_add = Screener.find(screener_id)\n if @screener_playlist_item.save\n flash[:notice] = 'Screeners were successfully added.'\n session[:screeners_search] = collection_to_id_array(@screener_playlist.screeners)\n end\n end # loop through video ids\n\n end",
"def grab_input_desktop\n\t\trequest = Packet.create_request('stdapi_ui_grab_input_desktop')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def init_desktop_js(registered_windows = [], options = {})\n user = options[:current_user] || \"Anonymous\"\n name = \"FirstWindow\"\n javascript_tag <<-_JS\n MyDesktop = new Ext.app.App({\n\tinit :function(){\n\t Ext.QuickTips.init();\n\t},\n\n\tgetModules : function(){\n\t return [\n\t #{build_window_lists(registered_windows)}\t\n\t ];\n\t},\n\n // config for the start menu\n getStartConfig : function(){\n return {\n title: '#{user}',\n iconCls: 'user',\n toolItems: [{\n text:'Konfigurasi',\n iconCls:'settings',\n\t handler : showMessage,\n scope:this\n },'-',{\n text:'Keluar',\n iconCls:'logout',\n\t handler: makeSureLogOut,\n scope:this\n }]\n };\n }\n });\n var windowIndex = 0; \n _JS\n end",
"def create\n @display = Display.new(display_params)\n screens_num = params[:split_in];\n # creamos las screens necesarias\n saved = @display.save\n \n create_screens(screens_num)\n\n respond_to do |format|\n if saved\n format.html { \n flash[:success]= 'Display was successfully created.' \n redirect_to displays_path \n }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_default\n w = Window_Confirmation.new(0,0,320,nil)\n @windows.push(w)\n return true\n end",
"def update_local_window_size(size); end",
"def padding_add!(size=4096)\n @metadata_blocks.each do |type|\n if type[0] == \"padding\"\n raise FlacInfoError, \"PADDING block exists. Use 'padding_resize!'\"\n end\n end\n build_padding_block(size) ? true : false\n end",
"def update_board\n if !sets_available?\n add_three_cards\n return true\n else\n return false\n end\n end",
"def test_default\n w = Window_SkillDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end",
"def can_make_new?(current_size)\n if @max_size > current_size\n @size[0] += 1\n end\n end",
"def add_devices(devices)\n log.info \"Adding additional devices: #{devices}\"\n devices.each do |kind, entries|\n entries.each do |entry|\n @driver.add_device(kind, entry)\n end\n end\n end",
"def input_add_wall\n if mouse_inside_grid?\n unless grid.walls.key?(cell_closest_to_mouse)\n grid.walls[cell_closest_to_mouse] = true\n reset_search\n end\n end\n end",
"def add_size (size)\n @size << size\n end",
"def add_window(id, x, y, width, height, **args)\n raise WindowError, \"Window #{id} already exists\" if @windows.key?(id)\n\n @windows[id] = Window.new(self, id, x, y, width, height, **args)\n end",
"def mkWins\n\t\tfreerows=4\n\t\t@apPanel=BoxedWin.new(nil,Ncurses.LINES-freerows,Ncurses.COLS/2,0,0,ATTR_NORMAL)\n\t\t@apListBox=ListBox.new(@apPanel)\n\t\t@entryPanel=BoxedWin.new(nil,Ncurses.LINES-freerows,Ncurses.COLS-Ncurses.COLS/2,0,Ncurses.COLS/2,ATTR_NORMAL)\n\t\t@entryListBox=ListBox.new(@entryPanel)\n\t\[email protected](false)\n\t\t@statusRow=WINDOW.new(1,Ncurses.COLS,Ncurses.LINES-freerows,0)\n\t\[email protected](ATTR_NORMAL); @statusRow.refresh\n\t\t@commandWin=BoxedWin.new(nil,freerows-1,Ncurses.COLS,Ncurses.LINES-freerows+1,0,ATTR_NORMAL)\n\t\t@active=@apListBox\n\n\t\[email protected]( \"Available Accesspoints\", :LEFT );\n\tend",
"def multipage_layouts=(value)\n @multipage_layouts = value\n end",
"def switch_windows\n tv = @form.by_name[\"tv\"]\n list = @form.by_name[\"mylist\"]\n if tv.col > 0\n tv.col = 0\n tmp = tv.width\n list.col = tmp + 1\n else\n list.col = 0\n tv.col = list.width + 1\n end\nend",
"def update!(**args)\n @screen_dpi = args[:screen_dpi] if args.key?(:screen_dpi)\n @screen_height_px = args[:screen_height_px] if args.key?(:screen_height_px)\n @screen_shape = args[:screen_shape] if args.key?(:screen_shape)\n @screen_width_px = args[:screen_width_px] if args.key?(:screen_width_px)\n end",
"def add(page_layout)\n all\n if page_layout.is_a?(Array)\n @definitions += page_layout\n elsif page_layout.is_a?(Hash)\n @definitions << page_layout\n else\n raise TypeError\n end\n end",
"def add(page_layout)\n all\n if page_layout.is_a?(Array)\n @definitions += page_layout\n elsif page_layout.is_a?(Hash)\n @definitions << page_layout\n else\n raise TypeError\n end\n end",
"def windows_enabled=(value)\n @windows_enabled = value\n end",
"def check_for_mobile\n#\tuse_mobile_pages # For development only: controls if I see mobile or desktop version of a page. Uncomment line below for production.\n\tuse_mobile_pages unless desktop? # priority is to use a pages from the 'views_mobile' folder over those from the 'views' folder\n end",
"def setup\n group.each do |name, windows|\n next if options[:group] && name != options[:group]\n\n setup_session(name)\n\n windows.each_with_index do |win, i|\n setup_window(win, i)\n end\n\n add_command(:screen, 'select %s', screen_group.primary_pos)\n\n break\n end\n end",
"def register(w, after=nil)\n\t\t\t(after) ? (@windows.insert(@windows.index(after), w)) : (@windows << w)\n\t\tend",
"def copy_pad_to_win\n # check that we don't exceed other windows height/maxrow\n smr = smaxrow()\n # SHIT, this means the otherwin has to be a Pad, cannot be a window\n osw = @otherwin.width\n osh = @otherwin.height\n osh = @height if osh == 0 # root window has 0\n osw = @width if osw == 0 # root window has 0\n osmr = @otherwin.smaxrow() rescue osh # TRYING for windows\n osmc = @otherwin.smaxcol() rescue osw\n if smr >= osmr\n $log.debug \" adjusted smr from #{smr} to #{osmr} -1 causing issues in viewfooter\"\n smr = osmr-1 # XXX causing issues in viewport, wont print footer with this\n end\n if smr > @sheight + @top -1 -@pminrow # 2010-01-17 13:27 \n smr = @sheight + @top -1 -@pminrow \n $log.debug \" adjusted smr to #{smr} to prevent crash \"\n end\n smc = smaxcol()\n $log.debug \" SMC original = #{smc} \"\n if smc >= osmc\n smc = osmc-1\n smc = @width # XXX ??? THIS WAS WORKING< but throwing error in viewport case\n smc = [osmc-1, @width].min # yet another hack\n $log.debug \" SMC o-1 #{osmc-1} wdth #{@width}, smc #{smc} \"\n end\n ### XXX commented out since it doesn't let a comp print fully if widget expanded (splitpane)\n #smc = osw -1 if smc >= osw; # added 2009-11-02 17:01 for tabbedpanes\n\n # dang, this is coming up a lot. 2010-01-16 20:34 \n # the second scrollpane was one row too large in testsplit3a.rb\n if smr - @top > @padheight\n $log.debug \" fixing smr to padheight 2010-01-16 20:35 HOPE THIS DOESNT BREAK ANYTHING\"\n smr = @padheight\n end\n @pminrow = 0 if @pminrow < 0\n @pmincol = 0 if @pmincol < 0\n $log.debug \" COPYING #{self.name} to #{@otherwin.name} \"\n $log.debug \" calling copy pad #{@pminrow} #{@pmincol}, #{@top} #{@left}, #{smr} #{smc} self #{self.name} \"\n $log.debug \" calling copy pad H: #{@height} W: #{@width}, PH #{@padheight} PW #{@padwidth} WIN:#{@window} \"\n# $log.debug \" -otherwin target copy pad #{@otherwin.pminrow} #{@otherwin.pmincol}, #{@otherwin.top} #{@otherwin.left}, #{osmr} #{osmc} OTHERWIN:#{@otherwin.name} \"\n ret=\"-\"\n #if ret == -1\n#x XXX $log.debug \" #{ret} otherwin copy pad #{@otherwin.pminrow} #{@otherwin.pmincol}, #{@otherwin.top} #{@otherwin.left}, #{osmr} #{osmc} \"\n $log.debug \" #{ret} otherwin copy pad H: #{osh} W: #{osw}\"\n if @top >= osh\n $log.debug \" #{ret} ERROR top exceeds other ht #{@top} H: #{osh} \"\n end\n if @left >= osw\n $log.debug \" #{ret} ERROR left exceeds other wt #{@left} W: #{osw} \"\n end\n if smr >= osh\n $log.debug \" #{ret} ERROR smrow exceeds other ht #{smr} H: #{osh} \"\n smr = osh() -1 # testing 2010-01-31 21:47 , again 2010-02-05 20:22 \n end\n if smc >= osw\n $log.debug \" #{ret} ERROR smcol exceeds other wt #{smc} W: #{osw} \"\n end\n if smc - @left > @padwidth\n $log.debug \" #{ret} ERROR smcol - left exceeds padwidth #{smc}- #{@left} PW: #{@padwidth} \"\n end\n if smr - @top > @padheight\n $log.debug \" #{ret} ERROR smr - top exceeds padheight #{smr}- #{@top} PH: #{@padheight} \"\n end\n ret = @window.copywin(@otherwin.get_window,@pminrow,@pmincol, @top, @left, smr, smc, 0)\n $log.debug \" copywin ret #{ret} \"\n # 2010-01-11 19:42 one more cause of -1 coming is that padheight (actual height which never\n # changes unless pad increases) or padwidth is smaller than area being printed. Solution: increase \n # buffer by increasing widgets w or h. smc - left should not exceed padwidth. smr-top should not\n # exceed padheight\n #end\n @modified = false\n return ret\n end",
"def update_config\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @yaml = ApplicationHelper.get_config_yaml\n\n unless params[:desktop].blank?\n @yaml[:desktop] = Hash.new if @yaml[:desktop].nil?\n\n params[:desktop].each do |key, val|\n @yaml[:desktop][key] = val\n end\n ApplicationHelper.save_config_yaml(@yaml)\n end\n\n flash[:notice] = t('msg.update_success')\n render(:partial => 'ajax_user_before_login', :layout => false)\n end",
"def update_screen\n @screen.update()\n end",
"def show\n user = @login_user\n\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n end\n\n @desktop = Desktop.get_for(user)\n end",
"def add_size( size )\n\n @size << size\n\n end",
"def add_size( size )\n\n @size << size\n\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def update!(**args)\n @desktop_cwv = args[:desktop_cwv] if args.key?(:desktop_cwv)\n @desktop_display_url_is_https = args[:desktop_display_url_is_https] if args.key?(:desktop_display_url_is_https)\n @display_url_is_https = args[:display_url_is_https] if args.key?(:display_url_is_https)\n @mobile_cwv = args[:mobile_cwv] if args.key?(:mobile_cwv)\n end",
"def add(severity, message = nil, progname = nil, &block)\n severity ||= UNKNOWN\n\n # give up if no logdevs or if too low a severity\n return true if severity < @lowest_level || !(@logdevs.values.map { |ld| ld[:dev].nil? }.include?(false))\n\n # Set progname to nil unless it is explicitly specified\n progname ||= @progname\n if message.nil?\n if block_given?\n message = yield\n else\n message = progname\n progname = @progname\n end\n end\n\n # Sync time across the logs and output only if above the log level for that device\n msg = format_message(format_severity(severity), Time.now, progname, message)\n @logdevs.each do |name, ld|\n ld[:dev].write(msg) unless ld[:dev].nil? && ld[:level] <= severity\n end\n return true\n end",
"def insert(fingerprint)\n return false unless has_space?\n\n @slots.each do |slot|\n if slot.empty?\n slot.set(fingerprint)\n @filled = [(@filled + 1), 4].min\n return true\n end\n end\n\n false\n end",
"def map_displayed?(store, store_type)\n index = macys? ? 0 : store_index(store, store_type)\n map_containers_elements[index].visible?\n end",
"def horizontals_push\n @htop += 1\n end",
"def do_window_adjust( bytes_to_add )\n @window_size += bytes_to_add\n callback :window_adjust, self, bytes_to_add\n end",
"def rescreen\n\t\t\tsize = Screen.size\n\t\t\t@smap = Array.new(size[0]){ Array.new(size[1]) }\n\n\t\t\[email protected] do |s|\n\t\t\t\tself.add_static s\n\t\t\tend\n\n\t\t\t@map = @smap.dup\n\t\tend",
"def no_device?\n\ttrue if devices.size < 1\nend",
"def map_custom_windows_desktop_versions(desktop_version)\n server_version = Util.map_windows_version(desktop_version)\n\n # Windows desktop 10 officially maps to server 2016.\n # However, we don't test on server 2016 at this time, so we default to 2012r2\n server_version = \"2012r2\" if server_version == \"2016\"\n\n server_version\n end",
"def add\n\n # if the show doesn't already exist in the db, add and then create relation\n if Show.where(shid: params[:shID]).present? == false\n aShow = Show.new(shid: params[:shID], poster: params[:shPoster])\n aShow.save\n\n cUser = current_user\n cUser.shows << aShow\n cUser.save\n\n # if the show exists already in the db, check if it has a relation\n # with the user, and create the relation if not\n else\n aShow = Show.where(shid: params[:shID])[0]\n\n if current_user.show_ids.include?(aShow.id) == false\n cUser = current_user\n cUser.shows << aShow\n cUser.save\n end\n end\n\n end",
"def addItem(item)\n item_number = @list_size\n widest_item = self.WidestItem\n temp = ''\n have = 0\n\n if self.allocListArrays(@list_size, @list_size + 1) &&\n self.allocListItem(item_number, temp, have,\n if @numbers then item_number + 1 else 0 end,\n item)\n # Determine the size of the widest item.\n widest_item = [@item_len[item_number], widest_item].max\n\n self.updateViewWidth(widest_item)\n self.setViewSize(@list_size + 1)\n end\n end",
"def insideScreen(delta)\n ((@x + @image.width + delta) < $windowW and (@x - delta) > 0)\n end",
"def onScreen?\n return Squish::Object::exists(@symbolicName)\n end",
"def desktop_path\n path.join(\"bowline-desktop\")\n end",
"def smart_screen_enable_in_shell=(value)\n @smart_screen_enable_in_shell = value\n end"
] | [
"0.7062807",
"0.54731876",
"0.53513676",
"0.5337657",
"0.525137",
"0.51632684",
"0.49705702",
"0.48633435",
"0.48525223",
"0.48099914",
"0.47970316",
"0.4655567",
"0.46508253",
"0.45151818",
"0.44761214",
"0.4452858",
"0.44372815",
"0.44363898",
"0.44302163",
"0.4296588",
"0.4285998",
"0.4270521",
"0.42522034",
"0.42359385",
"0.4222633",
"0.41810596",
"0.41711238",
"0.41559592",
"0.41555092",
"0.41282177",
"0.40721253",
"0.40692943",
"0.4059737",
"0.40570998",
"0.40365028",
"0.40322858",
"0.4030521",
"0.4028948",
"0.40147707",
"0.40147707",
"0.40139675",
"0.40078366",
"0.40040207",
"0.39941788",
"0.3984965",
"0.3983839",
"0.39737958",
"0.39724898",
"0.39678732",
"0.39660123",
"0.39601162",
"0.39267617",
"0.39262533",
"0.39161503",
"0.39122707",
"0.39013466",
"0.3897086",
"0.3886699",
"0.3885798",
"0.38802123",
"0.38695398",
"0.3868666",
"0.38683915",
"0.38622636",
"0.38521358",
"0.38500953",
"0.3846772",
"0.38454318",
"0.3840196",
"0.3834722",
"0.3829294",
"0.38281864",
"0.3821603",
"0.3821603",
"0.38142753",
"0.38104725",
"0.3796734",
"0.3793677",
"0.37855214",
"0.37821496",
"0.3780561",
"0.3773927",
"0.37664524",
"0.37664524",
"0.3766156",
"0.37640697",
"0.37616986",
"0.37613028",
"0.37584946",
"0.37570378",
"0.37525246",
"0.3752341",
"0.37498793",
"0.374944",
"0.37481427",
"0.3740657",
"0.37406385",
"0.37346134",
"0.37317652",
"0.3728659"
] | 0.74095416 | 0 |
Add desktops There can be at most 16 desktops unless the display has collected some when a secondary display has been unplugged. Returns true on success, false if number_to_add was zero, or would result in more than 16 desktops. The on_layout_change notification will be sent if a changed was made. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.add_desktops_on_display(1, display_id) | def add_desktops_on_display(number_to_add, display_id)
TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def desktops\n @desktops ||= if available?\n Libatspi.get_desktop_count.times.map do |idx|\n Desktop.new(Libatspi.get_desktop(idx))\n end\n else\n []\n end\n end",
"def cmd_setdesktop(*args)\n\t\tif(args.length == 0)\n\t\t\tprint_line(\"Usage: setdesktop [workstation\\\\\\\\desktop]\")\n\t\t\treturn\n\t\tend\n\t\t\n\t\tprint_line(\"Changing to desktop #{args[0]}\")\n\t\tclient.ui.set_desktop(*args)\n\t\treturn true\n\tend",
"def desktop?\n false # FIXME\n end",
"def desktop?\n true # Not nice, but if you're running desktopbrowser, assume running desktop\n end",
"def desktop?\n !is_mobile_device? && !is_tablet_device?\n end",
"def for_desktop?\n for_terminal == TerminalEnum.desktop\n end",
"def desktop_request?\n !mobile_request?\n end",
"def cmd_setdesktop( *args )\n\t\t\n\t\tswitch = false\n\t\tdsession = -1\n\t\tdstation = 'WinSta0'\n\t\tdname = 'Default'\n\t\t\n\t\tsetdesktop_opts = Rex::Parser::Arguments.new(\n\t\t\t\"-h\" => [ false, \"Help Banner.\" ],\n\t\t\t#\"-s\" => [ true, \"The session (Default: '#{dsession}')\" ],\n\t\t\t\"-w\" => [ true, \"The window station (Default: '#{dstation}')\" ],\n\t\t\t\"-n\" => [ true, \"The desktop name (Default: '#{dname}')\" ],\n\t\t\t\"-i\" => [ true, \"Set this desktop as the interactive desktop (Default: '#{switch}')\" ]\n\t\t)\n\t\t\n\t\tsetdesktop_opts.parse( args ) { | opt, idx, val |\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint_line( \"Usage: setdesktop [options]\\n\" )\n\t\t\t\t\tprint_line( \"Change the meterpreters current desktop.\" )\n\t\t\t\t\tprint_line( setdesktop_opts.usage )\n\t\t\t\t\treturn\n\t\t\t\t#when \"-s\"\n\t\t\t\t# dsession = val.to_i\n\t\t\t\twhen \"-w\"\n\t\t\t\t\tdstation = val\n\t\t\t\twhen \"-n\"\n\t\t\t\t\tdname = val\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tswitch = true if ( val =~ /^(t|y|1)/i )\n\t\t\tend\n\t\t}\n\t\t\n\t\tif( client.ui.set_desktop( dsession, dstation, dname, switch ) )\n\t\t\tprint_line( \"#{ switch ? 'Switched' : 'Changed' } to desktop #{dstation}\\\\#{dname}\" )\n\t\telse\n\t\t\tprint_line( \"Failed to #{ switch ? 'switch' : 'change' } to desktop #{dstation}\\\\#{dname}\" )\n\t\tend\n\t\t\n\t\treturn true\n\tend",
"def dpms_screen_is_on?\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n result = `xset -q 2>&1`\n rescue Errno::ENOENT\n return :unknown\n end\n if ($?.exitstatus != 0)\n return :unknown\n end\n if result.include? \"Monitor is On\"\n return true\n elsif result.include? \"Monitor is Off\"\n return false\n else\n return :unknown\n end\n end",
"def add_management_devices\n %i(physical_server\n physical_chassis\n physical_storage).each do |management_device_assoc|\n\n add_collection(physical_infra, \"#{management_device_assoc}_management_devices\".to_sym) do |builder|\n builder.add_properties(\n :model_class => ::GuestDevice,\n :manager_ref => %i(device_type hardware),\n :parent_inventory_collections => [management_device_assoc.to_s.pluralize.to_sym]\n )\n end\n end\n end",
"def IsGraphicalDesktop\n # Get patterns set for installation during desktop selection\n # (see DefaultDesktop::packages_proposal_ID_patterns for the first argument)\n pt = PackagesProposal.GetResolvables(\"DefaultDesktopPatterns\", :pattern)\n Builtins.contains(pt, \"x11\")\n end",
"def open_desktop\n Log.add_info(request, params.inspect)\n\n user = @login_user\n\n is_config_desktop = false\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n is_config_desktop = true\n end\n\n @toys = Toy.get_for_user(user)\n\n if is_config_desktop\n @toys.delete_if {|toy|\n ret = false\n if toy.xtype == Toy::XTYPE_FOLDER\n begin\n folder = Folder.find(toy.target_id)\n ret = folder.my_folder?\n rescue\n end\n elsif toy.xtype == Toy::XTYPE_POSTLABEL\n ret = true\n end\n ret == true\n }\n end\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n @ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n end\n\n @desktop = Desktop.get_for(user)\n\n render(:partial => 'ajax_get_desktop', :layout => false)\n end",
"def dpms_force_screen_on\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n `xset dpms force on`\n rescue Errno::ENOENT\n return false\n end\n if $?.exitstatus != 0\n return false\n end\n\n # Required if the screen was turned off with DPMS and the\n # screensaver has not been disabled:\n begin\n `xset s reset`\n rescue Errno::ENOENT #unlikely, but still...\n return false\n end\n if $?.exitstatus != 0\n return false\n end\n end",
"def create\n @display = Display.new(display_params)\n screens_num = params[:split_in];\n # creamos las screens necesarias\n saved = @display.save\n \n create_screens(screens_num)\n\n respond_to do |format|\n if saved\n format.html { \n flash[:success]= 'Display was successfully created.' \n redirect_to displays_path \n }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_screening(new_screening:)\n raise 'cannot add overlaping screening' if overlaps?(new_screening)\n Screening.create(new_screening)\n end",
"def add_or_update(monitor)\n @monitors[monitor.monitor_instance_id] = monitor\n end",
"def AddMountPointsForWinParts(partitions, primary, max_prim, foreign_nr)\n partitions = deep_copy(partitions)\n return if !Arch.i386 && !Arch.ia64 && !Arch.x86_64\n\n foreign_ids = \"CDEFGHIJKLMNOPQRSTUVW\"\n\n Builtins.foreach(partitions) do |partition|\n new_partition = deep_copy(partition)\n fsid = Ops.get_integer(partition, \"fsid\", Partitions.fsid_native)\n partnum = 0\n if Builtins.haskey(partition, \"nr\") &&\n Ops.is_integer?(Ops.get(partition, \"nr\", 0))\n partnum = Ops.get_integer(partition, \"nr\", 0)\n end\n if !Builtins.haskey(partition, \"mount\") &&\n !Ops.get_boolean(partition, \"delete\", false) &&\n Ops.less_or_equal(partnum, max_prim) == primary &&\n Ops.less_than(foreign_nr.value, 24) &&\n Partitions.IsDosWinNtPartition(fsid) &&\n !Arch.ia64 &&\n !IsEfiPartition(partition) &&\n Ops.greater_or_equal(\n Ops.get_integer(partition, \"size_k\", 0),\n 1024 * 1024\n ) &&\n Builtins.contains(\n [:vfat, :ntfs],\n Ops.get_symbol(partition, \"used_fs\", :none)\n )\n Ops.set(\n new_partition,\n \"fstopt\",\n FileSystems.DefaultFstabOptions(partition)\n )\n if Builtins.contains(Partitions.fsid_dostypes, fsid)\n Ops.set(\n new_partition,\n \"mount\",\n Ops.add(\n \"/dos/\",\n Builtins.substring(foreign_ids, foreign_nr.value, 1)\n )\n )\n foreign_nr.value = Ops.add(foreign_nr.value, 1)\n else\n Ops.set(\n new_partition,\n \"mount\",\n Ops.add(\n \"/windows/\",\n Builtins.substring(foreign_ids, foreign_nr.value, 1)\n )\n )\n foreign_nr.value = Ops.add(foreign_nr.value, 1)\n end\n ChangeVolumeProperties(new_partition)\n Builtins.y2milestone(\"win part %1\", new_partition)\n end\n end\n\n nil\n end",
"def test_default\n w = Window_ItemDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end",
"def add_measure(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_measure_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end",
"def cmd_getdesktop(*args)\n\t\t\n\t\tdesktop = client.ui.get_desktop\n\t\t\n\t\tsession = desktop['session'] == 0xFFFFFFFF ? '' : \"Session #{desktop['session'].to_s}\\\\\"\n\t\t\n\t\tprint_line( \"#{session}#{desktop['station']}\\\\#{desktop['name']}\" )\n\t\t\n\t\treturn true\n\tend",
"def add_physical_disks\n add_collection(physical_infra, :physical_disks) do |builder|\n builder.add_properties(\n :manager_ref => %i(physical_storage ems_ref),\n :manager_ref_allowed_nil => %i(ems_ref)\n )\n end\n end",
"def screen(screen_id, &blk)\n screen = Nimo::Screen.new(screen_id, @game_window, @resources)\n screen.instance_eval(&blk) if block_given?\n @game_window.add_screen(screen_id, screen)\n end",
"def screen_is_on?\n dpms_screen_is_on?\n end",
"def test_default\n w = Window_EquipDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end",
"def add_screen(screenhash)\n s = Shellplay::Screen.new\n s.import(screenhash)\n @sequence << s\n end",
"def g750_host? url\n return url.include? G750_HOST[:desktop]\n end",
"def display_show_interface\n Show.display_all_shows_lite\n puts \"There are #{Show.all.size} shows. Enter the number of the show you'd like to display\"\n usr_input = get_usr_input.to_i\n if usr_input <= Show.all.size\n disp_horiz_line\n Show.display_show(usr_input)\n disp_horiz_line\n end\n end",
"def lock_screen\n print_status(\"Locking the desktop...\")\n lock_info = session.railgun.user32.LockWorkStation()\n if lock_info[\"GetLastError\"] == 0\n print_status(\"Screen has been locked\")\n else\n print_error(\"Screen lock failed\")\n end\n end",
"def grab_input_desktop\n\t\trequest = Packet.create_request('stdapi_ui_grab_input_desktop')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def start\n @old_display = ENV['DISPLAY']\n ENV['DISPLAY'] = \":#{display}\"\n end",
"def monitor_apps(startup_check = false)\n # Always reset\n @mem_usage = 0\n VCAP::Component.varz[:running_apps] = []\n\n if (no_monitorable_apps? && !startup_check)\n EM.add_timer(MONITOR_INTERVAL) { monitor_apps(false) }\n return\n end\n\n pid_info = {}\n user_info = {}\n start = Time.now\n\n # BSD style ps invocation\n ps_start = Time.now\n process_statuses = `ps axo pid=,ppid=,pcpu=,rss=,user=`.split(\"\\n\")\n ps_elapsed = Time.now - ps_start\n @logger.warn(\"Took #{ps_elapsed}s to execute ps. (#{process_statuses.length} entries returned)\") if ps_elapsed > 0.25\n process_statuses.each do |process_status|\n parts = process_status.lstrip.split(/\\s+/)\n pid = parts[PID_INDEX].to_i\n pid_info[pid] = parts\n (user_info[parts[USER_INDEX]] ||= []) << parts if (@secure && parts[USER_INDEX] =~ SECURE_USER)\n end\n\n # This really, really needs refactoring, but seems like the least intrusive/failure-prone way\n # of making the du non-blocking in all but the startup case...\n du_start = Time.now\n if startup_check\n du_all_out = `cd #{@apps_dir}; du -sk * 2> /dev/null`\n monitor_apps_helper(startup_check, start, du_start, du_all_out, pid_info, user_info)\n else\n du_proc = proc do |p|\n p.send_data(\"cd #{@apps_dir}\\n\")\n p.send_data(\"du -sk * 2> /dev/null\\n\")\n p.send_data(\"exit\\n\")\n end\n\n cont_proc = proc do |output, status|\n monitor_apps_helper(startup_check, start, du_start, output, pid_info, user_info)\n end\n\n EM.system('/bin/sh', du_proc, cont_proc)\n end\n end",
"def test_default\n w = Window_Scrollable.new(0,0,640,96)\n @windows.push(w)\n return true\n end",
"def is_desktop_browser?\n !Handset.is_mobile? request.user_agent\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def add_to_host\n raise \"Unknown guest host! You must set current_host_id before creating\" unless current_host_id > 0\n user = User.find(current_host_id) # Raise error if not found\n user.add_guest(self, @circle)\n self.is_emergency_contact_for(user) if @emergency_contact\n true\n end",
"def init_desktop_js(registered_windows = [], options = {})\n user = options[:current_user] || \"Anonymous\"\n name = \"FirstWindow\"\n javascript_tag <<-_JS\n MyDesktop = new Ext.app.App({\n\tinit :function(){\n\t Ext.QuickTips.init();\n\t},\n\n\tgetModules : function(){\n\t return [\n\t #{build_window_lists(registered_windows)}\t\n\t ];\n\t},\n\n // config for the start menu\n getStartConfig : function(){\n return {\n title: '#{user}',\n iconCls: 'user',\n toolItems: [{\n text:'Konfigurasi',\n iconCls:'settings',\n\t handler : showMessage,\n scope:this\n },'-',{\n text:'Keluar',\n iconCls:'logout',\n\t handler: makeSureLogOut,\n scope:this\n }]\n };\n }\n });\n var windowIndex = 0; \n _JS\n end",
"def new_app_btn_display?\r\n make_sure_apps_page unless @driver.current_url =~ /.*apps.*/\r\n style = new_app_locator(:new_app_btn).attribute(\"style\")\r\n puts \"------style---> #{style} <-------------\"\r\n if style.chomp.include?(\"display: none;\")\r\n sleep 5\r\n puts \"+ <action> new_app_btn_display? NO\"\r\n return false\r\n end\r\n sleep 5\r\n puts \"+ <action> new_app_btn_display? YES\"\r\n return true\r\n end",
"def update_config\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @yaml = ApplicationHelper.get_config_yaml\n\n unless params[:desktop].blank?\n @yaml[:desktop] = Hash.new if @yaml[:desktop].nil?\n\n params[:desktop].each do |key, val|\n @yaml[:desktop][key] = val\n end\n ApplicationHelper.save_config_yaml(@yaml)\n end\n\n flash[:notice] = t('msg.update_success')\n render(:partial => 'ajax_user_before_login', :layout => false)\n end",
"def init_vnc_screens(*names)\n nodes = names.size == 0 ? @nodes : @nodes.select { |name| names.include? name }\n if @vnc_initialized\n return false\n end\n address_array = nodes.map do |name, el|\n a = \"#{config[:opennebula_ip]}:#{5900 + el.id}\"\n debug \"Node address: #{a}\"\n a\n end\n if address_array.empty?\n return false\n end\n initVNCPool(*address_array)\n nodes.each_with_index do |(name, el), index|\n el.set_vnc_screen($VNC_SCREEN_POOL[index])\n end\n @vnc_initialized = true\n end",
"def add_devices(devices)\n log.info \"Adding additional devices: #{devices}\"\n devices.each do |kind, entries|\n entries.each do |entry|\n @driver.add_device(kind, entry)\n end\n end\n end",
"def dpms_force_screen_off\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n `xset dpms force off`\n rescue Errno::ENOENT\n return false\n end\n if $?.exitstatus == 0\n return true\n else\n return false\n end\n end",
"def screen_size=(new_screen_size)\n\t try_set_screen\n Klass.setScreenSize(@handle, Phidgets::FFI::TextLCDScreenSizes[new_screen_size])\n\t \n\t load_rows(@index) #readjust screen rows\n new_screen_size\n end",
"def add_screens(screenarray)\n @sequence += screenarray\n end",
"def unlock_desktop(unlock=true)\n\t\trequest = Packet.create_request('stdapi_ui_unlock_desktop')\n\t\trequest.add_tlv(TLV_TYPE_BOOL, unlock)\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def map_displayed?(store, store_type)\n index = macys? ? 0 : store_index(store, store_type)\n map_containers_elements[index].visible?\n end",
"def windows?\n @windows\n end",
"def resize_to_desktop\n page.driver.browser.manage.window.resize_to(1280, 743)\n end",
"def update!(**args)\n @desktop_cwv = args[:desktop_cwv] if args.key?(:desktop_cwv)\n @desktop_display_url_is_https = args[:desktop_display_url_is_https] if args.key?(:desktop_display_url_is_https)\n @display_url_is_https = args[:display_url_is_https] if args.key?(:display_url_is_https)\n @mobile_cwv = args[:mobile_cwv] if args.key?(:mobile_cwv)\n end",
"def createDisplaysList\n for x in 1..@numberOfFloors do\n @floorDisplaysList.append(Display.new(x, DisplayStatus::ON, x))\n # puts \"elevator#{@id} display floor #{@floorDisplaysList[x - 1].id} created\"\n end\n end",
"def memory_mgmt_demo(screen, button)\n\n $instruct1 = screen.get_named_widget(\"Instruct1\")\n $instruct2 = screen.get_named_widget(\"Instruct2\")\n $instruct3 = screen.get_named_widget(\"Instruct3\")\n $instruct4 = screen.get_named_widget(\"Instruct4\")\n $instruct5 = screen.get_named_widget(\"Instruct5\")\n $instruct6 = screen.get_named_widget(\"Instruct6\")\n $instruct7 = screen.get_named_widget(\"Instruct7\")\n\n if (button == \"INFO\")\n \n display(\"CFS_KIT MEMORY_MGMT_DEMO_INFO_SCREEN\",500,50) \n\n elsif (button == \"NEXT\")\n \n $mmd_step += 1\n $mmd_demo = 0\n \n if ($mmd_step <= MMD_LAST_STEP)\n mmd_set_instruct_text($mmd_step)\n end\n\n case $mmd_step\n when 1\n display(\"CFS_KIT MEMORY_MGMT_SCREEN\",1500,50) \n display(\"MD DWELL_PKT_SCREEN\",50,50) \n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME MM, BITMASK 0x01\") # Enable debug events\n wait (1)\n cmd(\"CFE_EVS ENA_APP_EVENT_TYPE with APP_NAME MD, BITMASK 0x01\") # Enable debug events\n when 2..MMD_LAST_STEP\n # Keep case statement for maintenance\n else\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME MM, BITMASK 0x01\") # Disable debug events\n cmd(\"CFE_EVS DIS_APP_EVENT_TYPE with APP_NAME MD, BITMASK 0x01\") # Disable debug events\n $mmd_step = 0\n clear(\"CFS_KIT MEMORY_MGMT_SCREEN\") \n clear(\"MD DWELL_PKT_SCREEN\") \n clear(\"CFS_KIT MEMORY_MGMT_DEMO_SCREEN\")\n clear(\"CFS_KIT MEMORY_MGMT_DEMO_INFO_SCREEN\")\n \n end # Step Case\n \n elsif (button == \"DEMO\")\n \n case $mmd_step\n\n # Lookup a symbol\n when 1\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"LOOKUP_SYMBOL with SYMBOL_NAME #{MMD_SYMBOL}\")\n # Don't increment mmd_demo; okay if user repeatedly sends lookup cmd\n end\n \n # Jam Dwell table and start a dwell\n when 2\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 1, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 2, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 3, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W2}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"JAM_DWELL with TABLE_ID 1, ENTRY_ID 4, FIELD_LEN 4, DELAY 1, ADDR_OFFSET #{MMD_OFFSET_W3}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MD\",\"SET_SIGNATURE with TABLE_ID 1, PAD_16 0, SIGNATURE 'Memory Management Demo'\")\n $mmd_demo += 1\n elsif ($mmd_demo == 1)\n Osk::flight.send_cmd(\"MD\",\"START_DWELL with TABLE_MASK 0x0001\")\n # Don't increment mmd_demo; okay if user repeatedly sends start dwell cmd. \n end\n\n # 3 - Poke, Peek, and dump in event \n when 3\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0x01020304, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0x05060708, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0X090A0B0C, ADDR_OFFSET #{MMD_OFFSET_W2}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"POKE_MEM with DATA_SIZE 32, MEM_TYPE 1, DATA 0x0D0E0F10, ADDR_OFFSET #{MMD_OFFSET_W3}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n $mmd_demo += 1\n elsif ($mmd_demo == 1)\n Osk::flight.send_cmd(\"MM\",\"PEEK_MEM with DATA_SIZE 8, MEM_TYPE 1, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"PEEK_MEM with DATA_SIZE 16, MEM_TYPE 1, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n Osk::flight.send_cmd(\"MM\",\"PEEK_MEM with DATA_SIZE 32, MEM_TYPE 1, ADDR_OFFSET #{MMD_OFFSET_W2}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n $mmd_demo += 1\n elsif ($mmd_demo == 2)\n Osk::flight.send_cmd(\"MM\",\"DUMP_IN_EVENT with MEM_TYPE 1, NUM_BYTES 8, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n # Don't increment mmd_demo and repeatedly send send dump in event. \n end\n\n # 4 - Dump memory to a file and transfer file to the ground\n when 4\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"DUMP_MEM_TO_FILE with MEM_TYPE 1, NUM_BYTES 16, ADDR_OFFSET #{MMD_OFFSET_W0}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}, FILENAME #{MMD_FLT_PATH_FILENAME}\")\n $mmd_demo += 1\n elsif ($mmd_demo == 1)\n Osk::system.file_transfer.get(MMD_FLT_PATH_FILENAME,MMD_GND_PATH_FILENAME)\n # Don't increment mmd_demo; okay to repeat last command\n end\n\n # 5 - Display memory dump file using COSMOS table manager tool\n when 5\n if ($mmd_demo == 0)\n Cosmos.run_process(\"ruby tools/TableManager\")\n $mmd_demo += 1\n end\n\n # 6 - Fill memory with pattern from command\n when 6\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"FILL_MEM with MEM_TYPE 1, NUM_BYTES 8, FILL_PATTERN #{MMD_PAT_A0}, ADDR_OFFSET #{MMD_OFFSET_W1}, ADDR_SYMBOL_NAME #{MMD_SYMBOL}\")\n # Don't increment mmd_demo; okay to repeat last command\n end\n\n # 7 = Load memory from dump file to restore values\n when 7\n if ($mmd_demo == 0)\n Osk::flight.send_cmd(\"MM\",\"LOAD_MEM_FROM_FILE with FILENAME #{MMD_FLT_PATH_FILENAME}\")\n # Don't increment mmd_demo; okay to repeat last command\n end\n end # Step Case\n end # Demo\n \nend",
"def show\n user = @login_user\n\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n end\n\n @desktop = Desktop.get_for(user)\n end",
"def insert_mounted_app(mounter)\n Padrino.mounted_apps.push(mounter) unless Padrino.mounted_apps.include?(mounter)\n end",
"def add\n\n # if the show doesn't already exist in the db, add and then create relation\n if Show.where(shid: params[:shID]).present? == false\n aShow = Show.new(shid: params[:shID], poster: params[:shPoster])\n aShow.save\n\n cUser = current_user\n cUser.shows << aShow\n cUser.save\n\n # if the show exists already in the db, check if it has a relation\n # with the user, and create the relation if not\n else\n aShow = Show.where(shid: params[:shID])[0]\n\n if current_user.show_ids.include?(aShow.id) == false\n cUser = current_user\n cUser.shows << aShow\n cUser.save\n end\n end\n\n end",
"def add_measure_from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end",
"def multiple_devices?\n\ttrue if devices.size > 1\nend",
"def smart_screen_enable_in_shell=(value)\n @smart_screen_enable_in_shell = value\n end",
"def move_to_space_on_display(space_number, display_id)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, display_id)\n end",
"def update_display_dates(display_dates = true)\n if @remote\n @spaces = Space.available_remote( @reservation.startdate, @reservation.enddate, session[:desired_type])\n else\n @spaces = Space.available( @reservation.startdate, @reservation.enddate, session[:desired_type])\n end\n @count = @spaces.size \n debug \"update_display_dates: #{@count} spaces available\"\n display_count = show_available?\n render :update do |page|\n if flash[:error]\n\tpage[:flash].replace_html flash[:error]\n\tflash[:error] = nil\n\tpage[:flash][:style][:color] = 'red'\n\tpage[:flash].visual_effect :highlight\n elsif flash[:warning]\n\tpage[:flash].replace_html flash[:warning]\n\tflash[:warning] = nil\n\tpage[:flash][:style][:color] = 'yellow'\n\tpage[:flash].visual_effect :highlight\n elsif flash[:notice]\n\tpage[:flash].replace_html flash[:notice]\n\tflash[:notice] = nil\n\tpage[:flash][:style][:color] = 'green'\n\tpage[:flash].visual_effect :highlight\n end\n page[:count].replace_html :partial => 'shared/count' if display_count\n page[:spaces].replace_html :partial => 'space_pulldown' if session[:express]\n page[:dates].replace_html :partial => 'shared/dates' if display_dates\n end\n end",
"def mini?\n (screen_size == Deliver::AppScreenshot::ScreenSize::IOS_35)\n end",
"def check_for_mobile\n#\tuse_mobile_pages # For development only: controls if I see mobile or desktop version of a page. Uncomment line below for production.\n\tuse_mobile_pages unless desktop? # priority is to use a pages from the 'views_mobile' folder over those from the 'views' folder\n end",
"def update!(**args)\n @distinct_screens = args[:distinct_screens] if args.key?(:distinct_screens)\n @screen_ids = args[:screen_ids] if args.key?(:screen_ids)\n end",
"def update!(**args)\n @distinct_screens = args[:distinct_screens] if args.key?(:distinct_screens)\n @screen_ids = args[:screen_ids] if args.key?(:screen_ids)\n end",
"def triple_density?\n (screen_size == Deliver::AppScreenshot::ScreenSize::IOS_55 || screen_size == Deliver::AppScreenshot::ScreenSize::IOS_58)\n end",
"def add_entry_to_filesystem_table(host, mount_name)\n fs_file = filesystem_file(host)\n fs_type = filesystem_type(host)\n\n case host['platform']\n when %r{aix}\n # NOTE: /dev/hd8 is the default jfs logging device on AIX.\n on(host, \"echo '/#{mount_name}:\\n dev = /dev/#{mount_name}\\n vfs = #{fs_type}\\n log = /dev/hd8' >> #{fs_file}\")\n when %r{el-|centos|fedora|sles|debian|ubuntu}\n # Correctly munge whitespaces in mountpoints\n munged_mount_name = mount_name.gsub(' ', '\\\\\\040')\n on(host, \"echo '/tmp/#{munged_mount_name} /#{munged_mount_name} #{fs_type} loop 0 0' >> #{fs_file}\")\n else\n # TODO: Add Solaris and OSX support, as per PUP-5201 and PUP-4823\n fail_test(\"Adding entries to the filesystem table on #{host['platform']} is not currently supported.\")\n end\n end",
"def create_optional_windows\n @macmm_optional_windows = []\n $game_system.macmm_optional_windows.reverse.each { |sym|\n cw = MA_CustomizableMenu::CUSTOM_WINDOWS[sym]\n if cw.nil?\n manual_custom_window(sym)\n else\n auto_custom_window(sym)\n end\n }\n end",
"def smart_screen_enable_in_shell\n return @smart_screen_enable_in_shell\n end",
"def cuisineaz_host? url\n return url.include? CUISINEAZ_HOST[:desktop]\n end",
"def onScreen?\n return Squish::Object::exists(@symbolicName)\n end",
"def important\n updates = fetch_updates\n updates\n .select { |update|\n @update_mgmt.important?(update)\n }.map { |update| # rubocop:disable Style/MultilineBlockChain\n WindowsUpdate.new(update)\n }\n end",
"def update_chat_desktop_notification_settings(update_chat_desktop_notification_settings_input_object, opts = {})\n update_chat_desktop_notification_settings_with_http_info(update_chat_desktop_notification_settings_input_object, opts)\n nil\n end",
"def server_devices_list\n if !ccl_active? or (session[:usertype] != \"admin\" and ccl_active?)\n dont_be_so_smart\n redirect_to :controller => \"callc\", :action => \"main\" and return false\n end\n @page_title = _('Server_devices')\n @page_icon = 'server.png'\n @help_link = \"http://wiki.kolmisoft.com/index.php/Multi_Server_support\"\n # ip_auth + server_devices.server_id is null + server_devices.server_id is not that server + not server device(which were created with server creation)\n @devices = Device.select(\"devices.*,server_devices.server_id AS serv_id\").joins(\"LEFT JOIN server_devices ON (server_devices.device_id = devices.id AND server_devices.server_id = #{params[:id].to_i}) LEFT JOIN users ON (users.id = devices.user_id)\").where(\"(host != 'dynamic' OR device_type != 'SIP') AND users.owner_id = #{current_user.id} AND server_devices.server_id is null AND user_id != -1 AND name not like 'mor_server_%'\").order(\"extension ASC\").all\n end",
"def update\n if @screen\n \n bar_length = @length\n \n if @length < 1\n bar_length = @length * 120\n end\n \n response = @screen.client.send_command( Command.new( \"widget_set #{@screen.id} #{self.id} #{@x} #{@y} \\\"#{bar_length}\\\"\" ) )\n \n if response.successful?\n @screen.client.add_message( \"Widget '#{@id}' was successfully updated\" )\n return true\n else\n @screen.client.add_message( \"Error: Widget '#{@id}' was NOT successfully updated (#{response.message})\" )\n return true\n end\n else\n @screen.client.add_message( \"Error: Cannot update Widget '#{@id}' until it is attached to a screen\" )\n return false\n end\n end",
"def append_width(required_col)\n diff = required_col - @screen_size[1] + 1\n @screen.each.with_index do |row, i|\n @screen[i] = row + Array.new(diff)\n end\n @screen_size[1] += diff\n end",
"def add_multiple_screeners\n\n @notice = \"\"\n @screener_playlist = ScreenerPlaylist.find(params[:playlist_id])\n screener_ids = params[:screener_ids]\n\n screener_ids.each do |screener_id|\n @screener_playlist_item_position = ScreenerPlaylistItem.where(\"screener_playlist_id=?\", params[:playlist_id])\n .order(\"position ASC\")\n .find(:last)\n @screener_playlist_item_position = @screener_playlist_item_position.nil? ? 1 : @screener_playlist_item_position.position + 1\n @screener_playlist_item = ScreenerPlaylistItem.new(screener_playlist_id: params[:playlist_id],\n screener_id: screener_id,\n position: @screener_playlist_item_position)\n\n @screener_to_add = Screener.find(screener_id)\n if @screener_playlist_item.save\n flash[:notice] = 'Screeners were successfully added.'\n session[:screeners_search] = collection_to_id_array(@screener_playlist.screeners)\n end\n end # loop through video ids\n\n end",
"def windows_update_for_business=(value)\n @windows_update_for_business = value\n end",
"def add(severity, message = nil, progname = nil, &block)\n severity ||= UNKNOWN\n\n # give up if no logdevs or if too low a severity\n return true if severity < @lowest_level || !(@logdevs.values.map { |ld| ld[:dev].nil? }.include?(false))\n\n # Set progname to nil unless it is explicitly specified\n progname ||= @progname\n if message.nil?\n if block_given?\n message = yield\n else\n message = progname\n progname = @progname\n end\n end\n\n # Sync time across the logs and output only if above the log level for that device\n msg = format_message(format_severity(severity), Time.now, progname, message)\n @logdevs.each do |name, ld|\n ld[:dev].write(msg) unless ld[:dev].nil? && ld[:level] <= severity\n end\n return true\n end",
"def display_w(*val)\n if val.empty?\n return @display_w\n else\n #raise ArgumentError \"display_h should be ... \" if val[0] ...\n oldvalue = @display_w\n @display_w = val[0]\n @display_w = [@display_w, @target_window.width - 2].min unless @target_window.width == 0\n $log.debug \"XXX:set display_w to #{@display_w} \"\n #fire_property_handler(:display_h, oldvalue, @display_h)\n end\n self\n end",
"def add_menu_window(win, index = -1)\n remove_menu_window(win)\n $game_system.macmm_optional_windows.insert(index, win)\n end",
"def get_screen_size\r\n #obtenemos el tamaño de la ventana\r\n data_size_device = adb_exec(\"shell wm size\")\r\n size = Array.new\r\n size_device = { :width => nil, :height => nil }\r\n\r\n#we scan the existing numbers and store them in an array\r\n for i in 0..(data_size_device.size - 1)\r\n p data_size_device[i].to_s\r\n if data_size_device[i].to_s.include? 'size'\r\n data_size_device[i].to_s.scan(/\\d+/) do |number|\r\n size.push number\r\n end\r\n break\r\n end\r\n end\r\n\r\n size_device = { :width => size[0].to_s.to_i, :height => size[1].to_s.to_i }\r\n\r\nrescue Exception => e\r\n raise \"get_screen_size => Could not get screen size.\\nException => #{e.message}\"\r\n\r\nend",
"def update_screen\n @screen.update()\n end",
"def update_pref\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n desktop = Desktop.get_for(@login_user, true)\n\n params[:desktop].delete(:user_id)\n\n desktop.update_attributes(params.require(:desktop).permit(Desktop::PERMIT_BASE))\n\n params.delete(:desktop)\n\n show\n render(:action => 'show')\n end",
"def update_board\n if !sets_available?\n add_three_cards\n return true\n else\n return false\n end\n end",
"def add_new_users(users)\n user = users.first\n wait_until_bus_section_load\n user_group_select.select(user.user_group) unless user.user_group.nil?\n storage_type_select.select(user.storage_type) unless user.storage_type.nil?\n storage_max_tb.type_text(user.storage_limit) unless user.storage_limit.nil?\n device_tb.type_text(user.devices) unless user.devices.nil?\n\n unless user.enable_stash.nil?\n if user.enable_stash.downcase.eql?('yes')\n enable_stash_cb.check\n else\n enable_stash_cb.uncheck\n end\n end\n\n users.each_index do |index|\n Log.debug \"##########adding the #{index} user\"\n find(:id, \"user#{index+1}_name\").type_text(users[index].name)\n find(:id, \"user#{index+1}_username\").type_text(users[index].email)\n add_user_btn.click if index != users.length-1\n end\n\n unless user.send_email.nil?\n if user.send_email.downcase.eql?('yes')\n send_emails_cb.check\n else\n send_emails_cb.uncheck\n end\n end\n\n submit_btn.click\n wait_until_bus_section_load\n end",
"def add_to_apps_network\n raise \"This method can only be called if apps_network_id is set\" unless apps_network_id\n visit \"#{TestChamber.target_url}/dashboard/tools/apps_network_association/#{apps_network_id}\"\n fill_in('app_ids', :with => id)\n click_button('Add')\n end",
"def windows_mobile?\n !!(ua =~ /Windows CE/)\n end",
"def try_set_screen\n\t\tif (Common.device_id(@handle).to_s == \"textlcd_adapter\")\n\t\t\tKlass.setScreen(@handle, @index)\n\t\tend\n\tend",
"def supports_window_functions?\n server_version >= 80400\n end",
"def test_default\n w = Window_Confirmation.new(0,0,320,nil)\n @windows.push(w)\n return true\n end",
"def in_latency_window\n if read_preference['mode'] == :secondary_preferred && primary\n return @in_latency_window.push(primary).uniq\n end\n @in_latency_window\n end",
"def no_device?\n\ttrue if devices.size < 1\nend",
"def update!(**args)\n @is_on_device_smart_home_supported = args[:is_on_device_smart_home_supported] if args.key?(:is_on_device_smart_home_supported)\n end",
"def windows?\n has_os? && !!os_image_type.match(/windows/i)\n end",
"def desktop_url(url = request.url)\n desktop_path(url)\n end",
"def windows_enabled=(value)\n @windows_enabled = value\n end",
"def allow_multi_install\n refresh\n @allow_multi_install\n end",
"def mass_add(data)\n result = @client.api_request(\n :method => \"template.massAdd\",\n :params => {\n :hosts => data[:hosts_id].map { |t| {:hostid => t} },\n :templates => data[:templates_id].map { |t| {:templateid => t} }\n }\n )\n result.empty? ? false : true\n end",
"def map_custom_windows_desktop_versions(desktop_version)\n server_version = Util.map_windows_version(desktop_version)\n\n # Windows desktop 10 officially maps to server 2016.\n # However, we don't test on server 2016 at this time, so we default to 2012r2\n server_version = \"2012r2\" if server_version == \"2016\"\n\n server_version\n end"
] | [
"0.7482838",
"0.61482394",
"0.569244",
"0.5281861",
"0.51685375",
"0.5076606",
"0.4891148",
"0.48880905",
"0.48796102",
"0.47549608",
"0.47183523",
"0.46594033",
"0.4594886",
"0.45712245",
"0.45316643",
"0.45222574",
"0.4403283",
"0.43503955",
"0.42971486",
"0.4292949",
"0.42608988",
"0.42379123",
"0.42373365",
"0.42131588",
"0.41877082",
"0.4175694",
"0.41640884",
"0.41620278",
"0.41554374",
"0.4149323",
"0.41433975",
"0.4118987",
"0.410929",
"0.41078347",
"0.41032743",
"0.40977538",
"0.40812775",
"0.40775093",
"0.40618607",
"0.40541238",
"0.40448093",
"0.40370783",
"0.4033362",
"0.40295404",
"0.40278256",
"0.40172508",
"0.39781353",
"0.39752218",
"0.39714056",
"0.39680967",
"0.39650977",
"0.39644754",
"0.39516282",
"0.39507106",
"0.3934955",
"0.39100298",
"0.39096585",
"0.39016747",
"0.38949397",
"0.3888465",
"0.38882264",
"0.38809615",
"0.38792688",
"0.3878237",
"0.3878237",
"0.3867231",
"0.38623494",
"0.38581762",
"0.38525054",
"0.38437763",
"0.38305888",
"0.3822863",
"0.38188863",
"0.3815082",
"0.38122892",
"0.38114718",
"0.3811226",
"0.3810405",
"0.3805693",
"0.38018122",
"0.38008547",
"0.37982002",
"0.37977752",
"0.37961218",
"0.37874818",
"0.3764709",
"0.37607762",
"0.3748411",
"0.37277818",
"0.3721643",
"0.37211975",
"0.3715709",
"0.37124154",
"0.37029585",
"0.3693694",
"0.3688444",
"0.36781216",
"0.36688793",
"0.36660054",
"0.36590505"
] | 0.77525324 | 0 |
Remove desktops The highest numbered desktops are removed. Removing a desktop you are currently on will result in TotalSpaces2 switching to another dektop. Any windows present on a desktop being removed will be moved to one of the remaining desktops. Returns true on success, false if number_to_remove was zero or would result in less than 1 desktop remaining. The on_layout_change notification will be sent if a change was made. TotalSpaces2.remove_desktops(1) | def remove_desktops(number_to_remove)
TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_desktops_on_display(number_to_remove, display_id)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)\n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def desktops\n @desktops ||= if available?\n Libatspi.get_desktop_count.times.map do |idx|\n Desktop.new(Libatspi.get_desktop(idx))\n end\n else\n []\n end\n end",
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def desktop?\n false # FIXME\n end",
"def desktop?\n true # Not nice, but if you're running desktopbrowser, assume running desktop\n end",
"def remove_window(id)\n window_exist?(id)\n @windows.delete(id)\n end",
"def remove_sliders\n size = @sliders.size\n @sliders.clear\n @dialog.execute_script(\"remove_sliders(); update_size();\") if @dialog\n size\n end",
"def remove_mobile_platform(value)\n @children['mobile-platform'][:value].delete(value)\n end",
"def cmd_setdesktop(*args)\n\t\tif(args.length == 0)\n\t\t\tprint_line(\"Usage: setdesktop [workstation\\\\\\\\desktop]\")\n\t\t\treturn\n\t\tend\n\t\t\n\t\tprint_line(\"Changing to desktop #{args[0]}\")\n\t\tclient.ui.set_desktop(*args)\n\t\treturn true\n\tend",
"def desktop?\n !is_mobile_device? && !is_tablet_device?\n end",
"def remove_bullets_of_screen args\n args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280\nend",
"def cmd_getdesktop(*args)\n\t\t\n\t\tdesktop = client.ui.get_desktop\n\t\t\n\t\tsession = desktop['session'] == 0xFFFFFFFF ? '' : \"Session #{desktop['session'].to_s}\\\\\"\n\t\t\n\t\tprint_line( \"#{session}#{desktop['station']}\\\\#{desktop['name']}\" )\n\t\t\n\t\treturn true\n\tend",
"def cmd_setdesktop( *args )\n\t\t\n\t\tswitch = false\n\t\tdsession = -1\n\t\tdstation = 'WinSta0'\n\t\tdname = 'Default'\n\t\t\n\t\tsetdesktop_opts = Rex::Parser::Arguments.new(\n\t\t\t\"-h\" => [ false, \"Help Banner.\" ],\n\t\t\t#\"-s\" => [ true, \"The session (Default: '#{dsession}')\" ],\n\t\t\t\"-w\" => [ true, \"The window station (Default: '#{dstation}')\" ],\n\t\t\t\"-n\" => [ true, \"The desktop name (Default: '#{dname}')\" ],\n\t\t\t\"-i\" => [ true, \"Set this desktop as the interactive desktop (Default: '#{switch}')\" ]\n\t\t)\n\t\t\n\t\tsetdesktop_opts.parse( args ) { | opt, idx, val |\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint_line( \"Usage: setdesktop [options]\\n\" )\n\t\t\t\t\tprint_line( \"Change the meterpreters current desktop.\" )\n\t\t\t\t\tprint_line( setdesktop_opts.usage )\n\t\t\t\t\treturn\n\t\t\t\t#when \"-s\"\n\t\t\t\t# dsession = val.to_i\n\t\t\t\twhen \"-w\"\n\t\t\t\t\tdstation = val\n\t\t\t\twhen \"-n\"\n\t\t\t\t\tdname = val\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tswitch = true if ( val =~ /^(t|y|1)/i )\n\t\t\tend\n\t\t}\n\t\t\n\t\tif( client.ui.set_desktop( dsession, dstation, dname, switch ) )\n\t\t\tprint_line( \"#{ switch ? 'Switched' : 'Changed' } to desktop #{dstation}\\\\#{dname}\" )\n\t\telse\n\t\t\tprint_line( \"Failed to #{ switch ? 'switch' : 'change' } to desktop #{dstation}\\\\#{dname}\" )\n\t\tend\n\t\t\n\t\treturn true\n\tend",
"def unmanage window\n if h=managed[window]\n h[:source_funcs].each do |sf|\n sf.remove()\n end\n \n managed.delete window\n end\n end",
"def IsGraphicalDesktop\n # Get patterns set for installation during desktop selection\n # (see DefaultDesktop::packages_proposal_ID_patterns for the first argument)\n pt = PackagesProposal.GetResolvables(\"DefaultDesktopPatterns\", :pattern)\n Builtins.contains(pt, \"x11\")\n end",
"def unlock_desktop(unlock=true)\n\t\trequest = Packet.create_request('stdapi_ui_unlock_desktop')\n\t\trequest.add_tlv(TLV_TYPE_BOOL, unlock)\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def input_remove_wall\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_inside_grid?\n if grid.walls.key?(cell_closest_to_mouse)\n grid.walls.delete(cell_closest_to_mouse)\n reset_search\n end\n end\n end",
"def for_desktop?\n for_terminal == TerminalEnum.desktop\n end",
"def remove(number=nil)\n raise UsageError, 'Must specify number from boxes list or hostname/IP address' if not number\n\n prev_count = remotes.size\n msg = 'Box '\n if number.is_a?(Integer) || number =~ /^\\d+$/\n index = number.to_i - 1\n remotes.boxes.delete_at(index)\n msg << (index + 1).to_s\n else\n remotes.remove(number)\n msg << \"with IP/host #{number}\"\n end\n msg << ' removed'\n\n if prev_count == remotes.size + 1\n remotes.store\n puts msg\n else\n puts \"Could not remove box: #{number}\"\n end\n end",
"def input_remove_wall\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_over_grid?\n if state.walls.key?(cell_closest_to_mouse) or state.hills.key?(cell_closest_to_mouse)\n state.walls.delete(cell_closest_to_mouse)\n state.hills.delete(cell_closest_to_mouse)\n reset_search\n end\n end\n end",
"def mass_remove(data)\n result = @client.api_request(\n :method => \"template.massRemove\",\n :params => {\n :hostids => data[:hosts_id],\n :templateids => data[:templates_id],\n :groupids => data[:group_id],\n :force => 1\n }\n )\n result.empty? ? false : true\n end",
"def input_remove_wall2\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_over_grid2?\n if state.walls.key?(cell_closest_to_mouse2) or state.hills.key?(cell_closest_to_mouse2)\n state.walls.delete(cell_closest_to_mouse2)\n state.hills.delete(cell_closest_to_mouse2)\n reset_search\n end\n end\n end",
"def open_desktop\n Log.add_info(request, params.inspect)\n\n user = @login_user\n\n is_config_desktop = false\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n is_config_desktop = true\n end\n\n @toys = Toy.get_for_user(user)\n\n if is_config_desktop\n @toys.delete_if {|toy|\n ret = false\n if toy.xtype == Toy::XTYPE_FOLDER\n begin\n folder = Folder.find(toy.target_id)\n ret = folder.my_folder?\n rescue\n end\n elsif toy.xtype == Toy::XTYPE_POSTLABEL\n ret = true\n end\n ret == true\n }\n end\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n @ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n end\n\n @desktop = Desktop.get_for(user)\n\n render(:partial => 'ajax_get_desktop', :layout => false)\n end",
"def unbind_resize_child_windows\n API.unbind \"\\\\\", @mash\nend",
"def mass_remove(data)\n result = @client.api_request(\n :method => \"template.massRemove\", \n :params => {\n :hosts => data[:hosts_id].map { |t| {:hostid => t} },\n :templates => data[:templates_id].map { |t| {:templateid => t} }\n }\n )\n result.empty? ? false : true \n end",
"def delete_unused_layout_slides_online(document, password = nil)\n data, _status_code, _headers = delete_unused_layout_slides_online_with_http_info(document, password)\n data\n end",
"def delete_unused_layout_slides(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = delete_unused_layout_slides_with_http_info(name, password, folder, storage)\n data\n end",
"def desktop_request?\n !mobile_request?\n end",
"def clear_shared_folders\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n if line =~ /^SharedFolderNameMachineMapping\\d+=\"(.+?)\"$/\n execute(\"sharedfolder\", \"remove\", @uuid, \"--name\", $1.to_s)\n end\n end\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/Skype')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/VLC'),\n ::File.expand_path('~/Library/Application Support/org.videolan.vlc')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def bc_remove_layout_1(bc, path, barclamp)\n filelist = File.join BARCLAMP_PATH, \"#{bc}-filelist.txt\"\n if File.exist? filelist \n files = [ filelist ]\n File.open(filelist, 'r') do |f|\n f.each_line { |line| files << line }\n end\n FileUtils.rm files\n merge_nav barclamp, false\n merge_sass barclamp, bc, path, false\n puts \"Barclamp #{bc} UNinstalled\" if DEBUG\n end\n end",
"def delete_index(display_number)\n @list.each_with_index do |display, i|\n if display_number == display.number\n @list[i..i] = []\n return true\n end\n end\n false\n end",
"def clear_shared_folders\n share_ids = read_shared_folders.keys\n share_ids.each do |id|\n execute_prlctl('set', @uuid, '--shf-host-del', id)\n end\n end",
"def cmd_unlockdesktop(*args)\n\t\tmode = 0\n\t\tif(args.length > 0)\n\t\t\tmode = args[0].to_i\n\t\tend\n\t\t\n\t\tif(mode == 0)\n\t\t\tprint_line(\"Unlocking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(true)\n\t\telse\n\t\t\tprint_line(\"Locking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(false)\t\n\t\tend\n\n\t\treturn true\n\tend",
"def cmd_unlockdesktop(*args)\n\t\tmode = 0\n\t\tif(args.length > 0)\n\t\t\tmode = args[0].to_i\n\t\tend\n\t\t\n\t\tif(mode == 0)\n\t\t\tprint_line(\"Unlocking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(true)\n\t\telse\n\t\t\tprint_line(\"Locking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(false)\t\n\t\tend\n\n\t\treturn true\n\tend",
"def deleteAllDevPartitions(disk, installation)\n disk = deep_copy(disk)\n go_on = true\n del_dev = Ops.get_string(disk, \"device\", \"\")\n Builtins.y2milestone(\n \"deleteAllDevPartitions disk:%1\",\n Builtins.remove(disk, \"partitions\")\n )\n\n #///////////////////////////////////////////////////////////////\n # check mount points if not installation\n\n if !installation\n mounts = Storage.mountedPartitionsOnDisk(del_dev)\n if Builtins.size(mounts) != 0\n #///////////////////////////////////////////////////////\n # mount points found\n\n mounted_parts = \"\"\n Builtins.foreach(mounts) do |mount|\n # %1 is replaced by device name, %1 by directory e.g /dev/hdd1 on /opt\n mounted_parts = Ops.add(\n Ops.add(\n mounted_parts,\n Builtins.sformat(\n \"%1 on %2\",\n Ops.get_string(mount, \"device\", \"\"),\n Ops.get_string(mount, \"mount\", \"\")\n )\n ),\n \"\\n\"\n )\n end\n\n # popup text, %1 is replaced by device name\n message = Builtins.sformat(\n _(\n \"The selected device contains partitions that are currently mounted:\\n\" +\n \"%1\\n\" +\n \"We *strongly* recommended to unmount these partitions before deleting the partition table.\\n\" +\n \"Choose Cancel unless you know exactly what you are doing.\\n\"\n ),\n mounted_parts\n )\n\n go_on = false if !Popup.ContinueCancel(message)\n end\n end\n\n if go_on\n partitions = Ops.get_list(disk, \"partitions\", [])\n\n used = check_devices_used(partitions, false)\n\n go_on = used == :UB_NONE\n\n if used == :UB_LVM\n # popup text, Do not translate LVM.\n Popup.Message(\n _(\n \"\\n\" +\n \"The selected device contains at least one LVM partition\\n\" +\n \"assigned to a volume group. Remove all\\n\" +\n \"partitions from their respective volume groups\\n\" +\n \"before deleting the device.\\n\"\n )\n )\n elsif used == :UB_MD\n # popup text, Do not translate RAID.\n Popup.Message(\n _(\n \"\\n\" +\n \"The selected device contains at least one partition\\n\" +\n \"that is part of a RAID system. Unassign the\\n\" +\n \"partitions from their respective RAID systems before\\n\" +\n \"deleting the device.\\n\"\n )\n )\n elsif used != :UB_NONE\n # popup text\n Popup.Message(\n _(\n \"\\n\" +\n \"The selected device contains at least one partition\\n\" +\n \"that is used by another volume. Delete the volume using it\\n\" +\n \"before deleting the device.\\n\"\n )\n )\n end\n\n if go_on && Ops.get_symbol(disk, \"type\", :CT_UNKNONW) != :CT_DMRAID\n #///////////////////////////////////////////////\n # delete all partitions of disk\n # logical partitions get removed when extended is deleted\n dp = Builtins.filter(partitions) do |part|\n Ops.less_or_equal(\n Ops.get_integer(part, \"nr\", 0),\n Ops.get_integer(disk, \"max_primary\", 4)\n )\n end\n Builtins.y2milestone(\"deleteAllDevPartitions dp:%1\", dp)\n dp = Builtins.sort(dp) do |a, b|\n Ops.greater_than(\n Ops.get_integer(a, \"nr\", 0),\n Ops.get_integer(b, \"nr\", 0)\n )\n end\n Builtins.y2milestone(\"deleteAllDevPartitions dp:%1\", dp)\n Builtins.foreach(dp) do |part|\n go_on = go_on &&\n Storage.DeleteDevice(Ops.get_string(part, \"device\", \"\"))\n end\n end\n end\n Builtins.y2milestone(\"deleteAllDevPartitions ret:%1\", go_on)\n go_on\n end",
"def ListView_RemoveAllGroups(hwnd) send_listview_message(hwnd, :REMOVEALLGROUPS) end",
"def remove_favorite_location\n\n if get_favorite_locations_array.empty?\n puts \"You don't have any Favorites! Why don't you add one?\"\n puts \"\\n\"\n location_menu\n else\n #delete a location from favorites\n prints_favorite_locations\n puts \"\\nPlease enter the location number you want to remove from Favorites:\"\n #get favorite location name\n favorite_to_remove = get_user_input.to_i\n #title page------\n title\n #end title page----\n\n if favorite_to_remove == 0 || favorite_to_remove > get_favorite_locations_array.length\n puts \"\\nPlease enter a number between 1 and #{get_favorite_locations_array.length}\"\n remove_favorite_location\n else\n location_name = get_favorite_locations_array[favorite_to_remove-1]\n #update start and end location in database with favorite\n StartLocation.where(name: location_name).update(favorite: false)\n EndLocation.where(name: location_name).update(favorite: false)\n puts \"Your favorite has been removed!\"\n end\n puts \"\\n\"\n view_favorite_locations\n end\n end",
"def remove_stale_data_containers\n containers_data_dir = File.join(device_data_dir, \"Containers\", \"Data\", \"Application\")\n apps = Dir.glob(\"#{containers_data_dir}/**/#{METADATA_PLIST}\")\n apps.each do |metadata_plist|\n if pbuddy.plist_read(\"MCMMetadataIdentifier\", metadata_plist) == app.bundle_identifier\n FileUtils.rm_rf(File.dirname(metadata_plist))\n end\n end\n end",
"def destroy\n @window.destroy\n @forms.each { |f| w = f.window; w.destroy unless w.nil? }\n end",
"def resize_to_desktop\n page.driver.browser.manage.window.resize_to(1280, 743)\n end",
"def unmonitor_monit\n monit_status = \"monit status | grep -q #{adapter}_#{app['shortname']}\"\n context.execute \"monit unmonitor #{adapter}_#{app['shortname']}\" do\n retries 3\n only_if monit_status\n end\n end",
"def destroy\n # typically the ensure block should have this\n\n #$log.debug \"win destroy start\"\n\n $global_windows.delete self\n Ncurses::Panel.del_panel(@panel.pointer) if @panel\n delwin() if @window \n Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 \n\n # destroy any pads that were created by widgets using get_pad\n @pads.each { |pad| \n FFI::NCurses.delwin(pad) if pad \n pad = nil\n } if @pads\n # added here to hopefully take care of this issue once and for all. \n # Whenever any window is destroyed, the root window is repainted.\n #\n # 2014-08-18 - 20:35 trying out without refresh all since lower dialog gets erased\n Window.refresh_all\n #$log.debug \"win destroy end\"\n end",
"def remove_all_widgets\n array = @browser.div(:id=>\"add_goodies_body\").lis.select { |li| li.class_name == \"remove\" }\n sub_array = array.select { |li| li.visible? }\n sub_array.each do |li|\n li.button(:text=>\"Remove\").click\n wait_for_ajax\n end\n close_add_widget\n end",
"def RemoveAll()\r\n ret = _invoke(1610743824, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def RemoveAll()\r\n ret = _invoke(1610743824, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def is_desktop_browser?\n !Handset.is_mobile? request.user_agent\n end",
"def test_delete_other_windows\n w = selected_window\n elvar.window_min_height = 1\n split_window\n split_window \n delete_other_windows\n assert(one_window_p)\n assert(eq(w, selected_window))\n end",
"def destroy_and_remove_workspace\n if Rails.env.production?\n return\n end\n Rails.logger.info \"Removing workspace #{firecloud_project}/#{firecloud_workspace} in #{Rails.env} environment\"\n begin\n ApplicationController.firecloud_client.delete_workspace(firecloud_project, firecloud_workspace) unless detached\n DeleteQueueJob.new(self.metadata_file).delay.perform if self.metadata_file.present?\n destroy\n rescue => e\n Rails.logger.error \"Error in removing #{firecloud_project}/#{firecloud_workspace}\"\n Rails.logger.error \"#{e.class.name}:\"\n Rails.logger.error \"#{e.message}\"\n destroy # ensure deletion of study, even if workspace is orphaned\n end\n Rails.logger.info \"Workspace #{firecloud_project}/#{firecloud_workspace} successfully removed.\"\n end",
"def clear_screen_and_display_board\n clear\n display_board\n end",
"def clear_displays\n loop do\n break if Byebug.displays.empty?\n\n Byebug.displays.pop\n end\n end",
"def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end",
"def remove\n return unless confirm_command\n\n args.each do |name|\n messages = nil\n if name.start_with? \"HEROKU_POSTGRESQL_\"\n name = name.chomp(\"_URL\").freeze\n end\n action(\"Removing #{name} on #{app}\") do\n messages = addon_run { heroku.uninstall_addon(app, name, :confirm => app) }\n end\n display(messages[:attachment]) if messages[:attachment]\n display(messages[:message]) if messages[:message]\n end\n end",
"def is_removable?\n\t\tself.clusters.empty? and self.network_switch_ports.empty? and self.pdus.empty? and self.sans.empty? and self.serial_consoles.empty?\n\tend",
"def unfullscreen_width\n\n return unless @window\n\n @window.decorated = true\n @window.set_resizable(true)\n\n # Resize the width of the window\n width = @window.screen.width\n height = @window.screen.height\n \n # We need to change the minimum size of the window\n min_width = width / 4\n min_height = height / 4\n @window.set_size_request(min_width, min_height)\n #puts \"width : #{width} / #{height}\"\n\n @window.unfullscreen\n\n # then we can resize to a smaller size\n new_width = width / 2 \n @window.move(0, 0)\n @window.resize( new_width , height)\nend",
"def remove\n deprecation_notice!\n downstream = shift_argument\n verify_downstream! downstream\n @cisauraus.removeDownstream(app, downstream)\n display \"Removed downstream app: #{downstream}\"\n end",
"def clear_small_wall\n for row_i in 1...@height - 1\n for column_i in 1...@width - 1\n total_wall = count_adjacent_wall(row_i, column_i)\n\n if @map[row_i][column_i] == @WALL\n if total_wall < 2\n @map[row_i][column_i] = @FLOOR\n next\n end\n end\n end\n end\n end",
"def remove(*pkgs)\n opts = pkgs.last.is_a?(Hash) ? pkgs.pop : {}\n project.run \"apk del #{pkgs.join(' ')}\", opts\n end",
"def hide_windows\n end",
"def erase\n if self.validCDKObject\n (0...@menu_items).each do |x|\n @title_win[x].werase\n @title_win[x].wrefresh\n @pull_win[x].werase\n @pull_win[x].wrefresh\n end\n end\n end",
"def remove_stale\n if exists? && running?\n raise ProcessRunning, \"#{path} already exists, seems like it's already running (process ID: #{pid}). \" +\n \"Stop the process or delete #{path}.\"\n else\n remove\n end\n end",
"def unfavorite!(wallpaper)\n favorite = self.favorites.find_by_wallpaper_id(wallpaper.id)\n favorite.destroy!\n end",
"def remove( *files, **options )\n\t\tself.server.run( :remove, *files, **options )\n\t\treturn true\n\tend",
"def remove_sockets\n @socket_list.each_value do |socket_name|\n begin\n socket_file = \"#{Socket_dir}/#{socket_name}\"\n File.delete(socket_file) if FileTest.exist?(socket_file)\n rescue Exception\n puts \"Error deleting socket file #{socket_file}:\\n#{$!}\"\n end\n\tend\nend",
"def bc_remove_layout_1(bc, path, barclamp, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n filelist = File.join BARCLAMP_PATH, \"#{bc}-filelist.txt\"\n if File.exist? filelist \n files = [ filelist ]\n File.open(filelist, 'r') do |f|\n f.each_line { |line| files << line }\n end\n FileUtils.rm files\n merge_nav barclamp, false\n merge_sass barclamp, bc, path, false\n puts \"DEBUG: Barclamp #{bc} UNinstalled\" if debug\n end\nend",
"def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\n end",
"def remove!\n package('skype') { action :remove }\n end",
"def remove_items\n system 'clear'\n CoffeeMan.stay_logo\n @@cart = @@cart.flatten\n cart_arr = @@cart \n if cart_arr.count == 0 \n puts \"Your cart is empty, please add items\"\n sleep 1\n view_cart\n end\n if cart_arr.count > 0 \n splitted_cart = cart_arr.split(\" \")\n selected_items = prompt.multi_select(\"Which item would you like to remove?\", splitted_cart)\n selected_items.each do |del| \n cart_arr.delete_at(cart_arr.index(del))\n end \n # @@cart = cart_arr\n sleep(0.6)\n view_cart\n end\n end",
"def destroy\n # typically the ensure block should have this\n # @panel = @window.panel if @window\n #Ncurses::Panel.del_panel(@panel) if [email protected]? \n #@window.delwin if [email protected]?\n $log.debug \"win destroy start\"\n\n #@panel = @window.panel if @window\n Ncurses::Panel.del_panel(@panel) if [email protected]? \n @window.delwin if [email protected]?\n $log.debug \"win destroy end\"\n end",
"def ensure_only_one_browser_window_open\n $tracer.trace(\"GameStopMobileDSL : #{__method__}, Line : #{__LINE__}\")\n if (browser_count > 1)\n for i in (browser_count - 1) .. 1\n browser(i).close\n end\n end\n\n browser(0)\n end",
"def desktop_path(path = request.path)\n path.gsub(/^(.*?\\/\\/.*?)?\\/(#{mobile_path_prefix}\\/?)?(.*)$/) do\n \"#{$1}/#{$3}\"\n end.freeze\n end",
"def remove_old_media\n (@old_media || []).each do |medium|\n medium.destroy if medium\n end\n end",
"def remove_old_mgr(ceph_version)\n rs_client = kube_client.api('extensions/v1beta1').resource('replicasets', namespace: 'kontena-storage')\n old_replicasets = rs_client.list(labelSelector: 'app=rook-ceph-mgr').reject do |rs|\n rs.spec.template.spec.containers.first.image.include?(\"ceph/ceph:v#{ceph_version}\")\n end\n old_replicasets.each do |rs|\n rs_client.delete_resource(rs, propagationPolicy: 'Background')\n end\n end",
"def remove_size(size)\n @size.delete(size)\n end",
"def remove_items(supplies)\n counter = 0\n \n while counter < supplies.length\n if supplies.length > 5\n supplies.delete_at(counter)\n end\n counter += 1\n end\n supplies\nend",
"def screen_size\n coords = execute_applescript(%Q`\n tell application \"Finder\"\n get bounds of window of desktop\n end tell\n `)\n coords = coords.split(\", \").collect {|c| c.to_i}\n to(*coords)\n end",
"def remove_style(style_str, screen)\n if screen\n styles_pool[screen]&.delete(style_str)\n elsif styles_pool[:_common]\n styles_pool[:_common].delete(style_str)\n end\n end",
"def remove_from_selected_communications\n selected_communication = params[:communication_to_remove]\n communication = Communication.find(selected_communication) unless selected_communication.blank?\n previously_selected = session[:selected_communications]\n \n previously_selected.delete(communication)\n \n session[:selected_communications] = previously_selected\n \n render :partial => 'selected_communications'\n end",
"def remove(*scenes_to_remove)\n self.scenes -= scenes_to_remove\n update_systems_list\n true\n end",
"def destroy\n self.cleanTitle\n\n # Clear the matrix windows.\n CDK.deleteCursesWindow(@cell[0][0])\n (1..@vrows).each do |x|\n CDK.deleteCursesWindow(@cell[x][0])\n end\n (1..@vcols).each do |x|\n CDK.deleteCursesWindow(@cell[0][x])\n end\n (1..@vrows).each do |x|\n (1..@vcols).each do |y|\n CDK.deleteCursesWindow(@cell[x][y])\n end\n end\n\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean the key bindings.\n self.cleanBindings(:MATRIX)\n\n # Unregister this object.\n CDK::SCREEN.unregister(:MATRIX, self)\n end",
"def remove_math_images_folder\n math_images.remove_folder\n end",
"def uninstall_on_device_removal\n return @uninstall_on_device_removal\n end",
"def destroy\n name = @user_workspace.name\n message = \"'#{name}' was successfully destroyed.\"\n # remove workspace, unless user requests it to persist\n begin\n unless params[:persist] == 'true'\n begin\n logger.info \"Removing user_workspace: #{@user_workspace.full_name}\"\n user_fire_cloud_client(current_user).delete_workspace(@user_workspace.namespace, @user_workspace.name)\n rescue => e\n logger.info \"Unable to remove user_workspace: #{@user_workspace.full_name} due to error: #{e.message}\"\n message += \" Unity was unable to remove the associated workspace due to an error: #{e.message}\"\n end\n end\n @user_workspace.destroy\n respond_to do |format|\n format.html { redirect_to user_workspaces_path, notice: message }\n format.json { head :no_content }\n end\n rescue => e\n logger.error \"Error removing benchmark workspace '#{name}': #{e.message}\"\n redirect_to user_workspaces_path, alert: \"We were unable to remove benchmarking workspace '#{name}' due to an error: #{e.message}\" and return\n end\n end",
"def remove_servers(servers_to_destroy=[])\n servers_to_destroy.each do |server|\n puts \"Destroying...\" + server.id\n do_client.droplets.destroy(:id => server.id)\n end\n end",
"def remove_show_hls\n @spriteset.remove_group(DISPLAY_TB)\n @spriteset.remove_group(TB_AOE)\n end",
"def dpms_force_screen_off\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n `xset dpms force off`\n rescue Errno::ENOENT\n return false\n end\n if $?.exitstatus == 0\n return true\n else\n return false\n end\n end",
"def remove_from_list *list\n @show = @show - TinyPng::Path.get_all(list)\n end",
"def deletesms\n assert_privileges(\"storage_manager_delete\")\n sm_button_operation('destroy', 'deletion')\n end",
"def check_for_mobile\n#\tuse_mobile_pages # For development only: controls if I see mobile or desktop version of a page. Uncomment line below for production.\n\tuse_mobile_pages unless desktop? # priority is to use a pages from the 'views_mobile' folder over those from the 'views' folder\n end",
"def remove_group\n group = current_account.groups.of_devices.find(params[:group_id])\n\n group.devices.delete(current_account.devices.find(params[:apply_ids].split(\",\")))\n\n redirect_to devices_path\n end",
"def delete_inbox_repliers(opts = {})\n delete_inbox_repliers_with_http_info(opts)\n nil\n end",
"def remove_all_diffs_and_tests\n UiChanged::Screenshot.remove_all_diffs_and_tests\n head :ok\n end",
"def remove_from_list(list)\n li = Fl::Framework::List::ListItem.query_for_listable_in_list(self, list).first\n if li.nil?\n false\n else\n self.listable_containers.delete(li)\n true\n end\n end",
"def remove_left_factors\n\n prods = @productions.map do |name, rules|\n next if rules.size == 1\n t = Trie.new\n rules.each { |rule| t.insert(rule) }\n prefixes = t.group_by_prefixes\n next if prefixes.size == rules.size\n [name, t.group_by_prefixes]\n end.compact!\n\n return false if prods.empty?\n\n prods.each do |name, prefixes|\n\n rules = @productions[name] = []\n\n prefixes.each do |prefix, suffixes|\n if suffixes.size == 1 && suffixes.first.empty? # suffixes == [[]]\n rules << prefix\n else\n suffix = suffixes.find(&:empty?)\n suffix << EmptyProduction.instance if suffix\n\n new_name = @productions.find { |_name, rs| rs == suffixes }&.first\n unless new_name\n new_name = gen_prod_name(name)\n @productions[new_name] = suffixes\n end\n new_prod = Production.new(new_name)\n\n rules << (prefix << new_prod)\n end\n end\n\n end\n\n true\n end",
"def destroy\n @screen = Screen.find(params[:id])\n if [email protected]?(current_user)\n redirect_to(@screen,\n :notice => 'Permission denied: You can only delete your own Screens.')\n return \n end\n @topic = @screen.topic\n @screen.destroy\n\n respond_to do |format|\n format.html { redirect_to(navigate_path(@topic)) }\n format.xml { head :ok }\n end\n end",
"def remove\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - Yourself\" => 1,\n \" 2 - A cat\" => 2,\n \" 3 - Return to the Main Menu\" => 3 }\n choice = prompt.select(\"\\nWhat would you like to remove from the directory?\\n\", choices, per_page: 3)\n\n case (choice.to_i)\n when 1\n puts \"\\nWhat is your name?\"\n owner_name = gets.chomp\n destroy = Owner.find_by(name: owner_name)\n puts \"\\nAll set, #{owner_name}! ☹️ So sad to see you go!\"\n if destroy.nil?\n puts \"\\nSorry, this owner doesn't exist.\"\n remove\n else\n destroy.destroy\n puts \"\\nBye, #{owner_name}!\"\n end\n when 2\n puts \"\\n😿 What is the cat's name?\"\n cat_name = gets.chomp\n destroy = Cat.find_by(name: cat_name)\n if destroy.nil?\n puts \"\\nSorry, this cat doesn't exist.\"\n remove\n else\n destroy.destroy\n puts \"\\nSo long, sweet #{cat_name}!\"\n end\n when 3\n main_menu\n end\n end",
"def remove!\n windows_package 'Chef Development Kit' do\n action :remove\n end\n end",
"def destroy\n\t\tsession[:user_id] = nil\n\t\tif (params['mobile'].to_i == 1)\n\t\t\tredirect_to '/mobile/login/'\n\t\telse\n\t\t\tredirect_to root_path\n\t\tend\n\tend"
] | [
"0.71847725",
"0.55630857",
"0.51586",
"0.48049235",
"0.46907488",
"0.46150577",
"0.4537496",
"0.4483417",
"0.4475176",
"0.4461352",
"0.44572833",
"0.4424133",
"0.43214753",
"0.42999113",
"0.42979833",
"0.42798176",
"0.42550057",
"0.42425928",
"0.42243078",
"0.4211777",
"0.42116547",
"0.42097026",
"0.4207165",
"0.42067513",
"0.4148051",
"0.41361532",
"0.4131013",
"0.40710434",
"0.4049126",
"0.40467092",
"0.4030843",
"0.40118366",
"0.40029585",
"0.39833722",
"0.39603955",
"0.39312994",
"0.39312994",
"0.39305216",
"0.3930366",
"0.39245808",
"0.39190343",
"0.3916803",
"0.3884058",
"0.38825116",
"0.38706517",
"0.38668224",
"0.38637218",
"0.38637218",
"0.38582596",
"0.3857262",
"0.3847282",
"0.3842167",
"0.38413343",
"0.38362172",
"0.3831953",
"0.38273427",
"0.38259652",
"0.38139948",
"0.37956375",
"0.379281",
"0.37903148",
"0.37881565",
"0.37815303",
"0.37778324",
"0.37774092",
"0.37773907",
"0.37693295",
"0.37557346",
"0.37427446",
"0.37410468",
"0.373654",
"0.37363818",
"0.3734032",
"0.3733012",
"0.37258065",
"0.3715991",
"0.37082997",
"0.3707507",
"0.36971632",
"0.36971623",
"0.36940724",
"0.36920446",
"0.3688427",
"0.3681678",
"0.36808532",
"0.36735886",
"0.36688858",
"0.36635366",
"0.36630392",
"0.3654537",
"0.36504441",
"0.36483002",
"0.36481434",
"0.36463392",
"0.36327645",
"0.36312318",
"0.3629198",
"0.36291695",
"0.36230636",
"0.36227754"
] | 0.784 | 0 |
Remove desktops The highest numbered desktops are removed. Removing a desktop you are currently on will result in TotalSpaces2 switching to another dektop. Any windows present on a desktop being removed will be moved to one of the remaining desktops. Returns true on success, false if number_to_remove was zero or would result in less than 1 desktop remaining. The on_layout_change notification will be sent if a change was made. display_id = TotalSpaces2.main_display[:display_id] TotalSpaces2.remove_desktops_on_display(1, display_id) | def remove_desktops_on_display(number_to_remove, display_id)
TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, display_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_desktops(number_to_remove)\n TSApi.tsapi_removeDesktopsOnDisplay(number_to_remove, 0)\n end",
"def add_desktops_on_display(number_to_add, display_id)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, display_id)\n end",
"def add_desktops(number_to_add)\n TSApi.tsapi_addDesktopsOnDisplay(number_to_add, 0)\n end",
"def desktops\n @desktops ||= if available?\n Libatspi.get_desktop_count.times.map do |idx|\n Desktop.new(Libatspi.get_desktop(idx))\n end\n else\n []\n end\n end",
"def remove_window(id)\n window_exist?(id)\n @windows.delete(id)\n end",
"def desktop?\n false # FIXME\n end",
"def unlock_desktop(unlock=true)\n\t\trequest = Packet.create_request('stdapi_ui_unlock_desktop')\n\t\trequest.add_tlv(TLV_TYPE_BOOL, unlock)\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def desktop?\n true # Not nice, but if you're running desktopbrowser, assume running desktop\n end",
"def cmd_setdesktop(*args)\n\t\tif(args.length == 0)\n\t\t\tprint_line(\"Usage: setdesktop [workstation\\\\\\\\desktop]\")\n\t\t\treturn\n\t\tend\n\t\t\n\t\tprint_line(\"Changing to desktop #{args[0]}\")\n\t\tclient.ui.set_desktop(*args)\n\t\treturn true\n\tend",
"def delete_index(display_number)\n @list.each_with_index do |display, i|\n if display_number == display.number\n @list[i..i] = []\n return true\n end\n end\n false\n end",
"def remove_mobile_platform(value)\n @children['mobile-platform'][:value].delete(value)\n end",
"def clear_displays\n loop do\n break if Byebug.displays.empty?\n\n Byebug.displays.pop\n end\n end",
"def open_desktop\n Log.add_info(request, params.inspect)\n\n user = @login_user\n\n is_config_desktop = false\n if user.nil?\n user = DesktopsHelper.get_user_before_login\n is_config_desktop = true\n end\n\n @toys = Toy.get_for_user(user)\n\n if is_config_desktop\n @toys.delete_if {|toy|\n ret = false\n if toy.xtype == Toy::XTYPE_FOLDER\n begin\n folder = Folder.find(toy.target_id)\n ret = folder.my_folder?\n rescue\n end\n elsif toy.xtype == Toy::XTYPE_POSTLABEL\n ret = true\n end\n ret == true\n }\n end\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n @ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n end\n\n @desktop = Desktop.get_for(user)\n\n render(:partial => 'ajax_get_desktop', :layout => false)\n end",
"def desktop?\n !is_mobile_device? && !is_tablet_device?\n end",
"def unmanage window\n if h=managed[window]\n h[:source_funcs].each do |sf|\n sf.remove()\n end\n \n managed.delete window\n end\n end",
"def remove_bullets_of_screen args\n args.state.bullets = args.state.bullets.reject { |bullet| bullet.x > 1280 } # screen width is 1280\nend",
"def stop\n ENV['DISPLAY'] = @old_display\n end",
"def cmd_setdesktop( *args )\n\t\t\n\t\tswitch = false\n\t\tdsession = -1\n\t\tdstation = 'WinSta0'\n\t\tdname = 'Default'\n\t\t\n\t\tsetdesktop_opts = Rex::Parser::Arguments.new(\n\t\t\t\"-h\" => [ false, \"Help Banner.\" ],\n\t\t\t#\"-s\" => [ true, \"The session (Default: '#{dsession}')\" ],\n\t\t\t\"-w\" => [ true, \"The window station (Default: '#{dstation}')\" ],\n\t\t\t\"-n\" => [ true, \"The desktop name (Default: '#{dname}')\" ],\n\t\t\t\"-i\" => [ true, \"Set this desktop as the interactive desktop (Default: '#{switch}')\" ]\n\t\t)\n\t\t\n\t\tsetdesktop_opts.parse( args ) { | opt, idx, val |\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint_line( \"Usage: setdesktop [options]\\n\" )\n\t\t\t\t\tprint_line( \"Change the meterpreters current desktop.\" )\n\t\t\t\t\tprint_line( setdesktop_opts.usage )\n\t\t\t\t\treturn\n\t\t\t\t#when \"-s\"\n\t\t\t\t# dsession = val.to_i\n\t\t\t\twhen \"-w\"\n\t\t\t\t\tdstation = val\n\t\t\t\twhen \"-n\"\n\t\t\t\t\tdname = val\n\t\t\t\twhen \"-i\"\n\t\t\t\t\tswitch = true if ( val =~ /^(t|y|1)/i )\n\t\t\tend\n\t\t}\n\t\t\n\t\tif( client.ui.set_desktop( dsession, dstation, dname, switch ) )\n\t\t\tprint_line( \"#{ switch ? 'Switched' : 'Changed' } to desktop #{dstation}\\\\#{dname}\" )\n\t\telse\n\t\t\tprint_line( \"Failed to #{ switch ? 'switch' : 'change' } to desktop #{dstation}\\\\#{dname}\" )\n\t\tend\n\t\t\n\t\treturn true\n\tend",
"def for_desktop?\n for_terminal == TerminalEnum.desktop\n end",
"def cmd_getdesktop(*args)\n\t\t\n\t\tdesktop = client.ui.get_desktop\n\t\t\n\t\tsession = desktop['session'] == 0xFFFFFFFF ? '' : \"Session #{desktop['session'].to_s}\\\\\"\n\t\t\n\t\tprint_line( \"#{session}#{desktop['station']}\\\\#{desktop['name']}\" )\n\t\t\n\t\treturn true\n\tend",
"def dpms_force_screen_off\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n `xset dpms force off`\n rescue Errno::ENOENT\n return false\n end\n if $?.exitstatus == 0\n return true\n else\n return false\n end\n end",
"def IsGraphicalDesktop\n # Get patterns set for installation during desktop selection\n # (see DefaultDesktop::packages_proposal_ID_patterns for the first argument)\n pt = PackagesProposal.GetResolvables(\"DefaultDesktopPatterns\", :pattern)\n Builtins.contains(pt, \"x11\")\n end",
"def clear_screen_and_display_board\n clear\n display_board\n end",
"def move_window_to_space_on_display(window_id, space_number, display_id)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, display_id)\n end",
"def deleteAllDevPartitions(disk, installation)\n disk = deep_copy(disk)\n go_on = true\n del_dev = Ops.get_string(disk, \"device\", \"\")\n Builtins.y2milestone(\n \"deleteAllDevPartitions disk:%1\",\n Builtins.remove(disk, \"partitions\")\n )\n\n #///////////////////////////////////////////////////////////////\n # check mount points if not installation\n\n if !installation\n mounts = Storage.mountedPartitionsOnDisk(del_dev)\n if Builtins.size(mounts) != 0\n #///////////////////////////////////////////////////////\n # mount points found\n\n mounted_parts = \"\"\n Builtins.foreach(mounts) do |mount|\n # %1 is replaced by device name, %1 by directory e.g /dev/hdd1 on /opt\n mounted_parts = Ops.add(\n Ops.add(\n mounted_parts,\n Builtins.sformat(\n \"%1 on %2\",\n Ops.get_string(mount, \"device\", \"\"),\n Ops.get_string(mount, \"mount\", \"\")\n )\n ),\n \"\\n\"\n )\n end\n\n # popup text, %1 is replaced by device name\n message = Builtins.sformat(\n _(\n \"The selected device contains partitions that are currently mounted:\\n\" +\n \"%1\\n\" +\n \"We *strongly* recommended to unmount these partitions before deleting the partition table.\\n\" +\n \"Choose Cancel unless you know exactly what you are doing.\\n\"\n ),\n mounted_parts\n )\n\n go_on = false if !Popup.ContinueCancel(message)\n end\n end\n\n if go_on\n partitions = Ops.get_list(disk, \"partitions\", [])\n\n used = check_devices_used(partitions, false)\n\n go_on = used == :UB_NONE\n\n if used == :UB_LVM\n # popup text, Do not translate LVM.\n Popup.Message(\n _(\n \"\\n\" +\n \"The selected device contains at least one LVM partition\\n\" +\n \"assigned to a volume group. Remove all\\n\" +\n \"partitions from their respective volume groups\\n\" +\n \"before deleting the device.\\n\"\n )\n )\n elsif used == :UB_MD\n # popup text, Do not translate RAID.\n Popup.Message(\n _(\n \"\\n\" +\n \"The selected device contains at least one partition\\n\" +\n \"that is part of a RAID system. Unassign the\\n\" +\n \"partitions from their respective RAID systems before\\n\" +\n \"deleting the device.\\n\"\n )\n )\n elsif used != :UB_NONE\n # popup text\n Popup.Message(\n _(\n \"\\n\" +\n \"The selected device contains at least one partition\\n\" +\n \"that is used by another volume. Delete the volume using it\\n\" +\n \"before deleting the device.\\n\"\n )\n )\n end\n\n if go_on && Ops.get_symbol(disk, \"type\", :CT_UNKNONW) != :CT_DMRAID\n #///////////////////////////////////////////////\n # delete all partitions of disk\n # logical partitions get removed when extended is deleted\n dp = Builtins.filter(partitions) do |part|\n Ops.less_or_equal(\n Ops.get_integer(part, \"nr\", 0),\n Ops.get_integer(disk, \"max_primary\", 4)\n )\n end\n Builtins.y2milestone(\"deleteAllDevPartitions dp:%1\", dp)\n dp = Builtins.sort(dp) do |a, b|\n Ops.greater_than(\n Ops.get_integer(a, \"nr\", 0),\n Ops.get_integer(b, \"nr\", 0)\n )\n end\n Builtins.y2milestone(\"deleteAllDevPartitions dp:%1\", dp)\n Builtins.foreach(dp) do |part|\n go_on = go_on &&\n Storage.DeleteDevice(Ops.get_string(part, \"device\", \"\"))\n end\n end\n end\n Builtins.y2milestone(\"deleteAllDevPartitions ret:%1\", go_on)\n go_on\n end",
"def desktop_request?\n !mobile_request?\n end",
"def remove_show_hls\n @spriteset.remove_group(DISPLAY_TB)\n @spriteset.remove_group(TB_AOE)\n end",
"def mass_remove(data)\n result = @client.api_request(\n :method => \"template.massRemove\",\n :params => {\n :hostids => data[:hosts_id],\n :templateids => data[:templates_id],\n :groupids => data[:group_id],\n :force => 1\n }\n )\n result.empty? ? false : true\n end",
"def input_remove_wall\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_inside_grid?\n if grid.walls.key?(cell_closest_to_mouse)\n grid.walls.delete(cell_closest_to_mouse)\n reset_search\n end\n end\n end",
"def input_remove_wall\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_over_grid?\n if state.walls.key?(cell_closest_to_mouse) or state.hills.key?(cell_closest_to_mouse)\n state.walls.delete(cell_closest_to_mouse)\n state.hills.delete(cell_closest_to_mouse)\n reset_search\n end\n end\n end",
"def mass_remove(data)\n result = @client.api_request(\n :method => \"template.massRemove\", \n :params => {\n :hosts => data[:hosts_id].map { |t| {:hostid => t} },\n :templates => data[:templates_id].map { |t| {:templateid => t} }\n }\n )\n result.empty? ? false : true \n end",
"def clear_shared_folders\n execute(\"showvminfo\", @uuid, \"--machinereadable\").split(\"\\n\").each do |line|\n if line =~ /^SharedFolderNameMachineMapping\\d+=\"(.+?)\"$/\n execute(\"sharedfolder\", \"remove\", @uuid, \"--name\", $1.to_s)\n end\n end\n end",
"def remove(number=nil)\n raise UsageError, 'Must specify number from boxes list or hostname/IP address' if not number\n\n prev_count = remotes.size\n msg = 'Box '\n if number.is_a?(Integer) || number =~ /^\\d+$/\n index = number.to_i - 1\n remotes.boxes.delete_at(index)\n msg << (index + 1).to_s\n else\n remotes.remove(number)\n msg << \"with IP/host #{number}\"\n end\n msg << ' removed'\n\n if prev_count == remotes.size + 1\n remotes.store\n puts msg\n else\n puts \"Could not remove box: #{number}\"\n end\n end",
"def clear_shared_folders\n share_ids = read_shared_folders.keys\n share_ids.each do |id|\n execute_prlctl('set', @uuid, '--shf-host-del', id)\n end\n end",
"def unbind_resize_child_windows\n API.unbind \"\\\\\", @mash\nend",
"def input_remove_wall2\n # The mouse needs to be inside the grid, because we only want to remove walls\n # the cursor is directly over\n # Recalculations should only occur when a wall is actually deleted\n if mouse_over_grid2?\n if state.walls.key?(cell_closest_to_mouse2) or state.hills.key?(cell_closest_to_mouse2)\n state.walls.delete(cell_closest_to_mouse2)\n state.hills.delete(cell_closest_to_mouse2)\n reset_search\n end\n end\n end",
"def unmonitor_monit\n monit_status = \"monit status | grep -q #{adapter}_#{app['shortname']}\"\n context.execute \"monit unmonitor #{adapter}_#{app['shortname']}\" do\n retries 3\n only_if monit_status\n end\n end",
"def hide_windows\n end",
"def is_desktop_browser?\n !Handset.is_mobile? request.user_agent\n end",
"def delete(test_ids, type)\n type = @type_map.fetch(type) if type.class == Symbol\n test_ids = test_ids.join(',') if test_ids.class == Array\n args = {testIds: test_ids, type: type}\n post('deleteInternalMonitors', args)\n end",
"def cmd_unlockdesktop(*args)\n\t\tmode = 0\n\t\tif(args.length > 0)\n\t\t\tmode = args[0].to_i\n\t\tend\n\t\t\n\t\tif(mode == 0)\n\t\t\tprint_line(\"Unlocking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(true)\n\t\telse\n\t\t\tprint_line(\"Locking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(false)\t\n\t\tend\n\n\t\treturn true\n\tend",
"def cmd_unlockdesktop(*args)\n\t\tmode = 0\n\t\tif(args.length > 0)\n\t\t\tmode = args[0].to_i\n\t\tend\n\t\t\n\t\tif(mode == 0)\n\t\t\tprint_line(\"Unlocking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(true)\n\t\telse\n\t\t\tprint_line(\"Locking the workstation...\")\n\t\t\tclient.ui.unlock_desktop(false)\t\n\t\tend\n\n\t\treturn true\n\tend",
"def remove_sliders\n size = @sliders.size\n @sliders.clear\n @dialog.execute_script(\"remove_sliders(); update_size();\") if @dialog\n size\n end",
"def resize_to_desktop\n page.driver.browser.manage.window.resize_to(1280, 743)\n end",
"def dpms_screen_is_on?\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n result = `xset -q 2>&1`\n rescue Errno::ENOENT\n return :unknown\n end\n if ($?.exitstatus != 0)\n return :unknown\n end\n if result.include? \"Monitor is On\"\n return true\n elsif result.include? \"Monitor is Off\"\n return false\n else\n return :unknown\n end\n end",
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to(displays_url) }\n format.xml { head :ok }\n end\n end",
"def uninstall_on_device_removal\n return @uninstall_on_device_removal\n end",
"def is_removable?\n\t\tself.clusters.empty? and self.network_switch_ports.empty? and self.pdus.empty? and self.sans.empty? and self.serial_consoles.empty?\n\tend",
"def remove_style(style_str, screen)\n if screen\n styles_pool[screen]&.delete(style_str)\n elsif styles_pool[:_common]\n styles_pool[:_common].delete(style_str)\n end\n end",
"def remove_all_widgets\n array = @browser.div(:id=>\"add_goodies_body\").lis.select { |li| li.class_name == \"remove\" }\n sub_array = array.select { |li| li.visible? }\n sub_array.each do |li|\n li.button(:text=>\"Remove\").click\n wait_for_ajax\n end\n close_add_widget\n end",
"def destroy\n # typically the ensure block should have this\n\n #$log.debug \"win destroy start\"\n\n $global_windows.delete self\n Ncurses::Panel.del_panel(@panel.pointer) if @panel\n delwin() if @window \n Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 \n\n # destroy any pads that were created by widgets using get_pad\n @pads.each { |pad| \n FFI::NCurses.delwin(pad) if pad \n pad = nil\n } if @pads\n # added here to hopefully take care of this issue once and for all. \n # Whenever any window is destroyed, the root window is repainted.\n #\n # 2014-08-18 - 20:35 trying out without refresh all since lower dialog gets erased\n Window.refresh_all\n #$log.debug \"win destroy end\"\n end",
"def clear_screen\n\tGem.win_platform? ? (system \"cls\") : (system \"clear\")\nend",
"def clear_screen\n print @screen.to_s\n end",
"def destroy\n @main_screen.destroy\n respond_to do |format|\n format.html { redirect_to main_screens_url, notice: 'Main screen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def ListView_RemoveAllGroups(hwnd) send_listview_message(hwnd, :REMOVEALLGROUPS) end",
"def unfavorite_a_show(show_id)\n previous_clicks = Interest.where('user_id' => self.id,\n 'show_id' => show_id).all\n for elt in previous_clicks\n elt.destroy\n end\n end",
"def remove_measurement\n respond_to do |format|\n format.js { head :ok }\n end\n measurements = DataListMeasurement.where(data_list_id: @data_list.id).to_a.sort_by{ |m| m.list_order }\n index_to_remove = measurements.index{ |m| m.measurement_id == params[:measurement_id].to_i }\n new_order = 0\n measurements.each_index do |i|\n if index_to_remove == i\n next\n end\n measurements[i].update list_order: new_order\n new_order += 1\n end\n id_to_remove = DataListMeasurement.find_by(data_list_id: @data_list.id, measurement_id: params[:measurement_id].to_i).id\n DataListMeasurement.destroy(id_to_remove)\n end",
"def remove_old_media\n (@old_media || []).each do |medium|\n medium.destroy if medium\n end\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/VLC'),\n ::File.expand_path('~/Library/Application Support/org.videolan.vlc')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def remove_from_list\n # if in_list?\n # decrement_positions_on_lower_items\n # update_attribute position_column, nil\n # end \n return unless in_list?\n decrement_positions_on_lower_items\n update_attribute position_column, nil \n end",
"def remove_missing\n sync do\n devices.delete_if do |dev|\n pdev = ct.group.devices.get(dev)\n pdev.nil? || !pdev.mode.compatible?(dev.mode)\n end\n end\n end",
"def remove_stale_data_containers\n containers_data_dir = File.join(device_data_dir, \"Containers\", \"Data\", \"Application\")\n apps = Dir.glob(\"#{containers_data_dir}/**/#{METADATA_PLIST}\")\n apps.each do |metadata_plist|\n if pbuddy.plist_read(\"MCMMetadataIdentifier\", metadata_plist) == app.bundle_identifier\n FileUtils.rm_rf(File.dirname(metadata_plist))\n end\n end\n end",
"def clear_screen\n CLEAR_SCREEN\n end",
"def destroy\n @screen = Screen.find(params[:id])\n @screen.destroy\n\n respond_to do |format|\n format.html { redirect_to(hiring_screens_url) }\n format.xml { head :ok }\n end\n end",
"def dpms_force_screen_on\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n `xset dpms force on`\n rescue Errno::ENOENT\n return false\n end\n if $?.exitstatus != 0\n return false\n end\n\n # Required if the screen was turned off with DPMS and the\n # screensaver has not been disabled:\n begin\n `xset s reset`\n rescue Errno::ENOENT #unlikely, but still...\n return false\n end\n if $?.exitstatus != 0\n return false\n end\n end",
"def grab_input_desktop\n\t\trequest = Packet.create_request('stdapi_ui_grab_input_desktop')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend",
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end",
"def erase\n if self.validCDKObject\n (0...@menu_items).each do |x|\n @title_win[x].werase\n @title_win[x].wrefresh\n @pull_win[x].werase\n @pull_win[x].wrefresh\n end\n end\n end",
"def destroy\n @screen = Screen.find(params[:id])\n if [email protected]?(current_user)\n redirect_to(@screen,\n :notice => 'Permission denied: You can only delete your own Screens.')\n return \n end\n @topic = @screen.topic\n @screen.destroy\n\n respond_to do |format|\n format.html { redirect_to(navigate_path(@topic)) }\n format.xml { head :ok }\n end\n end",
"def center_stage_remove\n user_id = params[:user_id]\n session_id = params[:id]\n session_user_record = SessionUser.where(\"session_id = ? and user_id = ?\",\n session_id, user_id)[0]\n if session_user_record.update(center_stage: false)\n render json: {message: \"#{user_id} removed from center stage of session #{session_id}\"},\n status: 200\n else\n render json: { errors: session_user_record.errors.to_json }, status: 500\n end\n end",
"def remove_missing\n sync do\n devices.delete_if do |dev|\n pdev = parent.devices.get(dev)\n pdev.nil? || !pdev.mode.compatible?(dev.mode)\n end\n end\n end",
"def clear_screen(opts = {})\n Gem.win_platform? ? (system 'cls') : (system 'clear')\n return false unless opts[:flash_msg]\n puts opts[:flash_msg]\n puts ''\n opts[:flash_msg] = nil\n end",
"def set_screen_clear\n if @clear_screen\n @s_clear_screen_code = @clear_screen_code \n else\n @s_clear_screen_code = \"\"\n end\n end",
"def check_for_mobile\n#\tuse_mobile_pages # For development only: controls if I see mobile or desktop version of a page. Uncomment line below for production.\n\tuse_mobile_pages unless desktop? # priority is to use a pages from the 'views_mobile' folder over those from the 'views' folder\n end",
"def unfullscreen_width\n\n return unless @window\n\n @window.decorated = true\n @window.set_resizable(true)\n\n # Resize the width of the window\n width = @window.screen.width\n height = @window.screen.height\n \n # We need to change the minimum size of the window\n min_width = width / 4\n min_height = height / 4\n @window.set_size_request(min_width, min_height)\n #puts \"width : #{width} / #{height}\"\n\n @window.unfullscreen\n\n # then we can resize to a smaller size\n new_width = width / 2 \n @window.move(0, 0)\n @window.resize( new_width , height)\nend",
"def myitasa_remove_show(show_id, version)\n raise APIError, 'not logged in' if @authcode.nil?\n res = call(\n 'myitasa/removeShowFromPref',\n 'authcode' => @authcode,\n 'show_id' => show_id,\n 'version' => version\n )\n\n res.body['Itasa_Rest2_Server_Myitasa']['removeShowFromPref']['shows'].values\n end",
"def remove_notes_collection(remove_list)\n \n remove_list.each do |upload_id|\n upload = Upload.find(upload_id)\n if ( @collection.uploads.include?(upload) )\n @collection.uploads.delete(upload)\n end\n end\n end",
"def clear\n @screen_data = []\n end",
"def remove\n deprecation_notice!\n downstream = shift_argument\n verify_downstream! downstream\n @cisauraus.removeDownstream(app, downstream)\n display \"Removed downstream app: #{downstream}\"\n end",
"def prep_remove_list\n remove_list = [*@remove].compact.collect { |x| x.to_s.downcase.to_sym }\n\n remove_list += DataShift::Configuration.rails_columns if remove_rails\n\n remove_list\n end",
"def bc_remove_layout_1(bc, path, barclamp)\n filelist = File.join BARCLAMP_PATH, \"#{bc}-filelist.txt\"\n if File.exist? filelist \n files = [ filelist ]\n File.open(filelist, 'r') do |f|\n f.each_line { |line| files << line }\n end\n FileUtils.rm files\n merge_nav barclamp, false\n merge_sass barclamp, bc, path, false\n puts \"Barclamp #{bc} UNinstalled\" if DEBUG\n end\n end",
"def remove!\n [\n PATH,\n ::File.expand_path('~/Library/Application Support/Skype')\n ].each do |d|\n directory d do\n recursive true\n action :delete\n end\n end\n end",
"def chef_to_be_removed(chef_server_list)\n servers_up = cloud_server_list\n chef_server_list.delete_if do |name,server|\n puts \"Do not delete #{name}, it's up\" if servers_up[name]\n !! servers_up[name]\n end\nend",
"def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\n end",
"def clear_screen(opts = {})\n Gem.win_platform? ? (system 'cls') : (system 'clear')\n if opts[:flash_msg]\n puts opts[:flash_msg]\n puts ''\n opts[:flash_msg] = nil\n end\n end",
"def destroy\n # typically the ensure block should have this\n # @panel = @window.panel if @window\n #Ncurses::Panel.del_panel(@panel) if [email protected]? \n #@window.delwin if [email protected]?\n $log.debug \"win destroy start\"\n\n #@panel = @window.panel if @window\n Ncurses::Panel.del_panel(@panel) if [email protected]? \n @window.delwin if [email protected]?\n $log.debug \"win destroy end\"\n end",
"def clear_display\n system('clear') || system('clc')\n end",
"def remove_from_list *list\n @show = @show - TinyPng::Path.get_all(list)\n end",
"def clear_screen(opts = {})\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n if opts[:flash_msg]\n puts opts[:flash_msg]\n puts ''\n opts[:flash_msg] = nil\n end\n end",
"def clear_screen(opts = {})\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n if opts[:flash_msg]\n puts opts[:flash_msg]\n puts ''\n opts[:flash_msg] = nil\n end\n end",
"def clear_screen(opts = {})\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n if opts[:flash_msg]\n puts opts[:flash_msg]\n puts ''\n opts[:flash_msg] = nil\n end\n end",
"def destroy\n @window.destroy\n @forms.each { |f| w = f.window; w.destroy unless w.nil? }\n end",
"def clean_script\n <<-EOT.gsub(/^ {14}/, \"\")\n #{super}\n\n #{vnc_clean}\n [[ -n ${display} ]] && vncserver -kill :${display}\n EOT\n end",
"def update_chat_desktop_notification_settings(update_chat_desktop_notification_settings_input_object, opts = {})\n update_chat_desktop_notification_settings_with_http_info(update_chat_desktop_notification_settings_input_object, opts)\n nil\n end",
"def remove\n return unless confirm_command\n\n args.each do |name|\n messages = nil\n if name.start_with? \"HEROKU_POSTGRESQL_\"\n name = name.chomp(\"_URL\").freeze\n end\n action(\"Removing #{name} on #{app}\") do\n messages = addon_run { heroku.uninstall_addon(app, name, :confirm => app) }\n end\n display(messages[:attachment]) if messages[:attachment]\n display(messages[:message]) if messages[:message]\n end\n end",
"def clear_screen\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\nend",
"def clear_screen\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\nend",
"def clear_screen\n Gem.win_platform? ? (system \"cls\") : (system \"clear\")\nend",
"def mobile_exit(mobile)\n if mobile.is_player?\n @players.delete(mobile)\n if @players.empty?\n @players = nil\n end\n else\n @mobiles.delete(mobile)\n if @mobiles.empty?\n @mobiles = nil\n end\n end\n Game.instance.fire_event(self, :room_mobile_exit, {mobile: mobile})\n return\n end",
"def destroy\n\t\tsession[:user_id] = nil\n\t\tif (params['mobile'].to_i == 1)\n\t\t\tredirect_to '/mobile/login/'\n\t\telse\n\t\t\tredirect_to root_path\n\t\tend\n\tend"
] | [
"0.7939232",
"0.58576113",
"0.583454",
"0.51110566",
"0.46880496",
"0.46064773",
"0.4504501",
"0.44935206",
"0.44927365",
"0.4477538",
"0.44751856",
"0.44677877",
"0.44565356",
"0.4432883",
"0.44187096",
"0.44145742",
"0.43738288",
"0.43343857",
"0.43275428",
"0.43227485",
"0.43174893",
"0.42841086",
"0.4269556",
"0.41731107",
"0.41641438",
"0.41011027",
"0.40967086",
"0.40887052",
"0.40742135",
"0.40712026",
"0.40688485",
"0.40597758",
"0.40467456",
"0.40414503",
"0.4006133",
"0.4001038",
"0.399293",
"0.39881265",
"0.3941387",
"0.39179215",
"0.3916877",
"0.3916877",
"0.3909524",
"0.38917586",
"0.38895357",
"0.3877424",
"0.3874697",
"0.38743123",
"0.387246",
"0.38710082",
"0.38623133",
"0.38494632",
"0.38463524",
"0.38356242",
"0.38274422",
"0.3814608",
"0.38044208",
"0.3788372",
"0.3783269",
"0.37776795",
"0.37772846",
"0.37747136",
"0.37623593",
"0.3756199",
"0.37463716",
"0.3744653",
"0.37365702",
"0.37360394",
"0.37332544",
"0.37309608",
"0.37304527",
"0.3729626",
"0.37162548",
"0.3715837",
"0.3715187",
"0.3711143",
"0.37107867",
"0.37082288",
"0.37063646",
"0.370138",
"0.36988816",
"0.36988652",
"0.36948436",
"0.36903858",
"0.3689447",
"0.3688662",
"0.36858204",
"0.36854556",
"0.36791408",
"0.36791408",
"0.36791408",
"0.36780274",
"0.367541",
"0.36751044",
"0.36674818",
"0.36655596",
"0.36655596",
"0.36655596",
"0.36608523",
"0.36596"
] | 0.81090945 | 0 |
Move a particular window to the front and activate it. This might be usful after moving windows to other desktops. | def set_front_window(window_id)
TSApi.tsapi_setFrontWindow(window_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bring_current_window_to_front\n @fox_driver.switch_to.window(@fox_driver.window_handles.first)\n end",
"def show_window\r\n if visible?\r\n bring_to_front()\r\n else\r\n show_modal()\r\n end\r\n end",
"def activate_process_window( pid )\n pid , hwnd = find_parent_process_with_hwnd(pid)\n wsh.AppActivate(pid) if pid\n end",
"def window_focus window_name\r\n command 'windowFocus', window_name\r\n end",
"def activate_current_window\n if @item_window.index > -1\n @item_window.activate\n else\n @category_window.activate\n end\n end",
"def focus(window)\n WIN[:focus].call window\n end",
"def focus(window)\n WIN[:focus].call window\n end",
"def activate\n Window.functions[__method__] ||= AU3_Function.new(\"WinActivate\", 'SS')\n Window.functions[__method__].call(@title.wide, @text.wide)\n active?\n end",
"def focus_window(win=nil)\n window(win) << '.dialog().dialog(\"focus\");'\n nil\n end",
"def focus\n XDo::FFILib.xdo_window_focus @_xdo_pointer, @_window\n end",
"def switch_to_previous_window\n @window_id -= 1\n if @window_id < 0\n # wrap back to the last\n @window_id = @browser.windows.count - 1\n end\n\n @browser.windows[@window_id].use\n end",
"def active_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_get_active @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def focused_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_get_focus @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def focus\n application.focus(self)\n end",
"def command_back\n @confirm_window.close\n @items_window.smooth_move(0, @items_window.y)\n @materials_window.smooth_move(0, @materials_window.y)\n #@gold_window.smooth_move(0, @gold_window.y)\n @details_window.smooth_move(Graphics.width/2, @details_window.y)\n @items_window.activate\n end",
"def switch_window\n current_window = window\n wins = windows\n wait_until { (wins = windows) && wins.size > 1 } if wins.size == 1\n raise StandardError, 'Unable to determine which window to switch to' if wins.size > 2\n\n wins.find { |w| w != current_window }.use\n window\n end",
"def activate_window(title)\n append_to_script \"activate_window \\\"#{title}\\\"\"\n end",
"def move_first_window_or_create_new(window)\n if window == windows.first\n move_window(window.index)\n else\n new_window(window)\n end\n end",
"def show_window\n\t\tif self.visible?\n\t\t\tself.bring_to_front\n\t\telse\n\t\t\t# We use set_file here to prevent Macs loading the whole dialog when the\n\t\t\t# plugin loads. No need to populate the dialog and use extra resources\n\t\t\t# if it will never be used.\n\t\t\tfilepath = File.join(PATH, 'webdialog/ui_manager.html')\n\t\t\tself.set_file(filepath)\n\t\t\tif PLUGIN.is_mac?\n\t\t\t\tself.show_modal\n\t\t\telse\n\t\t\t\tself.show\n\t\t\tend\n\t\tend\n\tend",
"def activate_cat(cat_win)\n cat_win.activate\n cat_win.select(0)\n end",
"def active_window\n windows = @terminal.windows.get\n windows.detect do |window|\n window.properties_.get[:frontmost] rescue false\n end\n end",
"def active_window\n windows = @terminal.windows.get\n windows.detect do |window|\n window.properties_.get[:frontmost] rescue false\n end\n end",
"def real_focused_window\n window_pointer = FFI::MemoryPointer.new :ulong, 1\n XDo::FFILib.xdo_window_sane_get_focus @_pointer, window_pointer\n XDo::Window.new self, window_pointer.read_ulong\n end",
"def move_home_x\n @target_x = 0\n start_command('F11', true, false)\n end",
"def foregroundize\n SetForegroundWindow.call(@handle) != 0\n end",
"def set_backing_window win\n @otherwin = win\n # XX should we extract the coordinates and use for printing ??\n # or for setting maxrow and maxcol\n end",
"def switch_window(new_window, coords: {})\n @window = new_window\n move(coords[:y], coords[:x]) unless coords.empty?\n end",
"def swap_with(window)\n server.invoke_command \"swap-window -s #{identifier} -t #{window.identifier}\"\n end",
"def raise\n # Unsure of the proper tool to use here. \"windowactivate\" seems to work.\n xdotool \"windowactivate #{@id}\"\n sleep $sleep_time\n end",
"def set_on_top=(val)\n Window.functions[__method__] ||= AU3_Function.new(\"WinSetOnTop\", 'SSL', 'L')\n Window.functions[__method__].call(@title.wide, @text.wide, !!val)\n val\n end",
"def minimize_window(win)\n # noop\n end",
"def activate()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.HotkeySystem_activate(@handle.ptr)\n end",
"def bring_to_front\n {\n method: \"Page.bringToFront\"\n }\n end",
"def test_moveTo_Inside_Top\n w = Window_Base.new(100, -50, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(100, 100)\n return true\n end",
"def window(name_or_handle)\n logger.info 'EyesTargetLocator.window()'\n logger.info 'Making preparaions...'\n on_will_switch.will_switch_to_window name_or_handle\n logger.info 'Done! Switching to window..'\n __getobj__.window name_or_handle\n logger.info 'Done!'\n driver\n end",
"def launch(app_name, *options)\n options = combine_options(*options)\n\n ensure_window = nil\n begin\n ensure_window = send(\"ensure_window_for_#{ app_name.downcase }\")\n rescue\n end\n ensure_window ||= \"\"\n\n positioning = nil\n begin\n positioning = send(\"positioning_for_#{ app_name.downcase }\")\n rescue\n end\n unless positioning\n if options[:to]\n pos = \"#{options[:to][:left]}, #{options[:to][:top]}\"\n dims = \"#{options[:to][:left] + options[:to][:width]}, \" +\n \"#{options[:to][:top] + options[:to][:height]}\"\n if options[:to][:width]\n positioning = \"set bounds of front window to {#{pos}, #{dims}}\"\n else\n positioning = \"set position of front window to {#{pos}}\"\n end\n end\n end\n\n execute_applescript(%Q`\n tell application \"#{app_name}\"\n activate\n #{ensure_window}\n #{positioning}\n end tell\n `)\n end",
"def active_window\n if File.exists?(wmii_namespace)\n 'wmiir cat /client/sel/ctl | sed 1q'\n else\n %q[xprop -root _NET_ACTIVE_WINDOW | awk '/#/ { print $(NF) ; exit } END { exit 1 }' || xdotool getwindowfocus]\n end\nend",
"def show_target_window(right)\n @item_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n heigth_remain = (480 - @target_window.height)/2\n @target_window.y = heigth_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end",
"def show_target_window(right)\n @item_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n heigth_remain = (480 - @target_window.height)/2\n @target_window.y = heigth_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end",
"def launch(app_name, options)\n ensure_window = nil\n begin\n ensure_window = movie.send(\"ensure_window_for_#{ app_name.downcase }\")\n rescue\n end\n ensure_window ||= \"\"\n\n positioning = nil\n begin\n positioning = movie.send(\"positioning_for_#{ app_name.downcase }\")\n rescue\n end\n unless positioning\n if options[:to]\n pos = \"#{options[:to][:left]}, #{options[:to][:top]}\"\n dims = \"#{options[:to][:left] + options[:to][:width]}, \" +\n \"#{options[:to][:top] + options[:to][:height]}\"\n if options[:to][:width]\n positioning = \"set bounds of front window to {#{pos}, #{dims}}\"\n else\n positioning = \"set position of front window to {#{pos}}\"\n end\n end\n end\n\n execute_applescript(%Q`\n tell application \"#{app_name}\"\n activate\n #{ensure_window}\n #{positioning}\n end tell\n `)\n end",
"def move_home_x\n $status.info_target_x = 0\n execute_command('F11', true, false)\n end",
"def show_window\n end",
"def select_previous_window(num = 1)\n @server.invoke_command \"select-window -t:-#{num}\"\n current_window\n end",
"def main_window\r\n super\r\n # Make windows\r\n @left_window = Window_DebugLeft.new\r\n @right_window = Window_DebugRight.new\r\n @help_window = Window_Base.new(192, 352, 448, 128)\r\n @help_window.contents = Bitmap.new(406, 96)\r\n # Restore previously selected item\r\n @left_window.top_row = $game_temp.debug_top_row\r\n @left_window.index = $game_temp.debug_index\r\n @right_window.mode = @left_window.mode\r\n @right_window.top_id = @left_window.top_id\r\n end",
"def test_moveTo_Outside_Top\n w = Window_Base.new(100, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(100, -50)\n return true\n end",
"def reposition_window\n config = MARW_CONFIGURATION\n self.x = config[:window_x] == -1 ? (Graphics.width - window_width) / 2 : config[:window_x]\n self.y = 0\n end",
"def main_window\r\n super\r\n # Make actor command window\r\n s1 = $data_system.words.attack\r\n s2 = $data_system.words.skill\r\n s3 = $data_system.words.guard\r\n s4 = $data_system.words.item\r\n @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])\r\n @actor_command_window.y = 160\r\n @actor_command_window.back_opacity = 160\r\n @actor_command_window.active = false\r\n @actor_command_window.visible = false\r\n # Make other windows\r\n @party_command_window = Window_PartyCommand.new\r\n @help_window = Window_Help.new\r\n @help_window.back_opacity = 160\r\n @help_window.visible = false\r\n @status_window = Window_BattleStatus.new\r\n @message_window = Window_Message.new\r\n end",
"def set_avatar\n @avatar_window.activate\n @avatar_window.x = 0 - @avatar_window.width unless @avatar_window.visible\n @avatar_window.visible = true\n @avatar_window.smooth_move(0, @avatar_window.y)\n end",
"def switch_to_other_window\n @window_id = (@window_id - 1).abs\n if @window_id != 0 and @window_id !=1\n puts @window_id\n raise(Exception::WindowMatchError, \"You cannot use this keyword when more than 2 windows are open; you must use 'Switch To Window', 'Switch to Next Window', or 'Switch to Previous Window'\")\n end\n\n @browser.windows[@window_id].use\n end",
"def main_window\r\n super\r\n # Make command window\r\n s1 = \"To Title\"\r\n s2 = \"Shutdown\"\r\n s3 = \"Cancel\"\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 240 - @command_window.height / 2\r\n end",
"def switch_to_next_window\n @window_id += 1\n if @window_id >= @browser.windows.count\n # wrap back to the first\n @window_id = 0\n end\n\n @browser.windows[@window_id].use\n end",
"def mvwin(y, x)\n Ncurses.mvwin(pointer, y, x)\n end",
"def open_window_with_key_press(win_name, key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_shown(win_name)\n end",
"def open_window_with_key_press(win_name, key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_shown(win_name)\n end",
"def customWindowsToEnterFullScreenForWindow(window)\n\t\t[window]\n\tend",
"def main_window\r\n super\r\n # Make command window\r\n s1 = \"New Game\"\r\n s2 = \"Continue\"\r\n s3 = \"Shutdown\"\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.back_opacity = 160\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 288\r\n # If continue is enabled, move cursor to \"Continue\"\r\n # If disabled, display \"Continue\" text in gray\r\n if @continue_enabled\r\n @command_window.index = 1\r\n else\r\n @command_window.disable_item(1)\r\n end\r\n end",
"def switch_to_previous_window\n $driver.switch_to.window $previous_window\nend",
"def open_window(options = nil)\n terminal_process.keystroke(\"n\", :using => :command_down)\n # Options of the first tab must be set before window options, \n # because change of the first tab options causes change of window size\n if options \n set_options(return_last_tab, allowed_options(:tab, options))\n set_options(active_window, allowed_options(:window, options))\n end\n return_last_tab\n end",
"def switch_to_main_window\n $previous_window = $driver.window_handle\n $driver.switch_to.window($driver.window_handles.first)\nend",
"def focus!\n @gtk_socket.can_focus = true\n @gtk_socket.has_focus = true\n end",
"def main_window\r\n super\r\n # Make actor command window\r\n s1 = SDK::Scene_Commands::Scene_Battle::Attack\r\n s2 = SDK::Scene_Commands::Scene_Battle::Skill\r\n s3 = SDK::Scene_Commands::Scene_Battle::Guard\r\n s4 = SDK::Scene_Commands::Scene_Battle::Item\r\n @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])\r\n @actor_command_window.y = 160\r\n @actor_command_window.back_opacity = 160\r\n @actor_command_window.active = false\r\n @actor_command_window.visible = false\r\n # Make other windows\r\n @party_command_window = Window_PartyCommand.new\r\n @help_window = Window_Help.new\r\n @help_window.back_opacity = 160\r\n @help_window.visible = false\r\n @status_window = Window_BattleStatus.new\r\n @message_window = Window_Message.new\r\n end",
"def main_window\r\n super\r\n # Make windows\r\n @help_window = Window_Help.new\r\n @left_window = Window_EquipLeft.new(@actor)\r\n @right_window = Window_EquipRight.new(@actor)\r\n @item_window1 = Window_EquipItem.new(@actor, 0)\r\n @item_window2 = Window_EquipItem.new(@actor, 1)\r\n @item_window3 = Window_EquipItem.new(@actor, 2)\r\n @item_window4 = Window_EquipItem.new(@actor, 3)\r\n @item_window5 = Window_EquipItem.new(@actor, 4)\r\n # Associate help window\r\n @right_window.help_window = @help_window\r\n @item_window1.help_window = @help_window\r\n @item_window2.help_window = @help_window\r\n @item_window3.help_window = @help_window\r\n @item_window4.help_window = @help_window\r\n @item_window5.help_window = @help_window\r\n # Set cursor position\r\n @right_window.index = @equip_index\r\n refresh\r\n end",
"def show_target_window(right)\n @skill_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n height_remain = (480 - @target_window.height)/2\n @target_window.y = height_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end",
"def show_target_window(right)\n @skill_window.active = false\n width_remain = (640 - @target_window.width)/2\n @target_window.x = width_remain.floor\n height_remain = (480 - @target_window.height)/2\n @target_window.y = height_remain.floor\n @target_window.visible = true\n @target_window.active = true\n end",
"def main_window\r\n super\r\n # Make help window, status window, and skill window\r\n @help_window = Window_Help.new\r\n @status_window = Window_SkillStatus.new(@actor)\r\n @skill_window = Window_Skill.new(@actor)\r\n # Associate help window\r\n @skill_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end",
"def before?(other)\n FXWindow.before?(other)\n end",
"def overwrite_window\n return @window.overwrite(@otherwin.get_window)\n end",
"def make_current\n @window.make_current\n Screen.current = self\n self.vsync = @vsync\n end",
"def overlay(dest_win)\n if dest_win.respond_to?(:win)\n Ncurses.overlay(pointer, dest_win.win)\n else\n Ncurses.overlay(pointer, dest_win)\n end\n end",
"def setwindow(*)\n super\n end",
"def activate\n @hidden = 0 # Active worksheet can't be hidden.\n @selected = 1\n set_activesheet(@index)\n end",
"def pbActivateWindow(sprites,key)\n return if !sprites\n activeStatuses={}\n for i in sprites\n if i[1] && i[1].is_a?(Window) && !pbDisposed?(i[1])\n activeStatuses[i[0]]=i[1].active\n i[1].active=(i[0]==key)\n end\n end\n if block_given?\n begin\n yield\n ensure\n pbRestoreActivations(sprites,activeStatuses)\n end\n return {}\n else\n return activeStatuses\n end\nend",
"def update_page_window\n if Input.trigger?(Input::B)\n Sound.play_cancel\n @event_window.show.activate\n @page_window.hide.deactivate\n elsif Input.trigger?(Input::C)\n Sound.play_ok\n @mode_window.show.activate\n @page_window.deactivate\n end\n end",
"def main_window\r\n super\r\n # Make help window, item window\r\n @help_window = Window_Help.new\r\n @item_window = Window_Item.new\r\n # Associate help window\r\n @item_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end",
"def show_popup(index)\n @last_frame = Graphics.frame_count\n @popup_index = index\n x = Graphics.width - popup.width\n y = @help_window.height\n popup.x = Graphics.width\n popup.visible = true\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0 - popup.width, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0 - popup.width\n popup.x = x\n end\n popup.activate\n end",
"def show_popup(index)\n @last_frame = Graphics.frame_count\n @popup_index = index\n x = Graphics.width - popup.width\n y = @help_window.height\n popup.x = Graphics.width\n popup.visible = true\n if $imported[\"H87_SmoothMovements\"]\n @option_window.smooth_move(0 - popup.width, y)\n popup.smooth_move(x, y)\n else\n @option_window.x = 0 - popup.width\n popup.x = x\n end\n popup.activate\n end",
"def open_window_with_action(win_name, action_name, *params)\n if LoadActions.include?(action_name) then\n raise(DesktopExceptions::UnsupportedActionException, \"Action #{action_name} not supported\")\n end\n \n wait_start\n opera_desktop_action(action_name, *params)\n wait_for_window_shown(win_name)\n end",
"def init_window\n self.z = 10_000\n lock\n @name_window.visible = false\n @name_window.lock\n @name_text.text = ''\n update_windowskin\n init_pause_coordinates\n self.pauseskin = RPG::Cache.windowskin(PauseSkin)\n self.back_opacity = ($game_system.message_frame == 0 ? 255 : 0)\n unlock\n @name_window.unlock\n end",
"def reset_window (change_opacity = true)\n # x-coordinate depends on justification\n if $game_system.message_event == -1 and $game_system.train_actor == -1\n if $game_system.window_justification == RIGHT\n self.x = 640 - $game_system.window_width\n elsif $game_system.window_justification == LEFT\n self.x = 0\n else # center\n self.x = (640 - self.width) / 2\n end\n elsif $game_system.train_actor >= 0\n if $game_system.train_actor == 0 or $game_system.train_actor > $game_party.actors.size - 1\n # center on player\n event_x = $game_player.screen_x\n else\n # center on train actor\n event_x = $game_train.actors[$game_system.train_actor - 1].screen_x\n end\n self.x = event_x - self.width / 2\n @comic.x = self.x + (self.width / 2) + 4\n else\n if $game_system.message_event == 0 or $game_map.events[$game_system.message_event] == nil\n # center on player\n event_x = $game_player.screen_x\n else\n # center on the event specified\n event_x = $game_map.events[$game_system.message_event].screen_x\n end\n self.x = event_x - self.width / 2\n @comic.x = self.x + (self.width / 2) + 4\n end\n \n if $game_temp.in_battle\n self.y = 16\n else\n if $game_system.message_event == -1 and $game_system.train_actor == -1\n case $game_system.message_position\n when 0 # up\n self.y = 16\n when 1 # middle\n #self.y = (480 - $game_system.window_height) / 2\n self.y = (480 - self.height) / 2\n when 2 # down\n #self.y = 480 - $game_system.window_height - 24\n self.y = 480 - self.height - 24\n end\n elsif $game_system.train_actor >= 0\n if $game_system.train_actor == 0 or $game_system.train_actor > $game_party.actors.size - 1\n # center on player\n self.y = $game_player.screen_y - self.height - 48\n else\n # center on train actor\n self.y = $game_train.actors[$game_system.train_actor - 1].screen_y - self.height - 48\n end\n @comic.y = self.y + self.height - 2\n @comic.angle = 0\n else\n if $game_system.message_event == 0 or $game_map.events[$game_system.message_event] == nil\n # above player\n self.y = $game_player.screen_y - self.height - 48\n else\n # above event specified\n self.y = $game_map.events[$game_system.message_event].screen_y - self.height - 48\n end\n @comic.y = self.y + self.height - 2\n @comic.angle = 0\n end\n end\n if self.y < 0 + ($game_system.name == \"\" ? 0 : 16)\n if $game_system.comic_enabled\n if $game_system.message_event == 0 or $game_map.events[$game_system.message_event] == nil\n self.y = $game_player.screen_y - 16\n else\n self.y = $game_map.events[$game_system.message_event].screen_y - 16\n end\n @comic.angle = 180\n @comic.y = self.y + 2\n @comic.x = self.x + (self.width / 2) - 4\n else\n self.y = 0 + ($game_system.name == \"\" ? 0 : 16)\n end\n elsif self.y > 480 - self.height \n self.y = 480 - self.height\n end\n if self.x < 0 \n self.x = 0\n elsif self.x > 680 - self.width - 48\n self.x = 640 - self.width\n end\n \n if change_opacity\n if $game_system.message_frame == 0 and $game_temp.message_text != \"\"\n self.opacity = $game_system.opacity\n else\n self.opacity = 0\n end\n self.back_opacity = $game_system.back_opacity\n end\n \n # window back stuff\n if $game_system.window_image != nil\n @window_back.bitmap = RPG::Cache.windowskin($game_system.window_image)\n @window_back.x = self.x\n @window_back.y = self.y\n end\n \n # face stuff\n if $game_system.face_graphic != \"\" \n # the player has chosen to show a face graphic\n if @done and $game_system.resting_face != \"\"\n @face.bitmap = RPG::Cache.picture($game_system.face_graphic + $game_system.resting_face)\n if @face_frame * $game_system.face_frame_width >= @face.bitmap.width\n @face_frame = 0\n end\n else\n @face.bitmap = RPG::Cache.face($game_system.face_graphic) #RPG::Cache.picture($game_system.face_graphic)\n end\n \n # picture y-coordinate\n if $game_system.face_graphic_position == ABOVE\n @face.y = self.y - @face.bitmap.height\n @face_offset = 0\n elsif $game_system.face_graphic_position == CENTER\n delta = (@face.bitmap.height - self.height) / 2\n @face.y = self.y - delta\n if $game_system.animated_faces\n @face_offset = $game_system.face_frame_width + 16\n else\n @face_offset = @face.bitmap.width + 16\n end\n elsif $game_system.face_graphic_position == BOTTOM \n @face.y = self.y + self.height - @face.bitmap.height\n if $game_system.animated_faces\n @face_offset = $game_system.face_frame_width + 16\n else\n @face_offset = @face.bitmap.width + 16\n end\n else # side\n delta = (@face.bitmap.height - self.height) / 2\n @face.y = self.y - delta\n @face_offset = 0\n end\n \n # picture x-coordinate\n if $game_system.face_graphic_justification == LEFT\n if $game_system.face_graphic_position == SIDE\n @face.x = self.x - @face.bitmap.width\n else\n @face.x = self.x + 10\n end\n else # right side\n if $game_system.animated_faces\n offset = @face.bitmap.width - $game_system.face_frame_width\n else\n offset = 0\n end\n if $game_system.face_graphic_position == SIDE\n @face.x = self.x + self.width + offset\n else\n @face.x = self.x + self.width - @face.bitmap.width - 10 + offset\n @face_offset = 0\n end\n end\n \n if $game_system.animated_faces\n @face.src_rect = Rect.new(@face_frame * $game_system.face_frame_width, 0, $game_system.face_frame_width, @face.bitmap.height)\n if @done and $game_system.resting_face != \"\"\n pause = $game_system.resting_animation_pause\n else\n pause = $game_system.animation_pause\n end\n if Graphics.frame_count % pause == 0\n @animate_face = true\n end\n if @animate_face\n if Graphics.frame_count % 3 == 0\n @face_frame += 1\n if @face_frame * $game_system.face_frame_width >= @face.bitmap.width\n @face_frame = 0\n @animate_face = false\n end\n end\n end\n end\n end\n \n # name window\n if $game_system.name != \"\"\n @name_window.x = self.x\n @name_window.y = self.y - 36\n @name_window.set_name($game_system.name)\n end\n \n # If choice\n if $game_temp.choice_max > 0\n @choice_window.set_choices($game_temp.choices)\n # determine x and y coords for choice window\n if $game_system.choice_justification == LEFT\n @choice_window.x = self.x\n else\n @choice_window.x = self.x + self.width - @choice_window.width\n end\n if $game_system.choice_position == ABOVE\n # check to make sure there is enough room above the textbox\n if self.y < @choice_window.height\n # not enough room above, place below\n @choice_window.y = self.y + self.height\n else\n # draw above\n @choice_window.y = self.y - @choice_window.height\n end\n elsif $game_system.choice_position == BOTTOM\n # check to make sure there is enough room below the textbox\n if (480 - self.y - self.height) < @choice_window.height\n # not enough room below, place above\n @choice_window.y = self.y - @choice_window.height\n else\n # draw below \n @choice_window.y = self.y + self.height\n end\n else # side\n if $game_system.choice_justification == LEFT\n # check to make sure there's room on the left side\n if self.y < @choice_window.width\n # not enough room on the side, check to make sure there's room below\n if (480 - self.y - self.height) < @choice_window.height\n # not enough room below, place above\n @choice_window.y = self.y - @choice_window.height\n else\n # draw below \n @choice_window.y = self.y + self.height\n end\n else\n # place on the left side\n @choice_window.y = self.y\n @choice_window.x = self.x - @choice_window.width\n end\n else # right\n # check to make sure there's room on the right side\n if (680 - (self.y + self.width)) < @choice_window.width\n # not enough room on the side, check to make sure there's room below\n if (480 - self.y - self.height) < @choice_window.height\n # not enough room below, place above\n @choice_window.y = self.y - @choice_window.height\n else\n # draw below \n @choice_window.y = self.y + self.height\n end\n else\n # place on the left side\n @choice_window.y = self.y\n @choice_window.x = self.x + self.width\n end\n end\n end\n end\n \n # If number input\n if $game_temp.num_input_variable_id > 0\n if @input_number_window == nil\n digits_max = $game_temp.num_input_digits_max\n number = $game_variables[$game_temp.num_input_variable_id]\n @input_number_window = Window_InputNumber.new(digits_max)\n @input_number_window.number = number\n end\n # determine x and y coords for number input window\n if $game_system.choice_justification == LEFT\n @input_number_window.x = self.x\n else\n @input_number_window.x = self.x + self.width - @input_number_window.width\n end\n if $game_system.choice_position == ABOVE\n # check to make sure there is enough room above the textbox\n if self.y < @input_number_window.height\n # not enough room above, place below\n @input_number_window.y = self.y + self.height\n else\n # draw above\n @input_number_window.y = self.y - @choice_window.height\n end\n elsif $game_system.choice_position == BOTTOM\n # check to make sure there is enough room below the textbox\n if (480 - self.y - self.height) < @input_number_window.height\n # not enough room below, place above\n @input_number_window.y = self.y - @input_number_window.height\n else\n # draw below \n @input_number_window.y = self.y + self.height\n end\n else # side\n if $game_system.choice_justification == LEFT\n # check to make sure there's room on the left side\n if self.y < @input_number_window.width\n # not enough room on the side, check to make sure there's room below\n if (480 - self.y - self.height) < @input_number_window.height\n # not enough room below, place above\n @input_number_window.y = self.y - @input_number_window.height\n else\n # draw below \n @input_number_window.y = self.y + self.height\n end\n else\n # place on the left side\n @input_number_window.y = self.y\n @input_number_window.x = self.x - @choice_window.width\n end\n else # right\n # check to make sure there's room on the right side\n if (680 - (self.y + self.width)) < @input_number_window.width\n # not enough room on the side, check to make sure there's room below\n if (480 - self.y - self.height) < @input_number_window.height\n # not enough room below, place above\n @input_number_window.y = self.y - @input_number_window.height\n else\n # draw below \n @input_number_window.y = self.y + self.height\n end\n else\n # place on the left side\n @input_number_window.y = self.y\n @input_number_window.x = self.x + self.width\n end\n end\n end\n end\n end",
"def on_actor_change\n @status_window.actor = @actor\n @slot_window.actor = @actor\n @item_window.actor = @actor\n @attribute_window.actor = @actor\n @character_window.actor = @actor\n @preview_window.actor = @actor\n @slot_window.activate\n end",
"def open_window\n terminal_process.keystroke(\"n\", :using => :command_down)\n return_last_tab\n end",
"def present()\n LVGUI::Native.lv_disp_load_scr(@screen.lv_obj_pointer)\n reset_focus_group\n\n # Allow the window to do some work every time it is switched to.\n on_present\n end",
"def center_window(win)\n window(win) << \".dialog('option', 'position', 'center');\"\n end",
"def main_window\r\n super\r\n # Make command window\r\n s1 = SDK::Scene_Commands::Scene_Title::New_Game\r\n s2 = SDK::Scene_Commands::Scene_Title::Continue\r\n s3 = SDK::Scene_Commands::Scene_Title::Shutdown\r\n @command_window = Window_Command.new(192, [s1, s2, s3])\r\n @command_window.back_opacity = 160\r\n @command_window.x = 320 - @command_window.width / 2\r\n @command_window.y = 288\r\n # If continue is enabled, move cursor to \"Continue\"\r\n # If disabled, display \"Continue\" text in gray\r\n if @continue_enabled\r\n @command_window.index = 1\r\n else\r\n @command_window.disable_item(1)\r\n end\r\n end",
"def activate\r\n # puts 'activate'\r\n @@activated = true\r\n @suspended = false\r\n @user_esc = false\r\n @cancel_reason = nil\r\n @enable_redraw = true\r\n end",
"def open_window_with_action(win_name, action_name, *params)\n if LoadActions.include?(action_name) then\n raise(DesktopExceptions::UnsupportedActionException, \"Action #{action_name} not supported\")\n end\n\n wait_start\n opera_desktop_action(action_name, *params)\n wait_for_window_shown(win_name)\n end",
"def Edit_TakeFocus(hwndCtl) send_edit_message(hwndCtl, :TAKEFOCUS) end",
"def create(name, position=[0,0], active=true)\n return @windows[name.to_sym] if @windows[name.to_sym]\n window = GUI::Window.new(name)\n window.move(position[0],position[1])\n @windows[name.to_sym] = window\n end",
"def active_cursor_move\n @cursor.range = draw_ranges(@active_battler, 3)\n @windows[Menu_Actor].deactivate\n @windows[Menu_Actor].hide\n @windows[Win_Help].hide\n @drawn = false\n @cursor.mode = TBS_Cursor::Move\n end",
"def add_menu_window(win, index = -1)\n remove_menu_window(win)\n $game_system.macmm_optional_windows.insert(index, win)\n end",
"def test_moveTo_Outside_Left\n w = Window_Base.new(0, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(-100, 150)\n return true\n end",
"def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end",
"def skt_bringToFront\n\t\tparent = self.parent\n\t\tself.removeFromParent\n\t\tparent.addChild(self)\n\tend",
"def start(start_window)\n gtk_window.show_all\n start_window.start\n Gtk.main_with_queue\n end",
"def show\n\t\[email protected]\n\tend",
"def test_moveTo_Inside_Left\n w = Window_Base.new(-100, 100, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(0, 100)\n return true\n end",
"def linger caller_window=nil\n begin\n if caller_window\n ch = @win.getchar\n caller_window.ungetch(ch) # will this be available to underlying window XXX i think not !!\n else\n sleep 1\n end\n ensure\n destroy\n end\n end",
"def cancel_command()\n # Switch Window\n @list_window.active = true\n @list_window.visible = true\n @content_window.active = false\n end",
"def activate\n @hidden = 0 # Active worksheet can't be hidden.\n @selected = 1\n @activesheet = @index\n end",
"def lower(below = None)\n Tk.execute_only(:lower, window, below)\n end"
] | [
"0.8180855",
"0.71666",
"0.68272626",
"0.672905",
"0.66991854",
"0.6625408",
"0.6625408",
"0.65658736",
"0.6436523",
"0.6216314",
"0.62056345",
"0.61770236",
"0.6118638",
"0.59979236",
"0.5974988",
"0.5963231",
"0.5954785",
"0.59114265",
"0.58638746",
"0.5833954",
"0.5806035",
"0.5806035",
"0.57897586",
"0.5753898",
"0.56995696",
"0.5687659",
"0.5669574",
"0.5642846",
"0.5642433",
"0.56217235",
"0.5603044",
"0.5575974",
"0.5568117",
"0.5535457",
"0.55236155",
"0.5498004",
"0.54806656",
"0.54659206",
"0.54659206",
"0.5446248",
"0.54323494",
"0.5424896",
"0.5406042",
"0.5398984",
"0.5386963",
"0.5386794",
"0.5356395",
"0.5347327",
"0.53186774",
"0.53148544",
"0.5314115",
"0.53103894",
"0.53068084",
"0.53068084",
"0.5306172",
"0.5293749",
"0.5282497",
"0.5261579",
"0.52606666",
"0.52601624",
"0.5250597",
"0.52455515",
"0.52374613",
"0.52374613",
"0.52320194",
"0.52253205",
"0.5206888",
"0.52044636",
"0.5193766",
"0.51906306",
"0.5190118",
"0.51766676",
"0.51757616",
"0.51707953",
"0.5156796",
"0.5156796",
"0.5143889",
"0.51433676",
"0.5140252",
"0.51362664",
"0.51359934",
"0.51357347",
"0.5127967",
"0.51245743",
"0.5108511",
"0.51054674",
"0.5099646",
"0.5098599",
"0.50976676",
"0.5094179",
"0.5085921",
"0.5076453",
"0.50742024",
"0.50652534",
"0.5035264",
"0.5028025",
"0.5025248",
"0.50232565",
"0.50231135",
"0.50218046"
] | 0.71877915 | 1 |
Bind an app to a space. The bundle_id is normally in the format "com.apple.mail" Setting the space_uuid to AllSpaces will result in an app appearing on every desktop. Setting the space_uuid to nil will delete the setting for the given bundle_id. TotalSpaces2.bind_app_to_space("com.apple.mail", "AllSpaces") | def bind_app_to_space(bundle_id, space_uuid)
TSApi.tsapi_bindAppToSpace(bundle_id, space_uuid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_app\n @app = App.find(params[:uid])\n end",
"def fill_app\n if @param_storage.app_id == nil\n apps = @app_service.all\n @param_storage.store_app_id(apps[0].id) if apps.count == 1\n end\n end",
"def modify_application(app_name, namespace, public_hostname)\n end",
"def appstore_apps_labels(app_id, label_id, space_id)\n response = connection.put(get_appstore_apps_labels_url(app_id, label_id)) do |request|\n request.params[:adminDeviceSpaceId] = space_id\n end\n\n if response.success?\n AppStoreAppsLabelsResponse.new(response.body)\n end\n end",
"def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end",
"def app_with_pid pid\n AX::Application.new pid\n end",
"def set_app\n @app = current_client.apps.find(params[:id] || params[:app_id])\n end",
"def add_appserver_to_haproxy(app_id, ip, port)\n make_call(NO_TIMEOUT, RETRY_ON_FAIL, \"add_appserver_to_haproxy\") {\n @conn.add_appserver_to_haproxy(app_id, ip, port, @secret)\n }\n end",
"def register_application(app_name, namespace, public_hostname)\n end",
"def bind(namespace)\n # Over-write an empty prefix\n uri = namespace.uri.to_s\n @uri_binding[uri] = namespace unless namespace.prefix.to_s.empty?\n @uri_binding[uri] ||= namespace\n @nsbinding[namespace.prefix.to_s] = namespace\n end",
"def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end",
"def set_app\n @app = current_user.apps.find(params[:id])\n end",
"def set_app\n @app = current_user.apps.find(params[:app_id])\n end",
"def set_app\n @app = FortyTwo::App.find(params[:id])\n end",
"def bind_meta_app args={}, &block\n arg_string =\n args.values_at(:key, :listen_to, :respond_on, :application).join(\" \")\n arg_string += \"::#{args[:parameters]}\" if args[:parameters]\n\n application \"bind_meta_app\", arg_string, &block\n end",
"def launch_app\n @bridge.launch_app\n end",
"def enable_app(app)\n self.disable_app(app,'yes')\n end",
"def update!(**args)\n @app = args[:app] if args.key?(:app)\n end",
"def launch(app_name, *options)\n options = combine_options(*options)\n\n ensure_window = nil\n begin\n ensure_window = send(\"ensure_window_for_#{ app_name.downcase }\")\n rescue\n end\n ensure_window ||= \"\"\n\n positioning = nil\n begin\n positioning = send(\"positioning_for_#{ app_name.downcase }\")\n rescue\n end\n unless positioning\n if options[:to]\n pos = \"#{options[:to][:left]}, #{options[:to][:top]}\"\n dims = \"#{options[:to][:left] + options[:to][:width]}, \" +\n \"#{options[:to][:top] + options[:to][:height]}\"\n if options[:to][:width]\n positioning = \"set bounds of front window to {#{pos}, #{dims}}\"\n else\n positioning = \"set position of front window to {#{pos}}\"\n end\n end\n end\n\n execute_applescript(%Q`\n tell application \"#{app_name}\"\n activate\n #{ensure_window}\n #{positioning}\n end tell\n `)\n end",
"def application=(app)\n @application = app\n end",
"def application=(app)\n @application = app\n end",
"def application=(app)\n @application = app\n end",
"def bind\n req = VCAP::Services::Api::CloudControllerBindRequest.decode(request_body)\n\n app = ::App.find_by_collaborator_and_id(user, req.app_id)\n raise CloudError.new(CloudError::APP_NOT_FOUND) unless app\n\n cfg = ServiceConfig.find_by_name(req.service_id)\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg\n raise CloudError.new(CloudError::FORBIDDEN) unless cfg.provisioned_by?(user)\n\n binding = app.bind_to_config(cfg)\n\n resp = {\n :binding_token => binding.binding_token.uuid,\n :label => cfg.service.label\n }\n render :json => resp\n end",
"def update_app data={}\n put '/app', data\n end",
"def install_app(path, **options)\n options = options.transform_keys { |key| key.to_s.gsub(/_./) { |v| v[1].upcase } } unless options.nil?\n @bridge.install_app(path, options)\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def set_app\n @app = App.find(params[:id])\n end",
"def app(id_or_name_or_package_id)\n all_available_apps.find do |app|\n [app.name, app.id, app.package_id].include?(id_or_name_or_package_id)\n end\n end",
"def assign_group_to_application(app_id, group_id, options = {})\n put(\"/apps/#{app_id}/groups/#{group_id}\", options)\n end",
"def app=(name)\n self.config[:app] = name\n end",
"def addApplication(app)\n super(app)\n eachGroup { |g|\n # inform all enclosed groups, but do not request another install\n g.addApplication(app)\n }\n end",
"def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"def app_identifier=(value)\n @app_identifier = value\n end",
"def update!(**args)\n @space_id = args[:space_id] if args.key?(:space_id)\n end",
"def app(name=nil)\n if @app.nil? && name.nil? && Remotely.apps.size == 1\n name = Remotely.apps.first.first\n end\n\n (name and @app = name) or @app\n end",
"def set_app\n @app = App.find_by( token: params[:app_id])\n if !@app \n render json: { error: \"app not found\"}, status: :not_found\n end\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_AppID(value)\n set_input(\"AppID\", value)\n end",
"def set_phone_app\n @phone_app = PhoneApp.find(params[:id])\n end",
"def install_app(name)\n app = AppStore.find_app(name)\n @apps << app unless @apps.include?(app)\n end",
"def bind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_bind(queue, exchange, binding_key, arguments: arguments)\n end\n end",
"def install_app(name)\n app = AppStore.find_app(name)\n @apps << app unless app.nil? || @apps.include?(app)\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def assign_application_id\n self.application_id = supported_permission.application_id if supported_permission.present?\n end",
"def add_tuple_space(tuple_space)\n uuid = tuple_space.uuid\n\n # update tuple space table with the id\n @tuple_space_lock.synchronize {@tuple_space[uuid] = tuple_space}\n end",
"def change_space(namespace)\n update!(name: namespace)\n end",
"def set_registered_app\n @registered_app = RegisteredApp.find(params[:id])\n end",
"def set_registered_app\n @registered_app = RegisteredApp.find(params[:id])\n end",
"def update!(**args)\n @cast_app_id = args[:cast_app_id] if args.key?(:cast_app_id)\n @content_app_id = args[:content_app_id] if args.key?(:content_app_id)\n end",
"def set_global_appdata(params = {})\r\n deletes = context.remove_null_values(params)\r\n @context.call_myspace_api(:appdata_global_put, :body => params) if params.length > 0\r\n @context.call_myspace_api(:appdata_global_delete, :keys => deletes.join(';')) if deletes.length > 0\r\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def add_appserver_to_haproxy(app_id, ip, port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n if !my_node.is_login?\n return NO_HAPROXY_PRESENT\n end\n\n if @app_info_map[app_id].nil? or @app_info_map[app_id]['appengine'].nil?\n return NOT_READY\n end\n\n Djinn.log_debug(\"Adding AppServer for app #{app_id} at #{ip}:#{port}\")\n get_scaling_info_for_app(app_id)\n @app_info_map[app_id]['appengine'] << \"#{ip}:#{port}\"\n HAProxy.update_app_config(my_node.private_ip, app_id,\n @app_info_map[app_id])\n get_scaling_info_for_app(app_id, update_dashboard=false)\n\n return \"OK\"\n end",
"def install\n installed_app_bundle = installed_app_bundle_dir\n\n # App is not installed. Use simctl interface to install.\n if !installed_app_bundle\n installed_app_bundle = install_app_with_simctl\n else\n ensure_app_same\n end\n\n installed_app_bundle\n end",
"def set_space\n @space = Space.friendly.find(params[:id])\n redirect_to root_path unless @space.present?\n end",
"def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"def swap_app_ids(dbName)\n @conn = Mongo::Connection.new(DB_HOST)\n @db = @conn.db(SYSTEM_DB_NAME)\n @dbTenant = @conn.db(dbName)\n\n to_swap = [\n {\"app_name\" => \"inBloom Data Browser\", \"placeholder\" => \"DATABROWSER_ID_PLACEHOLDER\"},\n {\"app_name\" => \"inBloom Dashboards\", \"placeholder\" => \"DASHBOARD_ID_PLACEHOLDER\"},\n ]\n apps = @db.collection('application')\n app_auths = @dbTenant.collection('applicationAuthorization')\n\n to_swap.each do |app|\n puts \"Swapping IDs for #{app['app_name']}\"\n app_ent = apps.find_one({\"body.name\" => app['app_name']})\n if app_ent\n app_id = app_ent['_id']\n update_count = 0\n app_auths.find(\"body.appIds\" => app['placeholder']).each do |row|\n app_ids = row['body']['appIds']\n app_ids[app_ids.index(app['placeholder'])] = app_id\n app_auths.update({\"_id\" => row[\"_id\"]}, {\"$set\" => {\"body.appIds\" => app_ids}})\n update_count = update_count + 1\n end\n puts \"\\tUpdate #{update_count} entries\"\n end\n end\nend",
"def roby_app_start(*args, silent: false, **options)\n pid = roby_app_spawn(*args, silent: silent, **options)\n interface = assert_roby_app_is_running(pid)\n [pid, interface]\n end",
"def relocate_app(appid, http_port, https_port, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n http_port = Integer(http_port)\n https_port = Integer(https_port)\n\n # First, only let users relocate apps to ports that the firewall has open\n # for App Engine apps.\n if http_port != 80 and (http_port < 8080 or http_port > 8100)\n return \"Error: HTTP port must be 80, or in the range 8080-8100.\"\n end\n\n if https_port != 443 and (https_port < 4380 or https_port > 4400)\n return \"Error: HTTPS port must be 443, or in the range 4380-4400.\"\n end\n\n # Next, make sure that no other app is using either of these ports for\n # nginx, haproxy, or the AppServer itself.\n @app_info_map.each { |app, info|\n # Of course, it's fine if it's our app on a given port, since we're\n # relocating that app.\n next if app == appid\n\n if [http_port, https_port].include?(info['nginx'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['nginx_https'])\n return \"Error: Port in use by nginx for app #{app}\"\n end\n\n if [http_port, https_port].include?(info['haproxy'])\n return \"Error: Port in use by haproxy for app #{app}\"\n end\n\n # On multinode deployments, the login node doesn't serve App Engine apps,\n # so this may be nil.\n if info['appengine']\n info['appengine'].each { |appserver_port|\n if [http_port, https_port].include?(appserver_port)\n return \"Error: Port in use by AppServer for app #{app}\"\n end\n }\n end\n }\n\n if RESERVED_APPS.include?(appid)\n return \"Error: Can't relocate the #{appid} app.\"\n end\n\n # Next, remove the old port from the UAServer and add the new one.\n my_public = my_node.public_ip\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n uac.delete_instance(appid, my_public, @app_info_map[appid]['nginx'])\n uac.add_instance(appid, my_public, http_port)\n\n # Next, rewrite the nginx config file with the new ports\n Djinn.log_info(\"Regenerating nginx config for relocated app #{appid}\")\n @app_info_map[appid]['nginx'] = http_port\n @app_info_map[appid]['nginx_https'] = https_port\n proxy_port = @app_info_map[appid]['haproxy']\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n # Since we've changed what ports the app runs on, we should persist this\n # immediately, instead of waiting for the main thread to do this\n # out-of-band.\n backup_appserver_state\n\n if my_node.is_login?\n static_handlers = HelperFunctions.parse_static_data(appid)\n Nginx.write_fullproxy_app_config(appid, http_port, https_port, my_public,\n my_private, proxy_port, static_handlers, login_ip)\n end\n\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n\n # Same for any cron jobs the user has set up.\n # TODO(cgb): We do this on the login node, but the cron jobs are initially\n # set up on the shadow node. In all supported cases, these are the same\n # node, but there may be an issue if they are on different nodes in\n # the future.\n # TODO(cgb): This doesn't remove the old cron jobs that were accessing the\n # previously used port. This isn't a problem if nothing else runs on that\n # port, or if anything else there.\n CronHelper.update_cron(my_public, http_port,\n @app_info_map[appid]['language'], appid)\n\n # Finally, the AppServer takes in the port to send Task Queue tasks to\n # from a file. Update the file and restart the AppServers so they see\n # the new port. Do this in a separate thread to avoid blocking the caller.\n port_file = \"/etc/appscale/port-#{appid}.txt\"\n HelperFunctions.write_file(port_file, http_port)\n\n Thread.new {\n @nodes.each { |node|\n if node.private_ip != my_node.private_ip\n HelperFunctions.scp_file(port_file, port_file, node.private_ip,\n node.ssh_key)\n end\n next if not node.is_appengine?\n app_manager = AppManagerClient.new(node.private_ip)\n app_manager.restart_app_instances_for_app(appid)\n }\n }\n\n # Once we've relocated the app, we need to tell the XMPPReceiver about the\n # app's new location.\n MonitInterface.restart(\"xmpp-#{appid}\")\n\n return \"OK\"\n end",
"def app_id=(id)\n @app_id = id.to_s\n end",
"def move_window_to_space(window_id, space_number)\n TSApi.tsapi_moveWindowToSpaceOnDisplay(window_id, space_number, 0)\n end",
"def bind(id, repo_id, distributor_id, optional = {})\n required = required_params(binding.send(:local_variables), binding, ['id'])\n call(:post, path(\"#{id}/bindings/\"), :payload => { :required => required, :optional => optional })\n end",
"def app_id=(_arg0); end",
"def app_id=(_arg0); end",
"def launch(app_name, options)\n ensure_window = nil\n begin\n ensure_window = movie.send(\"ensure_window_for_#{ app_name.downcase }\")\n rescue\n end\n ensure_window ||= \"\"\n\n positioning = nil\n begin\n positioning = movie.send(\"positioning_for_#{ app_name.downcase }\")\n rescue\n end\n unless positioning\n if options[:to]\n pos = \"#{options[:to][:left]}, #{options[:to][:top]}\"\n dims = \"#{options[:to][:left] + options[:to][:width]}, \" +\n \"#{options[:to][:top] + options[:to][:height]}\"\n if options[:to][:width]\n positioning = \"set bounds of front window to {#{pos}, #{dims}}\"\n else\n positioning = \"set position of front window to {#{pos}}\"\n end\n end\n end\n\n execute_applescript(%Q`\n tell application \"#{app_name}\"\n activate\n #{ensure_window}\n #{positioning}\n end tell\n `)\n end",
"def launch(app_id, args)\n runcmd 'launch', \"#{app_id} #{args}\" \n end",
"def register_application(app_name, namespace, public_hostname)\n\n # create an A record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # create an update record\n\n update = {\n :comment => \"Add an application record for #{fqdn}\",\n :changes => [change_record(\"CREATE\", fqdn, @ttl, public_hostname)]\n }\n \n res = r53.change_resource_record_sets({\n :hosted_zone_id => @aws_hosted_zone_id,\n :change_batch => update\n })\n end",
"def insert_mounted_app(mounter)\n Padrino.mounted_apps.push(mounter) unless Padrino.mounted_apps.include?(mounter)\n end",
"def bind(exchange, binding_key, arguments: {})\n @client.exchange_bind(@name, exchange, binding_key, arguments: arguments)\n self\n end",
"def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def update!(**args)\n @host_app_name = args[:host_app_name] if args.key?(:host_app_name)\n end",
"def new_app(opts)\n api.app_new(\n applet: opts[:applet_dxid],\n name: AppSeries.construct_dxname(user.username, opts[:name], opts[:scope]),\n title: \"#{opts[:title]} \",\n summary: \" \",\n description: \"#{opts[:readme]} \",\n version: \"r#{opts[:revision]}-#{SecureRandom.hex(3)}\",\n resources: opts[:asset_dxids],\n details: { ordered_assets: opts[:asset_dxids] },\n openSource: false,\n billTo: bill_to,\n access: opts[:internet_access] ? { network: [\"*\"] } : {},\n )[\"id\"]\n end",
"def set_app\n @app = App.find_by(token: params[:token])\n end",
"def create(app_guid, space_guid, domain_guid, host = nil)\n app = @client.app(app_guid)\n space = @client.space(space_guid)\n domain = @client.domain(domain_guid)\n\n route = @client.routes.find { |rt|\n rt.host == host && rt.domain == domain && rt.space == space\n }\n\n unless route\n route = @client.route\n\n route.host = host if host != nil #app_name if app_name != nil\n route.domain = domain\n route.space = space\n route.create!\n end\n\n #@client.app(app_guid) will get an empty instance of Application, so we check that guid exists\n if app.guid\n app.add_route(route)\n end\n route\n end",
"def start(app, app_id = nil)\n defer = @web.defer\n app_id = app_id || AppStore.lookup(app)\n\n if app_id != nil && @status == :running\n @web.schedule do\n bindings = @bindings[app_id] ||= []\n starting = []\n\n bindings.each do |binding|\n starting << binding.bind\n end\n defer.resolve(::Libuv::Q.all(@web, *starting))\n end\n elsif app_id.nil?\n defer.reject('application not loaded')\n else\n defer.reject('server not running')\n end\n\n defer.promise\n end",
"def ensure_app_same\n installed_app_bundle = installed_app_bundle_dir\n\n if !installed_app_bundle\n RunLoop.log_debug(\"App: #{app} is not installed\")\n return true\n end\n\n installed_sha = installed_app_sha1\n app_sha = app.sha1\n\n if installed_sha == app_sha\n RunLoop.log_debug(\"Installed app is the same as #{app}\")\n return true\n end\n\n RunLoop.log_debug(\"The app you are testing is not the same as the app that is installed.\")\n RunLoop.log_debug(\" Installed app SHA: #{installed_sha}\")\n RunLoop.log_debug(\" App to launch SHA: #{app_sha}\")\n RunLoop.log_debug(\"Will install #{app}\")\n\n uninstall_app_with_simctl\n install_app_with_simctl\n true\n end",
"def app=(name)\n end",
"def application(name, options = {}, &blk)\n add_child(:applications, Hubcap::Application.new(self, name, options, &blk))\n end",
"def deregister_application(app_name, namespace)\n end",
"def update!(**args)\n @bundle_identifier = args[:bundle_identifier] if args.key?(:bundle_identifier)\n @localized_app_name = args[:localized_app_name] if args.key?(:localized_app_name)\n @open_app_url = args[:open_app_url] if args.key?(:open_app_url)\n end",
"def add_app_group(group,app)\n\t\tresults = submit_cmd('create app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t puts results\n\tend",
"def update!(**args)\n @app_id = args[:app_id] if args.key?(:app_id)\n @app_store = args[:app_store] if args.key?(:app_store)\n end",
"def bind_session (token)\n params = {\n :sessionid => token\n }\n invoke :bindSession, params\n end",
"def add_appserver_process(app_id, secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n # Starting a appserver instance on request to scale the application \n app = app_id\n @state = \"Adding an AppServer for #{app}\"\n\n uac = UserAppClient.new(@userappserver_private_ip, @@secret)\n app_manager = AppManagerClient.new(my_node.private_ip)\n\n warmup_url = \"/\"\n\n app_data = uac.get_app_data(app)\n \n Djinn.log_debug(\"Get app data for #{app} said [#{app_data}]\")\n\n loop {\n Djinn.log_info(\"Waiting for app data to have instance info for app named #{app}: #{app_data}\")\n\n app_data = uac.get_app_data(app)\n if app_data[0..4] != \"Error\"\n break\n end\n Kernel.sleep(5)\n }\n \n app_language = app_data.scan(/language:(\\w+)/).flatten.to_s\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n\n app_is_enabled = uac.does_app_exist?(app)\n Djinn.log_debug(\"is app #{app} enabled? #{app_is_enabled}\")\n if app_is_enabled == \"false\"\n return \n end\n\n appengine_port = find_lowest_free_port(STARTING_APPENGINE_PORT)\n Djinn.log_debug(\"Adding #{app_language} app #{app} on \" +\n \"#{HelperFunctions.local_ip}:#{appengine_port} \")\n\n xmpp_ip = get_login.public_ip\n\n result = app_manager.start_app(app, appengine_port, get_load_balancer_ip(),\n app_language, xmpp_ip, [Djinn.get_nearest_db_ip()],\n HelperFunctions.get_app_env_vars(app))\n\n if result == -1\n Djinn.log_error(\"ERROR: Unable to start application #{app} on port \" +\n \"#{appengine_port}.\")\n end\n\n # Tell the AppController at the login node (which runs HAProxy) that a new\n # AppServer is running.\n acc = AppControllerClient.new(get_login.private_ip, @@secret)\n acc.add_appserver_to_haproxy(app, my_node.private_ip, appengine_port)\n end",
"def set_space\n @space = current_user.spaces.friendly.find(params[:id])\n end"
] | [
"0.5276577",
"0.51932913",
"0.50844276",
"0.5054723",
"0.5017959",
"0.50005805",
"0.49933314",
"0.49660257",
"0.4934812",
"0.48842895",
"0.48402733",
"0.48287034",
"0.48214543",
"0.48156542",
"0.47961557",
"0.47172606",
"0.47152334",
"0.47052324",
"0.4700782",
"0.4697362",
"0.4697362",
"0.4697362",
"0.46740606",
"0.46719456",
"0.4664897",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46640152",
"0.46637753",
"0.46327242",
"0.46248138",
"0.4623999",
"0.46165612",
"0.46126187",
"0.46096143",
"0.460409",
"0.45932227",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45720705",
"0.45705894",
"0.45475224",
"0.4535142",
"0.45240143",
"0.45215648",
"0.45215648",
"0.4520496",
"0.4510791",
"0.44996107",
"0.44996107",
"0.44966674",
"0.44932377",
"0.44916654",
"0.44916654",
"0.4486651",
"0.44799173",
"0.44767195",
"0.4475193",
"0.4462479",
"0.44519278",
"0.44489694",
"0.44363463",
"0.44289252",
"0.44258422",
"0.44218454",
"0.44218454",
"0.44072825",
"0.4406661",
"0.4405391",
"0.4404177",
"0.4400071",
"0.43945202",
"0.4387448",
"0.43833885",
"0.43788502",
"0.43743017",
"0.4360237",
"0.43583792",
"0.4336824",
"0.43335256",
"0.43146992",
"0.43132535",
"0.43080562",
"0.42948025",
"0.42873815",
"0.42802495",
"0.42731455",
"0.42718452"
] | 0.84763855 | 0 |
GET /api/admin/user_evaluations.json def index | def create
@user_evaluation = ::UserEvaluation.new(user_evaluation_params)
@user_evaluation.evaluation = @evaluation
@user_evaluation.account = current_user.account
if @user_evaluation.save
render json: @user_evaluation, status: :created,
serializer: ::Admin::Evaluation::UserEvaluationSerializer
else
render json: @user_evaluation.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if current_user\n @evaluations = current_user.readable_evaluations\n else\n @circle = Circle.where(name: 'Public').try(:first)\n @evaluations = @circle.present? ? @circle.evaluations : []\n end\n user_ids = @evaluations.map(&:created_by_id)\n @users = User.in(id: user_ids)\n @users = @users.index_by(&:id)\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.accessible_by(current_ability, :read)\n end",
"def index\n @evaluates = Evaluate.all\n end",
"def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end",
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def index\r\n @evaluaciones = Evaluacione.all\r\n end",
"def index\n session[:evaluation_id] = nil\n if current_user.has_role? :admin\n @evaluations = Evaluation.all\n else\n @lesson = Lesson.find(session[:lesson_id]) if session[:lesson_id]\n @evaluations = Evaluation.where(user_id: current_user.id).order(updated_at: :desc)\n end\n\n end",
"def index\n @evaluaciones = Evaluacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluaciones }\n end\n end",
"def index\n @evals = Eval.all\n respond_with(@evals) \n end",
"def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def index\n @evaluos = Evaluo.all\n end",
"def index\n @evaluations = current_customer.customer_evaluations.order('evaluations.id desc')\n session[:left_service_orderitem] = 'theme'\n session[:right_service_orderitem] = 'theme'\n session[:right_service_query] = ''\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @evaluations}\n end\n end",
"def show\n @score = Evaluation.eval_user(@user)\n end",
"def index\n users = policy_scope(User)\n render json: { users: users }\n end",
"def index\n @evaluations = Evaluation.all\n @evaluation = Evaluation.new\n end",
"def get_evaluations\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_evaluations'\n\tend",
"def index\n @tutee = Tutee.find params[:tutee_id]\n @evaluations = @tutee.evaluations.where(:status => 'Pending')\n end",
"def index\n @student_goal_evaluations = StudentGoalEvaluation.all\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @evaluators }\n end\n end",
"def index\n @course_evaluations = CourseEvaluation.all\n end",
"def index\n json_response(User.all) \n end",
"def index\n @expressions = Expression.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expressions }\n end\n end",
"def index\n \n \n if user_signed_in? && current_user.admin?\n @users = User.all\n @unapproved_users = User.where(:approved => false)\n @approved_users = User.where(:approved => true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n else\n redirect_to root_path\n end\n end",
"def index\n if( is_admin? )\n \t\t@users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.json {render :json => @users.collect{|x| x.email} }\n end\n else\n redirect_to \"/home\", notice: \"Access Denied\"\n end\n end",
"def index\n @project_evaluations = ProjectEvaluation.all\n end",
"def index\n @user_results = UserResult.all\n end",
"def index\n @users = User.only_students\n @current_term = Term.where(:is_active => true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @users = AdminUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @performance_evaluations = PerformanceEvaluation.all\n end",
"def index\n render :json => UserInterest.all\n end",
"def index\n @predicted = false\n case params[:show]\n when \"unapproved\"\n @users = User.where(:cleared => false).order(\"name ASC\")\n when \"unwined\"\n @users = User.where(:wine => false).order(\"name ASC\")\n when \"predicted\"\n @predicted = true\n @users = User.where(:cleared => true).order(\"predicted DESC, name ASC\")\n else\n @users = User.where(:cleared => true).order(\"points DESC, name ASC\")\n end\n setup_latest_game_tip_hash\n # Any ongoing games right now? To toogle link to the page of predicted standing.\n @game_ongoing = Game.where(\"kickoff < ? AND final <> true\", Time.zone.now).count > 0\n @first_game_started = first_game_started?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n\n end",
"def index\n @advances = user_capabilities(Advance).current_advances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @advances }\n end\n end",
"def index\n @psicologic_evaluations = PsicologicEvaluation.all\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def index\n\t\trender json: User.all\n\tend",
"def index\n\t\trender json: User.all\n\tend",
"def show\n @evaluations = Evaluation.find(params[:id])\n end",
"def index\n if current_user.isadmin?\n @evaluations = Evaluation.all\n else\n @evaluations = Evaluation.where(\"user_id = ?\", current_user.id)\n end\n case params[:sort]\n when \"user\"\n @evaluations = @evaluations.sort_by{|ev| ev.user.full_name }\n when \"project\"\n @evaluations = @evaluations.sort_by{|ev| ev.project.title }\n when \"rating\"\n @evaluations = @evaluations.sort_by{|ev| ev.rating }\n else\n @evaluations = @evaluations.sort_by{|ev| ev.project.title }\n end\n if params[:sort_order] == 'desc'\n @evaluations = @evaluations.reverse\n end\n end",
"def index\n @userpolls = eager_userpoll.where(user_id: current_user.id)\n end",
"def index\n respond_with(end_user_plans)\n end",
"def project_evaluations\n ProjectEvaluation.where(user_id: @id)\n end",
"def index\n @admin_users = AdminUser.all\n\n respond_to do |format|\n format.html # not_index.html.erb\n format.json { render json: @admin_users }\n end\n end",
"def index\n respond_with current_user\n end",
"def index\n render json: User.all\n end",
"def index\n @employees = User.where(admin: true)\n end",
"def index\n @policy_valuations = PolicyValuation.all\n end",
"def completed_evaluations_list\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluations = []\n\t\tfor evaluation in @student.evaluations\n\t\t\tif evaluation.isCompleted\n\t\t\t\t@evaluations << evaluation\n\t\t\tend\n\t\tend\n\t\trender json: @evaluations\n\tend",
"def index\n render json: { users: User.pluck(:email, :admin), password: 'PassworD@55' }\n end",
"def index\n properties = current_user.properties\n\n if properties.any?\n render status: 200, json: { properties: properties.to_json }\n else\n render status: 404, json: { error: 'You have no properties' }\n end\n end",
"def index # ☑️ will get all users\n if current_user.admin == true \n render json: User.all\n else \n render json: {message: \"Authorized access denied. Admin status: #{current_user.admin}\"} \n end\n end",
"def index\n\t\t@equalizer_profiles = current_user.equalizer_profiles.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @equalizer_profiles }\n\t\t\tformat.json { render :json => @equalizer_profiles }\n\t\t\tformat.yaml { render :text => @equalizer_profiles.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def index\n @exercises = Exercise.all\n @user = current_user # changed get logged user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @users = User.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_roles }\n end\n end",
"def index\n @users = User.all\n authorize @users\n\n render json: @users\n end",
"def index\n\t\t@user = User.all\n\t\tCUSTOM_LOGGER.info(\"Start to return users #{@user.to_yaml}\")\n\tend",
"def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tokens }\n end\n end",
"def index\n\t\trender json: {\n\t\t\terror: nil,\n\t\t\tdata: @current_user.api_hash\n\t\t}\n\tend",
"def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end",
"def index\n @rules = Rule.all\n render_for_api :public, :json => @rules\n end",
"def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end",
"def index\n @users = User.all\n render json: @users, status: :ok\n end",
"def index\n ok_request current_user, %w(user, opinion_polls, opinion_polls.time_slots)\n end",
"def index\n if @user\n @equizzes = []\n if params[:subject]\n if Subject.find_by_name(params[:subject])\n @quizzes = @user.quizzes.where(:subject => Subject.find_by_name(params[:subject]),:enabled => true)\n\telse\n\t @quizzes = []\n\tend\n else\n @quizzes = @user.quizzes\n end\n @quizzes.each do |q|\n @equizzes << q.as_json.merge({unattempted: q.unattempted(@user).shuffle, numquestions: q.questions.count})\n end\n render :json => {quizzes:@equizzes,hearts:@user.hearts}.to_json\n else \n render text: \"Token failed verification\", status: 422\n end\n end",
"def index\n\t\t@runs = @current_user.runs\n\n\t\trender json: @runs\n\tend",
"def index\n @user = User.find(params[:user_id])\n unless can? :index, @user\n authorize! :index, WorkingExperience, :message => 'Not authorized as an administrator.'\n end\n @working_experiences = @user.working_experiences\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @working_experiences }\n end\n end",
"def index\n @users = User.where(at_ada: true).or.where(remote: true).order(\"available DESC\", \"at_ada DESC\").all\n\n @encouragement = [\n \"Drink some water.\",\n \"Call your person.\",\n \"Take a stretch break.\",\n \"Try talking it out with you rubber duck.\",\n \"Ask a friend to listen to you talk through your problem.\",\n \"Go for a short walk.\",\n \"Put on your favorite music and take a little break.\",\n \"Close your laptop for a few minutes.\",\n \"Did you restart your server?\"\n ].sample\n end",
"def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\r\n respond_with User.all\r\n end",
"def index\n @evaluacion_servicios = EvaluacionServicio.all\n end",
"def index\n @users = User.where(:admin => true).paginate(:page => params[:page], :per_page => 10).order('id DESC')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n respond_to do |format|\n if authorized?\n format.json { render json: User.all }\n else\n format.json { render json: unauthorized, status: :forbidden }\n end\n end\n end",
"def index\r\n users = User.all\r\n render json: users\r\n end",
"def index\n unless current_user.admin?\n respond_to do |format|\n format.html { redirect_to '/', alert: \"You don't have access to view that page\" }\n format.json { render :show, status: :ok, location: @user }\n end\n end\n @questions = Question.all\n end",
"def index\n require_user()\n @area_of_expertises = AreaOfExpertise.all\n end",
"def index\n\t\t\tif params[:q]\n\t\t\t\t@search = User.ransack(params[:q])\n\t\t\t\t@users = @search.result.page(params[:page])\n\t\t\telse\n\t\t\t\t@search = User.ransack(params[:q])\n\t\t\t\t@users = User.where('users.rol != ?', 'admin').page(params[:page])\n\t\t\tend\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend",
"def index\n # index not implemented - only admins may list users\n raise \"This action is not implemented\"\n end",
"def index\n render json: User.all\n end",
"def index\n render json: User.all\n end",
"def index\n if params[:query]\n @evaluations = Evaluation.text_search(params[:query]).paginate(page: params[:page]).\n order(date: :asc).per_page(10)\n flash[:notice] = 'Ningún resultado' if @evaluations.empty?\n else\n @evaluations = Evaluation.paginate(page: params[:page]).order(date: :asc).per_page(10)\n end\n end",
"def index\n if isAdmin?\n @title= \"Listing All Professors\"\n @users = User.where('role' => 2).paginate(page: params[:page])\n if([email protected]?)\n flash[:notice]= \"No professor on CMS. To create a new professor click on Create New Professor\"\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n else\n flash[:notice]= \"You don't have permission to browse all users\"\n redirect_to courses_path\n end\n end",
"def index\n params.permit(:user_id, :post_id)\n @evaluations = Evaluation.all\n\n user_id = params[:user_id]\n post_id = params[:post_id]\n\n unless post_id.nil? then\n @evaluations = @evaluation.where(user_id: user_id)\n end\n\n unless post_id.nil? then\n @evaluations = @evaluation.where(post_id: post_id)\n end\n end",
"def index\n @experiments = list_public\n begin\n @experiments_by_user = current_user.experiments\n rescue Exception\n # seems we dont have a session\n end\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @experiments }\n end\n end",
"def index\n @user_question_rates = UserQuestionRate.all\n end",
"def index\n @objectives = current_user.objectives.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @objectives }\n end\n end",
"def index\n if current_user\n @users = User.all\n render \"index_users.json.jb\"\n else\n render json: []\n end\n end",
"def index\n\t\t# Find average activity\n\t\tactivity = 12\n\t\tconnectivity = 12\n\t\tdate = Date.today\n\t\ttime = Time.now\n\t\trender json: user_index_json(nil)\n\tend",
"def index\n #if is_admin?\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @users }\n end\n # else \n # redirect_to :root\n # end\n end",
"def index\n render json: current_org.users\n end",
"def index\n @test_subject_evaluations = @test_subject.test_subject_evaluations.find(:all, :order => 'evaluated_on DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_subject_evaluations }\n end\n end",
"def evaluations(id)\n connection.get do |req|\n req.url \"job/#{id}/evaluations\"\n end\n end",
"def index\n @matrix_evaluation_types = MatrixEvaluationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @matrix_evaluation_types }\n end\n end",
"def index \n render json: User.all\n end"
] | [
"0.743854",
"0.7192998",
"0.7192998",
"0.7192998",
"0.7192998",
"0.7192998",
"0.71910703",
"0.71319187",
"0.70560473",
"0.7042955",
"0.7021815",
"0.6948761",
"0.69125646",
"0.69022363",
"0.6862299",
"0.6847277",
"0.6837487",
"0.67434317",
"0.67207795",
"0.6589854",
"0.6552325",
"0.65498066",
"0.6524341",
"0.6501343",
"0.6491239",
"0.6487896",
"0.6437312",
"0.6416942",
"0.63815254",
"0.6379348",
"0.6358686",
"0.63443077",
"0.6317966",
"0.6284324",
"0.627912",
"0.6273824",
"0.6259646",
"0.6249156",
"0.6247414",
"0.6229291",
"0.62222743",
"0.6221724",
"0.6221314",
"0.62164736",
"0.6212088",
"0.6208496",
"0.6196159",
"0.6182657",
"0.61814606",
"0.6161844",
"0.616051",
"0.61578125",
"0.6155424",
"0.6153781",
"0.6144566",
"0.6131062",
"0.6127362",
"0.6126231",
"0.61229",
"0.6121327",
"0.6113549",
"0.6112312",
"0.6110491",
"0.610901",
"0.61038715",
"0.6098797",
"0.6096135",
"0.60912025",
"0.6086959",
"0.60743505",
"0.60722524",
"0.60655886",
"0.60632586",
"0.6059964",
"0.605953",
"0.6056824",
"0.60558647",
"0.6054899",
"0.60522246",
"0.60475206",
"0.60456127",
"0.6045493",
"0.6045084",
"0.6044588",
"0.60428363",
"0.6038349",
"0.6038349",
"0.6038238",
"0.60301274",
"0.6028517",
"0.6023098",
"0.6022567",
"0.6022285",
"0.60210866",
"0.60165143",
"0.6015709",
"0.601522",
"0.6012805",
"0.60118985",
"0.6010914",
"0.6010237"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_evaluation
@evaluation = ::Evaluation.in_account(current_user.account.id).find(params[:evaluation_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_evaluation_params
params.require(:user_evaluation).permit(:evaluator_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
returns the current loggedin user | def current_user
@current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end",
"def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend",
"def current_user(id = session[:user_id])\n User.get_one id\n end",
"def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend",
"def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end",
"def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend",
"def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end",
"def current_user\n session.user\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end",
"def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end",
"def current_user\n current_session.user\n end",
"def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end",
"def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end",
"def current_user\n session[:user]\n end",
"def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end",
"def current_user\n User.find(session[:user])\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end",
"def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end",
"def current_user\n User.find(session[:user_id])\n end",
"def current_user\n User.find(session[:user_id])\n end",
"def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end",
"def current_user\n User.find session[:user_id] if user_signed_in?\n end",
"def current_user\n load_session\n @current_user\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def current_user\n User.find_by(id: session[:user_id])\n end",
"def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end",
"def current_user\n return session[:user]\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end",
"def current_user\n User.where(id: session[:user_id]).first\n end",
"def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n User.find(current_user_id)\n end",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end",
"def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend",
"def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end",
"def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend",
"def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend",
"def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end",
"def current_user\n if(@current_user.nil?)\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end",
"def current_user\n @current_user || User.find(session[:user_id]) if session[:user_id]\n \tend",
"def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end",
"def current_user\n\tUser.find_by(id: session[:user_id])\n end",
"def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n user = User.find_by(id: session[:user_id])\n end",
"def user\n\t\t\treturn nil if ! logged_in?\n\n\t\t\tPicombo::Session.instance.get('user')\n\t\tend",
"def current_user\n User.find_by_id(session[:user_id])\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end",
"def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend",
"def current_user #used in many methods to pull in the current user stored in sessions. \n \tUser.find(session[:user_id]) if session[:user_id]\n end",
"def current_user\n User.find session[:id] if session[:id]\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end",
"def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend",
"def current_user\n @current_user ||= User.find_by_id(session[:uid]) || User.from_auth_header(request.headers['HTTP_AUTHORIZATION'])\n\n @current_user\n end",
"def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end",
"def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if user_signed_in?\n end",
"def current_user\n # find a user by id based on the stored :user_id cookie\n User.find_by_id(session[:user_id])\n end",
"def current_user\n User.where(email: \"[email protected]\").first\n end",
"def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end",
"def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end",
"def current_user\n return @current_user\n end"
] | [
"0.8645991",
"0.86158556",
"0.8546729",
"0.8546729",
"0.85380167",
"0.8533476",
"0.8530044",
"0.8518198",
"0.8508356",
"0.85019004",
"0.84983087",
"0.8490113",
"0.8445486",
"0.8427902",
"0.8425241",
"0.84174234",
"0.84174234",
"0.8409872",
"0.8409872",
"0.8382717",
"0.8375381",
"0.83699304",
"0.8367246",
"0.83620864",
"0.83620864",
"0.83541787",
"0.83541787",
"0.8351858",
"0.8349356",
"0.834853",
"0.8324232",
"0.8302394",
"0.8298852",
"0.82945615",
"0.8289376",
"0.8287445",
"0.8285706",
"0.8282665",
"0.82760304",
"0.82760304",
"0.8269286",
"0.8255525",
"0.82545155",
"0.82545155",
"0.82480735",
"0.8243017",
"0.8239582",
"0.8239582",
"0.82375824",
"0.823528",
"0.82333744",
"0.8226406",
"0.8226406",
"0.8226406",
"0.8220315",
"0.82092077",
"0.8207069",
"0.8205565",
"0.8203128",
"0.8195499",
"0.8194526",
"0.81921226",
"0.81767",
"0.817348",
"0.81637096",
"0.8160561",
"0.81602293",
"0.81602293",
"0.81575435",
"0.81575435",
"0.81575435",
"0.81575435",
"0.8157113",
"0.81552184",
"0.81436914",
"0.81434083",
"0.8139071",
"0.8137047",
"0.81348425",
"0.8132968",
"0.8132306",
"0.812843",
"0.8126469",
"0.8122129",
"0.81203693",
"0.811381",
"0.81114304",
"0.81114304",
"0.8108007",
"0.81069493",
"0.8106408",
"0.8106408",
"0.8104167",
"0.8102704",
"0.8102253",
"0.8098199",
"0.8094448",
"0.8092566",
"0.80922776",
"0.8089101",
"0.808888"
] | 0.0 | -1 |
returns the current week of all weeks for the given year | def current_week
return get_current_week_from_weeks(Week.where(year: Date.today.year)
.order(:number))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weeks_in_year(year)\n date_calc.weeks_in_year(year)\n end",
"def year_week\n @year_week ||= (((date-start_of_year)+1)/7.0).ceil\n end",
"def week_of_year date\n \tdate.strftime('%U').to_i\n end",
"def week_of_year(*weeks)\n merge(week: weeks)\n end",
"def weeks_in_year\n return (self-(self.yday-1)).wday == 6 && self.leap? ? 54 : 53\n end",
"def week\n cweek = self.cweek\n year = self.year\n month = self.month\n\n next_year = year + 1\n previous_year = year - 1\n\n days = Date.new(year)\n .step(Date.new(year, -1, -1))\n .select{ |d| d.cweek == cweek }\n\n if cweek == 1 && month == 12 ||\n cweek == 1 && month == 1 ||\n cweek >= 52 && month == 12 ||\n cweek >= 52 && month == 1\n\n days.keep_if{ |d| d.year == year && d.month == month }\n end\n\n if days.count < 7\n rest = 7 - days.count\n\n rest_days = nil\n if month == 1\n rest_days = Date.new(previous_year, 12, 31 - rest + 1).step(Date.new(previous_year, 12, 31))\n elsif month == 12\n rest_days = Date.new(next_year).step(Date.new(next_year, 1, rest))\n end\n\n if !rest_days.nil?\n days += rest_days.to_a\n end\n end\n\n days.sort[0, 7]\n end",
"def week_of_year(weeks, *extras)\n merge(week: weeks.array_concat(extras))\n end",
"def get_week(year, month, day)\n weeks = [\"月\",\"火\",\"水\",\"木\",\"金\",\"土\",\"日\"]\n\n days = 0\n month_index = month - 1\n while month_index > 0 do\n month_days = get_days(year, month_index)\n days = days + month_days\n month_index = month_index - 1\n end\n\n year_days = 0\n year_index = year -1\n # while year_index > 0 do\n # year_days = get_year_days(year_index)\n # days = days + year_days\n # year_index = year_index - 1\n # end\n while year_index > 0 do\n if get_days(year_index, 2) == 29\n days = days + 366\n else\n days = days + 365\n end\n year_index = year_index - 1\n end\n \n days = days + day\n\n return weeks[(days-1) % 7]\nend",
"def weeks_with_year\n rows = []\n rows << \"Su Mo Tu We Th Fr Sa\" + \" \"\n days = format_dates\n (0..7).each {|num|\n fields = days[num * 7, 7]\n rows << fields.join(\" \") + \" \" if fields\n }\n\n if rows.last.length < 22\n rows.last << \" \" * (22 - rows.last.length)\n end\n\n until rows.length == 7\n rows << \" \" * 22\n end\n rows\n end",
"def week_pattern\n year_weeks == 53 ? [5,4,5]+[4,4,5]*3 : [4,4,5]*4\n end",
"def by_week(time=Time.zone.now, options = {}, &block)\n time = parse(time)\n\n # If options[:year] is passed in, use that year regardless.\n year = work_out_year(options.delete(:year)) if options[:year]\n # If the first argument is a date or time, ask it for the year\n year ||= time.year unless time.is_a?(Numeric)\n # If the first argument is a fixnum, assume this year.\n year ||= Time.zone.now.year\n\n # Dodgy!\n # Surely there's a method in Rails to do this.\n start_time = if valid_time_or_date?(time)\n weeks = time.strftime(\"%U\").to_i\n Time.zone.now.beginning_of_year\n elsif time.is_a?(Numeric) && time < 53\n weeks = time.to_i\n Time.utc(year, 1, 1)\n else\n raise ParseError, \"by_week takes only a Time or Date object, a Fixnum (less than or equal to 53) or a Chronicable string.\"\n end\n # Make the start of the week predictably Sunday.\n start_time.strftime(\"%w\").to_i != 0 ? start_time - (7 - start_time.strftime(\"%w\").to_i).days : start_time\n start_time += weeks.weeks\n end_time = start_time + 1.week\n by_star(start_time, end_time, options, &block)\n end",
"def dates_for_week(year, week_num)\n calendar_year_start = dates_for(1, year).first\n calendar_year_end = dates_for(12, year).last\n calendar_range = calendar_year_start..calendar_year_end\n\n dates = calendar_range.each_slice(7).take(week_num).last\n dates.first..dates.last\n end",
"def iso_weeks_in_year(wkst)\n iso_year, week_one_start = *iso_year_and_week_one_start(wkst)\n probe_date = week_one_start + (7*52)\n if probe_date.iso_year(wkst) == iso_year\n 53\n else\n 52\n end\n end",
"def apply_function_week_of_year(scope, ast)\n scope, date = apply_ast(scope, ast.children.first)\n return scope, \"(date_part('week', #{date})::integer)\"\n end",
"def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end",
"def week_start(week_num, year = 0)\n year = Time.now.year if year == 0\n \n begin\n first_date_of_the_week = Date.commercial(year, week_num, 1)\n \n # Date.commercial throws an exception if it can't find the \n # Monday of the week. This usually happens if the Monday\n # of the week is on the previous year. For example,\n # December 28, 2009 (Monday) - January 3, 2010 (Sunday)\n rescue\n # we'll basically decrement the year\n year -= 1\n first_date_of_the_week = Date.commercial(year, week_num, 1)\n end\n \n first_date_of_the_week\n end",
"def week_fields_for(date)\n week_data_cache[date] ||= begin\n eyear = date.year\n day_of_week = date.wday + 1\n day_of_year = date.yday\n\n # this should come from the CLDR's supplemental data set, but we\n # don't have access to it right now\n first_day_of_week = 1 # assume sunday\n minimal_days_in_first_week = 1 # assume US\n\n # WEEK_OF_YEAR start\n # Compute the week of the year. For the Gregorian calendar, valid week\n # numbers run from 1 to 52 or 53, depending on the year, the first day\n # of the week, and the minimal days in the first week. For other\n # calendars, the valid range may be different -- it depends on the year\n # length. Days at the start of the year may fall into the last week of\n # the previous year; days at the end of the year may fall into the\n # first week of the next year. ASSUME that the year length is less than\n # 7000 days.\n year_of_week_of_year = eyear\n rel_dow = (day_of_week + 7 - first_day_of_week) % 7 # 0..6\n rel_dow_jan1 = (day_of_week - day_of_year + 7001 - first_day_of_week) % 7 # 0..6\n woy = (day_of_year - 1 + rel_dow_jan1) / 7 # 0..53\n\n if (7 - rel_dow_jan1) >= minimal_days_in_first_week\n woy += 1\n end\n\n # Adjust for weeks at the year end that overlap into the previous or\n # next calendar year.\n if woy == 0\n # We are the last week of the previous year.\n # Check to see if we are in the last week; if so, we need\n # to handle the case in which we are the first week of the\n # next year.\n\n year_length = (Date.new(eyear, 1, 1) - Date.new(eyear - 1, 1, 1)).to_i\n\n prev_doy = day_of_year + year_length\n woy = week_number(prev_doy, day_of_week)\n year_of_week_of_year -= 1\n else\n last_doy = (Date.new(eyear + 1, 1, 1) - Date.new(eyear, 1, 1)).to_i\n # Fast check: For it to be week 1 of the next year, the DOY\n # must be on or after L-5, where L is yearLength(), then it\n # cannot possibly be week 1 of the next year:\n # L-5 L\n # doy: 359 360 361 362 363 364 365 001\n # dow: 1 2 3 4 5 6 7\n if day_of_year >= (last_doy - 5)\n last_rel_dow = (rel_dow + last_doy - day_of_year) % 7\n\n if (last_rel_dow < 0)\n last_rel_dow += 7\n end\n\n if ((6 - last_rel_dow) >= minimal_days_in_first_week) && ((day_of_year + 7 - rel_dow) > last_doy)\n woy = 1;\n year_of_week_of_year += 1\n end\n end\n end\n\n {\n week_of_year: woy,\n year_woy: year_of_week_of_year,\n week_of_month: week_number(date.mday, day_of_week),\n day_of_week_in_month: (date.mday - 1) / 7 + 1\n }\n end\n end",
"def by_week(value, options = {})\n year = work_out_year(options[:year] || Time.now.year)\n # Dodgy!\n # Surely there's a method in Rails to do this.\n start_time = if value.class == Time || value.class == Date\n (value.strftime(\"%U\").to_i - 1).weeks\n year = value.year\n elsif value.to_i.class == Fixnum && value < 52\n Time.utc(year, 1, 1) + (value.to_i - 1).weeks\n else\n raise ParseError, \"by_week takes only a Time object, or a Fixnum (less than 52).\"\n end\n end_time = start_time + 1.week\n \n by_star(start_time, end_time, options)\n end",
"def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.send(\"wday_offset\"))\n week_num = 0\n working_date.step(self) { |a_day| \n if a_day.wday == _week_day_numbers.first\n week_num += 1\n end\n }\n week_num\n end",
"def game_week\n now = DateTime.now\n all_games = NflSchedule.where(year: Date.today.year)\n .order(:start_time)\n week_started = 0\n all_games.each { |game|\n if (week_started < game.week) && (now > game.start_time)\n week_started = game.week\n end\n }\n return week_started\n end",
"def week_from_today\n ::Date.today + 7\n end",
"def weeks\n days_in_month = Time.days_in_month(month, year)\n starting_day = date.beginning_of_week() -1.day + beginning_of_week.days\n ending_day = (date + days_in_month).end_of_week() -1.day + beginning_of_week.days\n (starting_day..ending_day).to_a.in_groups_of(7).collect { |week| Week.new(week, events) }\n end",
"def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end",
"def weeks() 7 * days end",
"def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end",
"def get_week_report(week, year)\n\n week_start = Date.commercial(year, week)\n\n time_entries(week_start, week_start + 7).group_by { |e| e[:start].wday }.map do |_, date_entries|\n\n date = date_entries.first[:start]\n durations = date_entries.group_by { |e| e[:description] }\n .map { |desc, entries| [desc, entries.map { |e| e[:duration] }.reduce(&:+)] }\n total_duration = durations.map { |_, d| d }.reduce(&:+)\n\n {\n date: date,\n total_duration: total_duration,\n durations: durations\n }\n end\n end",
"def to_weekday_if_boxing_weekend_from_year(year)\n to_weekday_if_boxing_weekend(Date.civil(year, 12, 26))\n end",
"def current_week\n\t\t#TODO\n\tend",
"def weeks\n result = end_week - start_week + 1\n weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i\n result < 0 ? result + weeks : result\n end",
"def select_current_week\n select_week_of Date.today\n end",
"def iso_year_and_week_one_start(wkst)\n iso_year = self.year\n date = ::Date.new(self.year, self.month, self.mday)\n if (date >= ::Date.new(iso_year, 12, 29))\n week_one_start = Calculations.iso_week_one(iso_year + 1, wkst)\n if date < week_one_start\n week_one_start = Calculations.iso_week_one(iso_year, wkst)\n else\n iso_year += 1\n end\n else\n week_one_start = Calculations.iso_week_one(iso_year, wkst)\n if (date < week_one_start)\n iso_year -= 1\n week_one_start = Calculations.iso_week_one(iso_year, wkst)\n end\n end\n [iso_year, week_one_start]\n end",
"def get_monday_of_calendar_week(year, calendar_week)\n start = Time.new(year)\n\n # Monday of calendar week 1\n start = get_next_monday(start)\n start + (calendar_week - 2) * 7 * 60 * 60 * 24\n end",
"def week; end",
"def iso_week_num(wkst)\n iso_year_and_week_num(wkst)[1]\n end",
"def year\n if @date.cweek == 1 && @date.month == 12\n @date.year + 1\n elsif @date.cweek == 52 && @date.month == 1\n @date.year - 1\n else\n @date.year\n end\n end",
"def next_week(x = 1)\n\t\tself + (604800 * x)\n\tend",
"def iso_year(wkst)\n iso_year_and_week_num(wkst)[0]\n end",
"def current_week\n self.week.to_i\n end",
"def week(date = Date.today)\n day = monday(date)\n (day..day + 6)\n end",
"def week\n published_at.strftime('%W')\n end",
"def week\n @date.cweek\n end",
"def start_week\n start_date.strftime('%W').to_i\n end",
"def week\n self.date ? self.date.strftime('%Y-%W') : ('0000-00')\n end",
"def discover_week( nextweek )\n year = self.year\n owner = self.user_id\n\n if ( nextweek )\n inc = 1\n week = self.week_number + 1\n limit = Timesheet.get_last_week_number( year ) + 1\n\n return if ( week >= limit )\n else\n inc = -1\n week = self.week_number - 1\n limit = 0\n\n return if ( week <= limit )\n end\n\n while ( week != limit )\n timesheet = Timesheet.find_by_user_id_and_year_and_week_number(\n owner, year, week\n )\n\n if ( yield( timesheet ) )\n return { :week_number => week, :timesheet => timesheet }\n end\n\n week += inc\n end\n\n return nil\n end",
"def move_to_week_and_year!(week, year)\n wday = cwday\n wday = 7 if wday == 0 # sunday. bloody sunday\n\n *saved_hours = start_hour, end_hour\n *saved_minutes = start_minute, end_minute\n\n @date = Date.commercial(year, week, wday).in_time_zone.beginning_of_day\n self.starts_at = self.ends_at = self.week = self.year = nil\n self.start_hour, self.end_hour = *saved_hours\n self.start_minute, self.end_minute = *saved_minutes\n save!\n self\n end",
"def dayOfWeek\n days = 0;\n tempYear = MIN_YEAR\n while tempYear < @year\n days += SimpleDate.daysInYear(tempYear).to_i\n tempYear+=1\n end\n\n days = days + ordinalDate\n #puts \"days #{days}\"\n days = days % 7\n\n end",
"def calendar_week_applications\n puts \"Collecting applications for #{year}, week #{@date.cweek}...\"\n raise \"This week ain't over! It would result in a partial file, so stopping\" if @date.end_of_week >= Date.today\n applications = []\n (@[email protected]_of_week).each do |d|\n applications += applications_on_date(d)\n end\n puts \"Collected #{applications.count} applications.\"\n as_xml applications\n end",
"def current_game_week\n url = \"/service/weather/json/#{api_key}/\"\n response = conn.get(url)\n result = JSON.parse(response.body, symbolize_names: true)\n weather_data = result[:Games].map do |home_team, weather_data|\n GameWeather.new(weather_data)\n end\n return result[:Week], weather_data\n end",
"def end_of_week(week_number, year = Time.zone.now.year)\n year ||= Date.today.year\n t = Time.zone.parse(\"#{year}-01-01\").end_of_week + (week_number-1).weeks\n t.beginning_of_day\n end",
"def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end",
"def week_index\n @week_index ||= date.wday\n end",
"def get_day(year)\n candidate = new_time_or_datetime(year, month, @offset_start)\n diff = day_of_week - candidate.wday\n\n if diff < 0\n candidate.add_with_convert((7 + diff) * 86400)\n elsif diff > 0\n candidate.add_with_convert(diff * 86400)\n else\n candidate\n end\n end",
"def week_from_now\n current_time = Time.now\n beginning_of_hour = current_time.change(:hour => current_time.hour)\n beginning_of_next_hour = beginning_of_hour - 4.hours # Include offset for EST -0500\n beginning_of_next_hour + 1.week\n end",
"def week\n self.range('week')\n end",
"def fridays_in_year(year)\n current_week = 1\n current_day = 5\n current_date = DateTime.commercial(year, current_week, current_day)\n fridays_per_month = Array.new(12,0)\n while current_date.year == year\n fridays_per_month[current_date.month - 1] += 1\n current_date += 7\n end\n fridays_per_month\nend",
"def get_registration_start_week\n registration_start_date.strftime('%W').to_i\n end",
"def week\n\t\t@@week\n\tend",
"def weeks ; self * 7.days ; end",
"def weeks\n self.to_i * 604_800\n end",
"def this_week(project, api_key)\n\treturn _iterations('current', project, api_key)\nend",
"def get_current_week_from_weeks(weeks)\n now = DateTime.now\n weeks.each { |week|\n if now < week.start_time\n return (week.number - 1)\n end\n }\n return weeks.last.number\n end",
"def starting_of_week\n self.class.new(year, month, current_week.detect { |i| !i.nil? })\n end",
"def w_year\n @obj.date.strftime(\"%G\")\n end",
"def week\n @obj.date.strftime(\"%V\")\n end",
"def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n end \n \n days_of_week\n end",
"def day_of_week\n return -1 if self.day_of_year == 308\n result = self.days_since_epoch % 8\n if result > 0\n result\n else\n 8\n end\n\n end",
"def mweek; (5 - wday + day) / 7 end",
"def select_week_of date\n monday = date - date.wday + 1\n friday = monday + 4\n select_range(monday, friday)\n end",
"def week\n @year = params[:year].to_i\n @month = params[:month].to_i\n @day = params[:day].to_i\n @date = Date.new(@year, @month, @day)\n @work_times = WorkTime.find_by_start_date(@date)\n end",
"def bbc_week\n adjustment = 3 - ((self.wday + 1) % 7)\n tuesday = self + adjustment\n [tuesday.year, ((tuesday.yday - 1) / 7) + 1, 4 - adjustment]\n end",
"def last_week(x = 1)\n\t\tself - (604800 * x)\n\tend",
"def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end",
"def week_end(week_num, year = 0)\n year = Time.now.year if year == 0\n \n begin\n last_date_of_the_week = Date.commercial(year, week_num, 7)\n \n # same idea with week_start but we'll increment the year\n rescue\n year -= 1\n last_date_of_the_week = Date.commercial(year, week_num, 7)\n end\n \n last_date_of_the_week = Date.commercial(year, week_num, 7)\n \n last_date_of_the_week\n end",
"def iso_year_start(wkst)\n iso_year_and_week_one_start(wkst)[1]\n end",
"def today\n MerchWeek.from_date Date.today\n end",
"def day_of_week(date)\n 7 - date.cwday\n end",
"def weeks\n\t\treturn self * 7.days\n\tend",
"def weeks\n\t\treturn self * 7.days\n\tend",
"def weekly(workspace_id, params={})\n get_report('weekly', workspace_id, params)\n end",
"def weeks; self * WEEK; end",
"def weeks; self * WEEK; end",
"def get_day(year)\n next_month = month + 1\n if next_month == 13\n year += 1\n next_month = 1\n end\n\n candidate = new_time_or_datetime(year, next_month).add_with_convert(-86400)\n diff = candidate.wday - day_of_week\n\n if diff < 0\n candidate - (diff + 7) * 86400\n elsif diff > 0\n candidate - diff * 86400\n else\n candidate\n end\n end",
"def start_of_week; self - wday.days end",
"def find_week_count(count_date)\n week_of_year = count_date.strftime('%V').to_i\n week_count = week_of_year.modulo(4) + 1\n\n week_count\n end",
"def calendar_wdays(starting_day = 0)\n start_week = Date.today.beginning_of_week + (starting_day - 1).days # In rails week start in monday and monday.wday is 1\n (start_week...start_week+7.days).collect { |day| I18n.l(day, :format => '%A') }\n end",
"def last_week\n Date.week(Date.today - 7)\n end",
"def registration_weeks\n result = 0\n weeks = 0\n if registration_start_date && registration_end_date\n weeks = Date.new(registration_start_date.year, 12, 31).\n strftime('%W').to_i\n\n result = get_registration_end_week - get_registration_start_week + 1\n end\n result < 0 ? result + weeks : result\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def week( date = Date.today )\n (0...weeks.size).find { |i| weeks[i].include? date } + 1\n end",
"def all_weeks\n @all_weeks ||=\n data_points.each_with_object(Hash.new(0)) { |feed, all_weeks|\n all_weeks[feed.occurred_on.beginning_of_week(week_start_day)] += feed.send(field)\n }\n end",
"def new_years_day_for(year)\n nyd = Date.new(year,1,1)\n if nyd.saturday?\n Date.new(year,1,3)\n elsif nyd.sunday?\n Date.new(year,1,2)\n else\n nyd\n end\n end",
"def reportable_weeks(options = {})\n week = options[:from] ? from_time(options[:from]) : earliest_week\n last_in_sequence = current\n [week].tap do |weeks|\n while week != last_in_sequence\n week = week.next\n weeks << week\n end\n end\n end",
"def beginning_of_week\n (self - self.wday.days).midnight + 1.day\n end",
"def week_to_date_map\n week_of_year = Time.new.strftime(\"%V\").to_i\n week_count = week_of_year.modulo(4) + 1\n\n mapping = {}\n for i in 0..3 do\n date = Date.today.beginning_of_week(:monday)\n date += 1 + ((3-date.wday) % 7)\n date += i.week\n mapping[week_count] = date\n week_count += 1\n week_count = 1 if week_count > 4\n end\n\n mapping[0] = 'On Hold'\n mapping[99] = 'Not Yet Set'\n mapping\n end",
"def w_year; end",
"def weeks_on_list\n @data['weeks_on_list']\n end",
"def current_week(current_day, current_month)\n @today = Time.now.strftime('%Y-%m-%d')\n if Chronic.parse(\"1st #{current_day} in #{current_month}\").strftime('%Y-%m-%d') == @today\n current_week = \"1st\"\n elsif Chronic.parse(\"2nd #{current_day} in #{current_month}\").strftime('%Y-%m-%d') == @today\n current_week = \"2nd\"\n elsif Chronic.parse(\"3rd #{current_day} in #{current_month}\").strftime('%Y-%m-%d') == @today\n current_week = \"3rd\"\n elsif Chronic.parse(\"4th #{current_day} in #{current_month}\").strftime('%Y-%m-%d') == @today\n current_week = \"4th\"\n else\n current_week = \"nil\"\n end\n end",
"def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end",
"def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end"
] | [
"0.82422113",
"0.77540714",
"0.7370541",
"0.7282985",
"0.6990319",
"0.6966094",
"0.69470173",
"0.68604624",
"0.68520635",
"0.67422485",
"0.6714107",
"0.67027825",
"0.6701111",
"0.6673112",
"0.6673095",
"0.6642223",
"0.6633163",
"0.66074234",
"0.6505728",
"0.6494404",
"0.648893",
"0.6488544",
"0.6468454",
"0.6389359",
"0.63753855",
"0.6357209",
"0.6346941",
"0.6345532",
"0.6310175",
"0.62978786",
"0.62197083",
"0.62073135",
"0.62034047",
"0.6195033",
"0.61293375",
"0.61214405",
"0.61154115",
"0.6113312",
"0.6109036",
"0.6103765",
"0.6097608",
"0.6080003",
"0.60534257",
"0.6053393",
"0.6050919",
"0.60307926",
"0.6023306",
"0.60214436",
"0.6013746",
"0.5992518",
"0.5984534",
"0.59784347",
"0.5971622",
"0.59662765",
"0.5952216",
"0.59458303",
"0.59198695",
"0.5915086",
"0.5908664",
"0.59074575",
"0.5902973",
"0.5875401",
"0.58660287",
"0.5855592",
"0.58471304",
"0.58042264",
"0.57925534",
"0.5792423",
"0.577753",
"0.57721674",
"0.57682186",
"0.57610077",
"0.5757088",
"0.5733521",
"0.57323116",
"0.5731296",
"0.5704584",
"0.5704584",
"0.5693156",
"0.5691623",
"0.5691623",
"0.56764567",
"0.5661679",
"0.5653036",
"0.5652798",
"0.56458306",
"0.564342",
"0.5640987",
"0.5640987",
"0.5622238",
"0.5617025",
"0.5613552",
"0.5611296",
"0.5592157",
"0.55900604",
"0.5581892",
"0.5579219",
"0.554509",
"0.55383265",
"0.55383265"
] | 0.7085923 | 4 |
returns the current week, from the specified array of weeks, based on the weeks' start times | def get_current_week_from_weeks(weeks)
now = DateTime.now
weeks.each { |week|
if now < week.start_time
return (week.number - 1)
end
}
return weeks.last.number
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end",
"def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end",
"def setup_weeks(week_start)\n a_date = self.first\n the_last = self.last\n @weeks = []\n\n while (a_date < the_last)\n @weeks << Koyomi::Week.new(a_date, week_start)\n a_date += WEEK_DAYS\n end\n @weeks\n end",
"def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end",
"def weeks() 7 * days end",
"def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n end \n \n days_of_week\n end",
"def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end",
"def start_week\n start_date.strftime('%W').to_i\n end",
"def reportable_weeks(options = {})\n week = options[:from] ? from_time(options[:from]) : earliest_week\n last_in_sequence = current\n [week].tap do |weeks|\n while week != last_in_sequence\n week = week.next\n weeks << week\n end\n end\n end",
"def week\n @year = params[:year].to_i\n @month = params[:month].to_i\n @day = params[:day].to_i\n @date = Date.new(@year, @month, @day)\n @work_times = WorkTime.find_by_start_date(@date)\n end",
"def starting_of_week\n self.class.new(year, month, current_week.detect { |i| !i.nil? })\n end",
"def current_week\n return get_current_week_from_weeks(Week.where(year: Date.today.year)\n .order(:number))\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def betweenDates(index,week)\n if (index <= week[4].to_i)\n return week\n end\n return []\nend",
"def game_week\n now = DateTime.now\n all_games = NflSchedule.where(year: Date.today.year)\n .order(:start_time)\n week_started = 0\n all_games.each { |game|\n if (week_started < game.week) && (now > game.start_time)\n week_started = game.week\n end\n }\n return week_started\n end",
"def weeks\n result = end_week - start_week + 1\n weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i\n result < 0 ? result + weeks : result\n end",
"def weeks_since(weeks)\n advance(weeks: weeks)\n end",
"def week_starting(selected_date = Date.today, branch_ids = @my_ys, class_sel = 'VINYASA YOGA',\n sched_type_ids = ['Group Exercise Schedule'], page_no = 0)\n\n branch_ids.map do |branch_id|\n if class_sel.is_a? Array\n class_sel.map do |c|\n post(URI(BASE_URL + 'fillscheduler'),\n {sched_type_ids: sched_type_ids.join(?,),\n branch_ids: branch_id,\n year: selected_date.year,\n month: selected_date.month,\n classSel: c,\n day: selected_date.day})\n end.flatten\n else\n post(URI(BASE_URL + 'fillscheduler'),\n {sched_type_ids: sched_type_ids.join(?,),\n branch_ids: branch_id,\n year: selected_date.year,\n month: selected_date.month,\n classSel: class_sel,\n day: selected_date.day})\n end\n end\n end",
"def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end",
"def start_of_week; self - wday.days end",
"def current_week\n\t\t#TODO\n\tend",
"def week\n stamp = params[:stamp].to_i\n interval = (params[:interval] || 10).to_i\n plus_weeks = (params[:plus_weeks] || 0).to_i\n context = (params[:context] || 0).to_i == 1 ? true : false\n time = Time.at(stamp).utc\n\n # Calculate monday from given date\n wday = time.wday\n # Adjust for sunday when we want to start on a monday\n wday = 7 if wday == 0\n\n date = time - (wday.days - 1.days)\n\n date = date + plus_weeks.weeks\n\n # Number of days in week range if we add context, we add the surrounding weeks as well\n days = context ? (7 * 3) - 1 : 6\n\n # If context we'll start at the monday before\n if context\n date -= 7.days\n end\n\n\n\n week_data = []\n week_dates = []\n\n buckets = 0.step((60 * 24) - 1, interval).to_a\n\n (0..days).each do |day|\n interval_data = Hash.new { |h, k| h[k] = [] }\n\n data = GlucoseSensorData.by_day(date.to_date, :field => :timestamp)\n\n data.each do |datum|\n minutes = datum.timestamp.min + (datum.timestamp.hour * 60)\n # At first seems like a no op but this actually buckets minutes into intervals\n bucket = (minutes / interval) * interval\n\n interval_data[bucket] << datum\n end\n\n week_context = nil\n\n if context\n week_number = day / 7\n if week_number == 0\n week_context = \"before\"\n elsif week_number == 1\n week_context = \"current\"\n else\n week_context = \"after\"\n end\n else\n week_context = \"current\"\n end\n\n buckets.each do |bucket|\n datum = {}\n\n datums = interval_data[bucket]\n # Averages glucose values if there are more than one datum for that bucket\n if datums.length > 0\n datum[:glucose] = datums.inject(0.0) { |sum, d| sum + d.glucose } / datums.size\n #datum[:timestamp] = datums[0].timestamp.to_i\n end\n datum[:timestamp] = (date + bucket.minutes).to_i\n datum[:week_context] = week_context\n\n\n datum[:time] = bucket\n datum[:day] = date.strftime(\"%A\").downcase\n datum[:date] = date.to_i\n week_data << datum\n end\n\n week_dates.push({ :week_context => week_context, :day => date.strftime(\"%A\").downcase, :date => date.to_i })\n date += 1.days\n end\n\n render :json => { :data => week_data, :interval => interval, :week_dates => week_dates }\n end",
"def week_pattern\n year_weeks == 53 ? [5,4,5]+[4,4,5]*3 : [4,4,5]*4\n end",
"def mweek; (5 - wday + day) / 7 end",
"def week_of_year(*weeks)\n merge(week: weeks)\n end",
"def start_of_week_with_wkst(wkst)\n wkst ||= 1\n date = ::Date.civil(self.year, self.month, self.day)\n date -= 1 while date.wday != wkst\n date\n end",
"def select_current_week\n select_week_of Date.today\n end",
"def week_of_year(weeks, *extras)\n merge(week: weeks.array_concat(extras))\n end",
"def beginning_of_week\n (self - self.wday.days).midnight + 1.day\n end",
"def week_date_ranges\n (1..ReportWeeks).map do |week|\n begin_date = @start_date + (7*(week-1))\n begin_date .. (begin_date + 6)\n end\n end",
"def weeks\n lines[2..-1]\n end",
"def week(date = Date.today)\n day = monday(date)\n (day..day + 6)\n end",
"def weeks_on_list\n @data['weeks_on_list']\n end",
"def days_to_week_start(start_day = Date.beginning_of_week)\n start_day_number = DAYS_INTO_WEEK.fetch(start_day)\n (wday - start_day_number) % 7\n end",
"def days_in_week(*days)\n @test_time = @time if @test_time.nil?\n x_in_list_of_y(@test_time.wday, Configuration.parse_range(days,0...7).flatten)\n end",
"def week_index\n @week_index ||= date.wday\n end",
"def iso_year_and_week_one_start(wkst)\n iso_year = self.year\n date = ::Date.new(self.year, self.month, self.mday)\n if (date >= ::Date.new(iso_year, 12, 29))\n week_one_start = Calculations.iso_week_one(iso_year + 1, wkst)\n if date < week_one_start\n week_one_start = Calculations.iso_week_one(iso_year, wkst)\n else\n iso_year += 1\n end\n else\n week_one_start = Calculations.iso_week_one(iso_year, wkst)\n if (date < week_one_start)\n iso_year -= 1\n week_one_start = Calculations.iso_week_one(iso_year, wkst)\n end\n end\n [iso_year, week_one_start]\n end",
"def calendar_wdays(starting_day = 0)\n start_week = Date.today.beginning_of_week + (starting_day - 1).days # In rails week start in monday and monday.wday is 1\n (start_week...start_week+7.days).collect { |day| I18n.l(day, :format => '%A') }\n end",
"def get_week_string\n team = @user.team\n start_of_week = Time.now.beginning_of_week(team.start_of_week_symbol)\n end_of_week = Time.now.end_of_week(team.start_of_week_symbol)\n\n start_string = start_of_week.strftime(\"%d %b %Y\")\n end_string = end_of_week.strftime(\"%d %b %Y\")\n\n start_string + \" - \" + end_string\n end",
"def convertDailyToWeeklyData()\n aggregateData(ChartDirector::ArrayMath.new(@timeStamps).selectStartOfWeek())\n end",
"def week\n self.range('week')\n end",
"def beginning_of_week=(_arg0); end",
"def beginning_of_week=(_arg0); end",
"def week_from_today\n ::Date.today + 7\n end",
"def build_shifts\n shifts = Person.find(params[:id]).shifts.order(start: :asc)\n #init working_weeks\n working_weeks = [[[shifts[0]]]]\n if shifts[0].start.strftime(\"%U\").to_i != shifts[0].end.strftime(\"%U\").to_i or\n shifts[0].start.wday != shifts[0].end.wday\n #check for which it is because you have to append different things to different places.\n if shifts[0].start.strftime(\"%U\").to_i != shifts[0].end.strftime(\"%U\").to_i\n #duplicate the current shift and add it\n working_weeks.append [[shifts[0].dup]]\n #then set the dup's start and the original's end so you know what day it is later.\n working_weeks[0][0][0].end = working_weeks[0][0][0].start.end_of_day\n working_weeks[-1][-1][-1].start = working_weeks[-1][-1][-1].end.beginning_of_day\n elsif shifts[0].start.wday != shifts[0].end.wday\n working_weeks[0].append [shifts[0].dup]\n working_weeks[0][0][0].end = working_weeks[0][0][0].start.end_of_day\n working_weeks[-1][-1][-1].start = working_weeks[-1][-1][-1].end.beginning_of_day\n end\n #you incremented day so get the first day's display info set up. only one shift so pad it\n #with a nil at the front and 3 at the back. array's length has to be 7\n working_weeks[0][0].append(nil)\n #time before shift\n working_weeks[0][0].append(shifts[0].start.hour * 2 + shifts[0].start.min / 30)\n #time during shift\n working_weeks[0][0].append(48 - (shifts[0].start.hour * 2 + shifts[0].start.min / 30))\n 3.times do\n working_weeks[0][0].append 0\n end\n end\n shifts.drop(1)\n shifts.each_with_index do |shift, idx|\n #byebug\n #get the first bit of the shift in if it's on a different day\n #only setting the previous day's bit here so that day's array will be cleaned up afterwards\n #working shift's start is changed to get that started\n if shift.start.strftime(\"%U\").to_i != shift.end.strftime(\"%U\").to_i or\n shift.start.wday != shift.end.wday\n\n if shift.start.strftime(\"%U\").to_i != shift.end.strftime(\"%U\").to_i\n working_weeks.append([[shift.dup]])\n elsif shift.start.wday != shift.end.wday\n working_weeks[-1].append([shift.dup])\n end\n working_weeks[-1][-1][-1].end = working_weeks[-1][-1][-1].start.end_of_day\n shift.start = shift.end.beginning_of_day\n end\n\n if shift.start.strftime(\"%U\").to_i != shifts[idx - 1].end.strftime(\"%U\").to_i or\n shift.start.wday != shifts[idx - 1].end.wday\n\n #new day/month so set the last day's display info\n if working_weeks[-1][-1][1].nil?\n working_weeks[-1][-1].append(nil)\n end\n working_weeks[-1][-1].append(working_weeks[-1][-1][0].start.hour * 2 + \n working_weeks[-1][-1][0].start.min / 30)\n #add 1 to the end time because it might be 23:59 if it was set by \n working_weeks[-1][-1].append((working_weeks[-1][-1][0].end.hour * 2 +\n (working_weeks[-1][-1][0].end.min + 1) / 30) -\n (working_weeks[-1][-1][0].start.hour * 2 +\n working_weeks[-1][-1][0].start.min / 30))\n #if there's only one we just need to set the end\n if working_weeks[-1][-1][1].nil?\n working_weeks[-1][-1].append(48 - (working_weeks[-1][-1][0].end.hour * 2 +\n (working_weeks[-1][-1][0].end.min + 1) / 30))\n 2.times do\n working_weeks[-1][-1].append 0\n end\n #otherwise step to the second shift\n else\n working_weeks[-1][-1].append((working_weeks[-1][-1][0].start.hour * 2 +\n (working_weeks[-1][-1][0].start.min) / 30) -\n (working_weeks[-1][-1][1].end.hour * 2 +\n (working_weeks[-1][-1][1].end.min + 1) / 30))\n working_weeks[-1][-1].append((working_weeks[-1][-1][1].end.hour * 2 +\n (working_weeks[-1][-1][1].end.min + 1) / 30) -\n (working_weeks[-1][-1][1].start.hour * 2 +\n working_weeks[-1][-1][1].start.min / 30))\n working_weeks[-1][-1].append(48 - (working_weeks[-1][-1][1].end.hour * 2 + \n (working_weeks[-1][-1][1].end.min + 1) / 30))\n end\n\n end\n if shift.start.strftime(\"%U\").to_i != shifts[idx - 1].end.strftime(\"%U\").to_i\n working_weeks.append [[shift]]\n elsif shift.start.wday != shifts[idx - 1].end.wday\n working_weeks[-1].append [shift]\n else\n working_weeks[-1][-1].append shift\n end\n \n\n end\n return working_weeks\n end",
"def beginning_of_week\n days_to_sunday = self.wday\n self.ago(days_to_sunday, :days).midnight\n end",
"def weeks; self * WEEK; end",
"def weeks; self * WEEK; end",
"def week( date = Date.today )\n (0...weeks.size).find { |i| weeks[i].include? date } + 1\n end",
"def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.send(\"wday_offset\"))\n week_num = 0\n working_date.step(self) { |a_day| \n if a_day.wday == _week_day_numbers.first\n week_num += 1\n end\n }\n week_num\n end",
"def all_week(start_day = Date.beginning_of_week)\n beginning_of_week(start_day)..end_of_week(start_day)\n end",
"def week_split\n days_array.each_slice(7).to_a\n end",
"def start_of_week\n @start_of_week ||= (start_of_month + (7 * (week - 1)))\n end",
"def get_start_of_week(d)\n d -= DAY until d.monday?\n d\n end",
"def get_registration_start_week\n registration_start_date.strftime('%W').to_i\n end",
"def this_week(project, api_key)\n\treturn _iterations('current', project, api_key)\nend",
"def this(day)\n if dayindex == day #today\n x_weeks_from_day(1, day)\n else\n x_weeks_from_day(0, day)\n end\n end",
"def weeks ; self * 7.days ; end",
"def current_week\n self.week.to_i\n end",
"def current_week_tasks\n @current_week_tasks = {monday:[], tuesday:[], wednesday:[], thursday: [], friday: [], saturday:[], sunday:[]}\n end",
"def weeks\n @month.weeks.map { |w|\n w.map { |d| \n {\n\t\t\t\t date: d,\n\t\t\t\t\titems: !d.nil? ? items.where( trx_date: d ) : []\n\t\t\t\t}\n }\n }\n end",
"def week; end",
"def start_of_this_week\n now = Date.today\n sunday = now - now.wday\nend",
"def by_week(value, options = {})\n year = work_out_year(options[:year] || Time.now.year)\n # Dodgy!\n # Surely there's a method in Rails to do this.\n start_time = if value.class == Time || value.class == Date\n (value.strftime(\"%U\").to_i - 1).weeks\n year = value.year\n elsif value.to_i.class == Fixnum && value < 52\n Time.utc(year, 1, 1) + (value.to_i - 1).weeks\n else\n raise ParseError, \"by_week takes only a Time object, or a Fixnum (less than 52).\"\n end\n end_time = start_time + 1.week\n \n by_star(start_time, end_time, options)\n end",
"def first_wday; (wday - day + 1) % 7 end",
"def week_start(week_num, year = 0)\n year = Time.now.year if year == 0\n \n begin\n first_date_of_the_week = Date.commercial(year, week_num, 1)\n \n # Date.commercial throws an exception if it can't find the \n # Monday of the week. This usually happens if the Monday\n # of the week is on the previous year. For example,\n # December 28, 2009 (Monday) - January 3, 2010 (Sunday)\n rescue\n # we'll basically decrement the year\n year -= 1\n first_date_of_the_week = Date.commercial(year, week_num, 1)\n end\n \n first_date_of_the_week\n end",
"def days_of_week\n\n # create an array for processing\n days_array = [sunday, monday, tuesday, wednesday, thursday, friday, saturday]\n int_array = Array.new\n for day in days_array\n day ? int_array.push(1) : int_array.push(0)\n end\n\n # process with little recursive function\n r(int_array, 0)\n # fix first value, see note below\n int_array[0] == -1 ? int_array[0] = 1 : nil\n\n # final passes, change values into useable string\n int_array[0] == 1 ? int_array[0] = 'Su' : nil\n int_array[1] == 1 ? int_array[1] = 'M' : nil\n int_array[2] == 1 ? int_array[2] = 'Tu' : nil\n int_array[3] == 1 ? int_array[3] = 'W' : nil\n int_array[4] == 1 ? int_array[4] = 'Th' : nil\n int_array[5] == 1 ? int_array[5] = 'F' : nil\n int_array[6] == 1 ? int_array[6] = 'Sa' : nil\n\n int_array.delete(0)\n int_array.map{ |x| x == -1 ? '-' : x}.uniq.join\n\n end",
"def calculate_items_per_week(start_week, weeks, items)\n sum = 0\n result = []\n last_key = start_week - 1\n\n if !items.empty? && start_week > items.keys[0].to_i\n start_week = items.keys[0].to_i\n weeks += start_week - items.keys[0].to_i + 1\n end\n\n items.each do |key, value|\n # Padding\n if last_key < (key.to_i - 1)\n result += Array.new(key.to_i - last_key - 1, sum)\n end\n\n sum += value\n result.push(sum)\n last_key = key.to_i\n end\n\n # Padding right\n if result.length < weeks\n result += Array.new(weeks - result.length, sum)\n end\n\n result\n end",
"def week_start\n\ti = 1\n\twhile i < RC_C.num_rows\n\t\ttmp = RC_C.rows[i][0].split(\" \")[0].split(\"/\")\n\t\tdate = Date.parse(tmp[2] + '-' + tmp[0] + '-' + tmp[1])\n\t\tif (Date.parse(\"monday\") - 7) <= date\n\t\t\treturn i\n\t\tend\n\t\ti += 1\n\tend\n\treturn i\nend",
"def weeks\n self.to_i * 604_800\n end",
"def by_week(time=Time.zone.now, options = {}, &block)\n time = parse(time)\n\n # If options[:year] is passed in, use that year regardless.\n year = work_out_year(options.delete(:year)) if options[:year]\n # If the first argument is a date or time, ask it for the year\n year ||= time.year unless time.is_a?(Numeric)\n # If the first argument is a fixnum, assume this year.\n year ||= Time.zone.now.year\n\n # Dodgy!\n # Surely there's a method in Rails to do this.\n start_time = if valid_time_or_date?(time)\n weeks = time.strftime(\"%U\").to_i\n Time.zone.now.beginning_of_year\n elsif time.is_a?(Numeric) && time < 53\n weeks = time.to_i\n Time.utc(year, 1, 1)\n else\n raise ParseError, \"by_week takes only a Time or Date object, a Fixnum (less than or equal to 53) or a Chronicable string.\"\n end\n # Make the start of the week predictably Sunday.\n start_time.strftime(\"%w\").to_i != 0 ? start_time - (7 - start_time.strftime(\"%w\").to_i).days : start_time\n start_time += weeks.weeks\n end_time = start_time + 1.week\n by_star(start_time, end_time, options, &block)\n end",
"def all_weeks\n @all_weeks ||=\n data_points.each_with_object(Hash.new(0)) { |feed, all_weeks|\n all_weeks[feed.occurred_on.beginning_of_week(week_start_day)] += feed.send(field)\n }\n end",
"def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else\n @start_date = @today\n until @start_date.strftime(\"%a\") == \"Mon\"\n @start_date -= 1\n end\n end\n @end_date = @start_date+21\n @date_range = (@start_date..@end_date)\n @weeks = @date_range.to_a.in_groups_of(3)\n\n\n end",
"def current_game_week\n url = \"/service/weather/json/#{api_key}/\"\n response = conn.get(url)\n result = JSON.parse(response.body, symbolize_names: true)\n weather_data = result[:Games].map do |home_team, weather_data|\n GameWeather.new(weather_data)\n end\n return result[:Week], weather_data\n end",
"def weekly_updates_by_project(since)\n since = Date.new(2000,01,01) if since == :all\n self.weekly_updates.where([\"weekstart > ?\",since]).order(\"project_id, weekstart desc\").group_by {|w| w.project}\n end",
"def week_from_now\n current_time = Time.now\n beginning_of_hour = current_time.change(:hour => current_time.hour)\n beginning_of_next_hour = beginning_of_hour - 4.hours # Include offset for EST -0500\n beginning_of_next_hour + 1.week\n end",
"def beginning_of_week(start_day = Date.beginning_of_week)\n result = days_ago(days_to_week_start(start_day))\n acts_like?(:time) ? result.midnight : result\n end",
"def weeks\n days_in_month = Time.days_in_month(month, year)\n starting_day = date.beginning_of_week() -1.day + beginning_of_week.days\n ending_day = (date + days_in_month).end_of_week() -1.day + beginning_of_week.days\n (starting_day..ending_day).to_a.in_groups_of(7).collect { |week| Week.new(week, events) }\n end",
"def weeks ; Duration[self * 604800] ; end",
"def test_start_of_week(p_date)\n if p_date.wday == 0 #sundays count as end of week for vehicle app\n return p_date - 6\n else\n (p_date - p_date.wday.days) + 1 #start on monday\n end\n end",
"def weeks\n rows = []\n rows << name_of_month.center(20) + \" \"\n rows << \"Su Mo Tu We Th Fr Sa\" + \" \"\n days = format_dates\n (0..7).each {|num|\n fields = days[num * 7, 7]\n rows << fields.join(\" \") + \" \" if fields\n }\n if rows.last.length < 22\n rows.last << \" \" * (22 - rows.last.length)\n end\n until rows.length == 8\n rows << \" \" * 22\n end\n rows\n end",
"def beginning_of_week\n Thread.current[:beginning_of_week] || beginning_of_week_default || :monday\n end",
"def beginning_of_week=(week_start)\n Thread.current[:beginning_of_week] = find_beginning_of_week!(week_start)\n end",
"def thiscoming(day) # day is an index\n if dayindex < day\n x_weeks_from_day(0, day)\n else\n x_weeks_from_day(1,day) # the day is next week\n end\n end",
"def next_week(x = 1)\n\t\tself + (604800 * x)\n\tend",
"def this_week(options={})\n today = Time.now\n this_week = today.beginning_of_week\n\n between(this_week.beginning_of_day.to_i, today.end_of_day.to_i, options)\n end",
"def weeks\n\t\treturn self * 7.days\n\tend",
"def weeks\n\t\treturn self * 7.days\n\tend",
"def detect_closest_weeks_for_date(all_weeks, date)\n date_range = ((date - 16)..(date + 16)).to_a\n all_weeks.select{|d| date_range.include?(Date.parse(d))}\n end",
"def getStartOfWeek\n\t\tstart_of_week = Setting.start_of_week\n start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank? \n\t\tstart_of_week = start_of_week.to_i % 7\n\tend",
"def find_weekpattern(date)\n # find the pattern that fits the date\n #\n if date < @from\n result = Week.new(Time.at(0), @from - MINUTE, WORK_TYPE)\n elsif date > to\n result = Week.new(@to + MINUTE, Time.new(9999), WORK_TYPE)\n else\n\n date = Time.gm(date.year, date.month, date.day)\n\n result = @weeks.find { |week| week.start <= date && week.finish >= date }\n end\n result\n end",
"def discover_week( nextweek )\n year = self.year\n owner = self.user_id\n\n if ( nextweek )\n inc = 1\n week = self.week_number + 1\n limit = Timesheet.get_last_week_number( year ) + 1\n\n return if ( week >= limit )\n else\n inc = -1\n week = self.week_number - 1\n limit = 0\n\n return if ( week <= limit )\n end\n\n while ( week != limit )\n timesheet = Timesheet.find_by_user_id_and_year_and_week_number(\n owner, year, week\n )\n\n if ( yield( timesheet ) )\n return { :week_number => week, :timesheet => timesheet }\n end\n\n week += inc\n end\n\n return nil\n end",
"def calculate_week_meeting_dates\n meetings = []\n @timeline_week_count.times do |wk|\n week_start = @beginning_of_first_week + wk.weeks\n # This excludes Sunday, putting the end of the week at Saturday.\n week_end = week_start.end_of_week(:sunday)\n week_mtgs = []\n @meeting_dates.each do |meeting|\n next if (meeting < @course.timeline_start) || (@course.timeline_end < meeting)\n week_mtgs << meeting if date_is_between(meeting, week_start, week_end)\n end\n meetings.push week_mtgs\n end\n meetings\n end",
"def current_weekly_average\n week_number = Time.now.yday / 7\n @cycling[2] = @cycling[0] / week_number\n @entertainment[2] = @entertainment[0] / week_number\n @programming[2] = @programming[0] / week_number\n @reading[2] = @reading[0] / week_number\n @yoga[2] = @yoga[0] / week_number\n end",
"def last_week( remaining_days )\n pad = DPW - remaining_days.length\n\t\tremaining_days + Array.new( pad )\n end",
"def week\n\t\t@@week\n\tend",
"def get_week_hash current_day\n monday_idx = current_day_id + 1 - current_day\n {monday: people.find(person_order[monday_idx]).name,\n tuesday: people.find(person_order[monday_idx + 1]).name,\n wednesday: people.find(person_order[monday_idx + 2]).name,\n thursday: people.find(person_order[monday_idx + 3]).name,\n friday: people.find(person_order[monday_idx + 4]).name}\n end",
"def test_week_from_back\n te = TExp::Week.new([1])\n assert_equal -1, te.send(:week_from_back, Date.parse(\"Mar 31, 2008\"))\n assert_equal -1, te.send(:week_from_back, Date.parse(\"Mar 25, 2008\"))\n assert_equal -2, te.send(:week_from_back, Date.parse(\"Mar 24, 2008\"))\n end",
"def calc_weeks_till\n (calc_days_till / 7.0).round(2)\n end"
] | [
"0.7211833",
"0.71016705",
"0.7082129",
"0.68672514",
"0.6796819",
"0.67799085",
"0.6770836",
"0.6714053",
"0.67011446",
"0.66379714",
"0.6625588",
"0.66176665",
"0.6592336",
"0.6592336",
"0.6567472",
"0.6564778",
"0.6496082",
"0.6460043",
"0.64545846",
"0.6451746",
"0.64424825",
"0.6438109",
"0.6420604",
"0.64040977",
"0.6386",
"0.63699716",
"0.63554513",
"0.63537747",
"0.63507074",
"0.63377047",
"0.633742",
"0.63373107",
"0.63365084",
"0.6326343",
"0.6294104",
"0.6289328",
"0.62889016",
"0.6238494",
"0.62337416",
"0.62303644",
"0.6228916",
"0.6214262",
"0.62099665",
"0.62099665",
"0.62072635",
"0.6202788",
"0.6147077",
"0.6138364",
"0.6138364",
"0.613418",
"0.6132776",
"0.6128553",
"0.612614",
"0.61236084",
"0.6121884",
"0.609787",
"0.6093099",
"0.6090567",
"0.60891324",
"0.6078391",
"0.60696524",
"0.6068208",
"0.60589445",
"0.60534036",
"0.60508716",
"0.604204",
"0.6041799",
"0.6033252",
"0.60286486",
"0.6028626",
"0.6023636",
"0.60215974",
"0.60126626",
"0.60016954",
"0.59960014",
"0.5993941",
"0.5984176",
"0.59792227",
"0.5972519",
"0.5961865",
"0.59561795",
"0.5952039",
"0.5935246",
"0.59230447",
"0.5912463",
"0.5908837",
"0.5902475",
"0.5895132",
"0.5895132",
"0.58933884",
"0.58867776",
"0.5885433",
"0.58825606",
"0.5874368",
"0.58740133",
"0.5873229",
"0.58542866",
"0.5851042",
"0.585013",
"0.58453375"
] | 0.71990055 | 1 |
returns the week number based on whether any games in that particular week have already started | def game_week
now = DateTime.now
all_games = NflSchedule.where(year: Date.today.year)
.order(:start_time)
week_started = 0
all_games.each { |game|
if (week_started < game.week) && (now > game.start_time)
week_started = game.week
end
}
return week_started
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week( date = Date.today )\n (0...weeks.size).find { |i| weeks[i].include? date } + 1\n end",
"def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.send(\"wday_offset\"))\n week_num = 0\n working_date.step(self) { |a_day| \n if a_day.wday == _week_day_numbers.first\n week_num += 1\n end\n }\n week_num\n end",
"def week\n @week ||= (((date-start_of_month)+1)/7.0).ceil\n end",
"def match_week\n @week ? { 'fiscal_week_id' => @week.to_i } : {}\n end",
"def bye_weeks\n Set.new(((1..17).to_a - (cached_home_games.map(&:week) + cached_away_games.map(&:week))))\n end",
"def week_index\n @week_index ||= date.wday\n end",
"def weeks\n result = end_week - start_week + 1\n weeks = Date.new(start_date.year, 12, 31).strftime('%W').to_i\n result < 0 ? result + weeks : result\n end",
"def week_no(args = nil)\n week_no = (self.day_of_year.to_f / 7).to_i + 1\n \n if args and args[:mfirst] and self.day_in_week == 1\n week_no -= 1\n end\n \n return week_no\n end",
"def discover_week( nextweek )\n year = self.year\n owner = self.user_id\n\n if ( nextweek )\n inc = 1\n week = self.week_number + 1\n limit = Timesheet.get_last_week_number( year ) + 1\n\n return if ( week >= limit )\n else\n inc = -1\n week = self.week_number - 1\n limit = 0\n\n return if ( week <= limit )\n end\n\n while ( week != limit )\n timesheet = Timesheet.find_by_user_id_and_year_and_week_number(\n owner, year, week\n )\n\n if ( yield( timesheet ) )\n return { :week_number => week, :timesheet => timesheet }\n end\n\n week += inc\n end\n\n return nil\n end",
"def mds_needing_scoring\n Matchday.where(locked: true, scored: false).pluck(:week)\n end",
"def at_least_week?(record)\n return calculate_length(record) >= 7\n end",
"def week_start\n\ti = 1\n\twhile i < RC_C.num_rows\n\t\ttmp = RC_C.rows[i][0].split(\" \")[0].split(\"/\")\n\t\tdate = Date.parse(tmp[2] + '-' + tmp[0] + '-' + tmp[1])\n\t\tif (Date.parse(\"monday\") - 7) <= date\n\t\t\treturn i\n\t\tend\n\t\ti += 1\n\tend\n\treturn i\nend",
"def check_week(target_week)\n $log.info(\"Looking for week #{ target_week } scores, using week #{ @current_week } scores.\")\n raise \"No new scores - nothing to do. Aborting.\" unless target_week == @current_week \n end",
"def week_number\n\t\tWeek.find(week_id).week_number\n\tend",
"def weeks() 7 * days end",
"def this_week?\n\t\trange = (Time.now .. Time.now.sunday)\n\t\trange = (Time.now .. Time.now.next_week) if(Time.now.sunday?)\n\t\tself.showtimes.detect{ |st| range.cover? st.timestamp }\n\tend",
"def this_week?\n\t\trange = (Time.now .. Time.now.sunday)\n\t\trange = (Time.now .. Time.now.next_week) if(Time.now.sunday?)\n\t\tself.showtimes.detect{ |st| range.cover? st.timestamp }\n\tend",
"def test_start_of_week(p_date)\n if p_date.wday == 0 #sundays count as end of week for vehicle app\n return p_date - 6\n else\n (p_date - p_date.wday.days) + 1 #start on monday\n end\n end",
"def calculate_timeline_week_count\n ((@course.timeline_end.to_date - @beginning_of_first_week).to_f / 7).ceil\n end",
"def current_week\n standings = Standing.all.order(:wins).reverse\n\n user_standing_index = nil\n standings.each_with_index do |st, index|\n user_standing_index = index if st.user_id == current_user.id\n end\n\n ahead_user_standings = standings[user_standing_index - 1]\n behind_user_standings = standings[user_standing_index + 1]\n\n ahead_user = User.find(ahead_user_standings.user_id)\n behind_user = User.find(behind_user_standings.user_id)\n\n @user_standing = {\n place: user_standing_index + 1,\n wins: standings[user_standing_index].wins\n }\n\n @current_week = Week.last\n games = Game.where(week_id: @current_week.id)\n @games = games.order(:game_finished, :date, :start_time)\n\n if games.order(updated_at: :desc).first\n @last_upd = games.order(updated_at: :desc).first.updated_at\n else\n @last_upd = @current_week.updated_at\n end\n\n @correct = 0\n ahead_correct = 0\n behind_correct = 0\n\n @picks = {}\n @games.each do |g|\n user_pick = g.picks.where(user_id: current_user.id)\n ahead_pick = g.picks.where(user_id: ahead_user.id)\n behind_pick = g.picks.where(user_id: behind_user.id)\n\n pick_count = g.picks.count.to_f\n away_count = g.picks.where(away_home: 'away').count.to_f\n home_count = g.picks.where(away_home: 'home').count.to_f\n\n if away_count > home_count\n field = \"#{g.away} (#{(away_count / pick_count) * 100}%)\"\n elsif home_count > away_count\n field = \"#{g.home} (#{(home_count / pick_count) * 100}%)\"\n else\n field = 'split 50/50'\n end\n\n if user_pick[0] != nil\n if user_pick[0].pick\n @picks[user_pick[0].game_id] = { \n :pick => user_pick[0].pick, \n :away_home => user_pick[0].away_home,\n :field => field\n }\n end\n\n if user_pick[0].tbreak_pts != nil\n @tbreak_pts = user_pick[0].tbreak_pts\n end\n\n if g[:game_finished] == true\n @correct += 1 if user_pick[0].away_home == g.winner\n ahead_correct += 1 if ahead_pick[0].away_home == g.winner\n behind_correct += 1 if behind_pick[0].away_home == g.winner\n end\n end\n end\n\n @ahead = {\n user: ahead_user.username,\n wins: ahead_user_standings.wins,\n correct_this_week: ahead_correct\n }\n\n @behind = {\n user: behind_user.username,\n wins: behind_user_standings.wins,\n correct_this_week: behind_correct\n }\n end",
"def week_start\n\ti = 1\n\twhile i < RC_C.num_rows\n\t\ttmp = RC_C.rows[i][0].split(\" \")[0].split(\"/\")\n\t\tdate = Date.parse(tmp[2] + '-' + tmp[0] + '-' + tmp[1])\n\t\t\t\tputs 'tmp is ' + tmp.to_s + ', date is ' + date.to_s\n\t\tif (Date.parse(\"monday\") - 7) <= date\n\t\t\tputs Date.parse('monday') - 7\n\t\t\tputs 'success at i = ' + i.to_s\n\t\t\treturn i + 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn i\nend",
"def start_of_week; self - wday.days end",
"def current_game_week\n url = \"/service/weather/json/#{api_key}/\"\n response = conn.get(url)\n result = JSON.parse(response.body, symbolize_names: true)\n weather_data = result[:Games].map do |home_team, weather_data|\n GameWeather.new(weather_data)\n end\n return result[:Week], weather_data\n end",
"def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end",
"def odd_week?; (to_i / 7.days).odd? end",
"def general\n @week == 0 ? true : false\n end",
"def registration_weeks\n result = 0\n weeks = 0\n if registration_start_date && registration_end_date\n weeks = Date.new(registration_start_date.year, 12, 31).\n strftime('%W').to_i\n\n result = get_registration_end_week - get_registration_start_week + 1\n end\n result < 0 ? result + weeks : result\n end",
"def week_number(date_time=Time.now)\n date_time.strftime(WEEK_NUMBER_FORMAT).to_i\n end",
"def start_week\n start_date.strftime('%W').to_i\n end",
"def _week_day_numbers\n week_day_start = self.week_day_start\n week_day_start.capitalize if week_day_start.is_a? String\n [0, 1, 2, 3, 4, 5, 6].partition {|on| on >= day_names.index(week_day_start)%7 }.flatten\n end",
"def first_week?\n week_split[0].include?(day)\n end",
"def showable_week( nextweek )\n discover_week( nextweek ) do | timesheet |\n ( not timesheet.nil? )\n end\n end",
"def number_of_weeks\n @number_of_weeks ||= cell_row(last_of_month) + 1\n end",
"def week; end",
"def max_weeks\n return SurvivorEntry::MAX_WEEKS_MAP[self.get_game_type]\n end",
"def beginning_of_week; end",
"def beginning_of_week; end",
"def pays_players_week\n self.players.inject(0) {|sum, player| sum += player.pay_week}\n end",
"def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end",
"def games_won(player)\n\t\ttiebreak_win = tiebreak && tiebreak.winner_id.eql?(player.id) ? 1 : 0\n\t\tgames.where(winner_id: player.id).count + tiebreak_win\n\tend",
"def starting_of_week\n self.class.new(year, month, current_week.detect { |i| !i.nil? })\n end",
"def unused_weeks()\n timesheets = Timesheet.where( :user_id => self.user_id, :year => self.year )\n used_weeks = timesheets.select( :week_number ).map( &:week_number )\n\n range = 1..Timesheet.get_last_week_number( self.year )\n unused_weeks = ( range.to_a - used_weeks )\n unused_weeks.push( self.week_number ) unless ( self.week_number.nil? )\n\n return unused_weeks.sort()\n end",
"def last_week?\n week_split.last.include?(day)\n end",
"def mweek; (5 - wday + day) / 7 end",
"def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n end \n \n days_of_week\n end",
"def week_eliminated(chefstats)\n chefstats.each { |chefstat|\n if chefstat.stat.abbreviation == Stat::ELIMINATED_ABBR\n return chefstat.week\n end\n }\n return nil\n end",
"def total_weeks\n week_split.size\n end",
"def weeks_in_year\n return (self-(self.yday-1)).wday == 6 && self.leap? ? 54 : 53\n end",
"def week\n\t\t@@week\n\tend",
"def calculate_open_weeks\n @timeline_week_count - blackout_weeks_count - @course.weeks.count\n end",
"def weeks\n self.to_i * 604_800\n end",
"def date_of_next_week_count(find_week)\n current = Time.current\n week_count = find_week_count(current)\n while week_count != 1\n current += 1.week\n week_count = find_week_count(current)\n end\n\n while week_count != find_week\n current += 1.week\n week_count = find_week_count(current)\n end\n\n current.strftime('%Y-%V')\n end",
"def weekly_availability\n return [] if course.nil?\n\n availability = [\n { day: 'monday', count: 0, start_times: [] },\n { day: 'tuesday', count: 0, start_times: [] },\n { day: 'wednesday', count: 0, start_times: [] },\n { day: 'thursday', count: 0, start_times: [] },\n { day: 'friday', count: 0, start_times: [] },\n { day: 'saturday', count: 0, start_times: [] },\n { day: 'sunday', count: 0, start_times: [] }\n ]\n\n course.plannings.order('start_time ASC, end_time ASC').each do |planning|\n next if planning.week_day.nil? or Date::DAYNAMES[planning.week_day].nil?\n course_day = Date::DAYNAMES[planning.week_day].downcase\n day_availability = availability.detect { |d| d[:day] == course_day }\n\n day_availability[:count] += 1\n day_availability[:start_times] << I18n.l(planning.start_time, format: :short) if planning.start_time\n end\n\n availability\n end",
"def smoked_this_week\n Smoke.by_user(id).this_week(Date.today).sum(:counted) || 0\n end",
"def day_of_week\n return -1 if self.day_of_year == 308\n result = self.days_since_epoch % 8\n if result > 0\n result\n else\n 8\n end\n\n end",
"def cfp_weeks\n result = 0\n if call_for_papers\n result = call_for_papers.weeks\n end\n result\n end",
"def current_week\n week_split.select { |c| c.include?(day) }.flatten\n end",
"def get_current_week_from_weeks(weeks)\n now = DateTime.now\n weeks.each { |week|\n if now < week.start_time\n return (week.number - 1)\n end\n }\n return weeks.last.number\n end",
"def week_of_month\n week_split.each_with_index do |o, i|\n return (i + 1) if o.include?(day)\n end\n end",
"def current_week\n self.week.to_i\n end",
"def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end",
"def week(date = Date.today)\n day = monday(date)\n (day..day + 6)\n end",
"def weeks\n\t\treturn self * 7.days\n\tend",
"def weeks\n\t\treturn self * 7.days\n\tend",
"def day_of_week\n # Zellers: 0 = Saturday, 1 = Sunday, 2 = Monday, ..., 6 = Friday\n # day_of_week: 1 = Sunday, 7 = Saturday\n (zellers_congruence + 6) % 7\n end",
"def week_matches? date\n\t if @unit == :weeks \n \t return true if @frequency == 1\n \t return ((Recurring.week_of_year(date) - Recurring.week_of_year(@anchor)) % @frequency) == 0\n \tend\n \tif @weeks\n \t @weeks.include?(Recurring.nth_instance_of_day_in_month(date)) || @weeks.include?(Recurring.nth_negative_instance_of_day_in_month(date))\n \telse\n \t true\n \tend\n end",
"def <=>(other_week)\n if @start < other_week.start\n return -1\n elsif @start == other_week.start\n return 0\n else\n return 1\n end \n end",
"def weeks\n lines[2..-1]\n end",
"def beginning_of_week\n (self - self.wday.days).midnight + 1.day\n end",
"def all_weeks\n @all_weeks ||=\n data_points.each_with_object(Hash.new(0)) { |feed, all_weeks|\n all_weeks[feed.occurred_on.beginning_of_week(week_start_day)] += feed.send(field)\n }\n end",
"def week_of_month\n week_split.each_with_index do |o, i|\n return (i + 1) if o.include?(day)\n end\n end",
"def pbIsWeekday(wdayVariable,*arg)\n timenow = pbGetTimeNow\n wday = timenow.wday\n ret = false\n for wd in arg\n ret = true if wd==wday\n end\n if wdayVariable>0\n $game_variables[wdayVariable] = [ \n _INTL(\"Sunday\"),\n _INTL(\"Monday\"),\n _INTL(\"Tuesday\"),\n _INTL(\"Wednesday\"),\n _INTL(\"Thursday\"),\n _INTL(\"Friday\"),\n _INTL(\"Saturday\")][wday] \n $game_map.need_refresh = true if $game_map\n end\n return ret\nend",
"def iso_week_num(wkst)\n iso_year_and_week_num(wkst)[1]\n end",
"def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end",
"def next_week\n if self.class == Date\n self + 7\n elsif self.class == Time\n self + (60 * 60 * 24 * 7)\n end\n end",
"def week_1_total\n total = 0\n rostered_players.each do |rostered_player|\n total += rostered_player.player.week_1_score\n end\n return total\n end",
"def current_week\n\t\t#TODO\n\tend",
"def num_games win_condition\n total_games = 0\n @game_objects.each do |game|\n total_games += 1 if game_meets_win_cond?(win_condition, game)\n end \n total_games\n end",
"def end_of_week; self + (6 - wday).days end",
"def get_registration_start_week\n registration_start_date.strftime('%W').to_i\n end",
"def current_week\n return get_current_week_from_weeks(Week.where(year: Date.today.year)\n .order(:number))\n end",
"def week\n self.range('week')\n end",
"def start_of_week\n @start_of_week ||= (start_of_month + (7 * (week - 1)))\n end",
"def get_biweek()\n a = []\n week_days = DAYS.map { |day| day[:day] }\n @schedule.each_with_index do |row, i|\n row = row.compact.map { |a| a.upcase }\n if row.all? { |word| week_days.include?(word) } && row != []\n a.push(i + 1)\n end\n end\n return a\nend",
"def first_wday; (wday - day + 1) % 7 end",
"def getStartOfWeek\n\t\tstart_of_week = Setting.start_of_week\n start_of_week = l(:general_first_day_of_week, :default => '1') if start_of_week.blank? \n\t\tstart_of_week = start_of_week.to_i % 7\n\tend",
"def measure_streak\n streak = 0\n streak_ended = false\n \n @by_week.each_pair do |week, categories|\n result = false\n \n # Check if the passed in category is in the list of checkin categories.\n categories.each do |cat|\n if cat.downcase.include? @category.downcase\n result = true\n end\n end\n\n # If an existing streak is broken, stop here.\n # TODO: Try to continue and gather up historical streaks.\n if streak_ended and streak > 0\n break\n end\n \n # If this week doesn't have a result, contine to next week.\n if not result\n streak_ended = true\n next\n end\n \n # Increment the streak.\n streak_ended = false\n streak = streak + 1\n end\n \n @results[@category] = streak\n end",
"def week_day_conflict?(event)\n @start.wday == event.start.wday\n end",
"def num_startups_connected_with_this_week\n self.relationships.where(:connected_with_type => 'Startup').where(['pending_at >= ?', Checkin.prev_after_checkin]).pending.count\n end",
"def find_weekpattern(date)\n # find the pattern that fits the date\n #\n if date < @from\n result = Week.new(Time.at(0), @from - MINUTE, WORK_TYPE)\n elsif date > to\n result = Week.new(@to + MINUTE, Time.new(9999), WORK_TYPE)\n else\n\n date = Time.gm(date.year, date.month, date.day)\n\n result = @weeks.find { |week| week.start <= date && week.finish >= date }\n end\n result\n end",
"def weeks ; self * 7.days ; end",
"def week_from_today\n ::Date.today + 7\n end",
"def days_left_in_week\n 7 - days_past_in_week\n end",
"def weekly?\n starts_at.is_a?(Fixnum) && ends_at.is_a?(Fixnum)\n end",
"def weeks_on_list\n @data['weeks_on_list']\n end",
"def start_of_week_with_wkst(wkst)\n wkst ||= 1\n date = ::Date.civil(self.year, self.month, self.day)\n date -= 1 while date.wday != wkst\n date\n end",
"def week_pattern\n year_weeks == 53 ? [5,4,5]+[4,4,5]*3 : [4,4,5]*4\n end",
"def get_start_of_week(d)\n d -= DAY until d.monday?\n d\n end",
"def days_of_week_hash\n @days_of_week_hash ||= {\n :sunday => (days_of_week & SUNDAY ) > 0,\n :monday => (days_of_week & MONDAY ) > 0,\n :tuesday => (days_of_week & TUESDAY ) > 0,\n :wednesday => (days_of_week & WEDNESDAY ) > 0,\n :thursday => (days_of_week & THURSDAY ) > 0,\n :friday => (days_of_week & FRIDAY ) > 0,\n :saturday => (days_of_week & SATURDAY ) > 0\n }\n end",
"def get_week\n\t week = Time.now.strftime(\"%W\").to_i\n\t wday = Time.now.wday\n\t week = wday <= 3 ? week - 1 : week\n\t \t\n\t # registro = ActivityReport.find(:all, :conditions => {:volunteer_id => self.volunteer_id, :semana => week})\n\t registro = ActivityReport.where(volunteer_id: self.volunteer_id, semana: week)\n\t unless registro.empty?\n\t # DEPRECATION WARNING: ActiveModel::Errors#[]= is deprecated and will be removed in Rails 5.1. Use model.errors.add(:semana, \": Ya existe un registro de esta Semana\") instead. (called from get_week at /vagrant_data/hadronapp/app/models/activity_report.rb:35)\n\t errors[:semana] = \": Ya existe un registro de esta Semana\"\n\t return false\n \tend\n\tend"
] | [
"0.7157287",
"0.7049902",
"0.6924994",
"0.6918694",
"0.6899286",
"0.6851943",
"0.6797575",
"0.6718376",
"0.6714368",
"0.6697344",
"0.6673988",
"0.66644907",
"0.6648989",
"0.6647416",
"0.6618264",
"0.6610505",
"0.6610505",
"0.6570503",
"0.6503514",
"0.6502665",
"0.64974725",
"0.649392",
"0.64742357",
"0.64655316",
"0.6455269",
"0.6443146",
"0.64417994",
"0.6440789",
"0.6430594",
"0.6429206",
"0.6425929",
"0.64210224",
"0.64077234",
"0.6384072",
"0.6344569",
"0.6342229",
"0.6342229",
"0.6325934",
"0.63258797",
"0.6319715",
"0.6310884",
"0.6306777",
"0.6290073",
"0.6282876",
"0.6257884",
"0.6255586",
"0.6251012",
"0.62492585",
"0.6230108",
"0.6222861",
"0.6220274",
"0.6219092",
"0.62121475",
"0.6207827",
"0.62038165",
"0.61949074",
"0.6187507",
"0.6182285",
"0.6173588",
"0.61673486",
"0.6145006",
"0.6135162",
"0.61306727",
"0.61306727",
"0.6128286",
"0.61139965",
"0.6104681",
"0.610383",
"0.6102846",
"0.61008275",
"0.60846955",
"0.608334",
"0.6063866",
"0.6062692",
"0.6062692",
"0.6048412",
"0.6029449",
"0.60179967",
"0.6011207",
"0.60099185",
"0.6008758",
"0.6002845",
"0.6001904",
"0.60005015",
"0.59982693",
"0.5991074",
"0.59905225",
"0.59798956",
"0.5971439",
"0.59616077",
"0.59596837",
"0.5957259",
"0.59541076",
"0.59526473",
"0.59409916",
"0.5924525",
"0.59208333",
"0.5917182",
"0.5908493",
"0.59048367"
] | 0.8510001 | 0 |
GET /university_profiles/1 GET /university_profiles/1.json | def show
@university_profile = UniversityProfile.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @university_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end",
"def show\n @university = University.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university }\n end\n end",
"def set_university\n @university = University.find(params[:id])\n @university_profiles = @university.university_profiles.paginate(:page => params[:page], :per_page => 10)\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def profile\n p @user.as_json\n render json: @user.as_json\n end",
"def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end",
"def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end",
"def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end",
"def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def show\n @profile = Profile.find_by_user_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile.to_json(:include => [:faculty, :course]) }\n end\n end",
"def new\n @university_profile = UniversityProfile.new\n @university_profile.university_courses || @user.build_university_courses\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university_profile }\n end\n end",
"def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end",
"def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def show\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @private_profile }\n end\n end",
"def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end",
"def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end",
"def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end",
"def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end",
"def show\n @university = University.find(params[:id])\n end",
"def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n if @university_profile.save\n format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }\n format.json { render json: @university_profile, status: :created, location: @university_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profiles\n collection(\"profiles\", paged: true)\n end",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end",
"def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end",
"def get_profile\n self.class.get '/members/private', @options\n end",
"def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end",
"def index\n @personal_profiles =current_user.personal_profile\n end",
"def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n response = OpenStruct.new({\n 'id': @current_user.account_uuid,\n 'type': 'mvi_models_mvi_profiles',\n 'gender': @current_user.gender_mpi,\n 'birth_date': @current_user.birth_date_mpi\n })\n handle_errors!(response)\n\n render json: response, serializer: PersonalInformationSerializer\n end",
"def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def show\n render json: @skill_user_profile\n end",
"def show\n @institute_admin = InstituteAdmin.includes(:profile).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institute_admin }\n end\n end",
"def index\n @student_profiles = StudentProfile.all \n render json: @student_profiles\n end",
"def show\n @uniprot = Uniprot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uniprot }\n end\n end",
"def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end",
"def index\n @user_profiles = UserProfile.all\n end",
"def index\n @user_profiles = UserProfile.all\n end",
"def index\n @user_profiles = UserProfile.all\n end",
"def index\n @user_profiles = UserProfile.all\n end",
"def destroy\n @university_profile = UniversityProfile.find(params[:id])\n @university_profile.destroy\n \n respond_to do |format|\n format.html { redirect_to university_profiles_url }\n format.json { head :no_content }\n end\n end",
"def show\n @organization_profile = OrganizationProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization_profile }\n end\n end",
"def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end",
"def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end",
"def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end",
"def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end",
"def index\n @profiles = current_user\n end",
"def index\n @github_profiles = GithubProfile.all\n end",
"def index\n @userprofiles = Userprofile.all\n end",
"def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end",
"def profiles(fields: nil)\n params = build_fields_params fields\n res = @connection.get profile_path, params\n map_as_collection res, Profile\n end",
"def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def index\n @profiles = Profile.all\n end",
"def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end",
"def index\n @profiles = Profile.all\n\n end",
"def update\n @university_profile = UniversityProfile.find(params[:id])\n \n respond_to do |format|\n if @university_profile.update_attributes(params[:university_profile])\n format.html { redirect_to @university_profile, notice: 'University profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @profiles = Profile.all\n respond_to do |format|\n format.html\n format.json do\n @profiles = Profile.near(\n [\n current_user.profile.latitude,\n current_user.profile.longitude\n ], params[:radius]\n ).distinct\n @profiles = @profiles.where.not(id: current_user.profile.id)\n @profiles = @profiles.min_age(params[:min_age]) if params[:min_age].present?\n @profiles = @profiles.max_age(params[:max_age]) if params[:max_age].present?\n @profiles = @profiles.by_gender(params[:gender]) if params[:gender].present?\n @profiles = @profiles.by_activity(params[:activity])\n\n render json: @profiles.map{|profile| profile.attributes.merge(image: profile.image.url(:medium))}\n end\n end\n end",
"def index \n @profiles = Profile.all\n end",
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend",
"def index\n @profiles = Profile.all\n end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @user_profile }\n end\n end",
"def profile; Profile.get(self.profile_id); end",
"def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end",
"def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end",
"def show\n @profiles = @grab.profiles\n end",
"def profile\n render json: @current_user\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def index\r\n @profiles = Profile.all\r\n end"
] | [
"0.69243425",
"0.69243425",
"0.6900653",
"0.68601173",
"0.67913383",
"0.66611785",
"0.66429806",
"0.6641157",
"0.6624576",
"0.655977",
"0.6556821",
"0.65536",
"0.65536",
"0.6533507",
"0.6520157",
"0.65135384",
"0.650938",
"0.6475463",
"0.6452095",
"0.64447385",
"0.64406747",
"0.6421038",
"0.6389824",
"0.6351425",
"0.6338403",
"0.6303549",
"0.63032806",
"0.63029206",
"0.6283554",
"0.62688714",
"0.6258249",
"0.6241088",
"0.62359923",
"0.6232469",
"0.6221502",
"0.6213998",
"0.6203144",
"0.6203144",
"0.6203144",
"0.6202589",
"0.620207",
"0.6200384",
"0.6197693",
"0.618939",
"0.61736363",
"0.6169506",
"0.6167524",
"0.6167524",
"0.6167524",
"0.6167524",
"0.61671394",
"0.6161293",
"0.6158384",
"0.61571616",
"0.6147197",
"0.6135411",
"0.61300313",
"0.611388",
"0.6111868",
"0.6109579",
"0.60931826",
"0.6089617",
"0.60894024",
"0.60829526",
"0.60814124",
"0.6073737",
"0.6073275",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6041918",
"0.6036967",
"0.60322386",
"0.60243416",
"0.60190713",
"0.6016789",
"0.6011401",
"0.60078764",
"0.59988725",
"0.59844863",
"0.598068",
"0.5977644",
"0.5976979",
"0.5976979",
"0.59711605",
"0.59710336",
"0.5969878",
"0.5968216"
] | 0.79866904 | 0 |
GET /university_profiles/new GET /university_profiles/new.json | def new
@university_profile = UniversityProfile.new
@university_profile.university_courses || @user.build_university_courses
respond_to do |format|
format.html # new.html.erb
format.json { render json: @university_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n if @university_profile.save\n format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }\n format.json { render json: @university_profile, status: :created, location: @university_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end",
"def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end",
"def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n @profile.build_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @profile }\n end\n end",
"def new\n # @profile = Profile.new\n\n\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @private_profile = PrivateProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @private_profile }\n end\n end",
"def new\n @profile_attribute = current_user.profile_attributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile_attribute }\n format.json { render :json => @profile_attribute }\n end\n end",
"def new\n @uniprot = Uniprot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uniprot }\n end\n end",
"def new\n @profilepage = Profilepage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profilepage }\n end\n end",
"def new\n # @profile = Profile.new\n # authorize! :new, @profile\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\n @ProfileType = ProfileType.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @ProfileType }\n end\n end",
"def new\n @profile = Profile.new\n end",
"def new\n @profile = Profile.new\n end",
"def new\n @profile = Profile.new\n end",
"def new\n build_profile\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @organization_profile = OrganizationProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization_profile }\n end\n end",
"def new\n \t@user_profile = UserProfile.new\n end",
"def new\n\t\t@profile = Profile.new\n\tend",
"def new\n\t\t@profile = Profile.new\n\tend",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.new\n end",
"def new\n if current_user.profile.nil?\n @profile = Profile.new \n respond_with(@profile)\n else\n redirect_to profiles_path, notice: \"You can only create one profile as a user\"\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def create\n @private_profile = PrivateProfile.new(params[:private_profile])\n\n respond_to do |format|\n if @private_profile.save\n format.html { redirect_to @private_profile, notice: 'Private profile was successfully created.' }\n format.json { render json: @private_profile, status: :created, location: @private_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @private_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institution }\n end\n end",
"def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pay_profile = PayProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pay_profile }\n end\n end",
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def new\n @meetup_profile = MeetupProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meetup_profile }\n end\n end",
"def new\n @site = Site.new\n @profile_id = Profile.where(:username=>session[:username]).first.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.new\n @profile.user_id = session[:user_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile\nend",
"def new\n @profile_picture = ProfilePicture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile_picture }\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end",
"def new\n @web_profile = WebProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = current_user.id\n @personal_info = PersonalInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_info }\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile.full_name = 'System'\n profile\nend",
"def new\n @jurisdiction = Jurisdiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jurisdiction }\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n if @user.profile\n redirect_to edit_user_profile_path(@user)\n return\n end\n @profile = Profile.new\n respond_to do |format|\n format.html { render :action => \"profiles/edit\" }\n format.xml { render :xml => @profile }\n end\n end",
"def new\n @user = User.new\n @user.build_profile\n end",
"def new\n @inschool = Inschool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end",
"def new\n @user = User.new(:organization_id => current_org.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end",
"def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\n end\n end",
"def new\n @institute_admin = InstituteAdmin.new\n @institute_admin.build_profile\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @institute_admin }\n end\n end",
"def new\n @profile = Profile.new\n @goal = @user.goals.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end",
"def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end",
"def new\n @user = current_user\n @profile = Profile.new\n\n respond_with @profile\n end",
"def new\n\t\t@user = current_user\n\t\t@profile = @user.build_profile\n\tend",
"def create\n @representative_profile = RepresentativeProfile.new(representative_profile_params)\n\n respond_to do |format|\n if @representative_profile.save\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully created.' }\n format.json { render :show, status: :created, location: @representative_profile }\n else\n format.html { render :new }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @membership }\n end\n end",
"def new\n @unp = Unp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unp }\n end\n end",
"def create\n @university = University.new(university_params)\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render :show, status: :created, location: @university }\n else\n format.html { render :new }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @person_interest = PersonInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person_interest }\n end\n end"
] | [
"0.7789181",
"0.75316393",
"0.75316393",
"0.7491082",
"0.7491082",
"0.7491082",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7471185",
"0.7407796",
"0.7406522",
"0.7333984",
"0.73157513",
"0.72933996",
"0.7232191",
"0.7230974",
"0.7132187",
"0.71194345",
"0.708548",
"0.70609635",
"0.70609635",
"0.70609635",
"0.7055723",
"0.7042105",
"0.70388657",
"0.7038356",
"0.70306784",
"0.70306784",
"0.70299107",
"0.6993284",
"0.69757533",
"0.6969132",
"0.6967337",
"0.69283164",
"0.691175",
"0.6890954",
"0.68662304",
"0.68662304",
"0.68620205",
"0.686124",
"0.68604946",
"0.68505913",
"0.68498796",
"0.68497705",
"0.68497705",
"0.68497705",
"0.68497705",
"0.68497705",
"0.68497705",
"0.68497705",
"0.6803828",
"0.68018305",
"0.6801573",
"0.67902195",
"0.6780004",
"0.6769502",
"0.67674917",
"0.6758534",
"0.6746553",
"0.6741274",
"0.67385364",
"0.6737299",
"0.6737299",
"0.67351484",
"0.67281747",
"0.67213887",
"0.6720661",
"0.67119485",
"0.670789",
"0.6701917",
"0.66975963",
"0.66939354",
"0.6693467",
"0.6692873",
"0.6687315",
"0.6687315",
"0.6687315",
"0.6687315",
"0.6687315",
"0.6687315",
"0.6687315",
"0.6687315",
"0.6685573",
"0.66813487",
"0.66813487",
"0.66813487",
"0.6677672",
"0.66706413",
"0.6665481",
"0.6664465",
"0.66586745",
"0.66539174",
"0.6651945",
"0.665168"
] | 0.76105875 | 1 |
POST /university_profiles POST /university_profiles.json | def create
@university_profile = UniversityProfile.new(params[:university_profile])
respond_to do |format|
if @university_profile.save
format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }
format.json { render json: @university_profile, status: :created, location: @university_profile }
else
format.html { render action: "new" }
format.json { render json: @university_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end",
"def new\n @university_profile = UniversityProfile.new\n @university_profile.university_courses || @user.build_university_courses\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university_profile }\n end\n end",
"def university_params\n params.require(:university).permit(\n :univ_name,\n university_profile_attributes:\n [\n :id, :classification, :description, :owner, :total_area_hectare, :total_area_meter, :acquisition, :titling_status, :date_issued, :tax_dec_no, :remarks, :titling_step_ein , :titling_step_zwei, :titling_step_drei, :titling_step_vier, :titling_step_funf, :titling_step_sechs, :titling_step_sieben, :titling_step_acht, :titling_step_neun, :titling_step_zehn, :_destroy\n ]\n )\n end",
"def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @university = University.new(params[:university])\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render json: @university, status: :created, location: @university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_university\n @university = University.find(params[:id])\n @university_profiles = @university.university_profiles.paginate(:page => params[:page], :per_page => 10)\n end",
"def create\n @university = University.new(university_params)\n @university.user_id = current_user.id\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to university_path(@university), notice: 'University was successfully created.' }\n format.json { render :show, status: :created, location: @university }\n else\n format.html { render :new }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @university = University.new(university_params)\n\n respond_to do |format|\n if @university.save\n format.html { redirect_to @university, notice: 'University was successfully created.' }\n format.json { render :show, status: :created, location: @university }\n else\n format.html { render :new }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end",
"def create\n @surgical_profile = SurgicalProfile.new(surgical_profile_params)\n\n # TODO: minimize into single query\n @patient = Patient.query_one_by_id(\n current_user, @surgical_profile.patient_id\n )\n @surgeon = User.find(@surgical_profile.user_id)\n\n respond_to do |format|\n if @surgical_profile.preprocess_and_save()\n format.html { redirect_to patient_surgical_profiles_path(@patient), notice: 'Surgical profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @surgical_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @surgical_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end",
"def create\n\t\t# Creating the profile for particular surgeon\n\t\tsurgeon_profile = current_user.setting.build_profile(speciality_name: params[:speciality_name],sub_speciality_name:params[:sub_speciality_name],:medical_school=>params[:medical_school],:residency=>params[:residency],:spe_training=>params[:spe_training],:my_favourite=>params[:my_favourite],:my_hobby=>params[:my_hobby],:more_about=>params[:more_about],:cover_image=>params[:cover_image],:profile_image=>params[:profile_image]) \n\t\t# Condition checking the profile is saved or not\n\t\tif surgeon_profile.save\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Profile Successfully Created.\", response: surgeon_profile.as_json },:status=>200\n\t else\n\t render :json=> { success: false, message: surgeon_profile.errors },:status=> 203\n\t end\n\tend",
"def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @representative_profile = RepresentativeProfile.new(representative_profile_params)\n\n respond_to do |format|\n if @representative_profile.save\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully created.' }\n format.json { render :show, status: :created, location: @representative_profile }\n else\n format.html { render :new }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @userprofile = Userprofile.new(userprofile_params)\n\n respond_to do |format|\n if @userprofile.save\n format.html { redirect_to @userprofile, notice: 'Userprofile was successfully created.' }\n format.json { render :show, status: :created, location: @userprofile }\n else\n format.html { render :new }\n format.json { render json: @userprofile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(user_profile_params)\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n byebug\n @skill_user_profile = SkillUserProfile.new(skill_user_profile_params)\n\n if @skill_user_profile.save\n render json: @skill_user_profile, status: :created, location: @skill_user_profile\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end",
"def create\n Userprofile.create(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end",
"def university_params\n params.require(:university).permit(:user_id, :country_id, :option, :private_or_public, :name, :description, :fundation, :rector, :email, :facebook, :twitter, :linkedin, :website, :link_admission, :address, :longitude, :latitude, :logo, :many_proffesors, :many_students, :is_wifi, :is_cafe, :is_safe, :is_libray, :is_job_help, :is_student_exchange, :is_spiritual, :gym, :pool, :residence, :location, :lunch, :football, :soccer, :volley, :tennis, :table_tennis, :baseball, :track_and_field, :golf, :swimming, :rugby, :climbing, :lacrosse, :drawing, :photography, :sculpture, :theatre, :wood, :music, :choir, :marching_band, :dance, :mun, :volunteer, :gamers, :english, :spanish, :french, :german, :chinese, :italian, :portuguese, :russian, :japanese, :latin, :greek, :signs)\n end",
"def show\n @university_profile = UniversityProfile.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university_profile }\n end\n end",
"def create\n @admin_profile = Admin::Profile.new(admin_profile_params)\n\n respond_to do |format|\n if @admin_profile.save\n unless params[:admin_profile][:avatar].blank?\n preloaded = Cloudinary::Uploader.upload(params[:admin_profile][:avatar], :use_filename => true, :public_id => \"profiles/#{@admin_profile.id}\")\n end\n\n unless params[:admin_profile][:profile_skills_attributes].blank?\n params[:admin_profile][:profile_skills_attributes].each do |skill|\n admin_skill = Admin::ProfileSkill.create({profile_id: @admin_profile.id, name: skill[1][:name], skill: skill[1][:skill]})\n admin_skill.save\n end\n end\n\n unless params[:admin_profile][:profile_hobbies_attributes].blank?\n params[:admin_profile][:profile_hobbies_attributes].each do |hobby|\n admin_hobby = Admin::ProfileHobby.create({profile_id: @admin_profile.id, name: hobby[1][:name]})\n admin_hobby.save\n end\n end\n\n format.html { redirect_to admin_root_path, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_profile }\n else\n format.html { render action: 'new'}\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_profile = PersonalProfile.new(personal_profile_params)\n @personal_profile.user_id=current_user.id\n respond_to do |format|\n if @personal_profile.save\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully created.' }\n format.json { render :show, status: :created, location: resume_path }\n else\n format.html { render :new }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:user_id, :forenames, :surnames, :email, :sex_id, :marital_status_id, :birth_date, :professional_title, :nationality_id, :country_id, :province_id, :district_id, :township_id, :address, :phone_number, :skills, :wage_aspiration, :presentation, :avatar, :skill_list,\n experiences_attributes: [\n :id, :company, :position, :professional_area_id, :starting_salary, :final_salary, :begin_date, :end_date, :job_description, :_destroy\n ],\n studies_attributes: [\n :id, :institution, :title, :education_level_id, :educative_area_id, :begin_year, :end_year, :finished, :_destroy\n ]\n )\n end",
"def profile_params\n params.require(:profile).permit(:user_id, :forenames, :surnames, :email, :sex_id, :marital_status_id, :birth_date, :professional_title, :nationality_id, :country_id, :province_id, :district_id, :township_id, :address, :phone_number, :skills, :wage_aspiration, :presentation, :avatar, :skill_list,\n experiences_attributes: [\n :id, :company, :position, :professional_area_id, :starting_salary, :final_salary, :begin_date, :end_date, :job_description, :_destroy\n ],\n studies_attributes: [\n :id, :institution, :title, :education_level_id, :educative_area_id, :begin_year, :end_year, :finished, :_destroy\n ]\n )\n end",
"def create\n @user_profile = UserProfile.new(user_profile_params) \n\n respond_to do |format| \n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:residence, :first_time, :expectancy,\n :agile_id, :agile_description,\n :hobbies, :bring, :proposal,\n :bio, :agileRelation_id,\n :gender_id, :size_id)\n end",
"def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n \n respond_to do |format|\n if @profile.save\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create!(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization_profile = OrganizationProfile.new(organization_profile_params)\n current_user.organization_account.organization_profiles << @organization_profile \n authorize @organization_profile\n respond_to do |format|\n if @organization_profile.save\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully created.' }\n format.json { render :show, status: :created, location: @organization_profile }\n else\n format.html { render :new }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @params = profile_params\n if @params[\"country\"]\n @params[\"country\"] = CS.get[profile_params[:country].to_sym]\n end\n if @params[\"state\"].size==2\n @states = CS.get profile_params[:country].to_sym\n @params[\"state\"] = @states[profile_params[:state].to_sym]\n end\n\n if current_user.profile #if Profile already exists\n @profile = current_user.profile\n @projects = @profile.projects\n if !params[\"edit-profile-languages\"].empty?\n @lan_array = JSON.parse(params[\"edit-profile-languages\"])\n @params[\"languages\"] = @lan_array\n end\n if [email protected]_photo.nil? & params[\"profile_photo\"].empty?\n @params[\"profile_photo\"] = @profile.profile_photo\n else\n @params[\"profile_photo\"] = params[\"profile_photo\"].empty? ? nil : params[\"profile_photo\"]\n end\n if [email protected]_photo.nil? & params[\"banner_photo\"].empty?\n @params[\"banner_photo\"] = @profile.banner_photo\n else\n @params[\"banner_photo\"] = params[\"banner_photo\"].empty? ? nil : params[\"banner_photo\"]\n end\n\n respond_to do |format|\n if @profile.update(@params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n else\n if(params[:first_signup] == \"true\")\n @user = current_user\n @profile = Profile.new() #create new Profile\n @user.profile = @profile\n @lan_array = JSON.parse(params[\"languages\"])\n @params[\"languages\"] = @lan_array\n coordinates = Geocoder.search(profile_params[:city]).first.coordinates\n latitude = coordinates[0]\n longitude = coordinates[1]\n @params[\"time_zone\"] = Timezone.lookup(latitude,longitude).name\n\n respond_to do |format|\n if @profile.update(@params)\n format.html { redirect_to '/profile/explores', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end\n end\nend",
"def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:name, :bio, :country_id, :picture, interest_ids: [])\n end",
"def university_params\n params.require(:university).permit(:universityid, :name, :f211, :f985, :area, :address, :phone, :email, :level, :membership, :nature, :schoolid, :schooltype, :website, :shoufei, :intro)\n end",
"def tutor_profile_params\n params.require(:tutor_profile).permit(:user_id, :university, :degree_subject, :teaching_subject, :location, :about_myself, :tutoring_approach, :teaching_experience, :extracurricular_interests, :image, :tutor_profile_id)\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @private_profile = PrivateProfile.new(params[:private_profile])\n\n respond_to do |format|\n if @private_profile.save\n format.html { redirect_to @private_profile, notice: 'Private profile was successfully created.' }\n format.json { render json: @private_profile, status: :created, location: @private_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @private_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end",
"def create\n @university = University.new(params[:university])\n \n respond_to do |format|\n if @university.save\n if params[:domain]\n params[:domain].each do |d|\n @email_domain = EmailDomain.new\n @email_domain.university_id = @university.id\n @email_domain.domain = d\n @email_domain.save\n end \n end\n \n if params[:alumni_url]\n params[:alumni_url].each do |d|\n @alt_path = AltPath.new\n @alt_path.university_id = @university.id\n @alt_path.alumni_url = d\n @alt_path.save\n end \n end\n \n flash[:notice] = 'University was successfully created.'\n format.html { redirect_to(universities_url) }\n format.xml { render :xml => @university, :status => :created, :location => @university }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @university.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n authorize @profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to quit_user_profile_path, notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end",
"def new\n @university = University.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @university }\n end\n end",
"def create\n @user_profile = UserProfile.new(user_profile_params)\n\n respond_to do |format|\n if @user_profile.save\n flash[:success] = 'User profile was successfully created.'\n format.html { redirect_to @user_profile}\n format.json { render :show, status: :created, location: @user_profile }\n else\n flash[:danger] = \"There are some mistakes, please try again\"\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def representative_profile_params\n params.require(:representative_profile).permit(:name, :office, :district, :term, :term_start, :bio, :profession, :party_affiliation, :official_email, :avatar, :district_id)\n end",
"def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:username, :address, :suburb, :postcode, :search_radius, :sex, :age, :interests, :user_id)\n end",
"def profile_params\n params.require(:profile).permit(\n :summary,\n :degree,\n :stream,\n :status,\n section_ids: [],\n project_ids: [],\n employment_ids:[],\n certification_ids: [],\n education_ids: [],\n custom_ids: []\n )\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:name, :nickname, :gender, :description, { experienced_language_ids: [] })\n end",
"def create\n @tutor_profile = TutorProfile.new(tutor_profile_params)\n @tutor_profile.user_id = current_user.id\n\n respond_to do |format|\n if @tutor_profile.save\n format.html { redirect_to @tutor_profile, notice: 'Tutor profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tutor_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @tutor_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def surgical_profile_params\n params.require(:surgical_profile).permit(\n :user_id, :patient_id, :patient_status, :elective_surgery,\n :principal_procedure, :cpt_code, :origin_status, :hospital_admission_date,\n :operation_date, :anesthesia_technique, :encounter_number\n )\n end",
"def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:is_director, :is_assistant, :is_phd, :is_msc, :is_bsc, :is_intern, :username, :current_position, :email2, :website, :linked_in, :research_gate, :google_scholar, :phD_education, :MSc_education, :BSc_education, :phD_alumnus, :MSc_alumnus, :BSc_alumnus, :phD_thesis, :phD_thesis_desc, :MSc_thesis, :MSc_thesis_desc, :BSc_thesis, :BSc_thesis_desc, :entrance_year, :graduation_year, :isAdmin, :intern_title, :intern_desc, :intern_year, :avatar, :user_id, :phD_entrance_year, :phD_graduation_year, :MSc_entrance_year, :MSc_graduation_year, :BSc_entrance_year, :BSc_graduation_year, :guest_entrance_year, :guest_graduation_year, :guest_alumnus)\n end",
"def create\n @github_profile = GithubProfile.new(github_profile_params)\n\n respond_to do |format|\n if @github_profile.save\n format.html { redirect_to @github_profile, notice: 'Github profile was successfully created.' }\n format.json { render :show, status: :created, location: @github_profile }\n else\n format.html { render :new }\n format.json { render json: @github_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization_profile = OrganizationProfile.new(params[:organization_profile])\n\n respond_to do |format|\n if @organization_profile.save\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully created.' }\n format.json { render json: @organization_profile, status: :created, location: @organization_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_profile = UserProfile.new(user_profile_params)\n @user_profile.user =current_user\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: \"User profile was successfully created.\" }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def profile_params\n params.require(:profile).permit(:religion,:gender,:city_of_birth,:country_of_birth,:state_of_birth,:income,:education_concentration,:interest,:is_manglik,:time_of_birth,:nakshatra,:marital_status,:diet,:smoke,:drink,:community,:education_level, :dob,:height,:feet, :inches,:phone_number,:mobile_number,:state,:city,:have_children, :about_me,:photo, :instagram, :facebook,:linkedin , :partner_preferences,:country_raised, :country,:values, :member_relationship,:occupation)\n end",
"def profile_params\n params.require(:profile).permit(:name, :countries_visited, :favourite_countries, :bucket_list, :travel_buddy)\n end",
"def create_user_params\n params.require(:data).permit(:email, :password, :password_confirmation, profile: %i[first_name last_name])\n end",
"def create\n @cleaners_profile = Cleaners::Profile.new(cleaners_profile_params)\n\n respond_to do |format|\n if @cleaners_profile.save\n format.html { redirect_to after_signup_path(:preference) }\n format.json { render action: 'show', status: :created, location: @cleaners_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @university_profile = UniversityProfile.find(params[:id])\n @university_profile.destroy\n \n respond_to do |format|\n format.html { redirect_to university_profiles_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.6690696",
"0.64980185",
"0.6478158",
"0.6445904",
"0.6445904",
"0.6445125",
"0.64365804",
"0.6431544",
"0.63678014",
"0.63593143",
"0.6352346",
"0.6352069",
"0.6275461",
"0.6266235",
"0.62626374",
"0.6231612",
"0.6195032",
"0.6195032",
"0.6173253",
"0.61378783",
"0.6126015",
"0.61239403",
"0.611451",
"0.61128706",
"0.6105623",
"0.6100653",
"0.6098855",
"0.6081782",
"0.6076028",
"0.6076028",
"0.6073159",
"0.6067661",
"0.6042578",
"0.60358775",
"0.6033701",
"0.6025739",
"0.6012961",
"0.60120153",
"0.6007014",
"0.6003028",
"0.5994961",
"0.5986468",
"0.5978171",
"0.5973146",
"0.5961625",
"0.59440535",
"0.5940055",
"0.59383965",
"0.59362596",
"0.59289616",
"0.59247637",
"0.59247637",
"0.59247637",
"0.59247637",
"0.59247637",
"0.59247637",
"0.59247637",
"0.59247637",
"0.5922237",
"0.5922166",
"0.5920894",
"0.5920894",
"0.5920894",
"0.5920894",
"0.5920894",
"0.5920894",
"0.5920894",
"0.59202975",
"0.59202975",
"0.5918516",
"0.5914194",
"0.59113014",
"0.5910545",
"0.59064734",
"0.59003735",
"0.5890175",
"0.58856326",
"0.58856326",
"0.58856326",
"0.58789784",
"0.58752227",
"0.5861482",
"0.5852415",
"0.5852415",
"0.584275",
"0.582769",
"0.5826997",
"0.5825629",
"0.58248097",
"0.581589",
"0.5814601",
"0.5813271",
"0.58101875",
"0.580836",
"0.5805689",
"0.580527",
"0.5804863",
"0.58015394",
"0.5800237",
"0.5787012"
] | 0.75853705 | 0 |
PUT /university_profiles/1 PUT /university_profiles/1.json | def update
@university_profile = UniversityProfile.find(params[:id])
respond_to do |format|
if @university_profile.update_attributes(params[:university_profile])
format.html { redirect_to @university_profile, notice: 'University profile was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @university_profile.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { respond_with_bip(@university) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@university) }\n end\n end\n end",
"def update\n @university = University.find(params[:id])\n\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @university = University.find(params[:id])\n\n respond_to do |format|\n if @university.update_attributes(params[:university])\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @university = University.find_or_initialize_by(name: university_params)\n if params[:payments] == \"delete\" and current_user.authorization_level == 'admin'\n @user.update(payments: [])\n end\n\n if @user.update(user_params.merge(university: @university.id))\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend",
"def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { render :show, status: :ok, location: @university }\n else\n format.html { render :edit }\n format.json { render json: @university.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n if @university_profile.save\n format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }\n format.json { render json: @university_profile, status: :created, location: @university_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_university\n @university = University.find(params[:id])\n @university_profiles = @university.university_profiles.paginate(:page => params[:page], :per_page => 10)\n end",
"def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend",
"def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\[email protected]_columns(profile_params)\n\t\trespond_with @profile \n\tend",
"def update\n @skill_user_profile = SkillUserProfile.find(params[:id])\n\n if @skill_user_profile.update(skill_user_profile_params)\n head :no_content\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end",
"def update_profile(params)\n post('/account/update_profile.json', params)\n end",
"def update_profile(params)\n post 'account/update_profile', :post => params\n end",
"def update\n\t\t# Updating the details according the that particular profile\n\t\[email protected]_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend",
"def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @university.update(university_params)\n @universities = University.all\n @university = University.new\n end",
"def update\n @profile.update(profile_params)\n respond_with(@profile)\n end",
"def update\n userprofile = Userprofile.find_by(\"id\" => params[\"id\"])\n userprofile.update(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end",
"def update\n respond_to do |format|\n if @tutor_profile.update(tutor_profile_params)\n format.html { redirect_to @tutor_profile, notice: 'Tutor profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tutor_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end",
"def update\n respond_to do |format|\n if @personal_profile.update(personal_profile_params)\n format.html { redirect_to resume_path, notice: 'Your Personal profile was successfully updated.' }\n format.json { render :show, status: :ok, location: resume_path }\n else\n format.html { render :edit }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n if @user_profile.update_attributes(params[:user_profile])\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @representative_profile.update(representative_profile_params)\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @representative_profile }\n else\n format.html { render :edit }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end",
"def update\n @organization_profile = OrganizationProfile.find(params[:id])\n\n respond_to do |format|\n if @organization_profile.update_attributes(params[:organization_profile])\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @surgical_profile.preprocess_and_update(surgical_profile_params)\n format.html { redirect_to patient_surgical_profile_path(@patient, @surgical_profile),\n notice: 'Surgical profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @surgical_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @university_profile = UniversityProfile.find(params[:id])\n @university_profile.destroy\n \n respond_to do |format|\n format.html { redirect_to university_profiles_url }\n format.json { head :no_content }\n end\n end",
"def set_university\n @university = University.find(params[:university_id])\n end",
"def show\n @university_profile = UniversityProfile.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @university_profile }\n end\n end",
"def set_university\n @university = University.find(params[:id])\n end",
"def set_university\n @university = University.find(params[:id])\n end",
"def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend",
"def set_university\n @university = University.find(params[:id])\n end",
"def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @university = University.find(params[:university_id])\n if @university.update(university_params)\n flash[:success] = 'Information updated!'\n redirect_to @university\n else\n render 'edit'\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile\n @profile = Profile.find(params[:id])\n @profile.update_attribute(:field_name,params[:field_name])\n @profile.update_attribute(:field_type,params[:field_type])\n redirect_to(\"/profiles/create_profile/#{@profile.structure_component_id}\")\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to profile_path, notice: \"Book was successfully updated.\" }\n format.json { render profile_path, status: :ok, location: @profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @upload.update(university_params)\n format.html { redirect_to @upload, notice: 'upload was successfully updated.' }\n format.json { render :show, status: :ok, location: @upload }\n else\n format.html { render :edit }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t# Updating the details according the that particular profile\n\t\tif @profile.update_attributes(speciality_name: params[:speciality_name],sub_speciality_name:params[:sub_speciality_name],:medical_school=>params[:medical_school],:residency=>params[:residency],:spe_training=>params[:spe_training],:my_favourite=>params[:my_favourite],:my_hobby=>params[:my_hobby],:more_about=>params[:more_about],:cover_image=>params[:cover_image],:profile_image=>params[:profile_image])\n\t\t# response to the JSON\n\t\t\trender json: { success: true,message: \"Profile Successfully Updated.\", response: ProfileSerializer.new(@profile).as_json(root: false) },:status=>200\n\t else\n\t render :json=> { success: false, message: @profile.errors },:status=> 203\n\t end\n\tend",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @organization_profile.update(organization_profile_params)\n authorize @organization_profile\n format.html { redirect_to @organization_profile, notice: 'Organization profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization_profile }\n else\n format.html { render :edit }\n format.json { render json: @organization_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_profile\n # login_as(:patrick)\n # put :update, :id => profiles(:profile_00006).id, :profile => { }\n # assert_redirected_to profile_path(assigns(:profile))\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to '/', notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @profile.update(profile_params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html do\n redirect_to @profile,\n notice: \"Profile was successfully updated.\"\n end\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @profile = Profile.find_by_user_id(current_user.id)\n authorize! :update, @profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @private_profile = PrivateProfile.find(params[:id])\n\n respond_to do |format|\n if @private_profile.update_attributes(params[:private_profile])\n format.html { redirect_to @private_profile, notice: 'Private profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @private_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n params = profile_params\r\n params.delete(\"id\")\r\n params.delete(\"user\")\r\n respond_to do |format|\r\n if @profile.update(params)\r\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profile }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n @profile.slug=nil\n if @profile.update(profile_params)\n @profile.user.cedula = @profile.cedula\n @profile.user.save\n ruta = @profile==current_user.profile ? my_profile_path : @profile\n format.html { redirect_to ruta, notice: 'El perfil fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: \"User profile was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @profile_attribute = current_user.profile_attributes.find(params[:id])\n\n respond_to do |format|\n if @profile_attribute.update_attributes(params[:profile_attribute])\n format.html { redirect_to(@profile_attribute, :notice => 'Profile attribute was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => {:profile_attribute => @profile_attribute} }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile_attribute.errors, :status => :unprocessable_entity }\n format.json { render :json => {:error => @profile_attribute.errors.full_messages} }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_url, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_profile.update(user_profile_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_profile }\n else\n format.html { render :edit }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end",
"def university_params\n params.require(:university).permit(\n :univ_name,\n university_profile_attributes:\n [\n :id, :classification, :description, :owner, :total_area_hectare, :total_area_meter, :acquisition, :titling_status, :date_issued, :tax_dec_no, :remarks, :titling_step_ein , :titling_step_zwei, :titling_step_drei, :titling_step_vier, :titling_step_funf, :titling_step_sechs, :titling_step_sieben, :titling_step_acht, :titling_step_neun, :titling_step_zehn, :_destroy\n ]\n )\n end"
] | [
"0.66502464",
"0.66496396",
"0.6640017",
"0.6640017",
"0.66112286",
"0.65614825",
"0.64841443",
"0.64750904",
"0.6467817",
"0.6464113",
"0.64370036",
"0.64363295",
"0.6420192",
"0.6406723",
"0.6373182",
"0.6362654",
"0.6348551",
"0.63437223",
"0.63220936",
"0.6296308",
"0.62951386",
"0.62828267",
"0.62683445",
"0.6258273",
"0.62564665",
"0.62564665",
"0.6250346",
"0.623712",
"0.61988026",
"0.61970276",
"0.61959416",
"0.61873615",
"0.6167413",
"0.6153474",
"0.6144508",
"0.61430204",
"0.61404014",
"0.6121355",
"0.61140645",
"0.61111665",
"0.61111665",
"0.6104366",
"0.6100488",
"0.6085075",
"0.6082514",
"0.6077316",
"0.6075158",
"0.60683763",
"0.60683763",
"0.60683763",
"0.60653204",
"0.605219",
"0.60486025",
"0.6047478",
"0.60418075",
"0.6038593",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6038189",
"0.6033356",
"0.6031234",
"0.6029651",
"0.6017319",
"0.6006815",
"0.59994566",
"0.5986093",
"0.5985948",
"0.5976187",
"0.59695554",
"0.59695554",
"0.59695554",
"0.59695554",
"0.59674054",
"0.5963977",
"0.5954656",
"0.5950414",
"0.59475917",
"0.5944875",
"0.5944243",
"0.5944188",
"0.59428996",
"0.5942776",
"0.5942234",
"0.59386015",
"0.59386015",
"0.59352875",
"0.59294856",
"0.5923445"
] | 0.74559146 | 0 |
DELETE /university_profiles/1 DELETE /university_profiles/1.json | def destroy
@university_profile = UniversityProfile.find(params[:id])
@university_profile.destroy
respond_to do |format|
format.html { redirect_to university_profiles_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_profile.destroy\n respond_to do |format|\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @profile = Profile.find(params[:id])\n # authorize! :destroy, @profile\n\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @representative_profile.destroy\n respond_to do |format|\n format.html { redirect_to representative_profiles_url, notice: 'Representative profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \[email protected]\n\n \trespond_to do |format|\n \t\tprofiles = Profile.all\n \t\tformat.json { render json: profiles}\n \tend\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor_profile.destroy\n respond_to do |format|\n format.html { redirect_to tutor_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Profile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = @user.profile\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(@user) }\n format.json { head :no_content }\n end\n #redirect_to user_path(@user)\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retailer_profile.destroy\n respond_to do |format|\n format.html { redirect_to retailer_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @university = University.find(params[:id])\n @university.destroy\n\n respond_to do |format|\n format.html { redirect_to universities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @university = University.find(params[:id])\n @university.destroy\n\n respond_to do |format|\n format.html { redirect_to universities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @profile.destroy\r\n respond_to do |format|\r\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @private_profile = PrivateProfile.find(params[:id])\n @private_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to private_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @surgical_profile.destroy\n respond_to do |format|\n format.html { redirect_to patient_surgical_profiles_path(@patient) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end",
"def destroy\n @userprofile.destroy\n respond_to do |format|\n format.html { redirect_to userprofiles_url, notice: 'Userprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n end",
"def destroy\n @admin_profile.destroy\n respond_to do |format|\n format.html { redirect_to admin_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile_personal_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_personal_details_url, notice: 'Profile personal detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.profile.destroy\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n respond_to do |format|\n format.html do\n redirect_to profiles_url, notice:\n \"Profile was successfully destroyed.\"\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_agent_profile = TravelAgentProfile.find(params[:id])\n @travel_agent_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_agent_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_profiles_url, notice: 'User profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile.destroy\n respond_with(@profile)\n end",
"def destroy\n authorize @profile\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: \"Profile: #{I18n.t('helpers.deleted')}\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n @profile.requests.destroy_all\n @profile.member.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'El perfil fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @user_profile\n @user_profile.destroy\n respond_to do |format|\n format.html { redirect_to user_profiles_url, notice: 'User profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_profile.destroy\n respond_to do |format|\n format.html { redirect_to project_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pay_profile = PayProfile.find(params[:id])\n @pay_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to pay_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile.destroy\n redirect_to '/'\n end",
"def destroy\n @organization_profile = OrganizationProfile.find(params[:id])\n @organization_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to organization_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @users_profile = Users::Profile.find(params[:id])\n @users_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_profiles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cleaners_profile.destroy\n respond_to do |format|\n format.html { redirect_to cleaners_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.73018855",
"0.73018855",
"0.72988856",
"0.7292494",
"0.72700727",
"0.7269712",
"0.7269712",
"0.72634286",
"0.72577834",
"0.7250551",
"0.72116023",
"0.72109306",
"0.72109306",
"0.72109306",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.7207924",
"0.72030926",
"0.71788716",
"0.717565",
"0.7166351",
"0.71624804",
"0.71089876",
"0.7107312",
"0.71012455",
"0.70994335",
"0.70829314",
"0.70807207",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.7074973",
"0.70747584",
"0.70691127",
"0.7049011",
"0.7035433",
"0.7027819",
"0.7020163",
"0.7020163",
"0.70048606",
"0.69984686",
"0.6998401",
"0.6992104",
"0.6990709",
"0.6990362",
"0.6989227",
"0.69814634",
"0.6974537",
"0.6973144",
"0.6971515",
"0.6969575",
"0.6969575",
"0.6969533",
"0.6968236",
"0.6960666",
"0.69534916",
"0.6951321",
"0.6949279",
"0.69463414",
"0.6932824",
"0.692318",
"0.6904721",
"0.6899469",
"0.689904",
"0.6898651",
"0.68985814",
"0.6894999",
"0.6884873",
"0.68800753",
"0.68658555",
"0.6863229"
] | 0.7634479 | 0 |
Build takes the array of instructions and adds them to the graph. | def build(insns, profile=nil)
# Find the basic blocks in the instructions.
blocks = basic_blocks(insns)
# Build each basic block into a graph fragment first.
fragments = {}
blocks.each do |ip, block|
fragments[block.start] = basic_block_to_fragment(block.insns, ip, profile)
end
# Create more detailed, transitive, input and output names and stacks for each fragment.
trans_names_in = {}
trans_stack_in = {}
trans_names_out = {}
trans_stack_out = {}
blocks.each_value do |block|
fragment = fragments[block.start]
block_trans_names_in = {}
block_trans_stack_in = []
# Combine the names and stack values that come in from previous blocks.
if block.prev.size == 1
# If the block has a single previous block, simply use all the names
# and stack values out from that block.
prev = block.prev.first
block_trans_names_in.merge! trans_names_out[prev]
block_trans_stack_in.push *trans_stack_out[prev]
elsif block.prev.size > 1
# If the block has multiple previous blocks then we could have
# arrived at this basic block from either of them. That means that
# values coming in for names or the stack. For each value that
# comes in we join all the possible values in a phi node. The phi
# node works as a switch to choose the correct value. It takes
# input from the merge which starts this block, to tell it
# which way to switch.
# Find all the names out from all the previous blocks.
all_names_out = block.prev.map { |p| trans_names_out[p].keys }.flatten.uniq.sort
# See the number of stack values out from all the previous blocks.
max_stack_out = block.prev.map { |p| trans_stack_out[p].size }.max
# If all blocks don't have the same names and number of stack values we don't know what to do.
block.prev.each do |prev|
raise 'unsupported' unless trans_names_out[prev].keys.sort == all_names_out
raise 'unsupported' unless trans_stack_out[prev].size == max_stack_out
end
# Create phis for each value
all_names_out.each do |name|
phi = Node.new(:phi)
fragment.merge.output_to :switch, phi
block.prev.each do |prev|
trans_names_out[prev][name].output_to :value, phi, :"value(#{prev})"
end
block_trans_names_in[name] = phi
end
max_stack_out.times do |index|
phi = Node.new(:phi)
fragment.merge.output_to :switch, phi
block.prev.each do |prev|
trans_stack_out[prev][index].output_to :value, phi, :"value(#{prev})"
end
block_trans_stack_in.push phi
end
end
# The output set is the same as the input set...
block_trans_names_out = block_trans_names_in.dup
block_trans_stack_out = block_trans_stack_in.dup
# ...then add the new names and stack values from this fragment.
fragment.names_out.each do |name, value|
block_trans_names_out[name] = value
end
fragment.stack_out.each do |value|
block_trans_stack_out.push value
end
# Remember this transitive set for this block.
trans_names_in[block.start] = block_trans_names_in
trans_stack_in[block.start] = block_trans_stack_in
trans_names_out[block.start] = block_trans_names_out
trans_stack_out[block.start] = block_trans_stack_out
end
# Connect the data flow between fragments, using the transitive sets.
blocks.each_value do |block|
fragment = fragments[block.start]
fragment.names_in.each do |name, input|
trans_names_in[block.start][name].output_to :value, input
end
fragment.stack_in.each_with_index do |input, index|
trans_stack_in[block.start][index].output_to :value, input
end
end
# Connect the control flow between fragments.
blocks.each_value do |block|
fragment = fragments[block.start]
if block.prev.empty?
# If the block has no previous blocks, connect the start of the
# graph to it.
@graph.start.output_to :control, fragment.merge
end
if block.next.empty?
# If the block has no next blocks, connect it to the finish of
# the graph.
fragment.last_control.output_to :control, @graph.finish
fragment.last_node.output_to :value, @graph.finish
elsif block.next.size == 1
# If the block has a single next block, connect the last control
# node of this block to the merge node of the next block.
next_i = block.next.first
next_fragment = fragments[next_i]
fragment.last_control.output_to :control, next_fragment.merge, :"control(#{block.start})"
elsif fragment.last_control.op == :branch
# If the block ends with a branch then it goes to two possible next
# blocks. The branch node outputs two control edges, one labelled
# true and one labelled false. This is the only place where control
# forks like this.
raise unless block.next.size == 2
branch = fragment.last_control
branch.output_to :true, fragments[block.next[0]].merge, :control
branch.output_to :false, fragments[block.next[1]].merge, :control
else
raise 'unsupported'
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push\n @instructions << Instruction.new(:push)\n self\n end",
"def add_instruction(*parts)\n @program.add Verneuil::Instruction.new(*parts)\n end",
"def build_graph\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @matrix[x][y] = possible_moves(move)\n end\n end\n\tend",
"def cfg\n CFG.build @instructions\n end",
"def build\n GraphUtilities.alternation(@left.build, @right.build)\n end",
"def add i\n if i.kind_of? Array\n @instructions.concat i\n elsif i.kind_of? String\n @instructions.concat i.split\n end\n end",
"def build\n raise \"Nodes must implement #build\"\n end",
"def build_graph\n \n RDF::Graph.load(@options.file).each do |statement|\n subject = statement.subject\n predicate = statement.predicate\n object = statement.object\n \n edge(predicate,node(subject),node(object))\n end\n end",
"def build_just(file, &instructions)\n\t$build.instructions << BuildInstruction.new(16, file.to_s)\n\tbuild(&instructions)\nend",
"def instructions(lines)\n lines.map do |l|\n parts = l.split(\" \")\n inst = []\n inst[INST_COMMAND] = parts[0]\n inst[INST_VALUE] = parts[1].to_i\n inst[INST_VISITED] = false\n\n inst\n end\nend",
"def initialize(instructions)\n\t\t@operands = Array.new\n\t\t@operators = Array.new\n\t\t@errors = Array.new\n\t\t@instructions = instructions\n\tend",
"def run (path = \"progfile.dat\")\n find_instructions\n find_labels\n\n @input.each do |line|\n if (line.instruction?) || (line.comment?)\n parse_input(line)\n @instruction = nil\n # If it's a comment -> show but not work with it\n if line.instruction?\n \n exists_instruction?\n parse_label\n argument_size?\n argument_syntax?\n\n @instruction.set_arguments(@cmd[:arguments])\n @output << @instruction.code\n end\n show(@output.size-1) if @debug\n end\n @line += 1\n end\n generate(path)\n end",
"def run\n @to_exec.each do |args|\n @instructions[args[0]][1].call args[1]\n end\n end",
"def build( condition_sets )\n @set_of_graphs.clear\n\n # Do the heavy lifting\n optimal_graph = self.permutate_graphs( condition_sets ).find_optimal\n\n # Recover the memory associated with creating the optimal graph\n @set_of_graphs.clear\n\n optimal_graph\n end",
"def build(operators, scope)\n to_sexp(operators, scope)\n end",
"def on_program(nodes)\n nodes = [nodes] unless nodes.is_a?(Array)\n\n return Node.new(:root, nodes, :line => 1, :column => 0, :file => @file)\n end",
"def compile(filename)\n # First pass - define labels\n elements.each do |codeline|\n codeline.register_labels\n @@position += codeline.size\n end\n\n # Second pass - write to binary file\n File.open(filename, 'wb') do |f|\n elements.each do |codeline|\n f.write codeline.to_bin\n end\n end\n end",
"def build\n raise ConfigurationError.new(\"Must specify working directory\") unless @working_dir\n raise ConfigurationError.new(\"Must specify which sources to wrap\") unless @parser\n\n Logger.info \"Beginning code generation\"\n\n @builder = Builders::ExtensionNode.new(@name, @node || @parser, @modules)\n @builder.add_includes @options[:includes]\n @builder.build\n @builder.sort\n\n Logger.info \"Code generation complete\"\n end",
"def buildChain chain # chain is an array\n chain.each do |link|\n addLink link, self\n end\n end",
"def initialize\n @graph_command = []\n end",
"def instr_BUILD(instruction_stack)\n\t\targ = @stack.pop\n\t\[email protected][\"__state\"] = arg\n\tend",
"def build\n nodes << element_klass.new\n\n yield(nodes.last) if block_given?\n\n nodes.last\n end",
"def run\n ip = 0\n while ip < @instructions.length\n op = Opcode.find_by_ord(@instructions[ip])\n\n case op\n when Opcode::CONSTANT\n const_index = read_uint16(@instructions[ip + 1...ip + 3])\n ip += 2\n push(@constants[const_index])\n when Opcode::TRUE\n push(TRUE)\n when Opcode::FALSE\n push(FALSE)\n when Opcode::ADD, Opcode::SUB, Opcode::MUL, Opcode::DIV\n execute_binary_operation(op)\n when Opcode::POP\n pop\n end\n\n ip += 1\n end\n end",
"def build(entry, flowfacts, opts = { :mbb_variables => false })\n assert(\"IPETBuilder#build called twice\") { ! @entry }\n @entry = entry\n @markers = {}\n @call_edges = []\n\n # build refinement to prune infeasible blocks and calls\n build_refinement(@entry, flowfacts)\n\n # compute set of reachable machine functions\n # during traversal, add ILP variables for both machine code and bitcode\n mf_functions = reachable_set(@entry['machinecode']) do |mf_function|\n\n # inspect callsites in the current function\n succs = Set.new\n mf_function.callsites.each { |cs|\n next if @mc_model.infeasible?(cs.block)\n @mc_model.calltargets(cs).each { |f|\n assert(\"calltargets(cs) is nil\") { ! f.nil? }\n succs.add(f)\n }\n }\n\n # machinecode variables + cost\n @mc_model.each_edge(mf_function) do |edge|\n @ilp.add_variable(edge, :machinecode)\n\tif not @options.ignore_instruction_timing\n\t cost = yield edge\n\t @ilp.add_cost(edge, cost)\n\tend\n end\n\n # bitcode variables and markers\n if @bc_model\n add_bitcode_variables(mf_function)\n end\n succs # return successors to reachable_set\n end\n mf_function_callers = {}\n mf_functions.each do |f|\n add_bitcode_constraints(f) if @bc_model\n f.blocks.each_with_index do |block,ix|\n next if block.predecessors.empty? && ix != 0 # exclude data blocks (for e.g. ARM)\n if @mc_model.infeasible?(block)\n @mc_model.add_infeasible_block_constraint(block)\n next\n end\n @mc_model.add_block_constraint(block)\n if opts[:mbb_variables]\n @mc_model.add_block(block)\n end\n block.callsites.each do |cs|\n current_call_edges = @mc_model.add_callsite(cs, @mc_model.calltargets(cs))\n current_call_edges.each do |ce|\n (mf_function_callers[ce.target] ||= []).push(ce)\n end\n @call_edges += current_call_edges\n end\n end\n end\n @mc_model.add_entry_constraint(@entry['machinecode'])\n mf_function_callers.each do |f,ces|\n @mc_model.add_function_constraint(f, ces)\n end\n flowfacts.each { |ff|\n debug(@options,:ipet) { \"adding flowfact #{ff}\" }\n add_flowfact(ff)\n }\n end",
"def build\n Automaton.new(@name, @dimensions, @type, @width, @rule)\n end",
"def build(*nodes, attributes: {}, infos: nil, recursive: true)\n\t\t\tnodes.each do |node|\n\t\t\t\tcase node\n\t\t\t\twhen Hash\n\t\t\t\t\tnode.each do |name,children|\n\t\t\t\t\t\tadd_node(name,children: [*children], attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadd_node(node, attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\tend\n\t\t\tend\n\t\t\tself\n\t\tend",
"def build_network()\r\n @layers = []\r\n # Create the hidden layers, num_per_hiddenX(num_inputs+1) matrices.\r\n # The +1 accounts for a bias vector that is horizontally concatenated\r\n # upon creation of the layer.\r\n @num_hidden_layers.times do\r\n # Add a new layer (bias vector is concatenated in the creation\r\n # method).\r\n @layers << build_layer(@max_weight, @num_per_hidden, @num_inputs)\r\n end\r\n # Create output layer, an num_outputsX(num_per_hidden+1) matrix\r\n # (again, +1 accounts for the bias).\r\n @layers << build_layer(@max_weight, @num_outputs, @num_per_hidden)\r\n # Calculate weights\r\n weights # produces attribute @weights upon first invocation\r\n @num_weights = @weights.size\r\n end",
"def build(words)\n words.each do |word|\n self.add(word)\n end\n end",
"def build\n unpack_chars(Marshal.dump(@command))\n end",
"def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend",
"def build()\n HP.logger.debug(\"~ Build Mode: #{build_mode}\")\n HP.logger.debug(\"~ Source Root: #{source_root}\")\n HP.logger.debug(\"~ Build Root: #{build_root}\")\n build_entries(entries())\n end",
"def build\n [ Sox::SOX_COMMAND,\n build_options(@options),\n build_input_files,\n build_file(@output_file),\n build_effects\n ].flatten.join(' ')\n end",
"def parse(input_file, label_count)\n output = []\n\n input_file.each_line do |line|\n next if line.match(/\\/\\/.*/) \n\n if match = line.match(/push (?<segment>.+) (?<index>.+)/)\n push_constant_asm = %{\n @%s\n D=A\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n push_relative_asm = %{\n @%s\n D=A\n @%s\n A=D+M\n D=M\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n push_pointer_asm = %{\n @%s\n D=A\n @L#{label_count}\n D;JEQ\n @THAT\n D=M\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n @THIS\n D=M\n (L#{label_count + 1})\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n push_indirect_asm = %{\n @%s\n D=A\n @%s\n A=D+A\n D=M\n @SP\n A=M\n M=D\n @SP\n M=M+1\n }\n case match[:segment] \n when \"constant\"\n output << (push_constant_asm % match[:index].strip).split\n when \"local\"\n output << (push_relative_asm % [match[:index].strip, \"LCL\"]).split\n when \"argument\"\n output << (push_relative_asm % [match[:index].strip, \"ARG\"]).split\n when \"this\"\n output << (push_relative_asm % [match[:index].strip, \"THIS\"]).split\n when \"that\"\n output << (push_relative_asm % [match[:index].strip, \"THAT\"]).split\n when \"pointer\"\n output << (push_pointer_asm % match[:index].strip).split\n label_count = label_count + 2\n when \"temp\"\n output << (push_indirect_asm % [match[:index].strip, \"R5\"]).split\n when \"static\"\n output << (push_indirect_asm % [match[:index].strip, \"16\"]).split\n end\n end\n\n pop_relative_asm = %{\n @%s\n D=M\n @%s\n D=D+A\n @R13\n M=D\n @SP\n AM=M-1\n D=M\n @R13\n A=M\n M=D\n }\n pop_pointer_asm = %{\n @%s\n D=A\n @L#{label_count}\n D;JEQ\n @THAT\n D=A\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n @THIS\n D=A\n (L#{label_count + 1})\n @R13\n M=D\n @SP\n AM=M-1\n D=M\n @R13\n A=M\n M=D\n }\n pop_indirect_asm = %{\n @%s\n D=A\n @%s\n D=D+A\n @R13\n M=D\n @SP\n AM=M-1\n D=M\n @R13\n A=M\n M=D\n }\n if match = line.match(/pop (?<segment>.+) (?<index>.+)/)\n case match[:segment] \n when \"local\"\n output << (pop_relative_asm % [\"LCL\", match[:index].strip]).split\n when \"argument\"\n output << (pop_relative_asm % [\"ARG\", match[:index].strip]).split\n when \"this\"\n output << (pop_relative_asm % [\"THIS\", match[:index].strip]).split\n when \"that\"\n output << (pop_relative_asm % [\"THAT\", match[:index].strip]).split\n when \"pointer\"\n output << (pop_pointer_asm % match[:index].strip).split\n label_count = label_count + 2\n when \"temp\"\n output << (pop_indirect_asm % [match[:index].strip, \"R5\"]).split\n when \"static\"\n output << (pop_indirect_asm % [match[:index].strip, \"16\"]).split\n end\n end\n\n math_asm = %{\n @SP\n D=M\n AM=D-1\n D=M\n A=A-1\n M=M%sD\n }\n output << (math_asm % \"+\").split if line.match(/add/)\n output << (math_asm % \"-\").split if line.match(/sub/)\n\n binary_logic_asm = %{\n @SP\n D=M\n AM=D-1\n D=M\n A=A-1\n M=D%sM\n }\n output << (binary_logic_asm % \"|\").split if line.match(/or/)\n output << (binary_logic_asm % \"&\").split if line.match(/and/)\n\n unary_logic_asm = %{\n @SP\n A=M-1\n D=M\n M=%sD\n }\n output << (unary_logic_asm % \"-\").split if line.match(/neg/)\n output << (unary_logic_asm % \"!\").split if line.match(/not/)\n\n comp_asm = %{\n @SP\n AM=M-1\n D=M\n A=A-1\n D=M-D\n @L#{label_count}\n D;%s\n D=0\n @L#{label_count + 1}\n 0;JMP\n (L#{label_count})\n D=-1\n (L#{label_count + 1})\n @SP\n A=M-1\n M=D\n }\n if line.match(/eq/)\n output << (comp_asm % \"JEQ\").split\n label_count = label_count + 2\n end\n if line.match(/gt/)\n output << (comp_asm % \"JGT\").split\n label_count = label_count + 2\n end\n if line.match(/lt/)\n output << (comp_asm % \"JLT\").split\n label_count = label_count + 2\n end\n end\n return [output, label_count]\nend",
"def build\n nodes = []\n chars = []\n\n expression.each_char do |character|\n\n if '(' == character\n\n chars << character\n\n elsif /\\d+/.match(character)\n\n nodes.push Tree.new(character.to_i)\n\n elsif operands.include?(character)\n\n while(chars.any? && chars.last != '(')\n t = Tree.new(chars.pop)\n t.right = nodes.pop\n t.left = nodes.pop\n nodes << t\n end\n\n chars << Operation::OPERATIONS[character].new\n\n elsif ')' == character\n\n while(chars.any? && chars.last != '(')\n t = Tree.new(chars.pop)\n t.right = nodes.pop\n t.left = nodes.pop\n nodes << t\n end\n\n chars.pop\n\n end\n\n end\n\n unless nodes.empty? && chars.empty?\n self.root = Tree.new(chars.pop)\n root.right = nodes.pop\n root.left = nodes.pop\n end\n\n raise \"Ka-Blam! You still have nodes and/or chars\" if nodes.any? || chars.any?\n\n root\n end",
"def instructions\n @instructions ||= InstructionCollection.new(self)\n end",
"def build\n\t\t\tfifo_q = Array.new\n\t\n\t\t\t# Set the failures for the nodes coming out of the root node.\n\t\t\[email protected]_pair do |item, node|\n\t\t\t\tnode.failure = @root\n\t\t\t\tfifo_q.push node\n\t\t\tend\n\n\t\t\t# Set the failures in breadth-first search order\n\t\t\t# using a FIFO queue. A failure identifies the deepest node\n\t\t\t# that is a proper suffix of the current node. \n\t\t\twhile !fifo_q.empty?\n\t\t\t\tp_node = fifo_q.shift\n\t\t\t\tif p_node.get\n\t\t\t\t\tp_node.get.each_pair do |item, node|\n\t\t\t\t\t\t# Push the current node onto the queue, so any child\n\t\t\t\t\t\t# nodes can be processed later.\n\t\t\t\t\t\tfifo_q.push node \n\t\t\t\t\t\n\t\t\t\t\t\tf_node = p_node.failure\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Follow the failures until we find a goto transition\n\t\t\t\t\t\t# or arrive back at the root node\n\t\t\t\t\t\twhile f_node.goto(item) == nil and !f_node.eql? @root\n\t\t\t\t\t\t\tf_node = f_node.failure\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif f_node.eql? @root and f_node.goto(item) == nil\n\t\t\t\t\t\t\tnode.failure = @root\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnode.failure = f_node.goto(item)\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\tnode.output = yield node.output, (node.failure).output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif node.output && (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = node.output + (node.failure).output\n\t\t\t\t\t\t\t\telsif (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = (node.failure).output\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tbuild_dfa if @type == :DFA\n\n\t\tend",
"def instructions\n \n end",
"def call\n instructions.each do |instruction|\n rover.execute_instruction(instruction)\n end\n end",
"def make_graph(all_dependencies)\n graph = RGL::DirectedAdjacencyGraph.new\n all_dependencies.each do |source, targets|\n if targets.empty?\n graph.add_vertex(source)\n else\n targets.each { |target| graph.add_edge(source, target) }\n end\n end\n graph\n end",
"def build\n from_branches + from_tags + from_refs\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def build_nodes!\n @nodes.sort_by(&:key).each { |node| add_node(@graph, node) }\n end",
"def build_tree(array)\n tree = TreeNode.new(array[0], 0)\n (1..array.length-1).each {|i|\n insert_into_tree(tree, array[i], i)\n }\n tree\nend",
"def initialize(arry = [])\n @base = arry.collect{|el| el } # poor man's clone\n @tree_hash = run_layers\n end",
"def linearize(graph)\n # The basic blocks.\n blocks = []\n \n # Details of the basic block that contain the finish operation which\n # won't be added to the list of basic blocks until the end.\n first_node_last_block = nil\n last_block = nil\n \n # Two maps that help us map between nodes and the names of the blocks\n # that they go into, and the merge instruction indicies and the blocks\n # they're coming from.\n first_node_to_block_index = {}\n merge_index_to_first_node = {}\n\n # Look at each node that begins a basic block.\n\n basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }\n\n last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first\n\n basic_block_starters.delete last_basic_block_starter\n basic_block_starters.push last_basic_block_starter\n\n basic_block_starters.each do |node|\n original_first_node = node\n first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))\n\n # We're going to create an array of operations for this basic\n # block.\n\n block = []\n next_to_last_control = nil\n\n # Follow the local sequence.\n\n node = first_node\n\n begin\n # We don't want to include operations that are just there to form\n # branches or anchor points in the graph such as start and merge.\n\n unless [:start, :merge].include?(node.op)\n op = node.op\n\n # We rename finish to return to match the switch from the\n # declarative style of the graph to the imperative style\n # of the list of operations.\n op = :return if op == :finish\n\n # The instruction begins with the operation.\n insn = [op]\n\n # Then any constant values or similar.\n [:line, :n, :value].each do |p|\n insn.push node.props[p] if node.props.has_key?(p)\n end\n\n # Then any input registers.\n node.inputs.with_input_name(:value).from_nodes.each do |input_values|\n insn.push input_values.props[:register]\n end\n\n # Phi instructions need pairs of source registers with the blocks they came from.\n if node.op == :phi\n node.inputs.edges.each do |input|\n if input.input_name =~ /^value\\((.+)\\)$/\n n = $1.to_i\n insn.push n\n insn.push input.from.props[:register]\n end\n end\n # Elide phi instructions if register allocation has run correctly and values are\n # already in the correct registers.\n insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1\n end\n\n # Send instructions and lowered equivalents need the arguments.\n if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n if node.op == :send\n insn.push node.props[:name]\n elsif node.op == :call_managed\n insn.push node.inputs.with_input_name(:name).from_node.props[:register]\n end\n\n node.props[:argc].times do |n|\n arg = node.inputs.with_input_name(:\"arg(#{n})\").from_node\n\n if arg.op == :immediate\n insn.push arg.props[:value]\n else\n insn.push arg.props[:register]\n end\n end\n end\n\n # Then the target register if the instruction has one.\n insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)\n\n # If it's a branch then the target basic blocks and the test.\n if node.op == :branch\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n\n [:true, :false].each do |branch|\n target = node.outputs.with_output_name(branch).to_node\n raise unless target\n insn.push target\n end\n\n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Send instructions and lowered managed calls need the list of live registers.\n if [:send, :call_managed].include?(node.op)\n insn.push node.props[:live_registers]\n end\n \n # Guards are like branches, but only have one side.\n if node.op == :guard\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n \n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Kind instructions need the kind.\n if node.op == :kind_is?\n insn.push node.props[:kind]\n end\n \n # Frame states need the instructions, the ip, and to know where values are for\n # the receiver, the arguments, and the stack.\n if node.op == :deopt_map\n insn.push node.props[:insns]\n insn.push node.props[:ip]\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|\n /arg\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|\n /stack\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n end\n\n # Add the instruction to the block.\n block.push insn if insn\n end\n\n next_to_last_control = node if node.has_control_output?\n\n # Follow the local schedule edge to the next node.\n node = node.outputs.with_output_name(:local_schedule).to_nodes.first\n end while node && node.op != :merge\n\n # Empty blocks cause problems elsewhere - it's easier to just have a nop\n # in them. Really, we should remove empty blocks by modifying the\n # instruction that jumps here to jump to wherever this leads to.\n\n if block.empty?\n block.push [:nop]\n end\n\n # If the last node is a merge, we need to remember which merge index this is.\n\n if node && node.op == :merge\n next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\\((.+)\\)$/\n n = $1.to_i\n merge_index_to_first_node[n] = first_node\n end\n\n # Add a jump instruction if this block was going to just flow into the next\n # - we'll remove it later if the block followed it anyway and we can just\n # fallthrough.\n\n unless [:return, :branch].include?(block.last.first)\n begin\n block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]\n rescue\n block.push [:jump, :broken]\n end\n end\n\n first_node_to_block_index[original_first_node] = blocks.size\n first_node_to_block_index[first_node] = blocks.size\n blocks.push block\n end\n\n # Record the number that this basic block has and then add it to the list of basic blocks.\n\n first_node_to_block_index[first_node_last_block] = blocks.size\n\n # Go back through the basic blocks and update some references that were to things that\n # hadn't been decided yet.\n\n blocks.each do |block|\n block.each do |insn|\n insn.map! do |e|\n # If part of an instruction references a basic block, turn that into the index of\n # the basic block instead.\n\n if e.is_a?(IR::Node)\n :\"block#{first_node_to_block_index[e]}\"\n else\n e\n end\n end\n end\n end\n\n # Go back through the basic blocks and change how the branch instructions out of them\n # work.\n\n blocks.each_with_index do |block, n|\n next_block = :\"block#{n + 1}\"\n last = block.last\n\n if last == [:jump, next_block]\n # A jump that just goes to the next block can be removed and left to fall through.\n block.pop\n elsif last.first == :branch && last[3] == next_block\n # A branch where the else goes to the next block can branch only when true.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n elsif last.first == :branch && last[2] == next_block\n # A branch where the if goes to the next block can branch only unless true.\n block.pop\n test = last.drop(4)\n block.push [:branch_unless, last[1], last[3], *test]\n elsif last.first == :branch\n # A branch that doesn't go to the next block at all can be a branch if true\n # and then fallthrough to a new jump instruction.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n block.push [:jump, last[3]]\n end\n end\n\n blocks\n end",
"def build(params); end",
"def instructions=(instructions)\n self.remove_children :instructions\n if instructions\n self << (i = XMPPNode.new(:instructions, self.document))\n i.namespace = self.namespace\n i.content = instructions\n end\n end",
"def build_node(*args)\n node_class.new(*args)\n end",
"def build_tree array\n\t\t@root = Node.new array[0]\n\t\t@nodes += 1\n\t\tarray[1..-1].each do |var|\n\t\t\tinsert(@root,var)\n\t\tend\n\tend",
"def add(x, y, z)\n#\tx + y + z\n\tbuild = Array.new\n\tbuild << x << y << z\nend",
"def initialize(*nodes, attributes: {}, infos: nil)\n\t\t\t@nodes=[]\n\t\t\t# a node can be a Hash or a Node\n\t\t\t# so nodes really is a list of subgraphs\n\t\t\tbuild(*nodes, attributes: attributes, infos: infos)\n\t\tend",
"def get_instructions(source)\n elements = get_elements(source)\n text = \"\"\n instructions = Array.new\n elements.each do |child|\n if child[:tag]!=\"text\"\n text << \"Add the tag \" + child[:tag]\n text << \" in \" + child[:parent] if !child[:parent].nil?\n text << \" with an attribute '\" + child[:attribute] + \"' \" if !child[:attribute].nil?\n text << \" with value '\" + child[:value] + \"' \" if !child[:value].nil?\n else\n text << \" In \" + child[:parent]+ \" add the text '\" + child[:content] + \"' \" if !child[:content].nil?\n end\n instructions.push(text)\n text = \"\"\n end\n instructions\n end",
"def push(n)\n\t\[email protected] n\n\tend",
"def build(**)\n raise NotImplementedError\n end",
"def build\r\n end",
"def build\r\n end",
"def parse(text)\n lines = text.lines\n\n header = eval(lines.shift)\n required, post, total, locals = header\n opt = total - required\n\n raise 'optional arguments not supported' unless opt == 0\n raise 'post arguments not supported' unless post == 0\n\n insns = []\n labels = {}\n\n # Explicitly load arguments into locals.\n\n locals.each_with_index do |name, n|\n insns.push [:arg, n]\n insns.push [:store, name]\n end\n\n # Translate each instruction.\n\n lines.each do |line|\n index = insns.size\n\n case line\n when /(\\d+):\\s+push_self/\n insns.push [:self]\n when /(\\d+):\\s+push_local\\s+(\\d+)\\s+#.*/\n insns.push [:load, locals[$2.to_i]]\n when /(\\d+):\\s+push_int\\s+(\\d+)/\n insns.push [:push, $2.to_i]\n when /(\\d+):\\s+send_stack\\s+:([\\w\\+\\-<]+),\\s+(\\d+)/\n insns.push [:send, $2.to_sym, $3.to_i]\n when /(\\d+):\\s+goto\\s+(\\d+):/\n insns.push [:jump, $2.to_i]\n when /(\\d+):\\s+goto_if_false\\s+(\\d+):/\n insns.push [:not]\n insns.push [:branch, $2.to_i]\n when /(\\d+):\\s+ret/\n insns.push [:return]\n when /(\\d+):\\s+allow_private/\n else\n raise 'unknown instruction'\n end\n\n # Remember that the Rubinius byte offset of this instruction was at this index in our array of instructions.\n\n labels[$1.to_i] = index\n end\n\n # Go back and modify branch targets - we didn't know offsets for forward jumps on the first pass.\n\n insns.each do |insn|\n if [:jump, :branch].include?(insn.first)\n insn[1] = labels[insn[1]]\n end\n end\n\n insns\n end",
"def initialize\n\t\t@operands = []\n\tend",
"def on(instruction, arguments, &bloc)\n @instructions[instruction] = [arguments, bloc]\n end",
"def build\n end",
"def writePushPop(command, segment, index)\n assembly_builder = []\n # Push\n if command == 'C_PUSH'\n if segment == 'constant'\n assembly_builder.push(\n \"@#{index}\",\n 'D=A',\n '@SP',\n 'A=M',\n 'M=D',\n '@SP',\n 'M=M+1'\n )\n elsif segment == 'temp'\n assembly_builder.push(\n \"@#{5 + index.to_i}\", # A = 10\n 'D=M', # D = M[10]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 258\n 'M=D', # M[258] = D\n '@SP', # A = 0\n 'M=M+1' # M[0] = 258 + 1\n )\n elsif segment == 'pointer'\n assembly_builder.push(\n \"@#{3 + index.to_i}\", # A = 10\n 'D=M', # D = M[10]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 258\n 'M=D', # M[258] = D\n '@SP', # A = 0\n 'M=M+1' # M[0] = 258 + 1\n )\n elsif segment == 'static'\n assembly_builder.push(\n \"@#{file_name_without_ext}.#{index}\", # A = 10\n 'D=M', # D = M[10]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 258\n 'M=D', # M[258] = D\n '@SP', # A = 0\n 'M=M+1' # M[0] = 258 + 1\n )\n else\n segment_symbol = case segment\n when 'local'\n 'LCL'\n when 'argument'\n 'ARG'\n when 'this'\n 'THIS'\n when 'that'\n 'THAT'\n end\n\n assembly_builder.push(\n \"@#{index}\",\n 'D=A',\n \"@#{segment_symbol}\", # A = THAT = 4\n 'A=M',\n 'A=A+D', # A = 3010 + 5\n 'D=M', # D = M[3015]\n '@SP', # A = 0\n 'A=M', # A = M[0] = 257\n 'M=D', # M[257] = D = M[3015]\n '@SP', # A = 0\n 'M=M+1' # M[0] = 257 + 1\n )\n end\n # Pop\n elsif command == 'C_POP'\n if segment == 'temp'\n assembly_builder.push(\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1\n 'D=M', # D = M[257]\n \"@#{5 + index.to_i}\", # A = 5 + index\n 'M=D'\n )\n elsif segment == 'pointer'\n assembly_builder.push(\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1\n 'D=M', # D = M[257]\n \"@#{3 + index.to_i}\", # A = 5 + index\n 'M=D'\n )\n elsif segment == 'static'\n assembly_builder.push(\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1, M[0] = M[0] - 1\n 'D=M', # D = M[257]\n \"@#{file_name_without_ext}.#{index}\", # A = 6 + index\n 'M=D'\n )\n else\n segment_symbol = case segment\n when 'local'\n 'LCL'\n when 'argument'\n 'ARG'\n when 'this'\n 'THIS'\n when 'that'\n 'THAT'\n end\n\n assembly_builder.push(\n # RAM[RAM[SP]] -> RAM[RAM[segment]]\n \"@#{index}\", # A = 3\n 'D=A', # D = 3\n \"@#{segment_symbol}\", # A = 1\n 'D=M+D', # D = M[1] + 3 = 300 + 3\n 'M=D', # M[1] = 303\n '@SP', # A = 0\n 'AM=M-1', # A = M[0] - 1 = 258 -1\n 'D=M', # D = M[257]\n \"@#{segment_symbol}\", # A = 1\n 'A=M', # A = M[1] = 303\n 'M=D', # M[303] = M[257]\n \"@#{index}\", # A = 3\n 'D=A', # D = 3\n \"@#{segment_symbol}\", # A = 1\n 'M=M-D' # M[1] = M[1] - 3 = 303 - 3\n )\n end\n end\n\n return assembly_builder\n end",
"def build opts = nil, &blk\n builder.build opts, &blk\n end",
"def get_instructions\n @instructions = Instructions.new('./lib/instructions.txt')\n @instructions.create_parameters_from_input\n end",
"def bake()\n\t\tdebug \"Bake Start: #{arrayString(Process.times)}\"\n\t\tif(@clean)\n\t\t\tFileUtils.rm_r Dir.glob(\"#{@buildDestination}/*\")\n\t\t\tif(@mainTargets.empty?())\n\t\t\t\t#nothing was supposed to be compiled, we'll just abort here\n\t\t\t\texit\n\t\t\tend\n\t\tend\n\t\tdebug \"Bake Start Lex: #{arrayString(Process.times)}\"\n\t\trunLexers()\n\t\trunParsers()\n\n\t\tdebug \"Bake Start Maintargets: #{arrayString(Process.times)}\"\n\t\t#the roots of the dependency graph, the targets we were told to build\n\t\trootSet = Set.new()\n\t\[email protected] do |src| \n\t\t\t#ignore all but .ml and .mli files. \n\t\t\tif(['.ml', '.mli'].any? {|ext| File.extname(src) == ext})\n\t\t\t\trootSet << sourceToTarget(File.expand_path(src))\n\t\t\tend\n\n\t\tend\n\t\tdebug \"\\nMain Targets:\"\n\t\tdebug setString(rootSet)\n\n\t\tdebug \"Bake Start Dependencies: #{arrayString(Process.times)}\"\n\t\t#every key is a target filename, and it's value is an array of files it\n\t\t#depends on. leafSet are those targets with no dependencies\n\t\tdependencyHash, leafSet = calcDependencies(rootSet)\n\t\tdebug \"\\nDependencies:\"\n\t\tdebug setHashString(dependencyHash)\n\n\t\tdebug \"\\nLeaf Targets:\"\n\t\tdebug setString(leafSet)\n\n\t\tdebug \"Bake Start Invert Dep: #{arrayString(Process.times)}\"\n\t\t#every key is a filename, and it's value is an array of files that\n\t\t#require it to be built before it can be built\n\t\tneededByHash = invertDependencies(dependencyHash)\n\t\t#this will make traversing over the graph have more elegant end cases\n\t\trootSet.each do |t| \n\t\t\tunless (neededByHash.has_key?(t))\n\t\t\t\tneededByHash[t] = Set.new()\n\t\t\tend\n\t\tend\n\n\t\tdebug \"\\nDependents:\"\n\t\tdebug setHashString(neededByHash)\n\t\t\n\t\tdebug \"Bake Start Ordering: #{arrayString(Process.times)}\"\n\n\t\tmasterOrdering = findOrdering(neededByHash, leafSet)\n\t\tdebug \"\\nOrdering:\"\n\t\tdebug arrayString(masterOrdering)\n\n\t\t#determine the set of files that are stale, or are dependent on stale\n\t\t#files\n\t\tdebug \"Bake Start Stale: #{arrayString(Process.times)}\"\n\t\tstaleSet = findStaleTargets(neededByHash, dependencyHash, leafSet)\n\t\tputs \"\\nStale Targets:\"\n\t\tputs setString(staleSet) + \"\\n\"\n\n\t\tdebug \"Bake Start Compile: #{arrayString(Process.times)}\"\n\t\tdebug \"\\nStart Compiling\"\n\t\tcompileSources(masterOrdering, staleSet)\n\t\tdebug \"Done Compiling\"\n\t\tdebug \"buildExecutables: \\'#{@buildExecutables}\\'\"\n\t\tif(@buildExecutables) \n\t\t\tdebug \"\\nBuilding Executables\"\n\t\t\tbinSourceSet = Set.new()\n\t\t\[email protected] do |src| \n\t\t\t\t#ignore all but .ml files. \n\t\t\t\tif(File.extname(src) == \".ml\")\n\t\t\t\t\tdebug \"Queueing: #{src}\"\n\t\t\t\t\tbinSourceSet.add(File.expand_path(src))\n\t\t\t\tend\n\t\t\tend\n\t\t\tbuildExecs(binSourceSet, masterOrdering, dependencyHash, staleSet)\n\t\tend\n\t\tdebug \"Bake End: #{arrayString(Process.times)}\"\n\tend",
"def begin_build\n build_stack.push(true)\n end",
"def build_tokens\n build_count\n build_index\n build_pairs\n self\n end",
"def compileArr(arr)\n\tfor a in arr\n\t\tif isExecutable(a)\n\t\t\t$stderr.puts red(\"Error: \")+\"Couldn't link the source code.\"\n\t\t\texit 1\n\t\tend\n\tend\n\n\tarr.map! { |a|\n\t\tescapePath(a)\n\t}\n\n\treturn compile(arr.join(\" \"))\nend",
"def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end",
"def build(*args)\n raise \"Method 'build' not implemented for #{self.class.name}\"\n end",
"def build; end",
"def build(products, rule, inputs, vars)\n raise \"Invalid build name '#{rule}'.\" unless valid_id(rule)\n @file.write(\"build\")\n batch(products)\n @file.write(\": #{rule}\")\n batch(inputs)\n newline()\n var_set(vars)\n end",
"def instructions\n if read_inheritable_attribute(:instructions).nil?\n write_inheritable_attribute(:instructions, {})\n end\n read_inheritable_attribute(:instructions)\n end",
"def compile_treetop_runtime_syntax_node node\n if node.elements\n node.elements.map{|element| \n# puts \"Invoking on #{element.class}\"\n compile element}.to_s\n else\n node.text\n end \n end",
"def initialize(params)\n\t\tsuper\n\t\tbasename = requireParam(params, :name)\n\t\tmodpaths = requireParam(params, :modules)\n\t\t\n\t\tmodpaths.each {|path| addPrereq BuildEnv::src2build(System::mod2obj(path))}\n\t\taddTarget BuildEnv::src2build(System::mod2slib(basename))\n\t\t\t\n\t\t#symlink from the src tree to the build tree (even if our target is up-to-date, in case the symlink currently points to a file built with \n\t\t# different options, ie elsewhere in the build tree)\n\t\tSymlinkBuilder.new(:target => target(), :name => BuildEnv::build2src(target()))\n\t\t\n\t\t#flags for tasks that edit their own prereq lists before reinvoking themselves\n\t\t@cleanallRecurse = true #true before cleanall() is called from outside; false when it's called by itself\n\tend",
"def build_from_data(data)\n data.each do |list_data|\n adjacent_list = AdjacentList.new\n list_data.reduce do |ele1, ele2|\n node2 = Node.new(ele2)\n\n if ele1.is_a?(Node)\n ele1.next_node = node2\n else\n node1 = Node.new(ele1, node2)\n adjacent_list.head_node = node1\n self.dict[node1.value] = self.adj_list_array.length\n end\n # return node2 to next reduce iteration\n node2\n end\n self.adj_list_array.push(adjacent_list)\n end\n end",
"def instructions(incoming_instructions)\n incoming_instructions.chars.map(&INSTRUCTION)\n end",
"def build_sketch_graph\n\t@temp_hop_record = Hash.new\n\t@processed_list = Hash.new\n\t$node_list.each do |n|\n\t\t#Nodes in sketched graph: queries, user_inputs\n\t\t#if n.getInstr.getFromUserInput or (n.isQuery? and n.isWriteQuery?) or (n.getInstr.instance_of?AttrAssign_instr and n.getInstr.getFuncname.index('!') == nil)\n\t\tif n.isQuery? #or n.getInstr.getFromUserInputor isTableAttrAssign(n) \n\t\t\tn.Tnode = TreeNode.new(n)\n\t\t\t$sketch_node_list.push(n.Tnode)\t\n\t\t\t@temp_hop_record[n] = Array.new\n\t\t\t@processed_list[n] = Array.new\n\t\t\t@temp_hop_record[n].push(n)\n\t\tend \n\tend\n\tfor i in 0...$node_list.length\n\t\tadded_edge = false\n\t\tno_changes = true\n\t\t$node_list.each do |n|\n\t\t\tif n.Tnode != nil\n\t\t\t\t@temp_hop_record[n].push(nil)\n\t\t\t\ttemp_node = @temp_hop_record[n].shift\n\t\t\t\tstep = 0\n\t\t\t\twhile temp_node != nil and step < 10000 do\n\t\t\t\t\tstep += 1\n\t\t\t\t\tno_changes = false\n\t\t\t\t\ttemp_node.getDataflowEdges.each do |e|\n\t\t\t\t\t\tif e.getToNode.Tnode != nil and e.getToNode != n\n\t\t\t\t\t\t\tif n.Tnode.hasChildren(e.getToNode.Tnode) == false and (n.getIndex < e.getToNode.getIndex)\n\t\t\t\t\t\t\t\tn.Tnode.addChildren(e.getToNode.Tnode, i)\n\t\t\t\t\t\t\t\t#puts \"\\tAdd edge: #{n.getIndex}:#{n.getInstr.toString} -> #{e.getToNode.getIndex}:#{e.getToNode.getInstr.toString}\"\n\t\t\t\t\t\t\t\tadded_edge = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif e.getToNode != n \n\t\t\t\t\t\t\t\tif @processed_list[n].include?e\n\t\t\t\t\t\t\t\telsif e.getToNode.getIndex < e.getFromNode.getIndex #returnv\n\t\t\t\t\t\t\t\t\te.getToNode.getDataflowEdges.each do |e1|\n\t\t\t\t\t\t\t\t\t\tif e1.getToNode.getIndex > temp_node.getIndex\n\t\t\t\t\t\t\t\t\t\t\t@temp_hop_record[n].push(e1.getToNode)\n\t\t\t\t\t\t\t\t\t\t\t@processed_list[n].push(e1)\n\t\t\t\t\t\t\t\t\t\tend \n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@temp_hop_record[n].push(e.getToNode)\n\t\t\t\t\t\t\t\t\t@processed_list[n].push(e)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttemp_node = @temp_hop_record[n].shift\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif added_edge\n\t\t\t#puts \"iteration #{i} ||\"\n\t\tend\n\t\tif no_changes\n\t\t\tbreak\n\t\tend\n\tend\n=begin\n\tgraph_write($graph_file, \"digraph sketch {\\n\")\n\t$node_list.each do |n|\n\t\tif n.Tnode != nil\n\t\t\tif n.isQuery?\n\t\t\t\tcolor = \"blue\"\n\t\t\telsif n.getInstr.instance_of?AttrAssign_instr\n\t\t\t\tcolor = \"darkorange\"\n\t\t\telse\n\t\t\t\tcolor = \"crimson\"\n\t\t\tend\n\t\t\tgraph_write($graph_file, \"\\tn#{n.getIndex} [label=<<i>#{n.getIndex}__#{n.getInstr.toString2}</i>> color=#{color}]; \\n\")\n\t\t\tn.Tnode.children.each do |c|\n\t\t\t\tgraph_write($graph_file, \"\\tn#{n.getIndex} -> n#{c.node.node.getIndex} [label=\\\"#{c.dist}\\\"]\\n\")\n\t\t\tend\n\t\tend\n\tend\n\tgraph_write($graph_file, \"}\")\n=end\nend",
"def build_array(node)\r\n return [] if node.nil?\r\n results = []\r\n results.concat build_array(node.left)\r\n results << node.payload\r\n results.concat build_array(node.right)\r\n results\r\nend",
"def buildXML(label,array,xml)\r\n array.each do |hash|\r\n xml.send(label) do\r\n # Create an element named for the label\r\n hash.each do |key,value|\r\n if value.is_a?(Array)\r\n buildXML(key,value,xml)\r\n else\r\n # Create <key>value</key> (using variables)\r\n xml.send(key,value)\r\n end\r\n end\r\n end\r\n end\r\n end",
"def create_graph(arr)\n nodes = []\n (0...arr.size).each do |i|\n node = Node.new(i)\n nodes.push(node)\n end\n nodes.each_with_index do |node,i|\n arr[i].each {|val| node.connections.push(nodes[val])} \n end\n nodes\nend",
"def create_graph(arr)\n nodes = []\n (0...arr.size).each do |i|\n node = Node.new(i)\n nodes.push(node)\n end\n nodes.each_with_index do |node,i|\n arr[i].each {|val| node.connections.push(nodes[val])} \n end\n nodes\nend",
"def add(*nodes)\n @nodes.push(*nodes)\n end",
"def push(*xs)\n xs.each { |x| @nodes.push x }\n end",
"def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each do |x|\n self.add(x)\n end\n end",
"def build_tree(array)\n\t\t@root = Node.new(array[0])\n\t\ttemp_root = @root\n\n\t\tarray[1..-1].each do |node_value|\n\t\t\tinsert_node(node_value, temp_root)\n\t\tend\n\tend",
"def parse(args)\n @args = args\n @instruction = args.join(' ')\n until @args.empty?\n arg = @args[0]\n if @instructions.key? arg\n @args.shift\n buff = args_extract(arg, @instructions[arg][0])\n @to_exec << [arg, buff]\n else\n bad_argument_exit(arg)\n end\n end\n run\n end",
"def initialize(arr=[])\n @tree = []\n @tree.push(:dummy_head)\n 0.upto(arr.size-1) do |i|\n push(arr[i])\n end\n end",
"def call(*args)\n cache.fetch_or_store(args.hash) do\n type, adapter, ast, plugins, plugins_options, meta = args\n\n compiler = with(\n id: type,\n adapter: adapter,\n plugins: Array(plugins),\n plugins_options: plugins_options,\n meta: meta\n )\n\n graph_opts = compiler.visit(ast)\n command = ROM::Commands::Graph.build(registry, graph_opts)\n\n if command.graph?\n root = inflector.singularize(command.name.relation).to_sym\n CommandProxy.new(command, root)\n elsif command.lazy?\n command.unwrap\n else\n command\n end\n end\n end",
"def generate\n tree = generate_syntax_tree\n source = []\n\n tree.butfirst.each do |production|\n non_terminal = production.first\n\n if non_terminal == :statement\n terminals = production.butfirst\n procedure = terminals.first\n arguments = terminals.butfirst\n\n # If we encounter an unknown procedure, we have to consider\n # it a fatal error.\n if mnemonic_exists?(procedure)\n source << eval_procedure(procedure, arguments)\n else\n raise Bolverk::ASM::SemanticError, \"Unknown procedure: '#{procedure.value}' at line #{procedure.line}.\"\n end\n end\n end\n\n source.join(\"\\n\")\n end",
"def initialize(nodes, edges)\n super()\n self.nodes = nodes\n self.edges = edges.map { |e| Edge.new(e[0], e[1], e[2]) }\n\n self.build\n end",
"def build(*modules, &block)\n reset!\n\n modules.each { |mod| add_module(mod) }\n self.instance_eval(&block) if block\n\n [ '' ] + @modules + [ '' ]\n end",
"def build\n puts \"\\nExecuting ladon-batch\"\n _print_separator_line\n\n @runners = []\n\n # TODO: figure out wildcarding in TARGET_AUTOMATION_PATH.\n # Maybe we can preprocess AUTOMATION_CONFIG_KEY, using Dir to detect multiples, and expanding the config\n # with any repeats. Maybe we detect all non-abstract subclasses of automation_config[:automation_name] ?\n # Not sure yet. We'll get to this later.\n\n @config[AUTOMATION_CONFIG_KEY].each do |automation_config|\n # build and process this config's flag_sets\n target_flag_sets = _flag_sets_of_automation(automation_config)\n # calculate the number of runners to create for the automation\n repeats = _nonnegative_int(automation_config[:instances])\n\n target_flag_sets.each do |set_name, flag_set|\n _spawn_runners(automation_config, set_name, flag_set.dup, repeats)\n end\n end\n end",
"def add_instruction(instruction)\n raise ArgumentError, \"Instruction must be of type 'Instruction'\" unless instruction.is_a?(Instruction)\n @instructions << instruction\n end",
"def instructions; raise NotImplementedError\n end",
"def build_edge(*args)\n edge_class.new(*args)\n end",
"def build_tree(arr)\n\tend",
"def build(&block)\n instance_eval(&block)\n end",
"def emit_instr(base_addr = 0x0600)\n #by convention, stack is 0x0100-0x01FF\n #so we try tolay out our program starting from 0x0200\n #\n #errr.... turns out 6502asm.com starts userspace addrs at 0x0600\n \n #2-pass compilation:\n #first pass, we lay out all the instr except for goto-labels\n addr = base_addr\n \n @instr.each { |i|\n case i.instr_type\n when InstrBase::OPCODE\n #p \"opcode #{i}\"\n i.addr = addr\n \n #increment by number of instructions used: 1 for opcode + 1-2 for args\n addr = addr + 1 + i.args_len\n when InstrBase::LABEL_HOME\n #p \"label #{i}\"\n i.addr = addr\n i.label_addr = addr\n \n #also, need to update @def_labels structure for lookups later\n @def_labels[i.label_name][1] = addr \n when InstrBase::MACRO\n #p \"macro #{i.to_s}\" \n # set addr of macro to starting addr\n i.addr = addr\n \n # increment addr by length of macro's args\n addr = addr + i.args.length\n \n #actual opcode is captured in @args of macro, get it later\n else\n #p \"else #{i.instr_type}\"\n end\n }\n \n #second pass, we link in all the goto-labels\n @instr.each { |i|\n case i.instr_type\n when InstrBase::OPCODE\n if i.args.respond_to?(:instr_type)\n if i.args.instr_type == InstrBase::LABEL_GOTO\n \n #if we have a relative addr, args_len = 1\n #add signed 1byte disp to instr. counter\n if i.args_len == 1\n disp =@def_labels[i.args.label_addr][1] - (i.addr + 2)\n i.args = disp\n else #replace label goto with mapped addr to it\n i.args = @def_labels[i.args.label_addr][1]\n end\n \n else\n #raise exception here\n raise \"Unknown opcode arg-type \\\"#{i.args}\\\" found\"\n end\n end\n else\n #p \"else #{i.instr_type}\" \n end\n }\n \n \n \n end",
"def build\n # Create the offsets, if they are not provided\n current_offset = 0\n fields.each do |field_def|\n field_def[2] ||= current_offset\n current_offset = field_def[2] + field_def[1].size\n end\n registry.do_create_compound(name, fields, size)\n end",
"def mipsAddPICCode(list)\n myList = []\n list.each {\n | node |\n myList << node\n if node.is_a? Label\n if /_prologue$/.match(node.name) || /^_llint_function_/.match(node.name)\n # Functions called from trampoline/JIT codes.\n myList << Instruction.new(node.codeOrigin, \"pichdr\", [])\n elsif /_llint_op_catch/.match(node.name)\n # Exception cactcher entry point function.\n myList << Instruction.new(node.codeOrigin, \"pichdrra\", [])\n end\n end\n }\n myList\nend"
] | [
"0.5794964",
"0.5662501",
"0.5583097",
"0.55065143",
"0.53973097",
"0.5381506",
"0.5353424",
"0.5277581",
"0.5220385",
"0.5220011",
"0.5203354",
"0.5143381",
"0.5134549",
"0.51275074",
"0.5122272",
"0.51101774",
"0.5091723",
"0.5082538",
"0.50754756",
"0.5039806",
"0.503321",
"0.5033066",
"0.5012933",
"0.5011717",
"0.50005853",
"0.49818254",
"0.49802724",
"0.49719316",
"0.49702573",
"0.49451628",
"0.49295145",
"0.4917237",
"0.4872507",
"0.48640528",
"0.48578602",
"0.48494375",
"0.48318872",
"0.4827824",
"0.48237106",
"0.48025832",
"0.48023537",
"0.48023537",
"0.47971353",
"0.47913763",
"0.47682187",
"0.47680712",
"0.47534692",
"0.47458273",
"0.4739617",
"0.47354037",
"0.47088075",
"0.46797794",
"0.46776807",
"0.46736765",
"0.4671548",
"0.4671548",
"0.4666191",
"0.46658376",
"0.4659081",
"0.46485376",
"0.46483746",
"0.46342352",
"0.4625837",
"0.4624144",
"0.46190244",
"0.46144354",
"0.460545",
"0.4598451",
"0.45913026",
"0.45858732",
"0.45787433",
"0.4569677",
"0.45668736",
"0.45661923",
"0.45571196",
"0.45490125",
"0.45455185",
"0.4542109",
"0.4540843",
"0.4537284",
"0.4537284",
"0.4529025",
"0.45193338",
"0.45145014",
"0.45142344",
"0.45128247",
"0.4509948",
"0.45079952",
"0.44995624",
"0.44971743",
"0.44962254",
"0.4494764",
"0.44921857",
"0.4483555",
"0.44821995",
"0.447943",
"0.44767886",
"0.44641733",
"0.44626862",
"0.4461315"
] | 0.5247935 | 8 |
Finds the instructions that are the targets of jumping or branching, or fallthrough from not branching. | def targets(insns)
targets = Set.new
# The first instruction is implicitly jumped to when the function
# starts.
targets.add 0 unless insns.empty?
# Look at each instruction. If it's a jump add its target to the list of
# targets. If it's a branch then the branch may not be taken and so the
# next instruction is also a target as well as the actual target.
insns.each_with_index do |insn, index|
if [:jump, :branch].include?(insn.first)
targets.add insn[1]
targets.add index + 1 if insn.first == :branch
end
end
# Sort the targets so the output so we get the targets in the order
# they appear.
targets.to_a.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_correct_jump_offsets\n assert_instructions \"(true or true or true) or true\", [\n [\"lit\", true], [\"jtrue\", 4], [\"lit\", true], [\"jtrue\", 2], [\"lit\", true],\n [\"jtrue\", 2], [\"lit\", true],\n ]\n end",
"def valid_jump_destination?(from, to, pieces)\n row = Game.index_to_row(from)\n target = nil\n if Game.is_king?(pieces[from-1])\n return if (row + 2 != Game.index_to_row(to)) and (row - 2 != Game.index_to_row(to))\n target = get_target_for_red(row, from, to) || get_target_for_white(row, from, to)\n elsif Game.is_red?(pieces[from-1])\n return if row + 2 != Game.index_to_row(to)\n target = get_target_for_red(row, from, to)\n elsif Game.is_white?(pieces[from-1])\n return if row - 2 != Game.index_to_row(to)\n target = get_target_for_white(row, from, to)\n end\n return target\n end",
"def next_jumps\n\t\tvalid_jumps = []\n\t\tmove_diffs.each do |diff|\n\t\t\tvalid_jumps << [position.first + (diff.first * 2), position.last + (diff.last * 2)]\n\t\tend\n\n\t\tvalid_jumps.select! do |move|\n\t\t\ton_board?(move) && enemy_between?(move) && board[move].nil?\n\t\tend\n\tend",
"def branch_to\n @first unless opcode == :swi\n end",
"def identify_return_sites\n blocks.each { |b|\n b.instructions.each { |i|\n i.set_return_site(false)\n }\n }\n blocks.each { |b|\n b.instructions.each { |i|\n if i.calls?\n return_index = i.index + i.delay_slots + 1\n overflow = return_index - b.instructions.length\n if overflow < 0\n b.instructions[return_index].set_return_site(true)\n else\n b.next.instructions[overflow].set_return_site(true)\n end\n end\n }\n }\n end",
"def jump(*node_types); end",
"def jump_passable?(x, y, nx, ny)\n # passable if tags are not being used at all (to save process time)\n return true if BlizzABS::Config::NO_JUMP_TAGS.size == 0\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # get jump direction\n xdir, ydir = (nx - x).sgn, (ny - y).sgn\n # iterate\n loop do\n # if tile has one of the terrain tags\n if BlizzABS::Config::NO_JUMP_TAGS.include?(terrain_tag(x / pix, y / pix))\n # impassable \n return false\n # if all tiles are passable\n elsif x == nx && y == ny\n # passable\n return true\n end\n # next tile\n x += xdir * pix\n y += ydir * pix\n end\n end",
"def branch_targets\n []\n end",
"def test_jump\n jit.compile method(:jump)\n assert_equal 1, jit.compiled_methods\n assert_equal 0, jit.executed_methods\n assert_equal 0, jit.exits\n\n jit.enable!\n v = jump\n jit.disable!\n assert_nil v\n\n assert_equal 1, jit.compiled_methods\n assert_equal 1, jit.executed_methods\n assert_equal 0, jit.exits\n end",
"def valid_jumps \n jumps = []\n move_dirs.each do |jump|\n #landing location\n x, y = (2 * jump[0] + pos[0]), (2 * jump[1] + pos[1])\n #flyover square\n u, v = (jump[0] + pos[0]), (jump[1] + pos[1])\n next unless (0..7).include?(x) && (0..7).include?(y) \n next if @board[[u, v]].nil? || (@board[[u, v]].color == @color) \n jumps << [x, y] if (!@board[[u, v]].nil?) && @board[[x, y]].nil?\n end\n jumps\n end",
"def find_instructions\n @input.each_with_index do |line,i|\n if line.instruction?\n @instructions << i+1\n end\n end\n end",
"def cflow_targets( insn )\n # TODO\n end",
"def export_jumptables(func)\n func.blocks.each do |mbb|\n branches = 0\n mbb.instructions.each do |ins|\n branches += 1 if ins.branch_type && ins.branch_type != \"none\"\n if ins.branch_type == 'indirect'\n successors = ins.branch_targets ? ins.branch_targets : mbb.successors\n targets = successors.uniq.map { |succ|\n succ.ais_ref\n }.join(\", \")\n gen_fact(\"instruction #{ins.ais_ref(:branch_index => branches)} branches to #{targets}\",\"jumptable (source: llvm)\",ins)\n end\n end\n end\n end",
"def find_solution(currently_satisfied, remaining_mappings)\n currently_satisfied = currently_satisfied.dup\n # Note that we will not be modifying the Sets that are the values of remaining_mappings so dup will work well enough\n remaining_mappings = remaining_mappings.dup\n\n # Base case:\n if remaining_mappings.size.zero?\n return currently_satisfied\n end\n\n target_opcode, target_opnames = remaining_mappings.sort_by { |k, v| v.size }.first\n\n opname_options = target_opnames - currently_satisfied.values\n # If no opname options left (and still have remaining mappings), then this branch is not valid\n if opname_options.size.zero?\n return false\n end\n\n # Try out each opname that is not currently in use\n opname_options.each do |opname|\n currently_satisfied[target_opcode] = opname\n remaining_mappings.delete(target_opcode)\n\n # Result will be false if there is no solution\n result = find_solution(currently_satisfied, remaining_mappings)\n return result if result\n end\n\n false\nend",
"def goto_if_false\n <<-CODE\n next_int;\n t1 = stack_pop();\n if(!RTEST(t1)) {\n c->ip = _int;\n cpu_cache_ip(c);\n }\n CODE\n end",
"def expand_elses(branch); end",
"def expand_elses(branch); end",
"def step\n instcode = @memory[@ip]\n raise \"nil opcode encountered\" if instcode.nil?\n\n opcode = instcode % 100\n argcount = ARGCOUNT[opcode] || 0\n addressing_modes = argcount.times.map { |ix| (instcode / (10 ** (ix + 2))) % 10 }\n args = addressing_modes.each_with_index.map do |am, ix|\n raw_arg = @memory[@ip + ix + 1]\n translate_arg(opcode, ix, raw_arg, am)\n end\n\n if TRACE\n STDERR.puts \"#{@id} @ip=#{@ip} @base=#{@base} inst=#{@memory[@ip..@ip+argcount].inspect} opcode=#{opcode} am=#{addressing_modes.inspect} args=#{args.inspect}\"\n end\n\n jump_target = nil\n case opcode\n when 1 # add\n @memory[args[2]] = args[0] + args[1]\n when 2 # mul\n @memory[args[2]] = args[0] * args[1]\n when 3 # in\n if @inputs.any?\n @memory[args[0]] = @inputs.shift\n else\n return :need_input\n end\n when 4 # out\n @outputs << args[0]\n when 5 # jnz\n jump_target = args[1] if args[0] != 0\n when 6 # jz\n jump_target = args[1] if args[0] == 0\n when 7 # lt\n @memory[args[2]] = (args[0] < args[1]) ? 1 : 0\n when 8 # eq\n @memory[args[2]] = (args[0] == args[1]) ? 1 : 0\n when 9 #base\n @base += args[0]\n when 99\n return nil\n else\n raise \"invalid opcode #{opcode} at position #{@ip}\"\n end\n\n if jump_target\n @ip = jump_target\n else\n @ip += argcount + 1\n end\n end",
"def link_sym_labels\n @instr.each{ |i|\n if i.instr_type == InstrBase::OPCODE and i.args != nil and i.args.respond_to?(:label_addr) and not @def_labels.has_key?(i.args.label_addr)\n raise \"Reference to undefined label #{i.args.label_addr} found\"\n end\n } \n nil\n end",
"def perform_jump target_position \n if valid_jump?(target_position) \n move!(target_position)\n return true\n else\n return false\n end \n end",
"def live_successor?(target)\n ix = index\n while i = block.instructions[ix]\n return true if i.branch_targets.include?(target)\n ix+=1\n end\n return true if block.fallthrough_successor == target\n return false\n end",
"def jump(line)\n return line[/(JGT)|(JEQ)|(JGE)|(JLT)|(JNE)|(JLE)|(JMP)/]\n end",
"def is_target?\n not is_source? and @next.nil? and @chain.size > 1\n end",
"def verify\n insns[0...-1].each { |insn| raise unless insn.branch_targets.empty? }\n end",
"def jmp_on_false(label, op = :eax)\n testl(op, op)\n je(label)\n end",
"def battler_targets(pokemon, logic)\n case target\n # eo eo ex / ux ao ax || e! e! ex / ux a! ax\n when :adjacent_pokemon, :adjacent_all_pokemon\n return logic.adjacent_foes_of(pokemon).concat(logic.adjacent_allies_of(pokemon))\n # eo eo ex / ux ax ax || e! e! ex / ux ax ax\n when :adjacent_foe, :adjacent_all_foe\n return logic.adjacent_foes_of(pokemon)\n # e! e! e! / ux ax ax || e? e? e? / ux ax ax\n when :all_foe, :random_foe\n return logic.foes_of(pokemon)\n # e! e! e! / u! a! a!\n when :all_pokemon\n return logic.foes_of(pokemon).concat(logic.allies_of(pokemon)) << pokemon\n # ex ex ex / u! ax ax\n when :user\n return [pokemon]\n # ex ex ex / uo ao ax\n when :user_or_adjacent_ally\n return [pokemon].concat(logic.adjacent_allies_of(pokemon))\n # ex ex ex / ux ao ax\n when :adjacent_ally\n return logic.allies_of(pokemon)\n # ex ex ex / u! a! a!\n when :all_ally\n return [pokemon].concat(logic.allies_of(pokemon))\n # eo eo eo / ux ao ao\n when :any_other_pokemon\n return logic.foes_of(pokemon).concat(logic.allies_of(pokemon))\n end\n return [pokemon]\n end",
"def minimum_jumps(arr)\n # two arrays. One to keep track of minimum number of jumps needed to reach\n # the position. The other to keep track of which index was needed to reach\n # a given index position.\n num_jumps = [0]\n jump_idx = [nil]\n # use two pointers, one being the destination index and the other\n # being which index to jump from to reach it.\n destination_idx = 1\n while destination_idx < arr.length\n current_idx = find_starting_idx(destination_idx, jump_idx)\n p [current_idx, destination_idx]\n # break the inner while loop once we find an answer\n while current_idx < destination_idx && num_jumps[destination_idx].nil?\n if can_jump?(arr, current_idx, destination_idx)\n num_jumps[destination_idx] = num_jumps[current_idx] + 1\n jump_idx[destination_idx] = current_idx\n end\n current_idx += 1\n end\n destination_idx += 1\n end\n p jump_idx\n num_jumps.last\nend",
"def has_branches\n branch_found = false\n waypoints[1..-1].each do |waypoint|\n branch_found |= waypoint.parent_index != waypoint.local_index-1\n end\n branch_found\n end",
"def jump(_jump)\n j1 = '0'\n j2 = '0'\n j3 = '0'\n\n if (_jump == 'null')\n #Do nothing\n elsif (_jump == 'JGT')\n j3 = '1'\n elsif (_jump == 'JEQ')\n j2 = '1'\n elsif (_jump == 'JGE')\n j2 = '1'\n j3 = '1'\n elsif (_jump == 'JLT')\n j1 = '1'\n elsif (_jump == 'JNE')\n j1 = '1'\n j3 = '1'\n elsif (_jump == 'JLE')\n j1 = '1'\n j2 = '1'\n elsif (_jump == 'JMP')\n j1 = '1'\n j2 = '1'\n j3 = '1'\n else\n raise 'invalid syntax'\n end\n return j1 + j2 + j3\n end",
"def jumps\n jumps = Array.new\n move_dirs = jump_dirs\n jumped_dirs = slide_dirs # The spaces to be jumped over.\n\n move_dirs.length.times do |i|\n new_loc = [@location[0] + move_dirs[i][0],\n @location[1] + move_dirs[i][1]]\n jumped_loc = [@location[0] + jumped_dirs[i][0],\n @location[1] + jumped_dirs[i][1]]\n \n next unless @board.valid_location?(*new_loc)\n jumps << new_loc if !@board[*jumped_loc].nil? &&\n @board[*jumped_loc].color != @color &&\n @board[*new_loc].nil?\n end\n\n jumps \n end",
"def possible_jumps\n pos_jumps = [ ]\n row, col = @pos\n move_diffs.each do |row_change, col_change| \n jumped_piece = [row + row_change, col + col_change]\n new_position = [row + (row_change * 2), (col + col_change * 2)]\n unless @grid[jumped_piece].nil? || @grid[jumped_piece].color == @color\n pos_jumps << new_position\n end\n end\n pos_jumps\n end",
"def goto_if_defined\n <<-CODE\n next_int;\n t1 = stack_pop();\n if(t1 != Qundef) {\n c->ip = _int;\n cpu_cache_ip(c);\n }\n CODE\n end",
"def jumps_to_end\n ( @x == @y ) ? 0 : get_jumps_to_end\n end",
"def find_starting_idx(destination_idx, jump_idx)\n jump_idx.length > 1 ? jump_idx[destination_idx - 1] : 0\nend",
"def can_jump(arr)\n return false if arr.empty?\n jump_helper(arr, index = arr.size - 1, jumps = 0)\nend",
"def regex_find_operations\n /(?:\\bmove\\(|\\btake\\(|\\blook\\(|\\bputs\\(|\\bturn\\(|->|\\.|;|\\bend\\b|\\bcase\\b|\\bif\\b)/\nend",
"def test_jmpf_branches_if_top_of_stack_is_false\n @ctx.constants = [false, 'ok']\n @bc.codes = [:cls, :pushc, 0, :jmpf, 7, :pushl, 15, :pushc, 1, :halt]\n assert_eq @ci.run, 'ok'\n end",
"def goto(*paths_and_opts)\n if paths_and_opts.last.class == Hash\n *paths, opts = paths_and_opts\n else\n paths, opts = paths_and_opts, {}\n end\n \n # loop through `paths` called from goto to get states\n destination_states = paths.map do |p| \n state = resolve(p)\n state ? state : raise(CannotResolveError, \"State#goto could not resolve path #{p} from #{self}\")\n end\n\n # loop through all states added, find pivots of current state(preferably root? though not always) and target state\n pivots = destination_states.map { |state| find_pivot(state) }\n\n # there should only be 1 uniq state in [pivots]\n if uniq_states(pivots).size > 1\n raise MultiplePivotError, \"StateNode#goto: multiple pivot states found between state #{self} and paths #{paths.join(', ')}\"\n end\n\n pivot = pivots[0] || self\n\n if pivot.can_exit?(destination_states, opts) === false \n trace_state(\"State: [GOTO] : #{self} cannot exit\")\n return false\n end\n trace_state(\"State: [GOTO] : #{self} -> [#{destination_states.join(', ')}]\")\n\n # current state isn't active\n if (!__is_current__? && @superstate)\n raise InactiveStateError, \"StateNode#goto: state #{self} is not current\"\n end\n\n # if the pivot state is concurrent state and is NOT the current state (starting state), then we are attempting to cross a concurrency boundary.\n if (pivot.concurrent? && pivot != self)\n raise PivotingOnConcurrentStateError, \"StateNode#goto: one or more of the given paths are not reachable from state #{self}: #{paths.join(', ')}\"\n end\n\n # push transition to a queue `root.__transitions__`\n root.queue_transition(pivot, destination_states, opts)\n\n # flushes out all transitions queued up in `root.__transitions__`\n root.transition unless self.__is_sending__?\n\n true\n end",
"def goto_if_true\n <<-CODE\n next_int;\n t1 = stack_pop();\n if(RTEST(t1)) {\n c->ip = _int;\n cpu_cache_ip(c);\n }\n CODE\n end",
"def recommended_targets\n Character.all.select do |character|\n character.power <= (self.power + 2) && character != self\n end\n end",
"def sniper_targets\n potential_sniper_targets.select do |planet|\n # Predict future accounting for all current fleets\n max_travel_time = @pw.fleets_underway_to(planet).map{|fleet| fleet.turns_remaining}.max || 0\n predictions = predict_future_population(planet, max_travel_time + 1)\n\n # Only go for planets that the enemy will eventually win\n next unless predictions.last.enemy?\n\n next if planet.enemy?\n if planet.mine?\n # Recapture\n elsif planet.enemy?\n # Don't go for planets that are getting reinforced. Don't fight the enemy head-on.\n next\n else # neutral\n # Snipe\n end\n true\n end\n end",
"def step\n instcode = @memory[@ip]\n raise \"nil opcode encountered\" if instcode.nil?\n\n opcode = instcode % 100\n arg0imm = (instcode / 100) % 10 == 1\n arg1imm = (instcode / 1000) % 10 == 1\n\n argcount = ARGCOUNT[opcode] || 0\n args = @memory[@ip + 1..@ip + argcount]\n arg0 = (arg0imm ? args[0] : @memory[args[0]]) if argcount >= 1\n arg1 = (arg1imm ? args[1] : @memory[args[1]]) if argcount >= 2\n\n jump_target = nil\n case opcode\n when 1 # add\n @memory[args[2]] = arg0 + arg1\n when 2 # mul\n @memory[args[2]] = arg0 * arg1\n when 3 # in\n raise \"input past end\" unless @inputs.any?\n @memory[args[0]] = @inputs.shift\n when 4 # out\n @outputs << arg0\n when 5 # jnz\n jump_target = arg1 if arg0 != 0\n when 6 # jz\n jump_target = arg1 if arg0 == 0\n when 7 # lt\n @memory[args[2]] = (arg0 < arg1) ? 1 : 0\n when 8 # eq\n @memory[args[2]] = (arg0 == arg1) ? 1 : 0\n when 99\n return nil\n else\n raise \"invalid opcode #{opcode} at position #{@ip}\"\n end\n\n if jump_target\n @ip = jump_target\n else\n @ip += argcount + 1\n end\n end",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def can_jump?(arr, current_idx, destination_idx)\n current_idx + arr[current_idx] >= destination_idx\nend",
"def add_adjacent_jumpables(x,y,dist,jump_tags)\n add_adj_jumps(x,y,2,-1,false,dist,jump_tags)\n add_adj_jumps(x,y,4,-1, true,dist,jump_tags)\n add_adj_jumps(x,y,6,1,true,dist,jump_tags)\n add_adj_jumps(x,y,8,1,false,dist,jump_tags)\n end",
"def directly_reachable(target)\n number_of_interfaces_checked = 0\n @facts['interfaces'].split(',').each do |inf|\n if @facts[\"ipaddress_#{inf}\"] && @facts[\"netmask_#{inf}\"]\n number_of_interfaces_checked += 1\n infaddr = IPAddr.new(@facts[\"ipaddress_#{inf}\"] + '/' + @facts[\"netmask_#{inf}\"])\n return true if infaddr.include?(IPAddr.new(target))\n end\n end\n if number_of_interfaces_checked > 0\n return false\n else\n # If Facter failed for some reason and didn't send us any interface\n # data we don't want to have etch unconfigure/misconfigure the\n # networking on the client\n abort \"No interface addresses/netmasks received\"\n end\nend",
"def synpred24_Instructions\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 80 )\n\n # at line 132:11: WS the\n match( WS, TOKENS_FOLLOWING_WS_IN_synpred24_Instructions_410 )\n @state.following.push( TOKENS_FOLLOWING_the_IN_synpred24_Instructions_412 )\n the\n @state.following.pop\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 80 )\n\n end",
"def jmp_if_false(pos, x, y)\n conditional = @instructions[x] || 0\n puts \"Conditional: #{conditional}\" if @debug\n if conditional == 0\n # We need to update the position a little bit more nicely\n @pos = (@instructions[y] || 0) - 3\n end\n puts \"Pos: #{@pos}\" if @debug\n end",
"def competing_image_labels\n return image.image_labels.select{ |il| (not il.target.nil?) && (not il == self) }\n end",
"def first_applicable_branch(target)\n branches.each do |branch|\n return branch if branch.meets_condition?(target)\n end\n nil\n end",
"def when_branches\n node_parts[1...-1]\n end",
"def make_attack_targets\n targets = []\n if battler.confusion?\n targets.push(friends_unit.random_target)\n elsif battler.berserker?\n targets.push(opponents_unit.random_target)\n else\n targets.push(opponents_unit.smooth_target(@target_index))\n end\n if battler.dual_attack # Chain attack\n targets += targets\n end\n return targets.compact\n end",
"def find_reaching_nodes\n @visit = CAN_REACH_TARGET\n for node, count in @parents\n if node.visit == UNVISITED\n node.find_reaching_nodes\n end\n end\n end",
"def valid_jump? target_position\n return false unless self.board[target_position].nil?\n \n # check if target position is a valid position \n diffs = self.move_diffs.collect { |el| el * 2 } \n possible_moves = find_possible_moves(diffs)\n #if you cannot move to the target position return false\n return false unless possible_moves.include?(target_position) \n \n \n # find enemy position to check if its enemy or our own color\n jump_direction = [target_position[0] - self.pos[0], target_position[1] - self.pos[1]]\n enemy_distance = jump_distance.collect { |el| el / 2 }\n enemy_position = [self.pos[0] + enemy_distance[0], self.pos[1] + enemy_distance[1]]\n return false if self.board[enemy_position].color == self.color \n \n true \n end",
"def branches\n bodies = when_branches.map(&:body)\n bodies.push(else_branch) if else?\n bodies\n end",
"def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end",
"def can_jump(arr)\n return false if arr.empty?\n return true if arr.length == 1\n\n last_index = arr.length - 1\n cache = { last_index => true }\n jump_helper(arr, last_index - 1, cache)\nend",
"def jump(str)\n if str == \"treat\"\n puts \"jump up and down\"\n end\n end",
"def jump_bridge_check(x_plus, y_plus)\n return if x_plus == 0 && y_plus == 0\n if x_plus.abs > y_plus.abs\n x_plus < 0 ? turn_left : turn_right\n bridge_left_check(@z)\n else\n y_plus < 0 ? turn_up : turn_down\n bridge_down_check(@z)\n end\n end",
"def specific_allowed_targets\n return @specific_allowed_targets\n end",
"def execute_DynamicJump\n method = get_register(@instruction.register)\n log.debug \"Register at: #{@instruction.register} , has #{method.class}\"\n pos = Position.get(method.binary)\n log.debug \"Jump to binary at: #{pos} #{method.name}:#{method.binary.class}\"\n raise \"Invalid position for #{method.name}\" unless pos.valid?\n pos = pos + Parfait::BinaryCode.byte_offset\n set_pc( pos )\n false\n end",
"def jump_forever\n jump_to_negative_relative_offset(current_assembly_position)\n end",
"def path_blocked?(target)\n x_steps = target[0].to_i - @x\n y_steps = target[1].to_i - @y\n # Diagonal movements\n if x_steps != 0 && y_steps != 0\n (y_steps.abs - 1).times do |index| \n if y_steps > 0 && x_steps > 0\n current_target = \"#{@x + (index + 1)}#{@y + (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps < 0 && x_steps > 0\n current_target = \"#{@x + (index + 1)}#{@y - (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps > 0 && x_steps < 0\n current_target = \"#{@x - (index + 1)}#{@y + (index + 1)}\"\n return true if @board[current_target] != nil\n elsif y_steps < 0 && x_steps < 0\n current_target = \"#{@x - (index + 1)}#{@y - (index + 1)}\"\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n end\n end\n # Straight line movements\n else\n (y_steps.abs - 1).times do |index| \n if y_steps > 0\n current_target = @y + (index + 1)\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n elsif y_steps < 0\n current_target = @y - (index + 1)\n return true if @board[\"#{target[0]}#{current_target}\"] != nil\n end\n end\n (x_steps.abs - 1).times do |index| \n if x_steps > 0\n current_target = @x + (index + 1)\n return true if @board[\"#{current_target}#{target[1]}\"] != nil\n elsif x_steps < 0\n current_target = @x - (index + 1)\n return true if @board[\"#{current_target}#{target[1]}\"] != nil\n end\n end\n end\n false\n end",
"def listLegalJumpFrom(from)\n l = [] ;\n for x in 0 .. 3\n for y in 0 .. 3\n to = Pos.new(x,y) ;\n if(isLegalJump(from,to))\n l.push(to) ;\n end\n end\n end\n l\n end",
"def target_names\n targets ? targets.map(&:to_sym) : nil\n end",
"def backtrackable_elements\n select &:backtrackable?\n end",
"def jump(str)\n @@JUMP_TABLE[str]\n end",
"def tbs_make_attack_targets \n targets = []\n targets += subject.opponents + subject.friends\n targets &= subject.opponents if !GTBS::ATTACK_ALLIES\n targets &= $tbs_cursor.targeted_battlers \n targets = targets.select {|target| target.dead? == false}\n return targets.compact\n end",
"def get_neighbours (target_interactions, target)\n\t\tneighbours = target_interactions.collect { |elem|\n\t\t\telem[:intr1] == target ? elem[:intr2]: elem[:intr1]\n\t\t}\n\n\t\tneighbours = neighbours.uniq\n\t\tneighbours\n\tend",
"def mipsLowerSimpleBranchOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n annotation = node.annotation\n case node.opcode\n when /^b(addi|subi|ori|addp)/\n op = $1\n bc = $~.post_match\n branch = \"b\" + bc\n\n case op\n when \"addi\", \"addp\"\n op = \"addi\"\n when \"subi\"\n op = \"subi\"\n when \"ori\"\n op = \"ori\"\n end\n\n if bc == \"o\"\n case op\n when \"addi\"\n # addu $s0, $s1, $s2\n # xor $t0, $s1, $s2\n # blt $t0, $zero, no overflow\n # xor $t0, $s0, $s1\n # blt $t0, $zero, overflow\n # no overflow:\n #\n tr = Tmp.new(node.codeOrigin, :gpr)\n tmp = Tmp.new(node.codeOrigin, :gpr)\n noFlow = LocalLabel.unique(\"noflow\")\n noFlowRef = LocalLabelReference.new(node.codeOrigin, noFlow)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], node.operands[1], tr], annotation)\n newList << Instruction.new(node.codeOrigin, \"xori\", [node.operands[0], node.operands[1], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, noFlowRef])\n newList << Instruction.new(node.codeOrigin, \"xori\", [tr, node.operands[0], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n newList << noFlow\n newList << Instruction.new(node.codeOrigin, \"move\", [tr, node.operands[1]])\n when \"subi\"\n # subu $s0, $s1, $s2\n # xor $t0, $s1, $s2\n # bge $t0, $zero, no overflow\n # xor $t0, $s0, $s1\n # blt $t0, $zero, overflow\n # no overflow:\n #\n tr = Tmp.new(node.codeOrigin, :gpr)\n tmp = Tmp.new(node.codeOrigin, :gpr)\n noFlow = LocalLabel.unique(\"noflow\")\n noFlowRef = LocalLabelReference.new(node.codeOrigin, noFlow)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[1], node.operands[0], tr], annotation)\n newList << Instruction.new(node.codeOrigin, \"xori\", [node.operands[1], node.operands[0], tmp])\n newList << Instruction.new(node.codeOrigin, \"bigteq\", [tmp, MIPS_ZERO_REG, noFlowRef])\n newList << Instruction.new(node.codeOrigin, \"xori\", [tr, node.operands[1], tmp])\n newList << Instruction.new(node.codeOrigin, \"bilt\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n newList << noFlow\n newList << Instruction.new(node.codeOrigin, \"move\", [tr, node.operands[1]])\n when \"ori\"\n # no ovwerflow at ori\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..1], annotation)\n end\n else\n if node.operands[1].is_a? Address\n addr = node.operands[1]\n tr = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, \"loadp\", [addr, tr], annotation)\n newList << Instruction.new(node.codeOrigin, op, [node.operands[0], tr])\n newList << Instruction.new(node.codeOrigin, \"storep\", [tr, addr])\n else\n tr = node.operands[1]\n newList << Instruction.new(node.codeOrigin, op, node.operands[0..-2], annotation)\n end\n newList << Instruction.new(node.codeOrigin, branch, [tr, MIPS_ZERO_REG, node.operands[-1]])\n end\n when \"bia\", \"bpa\", \"bba\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[1], node.operands[0]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bnz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"biaeq\", \"bpaeq\", \"bbaeq\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[0], node.operands[1]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"bib\", \"bpb\", \"bbb\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[0], node.operands[1]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bnz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when \"bibeq\", \"bpbeq\", \"bbbeq\"\n tmp = Tmp.new(node.codeOrigin, :gpr)\n comp = node.opcode[1] == ?b ? \"sltub\" : \"sltu\"\n newList << Instruction.new(node.codeOrigin, comp, [tmp, node.operands[1], node.operands[0]], annotation)\n newList << Instruction.new(node.codeOrigin, \"bz\", [tmp, MIPS_ZERO_REG, node.operands[2]])\n when /^bt(i|p|b)/\n lowerMIPSCondBranch(newList, \"b\" + $~.post_match + $1, node)\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend",
"def lowerMIPSCondBranch(list, condOp, node)\n if node.operands.size == 2\n list << Instruction.new(node.codeOrigin,\n condOp,\n [node.operands[0], MIPS_ZERO_REG, node.operands[-1]],\n node.annotation)\n elsif node.operands.size == 3\n tmp = Tmp.new(node.codeOrigin, :gpr)\n list << Instruction.new(node.codeOrigin,\n \"andi\",\n [node.operands[0], node.operands[1], tmp],\n node.annotation)\n list << Instruction.new(node.codeOrigin,\n condOp,\n [tmp, MIPS_ZERO_REG, node.operands[-1]])\n else\n raise \"Expected 2 or 3 operands but got #{node.operands.size} at #{node.codeOriginString}\"\n end\nend",
"def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"def add_adj_jumps(x,y,dir, step, horz, dist,jump_tags)\n jump_length = 0 # number of \"tiles\" the jump will leap over.\n map = $game_map\n passables = jump_tags[:pass]\n \n ox, oy = x, y\n orig_valid = MoveUtils.ev_passable?(ox,oy,@source) && \n (map.passable?(ox,oy,dir) || passables[map.terrain_tag(ox,oy)])\n return if !orig_valid\n horz ? x+= step : y+=step # don't check start point, begin at an adjacent one\n\n while(jump_length < dist && map.valid?(x,y) && jump_tags[:jump][map.terrain_tag(x,y)] && !map.passable?(x,y,dir))\n jump_length+=1\n horz ? x+= step : y+=step\n end\n\n valid_jump = jump_length <= jump_tags[:jump_length] && jump_length > 0\n ev_pass = MoveUtils.ev_passable?(x,y,@source)\n map_valid = map.valid?(x,y)\n\n if ev_pass && map_valid && valid_jump\n v = Vertex.new(x,y,map.terrain_tag(x,y))\n v2 = Vertex.new(ox,oy,map.terrain_tag(ox,oy))\n add_vertex(v) if !@verticies[v]\n add_edge(v,v2,{:jump=>jump_length}, opp_dir(dir), dir)\n end\n end",
"def jump(n)\n \t\"*Jump!* \" * 2\n end",
"def achieve_all(states, ops, goals, goal_stack)\n\n # We try to achieve each goal in the order they are given. If any one\n # goal state cannot be achieved, then the problem cannot be solved.\n goals.each do |goal|\n states = achieve(states, ops, goal, goal_stack)\n if !states\n return nil\n end\n end\n\n # We must ensure that we haven't removed a goal state in the process of\n # solving other states--having done so is called the \"prerequisite clobbers\n # sibling goal problem\".\n goals.each do |goal|\n if !states.include? goal\n return nil\n end\n end\n states\nend",
"def single_jumps(pos)\n poss_dir = []\n jumpable = (@dir == :up ? UP_DIRS : DOWN_DIRS)\n jumpable = DOWN_DIRS + UP_DIRS if king\n\n jumpable.each do |dir|\n jumped_pos = add_dir(pos, dir)\n new_pos = add_2_dir(pos, dir)\n if @board.on_board?(new_pos)\n enemy = @board[*jumped_pos]\n\n poss_dir << dir if (\n enemy &&\n enemy?(enemy) &&\n new_pos.all? { |i| (0..7).include?(i) } &&\n !@board[*new_pos]\n )\n end\n end\n\n poss_dir\n end",
"def goto(*args)\n # Make reference to the fsm attributes.\n next_state_sig = @next_state_sig\n states = @states\n # Add the code of the goto to the working state.\n @work_state.gotos << proc do\n # Depending on the first argument type.\n unless args[0].is_a?(Symbol) then\n # expr + names arguments.\n # Get the predicate\n pred = args.shift\n # hif or hcase?\n if args.size <= 2 then\n # 2 or less cases, generate an hif\n arg = args.shift\n hif(pred) do\n next_state_sig <=\n (states.detect { |st| st.name == arg }).value\n end\n arg = args.shift\n if arg then\n # There is an else.\n helse do\n next_state_sig <=\n (states.detect { |st| st.name == arg }).value\n end\n end\n else\n # More than 2, generate a hcase\n hcase (pred)\n args[0..-2].each.with_index do |arg,i|\n # Ensure the argument is a symbol.\n arg = arg.to_sym\n # Make the when statement.\n hwhen(i) do\n next_state_sig <= \n (states.detect { |st| st.name == arg }).value\n end\n end\n # The last name is the default case.\n # Ensure it is a symbol.\n arg = args[-1].to_sym\n # Make the default statement.\n helse do\n next_state_sig <= \n (states.detect { |st| st.name == arg }).value\n end\n end\n else\n # single name argument, check it.\n raise AnyError, \"Invalid argument for a goto: if no expression is given only a single name can be used.\" if args.size > 1\n # Ensure the name is a symbol.\n name = args[0].to_sym\n # Get the state with name.\n next_state_sig <= (states.detect { |st| st.name == name }).value\n end\n end\n end",
"def reaches_state(start_state, target_state, states)\n if ((start_state).equal?(target_state))\n states.add(target_state)\n # System.out.println(\"found target DFA state \"+targetState.getStateNumber());\n @state_reachable.put(start_state.attr_state_number, REACHABLE_YES)\n return true\n end\n s = start_state\n # avoid infinite loops\n @state_reachable.put(s.attr_state_number, REACHABLE_BUSY)\n # look for a path to targetState among transitions for this state\n # stop when you find the first one; I'm pretty sure there is\n # at most one path to any DFA state with conflicting predictions\n i = 0\n while i < s.get_number_of_transitions\n t = s.transition(i)\n edge_target = t.attr_target\n target_status = @state_reachable.get(edge_target.attr_state_number)\n if ((target_status).equal?(REACHABLE_BUSY))\n # avoid cycles; they say nothing\n i += 1\n next\n end\n if ((target_status).equal?(REACHABLE_YES))\n # return success!\n @state_reachable.put(s.attr_state_number, REACHABLE_YES)\n return true\n end\n if ((target_status).equal?(REACHABLE_NO))\n # try another transition\n i += 1\n next\n end\n # if null, target must be REACHABLE_UNKNOWN (i.e., unvisited)\n if (reaches_state(edge_target, target_state, states))\n states.add(s)\n @state_reachable.put(s.attr_state_number, REACHABLE_YES)\n return true\n end\n i += 1\n end\n @state_reachable.put(s.attr_state_number, REACHABLE_NO)\n return false # no path to targetState found.\n end",
"def extract_target_nodes_from_path(visited_nodes)\n connected_to(visited_nodes.last).select do |node|\n i = visited_nodes.index(node) \n i && (unvisited_neighbours_of(visited_nodes[i + 1], visited_nodes).length > 0)\n end\n end",
"def address\n case target\n when '$'\n jump_forever\n when Label\n jump_to_negative_relative_offset(target.offset)\n else\n raise UnknownAddressError, \"Unknown address for #{target} target.\"\n end\n end",
"def util_targetselection_get_possible(launcher,skill)\n if launcher.position < 0\n arr = []\n util_targetselection_adjacent_pokemon(launcher).each do |target|\n arr << target if seviper_zangoose_detect(launcher, target)\n end\n return arr if arr.size > 0\n end\n case skill.target\n when :adjacent_pokemon # eo eo ex / ux ao ax\n return util_targetselection_adjacent_pokemon(launcher)\n when :adjacent_foe # eo eo ex / ux ax ax\n return util_targetselection_adjacent_foe(launcher)\n when :user_or_adjacent_ally # ex ex ex / uo ao ax\n return [launcher]+util_targetselection_adjacent_ally(launcher)\n when :adjacent_ally # ex ex ex / ux ao ax\n return util_targetselection_adjacent_ally(launcher)\n when :any_other_pokemon # ex ex ex / uo ax ax\n arr = ::BattleEngine.get_enemies!(launcher)\n arr += util_targetselection_adjacent_ally(launcher)\n return arr\n end\n return nil\n end",
"def mipsHasShiftedBaseIndexAddress(instruction)\n instruction.operands.each_with_index {\n | operand, index |\n if operand.is_a? BaseIndex and operand.scaleShift != 0\n return index\n end\n }\n -1\nend",
"def find_reachable(start, avoid_sectors = nil, maxcost = nil)\n all_paths(start,avoid_sectors,maxcost)\n end",
"def perform_moves! move_sequence\n move_sequence.each do |target_position| \n if valid_jump?(target_position) \n perform_jump(target_position)\n else\n raise InvalidMoveError, 'Move sequence in invalid'\n end\n end\n end",
"def get_a_target(char, targets)\n # check trigger condition\n case @condition\n when TRGHP # HP condition\n # for each possible target\n targets.each {|b|\n # get comparator string\n comparator = Cache::TRGComparators[@comparator]\n # evaluate condition\n if eval(\"b.battler.hp * 100 / b.battler.maxhp #{comparator} @value\")\n # this target fulfills the condition\n return b\n end}\n when TRGSP # SP condition\n # for each possible target\n targets.each {|b|\n # get comparator string\n comparator = Cache::TRGComparators[@comparator]\n # evaluate condition\n if eval(\"b.battler.sp * 100 / b.battler.maxsp #{comparator} @value\")\n # this target fulfills the condition\n return b\n end}\n when TRGState # State condition\n # if no state condition\n if @value == 0\n # find a target that has no states\n targets.each {|b| return b if b.battler.states.size == 0}\n else\n # find a target with the condition state\n targets.each {|b| return b if b.battler.states.include?(@value)}\n end\n when TRGLocation # Location condition\n # temporary variable\n pix = $BlizzABS.pixel\n # sort all targets by relative distance ascending\n targets.sort! {|a, b|\n Math.hypot(char.x / pix - a.x / pix, char.y / pix - a.y / pix) <=>\n Math.hypot(char.x / pix - b.x / pix, char.y / pix - b.y / pix)}\n # return the requested battler\n return case @value\n when TRGClosest then targets[0]\n when TRGFarthest then targets[targets.size - 1]\n end\n end\n # this trigger has not been activated\n return nil\n end",
"def skip_rule_targets\n targets = skip_rules.map { |r| r.dest_item || :end }.uniq\n targets.sort_by! { |t| t == :end ? [1e9] : t.full_rank }\n targets.map { |t| t == :end ? h.t(\"skip_rule.end\") : \"##{t.full_dotted_rank}\" }\n end",
"def finish_step?\n return !goto_true && !goto_false\n end",
"def possible_cell_solution(x, y)\n negation_solution(x, y) ||\n possibilities_minus_exclusions_solution(x, y) ||\n distant_neighbor_negations_solution(x, y)\n end",
"def find_path(source, target, map)\n @main_loop_count = 0\n\n max_y = map.size - 1\n max_x = map[0].size - 1\n target_x = target[0]\n target_y = target[1]\n # target heuristic is 0\n target = [target_x, target_y, 0]\n\n # Sets up the search to begin from the source\n source = source.dup.push((target_x - source[0]).abs + (target_y - source[1]).abs)\n came_from = {}\n came_from[source] = nil\n frontier = [source]\n\n # Until the target is found or there are no more cells to explore from\n until came_from.has_key?(target) || frontier.empty?\n @main_loop_count += 1\n\n # Take the next frontier cell\n new_frontier = frontier.shift\n\n # Find the adjacent neighbors\n adjacent_neighbors = []\n\n # Gets all the valid adjacent_neighbors into the array\n # From southern neighbor, clockwise\n nfx = new_frontier[0]\n nfy = new_frontier[1]\n adjacent_neighbors << [nfx , nfy - 1, (target_x - nfx).abs + (target_y - nfy + 1).abs] unless nfy == 0\n adjacent_neighbors << [nfx - 1, nfy - 1, (target_x - nfx + 1).abs + (target_y - nfy + 1).abs] unless nfx == 0 || nfy == 0\n adjacent_neighbors << [nfx - 1, nfy , (target_x - nfx + 1).abs + (target_y - nfy).abs] unless nfx == 0\n adjacent_neighbors << [nfx - 1, nfy + 1, (target_x - nfx + 1).abs + (target_y - nfy - 1).abs] unless nfx == 0 || nfy == max_y\n adjacent_neighbors << [nfx , nfy + 1, (target_x - nfx).abs + (target_y - nfy - 1).abs] unless nfy == max_y\n adjacent_neighbors << [nfx + 1, nfy + 1, (target_x - nfx - 1).abs + (target_y - nfy - 1).abs] unless nfx == max_x || nfy == max_y\n adjacent_neighbors << [nfx + 1, nfy , (target_x - nfx - 1).abs + (target_y - nfy).abs] unless nfx == max_x\n adjacent_neighbors << [nfx + 1, nfy - 1, (target_x - nfx - 1).abs + (target_y - nfy + 1).abs] unless nfx == max_x || nfy == 0\n\n new_neighbors = adjacent_neighbors.select do |neighbor|\n # That have not been visited and are not walls\n unless came_from.has_key?(neighbor) || map[neighbor[1]][neighbor[0]] != '.'\n # Add them to the frontier and mark them as visited\n # frontier << neighbor\n came_from[neighbor] = new_frontier\n end\n end\n\n # Sort the frontier so cells that are close to the target are then prioritized\n if new_neighbors.length > 0\n new_neighbors = merge_sort(new_neighbors)\n if frontier.length > 0 && new_neighbors[0][2] >= frontier[0][2]\n frontier = merge_sort(new_neighbors.concat(frontier))\n else\n frontier = new_neighbors.concat(frontier)\n end\n end\n end\n\n # If the search found the target\n if came_from.has_key?(target)\n # Calculates the path between the target and star for the greedy search\n # Only called when the greedy search finds the target\n path = []\n next_endpoint = came_from[target]\n while next_endpoint\n path << [next_endpoint[0], next_endpoint[1]]\n next_endpoint = came_from[next_endpoint]\n end\n path\n else\n return nil\n end\n end",
"def can_attack?( target )\n not @finished and targets.include?( target )\n end",
"def jump_forward(power=1)\n jump(0, power) if @direction == 2 \n jump(- power, 0) if @direction == 4\n jump(power, 0) if @direction == 6 \n jump(0, - power) if @direction == 8 \n end",
"def gettarget(pc, op)\n x = field_x(op)\n hibits = (pc + 4) & 0xf0000000\n lobits = x << 2\n\n (hibits | lobits)\nend",
"def targets(install)\n install = !!install\n @cache[\"targets\"].select do |key, target|\n target[\"install\"] == install\n end.map(&:first)\n end",
"def instruction\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n instruction_start_index = @input.index\n put_ingredient_into_mixing_bowl1 = nil\n liquefy_mixing_bowl2 = nil\n pour_contents_into_baking_dish3 = nil\n fold_ingredient_into_mixing_bowl4 = nil\n clean_the_mixing_bowl5 = nil\n take_ingredient_from_refrigerator6 = nil\n remove_ingredient_from_mixing_bowl7 = nil\n refrigerate_for_hours8 = nil\n add_ingredient_to_mixing_bowl9 = nil\n serve_with10 = nil\n mix_the_mixing_bowl_well11 = nil\n combine_ingredient_into_mixing_bowl12 = nil\n stir_mixing_bowl13 = nil\n stir_ingredient_into_the_mixing_bowl14 = 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 value\n end\n # at line 36:3: ( put_ingredient_into_mixing_bowl | liquefy_mixing_bowl | pour_contents_into_baking_dish | fold_ingredient_into_mixing_bowl | clean_the_mixing_bowl | take_ingredient_from_refrigerator | remove_ingredient_from_mixing_bowl | refrigerate_for_hours | add_ingredient_to_mixing_bowl | serve_with | set_aside | mix_the_mixing_bowl_well | combine_ingredient_into_mixing_bowl | divide_ingredient_into_mixing_bowl | stir_mixing_bowl | stir_ingredient_into_the_mixing_bowl )\n alt_1 = 16\n alt_1 = @dfa1.predict( @input )\n case alt_1\n when 1\n # at line 36:5: put_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_put_ingredient_into_mixing_bowl_IN_instruction_83 )\n put_ingredient_into_mixing_bowl1 = put_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = put_ingredient_into_mixing_bowl1\n \n # <-- action\n end\n\n when 2\n # at line 39:5: liquefy_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_liquefy_mixing_bowl_IN_instruction_91 )\n liquefy_mixing_bowl2 = liquefy_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = liquefy_mixing_bowl2\n \n # <-- action\n end\n\n when 3\n # at line 42:5: pour_contents_into_baking_dish\n @state.following.push( TOKENS_FOLLOWING_pour_contents_into_baking_dish_IN_instruction_99 )\n pour_contents_into_baking_dish3 = pour_contents_into_baking_dish\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = pour_contents_into_baking_dish3\n \n # <-- action\n end\n\n when 4\n # at line 45:5: fold_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_fold_ingredient_into_mixing_bowl_IN_instruction_107 )\n fold_ingredient_into_mixing_bowl4 = fold_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = fold_ingredient_into_mixing_bowl4\n \n # <-- action\n end\n\n when 5\n # at line 48:5: clean_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_clean_the_mixing_bowl_IN_instruction_115 )\n clean_the_mixing_bowl5 = clean_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = clean_the_mixing_bowl5\n \n # <-- action\n end\n\n when 6\n # at line 51:5: take_ingredient_from_refrigerator\n @state.following.push( TOKENS_FOLLOWING_take_ingredient_from_refrigerator_IN_instruction_123 )\n take_ingredient_from_refrigerator6 = take_ingredient_from_refrigerator\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = take_ingredient_from_refrigerator6\n \n # <-- action\n end\n\n when 7\n # at line 54:5: remove_ingredient_from_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_remove_ingredient_from_mixing_bowl_IN_instruction_131 )\n remove_ingredient_from_mixing_bowl7 = remove_ingredient_from_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = remove_ingredient_from_mixing_bowl7\n \n # <-- action\n end\n\n when 8\n # at line 57:5: refrigerate_for_hours\n @state.following.push( TOKENS_FOLLOWING_refrigerate_for_hours_IN_instruction_139 )\n refrigerate_for_hours8 = refrigerate_for_hours\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = refrigerate_for_hours8\n \n # <-- action\n end\n\n when 9\n # at line 60:5: add_ingredient_to_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_add_ingredient_to_mixing_bowl_IN_instruction_147 )\n add_ingredient_to_mixing_bowl9 = add_ingredient_to_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = add_ingredient_to_mixing_bowl9\n \n # <-- action\n end\n\n when 10\n # at line 63:5: serve_with\n @state.following.push( TOKENS_FOLLOWING_serve_with_IN_instruction_155 )\n serve_with10 = serve_with\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = serve_with10\n \n # <-- action\n end\n\n when 11\n # at line 66:5: set_aside\n @state.following.push( TOKENS_FOLLOWING_set_aside_IN_instruction_163 )\n set_aside\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $serve_with.value\n \n # <-- action\n end\n\n when 12\n # at line 69:5: mix_the_mixing_bowl_well\n @state.following.push( TOKENS_FOLLOWING_mix_the_mixing_bowl_well_IN_instruction_171 )\n mix_the_mixing_bowl_well11 = mix_the_mixing_bowl_well\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = mix_the_mixing_bowl_well11\n \n # <-- action\n end\n\n when 13\n # at line 72:5: combine_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_combine_ingredient_into_mixing_bowl_IN_instruction_179 )\n combine_ingredient_into_mixing_bowl12 = combine_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = combine_ingredient_into_mixing_bowl12\n \n # <-- action\n end\n\n when 14\n # at line 75:5: divide_ingredient_into_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_divide_ingredient_into_mixing_bowl_IN_instruction_187 )\n divide_ingredient_into_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = $stir_ingredient_into_the_mixing_bowl.value\n \n # <-- action\n end\n\n when 15\n # at line 78:5: stir_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_mixing_bowl_IN_instruction_195 )\n stir_mixing_bowl13 = stir_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_mixing_bowl13\n \n # <-- action\n end\n\n when 16\n # at line 81:5: stir_ingredient_into_the_mixing_bowl\n @state.following.push( TOKENS_FOLLOWING_stir_ingredient_into_the_mixing_bowl_IN_instruction_203 )\n stir_ingredient_into_the_mixing_bowl14 = stir_ingredient_into_the_mixing_bowl\n @state.following.pop\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n value = stir_ingredient_into_the_mixing_bowl14\n \n # <-- action\n end\n\n end\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__, 1 )\n memoize( __method__, instruction_start_index, success ) if @state.backtracking > 0\n\n end\n \n return value\n end",
"def branches\n bodies = in_pattern_branches.map(&:body)\n if else?\n # `empty-else` node sets nil because it has no body.\n else_branch.empty_else_type? ? bodies.push(nil) : bodies.push(else_branch)\n end\n bodies\n end",
"def valid_target? to\n get_target_branches.include?(to)\n end",
"def include_targets\n return @include_targets\n end",
"def perform_jump(end_pos)\n return false unless valid_jump?(end_pos)\n\n move!(end_pos)\n true\n end"
] | [
"0.60971874",
"0.57072026",
"0.54731196",
"0.5463928",
"0.542189",
"0.54170716",
"0.5333465",
"0.5186872",
"0.5158692",
"0.51487714",
"0.51413506",
"0.5115128",
"0.5099682",
"0.50930494",
"0.50517195",
"0.50358087",
"0.50358087",
"0.5018309",
"0.50063866",
"0.49908605",
"0.49875206",
"0.49719656",
"0.49533105",
"0.4952134",
"0.4944823",
"0.49401906",
"0.49319252",
"0.49192768",
"0.49135026",
"0.49127844",
"0.49075866",
"0.49048817",
"0.48908308",
"0.48893645",
"0.48778266",
"0.48733485",
"0.48719537",
"0.48652986",
"0.486409",
"0.4851973",
"0.48357412",
"0.48349085",
"0.4834634",
"0.4834634",
"0.4834634",
"0.48338354",
"0.48124376",
"0.4796848",
"0.4796276",
"0.4791977",
"0.47890747",
"0.47757122",
"0.47683612",
"0.4765461",
"0.47635567",
"0.474411",
"0.47422367",
"0.4726642",
"0.47208884",
"0.47108898",
"0.471049",
"0.47074032",
"0.47058022",
"0.4689977",
"0.46715045",
"0.4671285",
"0.46617937",
"0.46490988",
"0.46393996",
"0.46322116",
"0.46225333",
"0.4612821",
"0.4611168",
"0.46105385",
"0.4609584",
"0.4604112",
"0.45991975",
"0.45973715",
"0.45973396",
"0.45970574",
"0.45950326",
"0.4593237",
"0.45914197",
"0.4582738",
"0.45743135",
"0.4571044",
"0.4552928",
"0.4545245",
"0.45437148",
"0.4543676",
"0.45422745",
"0.4540563",
"0.4529076",
"0.4515848",
"0.45103264",
"0.45098212",
"0.4493635",
"0.44867036",
"0.4477941",
"0.44703624"
] | 0.5698439 | 2 |
Find the basic blocks in an array of instructions. | def basic_blocks(insns)
# Jump and branch targets give us the start of each basic block.
targets = targets(insns)
# Create a basic block for each jump or branch target.
blocks = {}
targets.each_with_index do |start, index|
# Slice the instructions that form this block by looking for where
# the next block starts.
if index == targets.size - 1
last = insns.size
else
last = targets[index + 1]
end
block_insns = insns.slice(start, last - start)
last_insn = block_insns.last
# Create an array for the previous basic blocks, but we'll fill it
# in later.
prev_blocks = []
# Look at the last instruction and its targets to see what the next
# possible basic blocks are.
next_blocks = []
next_blocks.push last_insn[1] if [:jump, :branch].include?(last_insn.first)
next_blocks.push targets[index + 1] unless [:jump, :return].include?(last_insn.first)
blocks[start] = BasicBlock.new(start, block_insns, prev_blocks, next_blocks)
end
# No go back and use the information about the basic blocks following
# each block to store the reverse - the basic blocks previous to each
# block.
blocks.values.each do |block|
block.next.each do |n|
blocks[n].prev.push block.start
end
end
blocks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blocks\n @block_stacks.map { |candidates| candidates&.first }\n end",
"def basic_blocks\n @basic_block_collection ||= BasicBlockCollection.new(self)\n end",
"def get_blocks\n if (branches = @cur_state.branches[@tape.val])\n branches.map { |branch| branch.block } \n else\n [@cur_state.default]\n end\n end",
"def basic_blocks\n cfg.blocks\n end",
"def by_basic_block(bb, level)\n assert(\"RelationNodeList#by_basic_block: level != :src,:dst\") { [:src,:dst].include?(level) }\n lookup(@basic_block_index[level], bb, \"#{level}-block\", false) || []\n end",
"def find_instructions\n @input.each_with_index do |line,i|\n if line.instruction?\n @instructions << i+1\n end\n end\n end",
"def _get_code_blocks(contents)\n code_blocks = []\n code_block = contents.slice(REGEX)\n if (!code_block.nil?)\n code_blocks << code_block\n while code_block = $'.slice(REGEX)\n code_blocks << code_block\n end\n end\n code_blocks\n end",
"def blocks\n @blocks ||= []\n end",
"def blank_blocks(filter = writable_mifare_blocks, blks = Array.new(16, 0))\n filter.map do |x|\n [x, blks]\n end\n end",
"def blocks\n unless defined?(@blocks)\n bs = block_sizes\n qst = query.starts\n tst = target.starts\n qseqs = query.seqs\n tseqs = target.seqs\n @blocks = (0...block_count).collect do |i|\n SegmentPair.new(query.size, strand, bs[i],\n qst[i], tst[i], qseqs[i], tseqs[i])\n end\n end\n @blocks\n end",
"def get_blocks(options = {block_range: (0..0)}, &block)\n get_block_objects(options.merge(object: :block), block)\n end",
"def blocks\n @blocks ||= []\n end",
"def findBlock(pieceIndex, offset, length)\n leftOffset = @pieceSize*pieceIndex + offset\n rightOffset = leftOffset + length-1\n\n findPart(leftOffset, rightOffset)\n end",
"def get_blocks\n @blocks ||= Block.find :all, :conditions => { :show_in_all => '' }\n end",
"def locate_matching_blocks\n @matching_blocks = matching_sdiff_segments.map do |segment|\n create_match_from(segment)\n end\n\n # an empty match at the end forces the loop to make operations to handle\n # the unmatched tails I'm sure it can be done more gracefully, but not at\n # 23:52\n @matching_blocks << HTMLDiff::Match.new(@old_words.size,\n @new_words.size, 0)\n end",
"def calculate_blocks(s, start_i, end_i, *operators)\n # The reason you do this is because on the final pass, Rs won't me removed\n # before it does one last run, often Rs replace brackets and any number\n # multiplied by R is 0\n # If you don't remove the useless elements it all fucks up\n # IF SOMETHING IS NOT DELETED, UNCOMMENT THIS\n s.delete(\"R\")\n op_index = \"\"\n get_logger.debug(\"Calculating formula blocks with operators #{operators} in range #{start_i}..#{end_i} of #{s}\")\n (start_i..end_i).each.with_index(start_i) { |i|\n v = s[i]\n get_logger.debug(\"Checking index #{i} in array, value present #{v}\")\n # First check if operator is valid, this is done to conform to PEDMAS\n if CalcParser.includes_operator(*operators, v)\n op = CalcParser.extract_operator(v)[0]\n get_logger.debug(\"Found operator '#{op}'\")\n if CalcParser.is_scientific_formula(v)\n # Since a scientific formula can have anything in the brackets, we need\n # check inside for a formula, recursive again\n v = v.delete_prefix(CalcParser.extract_prefix(v)[0]).delete_suffix(\")\")\n v = CalcParser.parse(v)\n # Pow uses a special format\n if op == \"pow\"\n s[i] = get_result(op, v[0].to_f, v[1].to_f)\n else\n perform_pedmas(v, 0, v.length - 1)\n s[i] = get_result(op, v[0].to_f)\n end\n next\n end\n if CalcParser.is_square(v)\n number = CalcParser.extract_number(v)[0].to_f\n # There are two situations where ^ can appear, x^ or (x*x)^, we check for both\n # since the parser don't care\n if number == 0\n number = s[i - 1].to_f\n s[i - 1] = \"R\"\n end\n s[i] = get_result(op, number)\n next\n end\n # We just assume that it's standard left and right operand operations at this point, maybe safe?\n left_operand, right_operand = assign_operands(s, i)\n # Important check, makes sure that there are no double or missing operators. Needs tidied and debug messages added\n if !CalcParser.is_number(left_operand) or !CalcParser.is_number(right_operand)\n exit\n end\n # Replaces the operator found with the answer found using the left and right operator\n s[i - 1] = \"R\"\n s[i + 1] = \"R\"\n result = get_result(op, left_operand.to_f, right_operand.to_f)\n get_logger.debug(\"Replace operator '#{v}' at index '#{op_index}' with result '#{result}'\")\n s[i] = result\n break\n end\n }\nend",
"def xml_blocks\n %w(start_blocks toolbox_blocks required_blocks recommended_blocks)\n end",
"def process_blocks(blocks); end",
"def first\n ptr = C.LLVMGetFirstBasicBlock(@fun)\n BasicBlock.from_ptr(ptr) unless ptr.null?\n end",
"def find_matching_blocks( key )\n\t\treturn self.class.routes.inject([]) do |accum, (re, re_blocks)|\n\t\t\taccum += re_blocks if re.match( key )\n\t\t\taccum\n\t\tend\n\tend",
"def get_blocks\n @blocks\n end",
"def each\n return to_enum :each unless block_given?\n\n ptr = C.LLVMGetFirstBasicBlock(@fun)\n 0.upto(size-1) do |i|\n yield BasicBlock.from_ptr(ptr)\n ptr = C.LLVMGetNextBasicBlock(ptr)\n end\n\n self\n end",
"def exec_blocks(blocks)\n blocks.map { |block| exec_commands(block.commands) }.compact || []\n end",
"def basic_block_to_fragment(insns, ip=0, profile=nil)\n # Basic blocks start with a merge node.\n\n merge = Node.new(:merge)\n\n # We're going to build up a list of names and stack values coming into\n # this basic block that we're going to need to connect up later when\n # we form a complete graph.\n\n names_in = {}\n stack_in = []\n\n # Create an initial deoptimisation map.\n\n deopt_map = FrameStateBuilder.new(insns, ip, names_in.dup, stack_in.dup)\n\n last_node = nil\n last_control = merge\n\n # We're also going to build up a list of names and stack values that\n # are available when this basic block is finished.\n\n names = {}\n stack = []\n\n # When we pop a value off the stack, we may be using a value that\n # wasn't created within this basic block - the value could have been\n # expected to be on the stack already. This proc tries to pop a value\n # off the basic block's stack, but if there isn't one, it then\n # records that the basic block will need another stack value coming in\n # and creates an unconnected value to represent that, called an input\n # node.\n\n pop = proc {\n if stack.empty?\n input = Node.new(:connector)\n stack_in.unshift input\n input\n else\n stack.pop\n end\n }\n\n # Go through each instruction in the basic block, and perform a kind\n # of abstract interpretation on it. This loop looks a lot like the one\n # in the interpreter. The difference here is that we don't deal with\n # real values, instead we deal with an abstraction of the values that\n # will be there in the future. It's somewhat like computing with\n # promises that are never fulfilled. It's simpler than it sounds\n # because as this is a basic block the control flow is simple - it's a\n # linear sequence of instructions with no branches. For each\n # instruction we create a graph node that represents the computation\n # on the abstract values. We build a backbone of linear control flow\n # through the instructions by linking each instruction that has some\n # kind of side effect to the previous instruction with a side effect.\n\n insns.each_with_index do |insn, n|\n case insn.first\n when :trace\n last_node = Node.new(:trace, line: insn[1])\n when :self\n last_node = Node.new(:self)\n stack.push last_node\n when :arg\n last_node = Node.new(:arg, n: insn[1])\n stack.push last_node\n when :load\n name = insn[1]\n value = names[name]\n unless value\n\n # Like the pop proc, if we don't find that a name has been set\n # in this basic block, we remember that we need it as an input\n # and create an input node to represent its future value.\n\n input = Node.new(:connector)\n names_in[name] = input\n names[name] = input\n value = input\n end\n stack.push value\n when :store\n names[insn[1]] = pop.call\n when :push\n last_node = Node.new(:constant, value: insn[1])\n stack.push last_node\n when :send\n name = insn[1]\n argc = insn[2]\n send_node = Node.new(:send, name: name, argc: argc)\n argc.times do |n|\n arg_node = pop.call\n arg_node.output_to :value, send_node, :\"arg(#{argc-n-1})\"\n end\n receiver_node = pop.call\n receiver_node.output_to :value, send_node, :receiver\n if profile\n send_node.props[:profile] = profile.sends[ip + n]\n end\n stack.push send_node\n last_node = send_node\n when :not\n value_node = pop.call\n not_node = Node.new(:not)\n value_node.output_to :value, not_node\n stack.push not_node\n last_node = not_node\n when :jump\n jump_node = Node.new(:jump)\n last_node = jump_node\n when :branch\n value_node = pop.call\n branch_node = Node.new(:branch)\n value_node.output_to :value, branch_node, :condition\n last_node = branch_node\n when :return\n last_node = pop.call\n stack.push last_node\n else\n raise 'unknown instruction'\n end\n\n # Does this instruction need a deoptimisation map becuase it could deoptimise?\n\n if @build_deopt_maps && [:send].include?(insn.first)\n # Create a deoptimisation map node?\n \n deopt_map_node = Node.new(:deopt_map, insns: deopt_map.insns, ip: deopt_map.ip)\n\n # Send the value of the receiver to it.\n\n Node.new(:self).output_to :value, deopt_map_node, :receiver\n\n # Send the value of all arguments to it.\n\n args = insns.select { |i| i.first == :arg }.map { |i| i[1] }\n\n if args.empty?\n args_count = 0\n else\n args_count = args.max + 1\n end\n\n args_count.times do |n|\n Node.new(:arg, n: n).output_to :value, deopt_map_node, :\"arg(#{n})\"\n end\n \n # Send the value of all names to it.\n\n deopt_map.names.each_pair do |name, value|\n value.output_to :value, deopt_map_node, name\n end\n \n # Send all values on the stack to it.\n\n deopt_map.stack.each_with_index do |value, index|\n value.output_to :value, deopt_map_node, :\"stack(#{index})\"\n end\n \n # Add the deoptimisation map to the instruction by adding a special edge.\n\n deopt_map_node.output_to :deopt_map, last_node\n end\n\n # The trace and send instructions have side effects - link them into\n # the backbone of control flow so that we know one instruction with\n # side effects needs to happen before any other after it. The jump and\n # branch instructions could or could not be seen as side effects. We\n # treat them so because it seems to make this easier.\n\n if [:trace, :send, :jump, :branch].include?(insn.first)\n last_control.output_to :control, last_node\n last_control = last_node\n end\n\n # If this instruction potentially has side-effects, create a new\n # deoptimisation map for the state after the instruction.\n\n if [:send].include?(insn.first)\n deopt_map = FrameStateBuilder.new(insns, ip + n + 1, names.dup, stack.dup)\n end\n end\n\n GraphFragment.new(names_in, stack_in, merge, last_node, last_control, names, stack)\n end",
"def iter_to_block_commands(iter)\n if iter[3].is_a?(Array) && iter[3].first == :block\n iter[3][1..-1]\n else\n [iter[3]]\n end\n end",
"def decode_blocks(base_addr=0, eip=base_addr)\n sc = Metasm::Shellcode.decode(self, @@cpu)\n sc.base_addr = base_addr\n sc.disassemble(eip)\n end",
"def blocklists; end",
"def find_nodes(*ops)\n found = []\n visit_nodes do |node|\n if ops.empty? || ops.include?(node.op)\n if !block_given? || yield(node)\n found.push node\n end\n end\n end\n found\n end",
"def get_block_names\n @blocks.keys\n end",
"def anonymous_blocklists; end",
"def matching_compound_members(procs_array)\n procs_array.map do |some_proc|\n # collect each proc operation\n matching_members(&some_proc)\n end.inject(self) do |memo,matches| \n # find all the intersections, starting with self\n # and whittling down until we only have members \n # that have matched every proc\n memo & matches\n end\n end",
"def setup_blocks\n @setup_blocks ||= []\n end",
"def each(&block)\n bits.each(&block)\n end",
"def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end",
"def get_record_blocks\n\n blocks = []\n current_block = nil\n\n File.readlines(@file).each do |l|\n\n # start of a new aragorn result\n if l =~ /^Location \\[(\\d+),(\\d+)\\]$/\n\n if current_block\n blocks << parse_block(current_block)\n current_block = []\n else \n current_block = Array.new\n end\n end\n\n if current_block\n current_block << l\n end \n\n end\n unless current_block.nil?\n blocks << parse_block(current_block)\n end\n\n return blocks\n end",
"def parse_block_extensions; end",
"def first\n ptr = C.LLVMGetFirstInstruction(@block)\n LLVM::Instruction.from_ptr(ptr) unless ptr.null?\n end",
"def for_each_in(array, &instructions)\n for i in 0...array.length\n instructions.call(array[i])\n end\nend",
"def sexp_provide_block\n program = sexp[1]\n\n program.each do |s|\n if s[0] == :method_add_block and\n s[1][0] == :command_call and\n s[1][1][0] == :method_add_arg and\n s[1][1][1][0] == :call and\n s[1][1][1][1][0] == :const_path_ref and\n s[1][1][1][1][1][0] == :var_ref and\n s[1][1][1][1][1][1][0..1] == [:@const, \"Puppet\"] and\n s[1][1][1][1][2][0..1] == [:@const, \"Type\"] and\n s[1][1][1][3][0..1] == [:@ident, \"type\"] and\n s[2][0] == :do_block\n\n return s[2][2]\n end\n end\n\n []\n end",
"def extract_code_blocks\n body.match /```([a-z]+)?\\n(.*)\\n```/\n end",
"def linearize(graph)\n # The basic blocks.\n blocks = []\n \n # Details of the basic block that contain the finish operation which\n # won't be added to the list of basic blocks until the end.\n first_node_last_block = nil\n last_block = nil\n \n # Two maps that help us map between nodes and the names of the blocks\n # that they go into, and the merge instruction indicies and the blocks\n # they're coming from.\n first_node_to_block_index = {}\n merge_index_to_first_node = {}\n\n # Look at each node that begins a basic block.\n\n basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }\n\n last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first\n\n basic_block_starters.delete last_basic_block_starter\n basic_block_starters.push last_basic_block_starter\n\n basic_block_starters.each do |node|\n original_first_node = node\n first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))\n\n # We're going to create an array of operations for this basic\n # block.\n\n block = []\n next_to_last_control = nil\n\n # Follow the local sequence.\n\n node = first_node\n\n begin\n # We don't want to include operations that are just there to form\n # branches or anchor points in the graph such as start and merge.\n\n unless [:start, :merge].include?(node.op)\n op = node.op\n\n # We rename finish to return to match the switch from the\n # declarative style of the graph to the imperative style\n # of the list of operations.\n op = :return if op == :finish\n\n # The instruction begins with the operation.\n insn = [op]\n\n # Then any constant values or similar.\n [:line, :n, :value].each do |p|\n insn.push node.props[p] if node.props.has_key?(p)\n end\n\n # Then any input registers.\n node.inputs.with_input_name(:value).from_nodes.each do |input_values|\n insn.push input_values.props[:register]\n end\n\n # Phi instructions need pairs of source registers with the blocks they came from.\n if node.op == :phi\n node.inputs.edges.each do |input|\n if input.input_name =~ /^value\\((.+)\\)$/\n n = $1.to_i\n insn.push n\n insn.push input.from.props[:register]\n end\n end\n # Elide phi instructions if register allocation has run correctly and values are\n # already in the correct registers.\n insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1\n end\n\n # Send instructions and lowered equivalents need the arguments.\n if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n if node.op == :send\n insn.push node.props[:name]\n elsif node.op == :call_managed\n insn.push node.inputs.with_input_name(:name).from_node.props[:register]\n end\n\n node.props[:argc].times do |n|\n arg = node.inputs.with_input_name(:\"arg(#{n})\").from_node\n\n if arg.op == :immediate\n insn.push arg.props[:value]\n else\n insn.push arg.props[:register]\n end\n end\n end\n\n # Then the target register if the instruction has one.\n insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)\n\n # If it's a branch then the target basic blocks and the test.\n if node.op == :branch\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n\n [:true, :false].each do |branch|\n target = node.outputs.with_output_name(branch).to_node\n raise unless target\n insn.push target\n end\n\n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Send instructions and lowered managed calls need the list of live registers.\n if [:send, :call_managed].include?(node.op)\n insn.push node.props[:live_registers]\n end\n \n # Guards are like branches, but only have one side.\n if node.op == :guard\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n \n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Kind instructions need the kind.\n if node.op == :kind_is?\n insn.push node.props[:kind]\n end\n \n # Frame states need the instructions, the ip, and to know where values are for\n # the receiver, the arguments, and the stack.\n if node.op == :deopt_map\n insn.push node.props[:insns]\n insn.push node.props[:ip]\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|\n /arg\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|\n /stack\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n end\n\n # Add the instruction to the block.\n block.push insn if insn\n end\n\n next_to_last_control = node if node.has_control_output?\n\n # Follow the local schedule edge to the next node.\n node = node.outputs.with_output_name(:local_schedule).to_nodes.first\n end while node && node.op != :merge\n\n # Empty blocks cause problems elsewhere - it's easier to just have a nop\n # in them. Really, we should remove empty blocks by modifying the\n # instruction that jumps here to jump to wherever this leads to.\n\n if block.empty?\n block.push [:nop]\n end\n\n # If the last node is a merge, we need to remember which merge index this is.\n\n if node && node.op == :merge\n next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\\((.+)\\)$/\n n = $1.to_i\n merge_index_to_first_node[n] = first_node\n end\n\n # Add a jump instruction if this block was going to just flow into the next\n # - we'll remove it later if the block followed it anyway and we can just\n # fallthrough.\n\n unless [:return, :branch].include?(block.last.first)\n begin\n block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]\n rescue\n block.push [:jump, :broken]\n end\n end\n\n first_node_to_block_index[original_first_node] = blocks.size\n first_node_to_block_index[first_node] = blocks.size\n blocks.push block\n end\n\n # Record the number that this basic block has and then add it to the list of basic blocks.\n\n first_node_to_block_index[first_node_last_block] = blocks.size\n\n # Go back through the basic blocks and update some references that were to things that\n # hadn't been decided yet.\n\n blocks.each do |block|\n block.each do |insn|\n insn.map! do |e|\n # If part of an instruction references a basic block, turn that into the index of\n # the basic block instead.\n\n if e.is_a?(IR::Node)\n :\"block#{first_node_to_block_index[e]}\"\n else\n e\n end\n end\n end\n end\n\n # Go back through the basic blocks and change how the branch instructions out of them\n # work.\n\n blocks.each_with_index do |block, n|\n next_block = :\"block#{n + 1}\"\n last = block.last\n\n if last == [:jump, next_block]\n # A jump that just goes to the next block can be removed and left to fall through.\n block.pop\n elsif last.first == :branch && last[3] == next_block\n # A branch where the else goes to the next block can branch only when true.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n elsif last.first == :branch && last[2] == next_block\n # A branch where the if goes to the next block can branch only unless true.\n block.pop\n test = last.drop(4)\n block.push [:branch_unless, last[1], last[3], *test]\n elsif last.first == :branch\n # A branch that doesn't go to the next block at all can be a branch if true\n # and then fallthrough to a new jump instruction.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n block.push [:jump, last[3]]\n end\n end\n\n blocks\n end",
"def generate_blocks(blocks_array)\r\n size=rand(1..3)\r\n index=0\r\n while blocks_array.length<size\r\n case rand(4)\r\n when 0\r\n blocks_array[index]=Obstacle.new(\"media/man.png\", :man)\r\n when 1\r\n blocks_array[index]=Obstacle.new(\"media/tree.png\", :tree)\r\n when 2\r\n blocks_array[index]=Obstacle.new(\"media/bird.png\", :bird)\r\n when 3\r\n blocks_array[index]=Obstacle.new(\"media/bird2.png\", :bird2)\r\n end\r\n\r\n index+=1\r\n end\r\n end",
"def split_blocks(array)\n array.inject( [ [] ] ) do |array_of_blocks, val|\n if val == -1\n array_of_blocks << [-1]\n array_of_blocks << [] \n else \n array_of_blocks[-1] << val\n end\n array_of_blocks\n end\nend",
"def get_block4(index)\n b1, b2, b3, *_ = _calculate_block_indices(index)\n return unless @block1[b1] && @block1[b1][b2]\n @block1[b1][b2][b3]\n end",
"def find_block(row,col)\n \n #Find block\n #--------------------------------\n case row\n when 0,1,2\n if col < 3\n\treturn 0\n elsif col < 6\n\treturn 1\n else \n\treturn 2\n end\n when 3,4,5\n if col < 3\n\treturn 3\n elsif col < 6\n\treturn 4\n else \n\treturn 5\n end \n else\n if col < 3\n\treturn 6\n elsif col < 6\n\treturn 7\n else \n\treturn 8\n end \n end \n end",
"def find_steps_defined_in_block(block)\r\n #log.debug \"#{block} #{block.class}\"\r\n block.each_with_index do |token,index|\r\n #log.debug \"Token #{token.class} #{token.text}\"\r\n if token.is_a?(YARD::Parser::Ruby::Legacy::RubyToken::TkCONSTANT) &&\r\n token.text =~ /^(given|when|then|and)$/i &&\r\n block[index + 2].is_a?(YARD::Parser::Ruby::Legacy::RubyToken::TkSTRING)\r\n log.debug \"Step found in Step Definition: #{block[index + 2].text} \"\r\n end\r\n\r\n end\r\n\r\n end",
"def block_splitter(array)\n answer_array = []\n\n answer_array << array.select { |word| word.yield }\n answer_array << array.reject { |word| word.yield }\n\n return answer_aray\nend",
"def find_all(template, &b)\n return @bin.values unless block_given?\n if key = domain(template)\n # indexed search\n return [@bin[key]]\n else\n # liner search\n return @bin.select{|_, val| yield(val)}.values\n end\n end",
"def reduce_blocks(blks, filter = writable_mifare_blocks)\n if identify_2d_array(blks)\n hsh = blks.to_h\n filter.map { |x| hsh[x] }.compact.flatten\n else\n filter.map { |x| blks[x] }.compact.flatten\n end\n end",
"def get_blocks(x0,y0,z0,x1,y1,z1)\n response = @api.send_and_receive(\"world.getBlocks(#{x0},#{y0},#{z0},#{x1},#{y1},#{z1})\")\n Block.find(response.to_i) \n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def blockss(content)\n j = count_key(content)\n array = []\n keywords = j[1]\n keywords.length.times do |i|\n arr = keywords[i]\n key = %w[if unless]\n key.each do |val|\n next unless arr[0] == val\n\n line = content[arr[1]]\n k = line.index(val) - 1\n res = (0..k).reject { |n| line[n] == ' ' }\n array << i unless res.empty?\n end\n end\n keyword = []\n array.length.times do |i|\n keyword << keywords[array[i]]\n end\n keywords -= keyword\n keywords\n end",
"def test_example\n\n b0 = Block.first( 'Genesis' )\n b1 = Block.next( b0, 'Transaction Data...' )\n b2 = Block.next( b1, 'Transaction Data...', 'Transaction Data...' )\n b3 = Block.next( b2 ) ## no transaction data\n b4 = Block.next( b3, ['Transaction Data...', 'Transaction Data...'] )\n\n blockchain = [b0, b1, b2, b3, b4]\n\n pp blockchain\n\n assert true ## (for now) everything ok if we get here\nend",
"def read_blocks(start_block, block_count, nonce)\n data = @disk.read_blocks start_block + @data_start, block_count\n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_leaf start_block + i\n load_data[:ops] <<\n { :op => :sign, :line => load_data[:line], :session_id => @sid,\n :nonce => nonce, :data => data[i * block_size, block_size],\n :block => start_block + i }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n { :data => data, :hmacs => hmacs }\n end",
"def get_block_cells block\n\t\tblock_cells = []\n\t\t(block / 3 * 3...block / 3 * 3 + 3).each do |r|\n\t\t\t(block % 3 * 3...block % 3 * 3 + 3).each do |c|\n\t\t\t\tblock_cells << r * 9 + c\n\t\t\tend\n\t\tend\n\treturn block_cells\n\n\tend",
"def parse_block_extensions\n # Parse the string +str+ and extract the annotation or the list of tests\n if @src.scan(RESPECTESTS_START)\n last_child = @tree.children.last\n if last_child.type == :header\n parse_respec_tests_list(@src[1], last_child.options[:respec_section] ||= {})\n @tree.children << new_block_el(:eob, :respec_section)\n else\n parse_respec_tests_list(@src[1], last_child.options[:ial] ||= {})\n @tree.children << new_block_el(:eob, :ial)\n end\n # Original parser of block extensions\n elsif @src.scan(ALD_START)\n parse_attribute_list(@src[2], @alds[@src[1]] ||= Utils::OrderedHash.new)\n @tree.children << new_block_el(:eob, :ald)\n true\n elsif @src.check(EXT_BLOCK_START)\n parse_extension_start_tag(:block)\n elsif @src.scan(IAL_BLOCK_START)\n if @tree.children.last && @tree.children.last.type != :blank &&\n (@tree.children.last.type != :eob || [:link_def, :abbrev_def, :footnote_def].include?(@tree.children.last.value))\n parse_attribute_list(@src[1], @tree.children.last.options[:ial] ||= Utils::OrderedHash.new)\n @tree.children << new_block_el(:eob, :ial) unless @src.check(IAL_BLOCK_START)\n else\n parse_attribute_list(@src[1], @block_ial ||= Utils::OrderedHash.new)\n end\n true\n else\n false\n end\n end",
"def block_list(context={})\n \n blocks = []\n blocks.concat(get_menus_as_blocks(context))\n blocks.concat(get_breadcrumb_as_block(context))\n blocks.concat(get_public_breadcrumb_as_block(context))\n blocks.concat(get_views_as_blocks(context))\n blocks.concat(get_contents_as_blocks(context))\n \n return blocks\n \n end",
"def create_first_block\n\ti = 0\n\tinstance_variable_set( \"@b#{i}\", \n\t\t\t\t\t\t\t\t\t\t\t\t Block.first( \n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Dutchgrown\", to: \"Vincent\", what: \"Tulip Bloemendaal Sunset\", qty: 10 },\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Keukenhof\", to: \"Anne\", what: \"Tulip Semper Augustus\", qty: 7 } )\n\t\t\t\t\t\t\t\t\t\t\t )\n\tLEDGER << @b0\n\tpp @b0\n\tp \"============================\"\n\tadd_block\nend",
"def get_all_thermal_blocks()\n zones = find_all_commands(\"ZONE\")\n end",
"def block_checker(array, &block)\n [array.to_a, !!block]\nend",
"def blocks_from_file(file)\n bytes = IO.binread(file)\n io = StringIO.new(bytes)\n blocks = []\n\n until io.eof?\n begin\n blocks << Block.new(io)\n rescue\n # ignore invalid blocks\n end\n end\n\n blocks\n end",
"def extract_blocks(dir)\n @dir = File.expand_path(dir)\n if File.directory? @dir\n Find.find(*Dir[\"#{self.dir}/**/*.rb\"]) do |filename|\n if File.file? filename\n sexp = @rp.process(File.read(filename), filename)\n self.process(sexp)\n end\n end\n elsif File.file? @dir\n sexp = @rp.process(File.read(@dir), @dir)\n self.process(sexp)\n end\n @sexp_blocks\n end",
"def each_mid(&block)\n \n end",
"def foldable_comment_block_ranges; end",
"def zip_blocks(blks, filter = writable_mifare_blocks)\n filter.map\n .with_index { |i, x| [i, blks[x]] }\n .reject { |_a, b| b.nil? }\n end",
"def test_blocks_not_consecutive\n block_num_checker = BlockNumChecker::new\n arr = [0,1,2,8,4,5,6]\n assert_equal 1, block_num_checker.check_block(arr)\n end",
"def blocks() end",
"def find_all(&block)\n @asset.representation_utis.each do |uti|\n find_by_uti(uti) do |rep|\n block.call(rep)\n end\n end\n end",
"def statement_block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n return_value = StatementBlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __BLOCK4__ = nil\n statement_list5 = nil\n\n tree_for_BLOCK4 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 23:5: ^( BLOCK ( statement_list )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __BLOCK4__ = match( BLOCK, TOKENS_FOLLOWING_BLOCK_IN_statement_block_80 )\n\n tree_for_BLOCK4 = @adaptor.copy_node( __BLOCK4__ )\n\n root_1 = @adaptor.become_root( tree_for_BLOCK4, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 23:14: ( statement_list )?\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( AMP, AMP_ASGN ) || look_3_0 == POST_DECR || look_3_0.between?( GEQ, AREF ) || look_3_0.between?( GREATER, HAT ) || look_3_0.between?( ARROW, HAT_ASGN ) || look_3_0.between?( ASGN, REGEX ) || look_3_0.between?( IN, RETURN ) || look_3_0 == INCR || look_3_0.between?( BREAK, RSHIFT3 ) || look_3_0.between?( LABEL, CATCH ) || look_3_0 == RSHIFT_ASGN || look_3_0 == LEQ || look_3_0.between?( LESS, SLASH ) || look_3_0.between?( SLASH_ASGN, CONTINUE ) || look_3_0.between?( STAR, DECR ) || look_3_0 == STAR_ASGN || look_3_0.between?( LSHIFT, THIS ) || look_3_0 == THROW || look_3_0.between?( MINUS, MOD ) || look_3_0.between?( MOD_ASGN, TYPEOF ) || look_3_0.between?( NEQ, UMINUS ) || look_3_0.between?( NEQQ, UNDEFINED ) || look_3_0.between?( NEW, UPLUS ) || look_3_0.between?( OBJECT, FALSE ) || look_3_0.between?( WITH, PLUS ) || look_3_0.between?( ID, DOC ) )\n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 23:14: statement_list\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_list_IN_statement_block_82 )\n statement_list5 = statement_list\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_list5.tree )\n\n\n end\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 3 )\n\n end\n \n return return_value\n end",
"def nodes_in_block(first_node)\n # We're going to do a depth-first search of the graph from the first\n # node, following control flow edges out, and global schedule edges in,\n # and stopping when we find a node that ends a basic block such as a\n # branch.\n\n worklist = [first_node]\n block = Set.new\n\n until worklist.empty?\n node = worklist.pop\n\n if block.add?(node)\n # We need to visit nodes that are anchored to this one.\n\n node.inputs.edges.each do |i|\n if i.input_name == :global_schedule\n worklist.push i.from\n end\n end\n\n # If this node isn't a branch, and it's either the first node or it\n # isn't a merge, visit the nodes that follow it in control flow.\n\n if node.op != :branch && (node == first_node || node.op != :merge)\n node.outputs.edges.each do |o|\n if o.control?\n if !(node.op == :start && o.to.op == :finish)\n worklist.push o.to\n end\n end\n end\n end\n end\n end\n\n block.to_a\n end",
"def query_interfaces(command,array)\n command.each_line do |line|\n array.push(line).flatten if line =~ /w[1-8]g1/ .. line =~ /TX/\n end\n end",
"def blocks\n if num_blocks.positive?\n blocks_for_num_blocks\n else\n blocks_for_block_size\n end\n end",
"def each_registered_block(type, &block); end",
"def filter(array, block)\n return array.select(&block)\nend",
"def _extract_block(block)\n src_file_path = block.source_location[0]\n block_start_line_number = block.source_location[1]\n\n src_file_content = File.open(src_file_path).read\n lines_after_block_start = src_file_content.split(\"\\n\")[block_start_line_number..-1]\n\n # block already starts with one \"do\"\n do_counter = 1\n # assuming that \"do themize\" and corresponding \"end\" placed on separate lines\n block_end_index = 1\n lines_after_block_start.each_with_index do |line, i|\n # http://stackoverflow.com/a/11899069/6376451\n do_counter += line.scan(/<%.*?do.*?%>/).size\n do_counter -= line.scan(/<%.*?end.*?%>/).size\n if line =~ /\\s*<%\\s*end\\s*%>/ && do_counter == 0\n block_end_index = i\n break\n end\n end\n return nil if block_end_index == 0\n\n lines_after_block_start[0..block_end_index-1].join(\"\\n\")\n end",
"def query_each_side_has_a_block x, y, z, do_update = false\r\n arr = Array.new(6, false)\r\n arr[0] = get_block_at(x, y - 1, z) == nil #bottom\r\n arr[1] = get_block_at(x, y, z - 1) == nil #sides\r\n arr[2] = get_block_at(x - 1, y, z) == nil #sides\r\n arr[3] = get_block_at(x + 1, y, z) == nil #sides\r\n arr[4] = get_block_at(x, y, z + 1) == nil #sides\r\n arr[5] = get_block_at(x, y + 1, z) == nil #top\r\n \r\n if do_update \r\n chx = (x / Util::Chunk_Size).floor\r\n chy = (y / Util::Chunk_Size).floor\r\n chz = (z / Util::Chunk_Size).floor\r\n \r\n if chy != ((y - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y - 1) / Util::Chunk_Size).floor, chz)\r\n elsif chy != ((y + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y + 1) / Util::Chunk_Size).floor, chz)\r\n end\r\n \r\n if chx != ((x - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x - 1) / Util::Chunk_Size).floor, chy, chz)\r\n elsif chx != ((x + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x + 1) / Util::Chunk_Size).floor, chy, chz)\r\n end\r\n \r\n if chz != ((z + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z + 1) / Util::Chunk_Size).floor)\r\n elsif chz != ((z - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z - 1) / Util::Chunk_Size).floor)\r\n end\r\n \r\n end\r\n\r\n #@called += 1\r\n #puts @called\r\n \r\n return arr\r\n end",
"def block_examples\n\n # calls each method on range ands passes it block\n # |i| is Ruby syntax for block variable\n # {} one way to indicate a clock\n (1..5).each { |i| puts 2 * i} # outputs 2 4 6 8 10\n\n # blocks can be more than one line using do..end syntax\n (1..5).each do |number|\n puts 2 * number\n puts '--'\n end\n\n # more block examples\n\n # 3.times takes a block with no variables\n 3.times { puts \"Betelgeuse!\" } # outputs \"Betelgeuse!\" three times\n\n # the map method returns the result of applying the given block to each element in the array or range\n # the ** notation is for 'power'\n (1..5).map { |i| i**2 } # => [1, 4, 9, 16, 25]\n\n # recall that %w makes string arrays\n %w[a b c] # => [\"a\", \"b\", \"c\"]\n %w[a b c].map { |char| char.upcase } # => [\"A\", \"B\", \"C\"]\n\n # array of alaphabet, shuffled then return first eight elements and join them\n ('a'..'z').to_a.shuffle[0..7].join # => \"mznpybuj\"\n end",
"def find_labels\n @input.each_with_index do |line, i|\n if line.label?(i)\n label = line.split(\":\")[0]\n if [email protected]?(label)\n @labels[label] = [*@instructions.each_with_index].search{|x, _| x >= i}.last\n else\n Error::message(7, i+1, line) \n end\n end\n end\n end",
"def find_blocks(text)\n lines = text.to_a\n\n initial = {\n 'prev' => lines[0],\n 'blocks' => [{\n 'lines' => [],\n 'from' => 0,\n 'to' => 0\n }]\n }\n\n text.to_a.reduce(initial) do |reduced, line|\n blocks = reduced['blocks']\n\n if is_all_whitespace(line)\n blocks[blocks.size-1]['lines'] << line\n blocks[blocks.size-1]['to'] = blocks[blocks.size-1]['to'] + 1\n { 'prev' => reduced['prev'], 'blocks' => blocks}\n elsif left_spacing(line) == left_spacing(reduced['prev'])\n blocks[blocks.size-1]['lines'] << line\n blocks[blocks.size-1]['to'] = blocks[blocks.size-1]['to'] + 1\n { 'prev' => line, 'blocks' => blocks}\n else\n blocks << {\n 'lines' => [line],\n 'from' => blocks[blocks.size-1]['to'],\n 'to' => blocks[blocks.size-1]['to'] + 1\n }\n { 'prev' => line, 'blocks' => blocks}\n end\n end['blocks']\n end",
"def first_in_block(first, nodes)\n first.inputs.from_nodes.each do |n|\n if nodes.include?(n)\n return first_in_block(n, nodes)\n end\n end\n first\n end",
"def blocks_for_num_blocks\n # Don't create blocks if we have no words\n return [] if @single_block.empty?\n\n # Split the single block into the right size and return\n @single_block.in_groups(@num_blocks, false).each_with_object([]) do |b, ret|\n ret << Block.new(b, I18n.t('lib.frequency.block_count_dataset',\n num: ret.size + 1, total: @num_blocks))\n end\n end",
"def build_block_list\n @tl_list = [[0, 0]]\n\n @tl_list.each do |col, row|\n neighbours(col, row).each do |c, r|\n @tl_list << [c, r] if candidate?(c, r)\n end\n end\n end",
"def all_veins\n mapblock.block_events.grep(BlockSquareEventMineralst)\n end",
"def parse_blocks(el, text = T.unsafe(nil)); end",
"def __loopb(&blk)\n codes = yield\n len = (codes.length + 1) * (-1)\n result = codes + [:jmpr, len]\n if result.any? {|e| e.class == UnknownBreak }\n outside = result.length\n result = result.map {|e| e.class == UnknownBreak ? e.to_break(0, outside) : e }\n result.each_with_index {|e, i| e.class == BreakStop ? e.index = i : e }\n result.map! {|e| e.class == BreakStop ? e.to_offset : e }\n end\n result\n end",
"def get_block(size, x, y)\n\t\t(y..y+size-1).each do |i|\n\t\t\t(x..x+size-1).each do |j|\n\t\t\t\tyield @matrix[i][j]\n\t\t\tend\n\t\tend\t\n\tend",
"def select_from(list, &instructions)\n list.map do |item|\n if instructions.call(item)\n item\n end\n end.compact\nend",
"def each\n\t\[email protected] do |v|\n\t\t\tyield v & 0x0F #Bottom Nibble\n\t\t\tyield (v >> 4) & 0x0F #Top Nibble\n\t\tend\n\tend",
"def hello_t(array)\n if block_given?#without or with block\n\n i = 0\n \n while i < array.length\n#will yield each element of the array to the block if a block is present. \n yield(array[i])\n i = i + 1\n end\n \n array\n# Otherwise, it will puts out a helpful phrase.\n else\n puts \"Hey! No block was given!\"\n end\n end",
"def filter(array, block)\n return array.select(&block) # Your code here\nend",
"def blocks\n @blocks ||= Array(@grpc.blocks).map do |b|\n Block.from_grpc b\n end\n end",
"def index\n\t\tif params[:tag]\n\t\t\t@blocks = Block.tagged_with(params[:tag])\n\t\telse\n\t\t\t@blocks = Block.all\n\t\tend\n\tend",
"def get_other_block_cells cell\n\t\tblock = get_block cell\n\t\tfirst_cell = cell / 27 * 27\n\t\treturn (first_cell...first_cell + 27).select { |r| block == r / 27 * 3 + r % 9 / 3 }.to_a - [cell]\n\tend",
"def blocks_for_block_size\n # We're already done with the last block behavior, if we wanted a small\n # last block, or if we only generated a single block\n return block_list if block_list.size <= 1 || last_block == :small_last\n\n case last_block\n when :truncate_all\n # Implemented in add_for_block_size\n nil\n when :small_last\n # Implemented just above\n nil\n when :truncate_last\n block_list.pop\n else # default to :big_last behavior\n last = block_list.pop\n block_list.last.words.concat(last.words)\n end\n\n block_list\n end",
"def first_all(conditions={}, &block)\n all.detect { |item| match_all(item, conditions, &block) }\n end",
"def can_have_basic_block_continuations?\n return false if [:call, :trace, :cjmp, :root_nop].include? @op\n return false if [:load, :texload].include? @op\n return true if [:mov_rsq, :mov_rcp].include? @op\n return true if [:mov, :nop, :mul, :add, :frac_minus,\n :sub, :frac, :setx, :sety, :setz, :neg,\n :dp3, :mul_m, :getx, :gety, :getz]\n raise \"I don't know whether #{@op} can be followed by other instructions in a basic block\"\n end",
"def readBlock(pieceIndex, offset, length)\n readRegions @pieceMapper.findBlock(pieceIndex, offset, length)\n end",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end"
] | [
"0.62876546",
"0.599573",
"0.5870855",
"0.5801424",
"0.5785719",
"0.57395476",
"0.54923743",
"0.53547287",
"0.5333158",
"0.5319296",
"0.52905166",
"0.52682805",
"0.52349675",
"0.5191449",
"0.5181",
"0.51454115",
"0.5140853",
"0.51077753",
"0.5099594",
"0.50637573",
"0.5048022",
"0.503839",
"0.50372255",
"0.5031827",
"0.5026897",
"0.49954796",
"0.49854174",
"0.49572295",
"0.49439114",
"0.49327898",
"0.49221104",
"0.49201077",
"0.49068806",
"0.49057722",
"0.48960653",
"0.4883664",
"0.48780867",
"0.48615184",
"0.4854922",
"0.48520267",
"0.48463434",
"0.4837424",
"0.48356462",
"0.48241386",
"0.4821502",
"0.48157975",
"0.48097342",
"0.47953093",
"0.47662333",
"0.4761645",
"0.47604468",
"0.47604468",
"0.47604468",
"0.4756594",
"0.47323212",
"0.47259724",
"0.47251433",
"0.4717718",
"0.47028327",
"0.47015607",
"0.46954608",
"0.4692371",
"0.46879596",
"0.46877545",
"0.46875316",
"0.46824425",
"0.46738514",
"0.46683457",
"0.46608332",
"0.46544257",
"0.4615556",
"0.46099952",
"0.46063107",
"0.4597883",
"0.45946476",
"0.45917642",
"0.4580473",
"0.45804077",
"0.45768607",
"0.45726943",
"0.45724958",
"0.4564242",
"0.45642158",
"0.45580313",
"0.45568198",
"0.4552771",
"0.4550564",
"0.454551",
"0.45381334",
"0.45354456",
"0.45354125",
"0.45313403",
"0.4522786",
"0.4520139",
"0.44913134",
"0.4491108",
"0.4487473",
"0.44866794",
"0.4480517",
"0.44781268"
] | 0.6558905 | 0 |
Convert one basic block to a fragment of graph. | def basic_block_to_fragment(insns, ip=0, profile=nil)
# Basic blocks start with a merge node.
merge = Node.new(:merge)
# We're going to build up a list of names and stack values coming into
# this basic block that we're going to need to connect up later when
# we form a complete graph.
names_in = {}
stack_in = []
# Create an initial deoptimisation map.
deopt_map = FrameStateBuilder.new(insns, ip, names_in.dup, stack_in.dup)
last_node = nil
last_control = merge
# We're also going to build up a list of names and stack values that
# are available when this basic block is finished.
names = {}
stack = []
# When we pop a value off the stack, we may be using a value that
# wasn't created within this basic block - the value could have been
# expected to be on the stack already. This proc tries to pop a value
# off the basic block's stack, but if there isn't one, it then
# records that the basic block will need another stack value coming in
# and creates an unconnected value to represent that, called an input
# node.
pop = proc {
if stack.empty?
input = Node.new(:connector)
stack_in.unshift input
input
else
stack.pop
end
}
# Go through each instruction in the basic block, and perform a kind
# of abstract interpretation on it. This loop looks a lot like the one
# in the interpreter. The difference here is that we don't deal with
# real values, instead we deal with an abstraction of the values that
# will be there in the future. It's somewhat like computing with
# promises that are never fulfilled. It's simpler than it sounds
# because as this is a basic block the control flow is simple - it's a
# linear sequence of instructions with no branches. For each
# instruction we create a graph node that represents the computation
# on the abstract values. We build a backbone of linear control flow
# through the instructions by linking each instruction that has some
# kind of side effect to the previous instruction with a side effect.
insns.each_with_index do |insn, n|
case insn.first
when :trace
last_node = Node.new(:trace, line: insn[1])
when :self
last_node = Node.new(:self)
stack.push last_node
when :arg
last_node = Node.new(:arg, n: insn[1])
stack.push last_node
when :load
name = insn[1]
value = names[name]
unless value
# Like the pop proc, if we don't find that a name has been set
# in this basic block, we remember that we need it as an input
# and create an input node to represent its future value.
input = Node.new(:connector)
names_in[name] = input
names[name] = input
value = input
end
stack.push value
when :store
names[insn[1]] = pop.call
when :push
last_node = Node.new(:constant, value: insn[1])
stack.push last_node
when :send
name = insn[1]
argc = insn[2]
send_node = Node.new(:send, name: name, argc: argc)
argc.times do |n|
arg_node = pop.call
arg_node.output_to :value, send_node, :"arg(#{argc-n-1})"
end
receiver_node = pop.call
receiver_node.output_to :value, send_node, :receiver
if profile
send_node.props[:profile] = profile.sends[ip + n]
end
stack.push send_node
last_node = send_node
when :not
value_node = pop.call
not_node = Node.new(:not)
value_node.output_to :value, not_node
stack.push not_node
last_node = not_node
when :jump
jump_node = Node.new(:jump)
last_node = jump_node
when :branch
value_node = pop.call
branch_node = Node.new(:branch)
value_node.output_to :value, branch_node, :condition
last_node = branch_node
when :return
last_node = pop.call
stack.push last_node
else
raise 'unknown instruction'
end
# Does this instruction need a deoptimisation map becuase it could deoptimise?
if @build_deopt_maps && [:send].include?(insn.first)
# Create a deoptimisation map node?
deopt_map_node = Node.new(:deopt_map, insns: deopt_map.insns, ip: deopt_map.ip)
# Send the value of the receiver to it.
Node.new(:self).output_to :value, deopt_map_node, :receiver
# Send the value of all arguments to it.
args = insns.select { |i| i.first == :arg }.map { |i| i[1] }
if args.empty?
args_count = 0
else
args_count = args.max + 1
end
args_count.times do |n|
Node.new(:arg, n: n).output_to :value, deopt_map_node, :"arg(#{n})"
end
# Send the value of all names to it.
deopt_map.names.each_pair do |name, value|
value.output_to :value, deopt_map_node, name
end
# Send all values on the stack to it.
deopt_map.stack.each_with_index do |value, index|
value.output_to :value, deopt_map_node, :"stack(#{index})"
end
# Add the deoptimisation map to the instruction by adding a special edge.
deopt_map_node.output_to :deopt_map, last_node
end
# The trace and send instructions have side effects - link them into
# the backbone of control flow so that we know one instruction with
# side effects needs to happen before any other after it. The jump and
# branch instructions could or could not be seen as side effects. We
# treat them so because it seems to make this easier.
if [:trace, :send, :jump, :branch].include?(insn.first)
last_control.output_to :control, last_node
last_control = last_node
end
# If this instruction potentially has side-effects, create a new
# deoptimisation map for the state after the instruction.
if [:send].include?(insn.first)
deopt_map = FrameStateBuilder.new(insns, ip + n + 1, names.dup, stack.dup)
end
end
GraphFragment.new(names_in, stack_in, merge, last_node, last_control, names, stack)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_local_graph(block)\n block_flow = dfg.block_flows.fetch(block.id)\n\n # A map of instructions to nodes.\n insn_nodes = {}\n\n # Create a node for each instruction in the block.\n block.each_with_length do |insn, offset|\n node = InsnNode.new(insn, offset)\n insn_nodes[offset] = node\n nodes << node\n end\n\n # The first and last node in the sub-graph, and the last fixed node.\n previous_fixed = nil\n first_fixed = nil\n last_fixed = nil\n\n # The merge node for the phi nodes to attach to.\n merge_node = nil\n\n # If there is more than one predecessor and we have basic block\n # arguments coming in, then we need a merge node for the phi nodes to\n # attach to.\n if block.incoming_blocks.size > 1 && !block_flow.in.empty?\n merge_node = MergeNode.new(id_counter)\n nodes << merge_node\n\n previous_fixed = merge_node\n first_fixed = merge_node\n last_fixed = merge_node\n end\n\n # Connect local control flow (only nodes with side effects.)\n block.each_with_length do |insn, length|\n if insn.side_effects?\n insn_node = insn_nodes[length]\n connect previous_fixed, insn_node, :control if previous_fixed\n previous_fixed = insn_node\n first_fixed ||= insn_node\n last_fixed = insn_node\n end\n end\n\n # Connect basic block arguments.\n inputs = {}\n outputs = {}\n block_flow.in.each do |arg|\n # Each basic block argument gets a phi node. Even if there's only\n # one predecessor! We'll tidy this up later.\n phi = PhiNode.new(id_counter)\n connect(phi, merge_node, :info) if merge_node\n nodes << phi\n inputs[arg] = phi\n\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows[consumer_offset]\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer == arg\n connect(phi, insn_nodes[consumer_offset], :data, input_index)\n end\n end\n end\n\n block_flow.out.each { |out| outputs[out] = phi if out == arg }\n end\n\n # Connect local dataflow from consumers back to producers.\n block.each_with_length do |_, consumer_offset|\n consumer_flow = dfg.insn_flows.fetch(consumer_offset)\n consumer_flow.in.each_with_index do |producer, input_index|\n if producer.local?\n connect(\n insn_nodes[producer.length],\n insn_nodes[consumer_offset],\n :data,\n input_index\n )\n end\n end\n end\n\n # Connect dataflow from producers that leaves the block.\n block.each_with_length do |_, producer_pc|\n dfg\n .insn_flows\n .fetch(producer_pc)\n .out\n .each do |consumer|\n unless consumer.local?\n # This is an argument to the successor block - not to an\n # instruction here.\n outputs[consumer.name] = insn_nodes[producer_pc]\n end\n end\n end\n\n # A graph with only side-effect free instructions will currently have\n # no fixed nodes! In that case just use the first instruction's node\n # for both first and last. But it's a bug that it'll appear in the\n # control flow path!\n SubGraph.new(\n first_fixed || insn_nodes[block.block_start],\n last_fixed || insn_nodes[block.block_start],\n inputs,\n outputs\n )\n end",
"def fragment(ast_node, &block)\n GeneratedFragment.new(self, ast_node).tap do |frag|\n yield frag if block_given?\n end\n end",
"def linearize(graph)\n # The basic blocks.\n blocks = []\n \n # Details of the basic block that contain the finish operation which\n # won't be added to the list of basic blocks until the end.\n first_node_last_block = nil\n last_block = nil\n \n # Two maps that help us map between nodes and the names of the blocks\n # that they go into, and the merge instruction indicies and the blocks\n # they're coming from.\n first_node_to_block_index = {}\n merge_index_to_first_node = {}\n\n # Look at each node that begins a basic block.\n\n basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }\n\n last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first\n\n basic_block_starters.delete last_basic_block_starter\n basic_block_starters.push last_basic_block_starter\n\n basic_block_starters.each do |node|\n original_first_node = node\n first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))\n\n # We're going to create an array of operations for this basic\n # block.\n\n block = []\n next_to_last_control = nil\n\n # Follow the local sequence.\n\n node = first_node\n\n begin\n # We don't want to include operations that are just there to form\n # branches or anchor points in the graph such as start and merge.\n\n unless [:start, :merge].include?(node.op)\n op = node.op\n\n # We rename finish to return to match the switch from the\n # declarative style of the graph to the imperative style\n # of the list of operations.\n op = :return if op == :finish\n\n # The instruction begins with the operation.\n insn = [op]\n\n # Then any constant values or similar.\n [:line, :n, :value].each do |p|\n insn.push node.props[p] if node.props.has_key?(p)\n end\n\n # Then any input registers.\n node.inputs.with_input_name(:value).from_nodes.each do |input_values|\n insn.push input_values.props[:register]\n end\n\n # Phi instructions need pairs of source registers with the blocks they came from.\n if node.op == :phi\n node.inputs.edges.each do |input|\n if input.input_name =~ /^value\\((.+)\\)$/\n n = $1.to_i\n insn.push n\n insn.push input.from.props[:register]\n end\n end\n # Elide phi instructions if register allocation has run correctly and values are\n # already in the correct registers.\n insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1\n end\n\n # Send instructions and lowered equivalents need the arguments.\n if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n if node.op == :send\n insn.push node.props[:name]\n elsif node.op == :call_managed\n insn.push node.inputs.with_input_name(:name).from_node.props[:register]\n end\n\n node.props[:argc].times do |n|\n arg = node.inputs.with_input_name(:\"arg(#{n})\").from_node\n\n if arg.op == :immediate\n insn.push arg.props[:value]\n else\n insn.push arg.props[:register]\n end\n end\n end\n\n # Then the target register if the instruction has one.\n insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)\n\n # If it's a branch then the target basic blocks and the test.\n if node.op == :branch\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n\n [:true, :false].each do |branch|\n target = node.outputs.with_output_name(branch).to_node\n raise unless target\n insn.push target\n end\n\n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Send instructions and lowered managed calls need the list of live registers.\n if [:send, :call_managed].include?(node.op)\n insn.push node.props[:live_registers]\n end\n \n # Guards are like branches, but only have one side.\n if node.op == :guard\n insn.push node.inputs.with_input_name(:condition).from_node.props[:register]\n \n if node.props[:test]\n insn.push node.props[:test]\n end\n end\n\n # Kind instructions need the kind.\n if node.op == :kind_is?\n insn.push node.props[:kind]\n end\n \n # Frame states need the instructions, the ip, and to know where values are for\n # the receiver, the arguments, and the stack.\n if node.op == :deopt_map\n insn.push node.props[:insns]\n insn.push node.props[:ip]\n insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|\n /arg\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n\n insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|\n /stack\\((\\d+)\\)/ =~ e.input_name.to_s\n [$1.to_i, e.from.props[:register]]\n }.sort_by { |pair| pair.first }.map { |pair| pair.last }\n end\n\n # Add the instruction to the block.\n block.push insn if insn\n end\n\n next_to_last_control = node if node.has_control_output?\n\n # Follow the local schedule edge to the next node.\n node = node.outputs.with_output_name(:local_schedule).to_nodes.first\n end while node && node.op != :merge\n\n # Empty blocks cause problems elsewhere - it's easier to just have a nop\n # in them. Really, we should remove empty blocks by modifying the\n # instruction that jumps here to jump to wherever this leads to.\n\n if block.empty?\n block.push [:nop]\n end\n\n # If the last node is a merge, we need to remember which merge index this is.\n\n if node && node.op == :merge\n next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\\((.+)\\)$/\n n = $1.to_i\n merge_index_to_first_node[n] = first_node\n end\n\n # Add a jump instruction if this block was going to just flow into the next\n # - we'll remove it later if the block followed it anyway and we can just\n # fallthrough.\n\n unless [:return, :branch].include?(block.last.first)\n begin\n block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]\n rescue\n block.push [:jump, :broken]\n end\n end\n\n first_node_to_block_index[original_first_node] = blocks.size\n first_node_to_block_index[first_node] = blocks.size\n blocks.push block\n end\n\n # Record the number that this basic block has and then add it to the list of basic blocks.\n\n first_node_to_block_index[first_node_last_block] = blocks.size\n\n # Go back through the basic blocks and update some references that were to things that\n # hadn't been decided yet.\n\n blocks.each do |block|\n block.each do |insn|\n insn.map! do |e|\n # If part of an instruction references a basic block, turn that into the index of\n # the basic block instead.\n\n if e.is_a?(IR::Node)\n :\"block#{first_node_to_block_index[e]}\"\n else\n e\n end\n end\n end\n end\n\n # Go back through the basic blocks and change how the branch instructions out of them\n # work.\n\n blocks.each_with_index do |block, n|\n next_block = :\"block#{n + 1}\"\n last = block.last\n\n if last == [:jump, next_block]\n # A jump that just goes to the next block can be removed and left to fall through.\n block.pop\n elsif last.first == :branch && last[3] == next_block\n # A branch where the else goes to the next block can branch only when true.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n elsif last.first == :branch && last[2] == next_block\n # A branch where the if goes to the next block can branch only unless true.\n block.pop\n test = last.drop(4)\n block.push [:branch_unless, last[1], last[3], *test]\n elsif last.first == :branch\n # A branch that doesn't go to the next block at all can be a branch if true\n # and then fallthrough to a new jump instruction.\n block.pop\n block.push [:branch_if, last[1], last[2], *last.drop(4)]\n block.push [:jump, last[3]]\n end\n end\n\n blocks\n end",
"def parse(block)\n ast = block.to_ast\n # produces sth. like:\n # (block\n # (send ..)\n # (args)\n # (begin ..)\n # )\n inner_ast = ast.children[2] # pick up (begin..)\n if inner_ast.type == :send\n lines = [inner_ast]\n else\n lines = inner_ast.children\n end\n\n lines.map do |node|\n if node.type == :send\n buf = []\n extract_value(node, buf)\n buf.reverse\n end\n end\n end",
"def to_source\n (['.block'] + collect{|e| e.to_source} + ['.bend']).flatten\n end",
"def basic_blocks\n @basic_block_collection ||= BasicBlockCollection.new(self)\n end",
"def graphviz(oGraph, c0, c1, c2, c3, c4)\n return if @src_id.nil? || @dst_id.nil?\n return if @count > 1 # TODO: eliminate dupulicate trans\n\n guard = @block.condition_success unless @block.nil?\n guard = \"unknown\" if guard.nil?\n\n if @title.nil?\n title = ''\n else\n title = \"#{@title}\"\n end\n @label = @type + '(' + title + ')\\n' + guard + '\\n' + @block.id\n\n if (@src_id =~ /^V_/) && (@dst_id =~ /^V_/)\n # V to V form\n src_id = @src_id + '_inbound'\n dst_id = @dst_id + '_inbound'\n\n elsif (@src_id =~ /^V_/) && (@dst_id =~ /^C_/)\n src_id = @src_id + '_inbound'\n dst_id = @dst_id\n\n c2.add_node(dst_id) if $graphviz_with_rank\n elsif (@src_id =~ /^C_/) && (@dst_id =~ /^V_/)\n src_id = @src_id\n dst_id = @dst_id + '_outbound'\n c2.add_node(src_id) if $graphviz_with_rank\n c4.add_node(dst_id) if $graphviz_with_rank\n elsif (@src_id =~ /^C_/) && (@dst_id =~ /^C_/)\n # redirect\n src_id = @src_id\n dst_id = @dst_id\n c2.add_node(src_id) if $graphviz_with_rank\n c3.add_node(dst_id) if $graphviz_with_rank\n else\n src_id = @src_id\n dst_id = @dst_id\n end\n\n # draw\n e = oGraph.add_edge(src_id, dst_id, label: @label)\n end",
"def start_block_to_dsl(block)\n return \"\" unless block\n\n block_dsls = block.each_block(false).map do |block|\n dsl_content = block.to_dsl\n\n if block.has_comment?\n dsl_content = method_call_with_possible_block(\n \"with_comment\",\n [block.comment, block.comment_pinned].compact.map(&:inspect).join(\", \"),\n dsl_content\n )\n end\n\n if block.is_shadow?\n dsl_content = method_call_with_possible_block(\"shadow\", \"\", dsl_content)\n end\n\n if block.has_position?\n dsl_content = method_call_with_possible_block(\"with_position\", [block.x, block.y].map(&:inspect).join(\", \"), dsl_content)\n end\n\n dsl_content\n end\n block_dsls.join(\"\\n\")\n end",
"def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend",
"def create_full_graph(spec_edges)\n create_sub_graph(spec_edges, $game_map.width+$game_map.height)\n end",
"def new\n\t\t@block = Block.new\n\tend",
"def get_parsable\n @block ||= Block.new\n end",
"def fragment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 3)\n\n type = FRAGMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 9:12: 'fragment'\n match(\"fragment\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 3)\n\n end",
"def convert_route_block(block)\n block\n end",
"def decode_new_multi(block)\n\t\t\n\t\tnot_found = []\n\t\tblock.blocks.each do |bl_id|\n\t\t\tif @decoded[bl_id].nil?\n\t\t\t\tnot_found << bl_id\n\t\t\telse\n\t\t\t\tblock.data ^= @decoded[bl_id]\n\t\t\tend\n\t\tend\n\t\tblock.blocks = not_found\n\t\treturn block\n\tend",
"def putFragmentBlock\n puts_tag(\"fragments\") { yield }\n end",
"def putFragmentBlock\n yield\n newline\n end",
"def contacting_block(block)\n face = block.state.data.facing\n unless face\n warn \"block #{block}'s face is nil\"\n nil\n end\n block.location.clone.tap {|loc|\n loc.subtract(face.mod_x, face.mod_y, face.mod_z)\n }.block\n end",
"def block_node; end",
"def block_node; end",
"def graph(name, options = {}, &block)\n GraphViz::DSL.new(name, options.merge( { :type => \"graph\" } ), &block).graph\nend",
"def fragment(&blk)\n @nodes << HtmlFragment.new(&blk)\n self\n end",
"def fragment(name, on, &block)\n Fragment.new(name, on, &block)\n end",
"def structure(name, &block)\n if existing = @base.structures.select { |s| s.name == name }.first\n structure = existing\n else\n structure = Moonrope::Structure.new(@base, name)\n @base.structures << structure\n end\n structure.dsl.instance_eval(&block) if block_given?\n structure\n end",
"def decode\n\t\t\n\t\t# go through all of the encoded blocks and fund new singles\n\t\[email protected] do |enc|\n\t\t\[email protected](enc)\n\t \t\tenc = decode_new_multi(enc)\n\t\t\tnd = enc.blocks.length\n\t\t\tif nd == 0\n\t\t\t\t# Got them all, discard\n\t\t\telsif nd == 1\n\t\t\t\t# new single block\n\t\t\t\tadd_single_block(enc)\n\t\t\telse\n\t\t\t\t# add to the pile of unknowns\n\t\t\t\t@encoded << enc\n\t\t\tend\n\t\tend\n\tend",
"def add_block_constraint(block)\n return if block.predecessors.empty?\n lhs = sum_incoming(block,-1) + sum_outgoing(block)\n lhs.push [IPETEdge.new(block,:exit,level),1] if block.may_return?\n ilp.add_constraint(lhs,\"equal\",0,\"structural_#{block.qname}\",:structural)\n end",
"def communicationgraph_old(filter=@filter, &block) # :nodoc:\n us = users(filter)\n if block\n g = DotGraph.new(us, :directed => true, &block)\n else\n g = DotGraph.new(us, :directed => true) { |n| n.name }\n end\n pages(filter).each do |p| \n p.revisions(filter).inject do |a,b|\n g.link(b.user,a.user)\n b\n end\n end\n g\n end",
"def create_first_block\n\ti = 0\n\tinstance_variable_set( \"@b#{i}\", \n\t\t\t\t\t\t\t\t\t\t\t\t Block.first( \n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Dutchgrown\", to: \"Vincent\", what: \"Tulip Bloemendaal Sunset\", qty: 10 },\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ from: \"Keukenhof\", to: \"Anne\", what: \"Tulip Semper Augustus\", qty: 7 } )\n\t\t\t\t\t\t\t\t\t\t\t )\n\tLEDGER << @b0\n\tpp @b0\n\tp \"============================\"\n\tadd_block\nend",
"def fragment_for(name = {}, options = nil, &block) #:nodoc:\n if fragment = controller.read_fragment(name, options)\n fragment\n else\n # VIEW TODO: Make #capture usable outside of ERB\n # This dance is needed because Builder can't use capture\n pos = output_buffer.length\n yield\n fragment = output_buffer.slice!(pos..-1)\n controller.write_fragment(name, fragment, options)\n end\n end",
"def make_graph\n\t\t@graph = Graph.new(@width2, @height2, @maze)\n\tend",
"def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end",
"def graph\n if @graph.nodes.empty?\n build_nodes!\n establish_edges!\n end\n\n @graph\n end",
"def graph\n if @graph.nodes.empty?\n build_nodes!\n establish_edges!\n end\n\n @graph\n end",
"def parse_block_math; end",
"def to_s; \"<Block #{length}>\"; end",
"def create_block(g, mod)\n pos(g)\n\n state = g.state\n state.scope.nest_scope self\n\n args = make_arguments(mod)\n\n blk = new_generator g, @name, args\n\n blk.push_state self\n\n blk.state.push_super state.super\n blk.state.push_eval state.eval\n\n blk.definition_line(@line)\n\n blk.state.push_name blk.name\n\n pos(blk)\n\n blk.state.push_block\n blk.push_modifiers\n blk.break = nil\n blk.next = nil\n blk.redo = blk.new_label\n blk.redo.set!\n\n # order matters quite a lot here\n args.bytecode(blk)\n\n recv = receiver_pattern(mod)\n if recv.binds?\n blk.push_self\n recv.deconstruct(blk, mod)\n end\n\n args.deconstruct_patterns(blk, mod)\n\n mod.compile(blk, @body)\n\n blk.pop_modifiers\n blk.state.pop_block\n\n blk.ret\n blk.close\n blk.pop_state\n\n blk.splat_index = args.splat_index\n blk.local_count = local_count\n blk.local_names = local_names\n\n g.create_block blk\n end",
"def new\n @block = Block.new\n\t@conferences = Conference.all\n\t@tracks = Track.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @block }\n end\n end",
"def query(&block)\n @query = GraphQuery.new(block) \n end",
"def consume_simple_block(input = @tokens)\n start_token = input.current[:node]\n end_token = BLOCK_END_TOKENS[start_token]\n\n block = {\n :start => start_token.to_s,\n :end => end_token.to_s,\n :value => [],\n :tokens => [input.current]\n }\n\n block[:tokens].concat(input.collect do\n while token = input.consume\n break if token[:node] == end_token\n\n input.reconsume\n block[:value] << consume_component_value(input)\n end\n end)\n\n create_node(:simple_block, block)\n end",
"def new_block blk\n time = Time.now\n res = store_block(blk)\n log.info { \"block #{blk.hash} \" +\n \"[#{res[0]}, #{['main', 'side', 'orphan'][res[1]]}] \" +\n \"(#{\"%.4fs, %3dtx, %.3fkb\" % [(Time.now - time), blk.tx.size, blk.payload.bytesize.to_f/1000]})\" } if res && res[1]\n res\n end",
"def build(insns, profile=nil)\n # Find the basic blocks in the instructions.\n\n blocks = basic_blocks(insns)\n\n # Build each basic block into a graph fragment first.\n\n fragments = {}\n\n blocks.each do |ip, block|\n fragments[block.start] = basic_block_to_fragment(block.insns, ip, profile)\n end\n\n # Create more detailed, transitive, input and output names and stacks for each fragment.\n\n trans_names_in = {}\n trans_stack_in = {}\n\n trans_names_out = {}\n trans_stack_out = {}\n\n blocks.each_value do |block|\n fragment = fragments[block.start]\n\n block_trans_names_in = {}\n block_trans_stack_in = []\n\n # Combine the names and stack values that come in from previous blocks.\n\n if block.prev.size == 1\n # If the block has a single previous block, simply use all the names\n # and stack values out from that block.\n\n prev = block.prev.first\n\n block_trans_names_in.merge! trans_names_out[prev]\n block_trans_stack_in.push *trans_stack_out[prev]\n elsif block.prev.size > 1\n # If the block has multiple previous blocks then we could have\n # arrived at this basic block from either of them. That means that\n # values coming in for names or the stack. For each value that\n # comes in we join all the possible values in a phi node. The phi\n # node works as a switch to choose the correct value. It takes\n # input from the merge which starts this block, to tell it\n # which way to switch.\n\n # Find all the names out from all the previous blocks.\n\n all_names_out = block.prev.map { |p| trans_names_out[p].keys }.flatten.uniq.sort\n\n # See the number of stack values out from all the previous blocks.\n\n max_stack_out = block.prev.map { |p| trans_stack_out[p].size }.max\n\n # If all blocks don't have the same names and number of stack values we don't know what to do.\n\n block.prev.each do |prev|\n raise 'unsupported' unless trans_names_out[prev].keys.sort == all_names_out\n raise 'unsupported' unless trans_stack_out[prev].size == max_stack_out\n end\n\n # Create phis for each value\n\n all_names_out.each do |name|\n phi = Node.new(:phi)\n fragment.merge.output_to :switch, phi\n\n block.prev.each do |prev|\n trans_names_out[prev][name].output_to :value, phi, :\"value(#{prev})\"\n end\n\n block_trans_names_in[name] = phi\n end\n\n max_stack_out.times do |index|\n phi = Node.new(:phi)\n fragment.merge.output_to :switch, phi\n\n block.prev.each do |prev|\n trans_stack_out[prev][index].output_to :value, phi, :\"value(#{prev})\"\n end\n\n block_trans_stack_in.push phi\n end\n end\n\n # The output set is the same as the input set...\n\n block_trans_names_out = block_trans_names_in.dup\n block_trans_stack_out = block_trans_stack_in.dup\n\n # ...then add the new names and stack values from this fragment.\n\n fragment.names_out.each do |name, value|\n block_trans_names_out[name] = value\n end\n\n fragment.stack_out.each do |value|\n block_trans_stack_out.push value\n end\n\n # Remember this transitive set for this block.\n\n trans_names_in[block.start] = block_trans_names_in\n trans_stack_in[block.start] = block_trans_stack_in\n\n trans_names_out[block.start] = block_trans_names_out\n trans_stack_out[block.start] = block_trans_stack_out\n end\n\n # Connect the data flow between fragments, using the transitive sets.\n\n blocks.each_value do |block|\n fragment = fragments[block.start]\n\n fragment.names_in.each do |name, input|\n trans_names_in[block.start][name].output_to :value, input\n end\n\n fragment.stack_in.each_with_index do |input, index|\n trans_stack_in[block.start][index].output_to :value, input\n end\n end\n\n # Connect the control flow between fragments.\n\n blocks.each_value do |block|\n fragment = fragments[block.start]\n\n if block.prev.empty?\n # If the block has no previous blocks, connect the start of the\n # graph to it.\n\n @graph.start.output_to :control, fragment.merge\n end\n\n if block.next.empty?\n # If the block has no next blocks, connect it to the finish of\n # the graph.\n\n fragment.last_control.output_to :control, @graph.finish\n fragment.last_node.output_to :value, @graph.finish\n elsif block.next.size == 1\n # If the block has a single next block, connect the last control\n # node of this block to the merge node of the next block.\n\n next_i = block.next.first\n next_fragment = fragments[next_i]\n\n fragment.last_control.output_to :control, next_fragment.merge, :\"control(#{block.start})\"\n elsif fragment.last_control.op == :branch\n # If the block ends with a branch then it goes to two possible next\n # blocks. The branch node outputs two control edges, one labelled\n # true and one labelled false. This is the only place where control\n # forks like this.\n\n raise unless block.next.size == 2\n branch = fragment.last_control\n branch.output_to :true, fragments[block.next[0]].merge, :control\n branch.output_to :false, fragments[block.next[1]].merge, :control\n else\n raise 'unsupported'\n end\n end\n end",
"def process_fragment_node(node)\n append(\"#{\n @as_module ? \"import * as HTX from '#{@import_path}'\\n\\n\"\n : \"#{@assign_to}['#{@name}'] = ((HTX) => {\\n#{@indent}\"\n }function render($renderer) {\\n\")\n\n @indent = @base_indent * 2 unless @as_module\n\n node.children.each do |child|\n process(child)\n end\n\n append(\"\\n\\n#{@indent}return $renderer.rootNode\")\n\n @indent = @as_module ? '' : @base_indent\n\n append(\n <<~JS\n\n #{@indent}}\n\n #{@indent}#{@as_module ? 'export' : 'return'} function Template(context) {\n #{@indent}#{@base_indent}this.render = render.bind(context, new HTX.Renderer)\n #{@indent}}#{\n \"\\n})(globalThis.HTX ||= {});\" unless @as_module}\n JS\n )\n\n flush\n end",
"def initialize\n super(Network.generate_id(\"block_\"))\n end",
"def generate_graph\n end",
"def basic_blocks\n cfg.blocks\n end",
"def add_block(block)\n return if ilp.has_variable?(block)\n ilp.add_variable(block)\n lhs = block_frequency(block) + [[block, -1]]\n ilp.add_constraint(lhs,\"equal\",0,\"block_#{block.qname}\", :structural)\n end",
"def mixblocks2seq!\n # Recurse on the scope.\n self.scope.mixblocks2seq!\n end",
"def by_basic_block(bb, level)\n assert(\"RelationNodeList#by_basic_block: level != :src,:dst\") { [:src,:dst].include?(level) }\n lookup(@basic_block_index[level], bb, \"#{level}-block\", false) || []\n end",
"def nodes_in_block(first_node)\n # We're going to do a depth-first search of the graph from the first\n # node, following control flow edges out, and global schedule edges in,\n # and stopping when we find a node that ends a basic block such as a\n # branch.\n\n worklist = [first_node]\n block = Set.new\n\n until worklist.empty?\n node = worklist.pop\n\n if block.add?(node)\n # We need to visit nodes that are anchored to this one.\n\n node.inputs.edges.each do |i|\n if i.input_name == :global_schedule\n worklist.push i.from\n end\n end\n\n # If this node isn't a branch, and it's either the first node or it\n # isn't a merge, visit the nodes that follow it in control flow.\n\n if node.op != :branch && (node == first_node || node.op != :merge)\n node.outputs.edges.each do |o|\n if o.control?\n if !(node.op == :start && o.to.op == :finish)\n worklist.push o.to\n end\n end\n end\n end\n end\n end\n\n block.to_a\n end",
"def define(&block)\n block.call DSL::GraphDefiner.new(@graph)\n self\n end",
"def new\n @block = Block.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @block }\n format.json { render :json => @block }\n end\n end",
"def block_def_node\n if @ast == nil\n if block == nil\n return nil\n end\n\n # Get array of block parameter names\n block_params = block.parameters.map do |param|\n param[1]\n end\n\n parser_local_vars = command_binding.local_variables + block_params\n source = Parsing.parse_block(block, parser_local_vars)\n @ast = AST::BlockDefNode.new(\n parameters: block_params,\n ruby_block: block, # necessary to get binding\n body: AST::Builder.from_parser_ast(source))\n end\n\n # Ensure `return` is there\n @ast.accept(Translator::LastStatementReturnsVisitor.new)\n\n return @ast\n end",
"def generate_genesis_block\n block = Block.new(0, 'Genesis Block', 0, 5.0)\n block.hash = 'GENESIS'\n\n block\n end",
"def decode_blocks(base_addr=0, eip=base_addr)\n sc = Metasm::Shellcode.decode(self, @@cpu)\n sc.base_addr = base_addr\n sc.disassemble(eip)\n end",
"def new\n @block = Block.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @block }\n end\n end",
"def single_connected_fragmentation\n peptide2 = @peptide.split('').insert(0,\"h\").insert(-1,\"oh\").join\n frag__b = ([email protected]+1).collect do |num|\n peptide2.split('').insert(num,'b').join \n end\n frag__y = (2..(@peptide.size)).to_a.collect do |ei|\n peptide2.split('').insert(ei,'y').join \n end\t\t\t\n final_arry_spectra = [frag__b,frag__y].flatten.collect do |pep_b|\n\t\t\t\tpep_b.gsub!(/[by]/, 'b'=>'+-h', 'y'=>'%-hh+').split(\"-\")\n end \n final_arry_spectra\n end",
"def block_node=(_); end",
"def process_blocks(blocks); end",
"def data(&block)\n if block_given?\n project_graph(nil) do |statement|\n block.call(statement) unless statement.variable? ||\n has_graph?(statement.subject) ||\n has_graph?(statement.object)\n end\n end\n enum_data\n end",
"def emit_body(anIO)\n anIO.puts <<-DOT\n subgraph island {\n node [shape = box, style=filled, color=lightgray];\nDOT\n feature_files.each_with_index do |ff, i|\n draw_node(anIO, ff, i) if ff.feature.anonymous?\n end\n\n anIO.puts <<-DOT\n label = \"Isolated features\";\n }\n\n subgraph dependencies {\n node [shape = box, fillcolor = none];\nDOT\n feature_files.each_with_index do |ff, i|\n draw_node(anIO, ff, i) unless ff.feature.anonymous?\n end\n anIO.puts <<-DOT\n label = \"Dependencies\";\n }\n\n // The edges represent dependencies\nDOT\n dependencies.each { |a_dep| draw_edge(anIO, a_dep) }\n end",
"def gv_object\n return @gv_object if @gv_object\n return unless defined? GraphViz\n @gv_object = GraphViz.new gv_graph_name, :type => :digraph\n @gv_object.node_attrs[:style] = 'filled, solid'\n\n each_task do |task|\n next unless task.node == gv_filter_node if gv_filter_node\n gv_node = @gv_object.add_node task.to_s\n gv_node.fillcolor = gv_task_color(task)\n end\n\n each_task do |task|\n task.each_dependency do |dep_task|\n next unless dep_task.node == gv_filter_node if gv_filter_node\n next unless @gv_object.find_node dep_task.to_s and @gv_object.find_node task.to_s\n @gv_object.add_edges dep_task.to_s, task.to_s\n end\n end\n @gv_object\n end",
"def new\n @block = @site.blocks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @block }\n end\n end",
"def dump_blocks(stream, x_start, y_start, z_start, x_end, y_end, z_end)\n\n end",
"def mixblocks2seq!\n # Is the block mix?\n return unless block.mix?\n # Mixed, do convert.\n # Converts the block to seq.\n self.block.to_seq!\n end",
"def create\n @block = Block.new(params[:block])\n\t@conferences = Conference.all\n\t@tracks = Track.all\n\n respond_to do |format|\n if @block.save\n format.html { redirect_to @block, notice: 'Block was successfully created.' }\n format.json { render json: @block, status: :created, location: @block }\n else\n format.html { render action: \"new\" }\n format.json { render json: @block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visit_block = VisitBlock.new(params[:visit_block])\n\n respond_to do |format|\n if @visit_block.save\n format.html { redirect_to visits_path, notice: 'Visit block was successfully created.' }\n format.json { render json: @visit_block, status: :created, location: @visit_block }\n else\n format.html { render action: \"new\" }\n format.json { render json: @visit_block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def beginning_to_pack_fragment(_fragment)\n end",
"def map_nodes!(&ruby_block)\n @statement = ruby_block.call(@statement)\n @statement.parent = self unless @statement.parent\n end",
"def nested_graph\n @nested_graph ||= ModelConverter.new(resource: Valkyrie::Types::Anything[value.value], adapter: value.adapter, subject_uri: subject_uri).convert.graph\n end",
"def create\n @block = @site.blocks.build(params[:block])\n @block.user_id = current_user.id\n\n respond_to do |format|\n if @block.save\n flash[:notice] = 'Block was successfully created.'\n format.html { redirect_to(one_table_blocks_path(@one_table)) }\n format.xml { render :xml => @block, :status => :created, :location => @block }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @block.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def fragment(name, *args, &block)\n if block_given?\n warn \"fragment definition form (with block) is deprecated. Use #def_fragment instead\"\n def_fragment(name, *args, &block)\n else\n use_fragment(name, *args)\n end\n end",
"def new\n @block = Block.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @block }\n end\n end",
"def each_vertex(&block) # :yields: v\n raise NotImplementedError\n end",
"def fragment_for(name = {}, options = nil, &block) #:nodoc:\n if controller.fragment_exist?(name, options)\n controller.read_fragment(name, options)\n else\n # VIEW TODO: Make #capture usable outside of ERB\n # This dance is needed because Builder can't use capture\n pos = output_buffer.length\n yield\n if output_buffer.is_a?(ActionView::OutputBuffer)\n safe_output_buffer = output_buffer.to_str\n fragment = safe_output_buffer.slice!(pos..-1)\n self.output_buffer = ActionView::OutputBuffer.new(safe_output_buffer)\n else\n fragment = output_buffer.slice!(pos..-1)\n end\n controller.write_fragment(name, fragment, options)\n end\n end",
"def fragment(*args, &block)\n Loofah::HTML::DocumentFragment.parse(*args, &block)\n end",
"def test_new\n\n b = Blockchain.new\n\n b << 'Genesis'\n b << 'Transaction Data...'\n b << ['Transaction Data...']\n b << ['Transaction Data...', 'Transaction Data...']\n b << [] ## empty block (no transactions)\n\n ## add do-it-yourself built block\n b << Block.next( b.last, 'Transaction Data...' )\n\n b << 'Transaction Data...'\n\n pp b\n\n assert true ## (for now) everything ok if we get here\nend",
"def Graph(name=:G, type=:digraph, &blk)\n Gviz.new(name, type).graph(&blk)\nend",
"def store_raw_block(block)\n payload = block.payload || block.to_payload\n if Toshi::Models::RawBlock.where(hsh: block.hash).empty?\n Toshi::Models::RawBlock.new(hsh: block.hash, payload: payload).save\n end\n end",
"def to_cpbb\n\t\treturn CP::BB.new(self.left, self.bottom, self.right, self.top)\n\tend",
"def parse_block(*_arg0); end",
"def inspect; to_ast.inspect end",
"def get_block4(index)\n b1, b2, b3, *_ = _calculate_block_indices(index)\n return unless @block1[b1] && @block1[b1][b2]\n @block1[b1][b2][b3]\n end",
"def make_link blocks\n raise \"from block #{@from.block_name} not found\" unless blocks.has_key?(@from.block_name)\n raise \"to block #{@to.block_name} not found\" unless blocks.has_key?(@to.block_name)\n \n from_block = blocks[@from.block_name]\n to_block = blocks[@to.block_name]\n \n raise \"from port #{@from.port_name} not found\" unless from_block.out_ports.has_key?(@from.port_name)\n raise \"to port #{@to.port_name} not found\" unless to_block.in_ports.has_key?(@to.port_name)\n \n from_port = from_block.out_ports[@from.port_name]\n to_port = to_block.in_ports[@to.port_name]\n \n return Link.new(:from => from_port, :to => to_port)\n end",
"def show\n @visit_block = VisitBlock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visit_block }\n end\n end",
"def raw_node; end",
"def relay_block_to_peers(block)\n # this is for peers\n @mq.workers_push_all({ 'msg' => 'relay_block', 'hash' => block.hash })\n # this is for websocket consumers\n @mq.clients_push_all({ 'msg' => 'new_block', 'hash' => block.hash })\n end",
"def subgraph_with(vertex)\n vertices = Set.new\n edges = Set.new\n pending = [vertex]\n until pending.empty?\n this_node = pending.shift\n conn_edges, conn_nodes = neighbors(this_node)\n conn_nodes.each do |node|\n pending << node unless vertices.include?(node)\n end\n vertices << this_node\n edges << conn_edges\n end\n PipeGraph.new(edges, vertices)\n end",
"def bfs( start, &block )\n start.distance = 0\n start.predecessor = nil\n start.gray!\n vq = Queue.new()\n vq.enqueue(start)\n while vq.size > 0\n current = vq.dequeue()\n current.get_connections.each do |nbr|\n if nbr.white?\n nbr.gray!\n nbr.distance = current.distance + 1\n nbr.predecessor = current\n vq.enqueue(nbr)\n end\n end\n current.black!\n yield current if block_given?\n end\n # clean up vertices attributes set during bfs\n @vertices.keys.each do |key|\n @vertices[key].distance = nil\n @vertices[key].predecessor = nil\n @vertices[key].color = nil\n end\n end",
"def rereverse_graph\n @a_matrix = ca_matrix\n read_vertices\n read_edges(0, 1)\n adj_lists\n end",
"def block_class() Block; end",
"def show\n @cover = Cover.find(params[:id])\n @plan = Plan.find(@cover.plan_id)\n @incident = Incident.find(@plan.incident_id)\n @block = Block.new\n @blocks = @cover.blocks.order(position: :asc)\n end",
"def new_block(proof, previous_hash = nil)\n block = {\n index: @chain.length + 1,\n epoch: Time.now.utc.to_f,\n transactions: @current_transactions,\n cost: @current_transactions.length - 1,\n proof: proof,\n previous_hash: previous_hash || Blockchain.hash(@chain.last)\n }\n @current_transactions = []; @chain << block; block\n end",
"def data_block\n return @data_block unless @data_block.nil?\n io = _root.data_blocks_with_io._io\n _pos = io.pos\n io.seek(ofs_data_block)\n @data_block = DataBlock.new(io, self, @_root)\n io.seek(_pos)\n @data_block\n end",
"def show\n @block = @site.blocks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @block }\n end\n end",
"def create\n\t\t@block = Block.new(block_params)\n\n\t\tif @block.save\n\t\t\tredirect_to blocks_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\n\tend",
"def create\n @block = Block.new(block_params)\n\n respond_to do |format|\n if @block.save\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render :show, status: :created, location: @block }\n else\n format.html { render :show }\n format.json { render json: @block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fragment?; end",
"def fragment?; end",
"def parse_block_html; end",
"def process(decoded_block)\n\t\t# filter them to where they need to go\n\t\tif decoded_block.blocks.length == 1\n\t\t\tadd_single_block(decoded_block)\n\t\telse\n\t\t\tadd_multi_block(decoded_block)\n\t\tend\n\t\tdecode if (@count % (@max_block/10)) == 0\n\t\t@count +=1\n\tend"
] | [
"0.6396569",
"0.60814226",
"0.5910024",
"0.5480614",
"0.542897",
"0.5424043",
"0.53848016",
"0.5323638",
"0.5311645",
"0.5270826",
"0.52481115",
"0.52298474",
"0.52169645",
"0.52151054",
"0.5191754",
"0.5168946",
"0.51431596",
"0.5138544",
"0.5137062",
"0.5137062",
"0.5035485",
"0.5024262",
"0.49709225",
"0.496182",
"0.4940822",
"0.49341685",
"0.49121788",
"0.4907815",
"0.4900338",
"0.4890845",
"0.4869467",
"0.48682296",
"0.48682296",
"0.4864283",
"0.4861066",
"0.48553634",
"0.4844331",
"0.48412216",
"0.48292395",
"0.48247615",
"0.4822019",
"0.48200127",
"0.4819705",
"0.48169792",
"0.4811347",
"0.48048934",
"0.47968078",
"0.47952247",
"0.4788848",
"0.47883528",
"0.47824505",
"0.47784853",
"0.47640803",
"0.4761002",
"0.47571418",
"0.47507825",
"0.47431925",
"0.47287956",
"0.47274408",
"0.47169927",
"0.47135398",
"0.4710226",
"0.47093472",
"0.4704175",
"0.47036442",
"0.46716192",
"0.46704003",
"0.46637377",
"0.4661926",
"0.46434483",
"0.46425697",
"0.46411583",
"0.46365497",
"0.46347272",
"0.4632952",
"0.4632651",
"0.46289945",
"0.46281385",
"0.4625264",
"0.46231794",
"0.46231595",
"0.46173537",
"0.46147087",
"0.46127185",
"0.4603117",
"0.45891935",
"0.45870453",
"0.45776007",
"0.45772967",
"0.45681855",
"0.4567029",
"0.4560063",
"0.45588982",
"0.4558652",
"0.4554627",
"0.45509404",
"0.45449632",
"0.45449632",
"0.4544283",
"0.45390594"
] | 0.6367712 | 1 |
before_action will run first and only render things inside find_book private method with find, edit and destroy action; this help to code dry by not repeting code over and over again by simply pointing the actions | def index
@books = Book.all.order("created_at DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t#show now run by find_book and before_action\n\t\t#keeps code dry\n\tend",
"def prepare_for_action\n # #don't save stuff between requests\n NotRelational::RepositoryFactory.instance.clear_session_cache\n @@page_blurbs =Set.new\n @renderer_params={}\n $current_weblab=nil\n @current_user=nil\n @displayed_blurb_names=Set.new\n # if BannedIp.is_banned?(request.remote_ip)\n # head(401)\n # return\n # end\n\n prepare_language_for_action\n prepare_powerbar_for_action\n prepare_rendermode_for_action\n prepare_weblab_for_action\n\n\n self.page_title=\"Rengine\"\n self.no_wrap=false\n return true\n end",
"def before_action \n end",
"def index\n books_to_consider=user_signed_in? ? (Book.where.not(owner_id: current_user.id) if stale?(Book.where.not(owner_id: current_user.id))) : (Book.all if stale?(Book.where.not(owner_id: current_user.id)))\n @books=[]\n books_to_consider.each do |book|\n unless BookTransaction.where(\"book_id=? AND (approved=false OR requested=false OR returned=false)\",book.id).exists?\n @books.push(book)\n end\n end\n @books = @books.where(genre: params[:genre]) if params[:genre].present?\n @books = @books.where(author: params[:author]) if params[:author].present?\n @books = @books.where(title: params[:title]) if params[:title].present?\n \n if params[:userid].present?\n books_by_user=[]\n @books.each do |book|\n if book.owner_id=params[:userid]\n books_by_user.push(book)\n end\n end\n @books=books_by_user\n end\n\n @books = @books.search(params[:search]) if params[:search].present?\n @books = @books.paginate(:page => params[:page], :per_page => 15)\n @unique_authors = Book.uniq.pluck(:author)\n @unique_genre = Book.uniq.pluck(:genre)\n #render :layout => false\n \n end",
"def manage_books\n\n end",
"def index\n check_if_student\n @books = Book.all\n end",
"def before_embedded(record, action); end",
"def find_book\n\t@book = Book.find(params[:id])\nend",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def edit\n checkBookExist\n if !@current_user || @current_user.position == \"User\"\n flash[:warning]= \"WARN! You don't have authority to edit book!\" \n redirect_to book_path(@book)\n end\n end",
"def index\n if current_student\n student_id = current_student.id \n @books = Book.fetch_books_by_university(student_id)\n elsif current_admin\n @books = Book.all\n elsif current_librarian\n library_id = current_librarian.library_id\n @books = Book.fetch_books_by_library(library_id)\n end\n\n if !params[:search].nil?\n @books = @books & Book.search(params[\"search_by\"].downcase, params[:search])\n end\n end",
"def index\n if params[:author_id]\n @author = Author.find(params[:author_id])\n @books = @author.books\n else\n @books = Book.all\n end\n end",
"def before_action verb = nil, &block\n playbook.before_action verb, &block\n end",
"def edit\n #SET_CHEF method will be called form BEFORE_ACTION\n end",
"def handle_edit\n if request.id\n obj = model.with_pk(normalized_type, request, request.id)\n model.hook(:before_edit, request, obj)\n edit_page(obj)\n else\n list_page(:edit)\n end\n end",
"def test_prepend_before_action\n render @page # should not be safe\n end",
"def show\n @collection_name = BookList.find(params[:id])\n breadcrumbs.add 'MY SHELVES', book_lists_path\n breadcrumbs.add @collection_name.category.upcase+' SHELF'\n @shelf0 = ListItem.find_all_by_book_list_id(@collection_name.id).paginate(:page=>params[:page], :per_page => params[:per_page])\n #unless params[:notice].blank? \n # flash[:notice] = params[:notice] \n #end\n end",
"def user_books\n @title = \"My Books\"\n @user = User.find(params[:id])\n @books = @user.book_lists.paginate(page: params[:page])\n render 'user_books'\n end",
"def filtered\n @books = []\n @order = 'asc'\n filter_by\n\n respond_to do |format|\n format.html{render partial: 'books/book_list', locals: {books: @books, order: @order}, layout: false}\n format.js {render partial: 'books/book_list', locals: {books: @books, order: @order}, layout: false}\n end\n end",
"def set_book\n @book = Book.active?.find(params[:id])\n end",
"def create\n @book = Book.new(book_params)\n @book.save_book\n\n need = InventoryNeed.find_by_book_id_and_user_id(@book.id, session[:user_id])\n own = InventoryOwn.find_by_book_id_and_user_id(@book.id, session[:user_id])\n\n unless (need and need.deleted == false) or (own and own.deleted == false)\n @inventory_need = InventoryNeed.new\n @inventory_need.book_id = @book.id\n @inventory_need.user_id = session[:user_id]\n @inventory_need.deleted = false\n\n respond_to do |format|\n if @inventory_need.save\n format.html { redirect_to search_path + \"?\" + params[:search].to_query(\"search\") }\n format.json { render action: 'index', status: :created, location: @inventory_need }\n else\n format.html { render action: 'new' }\n format.json { render json: @inventory_need.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to search_path + \"?\" + params[:search].to_query(\"search\")\n end\n end",
"def action_hook; end",
"def update\n @book = Book.find(params[:id])\r\n if @book.name != \"自分で登録した問題\"\n if @book.update_attributes(params[:book]) && @book.name != \"自分で登録した問題\"\r\n if @book.is_smart == true\r\n tags = @book.tags.split(\",\")\r\n tags.delete(\"\")\r\n @book.update_attribute(:tags ,tags.join(\",\"))\r\n categories = @book.categories.split(\",\")\r\n categories.delete(\"\")\r\n @book.update_attribute(:categories ,categories.join(\",\"))\r\n else\r\n if params[:is_collect]\r\n params[:is_collect].each_pair do |id,value|\r\n q = Question.find(id.to_i)\r\n @book.questions.delete(q)\r\n end\r\n end\r\n end\n render :update do |page|\r\n page.redirect_to :controller => \"mypage\"\r\n end\r\n else\n @msgs = @book.errors.full_messages\r\n render :update do |page|\r\n page.replace_html(\"message\", :partial=>\"message\",:locals => {:flug => \"error\"},:object => @msgs)\r\n page[:msg].visual_effect :highlight,\r\n :startcolor => \"#ffd900\",\r\n :endcolor => \"#ffffff\",\r\n :duration => 1.5\r\n end\n end\r\n else\r\n @book.valid?\r\n @msgs = @book.errors.full_messages\r\n @msgs << \"そのブック名は使用できません。\"\r\n render :update do |page|\r\n page.replace_html(\"message\", :partial=>\"message\",:locals => {:flug => \"error\"},:object => @msgs)\r\n page[:msg].visual_effect :highlight,\r\n :startcolor => \"#ffd900\",\r\n :endcolor => \"#ffffff\",\r\n :duration => 1.5\r\n end\r\n end\n end",
"def index\n if params.has_key?(:search) && params[:search].strip != \"\" #for rental search across site\n @books = Book.search(params[:search], :match_mode => :any, :star => true, :page => params[:page], :per_page => 10)\n if (@books.count == 0)\n @books = nil\n end\n\n elsif params[:category] #for category search\n @book_ids = BookCategory.where('category_id = ?', params[:category]).pluck(:book_id)\n if (@book_ids)\n @books = Book.where(:id => @book_ids).paginate(:page => params[:page], :per_page => 10)\n if (UserBook.find_by_book_id(@book_ids) == nil)\n @books = nil\n end\n else\n @books = nil\n #flash[:alert] = \"We didn't find any book in this category :(\" #not showing up\n end\n \n #elsif params[:value] #for autosuggest on search bar\n # @books = Book.search(params[:value], :match_mode => :any, :star => true)\n \n else \n @books = Book.where(:id => [1..191]).paginate(:page => params[:page], :per_page => 10) #paginate(:page => params[:page], :per_page => 1) #(limit: 10)\n flash.now[:alert] = \"Please type in something to search. Some recent listings have been shown. Also, we just opened up the listing feature :)\"\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n\n end",
"def sort\n book_no = params[:sort][:book_no]\n isbn = params[:sort][:isbn]\n flg_no_isbn = params[:sort][:flg_no_isbn]\n # check for an existing fulfilled, or dispatched record\n #ibtrs = Ibtr.find_all_by_book_no_and_state(book_no, [:Dispatched,:Fulfilled], :order => 'state desc, updated_at desc')\n #@ibtr = ibtrs.size == 0 ? nil : ibtrs[0]\n @ibtr = Ibtr.sort_1_jun.find_by_book_no_and_state(book_no, [:Dispatched,:Fulfilled])\n ib = IbtSort.new\n ib.book_no = book_no\n ib.isbn = isbn\n ib.flg_no_isbn = flg_no_isbn\n\n respond_to do |format|\n unless @ibtr.nil?\n @ibtr.d_user = current_user.id\n \n if @ibtr.state = :Fulfilled\n @ibtr.dispatch!\n end\n ib.ibtr_id = @ibtr.id\n ib.save!\n \n flash[:notice] = \"book dispatched to #{@ibtr.card_id} of branch #{@ibtr.branch_id}\"\n format.html { redirect_to @ibtr }\n format.xml # dispatch.xml.erb\n else\n good = Good.find_by_book_no(book_no) #to do: to add date restriction\n if good.nil? \n status = :precondition_failed\n else\n status = :not_found\n ib.consignment_id = good.consignment_id\n end\n ib.save\n format.html { render :action => \"lookup\" }\n format.xml { render :nothing => true, :status => status }\n end\n end \n end",
"def load_book\n @book = Book.find(params[:id])\n end",
"def test_append_before_action\n render @page # should be safe\n end",
"def show\r\n find_record\r\n # before_show callback\r\n if (m = callback_method('before_show') )\r\n ret = call_callback_method(m)\r\n if ret.class == FalseClass\r\n @form['readonly'] = nil # must be\r\n flash[:error] ||= t('drgcms.not_authorized')\r\n return index\r\n end\r\n end \r\n\r\n render action: 'edit', layout: 'cms'\r\nend",
"def index\n if params[:search].present?\n @books = Book.search_by_name(params[:search]).order(name: :ASC).page params[:page]\n elsif params[:status].present?\n case params[:status]\n when \"Draft\"\n @books = Book.draft.search_by_name(params[:search]).order(name: :ASC).page params[:page]\n when \"Published\"\n @books = Book.published.search_by_name(params[:search]).order(name: :ASC).page params[:page]\n end\n elsif params[:person].present?\n @books = Book.joins(:compositions).where(compositions: { person_id: params[:person] }).order(name: :ASC).page params[:page]\n else\n @books = Book.order(name: :ASC).page params[:page]\n end\n end",
"def index \n @filter = params[:filter] || \"order_by_title\"\n @books = Book.send(@filter) # Filter book index based on a filter param - default is order by title\n end",
"def edit_basic_predetails\n\t\t@petowner = Petowner.find( params[:id] )\n\n\t\t# instance variable is killed off so we have to recreate it\n\t\t@all_residential_areas_in_nairobi = ResidentialArea.all\n\n\t\trender 'edit_basic_predetails'\t\n\tend",
"def set_book\n @book = current_author.books.friendly.find(params[:id])\n end",
"def before\n\t\t\ttrue\n\t\tend",
"def delete_library_transaction\n @financetransaction=FinanceTransaction.find(params[:id])\n if @financetransaction\n @financetransaction.cancel_reason = params[:reason]\n @financetransaction.destroy\n end\n if params[:s_date].present?\n @start_date=params[:s_date]\n @end_date=params[:e_date]\n @transactions=FinanceTransaction.paginate(:per_page=>20,:page=>params[:page],:joins=>'LEFT OUTER JOIN students ON students.id = payee_id',:conditions=>[\"(finance_transactions.created_at >='#{@start_date}' and finance_transactions.created_at <='#{@end_date}') and (finance_type='BookMovement' and payee_id=students.id)\"],:order=>'created_at desc')\n render :update do |page|\n page.replace_html 'deleted_transactions', :partial => \"books/library_transactions_date_filter\"\n end\n elsif params[:query].present?\n @transactions=FinanceTransaction.paginate(:per_page=>20,:page=>params[:page],:joins=>'LEFT OUTER JOIN students ON students.id = payee_id',:conditions => [\"(students.admission_no LIKE ? OR students.first_name LIKE ?) and finance_type=?\",\n \"#{params[:query]}%\",\"#{params[:query]}%\",'BookMovement'],:order=>'created_at desc') unless params[:query] == ''\n render :update do |page|\n page.replace_html 'deleted_transactions', :partial => \"books/search_library_transactions\"\n end\n else\n @transactions=FinanceTransaction.paginate(:per_page=>20,:page=>params[:page],:conditions=>[\"created_at >='#{Date.today}' and created_at <'#{Date.today+1.day}' and finance_type='BookMovement'\"],:order=>'created_at desc')\n render :update do |page|\n page.replace_html 'deleted_transactions', :partial => \"books/library_transactions\"\n end\n end\n end",
"def before(*actions, &block)\n before_action = Moonrope::BeforeAction.new(@controller)\n before_action.block = block\n before_action.actions = actions\n @controller.befores << before_action\n before_action\n end",
"def index\n @books = Book.read_all_except_system(current_user.id).page(params[:page]).per(10)\n @current_total = Book.read_current_income(current_user.id)\n \n # new stuff.\n @percent_current_income = Book.percent_current_income(current_user.id, 31)\n @spending_levels = Book.read_spending_level(current_user.id, 31)\n @sum_income = Book.sum_income(current_user.id, 31).to_f\n @sum_bill = Book.sum_bill(current_user.id, 31).to_f\n\n # new book.\n @book = Book.new\n @book.user_id = current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def set_author_book\n @author_book = AuthorBook.find(params[:id])\n end",
"def set_author_book\n @author_book = AuthorBook.find(params[:id])\n end",
"def set_admin_book\n @book = Book.find(params[:id])\n end",
"def set_admin_book\n @book = Book.find(params[:id])\n end",
"def set_admin_book\n @book = Book.find(params[:id])\n end",
"def index \n # set the default value for the clear button \n params[:clear] = \"\" unless params[:clear]\n params[:sort] = \"last_name_asc\" unless params[:sort]\n #params[:filter] = {} unless params[:filter]\n \n # save the model names for use by the views (filter & sort)\n @plural_model_name = 'users'\n @model_name = 'user'\n @act_restful = true\n \n # sanatize the display param.\n params[:display] = sanitize_display(params[:display])\n\n # sanatize the sort params\n @sort_col, @sort_dir, model_name, @orig_col_name = sanitize_sort(params[:sort], '', @plural_model_name)\n \n # sanatize the filter params\n params[:filter] = nil if params[:clear].downcase == \"clear\" # if the user clicked on the 'clear' toss the filter params to the bit bucket.\n conditions = HashWithIndifferentAccess.new\n conditions.merge!(logged_in? ? {:is_active => 1} : {:show_personal_info => 1, :is_active => 1}) # the built in filter.\n conditions = params[:filter].merge!(conditions) if params[:filter]\n \n @filter = sanitize_filter(conditions)\n \n # create the params for the find method\n find_params = {:per_page => params[:display].to_i}\n \n # we need to remove the single quotes so the order works with included tables.\n # because rails alises all of the columns to generated names i.e. t0_r0, t0_r1\n find_params.merge!({:order => ActiveRecord::Base.send(:sanitize_sql, [\" #{model_name}.? #{@sort_dir}\", @sort_col]).delete(\"'\")}) if @sort_col\n find_params.merge!({:conditions => @filter}) if @filter\n find_params.merge!({:include => :discipline })\n\n # do the search\n @user_pages, @user_data = paginate :users, find_params\n \n # take care of rendeing if the user wants us to.\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @user_data.to_xml }\n format.text { render :text => data_text(false) }\n format.csv { render :text => data_text }\n end \n end",
"def set_books\n @books = Book.order('created_at ASC').paginate(:page => params[:page], :per_page => 10)\n end",
"def edit_basic_predetails\n\t\t@petsitter = Petsitter.find( params[:id] )\n\n\t\t# instance variable is killed off so we have to recreate it\n\t\t@all_residential_areas_in_nairobi = ResidentialArea.all\n\n\t\trender 'edit_basic_predetails'\t\n\tend",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def index\n\n @page_title = 'Listing books'\n sort_by = params[:sort_by]\n @books = Book.paginate(page: params[:page], per_page: 5).order(sort_by)\n #@book_pages, @books = paginate :books, :order => sort_by, :per_page => 10\n #@books = Book.all\n end",
"def edit_book(selected)\n\tedit_book_title(selected)\n\tedit_book_author(selected)\n\tedit_book_isbn(selected)\nend",
"def index\n #redirect_if_not_logged_in\n @books = Book.all\n end",
"def index\n book_id = params[:book_id]\n\n @mybooks = Mybook.all(:user_id => current_user.id, :order => [:order])\n if book_id == nil\n if @mybooks.count > 0\n book_id = Mybook.first(:user_id => current_user.id, :order => [:order]).id.to_s\n end\n end\n @mybookfolder = Mybookfolder.get(book_id.to_i)\n @mybookpdfs = Mybookpdf.all(:mybook_id => book_id.to_i, :order => [:order])\n puts_message @mybookpdfs.count.to_s\n @menu = \"mytemplate\"\n @board = \"mybook\"\n @section = \"index\"\n \n @folders = Mybook.all(:user_id => current_user.id)\n \n render 'mybook'\n end",
"def set_book\n if params[:id].present?\n @book = Book.find(params[:id])\n else\n @book = Book.find(params[:book_id])\n end\n end",
"def show\n @book = Book.find(params[:id])\r\n if user = User.find(:first, :conditions =>[\"id =?\",@book.user_id])\r\n @user_name = user.login\r\n else\r\n @user_name = \"-\"\r\n end\r\n if @book.is_smart == true\r\n if @book.tags != \"\"\r\n questions_t = Array.new\r\n @tags = @book.tags.split(\",\")\r\n @tags.each do |tag|\r\n questions_t << Question.find_tagged_with(tag)\r\n end\r\n questions_t.flatten!.uniq!\r\n end\r\n\r\n if @book.categories != \"\"\r\n questions_c = Array.new\r\n @categories = @book.categories.split(\",\")\r\n @categories.each do |category_name|\r\n category = Category.find(:first, :conditions => ['name = ?', category_name])\r\n questions_c << Question.find(:all, :conditions => ['category_id = ? and is_public = 1', category.id])\r\n end\r\n questions_c.flatten!.uniq!\r\n end\r\n\r\n if questions_t && questions_c\r\n @questions = (questions_t & questions_c)\r\n elsif @questions = questions_c\r\n @tags = Array.new\r\n elsif @questions = questions_t\r\n @categories = Array.new\r\n else\r\n @questions = Array.new\r\n @tags = Array.new\r\n @categories = Array.new\r\n end\r\n\r\n end\n end",
"def show\r\n find_record\r\n if (m = callback_method('before_show') )\r\n ret = call_callback_method(m)\r\n# Don't do anything if return is false\r\n if ret.class == FalseClass\r\n @form['readonly'] = nil # must be\r\n return index \r\n end\r\n end \r\n\r\n render action: 'edit', layout: 'cms'\r\nend",
"def check_non_author\n book = Book.find(params[:id])\n if book.user_id != current_user.id\n redirect_to books_path, alert: \"You are not main author of this book. Access denied\"\n end\n end",
"def before_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def index\n if view_context.is_admin?\n @books = Book.all\n elsif user_signed_in?\n @books = Book.where(\"is_approved = ? or user_id = ?\", true, current_user.id)\n else\n @books = Book.where(\"is_approved = ?\", true)\n end\n end",
"def create\n @book = Book.new(params[:book])\n @book.user_id = current_user.id\n # can alternatively use:\n # @book = current_user.books.build(params[:book])\n\n # I used the below code before I had added before_create to book model\n # client = Goodreads.new\n # book_info = client.book_by_isbn(params[:book][:isbn])\n # @book.title = book_info.title if @book.title.blank?\n \n\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book_author\n @book_author = BookAuthor.find(params[:id])\n end",
"def update\n @book = Book.find(params[:id])\n\tcreate_author(params[:q],params[:r])\n\n if @author != nil\n\t respond_to do |format|\n if @book.update_attributes(params[:book])\n\t @author.books << @book unless @author.books.include? @book\n\t\t if params[:checks] != nil\n\t params[:checks].each do |s|\n\t\t if @book.authors.count > 1\n\t @book.authors.delete(Author.find_by_id(s))\n\t end\n \t end\n\t end\n\t\t @author = nil\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n\t end\n\telse\n\t respond_to do |format|\n\t flash.now[:error] = 'Author name not valid'\n\t respond_to do |format|\n\t format.html { render :action => \"edit\" }\n\t end\n\t end\n\tend\n end",
"def new_action_before\n @status = true\n @suppliers = Supplier.all\n end",
"def index\n authorize! :read, StudentBook\n items_per_page = 25\n @grade_levels = GradeLevel.all.order(:id)\n @grade_level_ids = @grade_levels.collect(&:id)\n @grade_sections = GradeSection.all.order(:id)\n @grade_sections_ids = @grade_sections.collect(&:id)\n if params[:s].present?\n @grade_section = @grade_sections.where(id:params[:s]).first\n @grade_level = @grade_section.grade_level\n end\n\n @year_id = params[:year] || AcademicYear.current_id\n @academic_year = AcademicYear.find @year_id\n textbook_category_id = BookCategory.find_by_code('TB').id\n\n if params[:student_id].present?\n @student = Student.where(id:params[:student_id]).take\n gss = @student.grade_sections_students.where(academic_year_id: @year_id).try(:first)\n if gss.present?\n @grade_section = gss.grade_section\n @roster_no = gss.order_no\n # Notes: Because of data errors in database, we search StudentBook without student_id\n # => but filter it with grade_section, year and roster_no\n @student_books = StudentBook.where(grade_section:@grade_section)\n .standard_books(@grade_section.grade_level.id, @grade_section.id, @year_id, textbook_category_id)\n .where(roster_no:@roster_no.to_s)\n .where(academic_year_id:@year_id)\n .includes([:book_copy, book_copy: [:book_edition]])\n end\n elsif params[:s].present?\n @students = @grade_section.current_students\n @student_books = StudentBook.where(grade_section:@grade_section)\n .where(academic_year_id:@year_id)\n .standard_books(@grade_section.grade_level.id, @grade_section.id, @year_id, textbook_category_id)\n .order('roster_no ASC, standard_books.id ASC')\n .includes([:book_copy, book_copy: [:book_edition]])\n else\n @student_books = StudentBook.includes([:book_copy, book_copy: [:book_edition]])\n .where(academic_year_id:@year_id)\n .paginate(page: params[:page], per_page: items_per_page)\n end\n\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: \"StudentBooks-#{@grade_section.slug if params[:s].present?}#{('-'[email protected] if @student.present?)}\",\n disposition: 'inline',\n template: 'student_books/index.pdf.slim',\n layout: 'pdf.html',\n show_as_html: params.key?('debug')\n end\n end\n end",
"def set_book\n puts 'here', params\n params[:id] = params[:id] ? params[:id] : params[:book][:id]\n @book = Book.find(params[:id])\n end",
"def index\n \n breadcrumbs.add 'MY SHELVES'\n \n @shelves = BookList.find_all_by_user_id(current_user.id)\n if(@shelves.size > 0)\n @shelf0 = ListItem.find_all_by_book_list_id(@shelves[0].id).paginate(:page=>1, :per_page => 3)\n else\n @shelf0 = []\n end\n if(@shelves.size > 1)\n @shelf1 = ListItem.find_all_by_book_list_id(@shelves[1].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf1 = []\n end\n \n if(@shelves.size > 2) \n @shelf2 = ListItem.find_all_by_book_list_id(@shelves[2].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf2 = []\n end\n if(@shelves.size > 3)\n @shelf3 = ListItem.find_all_by_book_list_id(@shelves[3].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf3 = []\n end\n if(@shelves.size > 4)\n @shelf4 = ListItem.find_all_by_book_list_id(@shelves[4].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf4 = []\n end\n if(@shelves.size > 5)\n @shelf5 = ListItem.find_all_by_book_list_id(@shelves[5].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf5 = []\n end\n if(@shelves.size > 6)\n @shelf6 = ListItem.find_all_by_book_list_id(@shelves[6].id).paginate(:page=>1, :per_page => 3)\n else\n @shelf6 = []\n end\n if(@shelves.size > 7)\n @shelf7 = ListItem.find_all_by_book_list_id(@shelves[7].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf7 = []\n end\n if(@shelves.size > 8)\n @shelf8 = ListItem.find_all_by_book_list_id(@shelves[8].id).paginate(:page=>1, :per_page => 2)\n else\n @shelf8 = []\n end\n end",
"def edit\n #@user = User.find(params[:id]) \n #replced by the before_action at the top\n end",
"def index \n @book_shop = find_book_shop_params\n @books = @book_shop.books.all\n end",
"def before\n return nil if blue_prints.before.empty?\n\n hook_action = HookAction.new(driver,\n blue_prints.before,\n :hook_action, self, location + '[hook_action]')\n\n hook_action.run\n end",
"def show\n# Following is an example of a reliable render/redirect\n=begin\n @cars = Car.find(:make)\n if @car.nil?\n @car = Car.all\n flash.now[:alert] = \"The car is not found\"\n render :index\n end\n=end\n end",
"def create\n\n @book = Book.new(book_params)\n @book.save_book\n\n own = InventoryOwn.find_by_book_id_and_user_id(@book.id, session[:user_id])\n need = InventoryNeed.find_by_book_id_and_user_id(@book.id, session[:user_id])\n\n unless (need and need.deleted == false) or (own and own.deleted == false)\n @inventory_own = InventoryOwn.new\n @inventory_own.book_id = @book.id\n @inventory_own.user_id = session[:user_id]\n @inventory_own.condition_id = params[:condition_id]\n @inventory_own.deleted = false\n\n respond_to do |format|\n if @inventory_own.save\n format.html { redirect_to search_path + \"?\" + params[:search].to_query(\"search\") }\n format.json { render action: 'show', status: :created, location: @inventory_own }\n else\n format.html { render action: 'new' }\n format.json { render json: @inventory_own.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to search_path + \"?\" + params[:search].to_query(\"search\")\n end\n end",
"def index\n # @books = Book.paginate_by_sql(\"select * from books where is_delete='false'\")\n @books = Book.find_by_sql(\"select * from books where is_delete=false \")\n end",
"def set_book\n @book ||= Book.find_by(id: params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def set_book\n @book = Book.find(params[:id])\n end",
"def before\n end",
"def set_book\n if Book.exists?(params[:id])\n @book = Book.find(params[:id])\n else\n redirect_to \"/books\", alert: \"there's no SUCH book\"\n end\n end",
"def show\n if (params[:print])\n @fault_book = FaultBook.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => 'print' }# show.html.erb\n format.json { render json: @fault_book, :layout => 'print' }\n end\n else \n @fault_book = FaultBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fault_book }\n end\n end\n end",
"def set_book\n puts \"************set book called\" \n puts :id\n @book = Book.find(params[:id])\n end",
"def show\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_book_chapters_url(@book_series, @collection, @book) }\n format.json { head :no_content }\n\n# respond_to do |format|\n# format.html # show.html.erb\n# format.json { render json: @book }\n end\n end",
"def book\n @books=Book.all\n @book=Book.find(params[:id])\n end",
"def load_controller_object context\n if action_name == 'edit' || action_name == 'destroy' || action_name == 'update'\n super\n else\n @student ||= begin\n id = params[find_first_parent.is_a?(Student) ? :student_id : :id ]\n Student.find(id)\n end\n @test_score = TestScore.new({student_id: @student.id}, as: current_role)\n end\n end",
"def show\n @enable_edit = false\n @admin = false\n \n @dress = Dress.find_by_slug(params[:slug])\n @type = DressType.find_by_name params[:type]\n \n if [email protected]? and [email protected]?\n @related_dresses = @dress.get_related_dresses\n set_dresses_viewed_cookies(@dress)\n @viewed_dresses = get_dresses_viewed(@dress)\n if @dress.supplier_account.nil? or @dress.dress_images.first.nil?\n respond_to do |format|\n format.html { redirect_to bazar_path }\n format.json { head :ok }\n end\n else \n @sa_type = @dress.supplier_account.supplier_account_type.name\n\n if !current_supplier.nil?\n set_supplier_layout\n @supplier = current_supplier\n @supplier_account = current_supplier.supplier_account\n @enable_edit = true\n elsif !current_user.nil? and current_user.role_id == 1 and [email protected]_account.nil?\n @supplier_account = @dress.supplier_account\n @supplier = @supplier_account.supplier\n @enable_edit = true\n @admin = true\n end\n \n @soldable = (@type.name == 'vestidos-novia' ? true : false)\n \n @title_content = @dress.introduction\n \t@meta_description_content = @type.name.gsub('-', ' ').capitalize+': '[email protected]+' - '[email protected]\n @og_type = 'article'\n @og_image = 'http://www.tributosport.com'[email protected]_images.first.dress.url(:original)\n @og_description = @type.name + ': ' + @dress.description\n\n @title = params[:type]\n generate_bread_crumbs(params[:type])\n add_breadcrumb @dress.introduction.capitalize, dress_ver_path(:type => params[:type], :slug => params[:slug])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dress }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to bazar_path }\n format.json { head :ok }\n end \n end\n end"
] | [
"0.6944654",
"0.5908161",
"0.58470625",
"0.5723019",
"0.56198925",
"0.55033916",
"0.5447014",
"0.54032576",
"0.53145635",
"0.5301747",
"0.5281134",
"0.5278196",
"0.52770156",
"0.5257393",
"0.5252478",
"0.5223222",
"0.52130383",
"0.51970327",
"0.5195389",
"0.51916593",
"0.51886016",
"0.51773775",
"0.51763415",
"0.5170636",
"0.51671284",
"0.51589686",
"0.5153642",
"0.51392955",
"0.5131521",
"0.5127857",
"0.51267093",
"0.51182723",
"0.5116419",
"0.510482",
"0.5097322",
"0.50918764",
"0.5080896",
"0.5080896",
"0.50803727",
"0.50803727",
"0.50803727",
"0.5075433",
"0.5074635",
"0.5065079",
"0.5057994",
"0.5056884",
"0.5052607",
"0.5051917",
"0.5051639",
"0.5050501",
"0.5048733",
"0.5043203",
"0.5023967",
"0.5023103",
"0.5015357",
"0.501061",
"0.5008913",
"0.5007298",
"0.5006162",
"0.4999749",
"0.49951133",
"0.4988922",
"0.4988714",
"0.49868762",
"0.4986763",
"0.49817404",
"0.4980239",
"0.4979415",
"0.49784353",
"0.49779385",
"0.4973077",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49730217",
"0.49709702",
"0.49689525",
"0.4964715",
"0.4944226",
"0.4944158",
"0.49337524",
"0.493318",
"0.49323884"
] | 0.0 | -1 |
Handle emails to notify_to users | def normal_email(user, status)
@user = user
@status = status
mail to: @user.email, subject: 'CastleBridge Normal Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end",
"def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n Hyrax::MessengerService.deliver(user, recipient, message.html_safe, subject)\n\n mailer = workflow_message_mailer(to: recipient)\n mailer.send(mailer_method).deliver_later if mailer.respond_to?(mailer_method)\n end\n end",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def notify user\n if self.can_notify? user\n note = Note.new(:from => self, :to => user)\n \n if note.valid?\n note.save\n\n trigger_event_for_user user, \"notification-received\", note\n trigger_event \"notification-sent\", note\n \n if note.to.email != nil and note.to.email != \"\"\n NotificationsMailer.poke(note).deliver\n end\n \n return true\n end\n\n return false\n end\n\n false\n end",
"def notify\n ReminderMailer.notify\n end",
"def notification(params)\n mail(params)\n end",
"def notify_order\n UserMailer.notify_order\n end",
"def notify_via_service\n u = User.first\n u.update(last_notification_mail_sent: 30.days.ago)\n service = NotificationDigest.new(type: :notifications)\n service.notify_user(u, deliver: false)\n end",
"def notify_users(action)\n sender = user\n recipients = []\n\n # Send to people who have registered interest.\n interests.each do |interest|\n recipients.push(interest.user) if interest.state\n end\n\n # Tell masochists who want to know about all observation changes.\n User.where(email_observations_all: true).find_each do |user|\n recipients.push(user)\n end\n\n # Send notification to all except the person who triggered the change.\n recipients.uniq.each do |recipient|\n next if !recipient || recipient == sender || recipient.no_emails\n\n case action\n when :destroy\n QueuedEmail::ObservationChange.destroy_observation(sender, recipient,\n self)\n when :change\n QueuedEmail::ObservationChange.change_observation(sender, recipient,\n self)\n else\n QueuedEmail::ObservationChange.change_images(sender, recipient, self,\n action)\n end\n end\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail \n end",
"def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_notifications(unituser, msg)\n user = unituser.user\n user.send_sms(msg)\n UserMailer.send_email(user, user.email, msg).deliver if user.contact_flags[1] == \"1\"\n UserMailer.send_email(user, user.email2, msg).deliver if user.contact_flags[3] == \"1\"\n end",
"def send_notifications!\n # The person who wrote the note, anybody who's left a comment on this note minus \"current\" comment creator\n notification_emails.each do |email|\n Notifier.comment(self, email).deliver\n end\n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def notify(doctor ,recipient, subject, text)\n subject += \" sent to: #{recipient}, by: #{doctor.full_name}\" \n\t\tadmin_assists = AdminAssistant.all \n if admin_assists\n admin_assists.each do |adm|\n custom_email(adm, subject, text)\n end\n end\n end",
"def notify\n ActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :cc => \"[email protected]\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def notify(recipient, users_posts)\n \n\n @recipient = recipient\n @posts = users_posts\n # @post = post\n # @creator = creator\n # @group = group\n # @post_name = post.title\n # @post_desc = post.description\n #attachments[\"\"]\n mail(:to => recipient.email, :subject => \"New Stuff Today\")\n end",
"def notifier_to_users(recipients, task)\r\n recipients.each do |recipient, outcome|\r\n if recipient =~ /#{SEND_EMAILS_ONLY_FOR_DOMAIN}/\r\n puts \"Sending email to #{recipient}...\"\r\n begin\r\n Notifier.deliver_user_notification(recipient, outcome, task)\r\n rescue StandardError => err\r\n puts err.message\r\n end\r\n else\r\n puts \"Email to #{recipient} not sent\"\r\n end\r\n end\r\nend",
"def notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <[email protected]>\",\n\t return_path: \"[email protected]\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail\n end",
"def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\"\n end",
"def admin_notify\n UserMailer.signup_notification(self).deliver_later!(wait: 1.minute)\n end",
"def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end",
"def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end",
"def new_user_notification\n ModelMailer.new_user_notification\n end",
"def perform(user_name, content)\n\t\tNotificationMailer.notify_email(user_name, content).deliver\n\tend",
"def notify\n #ensure that you own the reservation or club\n #send notifcation in the background\n reservation = UserReservation.find(params[:user_reservation_id])\n\n if(reservation.contact.nil?) then\n Rails.logger.error \"No Contact email\"\n render json: {message:'No contact info'}, status: :expectation_failed\n return\n end\n\n if(reservation.contact.email.nil?) then\n Rails.logger.error \"Contact has no email\"\n render json: {message:'Contact has no email'}, status: :expectation_failed\n end\n\n #contact has email, deliver the email\n UserReservationMailer.notify(reservation).deliver_later\n head :ok\n end",
"def membership_notification(user)\n @greeting = \"Hi\"\n\n mail to: user.email, subject: \"Success! You did it.\"\n end",
"def send_notifications\n send_new_post_to(:person) if self.person.notify_on_response_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_response_received\n end",
"def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"[email protected]\"\n end",
"def send_notification\n # Getting users of current group\n @group = Group.find(params[:id])\n @users = @group.users\n\n # Subject for mail\n if action_name == \"create\"\n subject = \"New task creation\"\n else\n subject = \"Task update\"\n end\n\n # Sending mail to each user of the group\n @users.each do |user|\n TaskMailer.task_create_notification(subject, user, @group, @task).deliver_now\n end\n\n end",
"def send_notifications\n end",
"def email_sent(to)\n puts green(\"Notification sent to: #{to}\")\n end",
"def send_email!\n UserMailer.event_ticket_notification(user, self).deliver_now\n end",
"def notify_email2(fuel_limit)\n @fuel_limit=fuel_limit\n mail(to: @fuel_limit.emails, subject: 'Notification Email')\n end",
"def notify_user\n current_user.notify!(twilio_client)\n redirect_to current_user\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def notify_host\n OrganisationMailer.notify_host\n end",
"def notify(params)\n @body = params[\"/contact\"][:message]\n @from = params[\"/contact\"][:email]\n @phone = params[\"/contact\"][:phone]\n @name = params[\"/contact\"][:name]\n mail to: \"[email protected]\", subject: 'Mail from website', from: \"#{@from}\"\n end",
"def notify_administrators!\n AdminMailer.new_pending_interest_point(self).deliver!\n end",
"def notify_email\n begin\n InsuranceLeadMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send insurnace lead notification. #{e.message}\")\n end\n end",
"def new_user_notification\n\t\tUserMailer.new_user_notification('[email protected]',User.where(:administrator => nil).first)\n end",
"def process_notifications(users, plan)\r\n users.each{| user |\r\n #KS- if they have email notification on, check their notification setting\r\n email_notification = user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL)\r\n if email_notification\r\n #KS- which notification category does this user fall into?\r\n notification_setting = user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION)\r\n notification_setting = notification_setting.nil? ? nil : notification_setting.to_i\r\n case notification_setting\r\n when UserAttribute::INVITE_NOTIFICATION_ALWAYS\r\n if user.registered?\r\n UserNotify.deliver_invite_notification(current_user, user, plan)\r\n else\r\n url = url_for(:controller => 'users', :action => 'register', :id => user.id)\r\n UserNotify.deliver_unregistered_invite_notification(current_user, user, plan, url)\r\n end\r\n end\r\n\r\n end\r\n #TODO: KS- handle SMS notification\r\n }\r\n end",
"def perform\n User.where(id: @bug.notify_on_deploy).each do |user|\n NotificationMailer.deploy(@bug, user).deliver\n end\n end",
"def create_mail\n # Removes the current user from the recipients and cc\n # if he doesn't want to receive notifications about what he does\n @author ||= User.current\n if @author.pref[:no_self_notified]\n recipients.delete(@author.mail) if recipients\n cc.delete(@author.mail) if cc\n end\n \n notified_users = [recipients, cc].flatten.compact.uniq\n # Rails would log recipients only, not cc and bcc\n mylogger.info \"Sending email notification to: #{notified_users.join(', ')}\" if mylogger\n \n # Blind carbon copy recipients\n if Setting.bcc_recipients?\n bcc(notified_users)\n recipients []\n cc []\n end\n super\n end",
"def email_user\n Mailer.deliver_metadata_processed(dataset_id, user_id, @missing_variables, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def notify(subject,body,obj = nil,sanitize_text=true,notification_code=nil,send_mail=true,sender=nil)\n Mailboxer::Notification.notify_all([self],subject,body,obj,sanitize_text,notification_code,send_mail,sender)\n end",
"def notify\n @greeting = \"Just a test\"\n mail(to: \"[email protected]\") #.deliver_later\n end",
"def notify\n return false unless @tiers # invalid tiers_id\n extract_destinations\n if @french || @other\n done = notify_all_destinations\n say_notified if done && @mode\n done\n else # no mail\n register_tiers\n false\n end\n end",
"def email_notification\n return unless app.emailable? && should_email?\n Mailer.err_notification(self).deliver_now\n rescue => e\n HoptoadNotifier.notify(e)\n end",
"def notify!\n\n Alert.alert!(target, self, \"create\")\n\n # alert = Alert.create!(\n # user: target,\n # target: self,\n # text: \"Feedback received from #{self.user.name}\",\n # read_link: \"/app/main/feedbacks/show/#{id}\"\n # )\n\n # # Create notifications for the sender and receiver -> will appear in timeline\n # Notification.create!(\n # user_id: user.id, target: self,\n # notify: false,\n # unread: false\n # )\n # Notification.create!(\n # user_id: target.id, target: self,\n # notify: true,\n # unread: true\n # )\n\n end",
"def send_email_changed_notification; end",
"def notify_subscribers\n NewAnswerNotificationMailer.notify_subscribers\n end",
"def notify\n # Parse the message to send\n if params[:message].nil? || params[:message].empty?\n return render :status => 172, :json => {:message => 'Invitation message is missing.'}\n end\n message = CGI::unescape(params[:message])\n \n # Parse the list of emails (json encoded)\n if params[:emails].nil? || params[:emails].empty?\n return render :status => 171, :json => {:message => 'Contact emails are missing.'}\n end\n emails = ActiveSupport::JSON.decode(CGI::unescape(params[:emails]))\n \n # Notify each\n emails_sent = 0\n emails.each do |email|\n # Find the contact by email - commenting this out bc we want to send invites to anyone, not just contacts, ie not just pple in Address Book\n # contact = Contact.find_by_email(email)\n # next if contact.nil?\n\n # Check if already notified recently by the same user. If so, skip!\n next if current_user.contact_notifications.where(:email => email).count > 0\n\n # Save a record that we emailed them\n ContactNotification.create({\n :user_id => current_user.id,\n :email => email\n })\n \n # Send the actual email\n UserMailer.contact_invitation(current_user, email, message).deliver\n\n emails_sent += 1\n end\n \n render :status => 200, :json => {:message => \"Contacts notified successfully (#{emails_sent} of #{emails.size}).\"}\n end",
"def send_admin_notification_email\n #Notifies admin of the registration\n UserMailer.new_user(self).deliver\n end",
"def send_email(object)\n # SomeNotifier.notification(...).deliver_now\n end",
"def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end",
"def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end",
"def notify_team(note)\n # Note: wall posts are not \"attached\" to anything, so fall back to \"Wall\"\n noteable_type = note.noteable_type.presence || \"Wall\"\n notify_method = \"note_#{noteable_type.underscore}_email\".to_sym\n\n if Notify.respond_to? notify_method\n team_without_note_author(note).map do |u|\n Notify.delay.send(notify_method, u.id, note.id)\n end\n end\n end",
"def post_approve_email\n NotificationMailer.post_approve_email('[email protected]')\n end",
"def sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"[email protected]\", subject: \"登録完了通知\"\n end",
"def notification_for(product)\n \t@product = product \n mail(:to => @product.user.email, :subject => \"Perishab.ly alert regarding your #{@product.name}\")\n end",
"def new_user_alert(record, opts={})\n opts[:to] = '[email protected]'\n devise_mail(record, :new_user_alert, opts)\n end",
"def review_notification(book,user)\n @greeting = \"Hi\"\n @book=book\n @user=user\n mail to: user.email\n end",
"def deliver_message\n return unless @recipients\n append_delivery_notes\n @recipients.reject{|r| r==self.user}.each do |usr|\n usr.user_notifications.create(self.attributes)\n usr.save\n end\n self.save!\n self.user.save!\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def groups_notification_email\n @data = last_notification\n # Only send if there's something to send\n return unless @data.any?\n rails_secrets = Rails.application.secrets\n send_to = rails_secrets.user_default_email\n send_from = 'notifications@' + rails_secrets.domain_name\n mail(from: send_from, to: send_to,\n subject: 'Competitor-Monitor Changes Notification')\n end",
"def notify_user(record)\n unless record.user_id == record.author_id\n create_notification(record, record.user)\n end\n end",
"def send_notification(new_state, current_user_id, recipient_id)\n if current_user_id != user_id\n UserMailer.new_event(id, user.email).deliver_now\n end\n\n if ['verification', 'approval', 'execution'].include? new_state\n if recipient_id != user_id # must not be double delivering\n recipient_email = User.find_by(id: recipient_id).try(:email)\n UserMailer.new_event(id, recipient_email).deliver_now\n end\n end\n end",
"def send_email_changed_notification?; end",
"def user_sign_up_notification(user)\n @user = user\n\n mail(to: \"<#{user.email}>\", subject: \"Success! You did it.\")\n end",
"def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end",
"def notification(to,f)\n send_as :notification\n recipients to\n from f\n fbml \"Not\"\n end",
"def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend",
"def send_reminder_email \n UserMailer.reminder_email(self).deliver\n end",
"def send_notifications\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => REPORT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => {:VAR1 => self.patient.first_name, :VAR2 => self.patient.last_name, :VAR3 => self.pdf_url, :VAR4 => self.created_by_user.organization.name },\n\t\t\t\t\t:template_sender_id => REPORT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\temail = OrderMailer.report(recipient,self,self.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def mailer_notify\n #TODO-low is there a better way for sending it?\n # this is because we're testing it in capybara-email\n UserMailer\n .with(organizational_mentorship_id: id)\n .invitation_to_become_mentee\n .yield_self { |mail_message| Rails.env.test? || Rails.env.development? ? mail_message.deliver_now : mail_message.deliver_later }\n\n UserSentInvitationToBecomeMentee.create!(user: mentee_user, resource: self)\n end",
"def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end",
"def sign_up_notification\n # @greeting = \"Hi\"\n\n # mail to: \"[email protected]\"\n # @admin = User.where(is_admin: true).last\n @user = params[:user]\n mail(to: @user.email, subject: 'Sign Up successfull')\n end",
"def send_email(notification,receiver)\n new_notification_email(notification,receiver)\n end",
"def reminder_email2(all_payments)\n @all_payments = all_payments\n @url = generate_url(User.find_by_email(@all_payments.first.email))\n #loaner_email = User.find(@all_payments.first.user_id).email\n\n mail(:to => @all_payments.first.email, :subject => \"Reminder that you owe some money\")\n end",
"def reconfirm_notification(user)\n setup_email(user)\n subject 'Confirm new email'\n\n body :user => user, :host => FROM_HOST\n end",
"def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end",
"def notify_resource_owner(request, user)\n @request = request\n @user = user\n @url = request_url(@request)\n \n mail :to => @user.email\n end",
"def send_notifications\n\t\t#puts \"------------- CAME TO SEND NOTIFICAITONS FOR RECEIPT ------------------\"\n\t\t## we will have to override the gather recipients.\n\t\t## how to get the patient ?\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\t#puts \"recipient is: #{recipient}\"\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => RECEIPT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => build_var_hash,\n\t\t\t\t\t:template_sender_id => RECEIPT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\t#puts \"the recipient has email id\"\n\t\t\t\t#puts recipient.email_ids.to_s\n\t\t\t\temail = OrderMailer.receipt(recipient,self,self.payable_to_organization.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def send_user_reminder_notice(user)\n return if user.email.nil?\n return if user.last_reminder.sent_at < one_week_ago\n EmailSender.send_notice_to(user.email)\nend",
"def notify( notification_type, source_user, options={})\n notification = post_notification(notification_type, source_user, options)\n if true # XXX User's profile approves\n # Mapping from notification types to email types\n case notification_type\n when :share_recipe\n self.shared_recipe = options[:what]\n msg = RpMailer.sharing_notice(notification)\n msg.deliver\n when :make_friend\n :friend_notice\n end\n end\n end",
"def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end",
"def new_signup_notification\n user = User.first\n UserMailer.new_signup_notification(user, \"x.x.x.x (aprox y)\")\n end",
"def notify_user(user, deliver: true)\n if user.last_notification_mail_sent.nil?\n user.update(last_notification_mail_sent: 1.day.ago)\n end\n notification_ids = notifications_for_user(user)\n comment_thread_ids = comment_threads_for_user(user)\n return if notification_ids.count.zero? && comment_thread_ids.count.zero?\n\n mailer = NotificationMailer.notify(\n user_id: user.id,\n notification_ids: notification_ids,\n comment_thread_ids: comment_thread_ids,\n )\n if deliver\n mailer.deliver_later\n end\n mailer\n end",
"def reminder(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify_recipients\n if receiver.prefers_receive_email_notifications\n UserMailer.deliver_message_notification(self, receiver, sender)\n end\n end",
"def notify(object,class_name,notification_name,sms = false,options)\n if options[:email]\n if options[:password].present?\n Email.send_welcome_email(object,class_name,notification_name,options[:password])\n else\n Email.send_email(object,class_name,notification_name)\n end\n end\n Sms.send_sms(object,class_name,notification_name) if sms\n end",
"def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end",
"def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end",
"def reset_password_notify\n user = User.find_by_email(params[:email])\n\n if user\n user.reset_token\n ::NotifierMailer.reset_password_instructions(user).deliver\n flash.now.notice = t('flash.sessions.reset_password_notify.email_sent')\n else\n flash.now.alert = t('flash.sessions.reset_password_notify.user_not_found')\n end\n\n render :reset_password\n end"
] | [
"0.77243286",
"0.7352931",
"0.7266025",
"0.7259276",
"0.72396094",
"0.7233714",
"0.71800554",
"0.70704025",
"0.7054894",
"0.7049822",
"0.7042328",
"0.703432",
"0.6976092",
"0.69731915",
"0.6955278",
"0.69551337",
"0.6930769",
"0.69280404",
"0.6921682",
"0.6907902",
"0.6907713",
"0.6871318",
"0.6869612",
"0.68613195",
"0.684467",
"0.6832233",
"0.6809635",
"0.68052405",
"0.6802323",
"0.67942125",
"0.6765594",
"0.6764516",
"0.67466795",
"0.67452306",
"0.6722945",
"0.671488",
"0.6692058",
"0.6673361",
"0.66633976",
"0.6663318",
"0.6662073",
"0.6651063",
"0.66408026",
"0.66362137",
"0.66229236",
"0.66160595",
"0.6614291",
"0.66116613",
"0.65998966",
"0.65905654",
"0.65762764",
"0.65753335",
"0.6574193",
"0.65687",
"0.65583414",
"0.655017",
"0.6549163",
"0.65361285",
"0.6533079",
"0.6530159",
"0.65268093",
"0.6526524",
"0.6521409",
"0.6519935",
"0.65192497",
"0.6502443",
"0.649897",
"0.649631",
"0.6495591",
"0.64909655",
"0.64898336",
"0.64840126",
"0.6483716",
"0.6479895",
"0.6477122",
"0.6476704",
"0.6465467",
"0.64646375",
"0.64606035",
"0.6459408",
"0.64534676",
"0.6452742",
"0.6450894",
"0.64498913",
"0.64486545",
"0.64468",
"0.6445173",
"0.64395404",
"0.6436625",
"0.6433887",
"0.642779",
"0.6419179",
"0.6414857",
"0.64084303",
"0.6401299",
"0.63891983",
"0.63875175",
"0.6387297",
"0.6381496",
"0.6376473",
"0.63747114"
] | 0.0 | -1 |
Handle emails to morning_notify users | def morning_email(user, status)
@user = user
@status = status
mail to: @user.email, subject: 'CastleBridge Morning Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def notify\n ReminderMailer.notify\n end",
"def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end",
"def notify_via_service\n u = User.first\n u.update(last_notification_mail_sent: 30.days.ago)\n service = NotificationDigest.new(type: :notifications)\n service.notify_user(u, deliver: false)\n end",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def send_user_reminder_notice(user)\n return if user.email.nil?\n return if user.last_reminder.sent_at < one_week_ago\n EmailSender.send_notice_to(user.email)\nend",
"def notification(params)\n mail(params)\n end",
"def employeer_notification\n NotificationMailer.employeer_notification\n end",
"def send_email_changed_notification; end",
"def send_email_changed_notification?; end",
"def event_mail\n NoticePlannerMailer.delay.notice_planner_email('[email protected]', 'test', 'cron-test', 'https://yahoo.co.jp')\n end",
"def send_notifications\n end",
"def send_reminder\r\n\t\tif Date.today == expiration_date - 1\r\n\t\t\tReminderMailer.food_reminder_msg(@user).deliver\r\n \t\tflash[:notice] = \"#{@user.username} has been notified by email.\" \r\n \tend\r\n end",
"def follow_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def user_event_analisys(user, event)\n @user = user\n @event = event\n @meeting = user.meetings.find_by(event: event)\n\n mail(to: @user.email, subject: t('user_event_analisys', scope: 'message.email.subjects')) if @user.email.present?\n end",
"def reminder(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def new_user_notification\n ModelMailer.new_user_notification\n end",
"def groups_notification_email\n @data = last_notification\n # Only send if there's something to send\n return unless @data.any?\n rails_secrets = Rails.application.secrets\n send_to = rails_secrets.user_default_email\n send_from = 'notifications@' + rails_secrets.domain_name\n mail(from: send_from, to: send_to,\n subject: 'Competitor-Monitor Changes Notification')\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail \n end",
"def reminder\n UsersMailer.reminder\n end",
"def email_for_recipient(user)\n IntervalNotifier.daily_email(user, report) if report.top_public_recognitions.size > 0\n end",
"def process_emails(reader_info)\n notifications = reader_info.notifications\n notifications.each do |notification|\n case notification[:notification_type]\n when \"email\"\n send_email(reader_info) if notification[:checked]\n when \"internal\"\n send_internal(reader_info) if notification[:checked]\n when \"sms\"\n send_sms(reader_info) if notification[:checked]\n when \"e-boks\"\n send_e_boks(reader_info) if notification[:checked]\n end\n end\n end",
"def notify_member_expire_7\n users, event = User.unpaid_membership_expires_in_7_days\n users.each do |user|\n UserMailer.deliver_membership_expires_in_7_days(user)\n User.add_email_event(user, event)\n end\n end",
"def event_reminder_to_chef(evt)\n @evt = evt\n @chef = User.find_by_id(@evt.user_id)\n @guests = @evt.signups.where('confirmation_status in (?)', 'Attending')\n @comments = @evt.messages.where(\"public_flag = ?\", 1).group(\"messagechain_id\", \"order_id\", \"message_content\", \"sender_id\").sort{|a,b| b[:messagechain_id] <=> a[:messagechain_id]}\n if @guests.sum(:guest_count) > 0\n @paid_communal = @guests.where(\"own_group_flag = 0\")\n @own_table = @guests.where(\"own_group_flag = 1\")\n mail(:to => @chef.email, :subject => \"Your upcoming event on Local Yum\", :from => \"\\\"Local Yum\\\" <[email protected]>\")\n end\n end",
"def notifier_to_users(recipients, task)\r\n recipients.each do |recipient, outcome|\r\n if recipient =~ /#{SEND_EMAILS_ONLY_FOR_DOMAIN}/\r\n puts \"Sending email to #{recipient}...\"\r\n begin\r\n Notifier.deliver_user_notification(recipient, outcome, task)\r\n rescue StandardError => err\r\n puts err.message\r\n end\r\n else\r\n puts \"Email to #{recipient} not sent\"\r\n end\r\n end\r\nend",
"def membership_notification(user)\n @greeting = \"Hi\"\n\n mail to: user.email, subject: \"Success! You did it.\"\n end",
"def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <[email protected]>\",\n\t return_path: \"[email protected]\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end",
"def data_update_notification(user)\n @greeting = \"FREE PEPPERLUNCH@@!!!!!111111\"\n\n @lunch_count = user.lunches.count\n\n if @lunch_count > 15\n\n\n mail to: user.email\n end\nend",
"def reminder_sent\n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def new_notification\n mail(to: \"[email protected]\", subject: 'New Notification', sent_on: Time.now)\n end",
"def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end",
"def send_email!\n UserMailer.event_ticket_notification(user, self).deliver_now\n end",
"def email_user\n Mailer.deliver_metadata_processed(dataset_id, user_id, @missing_variables, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def notify(user, answer)\n @user = user\n @answer =answer\n mail(to: user.email, subject: 'You has new answers') \n end",
"def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <[email protected]>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end",
"def send_notification\n # Getting users of current group\n @group = Group.find(params[:id])\n @users = @group.users\n\n # Subject for mail\n if action_name == \"create\"\n subject = \"New task creation\"\n else\n subject = \"Task update\"\n end\n\n # Sending mail to each user of the group\n @users.each do |user|\n TaskMailer.task_create_notification(subject, user, @group, @task).deliver_now\n end\n\n end",
"def review_notification(book,user)\n @greeting = \"Hi\"\n @book=book\n @user=user\n mail to: user.email\n end",
"def notification_mail(booking)\n\n @booking_organizer = User.find(booking.user_id).username\n @booking = booking\n\n filename = \"tmpfile/\"+booking.guid\n ics_content = generate_ics(booking)\n\n mail_addr = User.find(booking.user_id).username\n mails_addr = split_invitees(booking.invitees)\n mails_addr << mail_addr\n\n attachments['invite.ics'] = {:content => ics_content.to_s, :mime_type => \"text/calendar\"}\n\n mail(:to => mails_addr, :subject => booking.summary, :template_path => \"notifier\", :template_name => \"content\" )\n\n end",
"def notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def new_user_notification\n\t\tUserMailer.new_user_notification('[email protected]',User.where(:administrator => nil).first)\n end",
"def notify\n #ensure that you own the reservation or club\n #send notifcation in the background\n reservation = UserReservation.find(params[:user_reservation_id])\n\n if(reservation.contact.nil?) then\n Rails.logger.error \"No Contact email\"\n render json: {message:'No contact info'}, status: :expectation_failed\n return\n end\n\n if(reservation.contact.email.nil?) then\n Rails.logger.error \"Contact has no email\"\n render json: {message:'Contact has no email'}, status: :expectation_failed\n end\n\n #contact has email, deliver the email\n UserReservationMailer.notify(reservation).deliver_later\n head :ok\n end",
"def process_notifications(users, plan)\r\n users.each{| user |\r\n #KS- if they have email notification on, check their notification setting\r\n email_notification = user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL)\r\n if email_notification\r\n #KS- which notification category does this user fall into?\r\n notification_setting = user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION)\r\n notification_setting = notification_setting.nil? ? nil : notification_setting.to_i\r\n case notification_setting\r\n when UserAttribute::INVITE_NOTIFICATION_ALWAYS\r\n if user.registered?\r\n UserNotify.deliver_invite_notification(current_user, user, plan)\r\n else\r\n url = url_for(:controller => 'users', :action => 'register', :id => user.id)\r\n UserNotify.deliver_unregistered_invite_notification(current_user, user, plan, url)\r\n end\r\n end\r\n\r\n end\r\n #TODO: KS- handle SMS notification\r\n }\r\n end",
"def notification\n BookingMailer.notification\n end",
"def notify\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def new_signup_notification\n user = User.first\n UserMailer.new_signup_notification(user, \"x.x.x.x (aprox y)\")\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail\n end",
"def shift_notify(shift, employee)\n @shift_name = shift.employee.full_name\n @employee_name = employee.full_name\n @shift_time = shift.shift_day.strftime(\"%a-%d-%b\")\n @employee = employee.id\n @email = shift.employee.email\n\n mail(to: @email, subject:'Interested in your Shift')\n end",
"def send_notification\n\n\n end",
"def send_email\n\n # Set subject for email\n title = \"\" + @meeting.name\n case action_name\n when 'create'\n title = \"[\" + t('views.meetings.new.title') + \"] \" + @meeting.name\n when 'update'\n title = \"[\" + t('views.meetings.edit.title') + \"] \" + @meeting.name\n when 'cancel'\n title = \"[\" + t('views.meetings.show.button.cancel') + \"] \" + @meeting.name\n else\n #nothing to do\n end\n\n # Set content for email\n content = %([#{t('activerecord.attributes.meeting.id')}]\\n#{@meeting.id}\\n) +'<br>'+\n %([#{t('activerecord.attributes.meeting.dates')}]\\n) << @meeting.dates.to_s << ' ' << @meeting.start_time.strftime('%l:%M %p') +'<br>'+\n %([#{t('activerecord.attributes.meeting.venue')}]\\n#{@meeting.venue}\\n) +'<br>'+\n %([#{t('activerecord.attributes.meeting.message')}]\\n#{@meeting.message}\\n) +'<br>'\n\n # Get email of users who join to meeting\n @meeting.participants.each do |participant|\n @participant_email = participant.user.mailaddress\n if !@participant_email.nil?\n Notifier.send_email_notifications(@participant_email, title, content ).deliver\n end\n end\n @meeting.observers.each do |observers|\n @observers_email = observers.user.mailaddress\n if !@observers_email.nil?\n Notifier.send_email_notifications(@observers_email, title, content ).deliver\n end\n end\n\n end",
"def reminder_received(event)\n @event = event\n\n mail :to => event.email, :subject => 'Reminder alert'\n end",
"def send_notifications(unituser, msg)\n user = unituser.user\n user.send_sms(msg)\n UserMailer.send_email(user, user.email, msg).deliver if user.contact_flags[1] == \"1\"\n UserMailer.send_email(user, user.email2, msg).deliver if user.contact_flags[3] == \"1\"\n end",
"def prebooking_reminder(service)\n notification = Notification.find_by_name(\"Pre booking reminder\")\n vehicle = service.fleet\n setting = vehicle.truck_fleet.setting.email_notifications.find_by_notification_id(notification.id)\n emails = self.find_emails(vehicle, setting)\n if emails.present?\n mail :to => emails,\n :subject => \"Prebooking reminder. For #{vehicle.fleet_number}\"\n end\n end",
"def reminder_email2(all_payments)\n @all_payments = all_payments\n @url = generate_url(User.find_by_email(@all_payments.first.email))\n #loaner_email = User.find(@all_payments.first.user_id).email\n\n mail(:to => @all_payments.first.email, :subject => \"Reminder that you owe some money\")\n end",
"def admin_notify\n UserMailer.signup_notification(self).deliver_later!(wait: 1.minute)\n end",
"def notify_email2(fuel_limit)\n @fuel_limit=fuel_limit\n mail(to: @fuel_limit.emails, subject: 'Notification Email')\n end",
"def notify_member_expire_1\n users, event = User.unpaid_membership_expires_in_1_day\n users.each do |user|\n UserMailer.deliver_membership_expires_in_1_day(user)\n User.add_email_event(user, event)\n end\n end",
"def notify_users(action)\n sender = user\n recipients = []\n\n # Send to people who have registered interest.\n interests.each do |interest|\n recipients.push(interest.user) if interest.state\n end\n\n # Tell masochists who want to know about all observation changes.\n User.where(email_observations_all: true).find_each do |user|\n recipients.push(user)\n end\n\n # Send notification to all except the person who triggered the change.\n recipients.uniq.each do |recipient|\n next if !recipient || recipient == sender || recipient.no_emails\n\n case action\n when :destroy\n QueuedEmail::ObservationChange.destroy_observation(sender, recipient,\n self)\n when :change\n QueuedEmail::ObservationChange.change_observation(sender, recipient,\n self)\n else\n QueuedEmail::ObservationChange.change_images(sender, recipient, self,\n action)\n end\n end\n end",
"def notify(activity)\n case activity.key\n when 'event.sms', 'workshop.sms', 'meeting.reminder'\n Notification.create(:user => self, :activity => activity, :email_me => self.email_short_messages, :sms_me => (self.sms_short_messages and not self.phone.blank?))\n else\n Notification.create(:user => self, :activity => activity, :email_me => self.email_notifications)\n end\n end",
"def show_notfication\n UserMailer.show_notfication\n end",
"def user_welcome_reminder(user,subject,message)\n @from = \"REIMatcher <[email protected]>\"\n @recipients = user.email\n @subject = \"#{subject}\"\n @sent_on = Time.now\n user_activation_link = \"#{REIMATCHER_URL}user_activate/#{user.activation_code}\"\n unless message.blank?\n @body = message.to_s.gsub(\"[User Email]\",user.email.to_s).gsub(\"[User First Name]\",user.first_name.to_s).gsub(\"[User Last Name]\",user.last_name.to_s).gsub(\"[User Login]\",\"<a href='#{user.login.to_s}'>#{user.login.to_s}</a>\").gsub(\"[User Full Name]\",user.first_name.to_s + \" \" + user.last_name.to_s).gsub(\"[User Activation Link]\",\"<a href='#{user_activation_link}'>#{user_activation_link}</a>\")\n else\n @body = \"\"\n end\n @content_type = \"text/html\"\n reminder_welcome_email_header = {:category => EMAIL_CATEGORIES[:ar]}\n @headers[\"X-SMTPAPI\"] = reminder_welcome_email_header.to_json unless reminder_welcome_email_header.blank?\n# @headers[\"X-SMTPAPI\"] = header\n end",
"def send_reminder_email(user, expiringtasks)\n @user = user\n @expiringtasks = expiringtasks\n mail( :to => @user.email ,\n :subject => '[Todo Manager] Task Reminder')\n end",
"def email_notification\n return unless app.emailable? && should_email?\n Mailer.err_notification(self).deliver_now\n rescue => e\n HoptoadNotifier.notify(e)\n end",
"def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end",
"def notify(message)\n messages << \"\\n#{message}\"\n send_email(messages) if (@last_sent.nil? || Time.now > (@last_sent + interval * 60))\n end",
"def create_notification\n host = ENV['WEB_CLIENT_HOST']\n url = \"http://#{host}/articles/#{article.id}\"\n\n # Notify the article author of the new comment\n subject = \"#{user.name} علق على مقالك '#{article.title}'\"\n body = \"#{user.name} ترك تعليق على مقالك <a href='#{url}' target='blank'>'#{article.title}'</a>. التعليق هو:\\n\\n <blockquote dir='rtl'>#{self.body}</blockquote>\"\n\n if not user.id.equal? article.user.id\n SendEmailsWorker.perform_async(\n subject, body, article.user_id, self.class.name, self.id)\n end\n\n # Notify any users who have commented on the same section (i.e. guid).\n past_commenters = Comment.where(\n guid: guid).includes(:user).collect(&:user).uniq\n subject = \"#{user.name} علق على مقال '#{article.title}'\"\n body = \"#{user.name} ترك تعليق على مقال <a href='#{url}' target='blank'>'#{article.title}'</a> بعد تعليقك. التعليق هو:\\n\\n <blockquote dir='rtl'>#{self.body}</blockquote>\"\n past_commenters.each do |commenter|\n # Don't notify the owner of the article they already have been notified.\n # Or the user who is adding the current comment.\n if (not commenter.id.equal? article.user.id and\n not commenter.id.equal? user.id)\n SendEmailsWorker.perform_async(\n subject, body, commenter.id, self.class.name, self.id)\n end\n end\n\n end",
"def user_event_confirmed(user, event)\n @user = user\n @event = event\n meeting = user.meetings.find_by(event: event)\n attachments.inline['prenotazione.ics'] = meeting.ical.to_ical if meeting.confirmed?\n mail(to: @user.email, subject: t('user_event_modified', scope: 'message.email.subjects') + ' ' + (l event.date_on)) if user.email.present?\n end",
"def reminder\n RequestMailer.reminder\n end",
"def post_approve_email\n NotificationMailer.post_approve_email('[email protected]')\n end",
"def notification\n user = User.first\n comic = Comic.first\n SubscriptionMailer.notification(work: comic, user: user)\n end",
"def send_reminder_email \n UserMailer.reminder_email(self).deliver\n end",
"def notify\n @greeting = \"Just a test\"\n mail(to: \"[email protected]\") #.deliver_later\n end",
"def invited_notification(user, data_template, company)\n setup_email(user, company.id)\n @subject += 'Event Invitiation'\n @body[:url] = \"#{SITE}/#{company.name}\"\n @support_email = \"#{SUPPORT_EMAIL}\"\n @invited_to_event = \"#{data_template.event.name}\"\n @invited_to_template = \"#{data_template.name}\"\n end",
"def show_reminder\n mail to: @guest.email, subject: \"Reminder: \"[email protected]+\" house show\"\n end",
"def email_reminder(week_id,day)\n # can we use a template?\n puts \"checking #{self.name}\"\n my_result = self.weekly_results.find_by(week_id: week_id) ||\n self.weekly_results.create(week_id: week_id)\n if my_result.send(\"#{day}_drinks\").nil? && !self.unsubscribed\n # generate a token and save to Redis\n puts \"No data for #{self.name} - #{Date.today}. Sending email\"\n my_token = SecureRandom.urlsafe_base64\n packet = {\n user: self.id,\n result: my_result.id,\n parameter: day\n }\n $redis.set(my_token,packet.to_json,{ex: 604800})\n # TODO: fix this bad workaround\n u = self\n # send email\n message = Mail.new do\n from ENV['EMAIL_FROM']\n to \"#{u.name} <#{u.email}>\"\n subject 'BoozeTracker Reminder'\n content_type 'text/html; charset=UTF-8'\n body \"<p>Did you have a drink yesterday?</p><p><a href='#{BASEURL}/token/#{my_token}?result=yes'>Yes</a> | <a href='#{BASEURL}/token/#{my_token}?result=no'>No</a></p><p>--</p><p>Brought to you by <a href='#{BASEURL}'>BoozeTracker</a> | <a href='#{BASEURL}/user/toggle-subscription?token=#{my_token}'>Unsubscribe</a></p>\"\n delivery_method Mail::Postmark, api_token: ENV['POSTMARK_API_TOKEN']\n end\n message.deliver\n\n else\n end\n\n\n end",
"def inactive_notification(user)\n setup_email(user)\n \n @subject += subject_from_sym :inactive_notification\n @body[:name] = user.full_name || 'Eternos user'\n @body[:link] = account_setup_url(:id => user.perishable_token)\n add_category_header \"Inactive Account Notice\"\n end",
"def notify( notification_type, source_user, options={})\n notification = post_notification(notification_type, source_user, options)\n if true # XXX User's profile approves\n # Mapping from notification types to email types\n case notification_type\n when :share_recipe\n self.shared_recipe = options[:what]\n msg = RpMailer.sharing_notice(notification)\n msg.deliver\n when :make_friend\n :friend_notice\n end\n end\n end",
"def sendmail_confirm(user)\n @greeting = \"Hi\"\n @username = user.username\n @userid = user.userid\n\n mail to: \"[email protected]\", subject: \"登録完了通知\"\n end",
"def push_notification\n NotificationMailer.push_notification\n end",
"def reconfirm_notification(user)\n setup_email(user)\n subject 'Confirm new email'\n\n body :user => user, :host => FROM_HOST\n end",
"def send_notifications!\n # The person who wrote the note, anybody who's left a comment on this note minus \"current\" comment creator\n notification_emails.each do |email|\n Notifier.comment(self, email).deliver\n end\n end",
"def incident_notification(incident)\n \t@incident = incident\n @user = incident.assigned_to\n @url = incident_url(incident)\n mail(:to => @user.email, :subject => \"You have a new Incident!\");\n end",
"def notice(notification)\n @notification = notification\n\n mail to: @notification.user_email, :subject => \"Cipher-tech wants you to know: #{@notification.notifier_type} #{@notification.message}\"\n end",
"def notify\n ActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :cc => \"[email protected]\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end",
"def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end",
"def event_admin_message_notice(action, user, event)\n @action = action\n @user = user\n @event = event\n \n mail(:to => @user.email, :subject => \"#{@action.user.name} posted on your StreetMeet - #{event.title}\") unless @user.email.blank?\n end",
"def resolved_event(user,event)\n @greeting = \"Hi\"\n @event = event\n\n mail to: user.email\n end",
"def send_notifications\n send_new_post_to(:person) if self.person.notify_on_response_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_response_received\n end",
"def send_lesson_reminder_email\n UserMailer.lesson_reminder(mentor).deliver_now\n end",
"def notify_email\n begin\n InsuranceLeadMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send insurnace lead notification. #{e.message}\")\n end\n end",
"def send_booking_reminder(user, booking)\n @user = user\n @booking = booking\n\n mail( :to => @user.email,\n :subject => \"You have an upcoming booking in 24 hours\" )\n end",
"def chore_notification_email(assignment)\n @user = assignment.user\n @chore = assignment.chore\n @due_date = assignment.due_date.to_formatted_s(:long_ordinal)\n @url = complete_chore_url(assignment)\n sendgrid_category \"Chore Notification\"\n # sendgrid_unique_args :key2 => \"newvalue2\", :key3 => \"value3\"\n mail :to => @user.email, :subject => \"#{@user.name}. You've got a chore!\"\n end",
"def perform(user_name, content)\n\t\tNotificationMailer.notify_email(user_name, content).deliver\n\tend",
"def event_invitation_notice(invitation)\n @user = invitation.user\n @invitation = invitation\n @event = invitation.event\n email = invitation.email || @user.try(:email)\n mail(:to => email, :subject => \"#{invitation.invitor.name} invited you to '#{invitation.event.title}' on SocialStreet\") unless email.blank?\n end",
"def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end",
"def notify(object,class_name,notification_name,sms = false,options)\n if options[:email]\n if options[:password].present?\n Email.send_welcome_email(object,class_name,notification_name,options[:password])\n else\n Email.send_email(object,class_name,notification_name)\n end\n end\n Sms.send_sms(object,class_name,notification_name) if sms\n end",
"def notify_host\n OrganisationMailer.notify_host\n end",
"def notify(recipient, users_posts)\n \n\n @recipient = recipient\n @posts = users_posts\n # @post = post\n # @creator = creator\n # @group = group\n # @post_name = post.title\n # @post_desc = post.description\n #attachments[\"\"]\n mail(:to => recipient.email, :subject => \"New Stuff Today\")\n end"
] | [
"0.75621027",
"0.7097204",
"0.7080787",
"0.6987877",
"0.69147533",
"0.69126105",
"0.68146706",
"0.6773544",
"0.6773258",
"0.6760959",
"0.67299366",
"0.6715238",
"0.66894674",
"0.66833526",
"0.6680886",
"0.6656738",
"0.6644087",
"0.6637007",
"0.66369754",
"0.6621577",
"0.66206676",
"0.6596602",
"0.65898544",
"0.6579534",
"0.65774965",
"0.6569766",
"0.6567906",
"0.65646714",
"0.6562228",
"0.65609396",
"0.65564734",
"0.65564424",
"0.6554189",
"0.6552608",
"0.65485775",
"0.6543088",
"0.6520363",
"0.6516842",
"0.65158087",
"0.6507998",
"0.65077794",
"0.6504361",
"0.65010613",
"0.6486272",
"0.64806837",
"0.6469791",
"0.6460952",
"0.6445661",
"0.6440985",
"0.64379334",
"0.6434951",
"0.6427189",
"0.6422295",
"0.64187473",
"0.6412259",
"0.64066833",
"0.6404637",
"0.63913107",
"0.638948",
"0.6385909",
"0.63722974",
"0.63718027",
"0.63618284",
"0.6361418",
"0.6354355",
"0.634826",
"0.6348082",
"0.6346787",
"0.6345635",
"0.63423777",
"0.63339597",
"0.63305867",
"0.63256896",
"0.6325017",
"0.6323266",
"0.6320853",
"0.63199097",
"0.6318185",
"0.631796",
"0.63157326",
"0.6313141",
"0.6310666",
"0.63024724",
"0.6298592",
"0.6298419",
"0.62926036",
"0.6287517",
"0.6287221",
"0.62818503",
"0.62815666",
"0.6272897",
"0.62700033",
"0.62675583",
"0.62667954",
"0.62631834",
"0.62605476",
"0.6258952",
"0.62581223",
"0.625718",
"0.62567997"
] | 0.6657463 | 15 |
Handle warning emails to all users | def warning_email(user, warning)
@user = user
@warning = warning
mail to: @user.email, subject: 'CastleBridge Warning Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def low_credit_warning_to_admin(user)\n @user = user\n @advertiser = user.advertiser\n\n set_attachments\n\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: '[email protected]', subject: \"Anunciante con crédito debajo de $1000 - Its time to go social\")\n when 'CO'\n mail(to: '[email protected]', subject: \"Anunciante con crédito debajo de $1000 - Its time to go social\")\n when 'MX'\n mail(to: '[email protected]', subject: \"Anunciante con crédito debajo de $1000 - Its time to go social\")\n end\n\n end",
"def admin_warning\n default_domain = \"example.com\"\n default_password = \"admin\"\n if logged_in? and current_person.admin? \n if current_person.email =~ /@#{default_domain}$/\n flash[:notice] = %(Warning: your email address is still at \n #{default_domain}.\n <a href=\"#{edit_person_path(current_person)}\">Change it here</a>.)\n end\n if current_person.unencrypted_password == default_password\n flash[:error] = %(Warning: your password is still the default.\n <a href=\"#{edit_person_path(current_person)}\">Change it here</a>.) \n end\n end\n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail \n end",
"def notify_admin_about_newbie(user)\n @user = user\n mail\n end",
"def admin_behavior_warning(email, company_phone, notification)\n @company_phone = company_phone\n @company = @company_phone.company\n @notification = notification\n mail(\n to: email,\n subject: 'GurúComm | Una línea esta cerca del límite de uso'\n )\n end",
"def admin_warning\n default_domain = \"example.com\"\n default_password = \"admin\"\n if logged_in? and current_person.admin? \n if current_person.email =~ /@#{default_domain}$/\n flash[:notice] = t('flash.email_is_default',\n :warning => t('global.warning'),\n :default_domain => default_domain,\n :edit_person => edit_person_path(current_person))\n end\n if current_person.unencrypted_password == default_password\n flash[:error] = t('flash.password_is_default',\n :warning => t('global.warning'),\n :edit_person => edit_person_path(current_person)) \n end\n end\n end",
"def list_check_notice\n user = User.second\n UserMailer.list_check_notice(user)\n end",
"def resolved_email(user, warning)\n @user = user\n @warning = warning\n mail to: @user.email, subject: 'CastleBridge Resolved Email'\n end",
"def do_notify_disabled(transition)\n if user && Rails.application.settings.enforce_rules\n UserMailer.access_revoked(user, self).deliver_later\n end\n end",
"def send_alert(display)\n\t\t@display = display\n\t\trecipients = User.alerts_for(display).map{|user| user.email}\n\t\tmail(:to => recipients, :subject => \"Signage Display Warning\")\n\tend",
"def new_user_alert(record, opts={})\n opts[:to] = '[email protected]'\n devise_mail(record, :new_user_alert, opts)\n end",
"def instauser_reject_email(user_id)\n @user = Instauser.find_by(id: user_id)\n mail(to: @user.email, subject: 'Thanks for joining Capish!')\n end",
"def denied\n ContactMailer.denied\n end",
"def show_warning_if_not_confirmed!\n unless current_user.confirmed_at?\n flash.now['warning_persist'] = \"#{I18n.t('flash.warning.confirm_email.text')} <a href=\\\"#{resend_confirmation_email_dashboard_users_path}\\\">#{I18n.t('flash.warning.confirm_email.button')}</a>\".html_safe\n end\n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def skip_email_changed_notification!; end",
"def send_denied_email\n return if ([email protected]_email_setup_done?) || ([email protected]_kyc_config_detail.auto_send_kyc_deny_email?)\n if @user_kyc_detail.kyc_denied?\n @user = User.using_client_shard(client: @client).\n where(client_id: @client_id, id: @user_kyc_detail.user_id).first\n Email::HookCreator::SendTransactionalMail.new(\n client_id: @client.id,\n email: @user.email,\n template_name: GlobalConstant::PepoCampaigns.kyc_denied_template,\n template_vars: {}\n ).perform\n end\n end",
"def missing_user(email)\n\t\tmail(to: email.to_s, subject: \"Password reset request\")\n\tend",
"def new_user_notification\n\t\tUserMailer.new_user_notification('[email protected]',User.where(:administrator => nil).first)\n end",
"def low_credit_warning_to_advertiser(user)\n @user = user\n @advertiser = user.advertiser\n\n set_attachments\n\n mail(to: user.email, subject: \"Su crédito ha disminuido a $#{sprintf('%.02f', @user.balance)} - Its time to go social\")\n end",
"def deny_upgrade\r\n @user = UpgradeRequest.find_by_user_id(params[:id])\r\n @user.processed = true\r\n @user.processed_by = session[:user_id]\r\n @user.processed_at = Date.today\r\n @user.refused = true\r\n @user.save\r\n @user = User.find(@user.user_id)\r\n email = RegistrationMailer.create_refuse_upgrade_to_agent(@user)\r\n email.set_content_type(\"text/html\")\r\n RegistrationMailer.deliver(email)\r\n redirect_to :action => 'show_upgrade_requests', :id => true \r\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in SendSecureDataAccessLinkJob'\n ).deliver if @failed_logs.present?\n end",
"def inactive_notification(user)\n setup_email(user)\n \n @subject += subject_from_sym :inactive_notification\n @body[:name] = user.full_name || 'Eternos user'\n @body[:link] = account_setup_url(:id => user.perishable_token)\n add_category_header \"Inactive Account Notice\"\n end",
"def warning(customer)\n @customer = customer\n @greeting = \"Hi\"\n\n mail(to: @customer.email, subject: \"Warning for the return\")\n end",
"def do_notify_restricted(transition)\n if user && Rails.application.settings.enforce_rules\n UserMailer.access_revoked(user, self).deliver_later\n end\n end",
"def email_notification\n return unless app.emailable? && should_email?\n Mailer.err_notification(self).deliver_now\n rescue => e\n HoptoadNotifier.notify(e)\n end",
"def reject_user\n ProjectUserMailer.reject_user\n end",
"def tasks_expired_warning\n user = User.joins(:tasks).take\n\n NotifierMailer.tasks_expired_warning user, user.tasks.limit(3)\n end",
"def admin_notification(subject, requester, message)\n # don't deliver if config value is set to true\n unless Rails.application.config.disable_admin_notifications == true\n @subject = subject\n @requester = requester.nil? ? '[email protected]' : requester\n @message = message\n @admins = User.where(admin: true).map(&:email)\n\n unless @admins.empty?\n mail(to: @admins, reply_to: @requester, subject: \"[Unity Admin Notification#{Rails.env != 'production' ? \" (#{Rails.env})\" : nil}]: #{@subject}\") do |format|\n format.html\n end\n end\n end\n end",
"def refresh_existing_user_accounts\n check_all_user_accounts\n handle_changed_sis_user_ids\n if Settings.canvas_proxy.delete_bad_emails.present?\n handle_email_deletions @user_email_deletions\n else\n logger.warn \"EMAIL DELETION BLOCKED: Would delete email addresses for #{@user_email_deletions.length} inactive users: #{@user_email_deletions}\"\n end\n end",
"def notifier_to_users(recipients, task)\r\n recipients.each do |recipient, outcome|\r\n if recipient =~ /#{SEND_EMAILS_ONLY_FOR_DOMAIN}/\r\n puts \"Sending email to #{recipient}...\"\r\n begin\r\n Notifier.deliver_user_notification(recipient, outcome, task)\r\n rescue StandardError => err\r\n puts err.message\r\n end\r\n else\r\n puts \"Email to #{recipient} not sent\"\r\n end\r\n end\r\nend",
"def notify_usage( user )\n most_recent = Usage.first :conditions => { :site => user.site }, :order => 'period_from DESC'\n # 24hr can be nil during free download periods\n if most_recent && most_recent.download_24hr && most_recent.download_24hr >= user.warning_threshold\n logger.info(\" notifying: #{most_recent.download_24hr}/#{user.warning_threshold}\")\n Notifier.deliver_usage_message( user, most_recent ) \n end\nend",
"def warn\n\n end",
"def missing_updates(event)\n warn \"Missing #{event.payload[:count]} updates in a row for #{event.payload[:update_type].to_s.upcase}\"\n\n Mailer.missing_updates(event.payload[:count], event.payload[:update_type].to_s).deliver\n end",
"def email_status_change_notices\n return if previously_published?\n\n case status\n when 'published', 'embargoed'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_published_notice(resource, status).deliver_now\n when 'peer_review'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_review_notice(resource, status).deliver_now\n when 'submitted'\n\n # Don't send multiple emails for the same resource, or for submission made by curator\n return if previously_submitted?\n\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n when 'withdrawn'\n return if note.include?('final action required reminder') # this has already gotten a special withdrawal email\n\n if user_id == 0\n StashEngine::UserMailer.user_journal_withdrawn(resource, status).deliver_now\n else\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n end\n end\n end",
"def user_welcome_notice(user)\n @user = user\n mail(:to => @user.email, :subject => \"Welcome to SocialStreet\") unless @user.email.blank?\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def warning!\n self.severity = :WARNING\n end",
"def index\n @early_warning_reports = EarlyWarningReport.all\n @recieviers = User.all\n end",
"def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end",
"def global_warning\n # using SiteConfigutation over an environment constant DOES require a query for EVERY REQUEST\n # but the table is tiny (<5 rows right now) and the coloumn is indexed. But it also gives us the flexibility\n # to display or remove a message within seconds which I think is worth it\n warning = $CACHE.fetch(\"application/global_warning\", :expires_in => 10.minutes) do\n parameter = SiteConfigurationOption.find_by_parameter('global_site_warning')\n if parameter && parameter.value\n parameter.value\n else\n 1\n end\n end\n if warning && warning.class == String\n flash.now[:error] = warning\n end\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end",
"def run_warned; end",
"def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <[email protected]>\",\n\t return_path: \"[email protected]\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end",
"def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end",
"def admin_notified(error_text_for_admin)\r\n @error_text_for_admin = error_text_for_admin\r\n mail to: 'admin@fancy_gifts_shop.net', subject: 'Error from the site www.depot.com !'\r\n end",
"def rejected_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Rejected')\n end",
"def warning(*args); end",
"def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end",
"def rejected(request)\n @request = request\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end",
"def unpaid_user_notification(user)\n mail(to: user.email, subject: I18n.t('user_mailer.unpaid_user_notification.subject'))\n end",
"def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def send_user_reminder_notice(user)\n return if user.email.nil?\n return if user.last_reminder.sent_at < one_week_ago\n EmailSender.send_notice_to(user.email)\nend",
"def findings_unanswered_warning\n user = User.joins(:findings).take\n\n NotifierMailer.findings_unanswered_warning user, user.findings.limit(3)\n end",
"def notify_devs(error_data, err_message)\n ApplicationMailer.notify(\n body: {err_message: err_message},\n data: {\n error_data: error_data\n },\n subject: 'Error while ProcessUnwhitelist'\n ).deliver\n end",
"def deny_users(deny_ids)\n deny_ids.each do |id|\n user = User.find(id)\n if user.update_attributes({approval: -1}, as: :admin)\n @@message = \"The users have been denied.\"\n end\n end\n end",
"def findings_expired_warning\n user = User.joins(:findings).take\n\n NotifierMailer.findings_expired_warning user, user.findings.limit(3)\n end",
"def send_self_eval_invitations\n users = User.all.select{|u| \n u.has_current_registration && \n u.current_registration.participant && \n !u.faculty && \n !u.test && \n !u.current_registration.has_complete_eval\n }\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_invitation(u)\n puts(\"Succeed on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def email_failure_report(message=\"\")\n\t\t\t@email_addr.each do |email|\n\t\t\t\tsend_email(:to => email, :subject => (\"Servers Down!\" + message), :message => @report.fail_text)\n\t\t\tend\n\t\tend",
"def notify_user_of_email_change_overlap_attempt!(email,supplied_name)\n user = User.find_by_email(email)\n template_locals = { :user => user, :supplied_name => supplied_name}\n send_email_to_user(user,\"Frank says someone is using your email.\" ,:'mail/email_change_warning', template_locals)\n end",
"def process_notifications(users, plan)\r\n users.each{| user |\r\n #KS- if they have email notification on, check their notification setting\r\n email_notification = user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL)\r\n if email_notification\r\n #KS- which notification category does this user fall into?\r\n notification_setting = user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION)\r\n notification_setting = notification_setting.nil? ? nil : notification_setting.to_i\r\n case notification_setting\r\n when UserAttribute::INVITE_NOTIFICATION_ALWAYS\r\n if user.registered?\r\n UserNotify.deliver_invite_notification(current_user, user, plan)\r\n else\r\n url = url_for(:controller => 'users', :action => 'register', :id => user.id)\r\n UserNotify.deliver_unregistered_invite_notification(current_user, user, plan, url)\r\n end\r\n end\r\n\r\n end\r\n #TODO: KS- handle SMS notification\r\n }\r\n end",
"def report_notice_to_user(user)\n @user = user\n\n mail to: \"#{user.email}\", bcc: '[email protected]', subject: \"【StudyConcierge】【報告作成のお知らせ】\"\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_reminder(u)\n puts(\"Succeed on #{u.email}\")\n @sent << u.email\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def twitter_connection_fail()\n set_attachments\n\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: '[email protected]', subject: \"Notificaciones @ Social Target - Error obteniendo conexiones\")\n when 'CO'\n mail(to: '[email protected]', subject: \"Notificaciones @ Social Target - Error obteniendo conexiones\")\n when 'MX'\n mail(to: '[email protected]', subject: \"Notificaciones @ Social Target - Error obteniendo conexiones\")\n end\n\n\n end",
"def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end",
"def send_category_limit_alert(user, path)\n @user = user\n @path = path\n mail( :to => @user.email,\n :subject => 'You have exceded the mailer amount.' )\n end",
"def notify\n ActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :cc => \"[email protected]\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def email_user\n Mailer.deliver_metadata_processed(dataset_id, user_id, @missing_variables, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def notify_user_of_registration_overlap_attempt!(email,supplied_name)\n user = User.find_by_email(email)\n template_locals = { :user => user, :supplied_name => supplied_name}\n send_email_to_user(user,\"Frank says someone is using your email.\" ,:'mail/email_warning', template_locals)\n end",
"def warn(check)\n update_check_status(check, 'warn')\n end",
"def show_anonymous_warning\n flash.now[:anonymous_warning] = true if current_user.nil?\n end",
"def warned; end",
"def event_admin_message_notice(action, user, event)\n @action = action\n @user = user\n @event = event\n \n mail(:to => @user.email, :subject => \"#{@action.user.name} posted on your StreetMeet - #{event.title}\") unless @user.email.blank?\n end",
"def rejected\n RequestMailer.rejected\n end",
"def refused_users(users)\n emails = email_list(users.map(&:email))\n if users.count == 0\n nil\n else\n \"#{emails} indicated that they were not present for the meeting.\".html_safe\n end\n end",
"def firecloud_api_notification(current_status, requester=nil)\n unless Rails.application.config.disable_admin_notifications == true\n @admins = User.where(admin: true).map(&:email)\n @requester = requester.nil? ? '[email protected]' : requester\n @current_status = current_status\n unless @admins.empty?\n mail(to: @admins, reply_to: @requester, subject: \"[Unity Admin Notification#{Rails.env != 'production' ? \" (#{Rails.env})\" : nil}]: ALERT: FIRECLOUD API SERVICE INTERRUPTION\") do |format|\n format.html\n end\n end\n end\n end",
"def tweet_rejected_by_influencer(tweet)\n @tweet = tweet\n\n set_attachments\n\n @screen_name = tweet.influencer.user.twitter_screen_name\n\n mail(to: tweet.campaign.advertiser.user.email, subject: \"Notificaciones @ Social Target - Tweet rechazado por @\"+@screen_name+ \". \"[email protected]_cause)\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: '[email protected]', subject: \"Notificaciones @ Social Target - Un tweet realizado por \"+tweet.campaign.advertiser.user.email+\" fue rechazado por @\"+@screen_name+ \". \"[email protected]_cause)\n when 'CO'\n mail(to: '[email protected]', subject: \"Notificaciones @ Social Target - Un tweet realizado por \"+tweet.campaign.advertiser.user.email+\" fue rechazado por @\"+@screen_name+ \". \"[email protected]_cause)\n when 'MX'\n mail(to: '[email protected]', subject: \"Notificaciones @ Social Target - Un tweet realizado por \"+tweet.campaign.advertiser.user.email+\" fue rechazado por @\"+@screen_name+ \". \"[email protected]_cause)\n end\n\n end",
"def tweet_rejected_by_advertiser(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.influencer.user.email, subject: \"Notificaciones @ Social Target - Una propuesta de tweet que has modificado, ha sido rechazada por el anunciante\")\n end",
"def warning?; end",
"def warning?; end",
"def warning?; end",
"def warning(warning)\n end",
"def due_next_week_warning_mail\n PetitionMailer.due_next_week_warning_mail(Petition.live.first)\n end",
"def notify_groups_for_alert(alert)\n @alert = alert\n groups = Group.where(id: alert.groups_alerted)\n\n users = groups.inject([]) do |users, group|\n users += group.users\n end.uniq\n\n user_emails = users.map(&:email)\n\n mail bcc: user_emails, subject: \"Alerta de inventário de item\"\n end",
"def warning(text)\n GitPusshuTen::Log.warning(text)\n end",
"def send_password_change_notification\n # do not notify the admins for now\n end",
"def notify_warning(error, context_message = nil)\n log(error, level: :warn) do\n @config.warn_notifiers&.map { |notifier| notifier.call(error, context_message) }\n end\n end",
"def send_notice_certification(score, wrongs)\n UserMailer.cert_notice(self, score, wrongs).deliver_now\n end",
"def unboarded_loans(loans)\n return unless Rails.env == 'production'\n to_email = 'MB Servicing <[email protected]>'\n subject = (Rails.env == 'development') ? 'TESTING -- MBWEB/TSS: Boarded Loans Notification' : 'MBWEB/TSS: Boarded Loans Notification'\n @loan_count = loans.count\n return if @loan_count <= 0\n mail(:to => to_email, :subject => subject) do |format|\n format.text\n end\n end",
"def disable_expired_users()\n confluence_user_names.each do |name|\n next if name == \"conflusa\" \n ldap_person = find_in_ldap(name)\n \n if ldap_person.nil? || !eligible_for_confluence?(ldap_person)\n user = find_in_confluence(name)\n user.disable()\n @disabled_users << user \n end\n end\n end",
"def notify_users\n board = Conversation.find(conversation_id).board\n if (board.public)\n users = User.ids - [user_id]\n users.each do |u|\n Notification.create(user_id: u, comment_id: id, conversation_id: conversation_id)\n end\n else #if the board is not public, Notifications are sent to the specific people.\n role_applications = RoleApplication.where(status: 'Approved')\n role_applications.each do |app|\n Notification.create(user_id: app.user_id, comment_id: id, conversation_id: conversation_id) if app.user_id != user_id\n notify_production_team\n end\n end\n end"
] | [
"0.70432657",
"0.6561599",
"0.65585905",
"0.6485254",
"0.64650327",
"0.63884485",
"0.63472915",
"0.6287187",
"0.61808294",
"0.61514384",
"0.6129055",
"0.608857",
"0.6080138",
"0.6079046",
"0.60732603",
"0.6066005",
"0.60626",
"0.6043357",
"0.6039502",
"0.6032962",
"0.60136604",
"0.5995786",
"0.59864753",
"0.5986393",
"0.5984828",
"0.5973087",
"0.5957672",
"0.59363383",
"0.5929989",
"0.59249425",
"0.592409",
"0.5918522",
"0.59153503",
"0.59037614",
"0.58960885",
"0.58952266",
"0.58884436",
"0.58875626",
"0.58780354",
"0.58680636",
"0.58494353",
"0.584914",
"0.5845743",
"0.5838748",
"0.5834682",
"0.58316094",
"0.5820845",
"0.58197665",
"0.58155257",
"0.5815246",
"0.58097476",
"0.5801617",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5794786",
"0.57868326",
"0.5784869",
"0.5784503",
"0.57844305",
"0.5775751",
"0.5774517",
"0.5774133",
"0.576424",
"0.5763184",
"0.57604307",
"0.5750549",
"0.5746762",
"0.5745525",
"0.57448626",
"0.5744539",
"0.5736058",
"0.57285863",
"0.5727083",
"0.5723352",
"0.5722132",
"0.57142574",
"0.57137",
"0.5713071",
"0.57111055",
"0.5703555",
"0.57014763",
"0.5700457",
"0.5700457",
"0.5700457",
"0.5696949",
"0.5694624",
"0.56894714",
"0.5683124",
"0.5680812",
"0.5671687",
"0.5659235",
"0.5654265",
"0.5647453",
"0.56468296"
] | 0.73420143 | 0 |
Handle sending resolved emails to all users | def resolved_email(user, warning)
@user = user
@warning = warning
mail to: @user.email, subject: 'CastleBridge Resolved Email'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_self_eval_reminders\n users = User.all.select{|u| u.has_current_registration && u.current_registration.participant && !u.current_registration.has_complete_eval}\n @sent = []\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_reminder(u)\n puts(\"Succeed on #{u.email}\")\n @sent << u.email\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def send_all_invitations\n uu = User.all.reject{|u| u.bounced_at || u.test || u.email =~ /musicalretreat.org/ || u.has_current_registration}\n Rails.logger.info(\"Going to send #{uu.size} invitations\")\n uu.each do |u|\n begin\n RegistrationMailer.invitation(u)\n Rails.logger.info(\"Successfully sent to #{u.email}\")\n rescue StandardError => e\n Rails.logger.error(\"Failed to send to #{u.email} due to #{e}\")\n end\n end\n end",
"def deliver\n User.all.each do |user|\n UserMailer.send_message(user,self).deliver\n end\n end",
"def send_self_eval_invitations\n users = User.all.select{|u| \n u.has_current_registration && \n u.current_registration.participant && \n !u.faculty && \n !u.test && \n !u.current_registration.has_complete_eval\n }\n users.each do |u| \n if u.bounced_at \n Rails.logger.error(\"Found bounced email #{u.email} in sending self eval_reminder\")\n else\n begin\n RegistrationMailer.self_eval_invitation(u)\n puts(\"Succeed on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email}\")\n Rails.logger.error(\"Send eval throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def notifier_to_users(recipients, task)\r\n recipients.each do |recipient, outcome|\r\n if recipient =~ /#{SEND_EMAILS_ONLY_FOR_DOMAIN}/\r\n puts \"Sending email to #{recipient}...\"\r\n begin\r\n Notifier.deliver_user_notification(recipient, outcome, task)\r\n rescue StandardError => err\r\n puts err.message\r\n end\r\n else\r\n puts \"Email to #{recipient} not sent\"\r\n end\r\n end\r\nend",
"def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end",
"def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end",
"def send_emails\n mail = build_mail\n get_recipients do |recipient|\n unless EmailResponse.exists?(email: recipient.email) # bounces & complaints\n mail.to = recipient.email\n replace_and_send_mail_safely(mail, recipient)\n end\n end\n end",
"def call\n users_to_notify.uniq.each do |recipient|\n Hyrax::MessengerService.deliver(user, recipient, message.html_safe, subject)\n\n mailer = workflow_message_mailer(to: recipient)\n mailer.send(mailer_method).deliver_later if mailer.respond_to?(mailer_method)\n end\n end",
"def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end",
"def send_to_admins\n @all_recipients = User.where(:receive_admin_email => true)\n raise NoRecipients if @all_recipients.blank?\n @all_recipients.group_by(&:language).each do |lang, users|\n @recipients = users\n mail_with_locale users, lang\n end\n end",
"def resend_activation_emails\n User.where.not(person: nil).where.not(activation_code: nil).each do |user|\n if user.person\n logs = user.person.activation_email_logs\n if logs.count < MAX_ACTIVATION_EMAILS && (logs.empty? || logs.last.created_at < RESEND_ACTIVATION_EMAIL_DELAY.ago)\n Mailer.activation_request(user).deliver_later\n MessageLog.log_activation_email(user.person)\n end\n else\n Rails.logger.info(\"User with invalid person - #{user.id}\")\n end \n end\n end",
"def send_emails\n self.attendees.distinct.each do |attendee|\n UpdatesMailer.updates_mail(attendee, self).deliver_now\n end\n end",
"def perform\n User.where(id: @bug.notify_on_deploy).each do |user|\n NotificationMailer.deploy(@bug, user).deliver\n end\n end",
"def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <[email protected]>\",\n\t return_path: \"[email protected]\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end",
"def send_message_email\n requires_user_can :edit, task\n users = User.where(email: params[:recipients])\n sent_to_users = []\n users.each do |user|\n sent_to_users << user.email\n GenericMailer.delay.send_email(\n subject: params[:subject],\n body: params[:body],\n to: user.email,\n task: task\n )\n end\n trigger_email_sent_event(task)\n d = Time.now.getlocal\n initiator = current_user.email\n render json: {\n letter_template: {\n to: sent_to_users,\n from: initiator,\n date: d.strftime(\"%h %d, %Y %r\"),\n subject: params[:subject],\n body: params[:body]\n }\n }\n end",
"def send_notification\n # Getting users of current group\n @group = Group.find(params[:id])\n @users = @group.users\n\n # Subject for mail\n if action_name == \"create\"\n subject = \"New task creation\"\n else\n subject = \"Task update\"\n end\n\n # Sending mail to each user of the group\n @users.each do |user|\n TaskMailer.task_create_notification(subject, user, @group, @task).deliver_now\n end\n\n end",
"def receive_emails_for!(ids)\n return nil if user.project? \n project_ids = user.projects.map(&:id) + [user.id]\n tracked_ids = receives_emails_for.map(&:id)\n \n # Remove trackings to projects user no longer follows, or no longer owns\n dead_ids = tracked_ids.select{|t| !project_ids.include?(t) || (ids.nil? || !ids.include?(t))}\n Tracking::EmailDelivery.delete_all [\"tracked_item_type='User' and tracked_item_id in (#{dead_ids.join(',')}) and tracking_user_id=?\", user.id] unless dead_ids.empty?\n \n return nil if ids.nil?\n \n # Add trackings that don't already exist\n ids.uniq.each do |pid|\n pid = pid.id if pid.is_a?(User)\n if project_ids.include?(pid.to_i) && !tracked_ids.include?(pid)\n Tracking::EmailDelivery.create(:tracking_user_id => user.id, :tracked_item_type => 'User', :tracked_item_id => pid)\n end\n end\n return receives_emails_for\n end",
"def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end",
"def send_email_on_human_data(email_data)\n # MAILER: Enable mailer so it can send out the email\n ActionMailer::Base.perform_deliveries = true\n\n # USER: Get user in a list to send\n email_recipients = User.where(username: curation_concern.admin_set.edit_users).map(&:email)\n\n # DELIVER: Delivering the email to the reviewer\n email_recipients.each do |i|\n ScholarsArchive::HumanDataMailer.with(user_mail: i, data: email_data).email_on_human_data.deliver_now\n end\n end",
"def send_mail(changed_watched_paths, hash, paths_by_users)\n \n # send one email for email address\n paths_by_users.keys.each do |user_email|\n subject=nil\n body=String.new @body_prefix\n \n # merge in the changed paths this user is interested in\n paths_by_users[user_email].each do |watched_path|\n \n if changed_watched_paths[watched_path]\n \n body << \"\\n\" << changed_watched_paths[watched_path].join(\"\\n\")\n # take any to generate the branch\n if !subject\n \n subject= String.new @subject_prefix\n subject << extract_branch(changed_watched_paths[watched_path])\n subject << \" by user \"\n subject << hash[:author]\n\t @logger.debug(\"Subject is=\"<< subject)\n end\n end \n end\n \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"revision: \" << hash[:rev]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n \n yield(user_email, subject, body)\n \n end\n end",
"def index\n @inbox = Email.to(@user.name)\n process_incoming(@inbox)\n @sent = Email.from(@user.name)\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def notify_all\n MemberMailerWorker.perform_async(member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_freelancer)\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :send_job_paid_to_employer)\n TeamMailerWorker.perform_async(job_order_id: self.id.to_s, perform: :send_job_order_paid)\n\n\n MemberMailerWorker.perform_in(4.hours, member_id: self.employer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_employer)\n MemberMailerWorker.perform_in(4.hours, member_id: self.freelancer.id.to_s, job_order_id: self.id.to_s, perform: :resend_job_paid_to_freelancer)\n\n km_properties = self.job.km_properties\n km_properties[:paid_job] = self.currency.convert_to_idr(self.budget)\n km_properties[:job_order_id] = self.id.to_s\n km_properties[:type] = self.class.to_s\n\n KissmetricsWorker.perform_async(perform: :job_paid, identity: self.job.member.email, properties: km_properties)\n\n # notify other applicants that a freelancer has been hired, only for the first job order\n if self.first_paid_order?\n all_applicants = self.job.job_applications\n all_applicants.each do |ja|\n if ja != self.job_application\n MemberMailerWorker.perform_async(member_id: ja.member.id.to_s, job_order_id: self.id.to_s, perform: :send_freelancer_hired_to_other_applicants)\n end\n end\n end\n end",
"def email_for_recipient(user)\n IntervalNotifier.daily_email(user, report) if report.top_public_recognitions.size > 0\n end",
"def email_user\n Mailer.deliver_metadata_processed(dataset_id, user_id, @missing_variables, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def handle(uids)\n each_message uids, 'text/plain' do |uid, mail|\n @mail = mail\n @url = nil\n @description = nil\n\n case mail.from.first\n when '[email protected]' then\n next false unless handle_a2atransfer\n when '[email protected]' then\n next false unless handle_alert\n when '[email protected]' then\n next false unless handle_hsbc\n else\n log \"Unknown From: #{mail.from.join ', '}\"\n next false\n end\n\n add_item mail.subject, @description, mail.from, mail.date, @url,\n mail.message_id, 'HSBC'\n end\n end",
"def send_user\n UserProfileCertificationMailer.send_user\n end",
"def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"[email protected]\"] )\n \n end",
"def process_notifications(users, plan)\r\n users.each{| user |\r\n #KS- if they have email notification on, check their notification setting\r\n email_notification = user.get_att_value(UserAttribute::ATT_REMIND_BY_EMAIL)\r\n if email_notification\r\n #KS- which notification category does this user fall into?\r\n notification_setting = user.get_att_value(UserAttribute::ATT_INVITE_NOTIFICATION_OPTION)\r\n notification_setting = notification_setting.nil? ? nil : notification_setting.to_i\r\n case notification_setting\r\n when UserAttribute::INVITE_NOTIFICATION_ALWAYS\r\n if user.registered?\r\n UserNotify.deliver_invite_notification(current_user, user, plan)\r\n else\r\n url = url_for(:controller => 'users', :action => 'register', :id => user.id)\r\n UserNotify.deliver_unregistered_invite_notification(current_user, user, plan, url)\r\n end\r\n end\r\n\r\n end\r\n #TODO: KS- handle SMS notification\r\n }\r\n end",
"def run_schedule_works\n # TODO list\n puts \"send email\"\n user_list = User.includes(:goods_stores).where('goods_stores.goods_expire_date < ?', Time.now.strftime(\"%Y-%m-%d\")).references(:goods_stores)\n\n\n user_list.each{|user|\n if user.goods_stores.length == 0\n next\n end\n\n email_content = \"\"\n email_content += \"<h1>Alert! Some Item in Your Fridge were expired</h1>\"\n email_content += \"<p>Hello #{user.username}</p>\"\n email_content += \"<p>The following item in your fridge is expired</p>\"\n email_content += \"<ul>\"\n\n user.goods_stores.each{|goods|\n email_content += \"<li>food name: #{goods.goods_info.goods_name} food expire date: #{goods.goods_expire_date} fridge: #{goods.fridge.fridge_name}</li>\"\n }\n\n email_content += \"</ul>\"\n puts email_content\n\n from = Email.new(email: '[email protected]')\n to = Email.new(email: user.email)\n subject = \"Alert! Some Item in Your Fridge were expired\"\n content = Content.new(type: 'text/html', value: email_content)\n mail = Mail.new(from, subject, to, content)\n\n sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])\n response = sg.client.mail._('send').post(request_body: mail.to_json)\n puts response.status_code\n puts response.body\n puts response.headers\n }\n\n end",
"def send_email\r\n if User.exists? params[:id]\r\n @email_to_usr = User.find(params[:id])\r\n if params[:commit]\r\n if @sending_res = profile_mail_sending(params, @email_to_usr)\r\n return if @sending_res.kind_of? Hash\r\n redirecting(t(:email_redir), session[:last_page])\r\n else\r\n redirect_to_info_page t(:email_error)\r\n end\r\n return\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end",
"def send_invitation_emails(registered_users, invited_users)\n registered_users.each do |user|\n Course::Mailer.user_added_email(@current_course, user).deliver_later\n end\n resend_invitation_emails(invited_users)\n end",
"def send_emails(contacts)\n @valid_emails = contacts.select { |e| e =~ Devise.email_regexp }\n @bad_emails = contacts - @valid_emails\n current_user.increase_invites_count!(@valid_emails.count)\n @valid_emails.each do |email|\n EmailInvite.transaction do\n invite = EmailInvite.create(:from_user_id => current_user.id, :email => email)\n InviteEmail.invite(email, params[:message], current_user, invite.token).deliver\n end\n end\n end",
"def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end",
"def send_welcome_email\n subscription = self.subscription\n parent_no_valids = ParentNoValid.where(subscription: subscription)\n parent_no_valids.each do |parent_no_valid|\n ParentNoValidMailer.welcome(parent_no_valid).deliver_now\n end\n end",
"def send_mail_to_associates\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end",
"def send_email!\n UserMailer.event_ticket_notification(user, self).deliver_now\n end",
"def send_email\n return true unless RunLevel.is_normal?\n\n log_msg = \"SEND #{flavor} \" \\\n \"from=#{user&.login || \"nil\"} \" \\\n \"to=#{to_user&.login || \"nil\"} \" +\n queued_email_integers.map { |x|\n \"#{x.key}=#{x.value}\"\n }.join(\" \") +\n queued_email_strings.map do |x|\n \"#{x.key}=\\\"#{x.value}\\\"\"\n end.join(\" \")\n self.class.debug_log(log_msg)\n current_locale = I18n.locale\n result = false\n if user.present? && user == to_user\n unless Rails.env.test?\n raise(\"Skipping email with same sender and recipient: #{user.email}\\n\")\n end\n else\n result = deliver_email\n end\n I18n.locale = current_locale\n result\n rescue StandardError => e\n warn(\"ERROR CREATING EMAIL\")\n warn(log_msg)\n warn(e)\n warn(e.backtrace)\n I18n.locale = current_locale\n false\n end",
"def deliver_email\n#puts \"**** deliver_email: emails=#{emails}\"\n emails = @contact_info.map {|c| c[:email]}.compact.uniq\n self.subject ||= 'Message from SIM Nigeria'\n id_for_reply = self.following_up || id # a follow-up message uses id of the original msg\n#puts \"**** Messages#deliver_email response_time_limit=#{response_time_limit}\"\n outgoing = Notifier.send_group_message(:recipients=>emails, :content=>self.body, \n :subject => subject, :id => id_for_reply , :response_time_limit => response_time_limit, \n :bcc => true, :following_up => following_up) # send using bcc:, not to:\nraise \"send_email with nil email produced\" if outgoing.nil?\n outgoing.deliver\n # Mark all as being sent, but only if they have an email address\n # This is terribly inefficient ... need to find a way to use a single SQL statement\n sent_messages.each do |sm| \n sm.update_attributes(:msg_status => MsgSentToGateway) if sm.member.primary_email\n end\n end",
"def perform\n users_hash = check_subscriptions\n ::ApplicationController.helpers.display_results(users_hash)\n ::AdminMailer.invalid_users(users_hash, :pending_subscription).deliver_later if users_hash.any?\n end",
"def process\n if recipient_ids == :all_users\n process_for_all_users\n else\n process_by_recipient_ids\n end\n end",
"def also_receive_emails_for(uid)\n u = uid.is_a?(User) ? uid.id : uid\n receive_emails_for!(receives_emails_for.map(&:id) + [u])\n end",
"def send_registration_summary\n #test_emails = [\"[email protected]\"]\n test_emails = nil\n rr = Registration.where(year: Year.this_year).reject{|r|r.faculty?} unless test_emails\n rr = rr.select{|r|test_emails.include?(r.email)} if test_emails\n rr.each do |r| \n u = r.user\n if u.bounced_at\n puts(\"Found bounced email #{u.email} in sending registration reminder\")\n else\n begin\n RegistrationMailer.registration_summary(r)\n puts(\"Succeeded on #{u.email}\")\n rescue => e\n puts(\"Failed on #{u.email} due to #{e}\")\n Rails.logger.error(\"Send registration reminder throws #{e}, skipping #{u.email}\")\n end\n end\n end\n end",
"def send_notifications\n\t\tphones_sent_to = []\n\t\temails_sent_to = []\n\t\tgather_recipients.each do |recipient|\n\t\t\trecipient.phone_numbers.each do |phone_number|\n\t\t\t\tnext if phones_sent_to.include? phone_number\n\t\t\t\tphones_sent_to << phone_number\n\t\t\t\tresponse = Auth::TwoFactorOtp.send_transactional_sms_new({\n\t\t\t\t\t:to_number => phone_number,\n\t\t\t\t\t:template_name => REPORT_UPDATED_TEMPLATE_NAME,\n\t\t\t\t\t:var_hash => {:VAR1 => self.patient.first_name, :VAR2 => self.patient.last_name, :VAR3 => self.pdf_url, :VAR4 => self.created_by_user.organization.name },\n\t\t\t\t\t:template_sender_id => REPORT_UPDATED_SENDER_ID\n\t\t\t\t})\n\t\t\tend\n\t\t\tunless recipient.email_ids.blank?\n\t\t\t\temail = OrderMailer.report(recipient,self,self.created_by_user,(recipient.email_ids - emails_sent_to))\n\t \temail.deliver_now\n\t \temails_sent_to << recipient.email_ids\n\t \temails_sent_to.flatten!\n \tend\n \tend\n\tend",
"def complete_post_processing_tasks\n process_incident_issues if process_issues?\n send_alert_email if send_email? && notifying_alert?\n end",
"def emails\n ActionMailer::Base.cached_deliveries\n end",
"def send_email(user)\n\t UserMailer.activate_email(user).deliver\n\tend",
"def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end",
"def email_all\n wc = Incoming::Workcamp.find(params[:id])\n addresses = wc.participants.map { |p| p.organization.email.to_s.strip }\n redirect_to \"mailto:#{addresses.join(',')}\"\n end",
"def send_thx_email\n @user = User.where(:uid => self.uid).first\n if [email protected]? && [email protected]?\n Services::Mandrill.mail(@user.email, 'PicsforPets_2013_Reportback', 'How to get puppies adopted')\n end\n end",
"def send_following_emails\n self.question.follow_questions.each do | follow |\n if follow.user_id != self.user_id && follow.user.email_follows?\n FollowQuestionMailer.new_answer(follow.user, self.question, self).deliver\n end\n end\n end",
"def send_email_alert(sender_email, sender_pass, recipients, subject, body)\n log \"Sending e-mail alert.\"\n recipients.each do |r|\n Pony.mail(:to => r, :via => :smtp, :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => sender_email,\n :password => sender_pass,\n :authentication => :plain,\n :domain => \"HELO\",\n }, :subject => subject, :body => body)\n end\nend",
"def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n\n process_request(request, response) && response.deliver\n end\n rescue StandardError => e\n logger.fatal(\"SERVER ERROR\") { \"#{e.inspect}\\n\" + e.backtrace.join(\"\\n \") }\n raise\n end",
"def email\n # redirect to the first page of the website\n redirect_to login_path\n\n # Get all users who subscribe\n users = User.where(subscribe: true)\n\n # Get mandril object\n mandrill = Mandrill::API.new 'SyKEz-QytC97dIODlvKQoQ'\n\n # Send a digest to each user\n users.each do |user|\n # Set the elementary content string\n content = \"Here is the list of interesting articles for you\\n\\n\"\n\n # Get all the interesting articles and order by date_time\n articles = Article.tagged_with(user.interest_list, any: true).order(date_time: :desc)\n\n # Get at most 10 new interesting articles\n num = 0\n articles.each do |article|\n # If 10 interesting articles are already extracted, break the loop\n break if num >= MAX_NUM_ARTICLES\n\n # If this article has not been sent to this user, include this to digest\n unless user.articles.include?(article)\n user.articles << article\n # Update content string\n content += make_paragraph(article.title, article.link)\n num += 1\n end\n end\n\n # If there is no interesting article\n if num == 0\n content = \"There is no any new interesting articles for you this time.\\n\"\n end\n\n # create a message to send\n message = {\n subject: 'Hello, ' + user.first_name + '. This is the digest you required',\n from_name: 'The Digest',\n text: content,\n to: [\n {\n email: user.email,\n name: user.first_name + ' ' + user.last_name\n }\n ],\n from_email: '[email protected]'\n }\n\n # send the email\n mandrill.messages.send message\n end\n end",
"def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end",
"def perform(user_id)\n user = User.find(user_id)\n Notifier.email_meed_fair_new_users(user).deliver\n end",
"def receive_email\n \n \n #if one of the to addresses matches us, use that one. todo - correctly handle mulitple emails, or correctly fail\n if params[:to].match(/group\\+(\\d+)@/) && @group = Group.find($1)\n from = params[:from]\n body = params[:plain].gsub(/^On .* wrote:$\\s*(^>.*$\\s*)+/,'') #strip out replies and whatnot\n\n if @sender = @group.students.find_by_email(from)\n @group.send_message(@sender.name+\": \"+body,@sender,[@group.user])\n elsif @group.user.email==from\n @group.send_message(@group.user.display_name+\": \"+body,@group.user)\n end\n end\n render :text => 'success', :status => 200\n end",
"def send_emails(params, bib_record, current_user)\n in_process_params = get_in_process_params(params, bib_record, current_user)\n # mail search details to staff, patron\n FormMailer.with(in_process_params).in_process.deliver_now\n end",
"def send_invitation_emails(registered_users, invited_users)\n registered_users.each do |user|\n Course::Mailer.user_added_email(@current_course, user).deliver_later\n end\n invited_users.each do |user|\n Course::Mailer.user_invitation_email(@current_course, user).deliver_later\n end\n true\n end",
"def send_mail\n User.send_welcome_email(self.id)\n end",
"def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end",
"def send_admin_mail\n admins = Admin.all\n\n admins.each do |admin|\n if admin.reminder\n AdminMailer.new_user_waiting_for_approval(admin.email).deliver_now\n end\n end\n end",
"def send!\n self.to_csv.split(/\\n/).each do |line|\n user = User.find_by_email(line.split(/\\t/)[0])\n fields = line.strip.split(/\\t/)[1..-1]\n self.send_message(user, fields)\n end\n end",
"def admin_request # :prefetch: :norobots:\n sender = @user\n pass_query_params\n if @project = find_or_goto_index(Project, params[:id].to_s)\n if request.method == :post\n subject = params[:email][:subject]\n content = params[:email][:content]\n for receiver in @project.admin_group.users\n AccountMailer.deliver_admin_request(sender, receiver, @project,\n subject, content)\n end\n flash_notice(:admin_request_success.t(:title => @project.title))\n redirect_to(:action => 'show_project', :id => @project.id,\n :params => query_params)\n end\n end\n end",
"def user_event_analisys(user, event)\n @user = user\n @event = event\n @meeting = user.meetings.find_by(event: event)\n\n mail(to: @user.email, subject: t('user_event_analisys', scope: 'message.email.subjects')) if @user.email.present?\n end",
"def by_mail_tracker\n end",
"def perform(participant_id, split_time_ids)\n live_effort_mail_data = LiveEffortMailData.new(participant_id, split_time_ids)\n live_effort_mail_data.followers.each do |follower|\n FollowerMailer.live_effort_email(follower, live_effort_mail_data.effort_data).deliver_later\n end\n end",
"def send_email_to_participants(request)\n unless RAILS_ENV == \"test\"\n recipients(last_message.sender).each do |recipient|\n if recipient.settings.email_when_new_comment == 1\n UserMailer.deliver_notification_of_new_message(recipient, last_message, request)\n end \n end\n end\n end",
"def notify_member_expire_7\n users, event = User.unpaid_membership_expires_in_7_days\n users.each do |user|\n UserMailer.deliver_membership_expires_in_7_days(user)\n User.add_email_event(user, event)\n end\n end",
"def send_acceptance_email\n # UserMailer.delay.send_accepted_email(user_id)\n end",
"def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end",
"def perform_deliveries\n @asq.deliveries.each(&:deliver)\n end",
"def send_reminder_for_all(rss_user_id)\n assigned_documents = get_assigned_documents(rss_user_id)\n ids = []\n types = []\n assigned_documents.each do |doc|\n ids << doc['assignmentid']\n types << doc['type']\n end\n reminder_ids = ids.join(',')\n reminder_types = types.join(',')\n send_reminder(rss_user_id, reminder_ids, reminder_types)\n end",
"def invitation(users)\n # making sure we only send in bulks of 1000 emails by the Sendgrid Api limits\n users = users[0..998]\n sendgrid_recipients users.collect {|user| user.email}\n sendgrid_substitute \"|name|\", users.collect {|user| user.name}\n mail :to => \"[email protected]\", :subject => \"Invitation to a demo app\"\n end",
"def send_notifications(unituser, msg)\n user = unituser.user\n user.send_sms(msg)\n UserMailer.send_email(user, user.email, msg).deliver if user.contact_flags[1] == \"1\"\n UserMailer.send_email(user, user.email2, msg).deliver if user.contact_flags[3] == \"1\"\n end",
"def send_admin_email\n AdminMailer.new_user_waiting_for_approval.deliver\n end",
"def send_email_to_user(user)\n if user.email && user.unsubscribed == false\n Email.create(:user_id => user.id, :message_id => self.id).deliver\n end\n end",
"def send_farewell_email(user)\n @user = user\n mail( :to => @user.email ,\n :subject => '[Todo Manager] See you again!')\n end",
"def setup_email(user)\n recipients user.email\n from self.contact_email\n sent_on Time.now\n end",
"def announcement \r\n admins = [2,45]\r\n redirect_to \"/\" and return if current_user.nil? or !admins.include?(current_user.id)\r\n users = User.all\r\n users.each do |user|\r\n Resque.enqueue(AnnouncementMailer, user.email, params[:subject], params[:message])\r\n end \r\n redirect_to \"/admin/\"\r\n end",
"def notify_member_expire_1\n users, event = User.unpaid_membership_expires_in_1_day\n users.each do |user|\n UserMailer.deliver_membership_expires_in_1_day(user)\n User.add_email_event(user, event)\n end\n end",
"def send_user_messages\n begin\n send_messages\n rescue Exception => exc\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Could not send mails. Check console.' }\n format.json { render :show, status: :mail_failed, location: @user }\n end\n\n raise exc\n end\n\n respond_to do |format|\n format.html { redirect_to @user, notice: 'User mails have been sent.' }\n format.json { render :show, status: :mail_success, location: @user }\n end\n end",
"def notify_admins\n team.admins.each do |admin|\n admin.send_email(:team_account_funded_admin, team_payin: self) unless admin.id == person.id\n end\n end",
"def sendMail(body)\n options = { :address => $advanced['mail']['address'],\n :port => $port,\n :domain => ENV['HOSTNAME'],\n :user_name => $advanced['mail']['username'],\n :password => $advanced['mail']['password'],\n :authentication => nil,\n :enable_starttls_auto => true }\n Mail.defaults do\n delivery_method :smtp, options\n end\n\n users = Array.new\n\n # Logic for pulling the email accounts from Plex.tv and/or the\n\t# config file\n\tplexTv = PlexTv.new($advanced)\n\n\tif !$testEmail\n \t if $plexEmails\n plex_users = plexTv.get('/pms/friends/all')\n\n if plex_users.nil? || plex_users.empty?\n $logger.info(\"No Plex friends found.\") \n else \n plex_users['MediaContainer']['User'].each do | user |\n\t\t\tif !user['email'].empty?\n users.push(user['email'])\n\t\t\tend\n end\n end\n\t end\n\t if !$advanced['mail']['recipients'].nil? || !$advanced['mail']['recipients_email'].nil?\n\t if !$advanced['mail']['recipients_email'].nil?\n\t $advanced['mail']['recipients_email'].each do | recipient |\n\t\t users.push(recipient)\n\t end\n\t end\n\t if !$advanced['mail']['recipients'].nil?\n\t\t $advanced['mail']['recipients'].each do | recipient |\n\t\t plex_users = plexTv.get('/pms/friends/all')\n plex_users['MediaContainer']['User'].each do | user |\n\t\t if user['username'] == recipient\n users.push(user['email'])\n\t\t\t end\n end\n\t\t end\n\t end\n\t end\n\tend\n\n #Get owner's email as well and add it to the list of recpients\n users.push(plexTv.get('/users/account')['user']['email'][0])\n \n\t#used to send individual email. Now it bcc's one email\n #users.each do | user |\n mail = Mail.new do\n from \"#{$advanced['mail']['from']} <#{$advanced['mail']['username']}>\"\n bcc users\n subject $advanced['mail']['subject'] + \" \" + (I18n.l Time.now.to_date)\n content_type 'text/html; charset=UTF-8'\n body body\n end\n begin\n mail.deliver!\n\t\t\trescue => e\n\t\t\t $logger.info(\"SMTP mailing failed!\\n#{e.message}#{e.backtrace}\")\n\t\t\tend\n #end\n end",
"def deliver_message\n return unless @recipients\n append_delivery_notes\n @recipients.reject{|r| r==self.user}.each do |usr|\n usr.user_notifications.create(self.attributes)\n usr.save\n end\n self.save!\n self.user.save!\n end",
"def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end",
"def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end",
"def user_has_few_contacts(user)\n mail to: user.email, subject: \"NetworkMill - Why Not Add Some Contacts?\"\n Email.create(:user_id => user.id, :sent_to => user.email, :title => \"user_has_few_contacts\")\n end",
"def subscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_subscribe(emails)\n end",
"def send_contact_email\n UserMailer.contact(self).deliver_now\n end",
"def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n \n begin\n apps.each do |app|\n app.call(:request => request, \n :response => response, \n :settings => settings,\n :logger => logger)\n end\n rescue StandardError => e\n logger.info(\"FAIL\") { e.to_s }\n logger.debug(\"FAIL\") { \"#{e.inspect}\\n\"+e.backtrace.join(\"\\n \") }\n\n if settings.service.raise_exceptions\n raise\n else\n next\n end\n end\n\n response.deliver\n end\n rescue Exception => e\n logger.fatal(\"Caught exception: #{e}\\n\\n#{e.backtrace.join(\"\\n\")}\")\n raise\n end",
"def new_user_email(user)\n @user = user\n User.where(admin: true).each do |admin|\n mail(to: admin.email, subject: \"A new user #{@user.email} has been added.\")\n end\n end",
"def deliver\n #find all the abonnes emails\n @abonnes = Abonne.all.collect(&:email)\n # Sends the newsletter to each one\n @abonnes.each do |abonne|\n NewsletterMailer.deliver_newsletter(abonne, self)\n end\n # Set the delivered_at time to now\n self.update_attribute(:delivered_at, Time.now)\n end",
"def run\n install_signal_handlers\n\n loop do\n begin\n cleanup\n emails = find_emails\n deliver(emails) unless emails.empty?\n rescue ActiveRecord::Transactions::TransactionError\n end\n break if @once\n sleep @delay\n end\n end",
"def perform(_sqs_msg, user_id)\n user = User.find_by(id: user_id)\n if user\n puts 'Sending email'\n SendEmail.send_mail(user)\n else\n puts 'Job failed'\n end\n end",
"def updated(ticket, currentUser)\n\t@ticket = ticket\n\t@emails = Array.new\n\n @ticket.users.each do |email|\n if !(email.seKey == currentUser)\n @emails.push(email.seKey + \"@semo.edu\")\n end\n end\n\n mail :to => @emails, :subject => ticket.responses.last.user.fName + \" \" + ticket.responses.last.user.lName + \" responded to ticket \" + \"#%06d\" % ticket.id\n end",
"def send_reminder_email \n UserMailer.reminder_email(self).deliver\n end",
"def send_mails_to_non_site_crowd_user(login_user, host_port)\n crowds = SharedTab.select('group_id').where([\"shareable_id=? AND shareable_type =?\", self.id, 'Discussion'])\n groups = crowds.present? ? Group.find(:all, :conditions=>[\"id in (?)\", crowds.map(&:group_id)]) : []\n for group in groups \n for group_user in group.group_users\n user = group_user.user\n Notifier.delay.mail_to_crowd_user(user.email,login_user.username, self, host_port)\n end\n for non_site in group.non_site_members\n Notifier.delay.mail_to_nsu_on_disc(non_site.email, login_user.username, host_port, self,non_site.id)\n end\n end if groups.present?\n end"
] | [
"0.7321592",
"0.72371495",
"0.71266496",
"0.7114521",
"0.7021203",
"0.6935726",
"0.6906808",
"0.6786121",
"0.6769543",
"0.67490363",
"0.6730936",
"0.668969",
"0.6686271",
"0.6572765",
"0.6544299",
"0.64343405",
"0.641731",
"0.64171994",
"0.63979447",
"0.63844293",
"0.6359168",
"0.6341632",
"0.63316643",
"0.6325364",
"0.63162047",
"0.6300493",
"0.62864643",
"0.6284939",
"0.6277408",
"0.62606",
"0.624911",
"0.6243506",
"0.6237682",
"0.6223182",
"0.6195706",
"0.61954755",
"0.6185608",
"0.6147603",
"0.614181",
"0.6131212",
"0.6130379",
"0.6128242",
"0.6120465",
"0.6119729",
"0.61139935",
"0.6113185",
"0.60991246",
"0.60883904",
"0.60687643",
"0.60660505",
"0.60605294",
"0.60577965",
"0.60536677",
"0.60530466",
"0.6051288",
"0.60475945",
"0.6045529",
"0.6045248",
"0.6038018",
"0.6034577",
"0.60333705",
"0.6029285",
"0.6028163",
"0.6024906",
"0.60080725",
"0.6006821",
"0.6005081",
"0.59950465",
"0.5993326",
"0.5992187",
"0.5987842",
"0.5986778",
"0.59841216",
"0.5984068",
"0.59797835",
"0.5972425",
"0.59646946",
"0.59519845",
"0.59465826",
"0.5944129",
"0.5943688",
"0.5943468",
"0.5943008",
"0.59427345",
"0.59413004",
"0.59384835",
"0.5937183",
"0.5936793",
"0.59351546",
"0.59303373",
"0.59288275",
"0.5922869",
"0.59194803",
"0.591835",
"0.59177536",
"0.5913896",
"0.5912256",
"0.59110236",
"0.5908616",
"0.58982563",
"0.5897643"
] | 0.0 | -1 |
we have to do this since remote_file expects a checksum as a string | def fetch_checksum
uri = URI(new_resource.checksum_uri)
request = Net::HTTP.new(uri.host, uri.port)
request.use_ssl = true if uri.to_s.start_with?('https')
response = request.get(uri)
if response.code != '200'
Chef::Log.fatal("Fetching the Logstash tarball checksum at #{uri} resulted in an error #{response.code}")
raise
end
response.body.split(' ')[0]
rescue => e
Chef::Log.fatal("Could not fetch the checksum due to an error: #{e}")
raise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end",
"def file_remote_digestsha1(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA1.hexdigest(data)\n end\n return chksum\n end",
"def calculated_checksum\n send(\"#{@resource[:checksum_type]}_file\".to_sym, @resource[:path]) \n end",
"def file_remote_digestmd5(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::MD5.hexdigest(data)\n end\n return chksum\n end",
"def validate_checksum(file_to_check)\n # desired = fetch_checksum\n desired = ::File.read(\"#{Chef::Config['file_cache_path']}/#{new_resource.tarball_name}.md5\").split.last\n actual = Digest::MD5.hexdigest(::File.read(file_to_check))\n\n if desired == actual\n true\n else\n Chef::Log.fatal(\"The checksum of the splunk tarball on disk (#{actual}) does not match the checksum provided from the mirror (#{desired}). Renaming to #{::File.basename(file_to_check)}.bad\")\n ::File.rename(file_to_check, \"#{file_to_check}.bad\")\n raise\n end\n end",
"def checksum\n fil_header[:checksum]\n end",
"def checksum\n\t\t@checksum ||= FileManager.checksum(@path)\n #\t\tif file?\n #\t\t\treturn FileManager.checksum(@path)\n #\t\tend\n end",
"def remote_file_content_same_as?(full_path, content)\n Digest::MD5.hexdigest(content) == capture(\"md5sum #{full_path} | awk '{ print $1 }'\").strip\n end",
"def file_checksum(file_path)\n Digest::SHA256.file(file_path).hexdigest\n end",
"def checksums; end",
"def validate_checksum\n raise Puppet::Error.new \"Inconsistent checksums. Checksum of fetched file is #{calculated_checksum}. You specified #{specified_checksum}\" if calculated_checksum != specified_checksum\n end",
"def checksum\n end",
"def verify_update_file\n @log.info('Beginning integrity check of downloaded file .')\n @file_sha1 = Digest::SHA1.file(@update_file.path).hexdigest\n\n @log.info('Verifying integrity of downloaded file.')\n\n if download_remote_sha1 == @file_sha1\n @log.info('Integrity verified.')\n true\n else\n abort('File was not downloaded correctly. Please try again.')\n end\n end",
"def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend",
"def calculate_checksum(file)\n @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: \"rb\")) rescue \"\"\n end",
"def test_get_checksum_stream\n\t\tbasechecksum = Cfruby::Checksum::Checksum.get_checksums(@tempfile.path)\n\t\tFile.open(@tempfile.path) { |fp|\n\t\t\tstreamchecksum = Cfruby::Checksum::Checksum.get_checksums(fp)\n\t\t\tassert_equal(basechecksum, streamchecksum)\n\t\t}\n\tend",
"def remote_file_resource\n Chef::Log.info \"Remote file: #{file_location}\"\n Chef::Log.info \"Local file: #{new_resource.name}\"\n @remote_file_resource ||= remote_file new_resource.name do\n source file_location\n checksum new_resource.checksum if !new_resource.checksum.nil?\n owner new_resource.owner\n group new_resource.group\n backup false\n action :nothing\n end\nend",
"def cached_file(source, checksum = nil)\n if source =~ %r{^(file|ftp|http|https):\\/\\/}\n uri = as_uri(source)\n cache_file_path = \"#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}\"\n Chef::Log.debug(\"Caching a copy of file #{source} at #{cache_file_path}\")\n\n remote_file cache_file_path do\n source source\n backup false\n checksum checksum unless checksum.nil?\n end\n else\n cache_file_path = source\n end\n\n Chef::Util::PathHelper.cleanpath(cache_file_path)\n end",
"def external_dependency_checksum; end",
"def checksum_of(url, etag, last_modified)\n #noinspection RubyArgCount\n Zlib::crc32(url + etag + last_modified).to_s\n end",
"def checksum\n source[digest_type]\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def rubocop_checksum; end",
"def ssh_md5sum_file(file)\n df = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n df = ssh.exec! \"md5sum #{file}\"\n end\n df\n end",
"def read_remote_file(file)\n begin\n result = \"\"\n @ftp.retrbinary(\"RETR #{file}\", 1024) {|line| result += line if line != nil}\n rescue Exception => e\n error_message(e)\n ensure\n return result\n end\n end",
"def download_distribution(src, dst)\n remote_file = Chef::Resource::RemoteFile.new(\n dst,\n run_context\n )\n remote_file.owner('root')\n remote_file.group('root')\n remote_file.source(src)\n remote_file.mode('0644')\n remote_file.backup(false)\n\n remote_file.run_action(:create)\n\n Chef::Log.debug(\"remote_file.source: #{remote_file.source}\")\n Chef::Log.debug(\"remote_file.path: #{remote_file.path}\")\n Chef::Log.debug(\"remote_file.atomic_update : #{remote_file.atomic_update}\")\n Chef::Log.debug(\"remote_file.checksum : #{remote_file.checksum}\")\n\n # Returning downloaded file checksum\n md5sum(dst)\n end",
"def exists?(remote_file, local_file = nil)\n if (file = find_by_path(remote_file)) == nil\n if local_file != nil\n if (file = find_by_md5(Digest::MD5.file(local_file).to_s)) != nil\n path = build_node_path(file)\n return {\n :success => true,\n :data => {\n \"message\" => \"File with same MD5 exists at #{path}: #{file.to_json}\",\n \"path_match\" => false,\n \"md5_match\" => true\n }\n }\n end\n end\n return {\n :success => false,\n :data => {\n \"message\" => \"File #{remote_file} does not exist\"\n }\n }\n end\n\n retval = {\n :success => true,\n :data => {\n \"message\" => \"File #{remote_file} exists\",\n \"path_match\" => true,\n \"md5_match\" => false,\n \"node\" => file\n }\n }\n\n if local_file != nil\n if file[\"contentProperties\"] != nil && file[\"contentProperties\"][\"md5\"] != nil\n if Digest::MD5.file(local_file).to_s != file[\"contentProperties\"][\"md5\"]\n retval[:data][\"message\"] = \"File #{remote_file} exists but checksum doesn't match\"\n else\n retval[:data][\"message\"] = \"File #{remote_file} exists and is identical\"\n retval[:data][\"md5_match\"] = true\n end\n else\n retval[:data][\"message\"] = \"File #{remote_file} exists, but no checksum is available\"\n end\n end\n\n retval\n end",
"def verify_checksum!\n log.info(log_key) { \"Verifying checksum\" }\n\n expected = checksum\n actual = digest(downloaded_file, digest_type)\n\n if expected != actual\n raise ChecksumMismatch.new(self, expected, actual)\n end\n end",
"def checksum_valid?\n require 'digest'\n\n Chef::Log.info \"Validating the checkum\"\n\n if new_resource.checksum.to_s==''\n Chef::Log.info \"Skipping as no checksum is provided\"\n return true\n end\n\n if Chef::Artifact.from_nexus?(new_resource.location)\n Digest::SHA1.file(new_resource.name).hexdigest == Chef::Artifact.get_artifact_sha(node, new_resource.location)\n else\n if new_resource.checksum\n Digest::SHA1.file(new_resource.name).hexdigest == new_resource.checksum\n else\n Chef::Log.info \"[artifact_file] No checksum provided for artifact_file, not verifying against downloaded file.\"\n true\n end\n end\nend",
"def checksum\n render json: content_files_checksums(druid).to_json\n end",
"def generate_dummy_checksum()\n file = Pedant::Utility.new_random_file\n checksum = Pedant::Utility.checksum(file)\n sandbox = create_sandbox([file])\n upload_to_sandbox(file, sandbox)\n sleep 2 #give s3 some time\n commit_sandbox(sandbox)\n checksum\n end",
"def getfile(sum)\n source_path = \"#{@rest_path}md5/#{sum}\"\n file_bucket_file = Puppet::FileBucket::File.indirection.find(source_path, :bucket_path => @local_path)\n\n raise Puppet::Error, \"File not found\" unless file_bucket_file\n file_bucket_file.to_s\n end",
"def dmg_package_checksum\n case new_resource.source\n when :direct\n package_metadata[:sha256]\n else\n new_resource.checksum\n end\n end",
"def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end",
"def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end",
"def checksum(path)\n FileChecksum.new(path, Digest::SHA1).checksum\n end",
"def validate_downloaded_file(file_path:, checksum:)\n return false unless file_path.present? && checksum.present? && File.exist?(file_path)\n\n puts 'Validating file against expected checksum...'\n\n checksum = checksum[4..] if checksum.starts_with?('md5:')\n\n actual_checksum = Digest::MD5.file(file_path).to_s\n actual_checksum == checksum\n end",
"def checksum!(path = nil, opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n raise \"Path uses differnt extension\" if path && File.extname(path) != File.extname(self.local_path)\n \n \n if opts[:debug]\n raise (\"File '%s' does not exist\" % File.expand_path( path ) ) if path && !File.exist?( File.expand_path( path ) )\n else\n raise (\"File '%s' does not exist\" % path ) if path && !File.exist?( File.expand_path( path ) )\n end\n \n raise \"Can not specify both piece_size and piece_count\" if opts[:piece_size] && opts[:piece_count]\n raise \"piece_size must be an Integer\" if opts[:piece_size] && !opts[:piece_size].is_a?(Integer)\n raise \"piece_count must be an Integer\" if opts[:piece_count] && !opts[:piece_count].is_a?(Integer)\n \n path ||= self.local_path\n \n #get filesize\n self.size = File.size( File.expand_path( path ) )\n\n # Overrides piece_count if set\n # minimum size of 1KB for a piece\n if opts[:piece_size]\n @piece_count = nil\n @piece_size = [opts[:piece_size], 1024].max\n end\n\n\n # Overrides piece_size if set\n # This will be a multiple of 1024, and the last file will be slightly smaller\n # this means 1KB is the minimum size for a piece\n if opts[:piece_count]\n @piece_count = opts[:piece_count]\n @piece_size = ((@size / @piece_count) / 1024.0).ceil * 1024 \n end\n\n self.hashes = []\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.file( File.expand_path( path ) ).hexdigest, hash_type: \"sha-256\" )\n if self.piece_size\n i = 0\n (0...@size).step(self.piece_size).each do |offset|\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.hexdigest(File.read(File.expand_path( path ), self.piece_size, offset)), hash_type: \"sha-256\", piece: i )\n i += 1\n end\n end\n end",
"def specified_checksum\n @resource[:checksum]\n end",
"def verify_checksum(filename)\n if options[:sha256]\n verify_sha256_hash(filename, options[:sha256])\n elsif options[:sha1]\n verify_sha1_hash(filename, options[:sha1])\n end\n end",
"def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def file_sha256\n Digest::SHA256.file(self).hexdigest\n end",
"def checksum(name)\n checksum_data[name]\n end",
"def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end",
"def checksum_trailer\n fil_trailer[:checksum]\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def relative_to_mount(remote_file) # :nodoc:\n remote_file\n end",
"def fetch(tarball, url, md5)\n if !File.exist?(tarball)\n puts \"fetching from #{url}\"\n puts \"progress messages should appear...\"\n perms = $platform == \"Windows\" ? \"wb\" : \"w\"\n totalSize = 0\n lastPercent = 0\n interval = 5\n f = File.new(tarball, perms)\n f.write(open(url,\n :content_length_proc => lambda {|t|\n if (t && t > 0)\n totalSize = t\n STDOUT.printf(\"expect %d bytes, percent downloaded: \",\n totalSize)\n STDOUT.flush\n else \n STDOUT.print(\"unknown size to download: \")\n end\n },\n :progress_proc => lambda {|s|\n if (totalSize > 0)\n percent = ((s.to_f / totalSize) * 100).to_i\n if (percent/interval > lastPercent/interval)\n lastPercent = percent\n STDOUT.printf(\"%d \", percent)\n STDOUT.printf(\"\\n\") if (percent == 100)\n end\n else\n STDOUT.printf(\".\")\n end\n STDOUT.flush\n }).read)\n f.close()\n s = File.size(tarball)\n if (s == 0 || (totalSize > 0 && s != totalSize))\n puts \"download failed\"\n FileUtils.rm_f(tarball)\n exit 1\n end\n\n # now let's check the md5 sum\n calculated_md5 = Digest::MD5.hexdigest(File.open(tarball, \"rb\") {\n |f| f.read\n })\n if calculated_md5 != md5\n puts \"md5 mismatch, tarball is bogus, delete and retry\"\n puts \"(got #{calculated_md5}, wanted #{md5})\"\n exit 1\n else\n puts \"md5 validated! (#{calculated_md5} == #{md5})\"\n end\n end\nend",
"def asset_checksum(asset)\n filename = asset.original_file_location\n match = filename.match(/\\ASHA256E-s\\d*--(\\h{64})\\.[a-zA-Z]+\\Z/)\n match ? match[1] : nil\n end",
"def external_dependency_checksum\n nil\n end",
"def test_calc_file_crc\n input = File.expand_path('B0019278.JPG')\n\n crc32 = calc_file_crc(input)\n\n assert_equal(309668251, crc32)\n end",
"def handlesum\n currentvalue = self.retrieve\n if currentvalue.nil?\n raise Puppet::Error, \"Checksum state for %s is somehow nil\" %\n @resource.title\n end\n\n if self.insync?(currentvalue)\n self.debug \"Checksum is already in sync\"\n return nil\n end\n # If we still can't retrieve a checksum, it means that\n # the file still doesn't exist\n if currentvalue == :absent\n # if they're copying, then we won't worry about the file\n # not existing yet\n return nil unless @resource.property(:source)\n end\n\n # If the sums are different, then return an event.\n if self.updatesum(currentvalue)\n return :file_changed\n else\n return nil\n end\n end",
"def digest\n Digest::MD5.file(file).hexdigest\n end",
"def file_sha1\n Digest::SHA1.file(self).hexdigest\n end",
"def md5sum_file(file)\n return `md5sum #{file}`\n end",
"def remote_file_differs?(full_path, content)\n !remote_file_exists?(full_path) || remote_file_exists?(full_path) && !remote_file_content_same_as?(full_path, content)\n end",
"def download_remote_sha1\n @log.info('Downloading Elasticsearch SHA1.')\n\n @remote_sha1 = ''\n open(@download.verify_url) do |file|\n @remote_sha1 = file.read\n end\n\n @remote_sha1 = @remote_sha1.split(/\\s\\s/)[0]\n\n @remote_sha1\n end",
"def checksum_valid?\n Digest::SHA256.file(path).hexdigest == sha256sum\n end",
"def upstream_md5=( checksum )\n @digest = Crate::Digest.md5( checksum )\n end",
"def checksum(file, digest=nil)\n return nil unless digest\n if FileTest.directory?(file)\n @null_string ||= digester(digest).hexdigest(\"\") # TODO use other means\n else\n digester(digest).hexdigest(File.read(file))\n end\n end",
"def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)\n \n checksum64 = Base64.encode64([sandbox_file_checksum].pack(\"H*\")).strip\n timestamp = Time.now.utc.iso8601\n file_contents = File.read(sandbox_filename)\n # TODO - 5/28/2010, cw: make signing and sending the request streaming\n sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n :http_method => :put,\n :path => URI.parse(url).path,\n :body => file_contents,\n :timestamp => timestamp,\n :user_id => rest.client_name\n )\n headers = { \n 'content-type' => 'application/x-binary', \n 'content-md5' => checksum64, \n :accept => 'application/json'\n }\n headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))\n\n # Don't set inflated_response as S3 (for the Platform) doesn't return JSON.\n # Only Open Source does.\n self.inflated_response = nil\n self.exception = nil\n self.api_response = RestClient::Request.execute(\n :method => :put, \n :url => url, \n :headers => headers, \n :payload => file_contents\n )\nend",
"def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend",
"def checksum!\n self.checksum = compute_checksum\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def check_file(local_file)\n # Immateriel.info binding, @url\n uniq_str = Digest::MD5.hexdigest(\"#{@url}:#{local_file}\")\n uri = URI.parse(@url)\n fn = \"/tmp/#{uniq_str}_\" + Digest::MD5.hexdigest(File.basename(uri.path)) + File.extname(uri.path)\n self.class.download(@url, fn)\n if File.exist?(fn)\n check_result = self.class.check_image(fn, local_file, uniq_str)\n FileUtils.rm_f(fn)\n if check_result\n true\n else\n false\n end\n else\n false\n end\n end",
"def handle_remote_file(url, pid)\n local_path = download_remote_file(url, pid)\n return local_path unless zip_file?(local_path)\n\n extracted_local_zip = extract_local_zip(local_path, pid)\n FileUtils.rm_rf(local_path)\n extracted_local_zip\n end",
"def md5; Digest::MD5.file(fname).hexdigest; end",
"def lookup_checksum(file)\n @lookup_checksums[file] || calculate_checksum(file)\n end",
"def upstream_sha1=( checksum )\n @digest = Crate::Digest.sha1( checksum )\n end",
"def script_sha(conn, file_name)\n if (sha = SCRIPT_SHAS.get(file_name))\n return sha\n end\n\n sha = conn.script(:load, script_source(file_name))\n SCRIPT_SHAS.put(file_name, sha)\n sha\n end",
"def checksum(file)\n sha = ::Digest::SHA1.new\n File.open(file, 'r') do |fh|\n fh.each_line do |l|\n sha << l\n end\n end\n sha.hexdigest\n end",
"def update_copied_remote_file(file, copy)\n # the remote has a file that has been copied or moved from copy[file] to file.\n # file is also destination.\n src = copy[file]\n \n # If the user doen't even have the source, then we apparently renamed a directory.\n if !(working_changeset.include?(file2))\n directory nil, file, src, remote.flags(file)\n elsif remote.include? file2\n # If the remote also has the source, then it was copied, not moved\n merge src, file, file, flag_merge(src, file, src), false\n else\n # If the source is gone, it was moved. Hence that little \"true\" at the end there.\n merge src, file, file, flag_merge(src, file, src), true\n end\n end",
"def pull_file(sftp_session, remote_path, local_path, sync_data)\n\n # get the remote modification time\n remote_mtime = Time.at(sftp_session.file.open(remote_path).stat().mtime)\n\n # get the local modification time\n if File.exists?(local_path)\n\n local_mtime = File.mtime(local_path)\n else\n\n local_mtime = nil\n end\n\n # get our last sync times\n last_sync = get_last_sync_times(sync_data, remote_path)\n\n if(# pull if the file isn't present on the local side\n !local_mtime ||\n\n # pull the file if the local file is older than our last push\n (last_sync[\"push_last_local\"] &&\n (last_sync[\"push_last_local\"] <=> local_mtime) > 0) ||\n\n # pull the file it's newer than the last pull\n (last_sync[\"pull_last_remote\"] &&\n (last_sync[\"pull_last_remote\"] <=> remote_mtime) < 0) ||\n\n # if we haven't pulled this file and the file is newer than the\n # last push\n (!last_sync[\"pull_last_local\"] && last_sync[\"push_last_local\"] &&\n (last_sync[\"push_last_local\"] <=> local_mtime) < 0))\n\n # pull the file\n sftp_session.download!(remote_path, local_path)\n @log.debug(\"Pulled file #{remote_path}\")\n\n # get the new modification time of the remote file\n local_mtime = File.mtime(local_path)\n \n # save the modification time of the remote file\n sync_data[\"pull\"][remote_path] = [local_mtime, remote_mtime]\n else\n\n @log.debug(\"Skipped file #{remote_path}\")\n end\n end",
"def getfile(md5, client = nil, clientip = nil)\n bucket = Puppet::FileBucket::File.indirection.find(\"md5:#{md5}\")\n contents = bucket.contents\n\n if client\n return Base64.encode64(contents)\n else\n return contents\n end\n end",
"def getsum(checktype, file = nil)\n sum = \"\"\n\n checktype = :mtime if checktype == :timestamp\n checktype = :ctime if checktype == :time\n self.should = checktype = :md5 if @resource.property(:source)\n\n file ||= @resource[:path]\n\n return nil unless FileTest.exist?(file)\n\n if ! FileTest.file?(file)\n checktype = :mtime\n end\n method = checktype.to_s + \"_file\"\n\n self.fail(\"Invalid checksum type %s\" % checktype) unless respond_to?(method)\n\n return \"{%s}%s\" % [checktype, send(method, file)]\n end",
"def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end",
"def fetch(filename, filesize)\n end",
"def fetch_image(host,old_file,new_file)\n\t`rm #{old_file}` \n\t`mv #{new_file} #{old_file}`\t\n\topen('assets/images/radar/new.png', 'wb') do |file|\n\t\tfile << open('host').read\n\tend\n\tnew_file\nend",
"def file_exists? url\n if url.match(/^http/)\n localfile = remote_url_to_local url\n else\n localfile = url\n end\n remotefile = local_to_remote localfile\n begin\n localfile_size = File.size localfile\n remotefile_size = ftp.size remotefile\n # puts \"#{localfile}: #{localfile_size}\"\n # puts \"#{remotefile}: #{remotefile_size}\"\n if remotefile_size == localfile_size\n url\n else\n nil\n end\n rescue Exception=>ex\n # puts ex.message\n nil\n end\n end",
"def crc; end",
"def crc; end",
"def crc; end",
"def file_md5\n Digest::MD5.file(self).hexdigest\n end",
"def create_checksums\n # puts \"Ins: #{@basename}\"\n md5 = Digest::MD5.file(@fullname).to_s\n sha1 = Digest::SHA1.file(@fullname).to_s\n sha256 = Digest::SHA2.new(256).file(@fullname).to_s\n @pkgdb.query(\"insert into checksums values ( datetime('now'), '#{@basename}', '#{@suitename}', '#{@mtime.iso8601}', '#{md5}', '#{sha1}', '#{sha256}' )\")\n end",
"def load\n @checksum ||= ::File.exists?(checksum_file) ? ::File.read(checksum_file) : ''\n Chef::Log.debug(\"Loaded checksum for SMF #{self.name}: #{@checksum}\")\nend",
"def update_remote_file(file, node, copy, copied_files)\n return if should_filter?(file) ||\n local_manifest[file] ||\n copied_files[file]\n \n if copy[file]\n # If it's been copied, then we might need to do some work.\n update_copied_remote_file file, copy\n elsif ancestor.include? file\n # If the ancestor has the file, and the target has the file, and we don't,\n # then we'll probably have to do some merging to fix that up.\n update_remotely_modified_file file, node\n else\n # Just get the god damned file\n get file, remote.flags(file)\n end\n end",
"def remote_contents_of(file)\n contents_of(remote_branch(local_branch), file)\n end",
"def download_file(remote_file, local_file)\n begin\n @log.info(\"Download file #{remote_file} to #{local_file}\")\n @ssh_connect.download!(remote_file,local_file)\n rescue Exception => error\n @log.error(\"#{error}\")\n exit\n end\n end",
"def checksum\n self[:ip_sum]\n end",
"def checksum!# {{{\n self.csum = compute_checksum\n end",
"def write_to_remote_file(string, remote_path)\n #filename = \"/tmp/\" + Random.srand().to_s() + \".sh\"\n filename = \"/tmp/\" + Kernel::srand().to_s() + \".sh\"\n File.open(filename, 'w') {|f| f.write(string)}\n copy_to_remote(filename, remote_path)\n File.delete(filename)\n end",
"def fix!# {{{\n self.checksum!\n end",
"def digestmd5(file2md5)\n if not ::File.exists?(file2md5)\n raise \"File #{file2md5} does not exists!\"\n else\n require 'digest/md5'\n chksum = nil\n chksum = Digest::MD5.hexdigest(::File.open(file2md5, 'rb') { |f| f.read })\n return chksum\n end\n end",
"def download_remote_file(remote_object, local_filename)\n completed = false\n\n ##TODO NEED CHANGE IN WRITE LOGIC TO AVOID MEMORY ISSUES\n\n File.open(local_filename, 'wb') { |file| file.write(remote_object) }\n completed = true\n\n return completed\n end",
"def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end",
"def checksum(arg = nil)\n set_or_return(:checksum, arg, kind_of: [String])\n end",
"def save_checksum\n Chef::Log.debug(\"Saving checksum for SMF #{self.name}: #{self.checksum}\")\n ::FileUtils.mkdir_p(Chef::Config.checksum_path)\n f = ::File.new(checksum_file, 'w')\n f.write self.checksum\nend",
"def get_crc\n # We consider the file's modification time\n if (File.exists?(@URL))\n return File.mtime(@URL)\n else\n return 0\n end\n end"
] | [
"0.7390663",
"0.71819943",
"0.71662086",
"0.7003425",
"0.6743358",
"0.66393846",
"0.65767634",
"0.65725833",
"0.64794296",
"0.6461368",
"0.6458413",
"0.63545007",
"0.6349538",
"0.6300919",
"0.6276329",
"0.62643063",
"0.624396",
"0.6219757",
"0.6206501",
"0.6196784",
"0.6193036",
"0.61695105",
"0.61695105",
"0.61650014",
"0.6148882",
"0.61045146",
"0.6089932",
"0.6083928",
"0.60683393",
"0.6023106",
"0.6021152",
"0.5997248",
"0.5969242",
"0.59665304",
"0.59581333",
"0.5948856",
"0.5948728",
"0.59295756",
"0.59084564",
"0.59050584",
"0.59031004",
"0.58964425",
"0.587593",
"0.5856412",
"0.5834024",
"0.5832633",
"0.5821967",
"0.5801992",
"0.5798212",
"0.5795928",
"0.5795152",
"0.5787238",
"0.57624835",
"0.5762115",
"0.57598096",
"0.57576376",
"0.5738372",
"0.5736648",
"0.57183915",
"0.5711727",
"0.5707557",
"0.570549",
"0.5703898",
"0.57027155",
"0.569198",
"0.569198",
"0.5689605",
"0.56883603",
"0.56540245",
"0.564595",
"0.564587",
"0.5637316",
"0.5632094",
"0.56304276",
"0.5627888",
"0.56158227",
"0.56123775",
"0.5609425",
"0.56057864",
"0.55981654",
"0.55919176",
"0.5590222",
"0.5590222",
"0.5590222",
"0.5588762",
"0.5579428",
"0.5576998",
"0.55747783",
"0.5562565",
"0.55516714",
"0.5543061",
"0.5534941",
"0.55318856",
"0.55243534",
"0.55098253",
"0.55069524",
"0.5498921",
"0.54986554",
"0.5492871",
"0.5492055"
] | 0.6587466 | 6 |
this should be returning an array = ["",""] | def initialize(stops:)
@stops = stops.scan(/\b[\w\s\/]+/im)
convert_to_proper
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_a; []; end",
"def to_ary; []; end",
"def to_ary\n\t []\n\tend",
"def another; return []; end",
"def to_a; Array(force) end",
"def values\n []\n end",
"def to_a; [Array]; end",
"def to_ary\n nil\n end",
"def to_ary; nil; end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def to_ary\n nil\n end",
"def get_users_a\n\n return [] if self.users.nil? or self.users.empty?\n\n array = self.users.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def to_ary()\n return nil;\n end",
"def to_a\n\t\tarr = []\n\t\teach {|valor| arr << valor}\n\t\tarr\n\tend",
"def get_elements(array)\n\n elements = []\n if array != nil\n elements = array.to_a\n end\n return elements\n\nend",
"def airports_normal\n return Array.new\n end",
"def to_array\n array = []\n self.each { |x| array.push x }\n return array\n end",
"def airports_out_of_region\n return Array.new\n end",
"def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def to_a\n array\n end",
"def to_array\n @array ||= begin\n array = to_hash.kind_of?(Array) ? to_hash : [to_hash]\n array.compact\n end\n end",
"def missing_data\n only_missing.to_a\n end",
"def to_a\n return [] unless head\n head.to_a\n end",
"def to_a\n return [] unless head\n head.to_a\n end",
"def data_with_nils\n to_a\n end",
"def required_data() [] end",
"def to_a\n out = []\n\n each { |e| out << e }\n\n out\n end",
"def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend",
"def content_as_array\n begin\n # '[\"a\",\"b\", \"c\"]' -> '\"a\",\"b\",\"c\"'\n no_brackets = content[1...-1]\n\n # '\"a\",\"b\",\"c\"' -> ['\"a\"', '\"b\"', '\"c\"']\n quoted_elements = no_brackets.split(\", \")\n\n # ['\"a\"', '\"b\"', '\"c\"'] -> ['a', 'b', 'c']\n quoted_elements.map { |quoted_elt| quoted_elt[1...-1] }\n rescue\n []\n end\n end",
"def splits\n []\n end",
"def make_array\n @phrase_string.downcase.split(WORD_SPLIT).reject(&:empty?)\n end",
"def parse_fill(_)\n []\n end",
"def to_a\n a = []\n each { |item|\n a.push(item)\n }\n a\n end",
"def to_a\n Array(each)\n end",
"def to_a\n result = []\n self.each do |item|\n result << item\n end\n return result\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def keys\n return [], []\n end",
"def expecting; [] end",
"def array()\n\t\t@array\n\tend",
"def array_start\n []\n end",
"def to_array\n self.word.split(\"\")\n end",
"def activity_log_non_student_time_categories_array\n activity_log_non_student_time_categories.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def get_teams_a\n\n return [] if self.teams.nil? or self.teams.empty?\n\n array = self.teams.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def get_array\n\t\tsynchronize do\n\t\t\[email protected]_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend",
"def words\n []\n end",
"def _getarray\n if @document.nil?\n return @list\n else\n return @document.native_text\n end\n end",
"def to_a\n each.to_a\n end",
"def to_a\n each.to_a\n end",
"def to_a\n Array.new @row || nilified_row\n end",
"def aggregate\n []\n end",
"def to_a\n each.force\n end",
"def all\n []\n end",
"def fetch_csv_array(str) # instance method\n\n #remove whitespace\n str.gsub!(/\\s+/, \"\")\n return str.split(',')\n end",
"def list\n only.to_a\n end",
"def tags_array\n # http://stackoverflow.com/a/17641383/2080089\n return self.tags.split(',').uniq.map(&:strip)\n end",
"def string_to_array(str)\n return [] if str.blank?\n return str.split(\",\").each{|t| t.strip!} if str.class == String\n return []\n end",
"def to_a\n x = []\n self.each do |it|\n x << it\n end\n x\n end",
"def to_a\n a = []\n each {|subc| a << subc}\n a\n end",
"def college_application_choice_options_array\n return %w[Reach Solid Safety] if college_application_choice_options.blank?\n college_application_choice_options.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def to_a; [self] end",
"def to_a; [self] end",
"def\tcollect\n\t\ta = []\n\t\tself.each{|v| a << v}\n\t\ta\n\tend",
"def array\n raise \"Not implemented\"\n end",
"def get_empty_cells(cells)\r\n arr = []\r\n cells.each_with_index { |cell, i| arr << i if cell.nil? }\r\n arr\r\n end",
"def get_emails\n emails = [self.email1, self.email2, self.email3]\n emails.compact!\n emails.delete('')\n return emails\n end",
"def to_response\n []\n end",
"def to_a\n\t\t\tflat = []\n\t\t\t\n\t\t\tflatten_to_array(flat)\n\t\t\t\n\t\t\treturn flat\n\t\tend",
"def paperwork_status_options_array\n return [\"Not Started\", \"In Progress\", \"Complete\"] if paperwork_status_options.blank?\n paperwork_status_options.try(:split, \"\\n\").try(:collect, &:strip).to_a\n end",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def to_a\n self.to_s.split(' ', 6)\n end",
"def to_a; @list; end",
"def string_to_arr(str)\n arr = str.split(\" \")\n arr_f = []\n \n for a in arr\n if a != \"\"\n arr_f.push(a.strip)\n end\n end\n \n return arr_f\n end",
"def as_array(key)\n out = self[key]\n\n if out.blank?\n out = nil\n else\n out = out.split(/(?<!\\\\),/).collect { |val| val.gsub(/\\\\,/, ',').strip }\n end\n\n out\n end",
"def returnList\n\t\telements = []\n\t\tcurrent = @head\n\t\twhile current != nil\n\t\t\telements << current.value\n\t\t\tcurrent = current.nnode\n\t\tend\n\t\treturn elements\n\tend",
"def to_a\n [chosung, jungsung, jongsung]\n end",
"def to_ary\n\t\[email protected]\n\tend",
"def valid_result_sets\n Array.new\n end",
"def my_array\n return @my_hash.values\n \n end",
"def ameds\n self.meds.reject(&:empty?) rescue [] \nend",
"def to_a; [self]; end",
"def array\n @array\n end",
"def values\n @values ||= []\n end",
"def put_in_array(elem)\n array = []\n elem.each {|e| array << e.text}\n return array\nend",
"def create_an_array\n [\"a\", \"b\", \"c\", \"d\"]\nend",
"def resume_to_array(text)\n result = text\n result.gsub!(\",\",\"\")\n result.gsub!(\"(\",\"\")\n result.gsub!(\")\",\"\")\n result.gsub!(\"[\",\"\")\n result.gsub!(\"]\",\"\")\n result.downcase!\n return result.split\nend",
"def make_array\n [@name, @author, @deviation_url, @views, @favs, @comments]\n end",
"def returns_array?\n false\n end",
"def returns_array?\n false\n end",
"def record_to_array(r, attrs)\n []\n end",
"def to_a\n results = []\n traverse { |value| results << value }\n results\n end",
"def create_empty_array\n @outcome_array = Array.new(find_number_of_rows+1) { Array.new(find_number_of_columns+1) }\nend",
"def array\n @@array\n end",
"def tag_list; []; end",
"def values\n @values ||= []\n end",
"def get_triggers_a\n\n return [] if self.triggers.nil? or self.triggers.empty?\n\n array = self.triggers.split('|')\n array.compact!\n array.delete('')\n\n return array\n end"
] | [
"0.7512543",
"0.72874576",
"0.7178788",
"0.7026042",
"0.69259036",
"0.68895745",
"0.67083216",
"0.6645794",
"0.66211385",
"0.6596319",
"0.6596319",
"0.6596319",
"0.6596319",
"0.65525794",
"0.65525794",
"0.65525794",
"0.65525794",
"0.64691675",
"0.6448536",
"0.64323765",
"0.6402372",
"0.6364076",
"0.6347531",
"0.6325051",
"0.6314403",
"0.63076353",
"0.63005567",
"0.6265225",
"0.62576306",
"0.62576306",
"0.62321234",
"0.6230263",
"0.6226574",
"0.62249064",
"0.62084574",
"0.62058514",
"0.62001175",
"0.6151397",
"0.61397904",
"0.6130061",
"0.61257863",
"0.61064774",
"0.60906696",
"0.6090481",
"0.60902363",
"0.608481",
"0.60730165",
"0.60671693",
"0.6060108",
"0.605963",
"0.60563964",
"0.605308",
"0.60397315",
"0.60397315",
"0.6039558",
"0.60141414",
"0.6009454",
"0.6009304",
"0.60042995",
"0.5998607",
"0.59946245",
"0.59807944",
"0.596354",
"0.59467995",
"0.59331715",
"0.5924813",
"0.5924813",
"0.59179825",
"0.59156144",
"0.5914312",
"0.5910815",
"0.58944917",
"0.58874476",
"0.5880686",
"0.587966",
"0.5878457",
"0.5876227",
"0.58715045",
"0.58696425",
"0.58625394",
"0.5860679",
"0.5858008",
"0.58575827",
"0.5855381",
"0.58549535",
"0.58353835",
"0.5834466",
"0.58336484",
"0.5831376",
"0.5828592",
"0.5826594",
"0.58236617",
"0.58214694",
"0.58214694",
"0.58209264",
"0.58205885",
"0.58147377",
"0.58102304",
"0.5805297",
"0.57992655",
"0.57903767"
] | 0.0 | -1 |
Find The Duplicated Number in a Consecutive Unsorted List Level: 7kyu You are given an array of n+1 integers 1 through n. In addition there is a single duplicate integer. The array is unsorted. An example valid array would be [3, 2, 5, 1, 3, 4]. It has the integers 1 through 5 and 3 is duplicated. [1, 2, 4, 5, 5] would not be valid as it is missing 3. You should return the duplicate value as a single integer. | def find_dup(cadena)
cadena.detect{ |e| cadena.count(e) > 1 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_duplicate(array)\n numberCount = {}\n array.each do |element|\n if !numberCount[element]\n numberCount[element] = 1\n else \n return element\n end \n end \n -1\nend",
"def find_dup(array)\n # 17 - (1 + 2 + 3 + 4 + 5) = 2 --- total in this array minus total if there were no dupes\n array.reduce(&:+) - (1..(array.length - 1)).reduce(&:+)\nend",
"def find_dup(array)\n array.find { |num| num if array.count(num) > 1 }\nend",
"def find_dup(array_of_integers)\n array_of_integers.each do |integer|\n return integer if array_of_integers.count(integer) == 2\n end\nend",
"def find_dup(arr)\n sorted = arr.sort\n num_arr = sorted.select.with_index do |el, idx|\n current_el = sorted[idx]\n if current_el == sorted[idx + 1]\n current_el\n end\n end\n num_arr[0]\nend",
"def unique_number(arr)\n arr.uniq.find { |e| arr.count(e) == 1 }\nend",
"def get_non_duplicated(given_array)\n non_repeated_values=[\"\"]\n non_repeated_index=0\n outer_index=0\n given_array.each do |first_num|\n flag_for_a_duplicate=true\n inner_index=0\n given_array.each do |second_num|\n if (first_num == second_num) && (inner_index \\\n != outer_index)\n flag_for_a_duplicate=false \n end \n inner_index +=1\n end\n if flag_for_a_duplicate\n non_repeated_values[non_repeated_index]=first_num\n non_repeated_index +=1\n end\n outer_index +=1\n end\n non_repeated_values \nend",
"def find_dup(array)\n array.inject(Hash.new(0)) { |hash, item| hash[item] += 1; hash }.key(2)\nend",
"def find_dup(arr)\n arr.select { |num| arr.count(num) == 2 }.uniq.join.to_i\nend",
"def find_dup(arr)\n dup = nil\n single_num = []\n arr.each do |num|\n if single_num.include?(num)\n dup = num\n else\n single_num << num\n end\n end\n dup\nend",
"def find_duplicate(arr)\n\tarr.select{|e| arr.count(e) > 1}.uniq\nend",
"def find_dup_number(array)\n n = array.length - 1\n expected_sum = n*(n+1)/2\n actual_sum = array.reduce(:+)\n actual_sum - expected_sum\nend",
"def find_dup(array)\n array.each { |x| return x if array.count(x) == 2 }\nend",
"def find_dup(arr)\n arr.each do |item|\n item_count = arr.count(item)\n return item if item_count > 1\n end\nend",
"def find_first_dup(num_arr)\r\n set = []\r\n num_arr.each do |value|\r\n return value if set[value] #return value if it exists already in the set 'Array'\r\n set[value] = true \r\n end\r\n return -1 \r\nend",
"def find_dup(arr)\n arr.select { |i| arr.count(i) == 2 }.uniq.join.to_i\nend",
"def firstDuplicate(a)\n counters = Hash.new(0)\n \n a.each do |i|\n counters[i] = counters[i] += 1\n if counters[i] > 1\n i\n end\n end\n -1\nend",
"def non_duplicated_values(array)\n count = Hash.new(0)\n u_num = []\n array.each {|x| count[x] += 1}\n count.each do |k, v|\n if v == 1\n u_num.push(k)\n end\n end\n\n u_num\nend",
"def unique_number(arr)\n existing_numbers = []\n not_unique = []\n arr.each do |entry|\n if existing_numbers[entry] === nil\n existing_numbers[entry] = true\n else\n not_unique[entry] = true\n end\n end\n arr.each do |entry|\n if not_unique[entry] == nil\n return entry\n end\n end\nend",
"def duplicate_number(array)\n raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array\n raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) }\n\n array.detect{ |number| array.count(number) > 1 }\nend",
"def find_dup(array)\n for elem in array\n return elem if array.count(elem) == 2\n end\nend",
"def find_dup(arr)\n arr.reduce(0) { |acc, current| arr.count(current) == 2 ? current : acc }\nend",
"def first_duplicate(a)\n a.uniq.each do |i|\n return i if a.select {|j| i == j}.count > 1\n end\n nil\n end",
"def find_dup(array)\n array.sort.each_with_index do |obj, idx| \n return obj if obj == array.sort[idx + 1]\n end\nend",
"def duplicates(array)\n frequency = Hash.new(0)\n array.each do |element|\n frequency[element] += 1\n end\n frequency.each do |k, v|\n return k if v > 1\n end\nend",
"def num_duplicates\n count = 0\n nums = Hash.new(0)\n @array.each do |num|\n nums[num] += 1\n count += 1 if nums[num] > 1\n end\n count\nend",
"def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend",
"def find_dup(a) \n 0.upto(a.length - 1).each {|i|\n while a[i] != i + 1 && !a[i].nil?\n if a[a[i] - 1] == a[i]\n return a[i]\n end\n aux = a[i]\n a[i] = a[aux - 1]\n a[aux - 1] = aux \n end\n }\n a.inspect\nend",
"def find_duplication(ary)\n ct = Hash.new{|h, k| h[k] = 0}\n ary.each do |x|\n ct[x] += 1\n end\n return ct.select{|k, v| v > 1}.map{|k, v| k}\n end",
"def contain_duplicates(arr)\n\n if arr == nil?\n return false\n end\n\n\n hash = Hash.new(0) # counter hash\n\n arr.each do |i|\n\n if hash[i]\n hash[i] = hash[i] + 1\n else\n hash[i] = 1\n end\n if hash[i] > 1\n return true\n end\n end\n\n return false\nend",
"def find_duplicates(array)\n result_hash = {}\n result_array = []\n\n array.each do |num|\n if result_hash[num].nil?\n result_hash[num] = 1\n else\n result_hash[num] += 1\n end\n end\n\n result_hash.each do |k, v|\n result_array.push(k) if v > 1\n end\n\n result_array\nend",
"def find_dup(array)\n while array.size > 0\n el = array.shift\n array.each do |val|\n return el if val == el\n end\n end\nend",
"def min_unique(arr)\n arr.sort! #[1,2,2,3,7]\n uniq = []\n dups = []\n (arr.length ).times do |i|\n if arr[i] == arr[i+1]\n dups << arr[i]\n else \n uniq << arr[i]\n end \n end \n\n dups.each do |el|\n while uniq.include?(el)\n el+=1\n end \n uniq << el\n p uniq\n end \n p uniq.reduce(:+)\nend",
"def has_duplicate_value_linear(array)\n existing_numbers = []\n (array.length - 1).times do |i|\n if existing_numbers[array[i]] == nil\n existing_numbers[array[i]] = 1\n else\n return true\n end\n end\n false\nend",
"def find_dup(arr)\n arr.each{ | ele | return ele if arr.count(ele) == 2 }\nend",
"def dupe(array)\n n = array.length - 1\n sum = ((n * n) + n) / 2\n return array.reduce(&:+) - sum\n # array.each_with_object({}) { |i,o| o[i.to_s] ? o[i.to_s] += 1 : o[i.to_s] = 1 }.keep_if { |k,v| v > 1 }.to_a[0][0].to_i\nend",
"def find_dup(array)\n array.find { |element| array.count(element) == 2 }\nend",
"def find_dup(array)\n array.find { |element| array.count(element) == 2 }\nend",
"def find_dup(array)\n array.each_with_index do |el, idx|\n array.slice(idx+1..-1).each { |val| return el if el == val }\n end\nend",
"def find_duplicate(arr)\n # compare the last and next elements until they match\n dupe = arr.inject do |last, nxt|\n # return the match\n return last if last == nxt\n # otherwise return the next elem\n nxt\n end\nend",
"def find_duplicate(array)\n\n if array.detect{ |value| array.count(value) > 1 }\n # use of detect method will find item in array\n \tduplicate = array.detect{ |value| array.count(value) > 1 }\n p \"duplicate is: #{duplicate}\"\n return duplicate\n else\n # if no duplicates, indicate to the user\n p \"no duplicate\"\n end\nend",
"def dupe_indices(arr)\n idxs = Hash.new { |h, k| h[k] = [] }\n \n arr.each_with_index do |ele, i|\n idxs[ele] << i\n end\n\n return idxs.select { |ele, arr| arr.length > 1 }\nend",
"def duplicate(array)\n if array.uniq.length == array.length\n return \"array doesn't have any duplicates homey\"\n else\n arycpy = array\n while arycpy != nil do \n y = arycpy.pop\n if arycpy.include? y\n return y\n end\n end\n end\nend",
"def find_dup(arr)\n arr.find { |element| arr.count(element) == 2 }\nend",
"def no_dupes?(arr)\n solved = Hash.new(0)\n arr.each { |ele| solved[ele] += 1 }\n solved.keys.select { |ele| solved[ele] == 1 }\nend",
"def find_dup(array)\n array.find { |item| array.count(item) == 2 }\nend",
"def no_dupes?(arr)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n #can use the select method\n # hash.keys.select {|ele| hash[ele] == 1}\n new = []\n hash.each do |k, v|\n new << k if v == 1\n end\n new\n #another way to do it is sort and if there are adjacent pairs\n # we know that it is not a unique pair\nend",
"def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\nend",
"def no_dupes?(array)\n hash = Hash.new(0)\n array.each do |ele|\n hash[ele] += 1\n end\n new_array = []\n hash.each do |k, v|\n new_array << k if v == 1\n end\n return new_array\nend",
"def no_dupes?(arr)\n new_hash = Hash.new(0)\n new_arr = []\n\n arr.each do |x|\n new_hash[x] += 1\n end\n\n new_hash.each do |k,v|\n if v == 1\n new_arr << k\n end\n end\n new_arr\nend",
"def find_dup(list)\n seen = { 0 => true }\n dup = nil\n current = 0\n loop do\n current = list.reduce(current) do |sum, i|\n sum = sum + i.to_i\n return sum if seen[sum]\n seen[sum] = true\n sum\n end\n end\nend",
"def no_dupes?(arr)\n dupes = Hash.new(0)\n\n arr.each do |ele|\n dupes[ele] += 1\n end\n\n new_arr = []\n dupes.each do |k, v|\n if v == 1\n new_arr << k\n end\n end\n\n new_arr\nend",
"def no_dupes?(arr)\n counts = Hash.new(0)\n arr.each do |e|\n counts[e] += 1\n end\n counts.select {|k,v| v <= 1}.keys\nend",
"def no_dupes?(arr)\n counter = Hash.new(0)\n arr.each { |ele| counter[ele] +=1 }\n \n # new_array = []\n # counter.each do |k,v|\n # new_array << k if v == 1\n # end\n # new_array\n counter.keys.select { |el| counter[el] == 1 }\nend",
"def print_duplicates(array)\n size = array.size\n array.each do |element|\n element = element.abs # returns the absolute value\n if element < size # This would fail if we have an element in the array i.e. greater than size of array\n if array[element] > 0\n array[element] = -array[element] # Indicates first occurance\n else # Element at that pos already negative, indicates current element is duplicate.\n puts \"#{element} is repeated\" # printing the duplicate\n end\n else\n puts ArgumentError.new \"failed constraints for the array\"\n break\n end\n end\nend",
"def find_lonely_num(array_of_numbers)\n a = Hash.new(0)\n array_of_numbers.each do |elem|\n a[elem]+=1\n end\n a.key(1)\nend",
"def find_unique_elements(arr)\n arr_unique = []\n arr.each do |elem1|\n var1 = 0\n arr.each do |elem2|\n if elem1 == elem2\n var1 = var1 + 1\n end\n end\n if var1 <= 1\n arr_unique.push(elem1)\n end\n end\nend",
"def find_dup(array)\n checked_array = []\n array.each do |el|\n if checked_array.include?(el)\n return el\n else\n checked_array << el\n end\n end\nend",
"def remove_duplicates(nums)\n prev = nil\n count = 0\n nums.each do |num|\n if num == prev\n next\n else\n nums[count] = num\n prev = num\n count+=1\n end\n end\n\n return count\nend",
"def find_duplicate_in(array)\n return array.first if array.length == 1\n\n midpoint_index = array.length / 2\n midpoint = array[midpoint_index]\n previous = array[midpoint_index - 1]\n following = array[midpoint_index + 1]\n\n return midpoint unless midpoint == previous || midpoint == following\n\n if midpoint == previous\n ary1 = array[0, midpoint_index - 1 ]\n ary2 = array[midpoint_index + 1, array.length - 1]\n else\n ary1 = array[0, midpoint_index]\n ary2 = array[midpoint_index + 2, array.length - 1]\n end\n ary = ary1.length.odd? ? ary1 : ary2\n find_duplicate_in(ary)\nend",
"def no_dupes?(arr)\n counter_hash = Hash.new(0)\n arr.each { |ele| counter_hash[ele] += 1 }\n counter_hash.select { |key, val| val == 1 }.keys\n #counter_hash.keys.select { |blah| counter_hash[blah] == 1 }\nend",
"def solution(a)\n # In production environment this will be my solution:\n # a.uniq.size\n #\n # But since this is a coding challenge, my assumption\n # is that you're looking for a by-hand O(N*logN) solution\n\n return 0 if a.empty?\n\n n = a.size\n ary = a.sort\n uniques = 1\n (1...n).each do |i|\n uniques += 1 if ary[i] != ary[i - 1]\n end\n uniques\nend",
"def single_number(nums)\n nums.sort.uniq.each do |i|\n if appears_three?(nums.sort, i)\n return i\n end\nend\nreturn -1\nend",
"def find_duplicates(a)\n len=a.length\n n=len-2\n xor= 0\n x,y=0,0 #variables to store duplicates\n \n #xor of all numbers from 1 to n\n for i in 1..n \n xor^=i\n end\n #xor of all array elements\n for i in 0...len \n xor^=a[i]\n end\n #Rightmost set bit\n set_bit_pos= xor & ~(xor-1)\n #Divinding array in two sets ,one with set bit at set_bit_pos and other with 0.\n for i in 0...len\n if (a[i] & set_bit_pos == 0)\n x^=a[i] # XOR of first-set(with 0 at set_bit_pos) in array\n else\n y^=a[i] # XOR of second-set(with 1 at set_bit_pos) in array\n end\n end\n \n for i in 0..n\n if (i & set_bit_pos == 0)\n x^=i # XOR of first-set(with 0 at set_bit_pos) in range\n else\n y^=i # XOR of second-set(with 1 at set_bit_pos) in range\n end\n end\n print \"#{x} #{y}\"\n\treturn\nend",
"def remove_duplicates(nums)\n counter = 0 # Establish a counter variable to keep track of the amount of duplicates\n original_length = nums.length # Hold a reference to the original length of the array because the array without duplicates will have less elements\n\n (1...nums.length).each do |i| # Iterate through the elements; there's no need to go to the end, where we'd end up with nil values since the value of the length of the array is going to hold an index out of bounds\n if nums[i-1] == nums[i] # Check to see if the element behind the current element and the current element are equivalent/duplicates\n counter += 1 # We only need to increment the counter because we've found a duplicate; nothing more and nothing less\n else\n nums[i-counter] = nums[i] # If two numbers are different from each other, push the current element as far back as the position of the last duplicated element; the streak of duplicates has ended and we've found a solo element; remember the arrays are sorted\n end\n end\n\n return original_length - counter # Return the new length by subtracting the amount of duplicates the array contained from the original_length\nend",
"def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |el| count[el] += 1 }\n count.keys.select { |el| count[el] == 1 }\nend",
"def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend",
"def find_singleton(array)\n array.each_with_index do |element, index|\n if element != array[index - 1] and element != array[index + 1]\n return element\n end \n end\n -1\nend",
"def repeatedNumber(a)\n new_arr = Array.new(a.length, false)\n result = []\n (0...a.length).each do |i|\n result << a[i] if new_arr[a[i] - 1] == true \n new_arr[a[i] - 1] = true \n end\n false_idx = new_arr.index(false)\n (false_idx...a.size).each do |i|\n result << i+1 if new_arr[i] == false\n end\n result\nend",
"def no_dupes?(arr)\n count_hash = Hash.new(0)\n non_dupes = []\n\n arr.each { |ele| count_hash[ele] += 1 }\n\n count_hash.each do |key, val|\n non_dupes << key if val == 1\n end\n\n non_dupes\nend",
"def find_unique_elements(arr)\n\tcounts = Hash.new 0\n\tarr.each do |ele|\n\t\tcounts[ele] += 1\n\tend\n\t\n\tcounts.delete_if {|key, value| value > 1 }\n\tresult = counts.keys #Array returned with keys for non-dupe values\n\treturn result\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def no_dupes?(arr)\n count = Hash.new(0)\n\n arr.each { |ele| count[ele] += 1 }\n\n array = []\n count.each { |k, v| array << k if v == 1 }\n\n array\nend",
"def find_it(seq)\n hash = Hash.new(0)\n seq.each do |num|\n hash[num] += 1\n end\n\n hash.each do |num, no_of_occurence|\n return num if no_of_occurence.odd?\n end\nend",
"def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend",
"def remove_dup(given_array, duplicate_count)\r\n counter = 0\r\n new_array = []\r\n hold_info = {}\r\n until counter >= given_array.length \r\n if hold_info[given_array[counter]].nil?\r\n hold_info[given_array[counter]] = 1 \r\n else\r\n hold_info[given_array[counter]] += 1\r\n end\r\n counter += 1\r\n end\r\n duplicates_array = hold_info.select{ |key, value| value == duplicate_count}\r\n new_array = given_array.clone\r\n duplicates_array.each {|key,value| new_array.delete(key)} # delete all the duplicate numbers from the array\r\n p new_array.sort\r\nend",
"def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend",
"def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend",
"def num_unique2(arr)\n count = 0\n new_number = nil\n arr.each do |number|\n if new_number != number\n new_number = number\n count += 1\n end\n end\n return count\n end",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend",
"def solution(array)\n result = Array.new(array.length, 0)\n\n array.each do |element|\n if result[element - 1]\n result[element - 1] += 1\n else\n result[element - 1] = 1\n end\n end\n\n result.uniq.size == 1 ? 1 : 0\nend",
"def numUnique list\n if list.length == 0\n return \"**0**\"\n end\n counter = Hash.new\n counter[list[0]] = 1\n\n list.each do |num|\n number_exists = false\n counter.each do |key, count|\n if num == key\n count += 1\n number_exists = true\n end\n end\n\n if !number_exists\n counter[num] = 1\n end\n\n end\n\n puts \"counter #{counter}\"\n unique_nums = []\n\n counter.each do |key, value|\n unique_nums << key\n end\n\n return \"**#{unique_nums.length}**\"\n\nend",
"def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend",
"def find_the_missing_numbers(arr)\n missing_num = arr.flat_map {|a| [a-1, a+1]}.uniq\n diff = (missing_num - arr).select {|a| a >= 1}\nend",
"def sorted(array) \n a = array.sort_by { |x| x}\n missing_value = 0 \n a.each { |x| \n missing_value = missing_value + 1 \n if missing_value != x \n return missing_value \n end \n }\n \n end",
"def contains_duplicate(nums)\n tmp_arr = nums.uniq\n result = \n tmp_arr.map do |i|\n nums.select { |j| i == j }.size > 1\n end\n return result.any?\nend",
"def first_non_consecutive(arr)\n full_arr = arr[0]..arr[-1]\n\n full_arr.each { |num|\n if !arr.include?(num)\n return num + 1\n end\n }\n nil\nend",
"def no_dupes?(arr)\n arr.reject do |ele|\n # debugger\n arr.count(ele) > 1\n end\nend",
"def missing_integer(a)\n a.sort!\n a.select!{|i| i > 0}\n\n return 1 if a.length == 0 || a[0] > 1\n\n\n (0..(a.length - 2)).each do |i|\n return (a[i] + 1) if a[i+1] - a[i] > 1\n end\n return a[-1] + 1\nend",
"def num_occur(array, target)\n return 0 if array == []\n #every element appears zero times\n dup_array = array.dup\n value = dup_array.shift\n #previous\n if value == target\n count = num_occur(dup_array, target) + 1 #return previous, add one\n else\n count = num_occur(dup_array, target) #return previous value\n end\n count #ensures count is used for prior calls\n\nend",
"def remove_duplicates(nums)\n return 0 if nums.empty?\n cur = nums.first\n primary = 1\n nums.each_with_index do |num, _idx|\n next if num == cur\n nums[primary] = num\n cur = num\n primary += 1\n end\n primary\nend",
"def remove_duplicates(nums)\n size, cursor = 0, 0\n while cursor < nums.size # iterating through each number in nums starting from the first number at index 0.\n num = nums[cursor] # as I iterate through each number, I will assign it to a variable called \"num\", i.e \"num\" will be constantly rewritten to the value that I am currently at as I iterate through the numbers.\n cursor += 1 # so that I can iterate.\n while nums[cursor] == num # if the duplicates are next to each other\n cursor += 1 # I iterate to the next number.\n end\n nums[size] = num # use num(which exclude the duplicates) again and assign it to nums[size] (which is the actual number). this step is just a checker so that the next step (size += 1) will be accurate, it is not actually removing the duplicates inline, i.e return nums will not give you the array without duplicates.\n size += 1 # After filtering out the duplicates, increase the counter by 1 every time we move on to another number.\n end\n return size\nend",
"def contains_duplicate(nums)\n nums.length.times do |i|\n (0..i - 1).each do |j|\n return true if nums[j] == nums[i]\n end\n end\n\n false\nend",
"def find_it(seq)\n integer_occurences = seq.each_with_object(Hash.new(0)) do | int, hash |\n hash[int] += 1\n end\n integer_occurences.select {| int, occured | occured.odd? }.keys[0]\nend",
"def find_most_frequent_integer(arr)\n new_array=[]\n final_array=[]\n if arr.uniq.length==0\n return nil\n else\n array_to_use=arr.uniq\n array_to_use.each do |x| \n new_array << [arr.count(x), x]\n final_array=new_array.sort\n end\n end\n count_array=[]\n final_array.each do |x|\n count_array << x.reverse\n end\n just_count_array=[]\n count_array.each do |x|\n just_count_array << x.pop\n end\n z=just_count_array[-1]\n res=just_count_array[0..-2].include?(z)\n if res==false\n return final_array[-1][1]\n end\nend",
"def no_consecutive_repeats?(arr)\n no_repeats = true\n arr.each_with_index do |ele,idx|\n if idx <= arr.length - 2\n if arr[idx] == arr[idx+1]\n no_repeats = false\n end\n end\n end\n no_repeats\nend",
"def duplicates(arr)\n values = Set.new\n copies = Set.new\n\n arr.each do |value|\n if values.include?(value)\n copies << value\n else\n values << value\n end\n end\n\n return copies\nend",
"def missing(array)\n result = []\n num = array.first + 1\n loop do\n result << num if !array.include?(num)\n num += 1\n break if num == array.last\n end\n result\nend",
"def remove_duplicates(nums)\n \n return nums.length if nums.length <= 2\n prevNum = nums[0]\n i = 1\n arrLength = 1\n dupCount = 1\n while i<nums.length do\n if nums[i] == prevNum && dupCount < 2\n dupCount = dupCount + 1\n arrLength = arrLength + 1\n elsif nums[i] != prevNum\n prevNum = nums[i]\n dupCount = 1\n arrLength = arrLength + 1\n end\n i = i + 1\n end\n \n puts(arrLength)\n \nend",
"def no_consecutive_repeats?(arr)\n arr.each_with_index do |ele,idx|\n if arr[idx+1] == ele\n return false\n end\n end\n true\nend"
] | [
"0.8070596",
"0.78280866",
"0.7688708",
"0.7678541",
"0.7650415",
"0.7647557",
"0.75819117",
"0.75796926",
"0.751927",
"0.7453325",
"0.74399203",
"0.7439353",
"0.73611224",
"0.73603886",
"0.7339873",
"0.73398083",
"0.7294938",
"0.72672004",
"0.7266288",
"0.724468",
"0.7236456",
"0.72229284",
"0.721953",
"0.7212466",
"0.7202799",
"0.71959484",
"0.7171401",
"0.71701896",
"0.7154144",
"0.7144274",
"0.7130877",
"0.71241474",
"0.7119898",
"0.71110094",
"0.70738626",
"0.70603603",
"0.7044541",
"0.7044541",
"0.7030851",
"0.7030061",
"0.7020088",
"0.7004738",
"0.700036",
"0.69955814",
"0.6994848",
"0.69669557",
"0.69612366",
"0.69516844",
"0.69344664",
"0.69257027",
"0.6912256",
"0.6902334",
"0.6855348",
"0.68201274",
"0.6801989",
"0.68019605",
"0.6791607",
"0.6787908",
"0.67833847",
"0.67809224",
"0.67803127",
"0.6773234",
"0.6765167",
"0.67628914",
"0.6745392",
"0.67133886",
"0.6710729",
"0.66998506",
"0.6698154",
"0.66937774",
"0.66824514",
"0.66736394",
"0.66648704",
"0.6655441",
"0.6641792",
"0.664133",
"0.6635129",
"0.66303223",
"0.6611177",
"0.66056806",
"0.6603325",
"0.6602605",
"0.6602225",
"0.6597274",
"0.65967464",
"0.65766144",
"0.65723985",
"0.6568673",
"0.6567956",
"0.6562824",
"0.65513396",
"0.65384865",
"0.6537327",
"0.65340024",
"0.6528216",
"0.6525139",
"0.6519727",
"0.6505483",
"0.65021163",
"0.64980835",
"0.6492352"
] | 0.0 | -1 |
TODO : We can calculcate lat , long at the time of registration so we will not need a saprate zipcoe model and an "additional query". | def profile_photo_url(version)
if self.photos.profile_photo.blank?
"#{version.to_s}_avtar.jpg"
else
self.photos.profile_photo.first.name_url(version)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geo; end",
"def get_by_lat_lng\n\tend",
"def meshcode2_coordinate(gps_info)\n grid_square_code = gps_info.to_s\n \n # calc from 1st grid square code\n lat = grid_square_code[0..1].to_f / 1.5; lon = grid_square_code[2..3].to_f + 100\n\n # calc from 2nd grid square code\n latcode = grid_square_code[4].to_f; loncode = grid_square_code[5].to_f\n lat += latcode * 5 / 60; lon += loncode * 7.5 / 60\n\n # calc from 3rd grid square code \n latcode = grid_square_code[6].to_f; loncode = grid_square_code[7].to_f\n lat += latcode * 0.5 / 60; lon += loncode * 0.75 / 60\n\n # calc from 4th grid square code \n num = grid_square_code[8].to_f - 1; latcode = (num / 2).to_i\n loncode = (num - latcode * 2).to_f; \n lat += latcode * 0.5 / 2 / 60; lon += loncode * 0.75 / 2 / 60\n\n # calc from 5th grid square code \n num = grid_square_code[9].to_f - 1\n latcode = (num / 2).to_i; loncode = (num - latcode * 2).to_f\n lat += latcode * 0.5 / 4 / 60; lon += loncode * 0.75 / 4 / 60\n\n # calc from 6th grid square code \n num = grid_square_code[10].to_f - 1\n latcode = (num / 2).to_i; loncode = (num - latcode * 2).to_f\n lat += latcode * 0.5 / 8 / 60; lon += loncode * 0.75 / 8 / 60\n\n mlat = 0.5 / 8; mlon = 0.75 / 8\n \n # left-down lat/ lon\n lat0 = lat; lon0 = lon\n # right-up lat/ lon\n lat1 = lat0 + mlat / 60; lon1 = lon0 + mlon / 60\n \n return lon0, lat0, lon1, lat1\n end",
"def find_lat_long(sites)\n sites.each do |site|\n if site.zip\n location_input = site.zip\n elsif site.state\n location_input = \"#{site.city}, #{site.state}\"\n else\n location_input = \"#{site.city}, #{site.country}\"\n end\n coordinates = Geocoder::Calculations.extract_coordinates(location_input)\n site.latitude = coordinates[0]\n site.longitude = coordinates[1]\n site.save\n end\nend",
"def geodatos\n end",
"def transform_data\n latitude = self.latitude\n longitude = self.longitude\n tempLat = latitude/100\n floatLat = (latitude - (tempLat.to_i * 100))/60\n lat = tempLat.to_i + floatLat\n tempLng = longitude/100\n floatLng = (longitude - (tempLng.to_i * 100))/60\n lng = tempLng.to_i + floatLng\n self.latitude = lat \n self.longitude = lng \nend",
"def getStationNearest\n coordinate_lat = params[:lattitude].to_f\n coordinate_lng = params[:longtitude].to_f\n distance_input = params[:distance].to_f\n end",
"def geolocate\n \"#{self.address}\"', '\"#{self.state}\"', '\"#{self.zipcode}\"\n end",
"def construct_coordinates\n construct_latitude\n construct_longitude\n end",
"def coordquery(p)\r\nend",
"def latitude; end",
"def show\n\n #form comments\n @comment = @store.comments.build \n\n @comments = @store.comments.includes(:user).all.reverse\n\n #offers\n @offer = @store.offers.build\n @offers = @store.offers.includes(:store).all.reverse \n\n #mapa\n result = request.location\n \n\n #gmap4rails\n @stores = Store.near([@store.latitude, @store.longitude], 5)\n @hash = Gmaps4rails.build_markers(@stores) do |stores, marker|\n marker.lat stores.latitude\n marker.lng stores.longitude\n end\n\n end",
"def snpi\n if latlonra[:latitude]\n #Creates new location to be matched\n @location = Location.new({:latitude => latlonra[:latitude], :longitude => latlonra[:longitude], :name => '', :description => ''})\n #Runs Get SNPI from models/location.rb\n @locations = Location.get_snpi(@location,Location.all, latlonra[:radius])\n #Uses orinila parameter for @Locations_json\n @locations_json = @locations.to_json\n end\n end",
"def latitude\n end",
"def nearby_stops\n \tstops = Stop.near([params[:latitude],params[:longitude]],10, :order => \"distance\").limit(6)\n google_results = UserLocation.search(params[:latitude],params[:longitude])\n geocoder_ca_results = UserLocation.geocoder_ca(params[:latitude],params[:longitude]).intersection\n user_location=UserLocation.new(\n :user_id => current_user.id,\n :longitude => params[:longitude],\n :latitude => params[:latitude],\n :address => google_results.address,\n :city => google_results.city,\n :neighborhood => google_results.neighborhood,\n :main_intersection => \"#{geocoder_ca_results[\"street1\"]} & #{geocoder_ca_results[\"street2\"]}\"\n )\n user_location.save\n if stops.empty?\n render json: stops, status: 422\n else\n \t render json: stops\n end\n end",
"def location\n b = []\n b << latitude\n b << longitude\n Geocoder.coordinates(b)\n end",
"def index\n # 6.215725, -75.596976 LEJOS \n # 6.209475, -75.571580 CERCA\n location = [params[:latitude], params[:longitude]]\n\n # if request && request.location\n # user_location = request.location\n # location = [user_location.latitude, user_location.longitude]\n # else\n # flash[:notice] = \"No se pudo determinar su ubicación actual...\"\n # end\n # flash\n # @parking_garages = ParkingGarage.all\n @parking_garages = ParkingGarage.near(location, 1, :units => :km)\n # @hash = Gmaps4rails.build_markers(@users) do |user, marker|\n # marker.lat user.latitude\n # marker.lng user.longitude\n # end\n \n # if params[:search].present?\n # @locations = Location.near(params[:search], 50, :order => :distance)\n # else\n # @locations = Location.all\n # end\n end",
"def get_location(zip)\n location = Weatherman::Client.new(:unit =>'f')\n location.lookup_by_location(zip)\nend",
"def user_location(user)\n geo = user.geolocation\n geo.latitude = 32.7157\n geo.longitude = -117.1611\n geo.fetch_address\n geo.save\n end",
"def location_args\n return { id: @city_id } if @city_id\n return { q: @query } if @query\n return { zip: @zip_code } if @zip_code\n return { lat: @latitude, lon: @longitude } if @latitude && @longitude\n end",
"def whereAmI\n \n lat = params[:latitud]\n long = params[:longitud]\n \n @donde = Geocoder.search(lat + \",\" + long)[0]\n \n render :json => {:direccion => @donde.address }\n \n end",
"def location_detail\n query = params[:address]\n Geocoder::Configuration.timeout = 10000\n @dest_location = Geocoder.search(query).first\n logger.info\"<====================#{@dest_location.inspect}=============#{@dest_location.formatted_address}============>\"\n logger.info\"<=========latitude===========#{@dest_location.latitude}=========================>\"\n logger.info\"<=========longitude===========#{@dest_location.longitude}=========================>\"\n set_source_and_dest_points(params[:curr_lat],params[:curr_long],@dest_location.latitude,@dest_location.longitude)\n geteta\n unless @error\n @location_detail = current_dispatcher.location_details.create(\n source_lat:params[:curr_lat],\n source_long:params[:curr_long],\n dest_lat:@dest_location.latitude,\n dest_long:@dest_location.longitude,\n eta:@eta,\n curr_lat:params[:curr_lat],\n curr_long:params[:curr_long],\n current_eta:@eta,\n curr_mile:@curr_mile,\n destination_address: @dest_location.formatted_address\n )\n end\n end",
"def add_lat_longt\n users = User.find(:all)\n for user in users\n if !user.city.blank? && !user.country_id.blank?\n address = Country.get_alt_longt(user.city,user.country_id)\n if address != nil\n user.update_attributes(:lat => address.latitude, :longt => address.longitude)\n end\n end\n end \n end",
"def geocoding_api_lookup\n location = self.address\n\n #result = Geocoder.search(location).first\n args = {postalcode: postcode, city: city, county: county, country: country, format: 'json'}\n result = nominatim_lookup(args)\n if result\n self.latitude = result[:lat]\n self.longitude = result[:lon]\n begin\n redis = Redis.new\n redis.set(location, [self.latitude, self.longitude].to_json)\n rescue Redis::RuntimeError => e\n raise e unless Rails.env.production?\n puts \"Redis error: #{e.message}\"\n end\n else\n self.update_column(:nominatim_count, self.nominatim_count + 1)\n end\n end",
"def get_location_info(zip)\n url_string = \"https://offer-demo.adcrws.com/v1/geolocation.json?access_token=#{ENV['ACCESS_DEVELOPMENT_TOKEN']}&search=#{zip}\"\n url_response = UrlRequest.send_request(url_string)\n json_data = JsonParser.decode(url_response)\n @lat = json_data['location'][0]['geometry']['location']['lat']\n @lon = json_data['location'][0]['geometry']['location']['lng']\n @city = json_data['location'][0]['formatted_address'].split(\",\").first\n end",
"def explore\n @center = Geocoder.coordinates(params[:city])\n @trips = Trip.nearest_with_index(@center) \n end",
"def lat_f\n lat.to_f\n end",
"def longitude\n end",
"def longitude; end",
"def to_WGS84\n\n\t if @type == :ie\n\t @a = 6377340.189\n\t @b = 6356034.447\n else\n @a = 6377563.396\n @b = 6356256.909\n end\n\n @eSquared = ((@a * @a) - (@b * @b)) / (@a * @a)\n\n @phi = deg_to_rad(@latitude)\n @lambda = deg_to_rad(@longitude)\n @v = @a / (Math.sqrt(1 - @eSquared * sin_pow_2(@phi)))\n @H = 0\n @x = (@v + @H) * Math.cos(@phi) * Math.cos(@lambda)\n @y = (@v + @H) * Math.cos(@phi) * Math.sin(@lambda)\n @z = ((1 - @eSquared) * @v + @H) * Math.sin(@phi)\n\n @tx = 446.448\n @ty = -124.157\n @tz = 542.060\n\n @s = -0.0000204894\n @rx = deg_to_rad( 0.00004172222)\n @ry = deg_to_rad( 0.00006861111)\n @rz = deg_to_rad( 0.00023391666)\n\n @xB = @tx + (@x * (1 + @s)) + (-@rx * @y) + (@ry * @z)\n @yB = @ty + (@rz * @x) + (@y * (1 + @s)) + (-@rx * @z)\n @zB = @tz + (-@ry * @x) + (@rx * @y) + (@z * (1 + @s))\n\n @a = 6378137.000\n @b = 6356752.3141\n @eSquared = ((@a * @a) - (@b * @b)) / (@a * @a)\n\n @lambdaB = rad_to_deg(Math.atan(@yB / @xB))\n @p = Math.sqrt((@xB * @xB) + (@yB * @yB))\n @phiN = Math.atan(@zB / (@p * (1 - @eSquared)))\n\n (1..10).each do |i|\n @v = @a / (Math.sqrt(1 - @eSquared * sin_pow_2(@phiN)))\n @phiN1 = Math.atan((@zB + (@eSquared * @v * Math.sin(@phiN))) / @p)\n @phiN = @phiN1\n end\n\n @phiB = rad_to_deg(@phiN)\n\n { :latitude => @phiB, :longitude => @lambdaB }\n\n end",
"def to_latlng(easting, northing, type = :gb)\n\n \t if type == :ie\n @OSGB_F0 = 1.000035\n @N0 = 250000.0\n @E0 = 200000.0\n @phi0 = deg_to_rad(53.5)\n @lambda0 = deg_to_rad(-8.0)\n @a = 6377340.189\n @b = 6356034.447\n else\n @OSGB_F0 = 0.9996012717\n @N0 = -100000.0\n @E0 = 400000.0\n @phi0 = deg_to_rad(49.0)\n @lambda0 = deg_to_rad(-2.0)\n @a = 6377563.396\n @b = 6356256.909\n end\n\n @eSquared = ((@a * @a) - (@b * @b)) / (@a * @a)\n @phi = 0.0\n @lambda = 0.0\n @E = easting\n @N = northing\n @n = (@a - @b) / (@a + @b)\n @M = 0.0\n @phiPrime = ((@N - @N0) / (@a * @OSGB_F0)) + @phi0\n\n \t begin\n\n \t @M =\n \t (@b * @OSGB_F0)\\\n \t * (((1 + @n + ((5.0 / 4.0) * @n * @n) + ((5.0 / 4.0) * @n * @n * @n))\\\n \t * (@phiPrime - @phi0))\\\n \t - (((3 * @n) + (3 * @n * @n) + ((21.0 / 8.0) * @n * @n * @n))\\\n \t * Math.sin(@phiPrime - @phi0)\\\n \t * Math.cos(@phiPrime + @phi0))\\\n \t + ((((15.0 / 8.0) * @n * @n) + ((15.0 / 8.0) * @n * @n * @n))\\\n \t * Math.sin(2.0 * (@phiPrime - @phi0))\\\n \t * Math.cos(2.0 * (@phiPrime + @phi0)))\\\n \t - (((35.0 / 24.0) * @n * @n * @n)\\\n \t * Math.sin(3.0 * (@phiPrime - @phi0))\\\n \t * Math.cos(3.0 * (@phiPrime + @phi0))))\n\n \t @phiPrime += (@N - @N0 - @M) / (@a * @OSGB_F0)\n\n \t end while ((@N - @N0 - @M) >= 0.001)\n\n \t @v = @a * @OSGB_F0 * ((1.0 - @eSquared * sin_pow_2(@phiPrime)) ** -0.5)\n \t @rho =\n \t @a\\\n \t * @OSGB_F0\\\n \t * (1.0 - @eSquared)\\\n \t * ((1.0 - @eSquared * sin_pow_2(@phiPrime)) ** -1.5)\n \t @etaSquared = (@v / @rho) - 1.0\n \t @VII = Math.tan(@phiPrime) / (2 * @rho * @v)\n \t @VIII =\n \t (Math.tan(@phiPrime) / (24.0 * @rho * (@v ** 3.0)))\\\n \t * (5.0\\\n \t + (3.0 * tan_pow_2(@phiPrime))\\\n \t + @etaSquared\\\n \t - (9.0 * tan_pow_2(@phiPrime) * @etaSquared))\n \t @IX =\n \t (Math.tan(@phiPrime) / (720.0 * @rho * (@v ** 5.0)))\\\n \t * (61.0\\\n \t + (90.0 * tan_pow_2(@phiPrime))\\\n \t + (45.0 * tan_pow_2(@phiPrime) * tan_pow_2(@phiPrime)))\n \t @X = sec(@phiPrime) / @v\n \t @XI =\n \t (sec(@phiPrime) / (6.0 * @v * @v * @v))\\\n \t * ((@v / @rho) + (2 * tan_pow_2(@phiPrime)))\n \t @XII =\n \t (sec(@phiPrime) / (120.0 * (@v ** 5.0)))\\\n \t * (5.0\\\n \t + (28.0 * tan_pow_2(@phiPrime))\\\n \t + (24.0 * tan_pow_2(@phiPrime) * tan_pow_2(@phiPrime)))\n \t @XIIA =\n \t (sec(@phiPrime) / (5040.0 * (@v ** 7.0)))\\\n \t * (61.0\\\n \t + (662.0 * tan_pow_2(@phiPrime))\\\n \t + (1320.0 * tan_pow_2(@phiPrime) * tan_pow_2(@phiPrime))\\\n \t + (720.0\\\n \t * tan_pow_2(@phiPrime)\\\n \t * tan_pow_2(@phiPrime)\\\n \t * tan_pow_2(@phiPrime)))\n \t @phi =\n \t @phiPrime\\\n \t - (@VII * ((@E - @E0) ** 2.0))\\\n \t + (@VIII * ((@E - @E0) ** 4.0))\\\n \t - (@IX * ((@E - @E0) ** 6.0))\n \t @lambda =\n \t @lambda0\\\n \t + (@X * (@E - @E0))\\\n \t - (@XI * ((@E - @E0) ** 3.0))\\\n \t + (@XII * ((@E - @E0) ** 5.0))\\\n \t - (@XIIA * ((@E - @E0) ** 7.0))\n\n \t { :latitude => rad_to_deg(@phi), :longitude => rad_to_deg(@lambda) }\n\n \t end",
"def index\n\n @lat_lons = LatLon.where(nil)\n\n if params[:search].present?\n @lat_lons = @lat_lons.search(params[:search])\n\n elsif params[:radius].present?\n\n if params[:current_location].present?\n @coords = [params[:geolat].to_f, params[:geolon].to_f]\n elsif params[:location].present?\n @coords = Geocoder.coordinates(params[:location])\n end\n\n if !(@coords)\n @coords = [0, 0]\n end\n\n @lat_lons = @lat_lons.within(params[:radius], :origin => @coords)\n\n case params[:search_type]\n when \"cheapest\"\n @lat_lons = @lat_lons.order_by_cheapest.by_distance(:origin => @coords)\n when \"closest\"\n @lat_lons = @lat_lons.by_distance(:origin => @coords)\n when \"optimal\"\n @lat_lons = @lat_lons.sort_by{ |l| l.distance_to(@coords)*params[:price].to_f + l.parking_meter.price}\n end\n elsif params[:recents].present? || !session[:user_id].nil?\n recent_names = User.find(session[:user_id]).get_recents\n arr = Array.new\n recent_names.each { |n| arr = arr + @lat_lons.search(n)}\n @lat_lons = arr\n else\n @lat_lons = LatLon.none\n end\n\n @lat_lons = @lat_lons.no_broken if params[:no_broken].present?\n @lat_lons = @lat_lons.no_occupied if params[:no_occupied].present?\n @lat_lons = @lat_lons.no_after_hours if params[:no_after_hours].present?\n\n @hash = Gmaps4rails.build_markers(@lat_lons) do |lat_lon, marker|\n marker.lat lat_lon.lat\n marker.lng lat_lon.lon\n meter = lat_lon.parking_meter\n\n color = \"18bc9c\"\n if meter.is_broken\n color = \"e74c3c\"\n elsif meter.is_occupied\n color = \"3498db\"\n end\n marker.picture({\n :url => \"http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|\" + color + \"|000000\", \n :width => 32,\n :height => 32\n })\n marker.json({ :meter_id => meter.id, :meter_name => meter.name })\n end\n\n end",
"def geoAddress\n\n self.address + \",\" +self.region.name\n\n end",
"def geo(zipRow)\n\t\t\tlong = zipRow[6].to_f\n\t\t\tlat = zipRow[5].to_f\n\t\treturn lat, long\n\tend",
"def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}\" \n #near_query = \"gl=UK\"\n end\n \n response = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"#{GEOCODER_QUERY_STRING}#{CGI.escape(query)}&#{near_query}\")\n end\n\n results = JSON.parse(response.body)['Placemark']\n \n unless results.nil? || results.empty?\n results.map do |result|\n if result['AddressDetails'] && result['AddressDetails']['Accuracy'].to_i >= 0\n p = { :name => result['address'] }\n\n p[:address] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['Thoroughfare']['ThoroughfareName'] rescue nil\n p[:city] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['LocalityName'] rescue nil\n p[:region] = result['AddressDetails']['Country']['AdministrativeArea']['AdministrativeAreaName'] rescue nil\n p[:country] = result['AddressDetails']['Country']['CountryNameCode'] rescue nil\n p[:postal_code] = result['AddressDetails']['Country']['AdministrativeArea']['Locality']['PostalCode'] rescue nil\n p[:latitude] = result['Point']['coordinates'][1].to_f rescue nil\n p[:longitude] = result['Point']['coordinates'][0].to_f rescue nil\n p[:accuracy] = result['AddressDetails']['Accuracy'].to_i rescue nil\n p[:zoom] = ZOOM_FROM_ACCURACY[result['AddressDetails']['Accuracy'].to_i] #rescue 0\n\n p\n else\n nil\n end\n end\n else\n []\n end\n end",
"def index\n @products = Product.all.order('created_at DESC')\n @products = @products.city_search(params[:city]) if params[:city].present?\n @markers = Gmaps4rails.build_markers(@products) do |flat, marker|\n marker.lat flat.latitude\n marker.lng flat.longitude\n end\n end",
"def getLocation\n loc = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/geocode/json\",\n :query_values => {:address => \"160+Folsom,+San+Francisco,+CA\",\n :sensor => \"false\"}).to_s\n\n location_request = RestClient.get(loc)\n parsed_location_request = JSON.parse(location_request)\n\n lat = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lat\"].to_s\n lng = parsed_location_request[\"results\"][0][\"geometry\"][\"location\"][\"lng\"].to_s\n\n [lat,lng]\nend",
"def find_city(lat,lng)\n if Geocoder::Calculations.distance_between([lat,lng], [40.698390,-73.98843]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [40.76813,-73.96439]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76423,-122.47743]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76912,-122.42593]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.85887,2.30965]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.86068,2.36389]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [51.51,-0.13]) < 20\n \"london\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.57664,-46.69787]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.55838,-46.64362]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.64446,139.70695]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.70136,139.73991]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.06901,-118.35904]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.07499,-118.28763]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.02663,-118.45998]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [50.07832,14.41619]) < 20\n \"prague\"\n else\n \"unknown\"\n end\n end",
"def setup\n @address = 'San Francisco, CA'\n @full_address = '100 Spear St, San Francisco, CA, 94105-1522, US'\n @full_address_short_zip = '100 Spear St, San Francisco, CA, 94105, US'\n\n @latlng = Geokit::LatLng.new(37.7742, -122.417068)\n @success = Geokit::GeoLoc.new({:city=>\"SAN FRANCISCO\", :state=>\"CA\", :country_code=>\"US\", :lat=>@latlng.lat, :lng=>@latlng.lng})\n @success.success = true\n end",
"def from_search\n name = params[:id]\n lat = params[:lat]\n lon = params[:lon]\n @locations = Location.locations_from_candy_ids(Candy.ids_by_name(name))\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end",
"def search_site\n db = Site::Database::SiteOrm.all\n db_lat = db.reduce([]) { |box, record| box << record[:lat] }\n db_lng = db.reduce([]) { |box, record| box << record[:lng] }\n tmp = db_lat.zip(db_lng)\n result = @site.lat.zip(@site.lng)\n result << tmp\n result.uniq!\n end",
"def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n validLocations = []\n\n validLocations = Location.where(\"latitude > ? AND latitude < ? AND longitude > ? AND longitude < ?\", swlat, nelat, swlng, nelng)\n validLocations = validLocations.sort_by { |k| k[\"latitude\"] }\n validLocations = validLocations[0..49]\n\n validLocations.each do|loc|\n @locations << loc.to_hash_with_follow(user_id)\n end\n\n end",
"def get_coords(address)\n coords = Geocoder.search(address)\n location = self.location\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def geo_params\n @geopoint = params[:geopoint]\n @user = User.find_by(login: @geopoint[:login])\n @user\n end",
"def set_zip_lat_long\n if self.zipcode\n ziploc=ZipLoc.find_by_zip(self.zipcode)\n if ziploc\n self.zipcode_latitude=ziploc.lat\n self.zipcode_longitude=ziploc.lng\n else\n self.zipcode_latitude=nil\n self.zipcode_longitude=nil\n end\n end\n end",
"def get_local_area_sp service, lat, long\n zipcode = Geocoder.search(\"#{lat},#{long}\").first.postal_code rescue nil\n Profile.where(\"profiles.zipcode like ? AND profiles.#{service.to_s.underscore} = ?\",\"%#{zipcode}%\", true)\n end",
"def optimistic_geo_wrapper(query)\n geocoded = nil\n result = ::Geocoder.search(query)\n puts result.inspect\n geocoded = result[0].data if result[0]\n geocoded\n end",
"def index\n @customers = Customer.like_customer(params[:latitude],params[:longitude])\n @vendors = Vendor.like_vendor(params[:latitude],params[:longitude])\n @gps = GpsLocation.find(params[:gps_id].to_i)\n end",
"def zip_plus_radius_to_near(params)\n # Convert zipcode + radius to lat/long+radius in lat|long|radius|units format\n if params[\"address-postalcode\"].present? # delete zip and radius params and replace with near\n radius = 25\n zip = params[\"address-postalcode\"]\n params.delete(\"address-postalcode\")\n if params[\"radius\"].present?\n radius = params[\"radius\"]\n params.delete(\"radius\")\n end\n # get coordinate\n coords = get_zip_coords(zip)\n near = \"#{coords[\"lat\"]}|#{coords[\"lng\"]}|#{radius}|mi\"\n params[:near]=near \n end\n params\n end",
"def zip_plus_radius_to_near(params)\n # Convert zipcode + radius to lat/long+radius in lat|long|radius|units format\n if params[\"address-postalcode\"].present? # delete zip and radius params and replace with near\n radius = 25\n zip = params[\"address-postalcode\"]\n params.delete(\"address-postalcode\")\n if params[\"radius\"].present?\n radius = params[\"radius\"]\n params.delete(\"radius\")\n end\n # get coordinate\n coords = get_zip_coords(zip)\n near = \"#{coords[\"lat\"]}|#{coords[\"lng\"]}|#{radius}|mi\"\n params[:near]=near \n end\n params\n end",
"def geo_factory\n @geo_factory\n end",
"def geo_factory\n @geo_factory\n end",
"def map_result(result)\n loc = result.dig('geometry', 'location') || {}\n geometry = Geoloco::Geometry.new(lat: loc['lat'], lng: loc['lng'])\n\n Geoloco::Location.new(\n geometry: geometry,\n full_address: result.dig('formatted_address'),\n street: get_component(result, 'route'),\n city: get_component(result, 'locality'),\n district: get_component(result, 'administrative_area_level_2'),\n municipality: get_component(result, 'administrative_area_level_3'),\n number: get_component(result, 'street_number'),\n state: get_component(result, 'administrative_area_level_1'),\n state_code: get_component(result, 'administrative_area_level_1', 'short_name'),\n zipcode: get_component(result, 'postal_code'),\n country: get_component(result, 'country'),\n country_code: get_component(result, 'country', 'short_name')\n )\n end",
"def get_coords(address)\n coords = Geocoder.search(address)\n if coords.length === 0 \n coords = Geocoder.search(self.name)\n end\n debugger\n self.lat ||= coords.first.coordinates[0]\n self.lng ||= coords.first.coordinates[1]\n end",
"def index\n\n current_location = Image.nearby( 0.2, 121.52847610518472, 25.04476753094792).first\n @hash = Gmaps4rails.build_markers(current_location) do |location, marker|\n marker.lat 25.04476753094792\n marker.lng 121.52847610518472\n end\n\n end",
"def index\n lat = params[:lat]\n long = params[:long]\n is_ok = params[:is_ok]\n id_panneaux = params[:id_panneaux] \n end",
"def location\n [lat.to_f / 100_000, lng.to_f / 100_000]\n end",
"def geocode!(instance)\n result = coordinates(instance).first\n if result\n {\n lat: result.latitude,\n lon: result.longitude,\n region: result.state_code,\n locality: result.city,\n postalcode: result.postal_code,\n address: result.address\n }\n else\n {}\n end\n end",
"def create\n @existing_address = Address.where('address LIKE ?', \"#{params[:address][:address]}%\")\n if @existing_address.present?\n @address = @existing_address.take.dup\n else\n @address = Address.new(address_params)\n random_array = [true, false]\n serverlookup = random_array.sample\n if serverlookup == true\n address = params[:address][:address]\n lat = Geocoder.coordinates(address).first\n lng = Geocoder.coordinates(address).last\n else\n # (30.730032 , -170.859375)\n lat = random_location(-170.859375,30.730032,100)[1]\n lng = random_location(-170.859375,30.730032,100)[0]\n end\n @address.latitude = lat\n @address.longitude = lng\n @address.save\n end\n respond_to do |format|\n format.js\n end\n end",
"def is_nearby(user_latitude,user_longitude, bus_latitude, bus_longitude)\n (user_longitude - bus_longitude).abs <= 0.01 && (user_latitude - bus_latitude).abs \nend",
"def geocode_endpoints\n if start_address_changed?\n geocoded = Geocoder.search(start_address).first\n if geocoded\n self.start_latitude = geocoded.latitude\n self.start_longitude = geocoded.longitude\n end\n end\n # Repeat for destination\n if end_address_changed?\n geocoded = Geocoder.search(end_address).first\n if geocoded\n self.end_latitude = geocoded.latitude\n self.end_longitude = geocoded.longitude\n end\n end\n end",
"def search_data\n attributes.merge(location: {lat: latitude, lon: longitude})\n end",
"def search\n\n @search = Location.near(params[:search], 15, :order => :distance)\n \n @query = params[:search]\n @locations = @search\n \n @filtros = ajustaFiltros\n @precios = precios(@locations)\n @campos = self.campos\n @places = places(@locations,@filtros)\n @facets = facetas(@locations, @filtros)\n @json = @locations.to_gmaps4rails\n end",
"def lonlat\r\n [longitude,latitude]\r\n end",
"def lonlat\r\n [longitude,latitude]\r\n end",
"def dlat\n @_dlat ||= _safe_sqrt(ssq_lat/weight - (sum_lat/weight)**2)\n end",
"def latitude\n -37.8136\n end",
"def create\n location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n idea_params[:lat].blank? ? idea_params[:lat] << location.latitude.to_s : idea_params[:lat]\n idea_params[:long].blank? ? idea_params[:long] << location.longitude.to_s : idea_params[:long]\n idea_params[:region_name].blank? ? idea_params[:region_name] << location.region_name : idea_params[:region_name]\n idea_params[:country].blank? ? idea_params[:country] << location.country_name : idea_params[:country]\n idea_params[:city].blank? ? idea_params[:city] << location.city_name : idea_params[:city]\n @idea = Idea.new(idea_params)\n\n respond_to do |format|\n if @idea.save\n format.html { redirect_to @idea, notice: 'Idea was successfully created.' }\n format.json { render action: 'show', status: :created, location: @idea }\n else\n format.html { render action: 'new' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(params={}) \r\n\t @id=params[:_id].nil? ? params[:id] : params[:_id].to_s\r\n\t @formatted_address=params[:formatted_address].to_s\r\n\t# @address_components=params[:address_components].map {|a| AddressComponent.new(a)}\r\n\t @address_components = []\r\n\t params[:address_components].nil? ? params[:address_components] :\r\n\t params[:address_components].each do | ac | @address_components << AddressComponent.new(ac) end\r\n\t @location = params[:geometry].nil? ? params[:geometry] :\r\n\t \t\t\t Point.new(params[:geometry][:geolocation])\r\n\r\n\tend",
"def geocode_function\n a = Geocoder.search(self.address)\n geocode = a[0]\n self.latitude = geocode.latitude\n self.longitude = geocode.longitude\n lat = @itinerary.latitude\n lon = @itinerary.longitude\n photos = Flickr.photos.search(lat: lat, lon: lon).shuffle!\n photo = photos.pop(1)\n self.img_url = 'http://farm' + photo[0].farm.to_s + '.static.flickr.com' + '/' + photo[0].server.to_s + '/' + photo[0].id.to_s + '_' + photo[0].secret.to_s + '.jpg'\n self.save\n end",
"def extract_latlng(params)\n lat = params.delete('pio_latitude')\n lng = params.delete('pio_longitude')\n params['pio_latlng'] = \"#{lat},#{lng}\" if lat && lng\n return params['pio_latlng']\n end",
"def to_geo\n self.translate(KA, GEO)\n end",
"def location(restrictions={state: [], zip_code: []})\n location = {}\n states = (restrictions[:state].is_a?(Array) and !restrictions[:state].blank?) ? restrictions[:state] : []\n zip_codes = (restrictions[:zip_code].is_a?(Array) and !restrictions[:zip_code].blank?) ? restrictions[:zip_code] : []\n\n unless @config[:location_db][:adapter].eql?(:none)\n location_result = find_location states, zip_codes\n\n location ={\n street: Faker::Address.street_address,\n city: location_result[\"#{@config[:location_db][:column_mapping][:city]}\"],\n state: location_result[\"#{@config[:location_db][:column_mapping][:state]}\"],\n state_abbr: location_result[\"#{@config[:location_db][:column_mapping][:state_abbr]}\"],\n zip_code: location_result[\"#{@config[:location_db][:column_mapping][:zip_code]}\"],\n area_code: location_result[\"#{@config[:location_db][:column_mapping][:area_code]}\"].split(\"/\").first,\n }\n end\n\n if location.blank?\n location = {\n street: Faker::Address.street_address,\n city: Faker::Address.city,\n state: Faker::Address.state,\n state_abbr: Faker::Address.state_abbr,\n zip_code: Faker::Address.postal_code,\n area_code: nil\n }\n end\n\n location\n end",
"def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end",
"def assign_lon_lat_locator_fields\n box = getBoxForCoordinates( view_path_coordinates[\"LonLat\"] )\n self.nw_lon= box[0][0]\n self.nw_lat= box[0][1]\n self.se_lon= box[1][0]\n self.se_lat= box[1][1]\n end",
"def create\n address1 = Address.create(address: params[:address1])\n address2 = Address.create(address: params[:address2])\n midpoint = Geocoder::Calculations.geographic_center([address1.coordinates, address2.coordinates])\n coordinates = { latitude: midpoint[0].round(4), longitude: midpoint[1].round(4) }\n params = { terms: 'restaurant' , limit: 5 }\n #render json: Yelp.client.search_by_coordinates(coordinates, params, locale)\n #def search\n #parameters = { term: params[:term], limit: 16 }\n #render json: Yelp.client.search('San Francisco', parameters)\n #end\n #render text: \"#{coordinates}\"\n #render text: \"midpoint of #{address1.address} and #{address2.address} = #{midpoint}\"\n render json: Yelp.client.search_by_coordinates(coordinates, params)\n \n\n end",
"def to_georss(*args)\n xml = Geos::Helper.xml_options(*args)[0]\n xml.georss(:where) do\n xml.gml(:Point) do\n xml.gml(:pos, \"#{self.lat} #{self.lng}\")\n end\n end\n end",
"def setup\n super\n @base_url = \"https://maps.googleapis.com/maps/api/geocode/json\"\n @api_key = \"key=AIzaSyC8TPOW-55dcfdOmiGAUwyd5-gqhQYdy1E\"\n # Geocode and Reverse Geocode values for Github US office\n @geocode_full_address = \"address=88%20Colin%20P%20Kelly%20Jr%20St%2C%20San%20Francisco%2C%20CA&sensor=false&#{@api_key}\"\n @geocode_street_wo_number = \"address=Colin%20P%20Kelly%20Jr%20St%2C%20San%20Francisco%2C%20CA&sensor=false&#{@api_key}\"\n @geocode_city_state = \"address=San%20Francisco%2C%20CA&sensor=false&#{@api_key}\"\n @geocode_state = \"CA&sensor=false&#{@api_key}\"\n @geocode_address_invalid = \"address=Z12345%20Colin%20P%20Kelly%20Jr%20St%2C%20San%20Francisco%2C%20CA&sensor=false\"\n @reverse_geocode = \"latlng=37.78226710000001,-122.3912479\"\n @geocode_invalid_uri = \"http://maps.googleapis.com/maps/api/geo/json?address=88%20Colin%20P%20Kelly%20Jr%20St%2C%20San%20Francisco%2C%20CA&sensor=false\"\n @reverse_geocode_invalid_lat = \"https://maps.googleapis.com/maps/api/geocode/json?latlng=37.7822671#0000001,-122.3912479&key=AIzaSyC8TPOW-55dcfdOmiGAUwyd5-gqhQYdy1E\"\n # Additional URL query parameters\n @country_us = \"components=country:US\"\n @place_id_us = \"place_id=ChIJCzYy5IS16lQRQrfeQ5K5Oxw\"\n @country_uk = \"components=country:UK\"\n @place_id_uk = \"place_id=ChIJqZHHQhE7WgIReiWIMkOg-MQ\"\n end",
"def gps_data\n\t conversion_factor = 60.0\n\t lat_multiplier = 1.0\n\t long_multiplier = 1.0\n\n if (latitude.nil? or longitude.nil?)\n if file.queued_for_write[:original].nil?\n errors.add(:file, \" not selected\")\n return\n end\n \n # Extract meta data as a hash\n exif = EXIFR::JPEG.new(file.queued_for_write[:original].path).to_hash\n if not exif[:gps_longitude].nil? # GPS Data Exists\n \tnorth_degree = exif[:gps_latitude][0].to_f\n north_minute = exif[:gps_latitude][1].to_f\n \tnorth_second = exif[:gps_latitude][2].to_f\n \teast_degree = exif[:gps_longitude][0].to_f\n \teast_minute = exif[:gps_longitude][1].to_f\n \teast_second = exif[:gps_longitude][2].to_f\n \n # Correct references\n if exif[:gps_latitude_ref] == 'N'\n\t lat = lat_multiplier\n else\n lat = -lat_multiplier\n end\n \n if exif[:gps_longitude_ref] == 'E'\n lng = long_multiplier\n else \n lng = -long_multiplier\n end\n \n lat *= (north_degree + (north_minute + (north_second/conversion_factor))/conversion_factor)\n \t lng *= (east_degree + (east_minute + (east_second/conversion_factor))/conversion_factor)\n \n \t self.latitude = lat\n self.longitude = lng\n else\n errors.add(:base, \"GPS data not present in file\")\n end\n end\n end",
"def reverse_geocode_trip\n self.departure_location_address ||= Geocoder.search([departure_location_latitude, departure_location_longitude]).first.address\n self.arrival_location_address ||= Geocoder.search([arrival_location_latitude, arrival_location_longitude]).first.address\n end",
"def nearby\n\n #select * from ( select * from Location\n # WHERE Longitude > @lngA-(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Longitude < @lngA+(@dist/(cos( radians(@latA+(@dist/68.703)))*69.172))\n # AND Latitude > @latA-(@dist/68.703)\n # AND Latitude < @latA+(@dist/68.703) ) AS `tmp` WHERE GEODISTANCE(@latA,@lngA ,Latitude,Longitude) < @dist\n\n #Calculate a bounding box we can use to quickly find nearby trucks\n lat = params[:lat].to_f\n lng = params[:lng].to_f\n dist = params[:radius].to_f\n latDelta = dist/68.703\n\n value = lat+(latDelta);\n rad = value/180 * Math::PI #Geocoder::Calculations.to_radians(value) #value.to_ra radians(value);\n\n lngDelta = dist/(Math.cos( rad)*69.172)\n minLng = lng-lngDelta\n maxLng = lng+lngDelta\n minLat = lat-latDelta\n maxLat = lat+latDelta\n\n\n #IFNULL( SQRT(((difX)(difX))+((difY)(difY))), 99999)\n trucks = Truck.find_by_sql \"SELECT trucks.* WHERE SQRT(((trucks.lng-#{lng})(trucks.lng-#{lng}))+((trucks.lat-#{lat})(trucks.lat-#{lat}))) < #{dist}\"\n\n render :json => trucks\n end",
"def process_geo\n\t if !params[:geo].nil? && params[:geo].split(\",\").length == 2\n\t\t@lat = params[:geo].split(\",\")[0].to_f\n\t\t@lng = params[:geo].split(\",\")[1].to_f\n\t end\n\t if params[:radius].nil?\n\t\t@radius = 1.0\n\t else\n\t\t@radius = params[:radius].to_f\n\t end\n\tend",
"def create_lat_long_coordinates(location)\n gmaps = GoogleMapsService::Client.new\n lat_long = gmaps.geocode(location)\n latitude = lat_long[0][:geometry][:location][:lat]\n longitude = lat_long[0][:geometry][:location][:lng]\n lat_long = [latitude, longitude]\n end",
"def compute_position\n # The negative and the ninety are the fudge to compensate for our map.\n lat = @latitude_radians = radians(-@latitude)\n long = @longitude_radians = radians(@longitude + 90)\n radius = $app.globe.diameter / 2.0 - 23\n @x = radius * cos(lat) * sin(long)\n @y = radius * sin(lat)\n @z = radius * cos(lat) * cos(long)\n end",
"def index\nif params[:search].present?\n @healthcares = Healthcare.near(params[:search], 50) \n \n else\n @healthcares = Healthcare.all\n end\n @hash = Gmaps4rails.build_markers(@healthcares) do |healthcare, marker|\n marker.lat healthcare.latitude\n marker.lng healthcare.longitude\n marker.infowindow healthcare.site\n end end",
"def test_getlatlon\n k = KAPHeader.new\n k.bsb_ra = [40, 40]\n r = REF.new\n r.x = 10\n r.y = 30\n r.latitude = -10\n r.longitude = 170\n k.ref << r\n r = REF.new\n r.x = 10\n r.y = 10\n r.latitude = 10\n r.longitude = 170\n k.ref << r\n r = REF.new\n r.x = 30\n r.y = 10\n r.latitude = 10\n r.longitude = -170\n k.ref << r\n r = REF.new\n r.x = 30\n r.y = 30\n r.latitude = -10\n r.longitude = -170\n k.ref << r\n puts k.inspect\n puts k.lat_at_y (11)\n puts k.lon_at_x (11)\n puts k.lat_at_y (21)\n puts k.lon_at_x (21)\n \n k = KAPHeader.new\n k.bsb_ra = [40, 40]\n r = REF.new\n r.x = 10\n r.y = 30\n r.latitude = -10\n r.longitude = -10\n k.ref << r\n r = REF.new\n r.x = 10\n r.y = 10\n r.latitude = 10\n r.longitude = -10\n k.ref << r\n r = REF.new\n r.x = 30\n r.y = 10\n r.latitude = 10\n r.longitude = 10\n k.ref << r\n r = REF.new\n r.x = 30\n r.y = 30\n r.latitude = -10\n r.longitude = 10\n k.ref << r\n puts k.inspect\n puts k.lat_at_y (11)\n puts k.lon_at_x (11)\n puts k.lat_at_y (21)\n puts k.lon_at_x (21)\nend",
"def from_name\n @locations = Location.where(\"name like ?\", \"%#{params[:id]}%\") \n\n lat = params[:lat]\n lon = params[:lon]\n\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end",
"def index\n # TODO: get current location vs get default location\n if current_user\n addr = \"#{current_user.street_address}, #{current_user.locality}, #{current_user.region}\"\n else\n addr = '580 Portola Plaza, Los Angeles, CA'\n end\n\n loc = Geokit::Geocoders::GoogleGeocoder.geocode addr\n if loc.nil?\n loc = Geokit::GeoLoc.new\n loc.lat = 34.0704374\n loc.lng = -118.4421695\n loc.success = true\n end\n\n # 1 degree ~ 70 miles\n if params[:distance] and !params[:distance].empty?\n distance = params[:distance].to_f / 70.0\n else\n distance = 1\n end\n\n # degrees\n w_bound = loc.lng - distance\n e_bound = loc.lng + distance\n n_bound = loc.lat - distance\n s_bound = loc.lat + distance\n\n if params[:keyword] and !params[:keyword].empty? and\n params[:classification] and !params[:classification].empty?\n @products = Product.where('name like ? and classification like ? and lat < ? and lat > ? and lon < ? and lon > ?',\n \"%#{params[:keyword]}%\",\n \"%#{params[:classification]}%\",\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n elsif params[:keyword] and !params[:keyword].empty?\n @products = Product.where('name like ? and lat < ? and lat > ? and lon < ? and lon > ?',\n \"%#{params[:keyword]}%\",\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n elsif params[:classification] and !params[:classification].empty?\n @products = Product.where('classification like ? and lat < ? and lat > ? and lon < ? and lon > ?',\n \"%#{params[:classification]}%\",\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n else\n @products = Product.where('lat < ? and lat > ? and lon < ? and lon > ?',\n s_bound, n_bound, e_bound, w_bound).order('created_at DESC')\n end\n\n @products = @products.paginate(:page => params[:page], :per_page => 12)\n end",
"def get_coordinates\n if self.country_status == 'closed'\n self.latitude = nil\n self.longitude = nil\n else\n q = self.city || ''\n q += ','+self.state if self.state\n q += ','+self.country\n begin\n self.latitude, self.longitude = Geocoder.coordinates(q)\n # We need to make sure that that no 2 projects have exactly the same\n # coordinates. If they do, they will overlap on the flash map and\n # you won't be able to click on one of them.\n while SpProject.where(['latitude = ? and longitude = ?', self.latitude, self.longitude]).first\n delta_longitude, delta_latitude = 0,0\n delta_longitude = rand(6) - 3 while delta_longitude.abs < 2\n delta_latitude = rand(6) - 3 while delta_latitude.abs < 2\n # move it over a little.\n self.longitude += delta_longitude.to_f/10\n self.latitude += delta_latitude.to_f/10\n end\n rescue => e\n Airbrake.notify_or_ignore(e, :parameters => attributes)\n end\n end\n true\n end",
"def store_lat_long\n if self.lat == nil or self.long == nil # remove if condition once we are done with seeding (prevents updating of address from changing lat/long)\n full_address = UsersController.helpers.get_full_address(self)\n if full_address\n geocoder = Geocoder.new\n lat_long = geocoder.getLatLong(full_address)\n self.lat = lat_long.lat\n self.long = lat_long.long\n end\n end\n end",
"def load_coarse_info\n @zip_code = @location[:zipCode] unless @location[:zipCode].nil?\n @city = @location[:city] unless @location[:city].nil?\n return if @location[:postalAddress].nil?\n @postal_address = @location[:postalAddress]\n end",
"def spatial_query(bounds)\n sb = bounds_to_center_radius(bounds)\n if sb.present?\n \"{!spatial lat=#{sb[:center][:latitude]} long=#{sb[:center][:longitude]} radius=#{sb[:radius]} unit=km calc=arc threadCount=2}\"\n else\n \"\"\n end\n end",
"def index\n @ip = request.remote_ip\n # @ip = \"108.190.18.85\"\n\n geocoded = Geocoder.search(@ip).last\n if geocoded\n @lat = geocoded.latitude\n @lng = geocoded.longitude\n else\n @lat = 27.7723\n @lng = -82.6341\n end\n @care_providers = current_user.care_providers.near([@lat, @lng], 15, {order: \"distance\"}).distinct\n end",
"def decimal_latitude\n @ce.andand.latitude.to_s\n end",
"def extract_geolocation\n img_lat = get_exif('GPSLatitude')[0][1].split(', ') rescue nil\n img_lng = get_exif('GPSLongitude')[0][1].split(', ') rescue nil\n lat_ref = get_exif('GPSLatitudeRef')[0][1] rescue nil\n lng_ref = get_exif('GPSLongitudeRef')[0][1] rescue nil\n return unless img_lat && img_lng && lat_ref && lng_ref \n latitude = to_frac(img_lat[0]) + (to_frac(img_lat[1])/60) + (to_frac(img_lat[2])/3600)\n longitude = to_frac(img_lng[0]) + (to_frac(img_lng[1])/60) + (to_frac(img_lng[2])/3600) \n latitude = latitude * -1 if lat_ref == 'S' # (N is +, S is -)\n longitude = longitude * -1 if lng_ref == 'W' # (W is -, E is +) \n self.latitude = latitude\n self.longitude = longitude\n end",
"def mapSearch\n @jardins = Jardin.where(\"(latitud between ? and ?) and (longitud between ? and ?)\",params[:SWLat].to_f, params[:NELat].to_f, params[:SWLng].to_f, params[:NELng].to_f)\n #@post = params\n render :json => @jardins.to_json(:only => [ :id , :nombre, :direccion, :telefono, :latitud, :longitud])\n #respond_to do |format|\n # format.html # mapSearch.html.erb\n # format.xml { render :xml => @jardins }\n #end\n end",
"def geocode\n @location = Location.find(params[:id])\n if @location.lat.blank? or @location.lng.blank?\n res = MultiGeocoder.geocode(@location.street + ', ' + @location.city + ', ' + @location.state + ', ' + @location.country)\n \n if !res.lng.blank? or !res.lat.blank?\n @location.lat = res.lat\n @location.lng = res.lng\n @location.save\n flash[:notice] = 'Geocoding results: ' + res.lat.to_s + ', ' + res.lng.to_s\n \n else\n flash[:notice] = 'Geocoding failed'\n end\n \n end\n \n respond_to do |format|\n format.html { redirect_to(@location) }\n format.xml { head :ok }\n end\n end",
"def gmaps4rails_address\n #describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki\n \"#{self.address}, #{self.town}, #{self.province}\"\n end",
"def initialize(street1, street2)\n\t\t@street1 = street1\n\t\t@street2 = street2\n\t\t@geo_endpoint_url = \"#{GEO_BASE_URL}#{URI::encode(@street1)}+and+#{URI::encode(@street2)},#{GEO_REST_URL}#{API_KEY}\"\n\t\t@loc_endpoint_url = \"\"\n\t\t@lat = nil\n\t\t@long = nil\n\t\t@stores = []\n\tend",
"def get_latitude\n get_coord['lat']\n end",
"def show\n #@location = Location.find(params[:id])\n @user=User.find_by_id(params[:user_id])\n @location = Location.find_by_id(params[:id])\n a = @location.address \n \n \n @array_rest = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_amusementpark_camp= Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n # @array_shopping = Gmaps4rails.places_for_address( a , 'AIzaSyDBgmxkPQH0JRNFvneP7d8vireve1gCC5Y', type = 'restaurant|amusement_park|shopping_mall|campground|bar|museum|night_club|movie_theater|zoo', radius = 1000)\n\n @json = @array_rest.to_json\n #@json = array_rest.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n \n end \n \n end"
] | [
"0.6779189",
"0.6270964",
"0.6185727",
"0.61477476",
"0.61281157",
"0.61205757",
"0.6119252",
"0.6099083",
"0.6075505",
"0.60378706",
"0.60136986",
"0.5996927",
"0.5971844",
"0.5930033",
"0.5886866",
"0.5885558",
"0.5872504",
"0.5840385",
"0.58331954",
"0.58315635",
"0.5827204",
"0.58186996",
"0.5816401",
"0.5808396",
"0.58006716",
"0.57979536",
"0.5791702",
"0.57569987",
"0.5756051",
"0.57501525",
"0.5738486",
"0.5738235",
"0.5731499",
"0.5727184",
"0.5707593",
"0.5696914",
"0.5694381",
"0.56878346",
"0.56877303",
"0.56675076",
"0.56615365",
"0.5660479",
"0.5658148",
"0.565643",
"0.5651789",
"0.56505233",
"0.5649486",
"0.56484395",
"0.5644335",
"0.5644335",
"0.56432515",
"0.56432515",
"0.56430656",
"0.5641027",
"0.56348836",
"0.5631791",
"0.56314623",
"0.5627265",
"0.56211907",
"0.56172",
"0.56022865",
"0.5572515",
"0.5571981",
"0.55683297",
"0.55683297",
"0.5564415",
"0.5554954",
"0.5540194",
"0.55384505",
"0.55353945",
"0.5534342",
"0.5534033",
"0.55288523",
"0.5525752",
"0.5525192",
"0.5523019",
"0.55203193",
"0.55188036",
"0.5516171",
"0.5513134",
"0.55060893",
"0.55041635",
"0.5503842",
"0.5500407",
"0.5489619",
"0.5486131",
"0.54848003",
"0.5484502",
"0.5481312",
"0.5479049",
"0.5468437",
"0.5461793",
"0.5459131",
"0.5458023",
"0.5455676",
"0.5454894",
"0.545326",
"0.54490846",
"0.544343",
"0.54352707",
"0.54346836"
] | 0.0 | -1 |
Reindex specific user only , instead of whole class. | def reindex_user!
Sunspot.index! self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_index\n \t\t@users = User.all\n \tend",
"def reindex!\n find(:all).each { |r| r.update_index(true) }\n end",
"def reindex!\n indexed if generate_solr_index\n end",
"def index_user\n @user = User.find(params[:id])\n @projects = @user.projects\n @user_index = true\n end",
"def additional_users_for_index\n []\n end",
"def add_user_to_index(userid)\n name = FBHot.redis.get \"#{userid}:name\"\n name = _convert_vietnamese_to_english name\n if name == nil then return end\n name.strip!\n name.split.each do |token|\n if token.length > 0 then\n # if a token is 'kien' => we make index for \n # ['ki', 'kie', 'kien', 'ie', 'ien', 'en']\n (0..token.length - 3).each do |i|\n ((i + 1)..token.length - 1).each do |j|\n FBHot.redis.zadd(\"#{@index_name}:#{token[i..j]}\", 0, userid)\n end\n end\n end\n end\n end",
"def index\n # set_user, is the only action taken here\n end",
"def index\n # set_user, is the only action taken here\n end",
"def genindex\n set_genre\n @userids = @genre.leaderboards.select(:user_id).map(&:user_id).uniq\n end",
"def index_users(search=nil, page=1)\n users = User.sorted\n users = users.search(search) if search\n users.page(page)\n end",
"def index\n @users = User.where(user_type: \"user\").all\n end",
"def indexable_by?(user, parent = nil)\n raise \"#{self}.indexable_by?(user, parent = nil) must be overridden\"\n end",
"def reset_index\n # delete old database\n FBHot.redis.keys(@index_name).each {|key| FBHot.redis.del key}\n\n # create new database\n ids = FBHot.redis.zrange 'zusers1', 0, User::count('girls') - 1\n ids.each {|id| add_user_to_index(id)}\n end",
"def reindex\n Sunspot.index!\n # puts 'reindexed'\n end",
"def reindex!\n doc = {:id => neo_node_id }\n self.class.index_updaters.each_value do |updater|\n updater.call(self, doc)\n end\n lucene_index << doc\n end",
"def index_user # :nologin: :norobots:\n if is_in_admin_mode? || find_query(:User)\n query = find_or_create_query(:User, by: params[:by])\n show_selected_users(query, id: params[:id].to_s, always_index: true)\n else\n flash_error(:runtime_search_has_expired.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def index\n @user_searches = UserSearch.all\n end",
"def reindex_resource\n\t\tresource.reindex\n\tend",
"def reindex!\n Student.update_recent_student_assessments!\n end",
"def reindex_class(klass, options={})\n opts = {:verbose => false}.merge(options)\n # First, delete all docs of this class\n XapianDb.database.delete_docs_of_class(klass)\n blueprint = XapianDb::DocumentBlueprint.blueprint_for(klass)\n indexer = XapianDb::Indexer.new(XapianDb.database, blueprint)\n show_progressbar = false\n obj_count = klass.count\n if opts[:verbose]\n if defined?(ProgressBar)\n show_progressbar = true\n end\n puts \"reindexing #{obj_count} objects of #{klass}...\"\n pbar = ProgressBar.new(\"Status\", obj_count) if show_progressbar\n end\n\n # Process the objects in batches to reduce the memory footprint\n nr_of_batches = (obj_count / 1000) + 1\n nr_of_batches.times do |batch|\n klass.all(:offset => batch * 1000, :limit => 1000) .each do |obj|\n if blueprint.should_index? obj\n doc = indexer.build_document_for(obj)\n XapianDb.database.store_doc(doc)\n else\n XapianDb.database.delete_doc_with_unique_term(obj.xapian_id)\n end\n pbar.inc if show_progressbar\n end\n end\n XapianDb.database.commit\n true\n end",
"def reindex\n Transaction.current.reindex(self)\n end",
"def index\n # @users = User.search(params).paginate(page: params[:page])\n if isAdmin?\n @q_users = User.where.not(role: \"SuperAdmin\").ransack(params[:q])\n else\n @q_users = User.ransack(params[:q])\n end\n @users = @q_users.result().paginate(page: params[:page])\n end",
"def index\n @users = User.where(flg: 0).order(:user_id)\n @name = \"\"\n @annual = \"\"\n end",
"def user_search\n @users = User.admin_search(params[:query])\n end",
"def index\n @users = User.all\n #@users = User.all\n end",
"def reindex!\n logger.debug \"Updating #{self.name} (#{self.id}) to Solr directly...\"\n indexed if generate_solr_index\n end",
"def index\n @user_users = User::User.all\n end",
"def reindex\n # We would need to set this explicitly to re-index\n if BoolENV[\"REINDEX_SOLR\"]\n Sunspot.session = Sunspot::SessionProxy::Retry5xxSessionProxy.new(Sunspot.session)\n reindex_options = { :batch_commit => false }\n Dir.glob(Rails.root.join('app/models/**/*.rb')).each { |path| require path }\n sunspot_models = Sunspot.searchable\n sunspot_models.each do |model|\n model.solr_reindex(reindex_options)\n end\n end\n end",
"def discoverUsers \n\t\tUser.index\n\t\t# @users = User.all\n\tend",
"def index\n \t@user=User.all\n end",
"def index\n check_user\n if @user['u_type'] == 1\n @users = User.all\n elsif @user['u_type'] == 2\n @users = User.where.not(u_type: [1])\n end\n\n end",
"def index\n @filter = params[:filter] if params.has_key? :filter and %w{unapproved invited}.include? params[:filter]\n\n if params[:search]\n @search = User.search { fulltext params[:search] }\n @users = user_query.where(id: @search.results.map(&:id))\n else\n @users = user_query.order(updated_at: :desc)\n end\n end",
"def user=(new_user)\n @user = new_user[0..100]\n end",
"def index\n @all_users = User.order(\"username\")\n end",
"def index\n authorize User\n\n @users = !!params[:search] ? User.search_includes(params[:search]) : User.all_includes\n\n @users = User.filter_with(@users, params[:filter]) if !!params[:filter]\n\n @users = User.sort_num_desc(@users, params[:sort_by]) if !!params[:sort_by]\n end",
"def reset_indices\n relevant_books = self.user.listed_books.where(is_read: true).order(:order_index)\n relevant_books.each_with_index { |book, i| relevant_books[i].order_index = i }\n relevant_books.each(&:save)\n relevant_books = self.user.listed_books.where(is_read: false).order(:order_index)\n relevant_books.each_with_index { |book, i| relevant_books[i].order_index = i }\n relevant_books.each(&:save)\n\n end",
"def search_users\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '1'\n flash[:authority_error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n empty_user_id\n return\n end\n end\n empty_user_id\n @check=0\n @searched_user=User.new\n end",
"def index\n @users = User.search_user(params[:search_user])\n end",
"def index\n @users = User.order(\"username ASC\").all\n end",
"def index\n\t\t@users = AdminUser.sorted\n\tend",
"def index\n @users = User.nonadmin.order('users.created_at desc')\n if params[:search].present?\n if params[:search][:name].blank?\n @users = User.nonadmin.order(\"users.id desc\").order('users.created_at desc')\n elsif params[:search][:name].present?\n search_terms = params[:search][:name].split(' ').join('%')\n @users = User.nonadmin.where(\"concat(LOWER(first_name), ' ', LOWER(last_name)) like ?\",\"%#{search_terms}%\").order('users.created_at desc')\n end\n\n if params[:search][:ic].present?\n @users = @users.where(ic_number: params[:search][:ic])\n end\n end\n if params[:filter].present?\n @users = @users.send(params[:filter])\n end\n @klass = Class\n @users = Kaminari.paginate_array(@users).page(params[:page]).per(6)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n @userids = Userid.all\n end",
"def primary_key_index_re\n PRIMARY_KEY_INDEX_RE\n end",
"def primary_key_index_re\n PRIMARY_KEY_INDEX_RE\n end",
"def index\n if params[:s]\n @search = User.search do\n fulltext \"#{params[:s]}\"\n end\n @users = @search.results\n else\n if params[:show_deleted]\n @users = User.only_deleted.page(params[:page]).order(:id)\n else\n @users = User.all.page(params[:page]).order(:id)\n end\n end\n end",
"def index\n @users = User.where(user_type: 'regular').paginate(page: params[:page])\n end",
"def index\n @users = User.where(contributor: true)\n end",
"def index\n @users = User.where(contributor: true)\n end",
"def index\n @all_users = User.order(:id)\n end",
"def index\n @users = User.search(params[:search], params[:page])\n @total_count = User.search(params[:search],\"\").count\n \n @menu = \"user\"\n @board = \"user\"\n @section = \"index\"\n \n render 'admin/users/user'\n end",
"def index\n @user = User.all\n end",
"def index\n @user = User.all\n end",
"def index\n @user = User.all\n end",
"def index\n @user = User.all\n end",
"def index\n @user = User.all\n end",
"def set_users\n \n columns=params[:columns]\n order=params[:order][\"0\"]\n search_list=User.attribute_names.select do |item|\n !@model_config[item].nil? && @model_config[item][\"searchable\"]\n end\n @filteredUsers=User.all\n @[email protected](\"#{columns[order[\"column\"]][\"data\"]} #{order[\"dir\"]}\") #单项排序\n @[email protected](params[:start]).limit(params[:length])\n end",
"def reindex!(index: nil, dataset: nil, batch_size: 100)\n index_name = index || timestamped_index\n import!(index: index_name, dataset: dataset, batch_size: batch_size)\n\n # Create an alias to the newly created index\n alias_index(index_name)\n end",
"def index\n if current_user.admin?\n @users = User.all\n end\n \n end",
"def index\n authorize_action_for User, at: current_store\n query = saved_search_query('user', 'admin_user_search')\n @search = UserSearch.new(query.merge(search_constrains))\n @users = @search.results.page(params[:page])\n end",
"def reindex!\n self.__elasticsearch__.update_document if self.published?\n end",
"def index\n if(current_user.entidade_id.nil?)\n @users = []\n @users.push User.find_by(email: current_user.email)\n else\n @users = User.where(entidade_id: current_user.entidade_id.to_int)\n end\n\n if(current_user.tipo.eql? 1)\n @users = User.where('tipo = 1 or tipo = 2 or tipo = 4')\n elsif(current_user.tipo.eql? 2)\n @users = User.distinct()\n .joins('left join reservas r on users.id = r.user_id')\n .where('(tipo in(2,3) and users.entidade_id=?) or (tipo = 4 and r.entidade_id=?)', current_user.entidade_id, current_user.entidade_id)\n elsif(current_user.tipo.eql? 3)\n @users = User.distinct()\n .joins('left join reservas r on users.id = r.user_id')\n .where('tipo = 4 and r.entidade_id=?', current_user.entidade_id)\n else \n end\n end",
"def index\n @users = User.all\n @users = User.order(\"rank ASC\").paginate(page: params[:page], :per_page => 20)\n end",
"def modified_by_user(user_id, source_id, number_to_return = :all, starting_index = 0)\n # ids = PublicEarth::Db::Place.many.modified_by_user(user_id, source_id, number_to_return == :all && 250 || number_to_return, starting_index).map { |result| result['modified_by_user'] }\n ids = PublicEarth::Db::Place.many.modified_by_user(user_id, source_id).map { |result| result['modified_by_user'] }\n PublicEarth::Db::Place.find_from_search(*ids)\n end",
"def index\n @users = User.select{ |_| can? :read, _ }\n end",
"def index\n @userns = Usern.all\n end",
"def index\n\t\t\n\t\t# @admins=User.where(admin: true)\n\t #Only show users that aren't admin(only the community are shown)\n\t @users = User.where(admin: false).order(\"first_name ASC\")\n\n\t if params[:search_user].present?\t\n\t \t#Storing user with capital letter on first letter of name and rest downcase.\n\n user_search= params[:search_user].downcase.split(\" \")\n \t\n @users= @users.where(\"first_name ILIKE ? OR last_name ILIKE ? OR last_name ILIKE ?\", \"#{user_search[0]}\", \"#{user_search[1]}\",\"#{user_search[0]}\")\n \n end\n end",
"def index\n @users = User.all\n\n\n end",
"def index\n @users = User.all\n\n\n end",
"def index\n @user_ids = UserId.all\n end",
"def index\n @users = User.search(params[:search], params[:search_type])\n end",
"def index\n #@users = User.all\n end",
"def index\n #@users = User.all\n end",
"def index\n @users=User.all\n end",
"def index\r\n # @users = User.all\r\n end",
"def index\n @user = @current_user\n end",
"def index\n #@users will store all the users available in the table users.\n @users=User.all\n end",
"def index\n @users = User.order(sort_column + \" \" + sort_diection).search(params[:search]).paginate(:per_page => 20, :page => params[:page])\n\n end",
"def index\n \t@all_users = User.all\n end",
"def index\n #@user_groupe_users = UserGroupeUser.all\n end",
"def index\n @users = User.search(params[:query]).order('lower(email) ASC').page(params[:page]).per(50)\n end",
"def index\n @users = User.find(:all)\n end",
"def index\n @users = User.find(:all)\n end",
"def index\n @users = User.find(:all)\n end",
"def reindex_article\n Article.reindex\n end",
"def index\n if @search.nil?\n @search = User.search(params[:search])\n @users = nil\n else\n @search.meta_sort = \"email.asc\" if @search.meta_sort.nil?\n @users = @search.paginate(:page => params[:page])\n end\n end",
"def index\n #@users = User.all\n #@users = User.order(:name).paginate(:page => params[:page], :per_page => 10)\n if params[:search]\n @users = User.search(params[:search])\n else\n #@users = User.order(:name).paginate(:page => params[:page], :per_page => 10)\n @users = User.all.order(:name)\n end\n end",
"def index\n # @users = User.all\n end",
"def index\n # @users = User.all\n end",
"def redirect_to_index\n redirect_to :action => 'index' unless current_user\n @user = current_user\n end",
"def index\n @myusers = Myuser.all\n end",
"def index\n @user_fields = UserField.all\n end",
"def index\n @user_fields = UserField.all\n end",
"def index\n @users = User.all\n \n end",
"def index\n @documents = Document.all\n if current_user.id!=1\n @documents = @documents.select{ |d| d.user == current_user }\n end\n end",
"def index\n @user_types_map = User.user_types.map{|k, v| [k, v.humanize.pluralize]}.to_h\n @filter = params[:filter] || 'Current'\n if @filter == 'All'\n @users = User.order(:email)\n elsif @user_types_map.values.include? @filter\n @users = User.where(locked_out: false, user_type: @user_types_map.key(@filter)).order(:email)\n else\n @users = User.where(locked_out: false).order(:email)\n end\n end",
"def change\n \tenable_extension 'btree_gin'\n \tadd_index :users,[:first_name, :last_name, :email], using: :gin, algorithm: :concurrently\n end",
"def reindex\n Watchable.reindex\n end",
"def index\n @users = User.all.order(:id)\n end",
"def set_user_search\n @user_search = UserSearch.find(params[:id])\n end",
"def index\n @admin_users = Admin::User.all.order(:id => :desc).where(:master => \"true\")\n @q = @admin_users.ransack(params[:q])\n @admin_users = @q.result(distinct: true).page(params[:page]).per(7)\n end"
] | [
"0.6265393",
"0.6084645",
"0.5906952",
"0.58696413",
"0.5845604",
"0.58391255",
"0.57809186",
"0.57809186",
"0.57558084",
"0.57063913",
"0.569151",
"0.56685054",
"0.56460935",
"0.5637015",
"0.56242466",
"0.56186455",
"0.5601047",
"0.55523485",
"0.55472046",
"0.55432546",
"0.5489688",
"0.5485295",
"0.5474022",
"0.54550165",
"0.5454574",
"0.5447319",
"0.54298073",
"0.5413691",
"0.53943217",
"0.53875715",
"0.5380212",
"0.5374685",
"0.53733486",
"0.5372703",
"0.53685445",
"0.5359732",
"0.5359212",
"0.53515315",
"0.5329371",
"0.5309859",
"0.52879494",
"0.5284029",
"0.5277896",
"0.5277896",
"0.5265109",
"0.5253181",
"0.5248626",
"0.5248626",
"0.5241706",
"0.5239767",
"0.52325267",
"0.52325267",
"0.52325267",
"0.52325267",
"0.52325267",
"0.52277535",
"0.5219268",
"0.5208526",
"0.5206888",
"0.52037555",
"0.520229",
"0.5198097",
"0.51947606",
"0.51914495",
"0.51760304",
"0.5173395",
"0.51727486",
"0.51727486",
"0.51663",
"0.5162121",
"0.5161653",
"0.5161653",
"0.51615876",
"0.5155069",
"0.51453084",
"0.51412666",
"0.51383185",
"0.51352876",
"0.51345533",
"0.5133543",
"0.5125019",
"0.5125019",
"0.5125019",
"0.5124386",
"0.51240456",
"0.5123254",
"0.5121867",
"0.5121867",
"0.51180845",
"0.511799",
"0.51136786",
"0.51136786",
"0.51050246",
"0.5101478",
"0.50987947",
"0.5095546",
"0.50947434",
"0.5091822",
"0.5089469",
"0.50869787"
] | 0.8281975 | 0 |
def validate_card_for_payment_detail payment_detail.validate_card if payment_detail end Rating TODO Remove this manual code from here , It is only for testing purpose. | def find_or_create_business_with_current_user(user)
business = Business.find_or_create_by_employee_id_and_employer_id(self.id,user.id)
#business.blank? ? Business.create(:employee_id => self.id, :employer_id =>user.id , :title => 'Test Business') : business
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_card\n\t\tif paypal_express_token.blank? && !credit_card.valid?\n\t\t\tcredit_card.errors.full_messages.each do |message|\n\t\t\t\terrors.add_to_base message\n\t\t\tend\n\t\tend\n\tend",
"def validate_for_card\n tt = self.transaction_type.to_i\n \n # mandatory: transaction_type must != (30, 31, 32, 34, 35)\n append_error(:cc_number, \"cc_number must not be set for tagged transactions\") if [30,31,32,34,35].include?(tt)\n \n # amount, cardholder_name always mandaory\n mandatory = [:amount, :cardholder_name]\n \n # card_number & expiry_date mandatory for all except 50, 54\n # pan mandatory for only 50, 54\n mandatory << ([50,54].include?(tt) ? :pan : [:cc_number, :cc_expiry])\n mandatory.flatten!\n\n # reference_no mandatory for 60\n mandatory << :reference_no if tt == 60\n \n # auth_number mandatory for (02, 03, 11, 12, 13)\n mandatory << :authorization_num if [02, 03, 11, 12, 13].include?(tt)\n \n check_mandatory(mandatory)\n end",
"def validate\n cc = self.credit_card\n cc.validate\n cc.errors.full_messages.each do |e|\n self.errors.add_to_base(e)\n end\n end",
"def validate_card\n unless credit_card.valid?\n credit_card.errors.full_messages.each do |message|\n self.errors.add :base, message\n end\n end\n end",
"def card_detection\n end",
"def process_card(card_data) # card_dat --> hash con toda la informacion de l tarjeta de credito\n\t\toptions = payment_options #options es todo el hash \n\t\toptions[:payer][:payment_method] = \"credit_card\"\n\t\toptions[:payer][:funding_instruments] = [{\n\t\t\tcredit_card: {\n\t\t\t\ttype: CreditCardValidator::Validator.card_type(card_data[:number]), #visa, mastercard\n\t\t\t\tnumber: card_data[:number], #numero de la cuenta\n\t\t\t\texpire_month: card_data[:expire_month],\n\t\t\t\texpire_year: card_data[:expire_year],\n\t\t\t\tcvv2: card_data[:cvv2]\n\t\t\t}\n\t\t}]\n\t\tself.payment = Payment.new(options)\n\t\tself.payment\n\tend",
"def test_card_valid_after_rules_added\n voyager_test_card_number = '869926275400212'\n assert !detector(voyager_test_card_number).valid?\n CreditCardValidations::Detector.add_rule(:voyager, 15, '86')\n assert detector(voyager_test_card_number).valid?\n assert_equal :voyager, detector(voyager_test_card_number).brand\n assert detector(voyager_test_card_number).voyager?\n assert !detector(voyager_test_card_number).visa?\n assert !detector(voyager_test_card_number).mastercard?\n end",
"def paid_with_card?\n payment_type == \"card\"\n end",
"def verify_credit_card\n @credit_card = ActiveMerchant::Billing::CreditCard.new(\n :type => \"visa\",\n :number => \"3024007148673576\",\n :verification_value => \"123\",\n :month => 1,\n :year => Time.now.year+1,\n :first_name => \"Greg\",\n :last_name => \"Barber\"\n )\n\n unless @credit_card.valid?\n @credit_card.errors.full_messages.each do |message|\n # errors.add_to_base message\n $stdout.puts \"777777777777777777777777777777777777\"\n $stdout.puts \"777777777777777777777777777777777777 message: \" + message\n $stdout.puts \"777777777777777777777777777777777777\"\n end\n end\n render :layout => false, :inline => \"Error: credit card is not valid. #{credit_card.errors.full_messages.join('. ')}\"\n end",
"def create\n @payment = Payment.new(params[:payment])\n respond_to do |format|\n if (params[:card_number].blank? || params[:card_month].blank? || params[:card_year].blank? || params[:card_cvc].blank? || params[:card_type].blank? || params[:name].blank? || params[:last_name].blank?)\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :type => 'visa',\n :number => \"4111111111111111\",\n :month => 12,\n :year => 2015,\n :first_name => \"test\",\n :last_name => \"test\",\n :verification_value => 123\n )\n else\n credit_card = ActiveMerchant::Billing::CreditCard.new(\n :type => params[:card_type],\n :number => params[:card_number],\n :month => params[:card_month].to_i,\n :year => params[:card_year].to_i,\n :first_name => params[:name],\n :last_name => params[:last_name],\n :verification_value => params[:card_cvc].to_i\n )\n\n if price > 0 && credit_card.valid?\n #api call\n end\n end\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card\n if request.post?\n # Save information in DB\n # Update attributes of credit card \n @credit_card = CreditCard.new(params[:credit_card])\n @credit_card.type = \"\"\n @credit_card.i_account = $uid\n\n # Override a state\n if params[:state].blank?\n @credit_card.state = \"--\"\n end\n\n # Convert a date expired\n expired_date = params[:expires_date_months].[](0..1).strip.concat(params[:expires_date_years].[](2..3))\n if expired_date.length == 3\n expired_date = \"0\".concat(expired_date)\n end\n\n cc_expired = expired_date.[](0..1) + \"/\" + expired_date.[](2..3)\n @credit_card.cc_expired = cc_expired\n\n # Validation a credit card\n unless @credit_card.valid?\n flash_error = \"<ul>\"\n @credit_card.errors.full_messages.each do |curr_error|\n flash_error << \"<li>\" << curr_error.to_s << \"</li>\"\n end\n flash_error << \"</ul>\"\n\n flash[:error_card] = flash_error\n\n redirect_to :controller => 'subs', :tab => \"subscriber\"\n return false\n end\n\n # Encode values\n @credit_card.first_name = encode_value(@credit_card.first_name).to_s.strip\n @credit_card.last_name = encode_value(@credit_card.last_name).to_s.strip\n @credit_card.cc_number = encode_value(@credit_card.cc_number).to_s.strip\n @credit_card.address = encode_value(@credit_card.address).to_s.strip\n @credit_card.cc_expired = encode_value(@credit_card.cc_expired).to_s.strip\n #@credit_card.address1 = encode_value(@credit_card.address1)\n\n # First, check by Luhn-algoritm\n # Checks cc by luhn alrogithm\n unless check_luhn(params[:credit_card][:cc_number])\n redirect_to :controller => 'subs', :tab => \"subscriber\"\n return false\n end\n\n # Checks, is ip blocked\n unless check_blocked_ip\n redirect_to :controller => 'subs', :tab => \"subscriber\"\n return false\n end\n\n # Checks cc by authorize.net\n unless authorize_net_valid(params[:credit_card])\n redirect_to :controller => 'subs', :tab => \"subscriber\"\n return false\n end\n\n # Clear cvv of credit card\n @credit_card.cvv = \"\"\n\n # Save the credit card\n if @credit_card.save \n # Update a card_id in the Account\n @account.attributes = {:i_cc => @credit_card.i_cc}\n @account.save\n\n # Generate user message\n if @response_code.to_i == 1 && @response_reason_code.to_i == 1\n user_message = \"Billing information changed\"\n else\n user_message = get_user_message(@response_code, @response_reason_code)\n end\n\n # Add transaction\n add_transaction(:i_account => @account.i_account,\n :i_cc => @credit_card.i_cc,\n :type => \"cc_changed\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n\n # Clear session\n session[:count_card_validation] = nil\n\n flash[:notice] = 'Credit card saved successfully'\n\n # Check, if account is blocked, then try to make a purchase and unblock account\n # Find a account\n @account = Account.find($uid)\n\n if @account.active == 0 && ([email protected]_i) > (60*60*24*3)\n bil_circle = @account.i_bilcircle\n @bil_circle = BillingCircle.find_by_i_bilcircle(bil_circle) if bil_circle > 0\n\n # Credit of user\n #credit = (@account.credit > 0) ? @account.credit : 0\n\n @plan = PlanCC.find_by_i_plan(@account.i_plan)\n\n # Count months of subscription\n count_months = (bil_circle == 0) ? 1 : @bil_circle.bilcircle\n # Discount of subscription\n discount = (bil_circle == 0) ? 0 : @bil_circle.discount.to_f/100\n\n # Find a credit card\n @credit_card = CreditCard.find_by_i_cc(@account.i_cc)\n # Result sum of payment\n sum_purchase = (@plan.price*count_months) - (@plan.price*count_months*discount) - @account.credit\n\n if sum_purchase > 0\n # Make a payment\n payment_result = authorize_net_purchase(sum_purchase)\n\n # Generate user message\n if @response_code.to_i == 1 && @response_reason_code.to_i == 1\n user_message = \"Billing information changed\"\n else\n user_message = get_user_message(@response_code, @response_reason_code)\n end\n\n if payment_result\n # Enable account\n @account.active = 1\n @account.credit = 0\n @account.endtime = (count_months.months).since(Time.now) #@account.endtime)\n\n @account.save\n\n add_transaction(:i_account => @account.i_account,\n :i_cc => @credit_card.i_cc,\n :amount => sum_purchase,\n :type => \"payment_received\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :plan => @plan.i_plan,\n :new_plan => @plan.i_plan,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n\n flash[:notice] = 'Credit card saved, account activated'\n else\n add_transaction(:i_account => @account.i_account,\n :i_cc => @credit_card.i_cc,\n :amount => sum_purchase,\n :type => \"payment_failed\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :plan => @plan.i_plan,\n :new_plan => @plan.i_plan,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n\n flash[:error_card] = 'Payment failed'\n end\n else\n # Sum purchase is less than 0\n sum_purchase = (@plan.price*count_months) - (@plan.price*count_months*discount)\n\n # Enable account\n @account.active = 1\n @account.endtime = (count_months.months).since(Time.now) #@account.endtime)\n @account.credit = @account.credit - sum_purchase\n\n @account.save\n\n add_transaction(:i_account => @account.i_account,\n :i_cc => @credit_card.i_cc,\n :amount => sum_purchase,\n :type => \"payment_received\",\n :plan => @plan.i_plan,\n :new_plan => @plan.i_plan,\n :user_message => \"Billing information changed\",\n :ip => request.remote_ip.to_s)\n\n flash[:notice] = 'Credit card saved, account activated'\n end\n end\n else\n flash[:error_card] = @credit_card.errors.full_messages.to_sentence\n end\n\n redirect_to :controller => 'subs', :tab => \"subscriber\"\n else\n redirect_to :controller => 'subs'\n end\n end",
"def credit_card_number_check \n if self.credit_card_number != nil\n if self.credit_card_number.to_s.match(/^4/) and (self.credit_card_number.to_s.length == 16 or self.credit_card_number.to_s.length == 13)\n \"Visa Card\"\n elsif self.credit_card_number.to_s.match(/^5[1-5]/) and (self.credit_card_number.to_s.length == 16)\n \"Master Card\"\n elsif self.credit_card_number.to_s.match(/^6011|65/ ) and (self.credit_card_number.to_s.length == 16)\n \"Discovery Card\"\n elsif self.credit_card_number.to_s.match(/^30[0-5]/) and (self.credit_card_number.to_s.length == 14)\n \"Diners Club\"\n elsif self.credit_card_number.to_s.match(/^3[47]/) and (self.credit_card_number.to_s.length == 15)\n \"Amex\"\n else \n \"credit card number invalid\"\n end \n end \n end",
"def valid_with_credit_card?\n self.valid?\n errors.add(:credit_card, \"can't be blank\") if self.credit_card == \"0\" || \n self.credit_card.blank?\n\n errors.add(:cvv, \"can't be blank\") if self.cvv == \"0\" || \n self.cvv.blank?\n\n self.expiration_date = DateTime.new(self.card_year.to_i, self.card_month.to_i).end_of_month\n\n errors.add(:expiration_date, \"can't be in past\") if self.expiration_date < Time.now\n\n end",
"def enter_credit_card_info (credit_card_type, credit_card_number, exp_month, exp_year, sec_code)\n if credit_card_type != \"PowerUp Rewards Credit Card\"\n chkout_credit_card_selector.value = credit_card_type\n chkout_credit_card_number_field.value = credit_card_number\n chkout_credit_card_month_selector.value = exp_month\n chkout_credit_card_year_selector.value = exp_year\n chkout_security_code_number_field.value = sec_code\n else\n chkout_credit_card_selector.value = credit_card_type\n chkout_credit_card_number_field.value = credit_card_number\n chkout_credit_card_month_selector.is_visible.should be_false\n chkout_credit_card_year_selector.is_visible.should be_false\n chkout_security_code_number_field.is_visible.should be_false\n end\n\n end",
"def paid_with_card?\n order.payment_method == 'credit_card'\n end",
"def credit_card?\n (payment_method == CREDIT_CARD)\n end",
"def credit_card_type; end",
"def cards_validation\n if cards.any?(&:invalid?)\n errors[:base] << 'Wallet has an invalid card'\n end\n end",
"def card\n false\n end",
"def check(payment)\n retval\n end",
"def valid?\n p = build_payment\n p.valid?\n end",
"def credit_card_format\n # check format\n return true if self.credit_card_type.to_s.empty?\n format = CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:format]\n format_range = CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:format_range]\n unless format.nil?\n unless self.credit_card_number.start_with?(*format)\n return errors.add(:credit_card_number, build_error_msg(format, format_range))\n end\n end\n\n unless format_range.nil?\n format_range.each do |index|\n range = (index[:from]..index[:to]).to_a\n if !self.credit_card_number.start_with?(*range) && !self.credit_card_number.start_with?(*format)\n return errors.add(:credit_card_number, build_error_msg(format, format_range))\n end\n end\n end\n\n # check length\n unless CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:length].nil?\n if self.credit_card_number.length != CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:length]\n return errors.add(:credit_card_number, \"^#{self.credit_card_type} card must have\n #{CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:length]} digits\")\n end\n else\n unless self.credit_card_number.length.between?(CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:min_length],\n CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:max_length])\n return errors.add(:credit_card_number, \"^#{self.credit_card_type} card must have\n #{CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:min_length]}\n - #{CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:max_length]} digits\")\n end\n end\n\n # check cvv\n unless CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:cvv_length].nil?\n if self.credit_card_cvv.length != CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:cvv_length]\n return errors.add(:credit_card_number, \"^#{self.credit_card_type} card CVV must have\n #{CARD_TYPE_NUMBER_FORMAT[self.credit_card_type][:cvv_length]} digits\")\n end\n end\n\n end",
"def valid?\n return false if @payment_amount.nil?\n return false if @payment_amount > 99999999.99\n return false if @payment_amount < 0\n return false if @payer.nil?\n payment_format_validator = EnumAttributeValidator.new('String', ['CCD', 'CCP', 'CTX', 'PPD', 'PPP', 'TEL', 'WEB'])\n return false unless payment_format_validator.valid?(@payment_format)\n return false if !@payment_currency.nil? && @payment_currency.to_s.length > 3\n return false if !@payment_currency.nil? && @payment_currency.to_s.length < 3\n return false if @payee.nil?\n return false if @payment_id.nil?\n return false if @payment_id.to_s.length > 15\n return false if @payment_id.to_s.length < 1\n return false if !@payment_description.nil? && @payment_description.to_s.length > 80\n return false if !@payment_description.nil? && @payment_description.to_s.length < 1\n return false if @debit_credit_indicator.nil?\n debit_credit_indicator_validator = EnumAttributeValidator.new('String', ['C', 'D'])\n return false unless debit_credit_indicator_validator.valid?(@debit_credit_indicator)\n return false if @payment_method.nil?\n return false if @payment_method.to_s.length > 35\n return false if @payment_method.to_s.length < 1\n true\n end",
"def check_card\n\t\tsplit_cc = @cc.to_s.split(\"\")\n\n# -- Convert string to an array of integers\n\t\t\tl = split_cc.length - 1\n\t\tfor num in 0..l\n\t\t\t@split_cc_integers << split_cc[num].to_i\n\t\tend\n\n# -- Now we split the original array of integers into two arrays of even indices and odd indices \n\t\tl_half = l/2\n\n\n# ------ EVENS -------\n\t\tfor num in 0..l_half\n\t\t\tevens = 2*num + 1\n\t\t\t@even_cc_integers << @split_cc_integers[evens]\n\t\tend\n\n\t\ttotal_of_evens = @even_cc_integers.each {|x| \n\t\t\t@sum_evens = @sum_evens + x\n\t\t\t}\n\n# ------ ODDS -------\n\t\tfor num in 0..l_half\n\t\t\todds = 2*num\n\t\t\t@odd_cc_integers << @split_cc_integers[odds]\n\t\tend\n\n\t\t@odd_cc_integers.each {|odd|\n\t\todd = 2*odd\n\t\tif odd < 10\n\t\t\t@modified_results_from_odd_cc_integers << odd\n\t\telse\n\t\t\ttens = odd/10\n\t\t\t@modified_results_from_odd_cc_integers << tens\n\t\t\tones = odd%10\n\t\t\t@modified_results_from_odd_cc_integers << ones\n\t\tend\n\t\t\t}\n\n\t\ttotal_of_odds = @modified_results_from_odd_cc_integers.each {|odd| \n\t\t\t@sum_odds = @sum_odds + odd\n\t\t\t}\n\n# ------ ODDS DONE -------\n# ------ Validation DONE -------\n\t\tgrand_total = @sum_evens + @sum_odds\n\n\t\tif grand_total%10 == 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def store_credit_card?\n paid?\n end",
"def validate\n #errors.add(:cc_number, \"There appears to be a typo in your Credit Card number.<br/>Please re-enter your card number.<br/> If you continue to have trouble, please <a url='/contactus.htm'>Contact Us.</a>\") unless cc_number.creditcard?\n today = DateTime.now\n #if (today.month > self.expiration_month && today.year >= self.expiration_year)\n #\terrors.add(:expiration_month, 'Please enter a valid expiration date.')\n #end\n\n # Add errors for credit card accounts\n #if (credit_card_payment? && self.cc_number.blank?)\n # errors.add(:cc_number, ERROR_EMPTY)\n #end\n end",
"def get_card\n end",
"def check_card\n @card = Card.where(uid: params[:card], user_id: nil).first\n if @card\n head :ok\n else\n head :forbidden\n end\n end",
"def get_credit_card\n end",
"def is_valid?(card)\n\n return true if (card.version == '3.0' && card.scope == Client::Card::GLOBAL)\n\n if (card.nil? || !card.is_a?(Card) || card.snapshot.nil? || (card.signatures.nil? || card.signatures.empty?))\n return false\n end\n\n # add self signature verifier\n fingerprint = self.crypto.calculate_fingerprint(\n Crypto::Bytes.from_string(card.snapshot)\n )\n fingerprint_hex = fingerprint.to_hex\n return false if fingerprint_hex != card.id\n\n verifiers = self.verifiers.clone\n card_public_key = self.crypto.import_public_key(card.public_key)\n verifiers[fingerprint_hex] = card_public_key\n\n verifiers.each do |id, key|\n unless card.signatures.has_key?(id)\n return false\n end\n is_valid = self.crypto.verify(\n fingerprint.value,\n Crypto::Bytes.from_base64(card.signatures[id]),\n key\n )\n return false unless is_valid\n end\n true\n end",
"def parse_card(params)\n ActiveMerchant::Billing::CreditCard.new(:number => params[:card_number],\n :verification_value => params[:card_code],\n :month => params[:card_month], \n :year => params[:card_year], \n :first_name => params[:first_name],\n :last_name => params[:last_name]) \n end",
"def create_the_payment_exhibition\n if((params[:invoicing_info][:payment_medium] == \"visa\") or (params[:invoicing_info][:payment_medium] == \"paypal\") or (params[:invoicing_info][:payment_medium] == \"master_card\")) \n credit_card = CreditCard.find_by_user_id(current_user.id)\n if credit_card.blank?\n credit_card = CreditCard.new()\n end\n credit_card.number = params[:credit_card][:number0]+params[:credit_card][:number1]+params[:credit_card][:number2]+params[:credit_card][:number3]+params[:credit_card][:number4]+params[:credit_card][:number5]+params[:credit_card][:number6]+params[:credit_card][:number7]+params[:credit_card][:number8]+params[:credit_card][:number9]+params[:credit_card][:number10]+params[:credit_card][:number11]+params[:credit_card][:number12]+params[:credit_card][:number13]+params[:credit_card][:number14]+params[:credit_card][:number15]\n credit_card.user_id = current_user.id\n credit_card.first_name = params[:credit_card][:first_name]\n credit_card.last_name = params[:credit_card][:last_name]\n credit_card.expiring_date = Date.civil(params[:credit_card][\"expiring_date(1i)\"].to_i,params[:credit_card][\"expiring_date(2i)\"].to_i,params[:credit_card][\"expiring_date(3i)\"].to_i).strftime(\"%y-%m-%d\") \n credit_card.save\n else\n end \n creditcardnumber = params[:credit_card][:number0]+params[:credit_card][:number1]+params[:credit_card][:number2]+params[:credit_card][:number3]+params[:credit_card][:number4]+params[:credit_card][:number5]+params[:credit_card][:number6]+params[:credit_card][:number7]+params[:credit_card][:number8]+params[:credit_card][:number9]+params[:credit_card][:number10]+params[:credit_card][:number11]+params[:credit_card][:number12]+params[:credit_card][:number13]+params[:credit_card][:number14]+params[:credit_card][:number15]\n #######################################this is im copying here is something from payment controller create method\n @order = session[:purchasable] \n if @order.blank?\n render :text =>\"Please Refresh The Page And Try Again\"\n return\n else \n @order.save\n current_user.profile.biography = params[:biography]\n current_user.profile.save\n end\n @current_object = Payment.new(params[:payment])\t\t#@invoice = session[:invoice]\t\t\n \n if @order.instance_of? ExhibitionsUser\n @current_object.amount_in_cents =params[:invoice_amount].to_i*100\n elsif @order.instance_of? CompetitionsUser\n @current_object.amount_in_cents = (@order.find_price(@order.competition.id) ) * 100\n else \n end\n @current_object.user = @current_user\t\t#@current_object.invoice = @invoice\n if @order.instance_of? ExhibitionsUser\n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master_card\" \n @current_object.common_wealth_bank_process((params[:invoice_amount].to_i*100),params,creditcardnumber)\n \n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\" \n #@current_object.make_paypal_payment((params[:invoice_amount].to_i),params) \n session[:paypal_amount] = params[:invoice_amount].to_i*100\n set_the_token#from here i need to redirect him to paypal after getting the token\n session[:invoice_id] = params[:invoice_id]\n session[:order] = @order\n session[:exhibition_id] = @order.exhibition.id\n session[:current_object_id] = @current_object\n render :update do |page|\n page[\"modal_space_answer\"].hide \n page[\"paypal_form\"].replace_html :partial=>\"paypal_form\",:locals=>{:token =>@token,:amt=>params[:invoice_amount].to_i}\n page.call 'submit_my_form'\n end\n return\n end\n elsif @order.instance_of? CompetitionsUser\n if @order.invoices.last \n total_amount = 0\n @order.invoices.each {|x| total_amount = total_amount + x.final_amount}\n if total_amount < @order.find_price(@order.competition.id) \n more_amount = (@order.find_price(@order.competition.id) ) - total_amount\n @current_object.amount_in_cents = more_amount * 100\n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master card\" \n @current_object.common_wealth_bank_process((more_amount * 100),params)\n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\" \n @current_object.make_paypal_payment((more_amount * 100),params) \n end\n else\n render :text=>\"You Did not changed the entry field or if you decremented it then send email to admin \"\n return\n end \n else\n if params[:invoicing_info][:payment_medium] == \"visa\" or params[:invoicing_info][:payment_medium] == \"master card\" \n @current_object.common_wealth_bank_process(((@order.find_price(@order.competition.id) ) * 100),params)#payment is done if invoice is not yet created. for competition user\n elsif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n elsif params[:invoicing_info][:payment_medium] == \"paypal\" \n @current_object.make_paypal_payment(((@order.find_price(@order.competition.id) ) * 100),params) \n end \n end \n else #here it may be come that while working in this method and it fails somewhere and session[:purchasable] = nil. generaly this is not the normal case\n if @order.instance_of? Order\n make_order_payment\n return\n else\n render :text=>\"There Is Internal Error While Making the payment Please Try Go Back And Try Again<a href='/admin/profiles/#{current_user.id}'>Back</a> \"\n end\n return\n end#bank procedure if end\n\t\t#here after the payment is done what message is required to be sent is get decided and the invoice is get generated\n if @current_object.state == 'online_validated'\t # flash[:notice] = 'Your Payment Is Done And Invoice Will Be Sent To You By Email'\n if @order.instance_of? CompetitionsUser \n if @order and @order.invoices.last\n total_amount = 0\n @order.invoices.each {|x| total_amount = total_amount + x.final_amount}\n if total_amount < @order.find_price(@order.competition.id) \n make_the_payment\n render :partial=>\"extra_payment_done\",:locals=>{:competition=>@order.competition,:order=>@order} \n return \n else\n # flash[:error] = \"Your Payment Is Already Done Please Go To Home Page <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n end\n render :text => @template.blank_main_div(:title => 'System error', :hsize => 'sixH', :modal => true), :layout => false\n return\n else \n make_the_payment\n end\n else\n if @order.instance_of? ExhibitionsUser \n make_the_payment_exhibition\n end\n end \n if @order.instance_of? ExhibitionsUser \n \n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. <a href='/admin/exhibitions/#{@order.exhibition.id}'>Select Artwork</a>\"\n else\n invoice = Invoice.find(:last,:conditions=>[\"purchasable_type = ? and client_id = ? and purchasable_id = ?\",\"ExhibitionsUser\" , @order.user,@order.id])\n \n if invoice.state == \"created\"\n alreadypaidamt = @order.price - invoice.final_amount\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n create_pdf(invoice.id,invoice.number,@order.exhibition.timing.starting_date.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,@order.price.to_i,note,@order.price - alreadypaidamt,alreadypaidamt,true,@order.exhibition.timing.ending_date,\"\")\n QueuedMail.add('UserMailer','send_invoice_exhibition',[@current_object.user.profile.email_address,\"invoice#{invoice.id}\",\"Your Exhibition Payment Is Done And An Invoice Is Sent to Your Email.\",invoice, @current_object.user],0,true,@current_object.user.profile.email_address,\"[email protected]\") \n end \n \n #render :text=>\"Your Payment Is Done Now Upload And Then Select The Artworks <a href='/admin/exhibitions/#{@order.exhibition.id}'>Select Artwork</a>\"\n #render :partial => \"online_response_exhibition_payment\",:locals=>{:exhibition_user_id=>@order.id,:artwork_count=>0}\n add_exhibition_artwork_insamediv\n\t\t\t \n end \n elsif @order.instance_of? CompetitionsUser\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n #render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. Please Make The Payment Before #{@order.submission_date} <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n render :partial=> \"cash_cheque_response\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order_id=>@order.id,:total_entry=>@order.total_entry}\n else\n #session[:total_entry] = @order.total_entry\n #render :update do |page|\n # session[:store_for_submitting_the_artwork] = @order.id\n #page[\"show_me_the_error\"].replace_html :partial=>\"add_artwork_link\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order_id=>@order.id}\n #end\n render :partial=>\"add_artwork_link\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order_id=>@order.id}\n #render :text=>\"Your Payment Is Done . The Invoice Is Sent To You By Email. <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n end \t \n end\n else\n if params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\" or params[:invoicing_info][:payment_medium] == \"direct deposit\"\n if @order.instance_of? CompetitionsUser\n make_the_payment\n else\n make_the_payment_exhibition\n invoice = Invoice.find(:last,:conditions=>[\"purchasable_type = ? and client_id = ? and purchasable_id = ?\",\"ExhibitionsUser\" , @order.user,@order.id])\n if invoice.state == \"created\"\n note = \"no notes created\"\n note = @order.exhibition.timing.note if @order.exhibition.timing\n senttime \n if invoice.sent_at\n senttime = invoice.sent_at.strftime(\"%d %b %Y\")\n else\n senttime = Time.now.strftime(\"%d %b %Y\")\n end\n \n \n create_pdf(invoice.id,invoice.number,senttime,invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,note)\n \n QueuedMail.add('UserMailer', 'send_invoice_exhibition', [invoice, @order.user], 0, true)\n end \n end \n if @order.instance_of? CompetitionsUser \n # render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. Please Make The Payment Before #{@order.competition.submission_deadline} <a href='/admin/competitions/#{@order.competition.id}'>Go Back To see the competition</a>\"\n render :partial=> \"cash_cheque_response\",:locals=>{:competition_id=>@order.competition.id,:artwork_count=>0,:order=>@order,:total_entry=>@order.total_entry}\n return \n else\n #exhibition cash_cheque_response\n # render :partial => \"cash_cheque_response_exhibition\",:locals=>{:exhibition_user_id=>@order.id,:artwork_count=>0}\n #instead of this response i need to give the option to add the artwork to user\n \n render :update do |page|\n page[\"add_the_artwork0\"].replace_html :partial=>\"add_the_artwork_exhibition\",:locals=>{:exhibition_user_id => @order.id,:exhibition_id=>@order.exhibition.id,:messageforimageuploaded=>\"After Your Payment Is Done Admin Will Validate You. Please Upload The Artwork\"}\n page[\"description_competition_ex_py\"].hide\n page[\"enterartworkcompetition\"].show\n page[\"add_the_artwork0\"].show\n page[\"iteam_image0\"].show\n page[\"iteam_image_uploaded\"].hide\n \n end\n #render :text=>\"After Your Payment Is Done Admin Will Validate You. After That Your Artwork Will Be Selected. <a href='admin/exhibitions/#{@order.exhibition.id}'>Select Artwork</a>\"\n end \t \n return\n end\n\t \n #flash[:error] = 'Error during the payment save '+@current_object.state.to_s\n\t \n #render :partial => 'new', :layout => false\n render :text=>\"Your payment has not been successful. Please check your details and try again\"\n end\n\n end",
"def authorize_recurring_and_store_card_details(encrypted_card, options = {})\n @authorize_response = authorize_with_encrypted_card(encrypted_card, options)\n @authorize_response.success? && store_credit_card_details\n end",
"def prepare_credit_card\n @card = ActiveMerchant::Billing::CreditCard.new({\n :number => card_number,\n :month => card_month,\n :year => card_year,\n :first_name => card_first_name,\n :last_name => card_last_name,\n :verification_value => card_verification,\n :type => card_type\n })\n \n if @card.valid?\n @result[:card] = true\n else\n @result[:card] = false\n end\n @result[:card]\n end",
"def charge_credit_card(amount)\n true\n end",
"def charge_credit_card(amount)\n true\n end",
"def check_card\n\t\tsplit_cc = @cc.to_s.split(\"\")\n\n# -- Convert string to an array of integers\n\t\t\tl = split_cc.length - 1\n\t\tfor num in 0..l\n\t\t\t@split_cc_integers << split_cc[num].to_i\n\t\tend\n\n# -- Now we split the original array of integers into two arrays of even indices and odd indices \n\t\tl_half = l/2\n\n\n# ------ EVENS -------\n\t\tfor num in 0..l_half\n\t\t\tevens = 2*num + 1\n\t\t\t@even_cc_integers << @split_cc_integers[evens]\n\t\tend\n\n\t\ttotal_of_evens = @even_cc_integers.each {|x| \n\t\t\t@sum_evens = @sum_evens + x\n\t\t\t}\n\n# ------ ODDS -------\n\t\tfor num in 0..l_half\n\t\t\todds = 2*num\n\t\t\t@odd_cc_integers << @split_cc_integers[odds]\n\t\tend\n\n\t\t@odd_cc_integers.each {|odd|\n\t\todd = 2*odd\n\t\tif odd < 10\n\t\t\t@modified_results_from_odd_cc_integers << odd\n\t\telse\n\t\t\ttens = odd/10\n\t\t\t@modified_results_from_odd_cc_integers << tens\n\t\t\tones = odd%10\n\t\t\t@modified_results_from_odd_cc_integers << ones\n\t\tend\n\t\t\t}\n\n\t\ttotal_of_odds = @modified_results_from_odd_cc_integers.each {|odd| \n\t\t\t@sum_odds = @sum_odds + odd\n\t\t\t}\n\n# ------ ODDS DONE -------\n# ------ Validation DONE -------\n\t\tgrand_total = @sum_evens + @sum_odds\n\n\t\tif grand_total%10 == 0\n x = \"valid\"\n puts \"This is a #{x} number!\"\n\t\t\treturn true\n\t\telse\n y = \"invalid\"\n puts \"This is an #{y} number!\"\n\t\t\treturn false\n\t\tend\n\tend",
"def valid?\r\n card_sum = compare_num.sum\r\n if \r\n card_sum % 10 == 0\r\n true\r\n else\r\n false\r\n end\r\n end",
"def card_status\n \n if params[:sender_phone_no].blank? or params[:card_id].blank?\n flash[:notice] = \"Card ID and Contact No should not be blank\"\n redirect_to :action => \"view_status\"\n else\n @card = CardDetail.find_by_card_id(params[:card_id])\n @phone_no = params[:sender_phone_no].to_i\n \n\t if @card.blank?\n\t\t flash[:notice] = \"Invalid Card ID\"\n\t\t redirect_to :action => \"view_status\"\n\t \n\t elsif (@card.sender_phone_no == @phone_no)\n\t\t @card = CardDetail.find_by_card_id(params[:card_id]) \n\t\t flash[:notice] = \"your card status\"\n\n\t elsif (@card.sender_phone_no != @phone_no)\n\t\t flash[:notice] = \"Invalid Card ID or Contact No\"\n\t\t redirect_to :action => \"view_status\" \n\n\t end #if card.blank?\n\n end #if params[:sender_phone_no].blank? or params[:card_id].blank?\n \n end",
"def hit?(card_total)\n # code hit? here\n\n \nend",
"def get_card\n @card ||= @user.get_valid_card\n end",
"def credit_card_needed?\n credit_card_required?\n end",
"def clean_card\n @card.fail_count = 0\n @card.review_count = 1\n @card.set_review_date\n end",
"def process_payment\n\n raise 'invalid credit card' unless @credit_card && @credit_card.valid?\n \n gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(\n :login => LOGIN_ID,\n :password => TRANSACTION_KEY\n )\n\n description = \"Concerts in the Clearing\"\n if reservation\n description += \"/Tickets, #{reservation.concert.name}\"\n end\n\n response = gateway.purchase((amount * 100).to_i, @credit_card, name_and_address.merge({:description => description}))\n return [true, response.authorization] if response.success?\n return [false, response.message]\n \n end",
"def create\n @card = check_params_and_create(params)\n\n if @card != nil\n render json: {\n :api_key => @card.api_key ,\n :barcode => @card.cardnumber,\n :is_active => @card.is_active,\n :current_balance => @card.balance,\n :balance_total => @card.balance_total,\n :max_balance => @card.program.punch_card}, status:201\n else\n render json: \"Kan de stempelkaart niet aanmaken!\", status:409\n end #@card != nil\n\n end",
"def valid_card_number\n return if self.number.blank? or not self.member\n return if self.club && self.club.uses_citylife?\n\n # Only check the rules of current cards\n if self.academic_year == Member.current_academic_year\n range = self.member.club.card_range_for self.card_type\n if !range.include?(self.number)\n errors.add(:number, \"valt niet in het toegekende bereik\")\n end\n end\n end",
"def verify_card\n\n\t\tcard = ScratchCard.find_by hidden_number: params[:hidden_number]\n\n\t\tif ScratchCard.verify(params[:hidden_number])\n\t\t\tsign_in_card(card)\n\t\t\tflash.now[:success] = \"card sucessfully verified. You can place your bets!\"\n\t\t\t\n\t\telse\n\t\t\tflash.now[:success] = \"card sucessfully verified. You can place your bets!\"\n\n\t\t \n\t end\n\t redirect_to action: 'index', controller: 'betting'\n\tend",
"def existing_card\n @rate = Rate.find(1)\n @card = CardDetail.find_by_card_id(session[:card_no])\n @card.sender_name = params[:card][:sender_name]\n @card.sender_address = params[:card][:sender_address]\n @card.sender_city = params[:card][:sender_city]\n @card.sender_pincode = params[:card][:sender_pincode]\n @card.sender_state = params[:card][:sender_state]\n @card.sender_phone_no = params[:card][:sender_phone_no]\n @card.sender_email = params[:card][:sender_email]\n @card.receiver_name = params[:card][:receiver_name]\n @card.receiver_address = params[:card][:receiver_address]\n @card.receiver_city = params[:card][:receiver_city]\n @card.receiver_pincode = params[:card][:receiver_pincode]\n @card.receiver_state = params[:card][:receiver_state]\n @card.receiver_phone_no = params[:card][:receiver_phone_no]\n @card.card_type = params[:type]\n @card.status = \"Received\"\n \n if params[:type] == \"ordinary\"\n @cost = @rate.ordinary_post\n @card.rate = @rate.ordinary_post\n @card.amount = @rate.ordinary_post\n @card.weight = 0\n else\n @cost = @rate.speed_post\n @card.weight = params[:card][:weight]\n @card.rate = @rate.speed_post \n @card.amount = @card.rate * @card.weight \n end #if params[:type] == \"ordinary\"\n\n if @card.save\n flash[:notice] = \"Changes Saved Successfully\"\n redirect_to :action => \"entry\" , :id => session[:card_no]\n else\n flash[:notice] = \"Changes not Saved\"\n end # if @card.save\n \n end",
"def payment_type\n :credit_card\n end",
"def isCreditCard(payload)\n cardNo = getCreditCard(payload)\n if cardNo.nil? # indicates no card found\n return false\n else\n return true\n end\nend",
"def create\n @card_number = CardNumber.new(params[:card_number])\n length = @card_number.number.size\n if length == 15 && @card_number.number =~ /^(34|37)/\n @card_number.card_type = \"American Express\"\n elsif length == 16 && @card_number.number =~ /^6011/\n @card_number.card_type = \"Discover\"\n elsif length == 16 && @card_number.number =~ /^5[1-5]/\n @card_number.card_type = \"MasterCard\"\n elsif (length == 13 || length == 16) && @card_number.number =~ /^4/\n @card_number.card_type = \"Visa\"\n elsif length == 14 && @card_number.number =~ /^30[0-5]|36|38|/\n @card_number.card_type = \"Diners\"\n else\n @card_number.card_type = \"Unknown\"\n end \n respond_to do |format|\n if @card_number.save\n format.html { redirect_to @card_number, notice: 'Broj kartice je uspjesno spremljen u bazu.' }\n format.json { render json: @card_number, status: :created, location: @card_number }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_credit_card(credit_card, billing_address = nil)\n add_credit_card_form.card_number_input.set credit_card[:card_number]\n add_credit_card_form.name_on_card_input.set credit_card[:card_name]\n\n # display expiration month option\n page.execute_script(\"$('#vin_PaymentMethod_creditCard_expirationDate_Month').css('display','block')\")\n add_credit_card_form.expiration_month_opt.select credit_card[:exp_month]\n\n # display expiration year option\n page.execute_script(\"$('#vin_PaymentMethod_creditCard_expirationDate_Year').css('display','block')\")\n add_credit_card_form.expiration_year_opt.select credit_card[:exp_year]\n\n add_credit_card_form.security_code_input.set credit_card[:security_code]\n\n if billing_address.nil?\n if add_credit_card_form.has_shipping_checked_chk?\n add_credit_card_form.use_shipping_address_chk.click\n else\n add_credit_card_form.use_shipping_address_as_billing_address.click\n end\n else\n fill_billing_address(billing_address)\n end\n\n # submit info\n add_credit_card_form.continue_btn.click\n\n AtgCheckOutReviewPage.new\n end",
"def valid_credit_card?(num)\r\n# Split the string into an array so we can work with each digit\r\n# Reverse the string so we can double every other number\r\n\tcard = num.split(//).reverse.each_with_index.map do |num, index| \r\n\t\tif index % 2 != 0 then\r\n\t\t\tnum.to_i * 2\r\n\t\telse\r\n\t\t\tnum.to_i\r\n\t\tend\r\n\tend\t\r\n\r\n# There must be a better way to do this, but the idea is to turn the array into a string\r\n# and back into an array to turn the double digit numbers into single digits.. /sigh\r\n\tcard.to_s\r\n\t.gsub(/,/,'')\r\n\t.gsub(/\\[/,'')\r\n\t.gsub(/\\]/,'')\r\n\t.gsub(/ /,'')\r\n\t.split('')\r\n\t.map {|i| i.to_i}\r\n\t.reduce(:+) % 10 == 0\r\nend",
"def validate_card(card)\n\n rank = [2,3,4,5,6,7,8,9,10,11,12,13,14]\n name = ['2','3','4','5','6','7','8','9','10','Jack','Queen','King','Ace']\n suit = [:heart, :diamond, :spade, :club]\n\n suit.each do |suit|\n rank.each_with_index do |rank, nam|\n temp = [name[nam], suit, rank]\n @valid_cards << temp\n end\n end\n #require 'pry' ; binding.pry\n @valid_cards.index(card).nil?\n end",
"def test_successful_authorize_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, false)\n end",
"def payment_type\n :credit_card\n end",
"def validate_payer_and_its_related_attributes\r\n result = true\r\n error_message = nil\r\n if !params[:payer].blank?\r\n payer_address_fields = {\r\n :address_one => params[:payer][:pay_address_one].to_s.strip,\r\n :city => params[:payer][:payer_city].to_s.strip,\r\n :state => params[:payer][:payer_state].to_s.strip,\r\n :zip_code => params[:payer][:payer_zip].to_s.strip\r\n }\r\n end\r\n if !params[:micr_line_information].blank?\r\n routing_number = params[:micr_line_information][:aba_routing_number]\r\n account_number = params[:micr_line_information][:payer_account_number]\r\n end\r\n \r\n result, error_message = validate_payer_address(payer_address_fields)\r\n logger.debug \"validate_payer_address result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = @payer.validate_payer_id(params[:payer][:payid])\r\n logger.debug \"validate_payer_id result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = @payer.validate_against_payer_duplication(params[:payer],\r\n params[:id], params[:micr_line_information])\r\n if !error_message.blank?\r\n @do_not_save_micr = true\r\n end\r\n logger.debug \"validate_against_payer_duplication result : #{result}\"\r\n message = error_message if result\r\n return result, error_message if not result\r\n \r\n result, error_message = @payer.validate_unique_payer_for_micr(routing_number, account_number)\r\n logger.debug \"validate_unique_payer_for_micr result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = @payer.validate_presence_of_eobs_when_payer_type_changes(params[:payer][:payer_type])\r\n logger.debug \"validate_presence_of_eobs_when_payer_type_changes result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = validate_client_id(params[:facilities_micr_information],\r\n params[:serial_numbers_for_adding_onbase_name])\r\n logger.debug \"validate_client_id for Onbase Name result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = validate_client_id(params[:facilities_payers_information],\r\n params[:serial_numbers_for_adding_output_payid])\r\n logger.debug \"validate_client_id for Output Payid result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = validate_footnote_indicator_for_assigning_set_name\r\n logger.debug \"validate_footnote_indicator_for_assigning_set_name result : #{result}\"\r\n return result, error_message if not result\r\n\r\n result, error_message = validate_payment_and_allowance_and_capitation_codes\r\n logger.debug \"validate_payment_and_allowance_and_capitation_codes result : #{result}\"\r\n return result, error_message if not result\r\n \r\n error_message = message.to_s + error_message.to_s\r\n return result, error_message\r\n end",
"def create\n @request = CardDetail.new.verify_transaction(params[:trxref]).parsed_response\n\n @user = User.find_by_email(@request['data']['customer']['email'])\n\n @card_detail = CardDetail.new(auth_code: @request['data']['authorization']['authorization_code'],\n bin: @request['data']['authorization']['bin'],\n last_four: @request['data']['authorization']['last4'],\n bank: @request['data']['authorization']['bank'],\n brand: @request['data']['authorization']['brand'],\n country_code: @request['data']['authorization']['country_code'],\n user: @user)\n respond_to do |format|\n if @card_detail.save\n format.html { redirect_to user_card_details_path(@user.id), notice: 'Card detail was successfully created.' }\n format.json { render json: request.headers['Content-Type'], head: :ok }\n else\n format.html { render :new }\n format.json { render json: @card_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def card\n @data[:credit_card]\n end",
"def validateCard(card_str)\n\tcard_str = card_str.gsub(/[^0-9]/, \"\")\n\n\tdigits = card_str.split(\"\").map(&:to_i)\n\tchecksum = digits.pop # chop off last digit, store as checksum\n\tdigits << 0 # Add back in a zero for balanced calculations\n\n\tsum = 0\n\tdigits.each_slice 2 do |pair|\n\t\tdouble = pair.first * 2\n\t\tsum += (double >= 10) ? (double % 10 + 1) : double\n\t\tsum += pair.last\n\tend\n\n\t(sum * 9) % 10 == checksum \n\nend",
"def credit_card_number; end",
"def guard_process_payment_from_created; true; end",
"def guard_process_payment_from_created; true; end",
"def save_and_charge\n # Check our data if it's valid\n if self.valid?\n #If if it's valid, charge\n Stripe::Charge.create(amount: self.total_price, currency: \"USD\", source: self.stripe_token, description: \"Order for #{self.email}\")\n\n self.save\n\n else\n false # Not valid, show error\n end\n\n rescue Stripe::CardError => e\n # This is coming from stripe documentation\n @message = e.json_body[:error][:message]\n\n # Beside validation errors, we can create our own errors\n self.errors.add(:stripe_token, @message)\n\n # Return false to our controller\n false\n\n end",
"def payment_profile(user, params)\n resp = Caboose::StdClass.new('success' => true) \n response = nil\n \n card_num = params[:credit_card][:number]\n user.card_brand = 'Amex' if card_num.starts_with?('3') \n user.card_brand = 'Visa' if card_num.starts_with?('4') \n user.card_brand = 'MasterCard' if card_num.starts_with?('5') \n user.card_brand = 'Discover' if card_num.starts_with?('6011')\n user.save\n \n # Make sure the customer profile exists \n if user.authnet_customer_profile_id.nil? \n response = self.customer_profile(user)\n if !response.success\n user.authnet_customer_profile_id = nil\n user.authnet_payment_profile_id = nil\n user.save\n resp.error = \"Error creating customer profile.\"\n else\n user.authnet_payment_profile_id = nil\n user.save\n end\n end\n \n # Now see if the payment profile exists\n if user.authnet_customer_profile_id && user.authnet_payment_profile_id\n options = payment_profile_options(user, params)\n options[:payment_profile][:customer_payment_profile_id] = user.authnet_payment_profile_id\n response = self.gateway.update_customer_payment_profile(options) \n if response.success?\n user.authnet_payment_profile_id = response.params['customer_payment_profile_id'] \n user.save \n resp.success = true\n elsif response.message == 'ProfileID is invalid.'\n user.authnet_customer_profile_id = nil\n user.authnet_payment_profile_id = nil\n user.save\n resp.error = \"Invalid customer profile ID. Please submit again.\"\n elsif response.message == \"The credit card number is invalid.\"\n resp.error = \"The credit card number is invalid.\"\n elsif response.message == \"This transaction has been declined.\" \n resp.error = \"We couldn't validate the credit card information.\"\n elsif response.message == \"A duplicate transaction has been submitted.\" # The user submitted the same information within two minutes \n resp.error = \"We couldn't validate the credit card information.\"\n else \n puts \"==================================================================\"\n puts \"Response from gateway.update_customer_payment_profile(#{options})\"\n puts \"\"\n puts response.message\n puts \"\"\n puts response.inspect\n puts \"==================================================================\"\n user.authnet_payment_profile_id = nil\n user.save \n end\n end\n \n if user.authnet_customer_profile_id && user.authnet_payment_profile_id.nil?\n options = payment_profile_options(user, params)\n response = self.gateway.create_customer_payment_profile(options) \n if response.success? \n user.authnet_payment_profile_id = response.params['customer_payment_profile_id'] \n user.save\n resp.success = true \n elsif response.message == \"A duplicate customer payment profile already exists.\"\n response = self.gateway.get_customer_profile({ :customer_profile_id => user.authnet_customer_profile_id }) \n if response.success?\n arr = response.params['profile']['payment_profiles']\n arr = [arr] if arr.is_a?(Hash)\n arr.each do |h|\n if h['payment'] && h['payment']['credit_card'] && h['payment']['credit_card']['card_number']\n x = h['payment']['credit_card']['card_number'].split(//).last(4).join(\"\")\n y = params[:credit_card][:number].split(//).last(4).join(\"\") \n if x == y\n user.authnet_payment_profile_id = h['customer_payment_profile_id']\n user.save\n break\n end\n end\n end\n end\n elsif response.message == \"The credit card number is invalid.\" \n resp.error = \"The credit card number is invalid.\"\n elsif response.message == \"This transaction has been declined.\" \n resp.error = \"We couldn't validate the credit card information.\"\n elsif response.message == \"A duplicate transaction has been submitted.\" # The user submitted the same information within two minutes \n resp.error = \"We couldn't validate the credit card information.\"\n else\n puts \"==================================================================\"\n puts \"Response from gateway.create_customer_payment_profile(#{options})\"\n puts \"\"\n puts response.message\n puts \"\"\n puts response.inspect\n puts \"==================================================================\"\n resp.error = \"A fatal error occured, the web administrator has been notified. Please try again later.\"\n end \n end\n return resp\n end",
"def purchase_with_card!\n puts 'purchase_with_card!'\n unless validate_card \n puts 'card invalid'\n puts 'calling err'\n err!\n puts 'state'\n puts self.state\n puts 'saving...'\n self.save!\n puts 'saved. state is'\n puts self.state\n puts 'valid?'\n puts self.valid?\n puts self.errors.full_messages\n return false \n end\n \n mode = self.account.gateway.mode\n gateway = self.account.gateway.authorize_net\n \n response = gateway.purchase(price_in_cents, credit_card, purchase_options)\n transactions.create!(:action => \"purchase\", \n :amount => price_in_cents, \n :response => response,\n :meth => 'card',\n :origin => 'web',\n :gateway_mode => mode)\n \n puts \"RESPONSE.success?\"\n puts response.success?\n \n if response.success?\n puts \"calling FINALIZE\"\n finalize!\n puts \"STATE\"\n puts state\n else\n puts \"calling ERR!\"\n err!\n puts 'STATE:'\n puts state\n end\n \n # response.success?\n end",
"def cheque_or_card_payment_not_excessive\n\t\t\n\t\tself.errors.add(:amount,\"payment is excessive\") if payment_excessive? && (is_cheque? || is_card?) && !refund\n\tend",
"def prepare_data\n \t@card_number = @card_number.to_s.gsub(/[^\\d]/, \"\") unless @card_number.nil?\n \t\n \t@test_request = @test_transaction.to_s.downcase == 'true' ? 'TRUE' : 'FALSE'\n\n \tif @recurring_billing.class != String\n \t\tif @recurring_billing == true\n \t\t\t@recurring_billing = \"YES\"\n \t\telsif @recurring_billing == false\n \t\t\t@recurring_billing = \"NO\"\n \t\tend\n \tend\n \t\n \t@expiration = @expiration.strftime \"%m/%y\" rescue nil # in case a date or time is passed\n \t\n \t@method = (@method.nil? || @card_number) ? 'CC' : @method.upcase\n \t\n \t# convert the action\n \tif TYPES.include?(@type)\n \t\t@type = TYPES[@type]\n \telsif ! TYPES.has_value?(@type)\n \t\traise PaymentError, \"The type '#{@type}' is not valid\"\n \tend\t\t\n \t\n \t# add some required fields specific to this payment gateway and the provided data\n \t@required += %w(method type login test_request delim_data relay_response)\n \n # If a transaction key is specified, use that instead\n \tif @transaction_key.nil?\n \t @transaction_key = nil\n \t\t@required += %w(password)\n \telse\n \t @password = nil\n \t\t@required += %w(transaction_key)\n \tend\n \t\n \tunless @method == 'VOID'\n \t\tif @method == 'ECHECK'\n \t\t\t@required += %w(amount routing_code account_number account_type bank_name account_name account_type)\n \t\t\t@required += %w(customer_org customer_ssn) unless @customer_org.nil?\n \t\telsif @method == 'CC'\n \t\t\t@required += %w(amount)\n \t\t\tif @type == 'PRIOR_AUTH_CAPTURE'\n \t\t\t\t@required += @order_number ? %w(order_number) : %w(card_number expiration)\n \t\t\telse\n \t\t\t\t@required += %w(card_number expiration)\n \t\t\tend\n \t\telse\n \t\t\traise PaymentError, \"Can't handle transaction method: #{@method}\"\n \t\tend\n \tend\n \t\n \[email protected]!\n end",
"def test_successful_authorize_stored_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, true)\n end",
"def validate\n \n \n end",
"def review_card\n @card = @current_user.cards.find(params[:card_id])\n check_result = @card.check_translation(trainer_params[:user_translation])\n render json: { state: check_result[:state] }\n end",
"def validate\r\n\r\n end",
"def test_credit_card_authorize_and_capture_amount_low\n assert auth = @gateway.authorize(@amount, @credit_card, @options)\n assert_success auth\n assert_equal 'Approved', auth.message\n assert capture = @gateway.capture(@amount-100, auth.authorization, @credit_card, @options)\n assert_success capture\n assert_equal 'Approved', capture.message\n end",
"def credit_card?(pkt)\n\tif pkt.payload.match(/4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) != nil\n\t\treturn true\n\telsif pkt.payload.match(/5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) != nil\n\t\treturn true\n\telsif pkt.payload.match(/6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) != nil\n\t\treturn true\n\telsif pkt.payload.match(/3\\d{3}(\\s|-)?\\d{6}(\\s|-)?\\d{5}/) != nil\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def create\n # new instance of a card with parameters of card details\n @card = Card.create(card_params)\n # current user info gets associated with card?? ASK\n # if card is valid based on our criteria (validations)\n # then the card will be saved and added to list of all cards\n # and user will be redirected to list of all cards\n if @card.valid?\n @card.save!\n \n redirect_to cards_path\n # if card doesn't fit our criteria, then user will get an\n # error message\n else\n render :new\n flash[:alert] = \"There was an error with your submission\"\n end\n end",
"def build_card(data)\n Card.new(\n bank: self,\n id: data['contrato']['numerodecontrato'],\n name: data['panmdp'],\n avaliable: money(data['saldoDisponible']),\n amount: money(data['saldoDispuesto']),\n pan: data['panmdp'],\n description: data['descripcion'],\n contract_id: data['contrato']['producto'],\n is_credit: data['tipoTarjeta'].to_s == \"credit\"\n )\n end",
"def card_valid?(card_value, options = {})\n\n card_value = HealthCard.sanitize(card_value, 'CA-ON')\n\n is_valid = validate_value(card_value)\n\n unless options[:skip_checksum]\n is_valid &&= validate_checksum(card_value)\n end\n\n is_valid\n end",
"def has_card? test_card \n @card_list.has_card? test_card\n end",
"def test_card_web(input)\n card_web = MangoPay::PayIn::Card::Web.create(\n 'AuthorId': @user.mango_pay_id,\n 'CreditedUserId': @user.mango_pay_id,\n 'CreditedWalletId': @user.wallet_id,\n 'DebitedFunds': { Currency: 'EUR', Amount: @contribution.amount_in_cents },\n 'Fees': { Currency: 'EUR', Amount: 0 },\n 'CardType': 'CB_VISA_MASTERCARD',\n 'ReturnURL': @callback_url,\n 'Culture': (@user.country_of_residence == 'FR' ? 'FR' : 'EN'),\n 'Tag': 'PayIn/Card/Web',\n \"SecureMode\": 'DEFAULT',\n \"TemplateURL\": 'http://www.a-url.com/3DS-redirect'\n )\n # On envoie l'utilisateur sur la page Mango pour qu'il renseigne sa CB\n # Mango nous renvoie le resultat (paiement en succes / echec)\n if card_web['Status'] == 'FAILED'\n Failure({ contribution: @contribution }.merge(error: 'mango_pay_error_card', project: @contribution.project_id))\n else\n @contribution.update(aasm_state: 'payment_pending')\n @contribution.update(mango_pay_id: card_web['Id'])\n Success(input.merge(redirect: card_web['RedirectURL']))\n end\n end",
"def check_card_type\n card_type && (card_type == 'VISA' || card_type == 'MASTERCARD' || card_type == 'AMEX')\n end",
"def credit_card(params = {})\n brand = params[:brand].to_sym\n params.delete(:brand)\n\n exp_month = sprintf(\"%.2i\", Integer(params[:expiry_month], 10))\n exp_year = sprintf(\"%.4i\", Integer(params[:expiry_year], 10))\n params.delete(:expiry_month)\n params.delete(:expiry_year)\n\n method_missing(:credit_card, params)\n\n # The expiration data needs to be combined together\n exp = \"#{exp_year[-2..-1]}#{exp_month}\"\n add_field(mappings[:credit_card][:expiry_month], exp)\n\n # Map the card type to what Migs is expecting\n if params[:number] =~ ELECTRON\n brand_name = 'VisaDebit'\n else\n brand_name = {\n :visa => 'Visa',\n :master => 'Mastercard',\n :american_express => 'Amex',\n :diners_club => 'Dinersclub',\n :jcb => 'JCB',\n :solo => 'Solo'\n }[brand]\n end\n\n add_field(mappings[:credit_card][:brand], brand_name)\n end",
"def purchase_sub_existing_choose\n @plan = params[:sec][:plan] #now this is an integer, my_plan_id\n @planobject = Plan.find_by_my_plan_id(@plan)\n @events_number = @planobject.events_number \n # if user is a stripe customer (even though no acticve sub), want to allow him to use existing card\n if !current_user.customer_id.blank? \n c = Stripe::Customer.retrieve(current_user.customer_id)\n @last4 = c.cards.data.first.last4\n @cardtype = c.cards.data.first.type\n end \n\nend",
"def payment\r\n return (deposit + credit_card_charge) if (payment_mode =~ /deposit/)\r\n return (balance + credit_card_charge) if (payment_mode =~ /balance/)\r\n raise \"Bad payment mode #{payment_mode}\"\r\n end",
"def validate\n end",
"def payment_by_token! card_id, _recurring_period = nil\n card = card_id.is_a?(PaymentCard) ? card_id : user.payment_cards.find_by_id(card_id)\n return errors.add(:base, 'Payment card token not found') && false unless card\n self.payment_card_id = card.id\n case card.kind\n when 'rave'\n uri = URI.parse(Payment.rave_api_for('tokenized/charge'))\n payload = {SECKEY: ENV['RAVE_SKEY'], token: card.customer_id, currency: Rails.configuration.app_currency, amount: total_amount, email: user.email, firstname: user.first_name, lastname: user.last_name, IP: payment_ip, txRef: \"trans-#{id}-#{Time.current.to_i}\"}\n http = Net::HTTP.new(uri.host)\n request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type': 'application/json'})\n request.body = payload.to_json\n response = http.request(request)\n body = JSON.parse(response.body)\n if body['status'] == 'success' && body['data'] && body['data']['status'] == 'successful'\n self.attributes = {payment_at: Time.current, payment_kind: 'rave', payment_token: card.customer_id, payment_transaction_id: body['data']['order_ref'], recurring_period: _recurring_period, last4: card.last4}\n card.update_column(:customer_id, body['data']['chargeToken']['embed_token'])\n else\n Rails.logger.error \"********** Rave Payment Error for #{id}: #{body.inspect}\"\n errors.add(:base, \"#{body['message']}: #{body['data']['code']}\")\n end\n \n when 'stripe'\n data = {:amount => (total_amount * 100).to_i, :currency => Rails.configuration.app_currency.downcase, :description => description, customer: card.customer_id}\n charge = Stripe::Charge.create(data)\n self.attributes = {payment_token: '', payment_transaction_id: charge.id, payment_at: Time.current, payment_kind: 'stripe', last4: charge.source.last4, recurring_period: _recurring_period}\n \n else\n errors.add(:base, 'Payment card token not found. Please contact to administrator.')\n return false\n end\n start_recurring_payment if save\n save\n end",
"def create\n creditcard = @payment_presenter.creditcard\n creditcard.address = @payment_presenter.address\n creditcard.order = @order\n \n begin\n creditcard.authorize(@order.total)\n rescue Spree::GatewayError => ge\n flash.now[:error] = \"Authorization Error: #{ge.message}\"\n render :action => \"new\" and return \n end\n creditcard.save\n @order.next!\n redirect_to checkout_order_url(@order)\n end",
"def valid_options_for_credit_card\n {\n :type => 'visa',\n :number => '4111111111111111',\n :verification_value => '111',\n :expires_on => Time.now + 1.year,\n :first_name => 'Quentin',\n :last_name => 'Costa'\n }\n end",
"def add_credit_card(xml, credit_card, address)\n xml.tag! :Card do\n \n # DataCash calls the CC number 'pan'\n xml.tag! :pan, credit_card.number\n xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)\n \n # optional values - for Solo etc\n if [ 'switch', 'solo' ].include?(credit_card.type.to_s)\n \n xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?\n \n if !credit_card.start_month.blank? && !credit_card.start_year.blank?\n xml.tag! :startdate, format_date(credit_card.start_month, credit_card.start_year)\n end\n end\n \n xml.tag! :Cv2Avs do\n xml.tag! :cv2, credit_card.verification_value if credit_card.verification_value?\n xml.tag! :street_address1, address[:address1] unless address[:address1].blank?\n xml.tag! :street_address2, address[:address2] unless address[:address2].blank?\n xml.tag! :street_address3, address[:address3] unless address[:address3].blank?\n xml.tag! :street_address4, address[:address4] unless address[:address4].blank?\n xml.tag! :postcode, address[:zip] unless address[:zip].blank?\n \n # The ExtendedPolicy defines what to do when the passed data \n # matches, or not...\n # \n # All of the following elements MUST be present for the\n # xml to be valid (or can drop the ExtendedPolicy and use\n # a predefined one\n xml.tag! :ExtendedPolicy do\n xml.tag! :cv2_policy, \n :notprovided => POLICY_REJECT,\n :notchecked => POLICY_REJECT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_REJECT\n xml.tag! :postcode_policy,\n :notprovided => POLICY_ACCEPT,\n :notchecked => POLICY_ACCEPT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_ACCEPT\n xml.tag! :address_policy, \n :notprovided => POLICY_ACCEPT,\n :notchecked => POLICY_ACCEPT,\n :matched => POLICY_ACCEPT,\n :notmatched => POLICY_REJECT,\n :partialmatch => POLICY_ACCEPT\n end\n end\n end\n end",
"def payment_card(card_id)\n c_r Lokalise::Resources::PaymentCard, :find, card_id\n end",
"def charge_credit_card(customer, credit_card, amount, payment, summary)\n\n # Set up the gateway -- test mode is specified in the environment.rb config file\n gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login => SmartFlix::Application::AUTHORIZE_NET_API_LOGIN_ID,\n :password => SmartFlix::Application::AUTHORIZE_NET_TRANSACTION_KEY)\n # Set up the credit card authorization options\n options = {\n # We store payment ID as invoice ID - XYZFIX P3 - huh - what is this!?!?!\n :order_id => payment.id, # XYZ P1 - what is this?\n :description => summary,\n :address => {},\n :currency => \"USD\",\n :billing_address => {\n :name => customer.full_name,\n :address1 => customer.billing_address.address_1,\n :city => customer.billing_address.city,\n :state => customer.billing_address.state.code,\n :country => customer.billing_address.country.name,\n :zip => customer.billing_address.postcode\n },\n }\n\n amount_to_charge = amount * 100.0\n\n response = gateway.authorize(amount_to_charge, credit_card.active_merchant_cc, options)\n\n if !response.success?\n return [ false, \"Error: There was a problem with your credit card (#{response.message})\" ]\n end\n\n response = gateway.capture(amount_to_charge, response.authorization)\n\n # In development, this test fails but we want to do it in production\n if (Rails.env == 'production')\n if (!response.success?)\n return [ false, \"Error: There was a problem with your credit card (#{response.message})\" ]\n end\n end\n\n return [true, nil ]\n\n rescue Exception => e\n ExceptionNotifier::Notifier.exception_notification(request.env, e).deliver\n return [ false, \"Error: There was a problem with your credit card (#{response.message})\" ]\n end",
"def validate_payment_profile(payment_profile_id, profile_id, options = {})\n @type = Type::CIM_VALIDATE_PAYMENT\n options = @@validate_payment_profile_option_defaults.merge(options)\n handle_payment_profile_id(payment_profile_id)\n handle_profile_id(profile_id)\n handle_address_id(options[:address_id]) unless options[:address_id].nil?\n set_fields(:validation_mode => options[:validation_mode])\n set_fields(:card_code => options[:card_code]) unless options[:card_code].nil?\n make_request\n end",
"def charge_card extra_fee=false\n return true unless processing?\n begin\n oauth_key = orderable.user.stripe_key\n charge = Stripe::Charge.create({\n amount: (price * 100).to_i,\n currency: \"usd\",\n customer: user.stripe_customer_id,\n description: \"Order for #{orderable.title.titleize}\",\n application_fee: order_fee(extra_fee),\n }, oauth_key)\n finish\n rescue Stripe::CardError => e\n body = e.json_body\n err = body[:error]\n\n logger.fatal \"Status is: #{e.http_status}\"\n logger.fatal \"Type is: #{err[:type]}\"\n logger.fatal \"Code is: #{err[:code]}\"\n # param is '' in this case\n logger.fatal \"Param is: #{err[:param]}\"\n logger.fatal \"Message is: #{err[:message]}\"\n\n self.error = e.message\n job = Afterparty::MailerJob.new UserMailer, :card_error , self\n Rails.configuration.queue << job\n fail\n end\n save!\n self\n end",
"def add_card(access_token,payment_method)\n begin\n if Rails.env.production?\n @url =\"https://#{APP_CONFIG.auth_api_key}/billing/addCard\"\n @authKey = APP_CONFIG.auth_api_key\n else\n @url = \"https://dev-#{APP_CONFIG.auth_api_key}:3018/billing/addCard\"\n @authKey = APP_CONFIG.auth_api_key\n end\n uri = URI(@url)\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n req = Net::HTTP::Post.new(uri.path, {'Content-Type' =>'application/json'});\n # debugger\n req.body ={\t\t\t\n :access_token => access_token,\n :user_id => user_id,\n :auth_key => @authKey,\n :offering => 2,\n :payment_method => payment_method\n }.to_json\n res1 = https.request(req)\n @authBody = JSON.parse(res1.body)\n raise @authBody[\"message\"] if @authBody[\"status\"] == 201\n return @authBody\n rescue Exception => e\n puts \"add_card exception\"\n puts e\n raise e\n end\n end",
"def build_payment_mechanism(xml, credit_card)\n xml.PaymentMech{\n xml.CreditCard{\n type = credit_card.type\n xml.Type(CARDS[type.to_sym] || 1, :DataType=>\"S32\")\n xml.Number(credit_card.number)\n #TODO: only takes 2 digit year and month\n #xml.Expires(\"#{credit_card.year}/#{credit_card.month}\", :DataType=>\"ExpirationDate\", :Locale=>\"826\") \n xml.Expires(\"10/10\", :DataType=>\"ExpirationDate\", :Locale=>\"826\") \n \n if not credit_card.start_year.nil? or not credit_card.start_month.nil?\n xml.StartDate(\"#{credit_card.start_year}/#{credit_card.start_month}\", :DataType=>\"StartDate\", :Local=>\"826\") \n end\n if not credit_card.issue_number.nil?\n xml.IssueNum(credit_card.issue_number)\n end\n if not credit_card.verification_value.nil?\n xml.Cvv2Indicator(\"1\")\n xml.Cvv2Indicator(credit_card.verification_value)\n end\n }\n }\n end",
"def getCreditCard(payload)\n # VISA\n matchList = payload.scan(/(4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n # MASTER CARD\n #form with dashes\n matchList = payload.scan(/(5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n # DISCOVER\n #form with dashes\n matchList = payload.scan(/(6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n # AMERICAN EXPRESS\n #form with dashes\n matchList = payload.scan(/(3\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4})\\D/) \n if matchList.length > 0\n return matchList[0][0]\n end\n\n return nil\n\nend",
"def findCreditCard(pkt)\n\tpayload = pkt.payload\n\tif /4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/.match(payload) || /5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/.match(payload) || /6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/.match(payload) || /3\\d{3}(\\s|-)?\\d{6}(\\s|-)?\\d{5}/.match(payload)\n\t\talert(\"Credit card leak\", pkt.ip_saddr(), \"HTTP\", payload)\n\tend\nend",
"def valid_card(card_type: T.unsafe(nil)); end",
"def test_successful_authorize_credit_card_metadata\n test_successful_purchase_credit_card_metadata(false, true, false)\n end",
"def validCreditCard(cardNumber)\n sum = 0\n nums = cardNumber.to_s.split(\"\")\n nums.each_with_index do |n, i|\n sum += if (i % 2 == 0)\n n.to_i * 2 >9 ? n.to_i*2-9 : n.to_i*2\n else\n n.to_i\n end\n end\n if (sum % 10) == 0\n return true\n else\n return false\n end\nend",
"def valid?\n return false if @amount.nil?\n return false if @cardnumber.nil?\n return false if @cardnumber.to_s.length > 22\n return false if @cardnumber.to_s.length < 12\n return false if [email protected]? && @csc.to_s.length > 4\n return false if [email protected]? && @csc.to_s.length < 3\n return false if [email protected]? && @currency.to_s.length > 3\n return false if [email protected]? && @currency.to_s.length < 3\n return false if @expmonth.nil?\n return false if @expmonth > 12\n return false if @expmonth < 1\n return false if @expyear.nil?\n return false if @expyear > 2100\n return false if @expyear < 2000\n return false if @identifier.nil?\n return false if @identifier.to_s.length > 50\n return false if @identifier.to_s.length < 4\n return false if @merchantid.nil?\n return false if !@trans_info.nil? && @trans_info.to_s.length > 50\n return false if !@trans_type.nil? && @trans_type.to_s.length > 1\n true\n end",
"def validate!\n Cybersource::Security.validate_signature!(@fields['signature'], signed_data)\n raise PaymentFailed unless payment_success?\n\n self\n end"
] | [
"0.7149934",
"0.6929394",
"0.6873045",
"0.6784411",
"0.6652981",
"0.6627597",
"0.6616447",
"0.64701706",
"0.641898",
"0.6377554",
"0.6342429",
"0.63400567",
"0.6309344",
"0.62120503",
"0.62084115",
"0.6180396",
"0.6153603",
"0.61481327",
"0.6145207",
"0.61269045",
"0.61143637",
"0.6109365",
"0.61042994",
"0.6093013",
"0.60869354",
"0.6072901",
"0.60727197",
"0.60708153",
"0.60688883",
"0.60644627",
"0.60305715",
"0.601968",
"0.6010235",
"0.6009445",
"0.59935516",
"0.59935516",
"0.597813",
"0.5962895",
"0.59556955",
"0.5950752",
"0.59428",
"0.5937496",
"0.592936",
"0.5886259",
"0.5876653",
"0.58718777",
"0.5861248",
"0.5860308",
"0.5857235",
"0.5836147",
"0.5835582",
"0.58320045",
"0.58046",
"0.5799778",
"0.57991123",
"0.579595",
"0.57947236",
"0.57889324",
"0.5785374",
"0.57817847",
"0.5779379",
"0.5779004",
"0.5779004",
"0.5771649",
"0.5768151",
"0.5765388",
"0.5741559",
"0.5710833",
"0.5709758",
"0.5700845",
"0.570052",
"0.56993556",
"0.56972915",
"0.5683433",
"0.56828153",
"0.5680447",
"0.56704485",
"0.5667951",
"0.56642574",
"0.56583005",
"0.56553525",
"0.56457967",
"0.56424284",
"0.5638281",
"0.5637702",
"0.56345737",
"0.5625614",
"0.5616503",
"0.5614363",
"0.56124985",
"0.56065536",
"0.5600366",
"0.55989945",
"0.55973566",
"0.5593051",
"0.5590359",
"0.5588784",
"0.55811787",
"0.55673414",
"0.5562017",
"0.5555644"
] | 0.0 | -1 |
has_many :reagents, :through => :game_base_skill_reagents, :class_name => :game_base_items | def skill_schools
[
'Tailoring',
'Jewelcrafting',
'Enchanting',
'Blacksmithing',
'Summoning',
'Shadow',
'Fire',
'Holy',
'Frost',
'Melee',
'Ranged'
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_target_actors\n [$game_party.members[0]]\n end",
"def a_tag_has_many_of_these_through_taggings\n ::Tag.class_exec(name, name.demodulize.underscore.pluralize.to_sym) do |class_name, association_name|\n has_many association_name, through: :taggings,\n class_name: class_name,\n source: :taggable,\n source_type: class_name\n end\n end",
"def hmt(goal, options)\n thru = options[:through]\n self.has_many(thru)\n self.has_many(goal, :through => thru, :skip_belongs_to => true)\n unless options[:bidi] == false\n goal.has_many(thru)\n goal.has_many( self, { :through => thru, :skip_belongs_to => true })\n end\n end",
"def nested_has_many(many_class, relation)\n acc = [relation]\n while (reflection = definition.reflection_by_name(many_class, relation))\n break if reflection.nil? || reflection.options[:through].nil?\n relation = reflection.options[:through]\n acc.unshift(relation)\n end\n acc.map { |relation| definition.reflection_by_name(many_class, relation) }\n end",
"def has_many(goal, options = { })\n goal.belongs_to(self) unless options[:skip_belongs_to]\n self.associate(:has_many, goal, options)\n end",
"def many_to_many_associated_tables\n @many_to_many_associated_tables\n end",
"def has_many(name, *args, **opt)\n add_collection_property(name, *args, **opt)\n set_relation_field(name, args.first)\n end",
"def use_item_to_actors\r\n item_target_actors.each do |target|\r\n item.repeats.times { target.item_apply(user, item) }\r\n end\r\n end",
"def genres\n Genre.joins(user_room_genres: :user_room)\n .where(user_rooms: { game_room: self })\n .distinct\n end",
"def model_relationships; end",
"def use_item(item)\n super\n $game_party.add_bestiary_data(@enemy_id, :ski, item.id)\n end",
"def child_relation; end",
"def use_item_to_actors\n $game_party.members[0].item_apply(user, item)\n end",
"def carried_weapons\n CharacterWeapon.where(:character_id => self.id, :carried => :true).order('equipped desc')\n end",
"def has_many_relations\n remap_relations(relations_by_macro(:has_many))\n end",
"def item_target_actors\r\n if !item.for_friend?\r\n []\r\n elsif item.for_all?\r\n $game_party.members\r\n else\r\n [$game_party.members[@actor_window.index]]\r\n end\r\n end",
"def enemy;\n @item;\n end",
"def shared_inventory\n @weapons + @armors + items_to_obj\n end",
"def test_has_many_through_belongs_to_with_has_many_through_source_reflection\n welcome_general, thinking_general = taggings(:welcome_general), taggings(:thinking_general)\n\n assert_equal [welcome_general, thinking_general],\n categorizations(:david_welcome_general).post_taggings.order(\"taggings.id\")\n end",
"def my_relationships(name)\n self.class.find_relationship(name).find_by_participant(self)\n end",
"def has_many(*args)\n require \"og/relation/has_many\"\n relations! << Og::HasMany.new(args, :owner_class => self, :collection => true)\n end",
"def inverse_class\n ManyToOne::Relationship\n end",
"def inverse_class\n ManyToOne::Relationship\n end",
"def has_many(relationship)\n define_method relationship do\n temp = instance_variable_get(:\"@#{ relationship }\")\n\n return temp unless temp.nil? || temp.empty?\n\n klass = RescueGroups.constantize(relationship)\n foreign_key = \"#{ self.class.to_s.split('::').last.downcase }_id\"\n klass.where(foreign_key.to_sym => @id)\n end\n\n attr_writer relationship\n end",
"def add_relationship(rel_attr); end",
"def revisable_association_name #:nodoc:\n revisable_class_name.underscore\n end",
"def weaponsTurret _obj, _args\n \"_obj weaponsTurret _args;\" \n end",
"def test_has_many_through_has_one_through_with_has_one_source_reflection\n assert_equal [sponsors(:moustache_club_sponsor_for_groucho)], members(:groucho).nested_sponsors\n end",
"def gyms \n self.memberships.map do |membership|\n membership.gym\n end\nend",
"def responsable_of\n self.references\n end",
"def relate base, name, metadata\n base.relations_sleeping_king_studios.update metadata.relation_key => metadata\n end",
"def has_many(name, type:)\n add_relationship(name: name, type: type, cardinality: :many)\n end",
"def readers_join_table\n self.class.readers_join_table\n end",
"def has_many_relations(ar_instance)\n\t\t\tcolumn_name = \"#{ar_instance.class.name.underscore}_id\"\n\t\t\tdescendents = ActiveRecord::Base.connection.tables\n\t\t\tdescendents.reject!{ |table| false unless table.classify.constantize rescue true }\n\t\t\tdescendents.reject!{ |table| true unless table.classify.constantize.column_names.include?(column_name) }\n\t\tend",
"def weapon; end",
"def weapon; end",
"def weapon; end",
"def relatedChallenges\n Challenge.all(:select => \"challenges.*,skill_challenges.parent_id\",\n :joins => :skill_challenges,\n :conditions => { \n :skill_challenges => { :parent_id => self.skill_challenges.first.parent_id }\n },\n :order => \"skill_challenges.lft\")\n end",
"def ranged_weapon; end",
"def _many_to_many_table_name(attr_name)\n _many_to_many_hash[attr_name][:table_name] ||= self.name + \"_\" + _many_to_many_hash[attr_name][:class_name]\n end",
"def skills\n\t\t[]\n\tend",
"def has_many_subleases(lodger, options = {})\n has_many lodger.to_sym, options.delete(:dependent), dependent: :destroy\n end",
"def one_to_many_relationship(rel_name, definition)\n @relationships << OneToManyRelationship.new(rel_name, definition)\n end",
"def lifters_gym\n gym_memberships.map do |membership|\n membership.lifter\n end\n end",
"def memberships \n Membership.all.select do |membership|\n membership.lifter == self\n end \nend",
"def parent_game\n return self if self.class==Game\n self.game\n end",
"def skills_tab\n skill_bonuses = @character.skill_bonuses.select_ability_total_bonus.select_skill_name.joins(:skill).joins(:ability_bonus)\n @insight = skill_bonuses.insight\n @perception = skill_bonuses.perception\n @skill_bonuses = skill_bonuses.sort_by(&:fr_name)\n @klass_choosable_skill_bonus = @character.klass.try(&:choosable_skills_to_a)\n end",
"def gyms \n self.memeberships.map do |memebership| \n memebership.gym \n end \n end",
"def _many_to_many_reverse_table_name(attr_name)\n _many_to_many_hash[attr_name][:reverse_table_name] ||= _many_to_many_hash[attr_name][:class_name].to_s + \"_\" + self.name\n end",
"def reciprocal_type\n :one_to_many\n end",
"def associated\n end",
"def has_many(name, options = {})\n options = HasManyOptions.new(name, self, options)\n define_method(name) do\n primary_key = self.id\n source_class = options.model_class\n source_class.where(options.foreign_key => primary_key)\n end\n end",
"def one_through_many(name, through, opts=OPTS, &block)\n associate(:one_through_many, name, opts.merge(through.is_a?(Hash) ? through : {:through=>through}), &block)\n end",
"def relation_method\n :join\n end",
"def weapon_reward(available_weapons)\n\n #reward is 1 random choice from this array\n reward = available_weapons.sample\n\n #create to CharacterWeapon object to show that player obtains weaopn\n CharacterWeapon.new_character_weapon(self.id, reward.id)\n\n #print weapon details to player\n puts \"#{reward.name}\".bold.blue\n puts \"Weapon Power: #{reward.attack_power}\"\n puts\"#####################################\".blink\n\n #actually equip the weapon, if it will increase this player's attack power\n if reward.attack_power > self.power - 1 || self.power == 1\n #increase the player's attack power\n self.update(power: 1+reward.attack_power)\n end\n end",
"def has_many_custom_fields\n group_custom_fields('has_many') { |rule| [rule['name'], rule['inverse_of']] }\n end",
"def has_many_custom_fields\n group_custom_fields('has_many') { |rule| [rule['name'], rule['inverse_of']] }\n end",
"def related_to(*args)\n@relations = args.map(&:to_s)\nend",
"def all_skills\n self.skills.map(&:name).join(', ')\n end",
"def many_to_many(name, opts={})\n singular_name = name.to_s.singularize\n ids_attr = \"#{singular_name}_ids\"\n guids_attr = \"#{singular_name}_guids\"\n\n define_method(\"add_#{singular_name}\") do |other|\n # sequel is not capable of merging adds to a many_to_many association\n # like it is for a one_to_many and nds up throwing a db exception,\n # so lets squash the add\n if other.is_a?(Integer)\n super(other) unless send(ids_attr).include? other\n else\n super(other) unless send(name).include? other\n end\n end\n\n opts[:reciprocal] ||=\n self.name.split('::').last.underscore.pluralize.to_sym\n\n define_to_many_methods(name, singular_name, ids_attr, guids_attr)\n super\n end",
"def all_skills\n self.skills.map(&:name).join(\", \")\n end",
"def weaponsItems _args\n \"weaponsItems _args;\" \n end",
"def myrewards\n @rewards = Reward.all.where(business: current_business)\n end",
"def have_many(models)\n HasManyReflection.new models\nend",
"def relators\n\t\t@relators = @tags = Relator.order('left_name').all.decorate\n\tend",
"def weaponAccessories _obj, _args\n \"_obj weaponAccessories _args;\" \n end",
"def lifter_membership\n Membership.all.select {|membership| membership.lifter == self}\nend",
"def relate\n resource_class = params[:related][:model].typus_constantize\n association_name = params[:related][:association_name].tableize\n\n if @item.send(association_name) << resource_class.find(params[:related][:id])\n notice = Typus::I18n.t(\"%{model} successfully updated.\", :model => @resource.model_name.human)\n end\n\n redirect_to :back, :notice => notice\n end",
"def lifters\n memberships.map {|membership| membership.lifter}\n end",
"def all_lifters\n Membership.all.select do |membership_instance|\n if membership_instance.gym == self\n membership_instance.member\n end\n end\n end",
"def all_gyms\n Membership.all.map do |membership| \n if membership.lifter == self\n membership.gym\n end\n end\n end",
"def menu_items\n MenuItem.all.select {|item| item.recipe == self}\n end",
"def test_has_many_through_has_many_with_has_many_through_source_reflection\n general = tags(:general)\n assert_equal [general, general], authors(:david).tags\n end",
"def lifters\n member = Membership.all.select do |membership|\n membership.gym == self\n end\n member.map do |membership|\n membership.lifter\n end\n end",
"def macro\n :belongs_to_related\n end",
"def resolve_polymorphic\n target_class.module_eval <<-EOS, __FILE__, __LINE__\n joins_many :#{owner_class.to_s.demodulize.underscore.pluralize}\n EOS\n end",
"def related_employees\n ratings.employees\n end",
"def targeting\n @things.targeting\n end",
"def associations; end",
"def group_through\n @group_through ||= self.class.group_through\n end",
"def related_items\n related_items = { :coffee_pods => related_coffee_pods }\n related_items\n end",
"def set_blue_magic_skill_to_learn_flags(item)\n $game_party.members.each do |actor|\n if actor.blue_magic_learning?\n actor.result.blue_magic_skill_to_learn = item.id\n end # if\n end # do\n end",
"def relations\n self.class.relations\n end",
"def my_memberships\n Membership.all.select {|membership_instance| membership_instance.lifter == self}\n end",
"def enduring_relationships\n ['series_system_agent_record_ownership_relationship']\n end",
"def model_class\n\t\tGame\n\tend",
"def one_to_many(name, opts={})\n singular_name = name.to_s.singularize\n ids_attr = \"#{singular_name}_ids\"\n guids_attr = \"#{singular_name}_guids\"\n\n opts[:reciprocal] ||= self.name.split('::').last.underscore.to_sym\n\n define_to_many_methods(name, singular_name, ids_attr, guids_attr)\n super\n end",
"def item_target_candidates\r\n if item.for_opponent?\r\n opponents_unit.alive_members\r\n elsif item.for_user?\r\n [subject]\r\n elsif item.for_dead_friend?\r\n friends_unit.dead_members\r\n else\r\n friends_unit.alive_members\r\n end\r\n end",
"def writers_join_table\n self.class.writers_join_table\n end",
"def permissable_associations; read_inheritable_attribute(:permissable_associations); end",
"def weighted_spawn_chances(items, skill)\n skill_factor = (50 - skill)/100.0\n items.map do |item|\n item.merge('weighted_spawn_chance' => item['spawn_chance'] * skill_factor + skill)\n end\n end",
"def gyms\n self.memberships.map do |membership_instance|\n membership_instance.gym \n end\n end",
"def has_many(name, options = {})\n association_set.add(name, options)\n end",
"def related\n council.wards\n end",
"def memberships # WORKS #\n Membership.all.select { |membership| membership.gym == self }\n end",
"def available_memberships\n Membership.all.select{|x| x.gym == self}\nend",
"def relations; enum_relations.to_a end",
"def equippable?(item)\n # If weapon\n if item.is_a?(RPG::Weapon)\n # If included among equippable weapons in current class\n if $data_classes[@class_id].weapon_set.include?(item.id)\n return true\n end\n end\n # If armor\n if item.is_a?(RPG::Armor)\n # If included among equippable armor in current class\n if $data_classes[@class_id].armor_set.include?(item.id)\n return true\n end\n end\n return false\n end",
"def melee_weapon; end",
"def barrie_ingham_multiple_roles\n MovieDatabase.execute(<<-SQL)\n SELECT\n movies.title\n FROM\n movies\n JOIN castings ON castings.movie_id = movies.id\n JOIN actors ON actors.id = castings.actor_id\n WHERE\n actors.name = 'Barrie Ingham'\n GROUP BY\n actors.name\n SQL\nend",
"def give_bonus player\n player.add_weapon(Vibrant_Weapon.new(@window, player))\n end"
] | [
"0.5654088",
"0.55920863",
"0.52702314",
"0.5167521",
"0.51471233",
"0.51303613",
"0.5043285",
"0.5022889",
"0.5021468",
"0.5020541",
"0.5016457",
"0.49985677",
"0.49956834",
"0.49532527",
"0.4929928",
"0.49274936",
"0.49182433",
"0.49164566",
"0.4896456",
"0.48810714",
"0.48700237",
"0.48573884",
"0.48573884",
"0.4840863",
"0.48384935",
"0.48361832",
"0.48202968",
"0.4800721",
"0.47818404",
"0.4775694",
"0.47622466",
"0.47602236",
"0.4755748",
"0.47438863",
"0.47347468",
"0.47347468",
"0.47347468",
"0.47319025",
"0.47258443",
"0.4720984",
"0.47204766",
"0.47146124",
"0.47070953",
"0.47026327",
"0.47024947",
"0.46992674",
"0.4686484",
"0.4671235",
"0.4657328",
"0.4653099",
"0.46509603",
"0.46403518",
"0.46402115",
"0.46377984",
"0.46345288",
"0.46322396",
"0.46322396",
"0.46179846",
"0.46116668",
"0.46116504",
"0.46081808",
"0.46078408",
"0.459875",
"0.45965186",
"0.4593401",
"0.4592887",
"0.4589724",
"0.4588556",
"0.4586582",
"0.45792484",
"0.45784634",
"0.45732906",
"0.45729372",
"0.4566944",
"0.45564145",
"0.45556086",
"0.455526",
"0.45537257",
"0.45491943",
"0.454412",
"0.4541534",
"0.4540942",
"0.4540773",
"0.45377403",
"0.45284835",
"0.45258126",
"0.45219168",
"0.45193338",
"0.45169184",
"0.4515305",
"0.4511954",
"0.4511634",
"0.45112914",
"0.45111796",
"0.4507285",
"0.45040247",
"0.45029873",
"0.4502795",
"0.4500529",
"0.44985875",
"0.44975266"
] | 0.0 | -1 |
Serialize all settings into a hash | def settings
# TODO
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end",
"def to_hash\n self.config.to_hash\n end",
"def as_hash\n @settings.each_with_object({}) do |(name, config), result|\n config.each_pair do |key, value|\n result[\"#{name}_#{key}\"] = value\n end\n end\n end",
"def to_hash\n ChefConfig::Config.save(true)\n end",
"def to_hash\n configuration\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def to_hash\n @configuration\n end",
"def to_hash\n @configuration\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n copy = OpenStruct.new\n @lock.synchronize do\n copy.marshal_load(@settings.marshal_dump)\n end\n copy\n end",
"def to_hash\n @configuration_data\n end",
"def to_h\n config\n end",
"def serializable_hash(options={})\n data = super(options)\n data.delete('ingest_state')\n if options.has_key?(:include) && options[:include].include?(:ingest_state)\n if self.ingest_state.nil?\n data['ingest_state'] = 'null'\n else\n state = JSON.parse(self.ingest_state)\n data.merge!(ingest_state: state)\n end\n end\n data['intellectual_object_identifier'] = self.intellectual_object.identifier\n if options.has_key?(:include)\n data.merge!(checksums: serialize_checksums) if options[:include].include?(:checksums)\n data.merge!(premis_events: serialize_events) if options[:include].include?(:premis_events)\n end\n data\n end",
"def custom_settings\n hash = HashWithIndifferentAccess.new\n configurations.each do |c|\n case c.data_type\n when :boolean\n value = c.value == 'true' ? true : false\n when :integer\n value = c.value.to_i\n when :string\n value = c.value\n else\n raise 'not implemented'\n end\n hash[c.key] = value # cast\n end\n hash\n end",
"def to_hash\n #Prevent inplace object chane to keep its state\n tohash = @metadata.clone\n #Call appropriate to_hash method for all available controls\n tohash['controls'].map!(&:to_hash)\n #Call appropriate to_hash method for all available connections\n tohash['connections'].map!(&:to_hash) unless tohash['connections'].nil?\n tohash\n end",
"def to_hash\n {\n name: @name,\n type: @type,\n catalog_id: @catalog_id,\n settings: @settings\n }\n end",
"def serializable_hash(options)\n hash = super(options)\n extra_hash = {\n 'project' => project,\n }\n hash.merge!(extra_hash)\n end",
"def to_hash\n { @key => @options }\n end",
"def serializable_hash(_options = nil)\n fail NotImplementedError, 'This is an abstract method. Should be implemented at the concrete adapter.'\n end",
"def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end",
"def to_hash\n { :setup => @setup, :windows => @windows }\n end",
"def initialize\n @settings = Hash.new\n end",
"def to_h\n @configuration\n end",
"def to_hash\n\t\ta = Hash.new\n\t\[email protected]_pair do |k, v|\n\t\t\ta[k] = v.value\n\t\tend\n\t\ta\n\tend",
"def all_settings\n @settings.values.sort_by(&:key)\n end",
"def serializable_hash(options = T.unsafe(nil)); end",
"def user_settings_hash\n fail 'sub class to implement'\n end",
"def to_hash\n {}.tap do |hash|\n # the \"key\" here is to call to_hash on all containers.\n [@wrapped_options.to_hash, @mutable_options.to_hash].each do |options|\n options.each { |k, v| hash[k.to_sym] = v }\n end\n end\n end",
"def settings\n @settings ||= {}\n end",
"def save_settings\n open(@@FN_CREDENTIALS, \"wb\") { |fd| fd.write(YAML::dump(@credentials)) }\n open(@@FN_CONFIG, \"wb\") { |fd| fd.write(YAML::dump(@configuration)) }\n open(@@FN_SETTINGS, \"wb\") { |fd| fd.write(YAML::dump(@settings)) }\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def config\n options.to_smash.deep_merge(opts.to_smash)\n end",
"def export\n configs.export(to_hash)\n end",
"def to_hash\n @_hash_\n end",
"def to_h\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s[1..-1]] = self.instance_variable_get(var)\n end\n hash.delete(\"mode\")\n return hash\n end",
"def serialize\n self.to_hash.to_json\n end",
"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",
"def to_hash\n {:hashes => @hashes}\n end",
"def to_hash\n default_options.to_hash\n end",
"def to_hash\n default_options.to_hash\n end",
"def serialize()\n data = {\n 'channels' => @channels.values.collect {|c| c.serialize },\n 'users' => @users.values.collect {|u| u.serialize },\n }\n data.to_yaml\n end",
"def serializable_hash\n hash = {}\n each_pair { |key, value| hash[key] = value }\n hash\n end",
"def get_hash()\n\t\t\treturn @config.clone()\n\t\tend",
"def stacked_hash_to_hash(settings)\n return if settings.blank?\n settings.each_with_object({}) { |value, result| result.deep_merge!(value) }\n end",
"def to_h\n @config\n end",
"def to_h\n @config\n end",
"def to_h!\n h = {}\n @schema.keys.each do |k|\n v = self[k]\n h[k] = Configuration.config?(v) ? v.to_h! : v.inspect\n end\n h\n end",
"def hash\n [cluster, options].hash\n end",
"def hash\n [cluster, options].hash\n end",
"def serialize\n JSON.generate(to_h)\n end",
"def export\n to_h.merge('&class' => self.class.to_s).stringify_keys\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_hash\n @scoped_config\n end",
"def settings\n {}\n end",
"def settings\n {}\n end",
"def serializable_hash(options={})\n options = { \n exclude: [:snapshot_url, :is_active]\n }.update(options)\n super(options)\n end",
"def inspect\n {\n :pipeline_id => @pipeline_id,\n :settings => @settings.inspect,\n :ready => @ready,\n :running => @running,\n :flushing => @flushing\n }\n end",
"def get_all_settings\n return @db[:settings].as_hash(:name, :body) if onblock(:u, -1, @client).admin?\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n @hash\n end",
"def to_hash\n validate!\n @hash ||= json\n end",
"def to_hash\n\t\t\trhash = {}\n\t\t\[email protected] {|k,v|\n\t\t\t\tcase v\n\t\t\t\twhen ConfigStruct\n\t\t\t\t\trhash[k] = v.to_h\n\t\t\t\twhen NilClass, FalseClass, TrueClass, Numeric\n\t\t\t\t\t# No-op (can't dup)\n\t\t\t\t\trhash[k] = v\n\t\t\t\twhen Symbol\n\t\t\t\t\trhash[k] = v.to_s\n\t\t\t\telse\n\t\t\t\t\trhash[k] = v.dup\n\t\t\t\tend\n\t\t\t}\n\t\t\treturn rhash\n\t\tend",
"def export\n to_h.stringify_keys\n end",
"def to_hash\n OPTIONS.each_with_object({}) do |option, hash|\n key = option.first\n hash[key] = send(key)\n end\n end",
"def dump\n object.map do |key, value|\n dumped_key = self.class.dump(key, context)\n dumped_key = \"!#{dumped_key.to_json}\" unless dumped_key.is_a?(String)\n [dumped_key, self.class.dump(value, context)]\n end.to_h\n end",
"def settings_as_json()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Layout_settings_as_json(@handle.ptr)\n result\n end",
"def to_dict\n @hash\n end",
"def to_h\n @ini.dup\n end",
"def to_h\n @ini.dup\n end",
"def as_json(options={})\n options ||= {}\n if root = options.fetch(:root, @options.fetch(:root, root_name))\n @options[:hash] = hash = {}\n @options[:unique_values] = {}\n\n hash.merge!(root => serializable_hash)\n include_meta hash\n hash\n else\n serializable_hash\n end\n end",
"def config_data\n {}\n end",
"def settings(options = {})\n ensure_config_loaded!\n setting_class.all_keys(options)\n end",
"def serialize_config\n final_conf = []\n config.each do |key, val|\n if val.respond_to?(:call)\n final_conf << Config.new(key, val.call)\n elsif val.is_a?(Array)\n final_conf += val.map { |v| Config.new(key, v) }\n\n # Hashes can have some inner nesting, but only to a certain point.\n elsif val.is_a?(Hash)\n val.each do |k, v|\n if v.is_a?(Array)\n final_conf += v.map { |e| Config.new(key, \"#{k}=#{e}\") }\n else\n final_conf << Config.new(key, \"#{k}=#{v}\")\n end\n end\n else\n final_conf << Config.new(key, val)\n end\n end\n final_conf\n end",
"def to_hash\n {\n :name => @name,\n :options => @options,\n :provisioner => @provisioner,\n :dependencies => @dependencies.to_hash,\n :run_list => @run_list.to_hash\n }\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end",
"def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end",
"def config_to_hash\n data = {}\n Pkg::Params::BUILD_PARAMS.each do |param|\n data.store(param, self.instance_variable_get(\"@#{param}\"))\n end\n data.store(:platform_data, platform_data)\n data\n end",
"def hash\n @__set.to_a.hash\n end",
"def save_persist_state\n return unless @persist_file\n new_persist_options = {}\n BaseWorker.worker_classes.each do |worker_class|\n worker_class.each_config(@adapter_factory.worker_config_class) do |config_name, ignored_extended_worker_config_class, default_options|\n static_options = default_options.merge(@worker_options[config_name] || {})\n worker_config = self[config_name]\n hash = {}\n # Only store off the config values that are specifically different from default values or values set in the workers.yml file\n # Then updates to these values will be allowed w/o being hardcoded to an old default value.\n worker_config.bean_get_attributes do |attribute_info|\n if attribute_info.attribute[:config_item] && attribute_info.ancestry.size == 1\n param_name = attribute_info.ancestry[0].to_sym\n value = attribute_info.value\n hash[param_name] = value if static_options[param_name] != value\n end\n end\n new_persist_options[config_name] = hash unless hash.empty?\n end\n end\n if new_persist_options != @persist_options\n @persist_options = new_persist_options\n File.open(@persist_file, 'w') do |out|\n YAML.dump(@persist_options, out )\n end\n end\n end",
"def to_h\n @manifest_options.to_h\n end",
"def serializable_hash(options = {})\n # options = (options || {}).merge(:except => definition.flags.select{ |k, v| !v }.collect{ |x| x.first.to_s.gsub(\"is_\", \"\").gsub(\"_displayed\", \"\") })\n super\n end",
"def serializable_hash options=nil\n hash = super\n eav_attributes_list.each do |attribute|\n hash[attribute] = self.send(attribute)\n end\n\n hash\n end",
"def to_hash\n rethash = {}\n\n @parameters.each do |name, obj|\n rethash[name] = obj.value\n end\n\n rethash\n end",
"def to_json(options = {})\n serializable_hash.compact.to_json(options)\n end",
"def serialize\n YAML::dump(self)\n end",
"def settings\n return {} if description.blank?\n @settings ||= description['settings']\n return {} if @settings.blank?\n @settings.symbolize_keys\n end",
"def settings\n\t\tif setting = params[\"settings\"]\n\t\t\tsetting.each do |k,v|\n\t\t\t\tv = v == \"1\" if v == \"1\" or v == \"0\"\n\t\t\t\tlogger.debug \"Setting #{k} to #{v.inspect}\"\n\t\t\t\tSettings[k] = v\n\t\t\tend\n\t\tend\n\t\thead :ok\n\tend",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def save_config\n self.data = JSON.dump(self.config)\n end",
"def serialize_array\n `self.serializeArray()`.map { |e| Hash.new(e) }\n end",
"def serializable_hash(options = nil)\n h = super options.merge(except: 'token_digest')\n h.merge! 'token' => token if token.present?\n h\n end",
"def instrumented_integrations_settings\n instrumented_integrations.flat_map do |name, integration|\n integration.configuration.to_h.flat_map do |setting, value|\n next [] if setting == :tracer # Skip internal Ruby objects\n\n # Convert value to a string to avoid custom #to_json\n # handlers possibly causing errors.\n [[:\"integration_#{name}_#{setting}\", value.to_s]]\n end\n end.to_h\n end",
"def serializable_hash\n attrs = self.class._attributes.dup.keys\n\n # Inclusive fields.\n if @opts[:only].present? || @opts[:fields].present?\n (@opts[:only] ||= []).concat(@opts[:fields] ||= [])\n attrs = (attrs & @opts[:only].map(&:to_sym))\n # Exclusive fields.\n elsif @opts[:exclude].present?\n attrs = (attrs - @opts[:exclude].map(&:to_sym))\n end\n\n filter_attributes(attrs)\n end"
] | [
"0.7642021",
"0.71637344",
"0.71404344",
"0.684871",
"0.6842132",
"0.6771699",
"0.6648124",
"0.6648124",
"0.6432106",
"0.6432106",
"0.6421479",
"0.63957775",
"0.63922936",
"0.637958",
"0.63619924",
"0.63312167",
"0.6321939",
"0.6321891",
"0.62680143",
"0.6250577",
"0.6198039",
"0.619045",
"0.6188469",
"0.61865056",
"0.6177288",
"0.61594063",
"0.6150592",
"0.6148869",
"0.6143358",
"0.6135327",
"0.61277395",
"0.6111747",
"0.6109599",
"0.61055565",
"0.61055565",
"0.61036444",
"0.60851413",
"0.6084477",
"0.60827756",
"0.60753095",
"0.607219",
"0.60698485",
"0.60698485",
"0.60694003",
"0.60693836",
"0.6067543",
"0.606616",
"0.6058099",
"0.6058099",
"0.60562587",
"0.6056216",
"0.6056216",
"0.6045941",
"0.6043341",
"0.60420525",
"0.6027956",
"0.6026799",
"0.6026799",
"0.6018601",
"0.6014041",
"0.59877396",
"0.59824324",
"0.5981606",
"0.5981606",
"0.59788233",
"0.597533",
"0.597301",
"0.5957209",
"0.59562",
"0.59476954",
"0.5945655",
"0.59394395",
"0.59394395",
"0.5935887",
"0.59325856",
"0.59281623",
"0.5926286",
"0.5921707",
"0.5916803",
"0.5916803",
"0.5916803",
"0.5916803",
"0.5916803",
"0.5904472",
"0.5897743",
"0.58973503",
"0.5863253",
"0.58532506",
"0.5847972",
"0.5813279",
"0.58116454",
"0.5811088",
"0.58103716",
"0.58096945",
"0.5808195",
"0.5808195",
"0.5805706",
"0.5802897",
"0.5798379",
"0.5795965"
] | 0.61594564 | 25 |
Instantiates a new securityContainerRegistryEvidence and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.security.containerRegistryEvidence"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.registryKeyEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.googleCloudResourceEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.kubernetesSecretEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.amazonResourceEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.azureResourceEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.kubernetesPodEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.processEvidence\"\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.oauthApplicationEvidence\"\n end",
"def add_default_values\n ensure_license\n ensure_publisher\n ensure_resource_type\n end",
"def initialize(registry={})\n self.registry = registry\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.mailClusterEvidence\"\n end",
"def create_default_collection_event_parameters(rep)\n cep = parent.collection_event_parameters if parent\n user = cep.user if cep\n user ||= scg_collector || rep.user || return\n cep = CaTissue::CollectionEventParameters.new(:specimen => self, :user => user)\n logger.debug { \"Created default #{qp} collection event #{cep.qp}.\" }\n cep\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.fileEvidence\"\n end",
"def initialize\n @codice_fiscale = CodiceFiscaleConfiguration.new\n @cap_lookup = CapLookupConfiguration.new\n end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def initialize(options = {})\n super\n @assigned_factories = {}\n @rng_seed = options[:rng_seed] || Random.new_seed\n end",
"def initialize\n raise \"Cannot instantiate Dependo::Registry\"\n end",
"def do_initialize\n Puppet.initialize_settings\n Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8\n Puppet[:trusted_node_data] = true\n rescue ArgumentError => e\n rescue Puppet::DevError => e\n # do nothing otherwise calling init twice raises an error\n end",
"def initialize\n @registry = Registry.new\n end",
"def do_initialize\n begin\n Puppet.initialize_settings\n Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8\n Puppet[:trusted_node_data] = true\n rescue ArgumentError => e\n\n rescue Puppet::DevError => e\n # do nothing otherwise calling init twice raises an error\n end\n end",
"def initialize_runtime_fields\n @experiment = Experiment.find_by_id(self.experiment_id)\n @resources_interface = ExperimentResourcesInterface.new(@experiment, self.user_id, self.allowed_resource_configurations)\n @experiment_metrics = ExperimentMetrics.new(@experiment, @resources_interface)\n self\n end",
"def initialize(affiliation, password, environment)\n @security = Rede::Security.new(affiliation, password, environment)\n end",
"def initialize(registry = T.unsafe(nil)); end",
"def initialize digital_object, dsid, options = {}\n _run_initialize_callbacks do\n @digital_object = digital_object\n @dsid = dsid\n options.each do |key, value|\n self.send(:\"#{key}=\", value)\n end\n end\n end",
"def initialize(opts={}, prnt=Ec2.new)\n @uniquely_identifiable_by = [:ip, :name, :dns_name, :instance_id]\n @original_options = opts\n @my_cloud = prnt\n super(opts, prnt)\n find_myself(@uniquely_identifiable_by && opts.keys) if prnt.respond_to?(:describe_instances)\n end",
"def initialize_default_values!\n Marshal.load(Marshal.dump(self.class.default_values)).each do |k, v|\n self[k] ||= v\n end\n end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.security.ediscoveryReviewTag\"\n end",
"def initialize\n @registry = {}\n end",
"def initialize(&block)\n load_defaults!\n\n instance_eval(&block)\n end",
"def add_defaults_local\n super\n self.collection_event ||= parent.collection_event if parent\n self.specimen_characteristics ||= CaTissue::SpecimenCharacteristics.new\n end",
"def initialize(&block)\n load_defaults!\n\n instance_eval(&block) if block_given?\n\n set_defaults!\n end",
"def initialize( options=DEFAULT_OPTIONS )\n\t\t\toptions = DEFAULT_OPTIONS.merge( options || {} )\n\n\t\t\toptions.each do |name, value|\n\t\t\t\tself.public_send( \"#{name}=\", value )\n\t\t\tend\n\n\t\t\t@resolver = Resolv::DNS.new\n\t\tend",
"def initialize(id, site_name, description, riskfactor = 1)\n\t\t@id = id\n\t\t@site_name = site_name\n\t\t@description = description\n\t\t@riskfactor = riskfactor\n\tend",
"def initialize(days, events)\n super days\n add_associated_events_to_days(events)\n end",
"def pre_run_initialize\n @evaluator = @evaluator_class.new(self) if @evaluator.nil?\n @evolver = @evolver_class.new(self) if @evolver.nil?\n end",
"def initialize(options, monitoring, seeds = [])\n @options = options\n @monitoring = monitoring\n @max_election_id = nil\n @max_set_version = nil\n end",
"def initialize(params = nil)\n @env = Hash.new\n unless params.nil?\n params.each_pair { |var, typ|\n @env[var] = {type: typ, fixed: true}\n }\n end\n end",
"def new\n @setup = EsSetup.new()\n @setup.read_only = 'N'\n end",
"def x509_initvar\n @x509_sign_and_crypt_method ||= @@default_x509_sign_and_crypt_method\n @x509_sign ||= @@default_x509_sign\n @x509_crypt ||= @@default_x509_crypt\n @x509_crypt_cert ||= @@default_x509_crypt_cert\n @x509_crypt_cipher ||= @@default_x509_crypt_cipher\n @x509_sign_cert ||= @@default_x509_sign_cert\n @x509_key ||= @@default_x509_sign_key\n @x509_sign_passphrase ||= @@default_x509_sign_passphrase\n end",
"def x509_initvar\n @x509_sign_and_crypt_method ||= @@default_x509_sign_and_crypt_method\n @x509_sign ||= @@default_x509_sign\n @x509_crypt ||= @@default_x509_crypt\n @x509_crypt_cert ||= @@default_x509_crypt_cert\n @x509_crypt_cipher ||= @@default_x509_crypt_cipher\n @x509_sign_cert ||= @@default_x509_sign_cert\n @x509_key ||= @@default_x509_sign_key\n @x509_sign_passphrase ||= @@default_x509_sign_passphrase\n end",
"def initialize(keyid = nil, vcode = nil, scope=\"account\")\n keyid ||= EAAL.config.keyid\n vcode ||= EAAL.config.vcode\n scope = EAAL.config.scope if EAAL.config.scope\n self.keyid = keyid.to_s\n self.vcode = vcode.to_s\n self.scope = scope.to_s\n end",
"def initialize(seed)\n Ed25519.validate_key_bytes(seed)\n\n @seed = seed\n @keypair = Ed25519.provider.create_keypair(seed)\n @verify_key = VerifyKey.new(@keypair[32, 32])\n end",
"def leave_default_initialization!(retval, resource, value)\n return unless resource.class.is_protectable?\n if Thread.current[:initializing_default_values]\n Thread.current[:initializing_default_values] = false\n end\n end",
"def initialize(attributes = {})\n @raw = attributes\n\n base = @raw.dig('informationBase') || {}\n\n @found = base.dig('foundInRegistry') == 'true'\n @siren = base.dig('siren')\n @orias = base.dig('registrationNumber')\n @denomination = base.dig('denomination')\n\n raw_registrations = @raw.dig('registrations', 'registration')\n @registrations = process_raw_registrations(raw_registrations)\n end",
"def get_field_deserializers()\n return super.merge({\n \"containers\" => lambda {|n| @containers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityContainerEvidence.create_from_discriminator_value(pn) }) },\n \"controller\" => lambda {|n| @controller = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityKubernetesControllerEvidence.create_from_discriminator_value(pn) }) },\n \"ephemeralContainers\" => lambda {|n| @ephemeral_containers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityContainerEvidence.create_from_discriminator_value(pn) }) },\n \"initContainers\" => lambda {|n| @init_containers = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SecurityContainerEvidence.create_from_discriminator_value(pn) }) },\n \"labels\" => lambda {|n| @labels = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityDictionary.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"namespace\" => lambda {|n| @namespace = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityKubernetesNamespaceEvidence.create_from_discriminator_value(pn) }) },\n \"podIp\" => lambda {|n| @pod_ip = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityIpEvidence.create_from_discriminator_value(pn) }) },\n \"serviceAccount\" => lambda {|n| @service_account = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityKubernetesServiceAccountEvidence.create_from_discriminator_value(pn) }) },\n })\n end",
"def initialize\n @territory = nil\n @weekend = nil\n @public_holiday_specifications = nil\n @generated_years = Array.new\n @public_holiday_collection = Array.new\n @public_holiday_hash = Hash.new\n end",
"def initialize(args={})\n set_defaults do\n self.event_id = '020001'\n self.start_reason = 'User Initiated'\n self.terminate_reason = 'User Requested'\n end\n super\n end",
"def apply_system_defaults\n if @region.nil? && @zone.nil?\n @region, @zone = Rudy::DEFAULT_REGION, Rudy::DEFAULT_ZONE\n elsif @region.nil?\n @region = @zone.to_s.gsub(/[a-z]$/, '').to_sym\n elsif @zone.nil?\n @zone = \"#{@region}b\".to_sym\n end\n \n @environment ||= Rudy::DEFAULT_ENVIRONMENT\n @role ||= Rudy::DEFAULT_ROLE\n @localhost ||= Rudy.sysinfo.hostname || 'localhost'\n @auto = false if @auto.nil?\n end",
"def initialize(attributes = {}, &block)\n @attributes = defaults.merge!(attributes)\n\n if block_given?\n @self_before_instance_eval = eval('self', block.binding)\n\n instance_eval(&block)\n end\n end",
"def initialize(klass, id, events, version, prohibit_new = true)\n @events = events\n @id = id\n @klass = klass\n @prohibit_new = prohibit_new\n @version = version\n end",
"def default_config\n data = {\n 'acr_values' => ENV['acr_values'] || 'http://idmanagement.gov/ns/assurance/ial/1',\n 'client_id' => ENV['client_id'] || 'urn:gov:gsa:openidconnect:sp:sinatra',\n 'mock_irs_client_id' => ENV['mock_irs_client_id'] ||\n 'urn:gov:gsa:openidconnect:sp:mock_irs',\n 'redirect_uri' => ENV['redirect_uri'] || 'http://localhost:9292/',\n 'sp_private_key_path' => ENV['sp_private_key_path'] || './config/demo_sp.key',\n 'redact_ssn' => true,\n 'cache_oidc_config' => true,\n }\n\n # EC2 deployment defaults\n\n env = ENV['idp_environment'] || 'int'\n domain = ENV['idp_domain'] || 'identitysandbox.gov'\n\n data['idp_url'] = ENV.fetch('idp_url', nil)\n unless data['idp_url']\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n end\n data['sp_private_key'] = ENV.fetch('sp_private_key', nil)\n\n data\n end",
"def initialize(yamlDisassembly, literalExpression=\"\")\n\n\t\t\t# Check for existence of the file\n\t\t\tif(!File.exists?(yamlDisassembly)) then\n\t\t\t\treturn(nil)\n\t\t\tend\n\n\t\t\t# Unserialize the YAML disassembly\n\t\t\t@attributes = YAML.load(File.open(yamlDisassembly))\t\n\t\t\[email protected]()\n\n\t\t\t# Create an instance of the expression\n\t\t\tinitialize_solver(literalExpression)\n\t\tend",
"def initialize(params = {})\n params.each { |key, value| send \"#{key}=\", value }\n @inst_id = params[:inst_id] || \"\"\n @contract_interval = params[:contract_interval] || \"\"\n end",
"def initialize(identity, attributes={})\n set_attributes(attributes)\n @identity = identity\n @persisted = false\n @errors = {}\n end",
"def set_default_exuid\n self.exuid ||=\n SecureRandom.random_bytes(8).unpack('Q').first & 0x7fffffffffffffff\n end",
"def preset_default_values( params_hash = {} )\n unless self.patient # Set current patient only if not set\n begin\n if params_hash[:patient_id]\n self.patient_id = params_hash[:patient_id].to_i\n end\n rescue\n self.patient_id = nil\n end\n end\n\n unless self.date_schedule # A default date schedule must be set anyhow:\n begin \n self.date_schedule = params_hash[:date_schedule] ? params_hash[:date_schedule] : Time.now\n rescue # Set default date for this entry:\n self.date_schedule = Time.now\n end\n end\n self\n end",
"def new \n curation_concern.publisher = ['McGill University']\n super\n end",
"def initialize(working_directory, zone_name, parent, config, enforcer_interval, validity)\n @working = working_directory\n @zone = zone_name\n @parent = parent\n @config = config\n @enforcer_interval = enforcer_interval\n @last_soa_serial = nil\n @initial_timestamp = Time.now.to_i\n @validity = validity\n @cache = load_tracker_cache()\n end",
"def init_calculation\n @gross_zone_residual_demands ||= GrossZoneResidualDemands.new\n end",
"def set_defaults\n super\n self.event_date ||= Date.today\n self.state ||= \"new\"\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def initialize(allowed_values)\n @allowed_values = allowed_values\n end",
"def default_config\n data = {\n 'acr_values' => 'http://idmanagement.gov/ns/assurance/loa/1',\n 'client_id' => 'urn:gov:gsa:openidconnect:sp:sinatra',\n }\n\n if LoginGov::Hostdata.in_datacenter?\n # EC2 deployment defaults\n\n env = LoginGov::Hostdata.env\n domain = LoginGov::Hostdata.domain\n\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n data['redirect_uri'] = \"https://sp-oidc-sinatra.#{env}.#{domain}/\"\n data['sp_private_key_path'] = \"aws-secretsmanager:#{env}/sp-oidc-sinatra/oidc.key\"\n data['redact_ssn'] = true\n else\n # local dev defaults\n data['idp_url'] = 'http://localhost:3000'\n data['redirect_uri'] = 'http://localhost:9292/'\n data['sp_private_key_path'] = demo_private_key_path\n data['redact_ssn'] = false\n end\n\n data\n end",
"def initialize(seed, encoding = :raw)\n seed = Encoder[encoding].decode(seed)\n\n Util.check_length(seed, NaCl::SECRETKEYBYTES, \"seed\")\n\n pk = Util.zeros(NaCl::PUBLICKEYBYTES)\n sk = Util.zeros(NaCl::SECRETKEYBYTES * 2)\n\n NaCl.crypto_sign_seed_keypair(pk, sk, seed) || raise(CryptoError, \"Failed to generate a key pair\")\n\n @seed, @signing_key = seed, sk\n @verify_key = VerifyKey.new(pk)\n end",
"def initialize null_object_signature=nil\n @null_object_signature = null_object_signature \n end",
"def initialize(options)\n @options = normalize_options(options)\n\n validate_options\n initialize_registry\n\n @logger = Bosh::Clouds::Config.logger\n\n @agent_properties = @options.fetch('agent', {})\n openstack_properties = @options['openstack']\n @default_key_name = openstack_properties['default_key_name']\n @default_security_groups = openstack_properties['default_security_groups']\n @default_volume_type = openstack_properties['default_volume_type']\n @stemcell_public_visibility = openstack_properties['stemcell_public_visibility']\n @boot_from_volume = openstack_properties['boot_from_volume']\n @use_dhcp = openstack_properties['use_dhcp']\n @human_readable_vm_names = openstack_properties['human_readable_vm_names']\n @enable_auto_anti_affinity = openstack_properties['enable_auto_anti_affinity']\n @use_config_drive = !!openstack_properties.fetch('config_drive', false)\n @config_drive = openstack_properties['config_drive']\n\n @openstack = Bosh::OpenStackCloud::Openstack.new(@options['openstack'])\n\n @az_provider = Bosh::OpenStackCloud::AvailabilityZoneProvider.new(\n @openstack,\n openstack_properties['ignore_server_availability_zone'],\n )\n\n @metadata_lock = Mutex.new\n\n @instance_type_mapper = Bosh::OpenStackCloud::InstanceTypeMapper.new\n end",
"def create\n Puppet.debug(\"Calling create method of security_policy_parameter_protectionprovider: \")\n end",
"def initialize(kernel_type='RBF')\n @training_data_set = Diabetic.pick(538)\n @training = @training_data_set.collect {|d| [d.pregnant,\n d.oral_glucose_tolerance,\n d.blood_pressure,\n d.skin_fold_thickness,\n d.serum_insulin,\n d.body_mass_index,\n d.pedigree_function,\n d.age,\n d.positive]}\n\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 100 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 10\n\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end",
"def initialize(value,cause)\n @value = value\n @cause = cause\n end",
"def service_principal_risk_detections=(value)\n @service_principal_risk_detections = value\n end",
"def initialize(verbose = true)\n\n @verbose = verbose\n\n @open_ssl_tool_path = \"/usr/bin/openssl\"\n @plistbuddy_tool_path = \"/usr/libexec/PlistBuddy\"\n @evroots_config_path = File.join(CertTools.certificate_dir, \"CertificateTool/BuildOSXRootKeychain/evroot.config\")\n @evroots_config_data = nil\n\n Utilities.check_path(@evroots_config_path, false)\n\n @evroots_kc_name = \"EVRoots.keychain\"\n @evroots_kc_path = File.join(CertTools.build_dir, @evroots_kc_name)\n\n @evroots_plist_name = \"EVRoots.plist\"\n @evroots_plist_path = File.join(CertTools.output_keychain_path, @evroots_plist_name)\n\n end",
"def initialize\n @sdc_name = nil\n @global_sw = false\n @syn_flag = \"none\"\n @ucf_const = Array.new\n @ise_flag = \"none\"\n @rep_result = nil\n end",
"def initialize(cause:)\n super\n\n self.cause = cause\n end",
"def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2',\n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST,\n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => @@api },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end",
"def initialize(runtime_class, value = self)\n @runtime_class = runtime_class\n @value = value\n end",
"def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2', \n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST, \n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH, \n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL }, \n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end",
"def risk_detections=(value)\n @risk_detections = value\n end",
"def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end",
"def init_default_config\n configuration.project_id ||= (Cloud.configure.project_id || ErrorReporting::Project.default_project_id)\n configuration.credentials ||= Cloud.configure.credentials\n configuration.service_name ||= ErrorReporting::Project.default_service_name\n configuration.service_version ||= ErrorReporting::Project.default_service_version\n configuration.ignore_classes = Array(configuration.ignore_classes)\n end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def initialize(certname, reusable=false, validfor=7200, requester, secret)\n # set up logging\n @log = Logging.logger[self.class]\n @log.debug \"initializing #{self.class.name}\"\n\n @validfor = validfor\n @certname = certname\n @reusable = reusable\n @requester = requester\n @secret = secret\n @uuid = SecureRandom.uuid # UUID is needed to allow token regeneration with the same settings\n @validto = Time.now.to_i + self.validfor\n end",
"def initialize(attributes = {})\n defaults.merge!(validate(attributes)).each do |key, value|\n instance_variable_set(\"@#{key}\", value || defaults.fetch(key))\n end\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def set_default_exuid\n self.exuid ||=\n Base32.encode(SecureRandom.random_bytes(16)).downcase.sub(/=*$/, '')\n end",
"def default_factory=(factory); end",
"def initialize( rest_url = nil, params = {}, test_mode: false, debug_mode: false )\n\n # Of course it can, lots of processes defines the url later.\n # raise \"RubyBareEsi.initialize : rest_url can't be nil\" unless rest_url\n\n @debug_mode = debug_mode || ENV['EBS_DEBUG_MODE'] == 'true'\n @test_mode = test_mode\n\n puts 'RubyBareEsi.initialize : debug mode on' if @debug_mode\n\n @rest_url = rest_url\n @params = params.merge( ESI_DATA_SOURCE )\n @forbidden_count = 0\n end",
"def initialize(inst_var)\n @inst_var = inst_var # instance variables that are initialized when new instance is created\n end",
"def initialize\n @reservations = {}\n @secret = HelperFunctions.get_secret()\n end",
"def initialize(events=[:gs, :downhill])\n @events = events # when we make a skier object, that object will have access to the instance variable,\n # which is the variable with the @. \n # when you pass parameters, they're only usable in that method, unless you have them instance variables.\n # att\n end",
"def initialize(recipe, options = {})\n @recipe = recipe\n @scope = Scope.new(recipe)\n\n # For some reason, +Hiera+'s constructor expects a hash with just the\n # one key.\n super({ :config => hiera_config(options) })\n end",
"def initialize\n set_default_as_provider\n yield self if block_given?\n end",
"def set_evidence\n @evidence = Evidence.find(params[:id])\n end",
"def set_evidence\n @evidence = Evidence.find(params[:id])\n end",
"def initialize(source_hash = T.unsafe(nil), default = T.unsafe(nil), &blk); end",
"def set_default_values\n @mappings ||= {}\n @attr_methods ||= []\n @search_mappings ||= {}\n @value_blocks ||= {}\n @missing_blocks ||= {}\n @primary_key ||= :id\n end",
"def auto_initialize!\n # noop by default\n end",
"def add_default_verifiers\n public_key_bytes = Crypto::Bytes.from_base64(SERVICE_PUBLIC_KEY)\n public_key = crypto.import_public_key(public_key_bytes)\n @verifiers[SERVICE_CARD_ID] = public_key\n end",
"def initialize(params={})\n @logger = Logger.new(STDOUT)\n establish_main_container(params)\n if main?\n @ams = AgentManagementSystem.new(\n :addresses => agent_transport_addresses,\n :logger => logger\n )\n @df = DirectoryFacilitator.new(\n :logger => logger\n )\n @acc = AgentCommunicationChannel.new(\n :logger => logger,\n :ams => ams\n )\n else\n logger.debug \"Obtaining reference to main container AMS...\"\n @ams = main_container.ams\n logger.debug \"Done obtaining reference to main container AMS.\"\n logger.debug \"Obtaining reference to main container DF...\"\n @df = main_container.df # FIXME: broken as of JRuby 0.9.8: see http://jira.codehaus.org/browse/JRUBY-572\n logger.debug \"Done obtaining reference to main container DF.\"\n logger.debug \"Obtaining reference to main container ACC...\"\n @acc = main_container.acc\n logger.debug \"Done obtaining reference to main container ACC.\"\n end\n @config = params[:config] || \"rage.yaml\"\n end",
"def initialize(params = {})\n super(DEFAULTS.merge(params))\n end"
] | [
"0.641984",
"0.57567924",
"0.56801087",
"0.5619467",
"0.5546558",
"0.5406718",
"0.53548807",
"0.5220076",
"0.5012527",
"0.4963109",
"0.49273753",
"0.4919461",
"0.48658895",
"0.48651102",
"0.48417595",
"0.48417595",
"0.47785822",
"0.4772516",
"0.47507504",
"0.47369826",
"0.47363672",
"0.47337857",
"0.46941832",
"0.46461827",
"0.4641446",
"0.4628158",
"0.46278644",
"0.45826998",
"0.45518175",
"0.4545872",
"0.45250776",
"0.45173514",
"0.44888943",
"0.44763693",
"0.44583872",
"0.44578695",
"0.44072726",
"0.44027802",
"0.4401837",
"0.4401357",
"0.4401357",
"0.4391619",
"0.4383809",
"0.43724403",
"0.4368412",
"0.43446714",
"0.43387958",
"0.4334107",
"0.43334147",
"0.4332148",
"0.4331447",
"0.43298656",
"0.43287736",
"0.43280983",
"0.43240994",
"0.43238178",
"0.43200663",
"0.43177795",
"0.43064615",
"0.42971885",
"0.42937973",
"0.42913592",
"0.42839524",
"0.427942",
"0.42779616",
"0.42752558",
"0.42750177",
"0.42722973",
"0.42697963",
"0.42690954",
"0.42664105",
"0.42609173",
"0.42606997",
"0.42579243",
"0.4256654",
"0.42540485",
"0.425212",
"0.42506412",
"0.42494035",
"0.42475548",
"0.42378527",
"0.4236338",
"0.4229525",
"0.4229525",
"0.42267194",
"0.42266223",
"0.42255023",
"0.42236656",
"0.42227545",
"0.42226613",
"0.4219858",
"0.42195648",
"0.42178556",
"0.42178556",
"0.4217708",
"0.42152795",
"0.42122912",
"0.420736",
"0.42072943",
"0.42054978"
] | 0.6913321 | 0 |
The deserialization information for the current model | def get_field_deserializers()
return super.merge({
"registry" => lambda {|n| @registry = n.get_string_value() },
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"fileDetails\" => lambda {|n| @file_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n })\n end",
"def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"attribution\" => lambda {|n| @attribution = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImageInfo.create_from_discriminator_value(pn) }) },\n \"backgroundColor\" => lambda {|n| @background_color = n.get_string_value() },\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayText\" => lambda {|n| @display_text = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"detectionType\" => lambda {|n| @detection_type = n.get_string_value() },\n \"method\" => lambda {|n| @method = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"maxImageSize\" => lambda {|n| @max_image_size = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"timeout\" => lambda {|n| @timeout = n.get_duration_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"headerValue\" => lambda {|n| @header_value = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"callEndSubReason\" => lambda {|n| @call_end_sub_reason = n.get_number_value() },\n \"callType\" => lambda {|n| @call_type = n.get_string_value() },\n \"calleeNumber\" => lambda {|n| @callee_number = n.get_string_value() },\n \"callerNumber\" => lambda {|n| @caller_number = n.get_string_value() },\n \"correlationId\" => lambda {|n| @correlation_id = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_number_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"failureDateTime\" => lambda {|n| @failure_date_time = n.get_date_time_value() },\n \"finalSipCode\" => lambda {|n| @final_sip_code = n.get_number_value() },\n \"finalSipCodePhrase\" => lambda {|n| @final_sip_code_phrase = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"inviteDateTime\" => lambda {|n| @invite_date_time = n.get_date_time_value() },\n \"mediaBypassEnabled\" => lambda {|n| @media_bypass_enabled = n.get_boolean_value() },\n \"mediaPathLocation\" => lambda {|n| @media_path_location = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"signalingLocation\" => lambda {|n| @signaling_location = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"successfulCall\" => lambda {|n| @successful_call = n.get_boolean_value() },\n \"trunkFullyQualifiedDomainName\" => lambda {|n| @trunk_fully_qualified_domain_name = n.get_string_value() },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"versionId\" => lambda {|n| @version_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"buildNumber\" => lambda {|n| @build_number = n.get_string_value() },\n \"bundleId\" => lambda {|n| @bundle_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"versionNumber\" => lambda {|n| @version_number = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"imageFile\" => lambda {|n| @image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n \"parentProcessCreationDateTime\" => lambda {|n| @parent_process_creation_date_time = n.get_date_time_value() },\n \"parentProcessId\" => lambda {|n| @parent_process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"parentProcessImageFile\" => lambda {|n| @parent_process_image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"processCommandLine\" => lambda {|n| @process_command_line = n.get_string_value() },\n \"processCreationDateTime\" => lambda {|n| @process_creation_date_time = n.get_date_time_value() },\n \"processId\" => lambda {|n| @process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"userAccount\" => lambda {|n| @user_account = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityUserAccount.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::OperationStatus) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"progress\" => lambda {|n| @progress = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DataPolicyOperationStatus) },\n \"storageLocation\" => lambda {|n| @storage_location = n.get_string_value() },\n \"submittedDateTime\" => lambda {|n| @submitted_date_time = n.get_date_time_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"completedUnits\" => lambda {|n| @completed_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"progressObservationDateTime\" => lambda {|n| @progress_observation_date_time = n.get_date_time_value() },\n \"totalUnits\" => lambda {|n| @total_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"units\" => lambda {|n| @units = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"provisioningStepType\" => lambda {|n| @provisioning_step_type = n.get_enum_value(MicrosoftGraph::Models::ProvisioningStepType) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ProvisioningResult) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"check32BitOn64System\" => lambda {|n| @check32_bit_on64_system = n.get_boolean_value() },\n \"comparisonValue\" => lambda {|n| @comparison_value = n.get_string_value() },\n \"fileOrFolderName\" => lambda {|n| @file_or_folder_name = n.get_string_value() },\n \"operationType\" => lambda {|n| @operation_type = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppFileSystemOperationType) },\n \"operator\" => lambda {|n| @operator = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppRuleOperator) },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n })\n end",
"def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end",
"def get_field_deserializers()\n return {\n \"destinationFileName\" => lambda {|n| @destination_file_name = n.get_string_value() },\n \"sourceFile\" => lambda {|n| @source_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemReference.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return {\n \"newText\" => lambda {|n| @new_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numBytes\" => lambda {|n| @num_bytes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"oldText\" => lambda {|n| @old_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"startNum\" => lambda {|n| @start_num = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"targetType\" => lambda {|n| @target_type = n.get_enum_value(MicrosoftGraph::Models::FeatureTargetType) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"activationUrl\" => lambda {|n| @activation_url = n.get_string_value() },\n \"activitySourceHost\" => lambda {|n| @activity_source_host = n.get_string_value() },\n \"appActivityId\" => lambda {|n| @app_activity_id = n.get_string_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"contentInfo\" => lambda {|n| @content_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fallbackUrl\" => lambda {|n| @fallback_url = n.get_string_value() },\n \"historyItems\" => lambda {|n| @history_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ActivityHistoryItem.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::Status) },\n \"userTimezone\" => lambda {|n| @user_timezone = n.get_string_value() },\n \"visualElements\" => lambda {|n| @visual_elements = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::VisualInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"category\" => lambda {|n| @category = n.get_string_value() },\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"malwareIdentifier\" => lambda {|n| @malware_identifier = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"lastActionDateTime\" => lambda {|n| @last_action_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operation\" => lambda {|n| @operation = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"identityType\" => lambda {|n| @identity_type = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"dataLocationCode\" => lambda {|n| @data_location_code = n.get_string_value() },\n \"hostname\" => lambda {|n| @hostname = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"root\" => lambda {|n| @root = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Root.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return {\n \"address\" => lambda {|n| @address = n.get_string_value() },\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"relevanceScore\" => lambda {|n| @relevance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"selectionLikelihood\" => lambda {|n| @selection_likelihood = n.get_enum_value(MicrosoftGraph::Models::SelectionLikelihoodInfo) },\n }\n end",
"def get_field_deserializers()\n return {\n \"hashes\" => lambda {|n| @hashes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Hashes.create_from_discriminator_value(pn) }) },\n \"mimeType\" => lambda {|n| @mime_type = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"processingMetadata\" => lambda {|n| @processing_metadata = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"errorDetails\" => lambda {|n| @error_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::GenericError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"sourceId\" => lambda {|n| @source_id = n.get_string_value() },\n \"targetId\" => lambda {|n| @target_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"contentSource\" => lambda {|n| @content_source = n.get_string_value() },\n \"hitId\" => lambda {|n| @hit_id = n.get_string_value() },\n \"isCollapsed\" => lambda {|n| @is_collapsed = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"rank\" => lambda {|n| @rank = n.get_number_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resultTemplateId\" => lambda {|n| @result_template_id = n.get_string_value() },\n \"summary\" => lambda {|n| @summary = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"assignedUserPrincipalName\" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },\n \"groupTag\" => lambda {|n| @group_tag = n.get_string_value() },\n \"hardwareIdentifier\" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"importId\" => lambda {|n| @import_id = n.get_string_value() },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"serialNumber\" => lambda {|n| @serial_number = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"audioRoutingGroups\" => lambda {|n| @audio_routing_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AudioRoutingGroup.create_from_discriminator_value(pn) }) },\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_string_value() },\n \"callOptions\" => lambda {|n| @call_options = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallOptions.create_from_discriminator_value(pn) }) },\n \"callRoutes\" => lambda {|n| @call_routes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CallRoute.create_from_discriminator_value(pn) }) },\n \"callbackUri\" => lambda {|n| @callback_uri = n.get_string_value() },\n \"chatInfo\" => lambda {|n| @chat_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ChatInfo.create_from_discriminator_value(pn) }) },\n \"contentSharingSessions\" => lambda {|n| @content_sharing_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ContentSharingSession.create_from_discriminator_value(pn) }) },\n \"direction\" => lambda {|n| @direction = n.get_enum_value(MicrosoftGraph::Models::CallDirection) },\n \"incomingContext\" => lambda {|n| @incoming_context = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IncomingContext.create_from_discriminator_value(pn) }) },\n \"mediaConfig\" => lambda {|n| @media_config = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaConfig.create_from_discriminator_value(pn) }) },\n \"mediaState\" => lambda {|n| @media_state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallMediaState.create_from_discriminator_value(pn) }) },\n \"meetingInfo\" => lambda {|n| @meeting_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MeetingInfo.create_from_discriminator_value(pn) }) },\n \"myParticipantId\" => lambda {|n| @my_participant_id = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CommsOperation.create_from_discriminator_value(pn) }) },\n \"participants\" => lambda {|n| @participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Participant.create_from_discriminator_value(pn) }) },\n \"requestedModalities\" => lambda {|n| @requested_modalities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Modality.create_from_discriminator_value(pn) }) },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ParticipantInfo.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::CallState) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InvitationParticipantInfo.create_from_discriminator_value(pn) }) },\n \"tenantId\" => lambda {|n| @tenant_id = n.get_string_value() },\n \"toneInfo\" => lambda {|n| @tone_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ToneInfo.create_from_discriminator_value(pn) }) },\n \"transcription\" => lambda {|n| @transcription = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallTranscriptionInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"teacherNumber\" => lambda {|n| @teacher_number = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"key\" => lambda {|n| @key = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"thumbprint\" => lambda {|n| @thumbprint = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"usage\" => lambda {|n| @usage = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"allowMultipleLines\" => lambda {|n| @allow_multiple_lines = n.get_boolean_value() },\n \"appendChangesToExistingText\" => lambda {|n| @append_changes_to_existing_text = n.get_boolean_value() },\n \"linesForEditing\" => lambda {|n| @lines_for_editing = n.get_number_value() },\n \"maxLength\" => lambda {|n| @max_length = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"textType\" => lambda {|n| @text_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"assignCategories\" => lambda {|n| @assign_categories = n.get_collection_of_primitive_values(String) },\n \"copyToFolder\" => lambda {|n| @copy_to_folder = n.get_string_value() },\n \"delete\" => lambda {|n| @delete = n.get_boolean_value() },\n \"forwardAsAttachmentTo\" => lambda {|n| @forward_as_attachment_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"forwardTo\" => lambda {|n| @forward_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"markAsRead\" => lambda {|n| @mark_as_read = n.get_boolean_value() },\n \"markImportance\" => lambda {|n| @mark_importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"moveToFolder\" => lambda {|n| @move_to_folder = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"permanentDelete\" => lambda {|n| @permanent_delete = n.get_boolean_value() },\n \"redirectTo\" => lambda {|n| @redirect_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"stopProcessingRules\" => lambda {|n| @stop_processing_rules = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"acceptMappedClaims\" => lambda {|n| @accept_mapped_claims = n.get_boolean_value() },\n \"knownClientApplications\" => lambda {|n| @known_client_applications = n.get_collection_of_primitive_values(UUIDTools::UUID) },\n \"oauth2PermissionScopes\" => lambda {|n| @oauth2_permission_scopes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PermissionScope.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preAuthorizedApplications\" => lambda {|n| @pre_authorized_applications = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PreAuthorizedApplication.create_from_discriminator_value(pn) }) },\n \"requestedAccessTokenVersion\" => lambda {|n| @requested_access_token_version = n.get_number_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return {\n \"failedRuns\" => lambda {|n| @failed_runs = n.get_number_value() },\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulRuns\" => lambda {|n| @successful_runs = n.get_number_value() },\n \"totalRuns\" => lambda {|n| @total_runs = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_guid_value() },\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"recommendedActions\" => lambda {|n| @recommended_actions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RecommendedAction.create_from_discriminator_value(pn) }) },\n \"resolvedTargetsCount\" => lambda {|n| @resolved_targets_count = n.get_number_value() },\n \"simulationEventsContent\" => lambda {|n| @simulation_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SimulationEventsContent.create_from_discriminator_value(pn) }) },\n \"trainingEventsContent\" => lambda {|n| @training_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TrainingEventsContent.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"hint\" => lambda {|n| @hint = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"secretText\" => lambda {|n| @secret_text = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"isRequired\" => lambda {|n| @is_required = n.get_boolean_value() },\n \"locations\" => lambda {|n| @locations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LocationConstraintItem.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"suggestLocation\" => lambda {|n| @suggest_location = n.get_boolean_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"activityType\" => lambda {|n| @activity_type = n.get_string_value() },\n \"chainId\" => lambda {|n| @chain_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"previewText\" => lambda {|n| @preview_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"recipient\" => lambda {|n| @recipient = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkNotificationRecipient.create_from_discriminator_value(pn) }) },\n \"templateParameters\" => lambda {|n| @template_parameters = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::KeyValuePair.create_from_discriminator_value(pn) }) },\n \"topic\" => lambda {|n| @topic = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkActivityTopic.create_from_discriminator_value(pn) }) },\n }\n end",
"def metadata\n self.class.metadata\n end",
"def get_field_deserializers()\n return {\n \"activityIdentifier\" => lambda {|n| @activity_identifier = n.get_string_value() },\n \"countEntitled\" => lambda {|n| @count_entitled = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEntitledForProvisioning\" => lambda {|n| @count_entitled_for_provisioning = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowed\" => lambda {|n| @count_escrowed = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowedRaw\" => lambda {|n| @count_escrowed_raw = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExported\" => lambda {|n| @count_exported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExports\" => lambda {|n| @count_exports = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImported\" => lambda {|n| @count_imported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedDeltas\" => lambda {|n| @count_imported_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedReferenceDeltas\" => lambda {|n| @count_imported_reference_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"error\" => lambda {|n| @error = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::SynchronizationTaskExecutionResult) },\n \"timeBegan\" => lambda {|n| @time_began = n.get_date_time_value() },\n \"timeEnded\" => lambda {|n| @time_ended = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"content\" => lambda {|n| @content = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"transportKey\" => lambda {|n| @transport_key = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"activeDeviceCount\" => lambda {|n| @active_device_count = n.get_number_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"modelAppHealthScore\" => lambda {|n| @model_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceAccess\" => lambda {|n| @resource_access = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ResourceAccess.create_from_discriminator_value(pn) }) },\n \"resourceAppId\" => lambda {|n| @resource_app_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end",
"def get_field_deserializers()\n return {\n \"anchor\" => lambda {|n| @anchor = n.get_boolean_value() },\n \"apiExpressions\" => lambda {|n| @api_expressions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::StringKeyStringValuePair.create_from_discriminator_value(pn) }) },\n \"caseExact\" => lambda {|n| @case_exact = n.get_boolean_value() },\n \"defaultValue\" => lambda {|n| @default_value = n.get_string_value() },\n \"flowNullValues\" => lambda {|n| @flow_null_values = n.get_boolean_value() },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeDefinitionMetadataEntry.create_from_discriminator_value(pn) }) },\n \"multivalued\" => lambda {|n| @multivalued = n.get_boolean_value() },\n \"mutability\" => lambda {|n| @mutability = n.get_enum_value(MicrosoftGraph::Models::Mutability) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"referencedObjects\" => lambda {|n| @referenced_objects = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ReferencedObject.create_from_discriminator_value(pn) }) },\n \"required\" => lambda {|n| @required = n.get_boolean_value() },\n \"type\" => lambda {|n| @type = n.get_enum_value(MicrosoftGraph::Models::AttributeType) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"averageBlueScreens\" => lambda {|n| @average_blue_screens = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageRestarts\" => lambda {|n| @average_restarts = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"blueScreenCount\" => lambda {|n| @blue_screen_count = n.get_number_value() },\n \"bootScore\" => lambda {|n| @boot_score = n.get_number_value() },\n \"coreBootTimeInMs\" => lambda {|n| @core_boot_time_in_ms = n.get_number_value() },\n \"coreLoginTimeInMs\" => lambda {|n| @core_login_time_in_ms = n.get_number_value() },\n \"deviceCount\" => lambda {|n| @device_count = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"diskType\" => lambda {|n| @disk_type = n.get_enum_value(MicrosoftGraph::Models::DiskType) },\n \"groupPolicyBootTimeInMs\" => lambda {|n| @group_policy_boot_time_in_ms = n.get_number_value() },\n \"groupPolicyLoginTimeInMs\" => lambda {|n| @group_policy_login_time_in_ms = n.get_number_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"loginScore\" => lambda {|n| @login_score = n.get_number_value() },\n \"manufacturer\" => lambda {|n| @manufacturer = n.get_string_value() },\n \"model\" => lambda {|n| @model = n.get_string_value() },\n \"modelStartupPerformanceScore\" => lambda {|n| @model_startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"operatingSystemVersion\" => lambda {|n| @operating_system_version = n.get_string_value() },\n \"responsiveDesktopTimeInMs\" => lambda {|n| @responsive_desktop_time_in_ms = n.get_number_value() },\n \"restartCount\" => lambda {|n| @restart_count = n.get_number_value() },\n \"startupPerformanceScore\" => lambda {|n| @startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return {\n \"connectingIP\" => lambda {|n| @connecting_i_p = n.get_string_value() },\n \"deliveryAction\" => lambda {|n| @delivery_action = n.get_string_value() },\n \"deliveryLocation\" => lambda {|n| @delivery_location = n.get_string_value() },\n \"directionality\" => lambda {|n| @directionality = n.get_string_value() },\n \"internetMessageId\" => lambda {|n| @internet_message_id = n.get_string_value() },\n \"messageFingerprint\" => lambda {|n| @message_fingerprint = n.get_string_value() },\n \"messageReceivedDateTime\" => lambda {|n| @message_received_date_time = n.get_date_time_value() },\n \"messageSubject\" => lambda {|n| @message_subject = n.get_string_value() },\n \"networkMessageId\" => lambda {|n| @network_message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"application\" => lambda {|n| @application = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Identity.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preventsDownload\" => lambda {|n| @prevents_download = n.get_boolean_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"webHtml\" => lambda {|n| @web_html = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"uploadUrl\" => lambda {|n| @upload_url = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceCountWithCrashes\" => lambda {|n| @device_count_with_crashes = n.get_number_value() },\n \"isLatestUsedVersion\" => lambda {|n| @is_latest_used_version = n.get_boolean_value() },\n \"isMostUsedVersion\" => lambda {|n| @is_most_used_version = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"attributeMappings\" => lambda {|n| @attribute_mappings = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeMapping.create_from_discriminator_value(pn) }) },\n \"enabled\" => lambda {|n| @enabled = n.get_boolean_value() },\n \"flowTypes\" => lambda {|n| @flow_types = n.get_enum_value(MicrosoftGraph::Models::ObjectFlowTypes) },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ObjectMappingMetadataEntry.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Filter.create_from_discriminator_value(pn) }) },\n \"sourceObjectName\" => lambda {|n| @source_object_name = n.get_string_value() },\n \"targetObjectName\" => lambda {|n| @target_object_name = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appHangCount\" => lambda {|n| @app_hang_count = n.get_number_value() },\n \"crashedAppCount\" => lambda {|n| @crashed_app_count = n.get_number_value() },\n \"deviceAppHealthScore\" => lambda {|n| @device_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"messageId\" => lambda {|n| @message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"replyChainMessageId\" => lambda {|n| @reply_chain_message_id = n.get_string_value() },\n \"threadId\" => lambda {|n| @thread_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"isUsable\" => lambda {|n| @is_usable = n.get_boolean_value() },\n \"isUsableOnce\" => lambda {|n| @is_usable_once = n.get_boolean_value() },\n \"lifetimeInMinutes\" => lambda {|n| @lifetime_in_minutes = n.get_number_value() },\n \"methodUsabilityReason\" => lambda {|n| @method_usability_reason = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"temporaryAccessPass\" => lambda {|n| @temporary_access_pass = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end",
"def get_field_deserializers()\n return {\n \"bargeInAllowed\" => lambda {|n| @barge_in_allowed = n.get_boolean_value() },\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"initialSilenceTimeoutInSeconds\" => lambda {|n| @initial_silence_timeout_in_seconds = n.get_number_value() },\n \"maxRecordDurationInSeconds\" => lambda {|n| @max_record_duration_in_seconds = n.get_number_value() },\n \"maxSilenceTimeoutInSeconds\" => lambda {|n| @max_silence_timeout_in_seconds = n.get_number_value() },\n \"playBeep\" => lambda {|n| @play_beep = n.get_boolean_value() },\n \"prompts\" => lambda {|n| @prompts = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Prompt.create_from_discriminator_value(pn) }) },\n \"stopTones\" => lambda {|n| @stop_tones = n.get_collection_of_primitive_values(String) },\n }\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"response\" => lambda {|n| @response = n.get_enum_value(MicrosoftGraph::Models::ResponseType) },\n \"time\" => lambda {|n| @time = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"driveId\" => lambda {|n| @drive_id = n.get_string_value() },\n \"driveType\" => lambda {|n| @drive_type = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n \"shareId\" => lambda {|n| @share_id = n.get_string_value() },\n \"sharepointIds\" => lambda {|n| @sharepoint_ids = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SharepointIds.create_from_discriminator_value(pn) }) },\n \"siteId\" => lambda {|n| @site_id = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"activeMalwareDetectionCount\" => lambda {|n| @active_malware_detection_count = n.get_number_value() },\n \"category\" => lambda {|n| @category = n.get_enum_value(MicrosoftGraph::Models::WindowsMalwareCategory) },\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"distinctActiveMalwareCount\" => lambda {|n| @distinct_active_malware_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"issuerName\" => lambda {|n| @issuer_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::CertificateStatus) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"subjectName\" => lambda {|n| @subject_name = n.get_string_value() },\n \"uploadDateTime\" => lambda {|n| @upload_date_time = n.get_date_time_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"servicePrincipalId\" => lambda {|n| @service_principal_id = n.get_string_value() },\n \"servicePrincipalName\" => lambda {|n| @service_principal_name = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"riskDetections\" => lambda {|n| @risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskDetection.create_from_discriminator_value(pn) }) },\n \"riskyServicePrincipals\" => lambda {|n| @risky_service_principals = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyServicePrincipal.create_from_discriminator_value(pn) }) },\n \"riskyUsers\" => lambda {|n| @risky_users = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyUser.create_from_discriminator_value(pn) }) },\n \"servicePrincipalRiskDetections\" => lambda {|n| @service_principal_risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ServicePrincipalRiskDetection.create_from_discriminator_value(pn) }) },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return super.merge({\n })\n end",
"def get_field_deserializers()\n return {\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"failedUsers\" => lambda {|n| @failed_users = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulUsers\" => lambda {|n| @successful_users = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"durationInSeconds\" => lambda {|n| @duration_in_seconds = n.get_number_value() },\n \"joinDateTime\" => lambda {|n| @join_date_time = n.get_date_time_value() },\n \"leaveDateTime\" => lambda {|n| @leave_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"entityType\" => lambda {|n| @entity_type = n.get_string_value() },\n \"mailNickname\" => lambda {|n| @mail_nickname = n.get_string_value() },\n \"onBehalfOfUserId\" => lambda {|n| @on_behalf_of_user_id = n.get_guid_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"actionName\" => lambda {|n| @action_name = n.get_string_value() },\n \"actionState\" => lambda {|n| @action_state = n.get_enum_value(MicrosoftGraph::Models::ActionState) },\n \"lastUpdatedDateTime\" => lambda {|n| @last_updated_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"accountName\" => lambda {|n| @account_name = n.get_string_value() },\n \"azureAdUserId\" => lambda {|n| @azure_ad_user_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"domainName\" => lambda {|n| @domain_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n \"userSid\" => lambda {|n| @user_sid = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n }\n end",
"def get_field_deserializers()\n return {\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_guid_value() },\n \"cloudServiceDeploymentEnvironment\" => lambda {|n| @cloud_service_deployment_environment = n.get_string_value() },\n \"cloudServiceDeploymentId\" => lambda {|n| @cloud_service_deployment_id = n.get_string_value() },\n \"cloudServiceInstanceName\" => lambda {|n| @cloud_service_instance_name = n.get_string_value() },\n \"cloudServiceName\" => lambda {|n| @cloud_service_name = n.get_string_value() },\n \"deviceDescription\" => lambda {|n| @device_description = n.get_string_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"mediaLegId\" => lambda {|n| @media_leg_id = n.get_guid_value() },\n \"mediaQualityList\" => lambda {|n| @media_quality_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TeleconferenceDeviceMediaQuality.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"participantId\" => lambda {|n| @participant_id = n.get_guid_value() },\n }\n end",
"def _before_validation\n serialize_deserialized_values\n super\n end",
"def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isBuiltIn\" => lambda {|n| @is_built_in = n.get_boolean_value() },\n \"roleAssignments\" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },\n \"rolePermissions\" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },\n })\n end",
"def get_field_deserializers()\n return super.merge({\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_string_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n })\n end",
"def get_field_deserializers()\n return {\n \"color\" => lambda {|n| @color = n.get_string_value() },\n \"criterion1\" => lambda {|n| @criterion1 = n.get_string_value() },\n \"criterion2\" => lambda {|n| @criterion2 = n.get_string_value() },\n \"dynamicCriteria\" => lambda {|n| @dynamic_criteria = n.get_string_value() },\n \"filterOn\" => lambda {|n| @filter_on = n.get_string_value() },\n \"icon\" => lambda {|n| @icon = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookIcon.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operator\" => lambda {|n| @operator = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end"
] | [
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.61200523",
"0.6089013",
"0.60869795",
"0.6079146",
"0.60785794",
"0.6070405",
"0.6063533",
"0.60625833",
"0.6061235",
"0.60584134",
"0.6055769",
"0.6051312",
"0.60465735",
"0.6046329",
"0.6031944",
"0.6029311",
"0.6028314",
"0.60255736",
"0.6022033",
"0.60210633",
"0.6009887",
"0.5988654",
"0.59844214",
"0.59793943",
"0.5975247",
"0.5969614",
"0.596824",
"0.5966432",
"0.5965554",
"0.596292",
"0.5951651",
"0.5950895",
"0.59456754",
"0.59448177",
"0.593984",
"0.59362113",
"0.5935833",
"0.59319806",
"0.59312665",
"0.59307545",
"0.5930406",
"0.5926444",
"0.5926136",
"0.59240156",
"0.5922303",
"0.591605",
"0.591336",
"0.5913327",
"0.59130335",
"0.5910617",
"0.5906052",
"0.5906045",
"0.59042066",
"0.5903306",
"0.5902868",
"0.59027255",
"0.5902389",
"0.5902219",
"0.5901496",
"0.58978146",
"0.5891392",
"0.5890228",
"0.5885622",
"0.5885429",
"0.5884738",
"0.5883899",
"0.5883899",
"0.5883899",
"0.58811784",
"0.5878516",
"0.5877111",
"0.5869185",
"0.5844199",
"0.58430207",
"0.58408237",
"0.58383596",
"0.58362466",
"0.5836192",
"0.5835942",
"0.5834559",
"0.583357"
] | 0.0 | -1 |
Gets the registry property value. The registry URI. | def registry
return @registry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registry_key\n return @registry_key\n end",
"def [](registry_id)\n @registry[registry_id]\n end",
"def registry=(value)\n @registry = value\n end",
"def registry_key=(value)\n @registry_key = value\n end",
"def uri\n read_attr :uri\n end",
"def uri\n return @uri\n end",
"def uri\n return @uri\n end",
"def getURI()\n return @uri.to_s\n end",
"def registry_path=(path=nil)\n if(path)\n custom_paths[:registry_directory] = path\n end\n custom_paths[:registry_directory]\n end",
"def registry_path=(path=nil)\n if(path)\n custom_paths[:registry_directory] = path\n end\n custom_paths[:registry_directory]\n end",
"def get\n uri\n super()\n end",
"def get\n uri\n super()\n end",
"def get\n uri\n super()\n end",
"def uri\n @uri\n end",
"def uri\n @uri\n end",
"def registry\n @registry\n end",
"def uri\n @uri.to_s\n end",
"def uri\n attributes.fetch(:uri)\n end",
"def uri\n attributes.fetch(:uri)\n end",
"def get(name)\n @registry.fetch(name)\n rescue KeyError\n raise UndeclaredNameError, \"config value '#{name}' never loaded\"\n end",
"def registry_path\n fail NotImplementedError\n end",
"def class\n Registry\n end",
"def uri\n @uri\n end",
"def uri\n @uri\n end",
"def registry_hive\n return @registry_hive\n end",
"def registry_getvalinfo(key, valname, view = REGISTRY_VIEW_NATIVE)\n if session_has_registry_ext\n meterpreter_registry_getvalinfo(key, valname, view)\n else\n shell_registry_getvalinfo(key, valname, view)\n end\n end",
"def registry\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)\n\tend",
"def value\n get_lxd_config_value(resource[:config])\n end",
"def lookup(key)\n @@registry[registry_key(key)]\n end",
"def registry\n @registry ||= client.registry\n end",
"def get_value keyname, valuename\n begin\n status = Open4::popen4(\"regtool\", \"get\", \"#{keyname}/#{valuename}\") do |c,i,o,e|\n return o.readline.chomp\n end\n rescue EOFError\n return nil\n end\n end",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def reg_resolve(key)\n return key unless Utils.ident?(key)\n\n spec = @registry_ref.value[key]\n\n if Utils.ident?(spec)\n deep_resolve(registry, spec)\n else\n spec\n end\n end",
"def url_value\n xml_value\n end",
"def read\n @pstore.transaction do\n return @pstore[:registry]\n end\n end",
"def url\n uri\n end",
"def url\n uri\n end",
"def get_sc_path_string_value(scpath)\n return __string_command(\"getScPropertyValue\", [scpath])\n end",
"def get\n @value\n end",
"def [](name=nil)\n # We lazy load the default because we want to be able to specify the \n # default after the registry has been initialized since initialization of \n # the registry happens on startup.\n key = name || configured_default\n entry = @registry[ key ]\n if entry != nil\n return entry \n elsif key == configured_default\n return register_default\n end\n end",
"def uri_path\n __getobj__.uri.path\n end",
"def url\n @browser.url\n end",
"def get_property_uri(name)\n p = @datatype_properties.detect { |mapping| name == mapping.name }\n if p == nil\n return nil\n else\n return p.property_uri\n end\n end",
"def get_remote_repository_name\n return @registry_server + \"/\" + @repository_name\n end",
"def resolved_uri\n @mech.resolve uri\n end",
"def uri\n N::URI.new(self[:uri])\n end",
"def uri\n N::URI.new(self[:uri])\n end",
"def registry_entry( registry, entry_name )\n r = @registry[ registry ]\n r[ entry_name ] if r\n end",
"def __drburi\n @uri\n end",
"def get_value(property)\n if @env_properties.get_value(property)\n return @env_properties.get_value(property)\n end\n @file_properties.get_value(property)\n end",
"def uri\n @rui ||= @node.search('URI/listEntry').map(&:inner_text)\n end",
"def registry\n @registry ||= Registry.new(self)\n end",
"def value\n @property_hash[:value]\n end",
"def path\n @uri.path\n end",
"def registry_getvaldata(key, valname, view = REGISTRY_VIEW_NATIVE)\n if session_has_registry_ext\n meterpreter_registry_getvaldata(key, valname, view)\n else\n shell_registry_getvaldata(key, valname, view)\n end\n end",
"def get_value name\n get name\n end",
"def resolved_uri; end",
"def [](name)\n @@registry_lock.synchronize do\n @@registry[name.to_sym]\n end\n end",
"def rhost\n\t\tdatastore['RHOST']\n\tend",
"def result\n ::RDF::URI.new(value.sub(/^uri-/, ''))\n end",
"def getproxyuri\n proxy = self.getproxy\n proxy_uri = (proxy != nil )? URI.parse(proxy) : nil\n return proxy_uri\n end",
"def value\n @value ||= basename\n end",
"def intersys_get(property)\n intersys_property(property).get\n end",
"def url\n @browser.url\n end",
"def rhost\n datastore['RHOST']\n end",
"def setting\n resource[:name].split('/', 2).last\n end",
"def get_registry_unattend_path\n # HKLM\\System\\Setup!UnattendFile\n begin\n key = session.sys.registry.open_key(HKEY_LOCAL_MACHINE, 'SYSTEM')\n fname = key.query_value('Setup!UnattendFile').data\n return fname\n rescue Rex::Post::Meterpreter::RequestError\n return ''\n end\n end",
"def uri\n @_uri ||= URI(@url)\n end",
"def uri\n @_uri ||= URI(@url)\n end",
"def [](name)\n _registry[name.to_sym]\n end",
"def value\n if self.namespace\n content_from 'ns:value', :ns => self.namespace.href\n else\n content_from :value\n end\n end",
"def value\n\t@value = @selenium.get_value(@locator)\n\treturn @value\n end",
"def url\n uri.to_s\n end",
"def uri\n @uri ||= URI(url)\n end",
"def to_s\n @uri\n end",
"def get\n val\n end",
"def get\n val\n end",
"def url\n uri.to_s\n end",
"def path\n @value[:value]\n end",
"def url\n @hash[\"Url\"]\n end",
"def registry_hive=(value)\n @registry_hive = value\n end",
"def getRefPath()\n return @refPath\n end",
"def get_property _property\n send_cmd(\"get_property #{_property}\")\n end",
"def find_registry\n @registry = Spree::Registry.find_by_access_hash!(params[:id])\n end",
"def gem_uri\n @gem_uri ||=\n @rack_context.getInitParameter('gem.path') ||\n @rack_context.getInitParameter('gem.home')\n end",
"def getserverurl\r\n return getvalue(@@SERVER_URL)\r\n end",
"def gems_uri\n raise NotImplementedError, not_implemented_msg(:gems_uri)\n end",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def getURL\r\n\t\t\t\t\treturn @url\r\n\t\t\t\tend",
"def registry_id_safe\n @registry_id || '[NO ID]'\n end",
"def to_s\n uri\n end",
"def to_s\n @uri\n end",
"def uri\n @uri ||= URI.parse @url if @url\n @uri\n end",
"def uri\n @uri ||= URI.parse(url)\n end"
] | [
"0.692245",
"0.60514754",
"0.6013806",
"0.5990011",
"0.59313554",
"0.58115417",
"0.58115417",
"0.58101183",
"0.57087725",
"0.57087725",
"0.5632581",
"0.5632581",
"0.5632581",
"0.5632519",
"0.5632519",
"0.56293017",
"0.56107503",
"0.5609899",
"0.5609899",
"0.554849",
"0.55446994",
"0.5500007",
"0.5499414",
"0.5499414",
"0.5448189",
"0.5443689",
"0.54304945",
"0.54072946",
"0.54057974",
"0.5382886",
"0.5382867",
"0.5379034",
"0.5379034",
"0.5379034",
"0.5379034",
"0.5357756",
"0.5336902",
"0.5330193",
"0.53249544",
"0.53249544",
"0.5318375",
"0.5310716",
"0.5293341",
"0.5290717",
"0.52826",
"0.524252",
"0.5240516",
"0.52339464",
"0.52263474",
"0.52263474",
"0.52261317",
"0.5220729",
"0.52192515",
"0.5218491",
"0.5211122",
"0.52102554",
"0.5202919",
"0.5199727",
"0.5178121",
"0.5176104",
"0.51581055",
"0.515527",
"0.5152835",
"0.5138421",
"0.51382595",
"0.5137917",
"0.5135216",
"0.5131688",
"0.5124306",
"0.5111606",
"0.510616",
"0.510616",
"0.5104448",
"0.50993353",
"0.50979215",
"0.5086109",
"0.5080184",
"0.5070088",
"0.50661886",
"0.50661886",
"0.5065957",
"0.50595737",
"0.50544477",
"0.50460035",
"0.5035613",
"0.5031568",
"0.5029165",
"0.5023904",
"0.5023353",
"0.5009628",
"0.500906",
"0.500906",
"0.500906",
"0.500906",
"0.500906",
"0.50065815",
"0.49942133",
"0.49937838",
"0.49878415",
"0.49754944"
] | 0.5885671 | 5 |
Sets the registry property value. The registry URI. | def registry=(value)
@registry = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registry_key=(value)\n @registry_key = value\n end",
"def registry_path=(path=nil)\n if(path)\n custom_paths[:registry_directory] = path\n end\n custom_paths[:registry_directory]\n end",
"def registry_path=(path=nil)\n if(path)\n custom_paths[:registry_directory] = path\n end\n custom_paths[:registry_directory]\n end",
"def set_registry\n @registry = Registry.find(params[:id])\n end",
"def set_registry\n @registry = Registry.find(params[:id])\n end",
"def uri=(value)\n @uri = value\n end",
"def uri=(value)\n @uri = value\n end",
"def registry_hive=(value)\n @registry_hive = value\n end",
"def uri=(value)\n @uris << value\n end",
"def set_url\n url 'set'\n end",
"def uri= new_uri\n @uri = self.class.build_uri new_uri\n end",
"def intersys_set(property, value)\n intersys_property(property).set(value)\n end",
"def set_regurl\n @regurl = Regurl.find(params[:id])\n end",
"def uri=(uri)\n @uri = uri.to_s.dup.freeze\n update_uri_with_version\n end",
"def cfg_set(key, value)\n hr_config.set_for_url(url.to_s, key, value)\n end",
"def set_uri(base, path)\n @uri = \"#{base}/#{path}/#{self.identifier}\"\n end",
"def uri=(val)\n self.title = self.class.id_from_uri(val)\n if self.title\n self.title = self.title.titleize \n end\n self.uri_path = self.class.scope_from_uri(val)\n end",
"def []=(path,value)\n set(path, value)\n end",
"def registry_setvaldata(key, valname, data, type, view = REGISTRY_VIEW_NATIVE)\n if session_has_registry_ext\n meterpreter_registry_setvaldata(key, valname, data, type, view)\n else\n shell_registry_setvaldata(key, valname, data, type, view)\n end\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def []=(property, value)\n root[property] = value\n end",
"def setserverurl(value)\r\n setvalue(@@SERVER_URL, value)\r\n end",
"def set_URL(value)\n set_input(\"URL\", value)\n end",
"def set_property(name, value)\n # let Resource handle DAV properties\n if name[:ns_href] == DAV_NAMESPACE\n super\n else\n set_custom_props name, value\n end\n end",
"def url=(value)\n if value.nil?\n @url = nil\n else\n @url = Addressable::URI.parse(value)\n @url.path << '/' unless @url.path.end_with?('/')\n end\n end",
"def repository_browser_location=(repository_browser_location)\n @repository_browser_location = repository_browser_location\n @config_doc.elements[\"/project/scm/browser/location\"].text = repository_browser_location\n @config = @config_doc.to_s\n update\n end",
"def set(property, value)\n last = @routes.last\n last[property.to_s] = value if last.is_a?(Hash)\n last.send(\"#{property.to_s}=\", value) if last.is_a?(Route)\n end",
"def set!(path, value)\n setProperty path, value\n save if respond_to? :save # Only Configuration can save\n value\n end",
"def set_registry\n @registry = Couple.find_by_id(params[:couple_id]).registry\n if @registry.blank?\n render_non_existent\n return false\n end\n end",
"def []=(name, value)\n set_namevalue_glob(name,value, :color => 42) # 42 - aqua-marin, 7-green\n end",
"def proxy=value\n @proxy=value.is_a?(URI) ? value:URI.parse(value)\n end",
"def repository_browser_location=(repository_browser_location)\n @repository_browser_location = repository_browser_location\n @config_doc.elements[\"/project/scm/browser/location\"].text = repository_browser_location\n @config = @config_doc.to_s\n update\n end",
"def url=(value)\n value = \"http://#{value}\" unless value.empty? || value =~ %r{^http://} || value =~ %r{^https://}\n write_local(:url, value)\n end",
"def set_property(name, value)\n Config::Collection.set(name, value)\n end",
"def set_RedirectURI(value)\n set_input(\"RedirectURI\", value)\n end",
"def set_RedirectURI(value)\n set_input(\"RedirectURI\", value)\n end",
"def set_property(element, value)\n raise NotImplemented if (element[:ns_href] != 'DAV:')\n case element[:name]\n when 'resourcetype' then self.resource_type = value\n when 'getcontenttype' then self.content_type = value\n when 'getetag' then self.etag = value\n when 'getlastmodified' then self.last_modified = Time.httpdate(value)\n else raise NotImplemented\n end\n end",
"def url(value)\n @url = value\n end",
"def set_property(property_name, value)\n command(\"set_property\", property_name, value)\n end",
"def set(property, value)\n self.send(\"#{property}=\".to_sym, value)\n end",
"def url=(url)\n @@url = url\n end",
"def set(properties)\n \"mixpanel.register(#{properties.to_json});\"\n end",
"def set_property(key, value)\n new_repr = Representation.new(repr.href,\n repr.properties.merge(key => value),\n repr.all_links,\n repr.hal_client)\n\n self.class.new(new_repr, orig_repr)\n end",
"def property(name, value)\n @resource.set_property name, value\n end",
"def set!(resource, value)\n hook_value(resource, value) unless value.kind_of? Hooker\n super\n end",
"def set(*args)\n json_op(:set, self, *path_value_args(args))\n end",
"def set(value)\n execute(:set, value)\n end",
"def set_property(*args)\n return unless alive?\n\n command \"set_property\", *args\n end",
"def set_resource value\n instance_variable_set(resource_name, value)\n end",
"def proxy=(value)\n Curl.set_option(:proxy, value_for(value, :string), handle)\n end",
"def doc_url=(value)\n @children['doc-url'][:value] = value\n end",
"def set(val)\n @value = val\n @http_value = nil\n self\n end",
"def set!(resource, value)\n resource.instance_variable_set(instance_variable_name, value)\n end",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend",
"def set(resource, value)\n value = set_value(resource, input_to_stored_value(resource, value))\n\n if options.key?(:deprecated)\n Chef.deprecated(:property, options[:deprecated])\n end\n\n if value.nil? && required?(resource_action(resource))\n raise Chef::Exceptions::ValidationFailed, \"#{name} is a required property\"\n else\n value\n end\n end",
"def set_Property(value)\n set_input(\"Property\", value)\n end",
"def set_to(value)\n @native.set_current_value(value)\n end",
"def host(s) self.host_value = s ; self end",
"def set(value)\n wait_for_exists\n @alert.send_keys(value)\n end",
"def url=(url)\n @@url = url\n end",
"def set(key, value)\n Lib.set @path, @no_follow, key.to_s, value.to_s\n end",
"def set(value)\n execute_only(:set, value)\n end",
"def set(object, value); end",
"def value=(val)\n if identifier_scheme.present? &&\n identifier_scheme.identifier_prefix.present? &&\n val.to_s.strip.present? &&\n !val.to_s.start_with?(identifier_scheme.identifier_prefix) &&\n !val.to_s.start_with?('http')\n\n base = identifier_scheme.identifier_prefix\n base += '/' unless base.ends_with?('/')\n super(\"#{base}#{val.to_s.strip}\")\n else\n super(val)\n end\n end",
"def SetReg()\n if (@env==\"ORBIT\")\n allGroups.exec(\"iw reg set US\")\n end\n end",
"def set_uri_seeds(value)\n @uri_seeds = value\n end",
"def path_set(path)\n absolute_path = (Pathname.new(uri.path) + path).to_s\n rebuild_uri :path => absolute_path\n end",
"def set_registrer\n @registrer = Registrer.find(params[:id])\n end",
"def set(value)\n value\n end",
"def setting(property, value)\n\t\tproperty + ':' + value + ';'\n\tend",
"def data_uri=(uri)\n assign_data_uri(uri)\n @data_uri = uri\n end",
"def []=(name, value) \n @server.setAttribute @object_name, javax.management.Attribute.new(name.to_s, value)\n end",
"def set_role_url(url, role_index=0)\n implementation[\"roles\"][role_index][\"role_url\"]=url\n end",
"def router_uri_prefix=(uri_prefix)\n if respond_to?(:uri=)\n self.uri = (uri_prefix.empty? ? '/' : uri_prefix)\n end\n @router_uri_prefix = uri_prefix\n end",
"def set(path, value, rev=-1)\n invoke(Request.new(:path => path, :value => value, :rev => rev, :verb => Request::Verb::SET), false).rev\n end",
"def scheme_set(scheme)\n rebuild_uri :scheme => scheme\n end",
"def uri=(u)\n # Remove any format extension (.json, .rdf etc.)\n ext = File.extname(u)\n @uri = ext.nil? || ext.empty? ? u : u.rpartition(ext)[0]\n end",
"def url=(url)\n if url =~ /^http(s?)\\:\\/\\//i\n @url = url\n write_settings\n else\n $stderr.puts \"Please include a leading http://\"\n end\n end",
"def update_uri(p)\n update_attribute(:uri_actual, p)\n end",
"def service_management_url=(value)\n @service_management_url = value\n end",
"def url=(value)\n @url = value\n Curl.set_option(:url, value_for(value, :string), handle)\n end",
"def github=(value)\n conf['dashboard']['github'] = value.to_hash\n end",
"def base_uri=(new_base_uri)\n @base_uri = new_base_uri\n end",
"def set(name, value)\n update(name, value)\n end",
"def set_value(*args)\n raise ReadOnlyRecord if readonly?\n resource.set_value(*args)\n end",
"def set_ReturnURL(value)\n set_input(\"ReturnURL\", value)\n end",
"def set_property(key, value)\n end",
"def url=(url)\n active_window.url = url\n end",
"def []=(property, value); end",
"def set_curl(value)\n if value.nil?\n @curl = 'curl'\n else\n return skip_resource 'Invalid character in curl_path' unless value =~ /^[\\w\\\\\\/\\. :-]+$/\n @curl = value.to_s\n end\n end"
] | [
"0.65558785",
"0.64465743",
"0.64465743",
"0.6398272",
"0.6398272",
"0.62428886",
"0.62428886",
"0.61232847",
"0.6087306",
"0.59248924",
"0.58984023",
"0.56568646",
"0.5648688",
"0.56280875",
"0.56248456",
"0.56008685",
"0.5574204",
"0.556259",
"0.55327195",
"0.55165225",
"0.55165225",
"0.55165225",
"0.55165225",
"0.55165225",
"0.55165225",
"0.55165225",
"0.54795736",
"0.5471933",
"0.5450078",
"0.543645",
"0.54058963",
"0.54048496",
"0.540302",
"0.5402136",
"0.53903335",
"0.53780925",
"0.5371922",
"0.53634393",
"0.5347903",
"0.5347574",
"0.53403944",
"0.53403944",
"0.5333282",
"0.5322214",
"0.5299434",
"0.5274476",
"0.5271422",
"0.52474517",
"0.5246688",
"0.52382445",
"0.5205611",
"0.5204462",
"0.5200189",
"0.5198976",
"0.519748",
"0.518726",
"0.5182887",
"0.51780856",
"0.517774",
"0.5168701",
"0.5168701",
"0.5168701",
"0.5168701",
"0.5168701",
"0.5167492",
"0.51672244",
"0.5160849",
"0.51473635",
"0.5142533",
"0.5142427",
"0.5141122",
"0.5136989",
"0.51346743",
"0.5132876",
"0.5128432",
"0.51239985",
"0.5123486",
"0.5109722",
"0.5105842",
"0.51010746",
"0.50755125",
"0.5069281",
"0.5065623",
"0.5064332",
"0.5064182",
"0.5063318",
"0.505628",
"0.50497675",
"0.5046263",
"0.5034474",
"0.5031728",
"0.50304735",
"0.5012111",
"0.5009045",
"0.50051665",
"0.50047183",
"0.50038666",
"0.5003201",
"0.4998099",
"0.4992161"
] | 0.7437524 | 0 |
Serializes information the current object | def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
super
writer.write_string_value("registry", @registry)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
"def serialize\n self.to_hash.to_json\n end",
"def serialized\n serializer_class.new(self).serializable_hash\n end",
"def serialize\n @raw_data\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end",
"def serialize\n @serializer.serialize(self.output)\n end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"def serializer; end",
"def serialize!\n end",
"def serialize(object)\n object.serializable_hash\n end",
"def serialize(object)\n object.to_s\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def marshal\n Marshal.dump self\n end",
"def inspect\n serialize.to_s\n end",
"def serialize\n YAML::dump(self)\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end",
"def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end",
"def serialize(object, data); end",
"def serialize\n JSON.generate(to_h)\n end",
"def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end",
"def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end",
"def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end",
"def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end",
"def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end",
"def serializable_hash\n self.attributes\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end",
"def serialize\n JSON.dump(@hash)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end",
"def to_s\r\n dump\r\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end",
"def serialize(io)\n Encoder.encode(io, self)\n io\n end",
"def _dump() end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end",
"def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end",
"def _dump()\n #This is a stub, used for indexing\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end",
"def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end",
"def inspect\n self.to_hash.inspect\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end",
"def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end",
"def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end",
"def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end"
] | [
"0.7951372",
"0.7645999",
"0.7579812",
"0.7579812",
"0.7440032",
"0.720861",
"0.720861",
"0.7207583",
"0.7016516",
"0.70007193",
"0.6992252",
"0.69838214",
"0.69723576",
"0.69666415",
"0.69666415",
"0.6942002",
"0.69417155",
"0.6933786",
"0.6913977",
"0.6891677",
"0.68810964",
"0.687664",
"0.687664",
"0.687664",
"0.6875119",
"0.68510306",
"0.68364877",
"0.68364877",
"0.6825542",
"0.6815931",
"0.68061364",
"0.68006235",
"0.67944074",
"0.67717844",
"0.67341864",
"0.67289317",
"0.66964674",
"0.66828746",
"0.6673492",
"0.6668077",
"0.6666333",
"0.6659732",
"0.6656788",
"0.66513675",
"0.6635875",
"0.66275525",
"0.66275525",
"0.66275525",
"0.6627384",
"0.66165835",
"0.66141444",
"0.6611379",
"0.6597342",
"0.65968686",
"0.6594517",
"0.6592636",
"0.6583964",
"0.6580536",
"0.65803635",
"0.6575503",
"0.65716475",
"0.65712893",
"0.6566952",
"0.6560253",
"0.65554273",
"0.65410006",
"0.65378475",
"0.65346783",
"0.6527361",
"0.6525178",
"0.65242875",
"0.65235287",
"0.65174305",
"0.65141636",
"0.6508169",
"0.6499713",
"0.6498714",
"0.6496881",
"0.6486202",
"0.6482482",
"0.64814615",
"0.6479782",
"0.6476621",
"0.6475453",
"0.64677024",
"0.64633876",
"0.64619535",
"0.6461202",
"0.6457243",
"0.64497435",
"0.6439583",
"0.6433183",
"0.643078",
"0.6424316",
"0.6420337",
"0.6420337",
"0.6420337",
"0.6420337",
"0.6420337",
"0.6418776",
"0.64156514"
] | 0.0 | -1 |
You can add fixtures and/or initialization code here to make experimenting with your gem easier. You can also use a different console, if you like. (If you use this, don't forget to add pry to your Gemfile!) require "pry" Pry.start | def in_ms(seconds)
"#{'%.2f' % (seconds * 1000).round(2)}ms"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n # require \"pry\"; binding.pry\n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def main\n\n # test\n\n # Console.new\n console_start\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def test_console\n console\n end",
"def setup\n @story = Story.create( :text => 'Hello world' )\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\r\n end",
"def setup; end",
"def console\n\t\t\tcla = as_class_name(@arguments.first)\tif @arguments.length == 1\n\t\t File.open(\"./tmp/irb-setup.rb\", 'w') do |f|\n\t\t f.puts \"# Initializes the environment for IRb.\"\n\t\t f.puts \"Experiment::Config::init #{@options.env.inspect}\"\n\t\t f.puts \"$: << '#{File.expand_path(\".\")}/'\"\n\t\t if @arguments.length == 1\n\t\t f.puts \"require 'experiments/#{@arguments.first}/#{@arguments.first}'\"\n\t\t f.puts \"def experiment\"\n \t\t f.puts \" @experiment ||= #{cla}.new :normal, #{@arguments.first.inspect}, OpenStruct.new(#{@options.marshal_dump})\"\n \t\t f.puts \"end\"\n \t\t f.puts \"experiment #load up the configs\"\n \t\t else\n \t\t f.puts 'Dir[\"./app/**/*.{rb,o,so,dll,bundle}\"].each{|e| require e.gsub(/\\.(rb|so|o|dll|bundle)$/, \"\") }'\n \t\t f.puts \"Experiment::Config::load '', #{options.opts.inspect}\"\n\t\t end\n\t\t \n\t\t end\n irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'\n libs = \" -r irb/completion\"\n libs << \" -r #{File.dirname(__FILE__) + \"/base\"}\"\n libs << \" -r./experiments/experiment\"\n libs << \" -r ./tmp/irb-setup.rb\"\n puts \"Loading #{@options.env} environment...\"\n exec \"#{irb} #{libs} --simple-prompt\"\n\t end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n ''\n end",
"def do_setup; \"\" end",
"def setup()\n end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def setup\n debug 'No custom setup defined'\n end",
"def setup\n true\n end",
"def setup_environment; end",
"def setup\n # NOTE: We do not yet assume any contents of the depot. When we do,\n # I have some code for populating test fixtures, although it leans a bit\n # toward Rails' conventions. We can probably 'derail' it. :)\n\n # Specify the environment, e.g. development vs. test, etc. It is assumed to be\n # test. This is done mainly so that the right configuration is used for connecting to\n # Perforce. This should probably be moved to a generic 'test_helper' which is\n # included in all tests.\n ENV['APP_ENV'] ||= 'test'\n end",
"def test_library\n\tputs \"Library Loaded!\"\nend",
"def setup\n @practical = Flow.new(\"gb\", \"Practical\")\n @legal = Flow.new(\"gb\", \"Legal\")\n # binding.pry\n end",
"def setup(options); end",
"def setup(options); end",
"def setup\n\t\t\t\tp \"mytest1 setup\"\n\t\tend",
"def call\n if gem.exist?\n gem.prepare_data(keys: PRELOAD_KEYS, concurrency: false)\n GemsBond::Printers::Stdout.new(gem).call\n else\n puts \"Sorry, this gem could not be found!\"\n end\n end",
"def setup\n # no setup\n\tend",
"def setup\n # override this if needed\n end",
"def setup(options = {}); end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def setup\n # Do nothing\n end",
"def test_initialize\n assert_nothing_raised { Spoonerize::Cli.new(fixtures['default_words']) }\n end",
"def test_helloworld\n with_fixture 'helloworld' do\n assert system(\"ruby\", ocra, \"helloworld.rb\", *DefaultArgs)\n assert File.exist?(\"helloworld.exe\")\n assert system(\"helloworld.exe\")\n end\n end",
"def cmd_pry(*args)\n if args.include?('-h')\n cmd_pry_help\n return\n end\n\n begin\n require 'pry'\n rescue LoadError\n print_error('Failed to load Pry, try \"gem install pry\"')\n return\n end\n\n print_status('Starting Pry shell...')\n print_status(\"You are in the \\\"self\\\" (session) object\\n\")\n\n self.pry\n end",
"def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('core');\", \"(opal)\"\n require_file 'core'\n end",
"def setup\n # noop\n end",
"def init_example_db\n # Create repos table\n database.create_table :repos do\n primary_key :id\n String :name\n foreign_id :token_id\n end\n\n # Add example repositories\n r = database[:repos]\n r.insert(:name => \"josefwaller/pycatan\")\n r.insert(:name => \"josefwaller/github_dash\")\n r.insert(:name => \"rails/rails\")\n\n # Create tokens table\n database.create_table :tokens do\n primary_key :id\n String :token\n String :name\n end\n\n # Add example token\n t = database[:tokens]\n ENV['GITHUB_DASH_TOKEN'] ||= \"ThisIsAnExampleGithubApiKey\"\n t.insert(:token => ENV['GITHUB_DASH_TOKEN'])\n end",
"def setup(*args) ; end",
"def test_pp\n binding.pry\n puts Time.now\n end",
"def run_console\n require 'irb'\n require 'irb/completion'\n require 'pp'\n load_code\n connect_to_database true\n CloudCrowd::Server # Preload server to autoload classes.\n Object.send(:include, CloudCrowd)\n IRB.start\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = accounts(:first)\n end",
"def before_setup; end",
"def main\n puts 'Ruby bootstrap...'\n puts 'Check sqlite3'\n if system('sqlite3 --version')\n puts 'Ok'\n else\n puts 'Ko: sqlite3 is required'\n puts 'https://guides.rubyonrails.org/getting_started.html'\n exit 1\n end\n\n puts 'Update Ruby gem manager'\n system('gem update --system')\n\n puts 'Install bundler'\n system('gem install bundler')\n\n puts 'Install rails'\n system('gem install rails')\n system('rails --version')\nend",
"def setup()\n @person = {\"name\" => \"jim\", \"age\" => 20}\n end"
] | [
"0.6681039",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6503785",
"0.6435417",
"0.6408537",
"0.6408537",
"0.6408537",
"0.6408537",
"0.6408537",
"0.6408537",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.64015144",
"0.6383592",
"0.63647836",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63484186",
"0.63355523",
"0.63355523",
"0.63355523",
"0.62931645",
"0.61580986",
"0.60708994",
"0.6053581",
"0.6053581",
"0.6053581",
"0.6053581",
"0.6053581",
"0.6024129",
"0.6024129",
"0.60118747",
"0.5983494",
"0.59597343",
"0.59586626",
"0.59586626",
"0.5946879",
"0.5915702",
"0.58984494",
"0.58532256",
"0.5761126",
"0.5759345",
"0.57402635",
"0.57402635",
"0.57361597",
"0.57318425",
"0.57270604",
"0.5711835",
"0.57007897",
"0.56817406",
"0.56817406",
"0.5681189",
"0.5681189",
"0.5681189",
"0.5681189",
"0.5681189",
"0.5681189",
"0.5681189",
"0.5677433",
"0.56662315",
"0.56590676",
"0.5654569",
"0.5633945",
"0.56268394",
"0.5605986",
"0.5591726",
"0.55866814",
"0.5580374",
"0.55532146",
"0.5551237",
"0.55467176"
] | 0.0 | -1 |
GET /qs GET /qs.json | def index
@qs = Q.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def getQuery\n\t\tquery = params[:query]\n\t\tresults = GetQueryFromSpotify.build.call(query)\n\t\trender json: results\n\tend",
"def http_query(verb, uri, opts)\n JSON.parse RestClient.send(verb, uri.to_s, opts)\n end",
"def q\n @q ||= HTTP.parseQs qs[1..-1]\n end",
"def search(q)\n url = build_query_url q\n begin\n raw_response = json(url)\n rescue JSON::ParserError\n Rails.logger.info \"Could not parse response as JSON. Request url: #{url}\"\n return []\n end\n parse_authority_response(raw_response)\n end",
"def query q, params={}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"q\" => q,\n \"Call_ID\" => params[:call_id],\n \"format\" => params[:format]\n }\n }\n get 'query.php', params\n end",
"def get\n request_object.get_query\n end",
"def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end",
"def get(path, query={})\n request_json :get, path, query\n end",
"def query(query, apikey, endpoint, accept = \"application/json\")\n\tjson = open(\"#{endpoint}?query=#{CGI.escape(query)}&apikey=#{apikey}\", \"Accept\" => accept).read\n\tJSON.parse(json)\n\nend",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end",
"def get(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :GET)\n end",
"def index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end",
"def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end",
"def search(jql, start_at = 0, max_results = 50, fields = '', expand = '')\n url = \"#{@api_url}/search?jql=#{jql}\"\n url = \"#{url}&startAt=#{start_at}\" unless start_at == 0\n url = \"#{url}&maxResults=#{max_results}\" unless max_results == 50\n url = \"#{url}&fields=#{fields}\" unless fields == ''\n url = \"#{url}&expand=#{expand}\" unless expand == ''\n get_json(url)\n end",
"def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end",
"def query(params)\n request(Resources::RESOURCE_QUERY, HTTP_METHOD_POST, params)\n end",
"def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def index\n @comment_qs = CommentQ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comment_qs }\n end\n end",
"def index\n faqs = Faq.all\n json_response(faqs)\n end",
"def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end",
"def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end",
"def qs\n if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?\n '?' + @r['QUERY_STRING']\n elsif query && !query.empty?\n '?' + query\n else\n ''\n end\n end",
"def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end",
"def query\n { \"page\" => page,\n \"page_size\" => page_size,\n \"phrase\" => phrase }\n end",
"def search(query, opts = {})\r\n page = opts[:page] || 1\r\n uri = url_for('search', opts)\r\n response = RestClient.get(uri, params: { q: query, page: page })\r\n JSON.parse response\r\n end",
"def search\n query = params[:q]\n works = ActiveFedora::SolrService.query(query, fq: @fq, fl: @fl, df: @df, rows: @max_rows) \n format_solr_keys(works)\n render(json: works)\n end",
"def index\n @faqs = Faq.all\n\n render json: @faqs\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend",
"def search(q, options = {})\n h = {}\n h[:max_results] = 10\n h[:user_id] = 'all'\n h[:kind] = 'photo'\n # merge options over h, but merge q over options\n get(h.merge(options).merge(:q => q))\n end",
"def index\n @quantities = Quantity.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def show\n @query = current_user.queries.find(params[:id])\n # @queries = current_user.queries.all\n respond_to do |format|\n format.html\n format.json { render json: @query }\n end\n end",
"def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def query\n @query || params[:q] || params[:tq]\n end",
"def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end",
"def index\n @title = t 'view.grades.index_title'\n @searchable = true\n @grades = @grades.filtered_list(params[:q]).page(params[:page]).uniq('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grades }\n end\n end",
"def index\n @rnaseqs = Rnaseq.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rnaseqs }\n end\n end",
"def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end",
"def query_param\n params[:q]\n end",
"def index\n #@posts = Post.all\n #render json: params\n @query = params[:q]\n if @query.nil?\n @posts = Post.includes(:user).all.page\n else\n @posts = Post.includes(:user).where(\"title ilike ? or content ilike ?\", \"%#{@query}%\", \"%#{@query}%\")\n end\n\n @posts = @posts.page params[:page]\n respond_to do |format|\n format.html\n format.json\n format.js\n end\n end",
"def query(query_string)\n restforce_client.query(query_string)\n end",
"def index\n @shops = Shop.order('isnull(alexa) asc,alexa asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { \n q = \"%#{params[:q]}%\"\n @shops = @shops.\n where(\"name like ? or domain like ? or cert like ?\",q,q,q) if params[:q].present?\n render json: @shops \n }\n end\n end",
"def index\n @querylists = HTTParty.post(\"http://66.175.217.67:3020/argames/getQuery\", :body => { :checkFilter => '' }, :headers => {\"Authorization\" => \"Bearer \" + ENV[\"API_KEY\"] })\n end",
"def wrap_solr_request\n\n # Get fq parameters from request object\n fq =[]\n request.query_string.split(\"&\").each do |p|\n if p.starts_with?(\"fq=\")\n fq.push(URI.decode_www_form_component(p[3..-1]))\n end\n end\n\n q = params[:q] || \"*:*\"\n wt = params[:wt] || \"json\"\n start = params[:start] || 0\n rows = params[:rows] || 10\n sort = params[:sort] || 'pubyear desc,modified desc'\n\n\n response = solr.get 'select', :params => {:q => q, :fq => fq, :wt=> wt, :sort => sort, :start => start.to_i, :rows => rows.to_i}\n\n if wt.eql?(\"xml\")\n render xml: response\n elsif wt.eql?(\"json\")\n render json: response\n else\n render nothing: true\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\n end",
"def call(query)\n # TODO: handle exceptions\n self.class.get(\"/jokes/search?query=#{query}\")\n end",
"def query(endpoint, query=nil, http=nil, version=:v3)\n require 'json'\n \n unless http then\n require 'puppet/network/http_pool'\n http = Puppet::Network::HttpPool.http_instance(@host, @port, use_ssl=true)\n end\n headers = { \"Accept\" => \"application/json\" }\n \n uri = \"/#{version.to_s}/#{endpoint.to_s}\"\n uri += URI.escape \"?query=#{query.to_json}\" unless query.nil? or query.empty?\n \n resp = http.get(uri, headers)\n raise RuntimeError, \"PuppetDB query error: [#{resp.code}] #{resp.msg}, query: #{query.to_json}\" unless resp.kind_of?(Net::HTTPSuccess)\n return JSON.parse(resp.body)\n end",
"def query(sparql, opts = {})\n res = execute_request(\n :get,\n '/query',\n params: opts.slice(:baseURI, :offset, :limit).merge(query: sparql),\n headers: request_headers(opts)\n ).body\n\n res.blank? ? [] : SPARQL::Client.parse_json_bindings(res)\n end",
"def show\n @q_resource = QResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @q_resource }\n end\n end",
"def index\n @recipes = (!params[:recipe].blank?)? Recipe.where(\"id in (\" + params[:recipe] + \")\") : Recipe.all\n @recipes_json = Recipe.where(\"title ilike ?\", \"%#{params[:q]}%\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: custom_json_for(@recipes_json)}\n end\n end",
"def search_json(query,types=nil,never_or=nil,extras=nil,start=nil,count=nil)\n method = 'search'\n type = TODO\n if not types\n types = 'Artist,Album,Track,Playlist,User'\n end\n args = {:query=>query}\n args[:types] = types if types\n args[:never_or] = never_or if never_or\n args[:extras] = extras if extras\n args[:start] = start if start\n args[:count] = count if count\n json = call method,args\n if Rdio::log_json\n Rdio::log json\n end\n return unwrap_json json\n end",
"def http_get(path, query, format = :json)\n uri = URI.parse(\"http://#{Jamendo::API_SERVER}/v#{Jamendo::API_VERSION}/#{path}#{query}\")\n puts uri.request_uri\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Get.new(uri.request_uri)\n begin\n response = http.request(request)\n result = parse_response(response)\n assert_response(result[:headers])\n return result[:results]\n rescue JamendoError => e\n e.inspect\n end\n end",
"def query\n start do |connection|\n request = HTTP::Get.new \"#{ @uri.path }?#{ @uri.query }\"\n @headers.each { |header, value| request[header] = value }\n connection.request request\n end\n end",
"def query ; @request.params ; end",
"def query(query, params={})\n query_url = \"#{API_URL}/query.json?#{query}\"\n perform_get_request(query_url, params)\n end",
"def index\n @faqs = Faq.sorted\n if @subject\n @faqs = @faqs.where(:subject_id => @subject.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs, include: 'subject' }\n end\n end",
"def get_q\n @q = params[:q].to_i if params.has_key?:q\n @q = nil if @q == 0 # avoid q = 0 when there is no filter\n end",
"def request_uri\n uri = URI.parse(Europeana::URL + \"/search.json\")\n request_params = params_with_authentication\n\n if request_params[:qf].is_a?(Hash)\n qf = request_params.delete(:qf)\n uri.query = request_params.to_query\n qf.each_pair do |name, criteria|\n [ criteria ].flatten.each do |criterion|\n uri.query = uri.query + \"&qf=\" + CGI::escape(name.to_s) + \":\" + CGI::escape(criterion)\n end\n end\n else\n uri.query = request_params.to_query\n end\n \n uri\n end",
"def get_queries(opts = {})\n data, _status_code, _headers = get_queries_with_http_info(opts)\n return data\n end",
"def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end",
"def get(**args)\n solr_service.get(build, **args)\n end",
"def search\n\t\tuser = User.find_by_id(params[:user_id])\n\t\tunless user\n\t\t\trender json: {error: \"user not found\"} and return\n\t\tend\n\n\t\tquests = []\n\t\tulat = params[:latitude] || 0\n\t\tulat = ulat.to_d\n\t\tulon = params[:longitude] || 0\n\t\tulon = ulon.to_d\n\t\trange = params[:range] || 0\n\t\trange = range.to_i\n\n\t\tQuest.all.each do |quest|\n\t\t\tunless quest.users.include?(user)\n\t\t\t\tif quest.get_distance_to_point(ulat, ulon) < range\n\t\t\t\t\tquests.push(quest)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trender json: {quests: quests.as_json(include: :images)}\n\tend",
"def query(query)\n url = \"query?query=#{URI.encode(query)}\"\n api_get(url).body\n end",
"def index\n @q = Galaxy.search(params[:q])\n @q.sorts = 'id asc' if @q.sorts.empty?\n if params[:page] != \"false\"\n @galaxies = @q.result(distinct: true).page(params[:page])\n else\n @galaxies = @q.result(distinct: true)\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @galaxies.to_json(\n :only => [:id, :galaxy_name, :galaxy_type, :distance, :luminosity, :scale_length,\n :mass_hydrogen, :mass_disk, :velocities_citation, :luminosity_citation, :mass_hydrogen_citation, :scale_length_citation],\n :methods => [:citation_ids_array, :r_last, :vrot_data_last, :velocities_count]\n )\n }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def query_param\n {\n query: ::Kahn::JSON.decode(params.fetch('query', '{}')),\n fields: ::Kahn::JSON.decode(params.fetch('fields', '{}')),\n limit: params.fetch(:limit, 10),\n skip: params.fetch(:skip, 0)\n }\n end",
"def query(query=nil, options={})\n options = options.symbolize_keys\n query_params = query ? options.merge({ql: query}) : options\n self.get({params: query_params })\n self\n end",
"def index\n @qus = Qu.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @qus }\n end\n end",
"def get_thing(query_hash)\n query = {\"type\" => \"/type/edition\"}.merge(query_hash)\n response = open(@api_url + \"/things?query=\" + CGI.escape(query.to_json) ).read\n JSON.parse(response)\n end",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def index\n @qrs = Qr.all\n end",
"def get_data(custom_query)\n qopts = {\n token: token,\n from: from, \n output: :json, \n mode: mode,\n target: :'ahrefs.com'\n }.merge(custom_query)\n \n response = self.class.get('/', {query: qopts})\n \n raise \"HTTP error: #{response.code}\", response unless (200..299).include? response.code\n json = JSON.parse response.body\n unless json['error'].nil?\n error = json['error']\n raise \"API error: #{error}\" \n \n end\n return json\n end",
"def solr(url, handler, params={})\n connection, solr_url = connection(url)\n req_url = solr_url.path + '/select?' + hash_to_query_string(params.merge(:qt => handler))\n # puts \"*** requesting to Solr: #{req_url}\"\n connection.get(req_url)\nend",
"def get(path, query={})\n request.get(path, query_options(query))\n end",
"def query_params; end",
"def search_posts\n @posts = Post.ransack(name_cont: params[:q]).result.limit(20)\n\n render json: @posts, status: 200\n end",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def do_query(endpoint, query)\n url = compile_query_url(endpoint, query)\n Net::HTTP::get_response(URI.parse(url))\n end",
"def index\n if params[:query].present?\n @bugs = Bug.search(params[:query])\n else\n @bugs = Bug.all\n end\n render json: @bugs\n end",
"def search(project: nil, text: nil, kind: 'subject', tags: { }, page: 1, results: [])\n raise 'no project specified' unless project\n tag_query = tags.each_pair.collect{ |k, v| \"tags[#{ k }]=#{ v }\" }.join '&'\n uri = URI.parse \"https://api.zooniverse.org/projects/#{ project }/talk/search?text=#{ text }&kind=#{ kind }&#{ tag_query }&per_page=20&page=#{ page }\"\n req = Net::HTTP::Get.new uri.to_s\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n res = http.request req\n json = JSON.parse res.body\n \n pages = (json['total'] / json['per_page'].to_f).ceil\n \n # More than 1,000 results\n if page == 1 && pages > 50\n puts \"\\n\\nThis query has #{ json['total'] } results.\"\n puts \"It could take a long time and degrade server performance.\"\n puts \"Are you really sure you want to run this query? (y/n)\"\n return unless gets.chomp =~ /y/i\n end\n \n if json['page'] < pages\n puts \"#{ json['page'] } / #{ pages }\"\n search project: project, text: text, kind: kind, tags: tags, page: page + 1, results: results + json['results']\n else\n results + json['results']\n end\nend",
"def index\n @shelters = Shelter.where(filtering_params)\n render json: @shelters\n end",
"def query_params\n params[:query]\n end",
"def index\n\t#params[:quest_id]\n #@qrcodes = Qrcode.find_all_by_userid(current_user.id)\n #@qrcodes= Qrcode.all\n@qrcodes = Qrcode.find_all_by_quest_id(params[:quest_id])\n@quest = Quest.find(params[:quest_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qrcodes }\n end\n end",
"def query_options; end",
"def search\n render json: User.first(10)\n end",
"def index\n @properties = if params[\"q\"].present?\n then Property.all.by_city_state(params[\"q\"])\n else Property.all\n end\n respond_to do |format|\n format.html {}\n format.json {\n # This is a temp solution to ignore records without latitude & longitude\n render json: @properties.where.not(longitude: nil)\n .where.not(latitude: 0.0)\n .where.not(city: nil)\n }\n end\n end",
"def query(q, options={}, async = true)\n request(\"/Locations\", {:query => {:key => @key, :addressLine => q}.merge(options)}, async)\n end",
"def index\n @ques = Que.search_names params[:q]\n respond_to do |format|\n format.js\n end\n end",
"def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end",
"def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end",
"def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n per_page = params[:per_page]&.to_i || DEFAULT_PER_PAGE\n page = params[:page]&.to_i || DEFAULT_PAGE\n query = params[:query] || \"\"\n\n queries = query.split(\",\").map { |q| \"%#{q.downcase.strip}%\" }\n recipe_ids = []\n \n if queries.present?\n queries.each do |q|\n tmp_recipe_ids = Ingredient.where('UNACCENT(LOWER(name)) ILIKE UNACCENT(?)', q)\n .pluck(:recipe_id)\n .uniq\n\n excluded_ids = []\n excluded_ids = recipe_ids - tmp_recipe_ids | tmp_recipe_ids - recipe_ids unless recipe_ids.empty?\n \n recipe_ids = (recipe_ids + tmp_recipe_ids) - excluded_ids\n end\n end\n \n recipes = Recipe.where(id: recipe_ids).order('rate DESC NULLS LAST').order(id: :asc)\n .page(page)\n .per(per_page)\n \n render json: {\n meta: {\n total_recipes: recipes.total_count,\n total_pages: recipes.total_pages,\n per_page: per_page,\n query: query,\n page: page\n }, \n recipes: recipes.map { |recipe| ::RecipeJson.new(recipe: recipe).to_h }\n }\n end"
] | [
"0.6967111",
"0.6878766",
"0.6575237",
"0.6530729",
"0.642635",
"0.6421816",
"0.6390276",
"0.63742244",
"0.6240254",
"0.62381876",
"0.6227804",
"0.6227804",
"0.61734974",
"0.6128986",
"0.6127512",
"0.6126428",
"0.6124328",
"0.6086575",
"0.60730296",
"0.6060777",
"0.60582715",
"0.60517824",
"0.60427713",
"0.6029439",
"0.60248363",
"0.60170394",
"0.6015875",
"0.6014144",
"0.60032326",
"0.59466225",
"0.59412795",
"0.59086853",
"0.5888134",
"0.58658344",
"0.5856183",
"0.58453345",
"0.5797773",
"0.5796742",
"0.57926667",
"0.57873315",
"0.5782706",
"0.5767227",
"0.5762713",
"0.5746276",
"0.5742696",
"0.57392925",
"0.5732681",
"0.57234985",
"0.5708073",
"0.57069504",
"0.57061684",
"0.56965935",
"0.5696406",
"0.56938773",
"0.5675928",
"0.5668116",
"0.5660893",
"0.5655825",
"0.5651041",
"0.56459504",
"0.5634188",
"0.5621078",
"0.56165224",
"0.56156397",
"0.56072694",
"0.56065375",
"0.5603023",
"0.560284",
"0.5592955",
"0.5580919",
"0.55769145",
"0.55755097",
"0.5569578",
"0.556875",
"0.5566755",
"0.55635715",
"0.55635715",
"0.55622923",
"0.5559484",
"0.55542064",
"0.55469376",
"0.5543957",
"0.5543929",
"0.5534607",
"0.5527028",
"0.55239415",
"0.5523137",
"0.5522075",
"0.5520782",
"0.5513908",
"0.5510098",
"0.5509966",
"0.55092806",
"0.5508636",
"0.55069774",
"0.5500291",
"0.5498692",
"0.5493097",
"0.54901284",
"0.54890674"
] | 0.6500322 | 4 |
GET /qs/1 GET /qs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def q\n @q ||= HTTP.parseQs qs[1..-1]\n end",
"def getQuery\n\t\tquery = params[:query]\n\t\tresults = GetQueryFromSpotify.build.call(query)\n\t\trender json: results\n\tend",
"def http_query(verb, uri, opts)\n JSON.parse RestClient.send(verb, uri.to_s, opts)\n end",
"def index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end",
"def get(path, query={})\n request_json :get, path, query\n end",
"def index\n @qs = Q.all\n end",
"def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end",
"def get\n request_object.get_query\n end",
"def index\n @comment_qs = CommentQ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comment_qs }\n end\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def query q, params={}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"q\" => q,\n \"Call_ID\" => params[:call_id],\n \"format\" => params[:format]\n }\n }\n get 'query.php', params\n end",
"def show\n @q_resource = QResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @q_resource }\n end\n end",
"def get(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :GET)\n end",
"def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end",
"def index\n @faqs = Faq.all\n\n render json: @faqs\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end",
"def query(query, apikey, endpoint, accept = \"application/json\")\n\tjson = open(\"#{endpoint}?query=#{CGI.escape(query)}&apikey=#{apikey}\", \"Accept\" => accept).read\n\tJSON.parse(json)\n\nend",
"def index\n faqs = Faq.all\n json_response(faqs)\n end",
"def index\n @rnaseqs = Rnaseq.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rnaseqs }\n end\n end",
"def show\n @query = current_user.queries.find(params[:id])\n # @queries = current_user.queries.all\n respond_to do |format|\n format.html\n format.json { render json: @query }\n end\n end",
"def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end",
"def http_get(path, query, format = :json)\n uri = URI.parse(\"http://#{Jamendo::API_SERVER}/v#{Jamendo::API_VERSION}/#{path}#{query}\")\n puts uri.request_uri\n http = Net::HTTP.new(uri.host, uri.port) \n request = Net::HTTP::Get.new(uri.request_uri)\n begin\n response = http.request(request)\n result = parse_response(response)\n assert_response(result[:headers])\n return result[:results]\n rescue JamendoError => e\n e.inspect\n end\n end",
"def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end",
"def show\n @qu = Qu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end",
"def show\n @q = Q.find_by_unique_id(params[:id])\n\n @q_next = Q.offset(rand(Q.count)).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @q }\n end\n end",
"def get_thing(query_hash)\n query = {\"type\" => \"/type/edition\"}.merge(query_hash)\n response = open(@api_url + \"/things?query=\" + CGI.escape(query.to_json) ).read\n JSON.parse(response)\n end",
"def show\n @qu = Qu.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def get_one(*path, query: nil, api_v1: true)\n url = encode_url(path: path, query: query, api_v1: api_v1)\n faraday_safe(:get, url).body\n end",
"def index\n @qus = Qu.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @qus }\n end\n end",
"def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def search(q)\n url = build_query_url q\n begin\n raw_response = json(url)\n rescue JSON::ParserError\n Rails.logger.info \"Could not parse response as JSON. Request url: #{url}\"\n return []\n end\n parse_authority_response(raw_response)\n end",
"def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end",
"def show\n @q_response = QResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @q_response }\n end\n end",
"def index\n\t#params[:quest_id]\n #@qrcodes = Qrcode.find_all_by_userid(current_user.id)\n #@qrcodes= Qrcode.all\n@qrcodes = Qrcode.find_all_by_quest_id(params[:quest_id])\n@quest = Quest.find(params[:quest_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qrcodes }\n end\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def index\n @faqs = Faq.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs }\n end\n end",
"def index\n @quantities = Quantity.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def index\n @faqs = Faq.sorted\n if @subject\n @faqs = @faqs.where(:subject_id => @subject.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs, include: 'subject' }\n end\n end",
"def show\n @rnaseq = Rnaseq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rnaseq }\n end\n end",
"def get(**args)\n solr_service.get(build, **args)\n end",
"def index\n @recipes = (!params[:recipe].blank?)? Recipe.where(\"id in (\" + params[:recipe] + \")\") : Recipe.all\n @recipes_json = Recipe.where(\"title ilike ?\", \"%#{params[:q]}%\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: custom_json_for(@recipes_json)}\n end\n end",
"def index\n render json: RequestItem.all\n end",
"def show\n @quize = Quize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quize }\n end\n end",
"def query(endpoint, query=nil, http=nil, version=:v3)\n require 'json'\n \n unless http then\n require 'puppet/network/http_pool'\n http = Puppet::Network::HttpPool.http_instance(@host, @port, use_ssl=true)\n end\n headers = { \"Accept\" => \"application/json\" }\n \n uri = \"/#{version.to_s}/#{endpoint.to_s}\"\n uri += URI.escape \"?query=#{query.to_json}\" unless query.nil? or query.empty?\n \n resp = http.get(uri, headers)\n raise RuntimeError, \"PuppetDB query error: [#{resp.code}] #{resp.msg}, query: #{query.to_json}\" unless resp.kind_of?(Net::HTTPSuccess)\n return JSON.parse(resp.body)\n end",
"def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end",
"def simple_queue\n make_json_request('qstatus')\n end",
"def get_q\n @q = params[:q].to_i if params.has_key?:q\n @q = nil if @q == 0 # avoid q = 0 when there is no filter\n end",
"def url *args\n if args.first\n Url.current.qs(*args)\n else\n Url.current\n end\n end",
"def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"def call(query)\n # TODO: handle exceptions\n self.class.get(\"/jokes/search?query=#{query}\")\n end",
"def query\n { \"page\" => page,\n \"page_size\" => page_size,\n \"phrase\" => phrase }\n end",
"def index\n @qandas = Qanda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qandas }\n end\n end",
"def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def search(jql, start_at = 0, max_results = 50, fields = '', expand = '')\n url = \"#{@api_url}/search?jql=#{jql}\"\n url = \"#{url}&startAt=#{start_at}\" unless start_at == 0\n url = \"#{url}&maxResults=#{max_results}\" unless max_results == 50\n url = \"#{url}&fields=#{fields}\" unless fields == ''\n url = \"#{url}&expand=#{expand}\" unless expand == ''\n get_json(url)\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def query(sparql, opts = {})\n res = execute_request(\n :get,\n '/query',\n params: opts.slice(:baseURI, :offset, :limit).merge(query: sparql),\n headers: request_headers(opts)\n ).body\n\n res.blank? ? [] : SPARQL::Client.parse_json_bindings(res)\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa }\n end\n end",
"def index\n @qrs = Qr.all\n end",
"def solr(url, handler, params={})\n connection, solr_url = connection(url)\n req_url = solr_url.path + '/select?' + hash_to_query_string(params.merge(:qt => handler))\n # puts \"*** requesting to Solr: #{req_url}\"\n connection.get(req_url)\nend",
"def index\n @title = t 'view.grades.index_title'\n @searchable = true\n @grades = @grades.filtered_list(params[:q]).page(params[:page]).uniq('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grades }\n end\n end",
"def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end",
"def show\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quartet }\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def index\n @shops = Shop.order('isnull(alexa) asc,alexa asc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { \n q = \"%#{params[:q]}%\"\n @shops = @shops.\n where(\"name like ? or domain like ? or cert like ?\",q,q,q) if params[:q].present?\n render json: @shops \n }\n end\n end",
"def new\n @q = Q.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @q }\n end\n end",
"def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def query\n start do |connection|\n request = HTTP::Get.new \"#{ @uri.path }?#{ @uri.query }\"\n @headers.each { |header, value| request[header] = value }\n connection.request request\n end\n end",
"def get(request)\n @connection.get request.qpath\n end",
"def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"def search\n query = params[:q]\n works = ActiveFedora::SolrService.query(query, fq: @fq, fl: @fl, df: @df, rows: @max_rows) \n format_solr_keys(works)\n render(json: works)\n end",
"def get(path, query={})\n request.get(path, query_options(query))\n end",
"def search(query, opts = {})\r\n page = opts[:page] || 1\r\n uri = url_for('search', opts)\r\n response = RestClient.get(uri, params: { q: query, page: page })\r\n JSON.parse response\r\n end",
"def search\n render json: User.first(10)\n end",
"def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend",
"def my_students(query={})\n self.simple_client.get(\"/api/v1/students?#{query.to_query}\")\n end",
"def wrap_solr_request\n\n # Get fq parameters from request object\n fq =[]\n request.query_string.split(\"&\").each do |p|\n if p.starts_with?(\"fq=\")\n fq.push(URI.decode_www_form_component(p[3..-1]))\n end\n end\n\n q = params[:q] || \"*:*\"\n wt = params[:wt] || \"json\"\n start = params[:start] || 0\n rows = params[:rows] || 10\n sort = params[:sort] || 'pubyear desc,modified desc'\n\n\n response = solr.get 'select', :params => {:q => q, :fq => fq, :wt=> wt, :sort => sort, :start => start.to_i, :rows => rows.to_i}\n\n if wt.eql?(\"xml\")\n render xml: response\n elsif wt.eql?(\"json\")\n render json: response\n else\n render nothing: true\n end\n end",
"def index\n if(params[:uid].present?)\n @qus = Qu.find(:all, :conditions => [\"uid = ?\", params[:uid]], :order => \"created_at desc\").paginate(:page => params[:page], :per_page => 50)\n else\n @qus = Qu.find(:all, :order => \"created_at desc\").paginate(:page => params[:page], :per_page => 50)\n end \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @qus }\n end\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def show\n respond_to do |format|\n format.html\n format.json do\n collection = @collection\n\n if params[:related].nil?\n asks = collection.asks\n .as_json(include: [{ user: { only: [:id, :string_id, :birthday, :gender, :avatar_file_name] } },\n { left_ask_deal: { include: [{ recent_comment: { include: [user: { only: [:id, :string_id] }] } } ] } },\n { right_ask_deal: { include: [{ recent_comment: { include: [user: { only: [:id, :string_id] }] } } ] } },\n :votes,\n { ask_likes: { include: { user: { only: [:id, :string_id] } } } },\n :ask_complete,\n :event])\n else\n related_collections = collection.fetch_related_collections.limit(5)\n\n if related_collections.blank?\n recent_asks = Ask.order(id: :desc).limit(Ask::ASK_PER)\n if current_user\n my_votes = Vote.where(user_id: current_user.id).map(&:ask_id)\n recent_asks = recent_asks.where.not(user_id: current_user.id)\n recent_asks = recent_asks.where.not(id: my_votes) unless my_votes.empty?\n end\n end\n end\n\n render json: {\n collection: collection,\n asks: asks,\n related_collections: related_collections,\n recent_asks: recent_asks\n }\n end\n end\n end",
"def qs\n if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?\n '?' + @r['QUERY_STRING']\n elsif query && !query.empty?\n '?' + query\n else\n ''\n end\n end",
"def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end",
"def query(params)\n request(Resources::RESOURCE_QUERY, HTTP_METHOD_POST, params)\n end",
"def show\n render json: Collection.find(params.require(:id))\n end",
"def show\n @query_history = QueryHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @query_history }\n end\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end",
"def getQueueSearch( type, id)\n params = Hash.new\n params['type'] = type\n params['id'] = id\n return doCurl(\"get\",\"/queue/search\",params)\n end",
"def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end",
"def index\n @quantities = Quantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end",
"def get\n url = prefix + \"get\" + id_param\n return response(url)\n end",
"def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"def document\n json = Net::HTTP.get_response URI.parse(query_string(@query))\n json.body\n end",
"def index\n @querylists = HTTParty.post(\"http://66.175.217.67:3020/argames/getQuery\", :body => { :checkFilter => '' }, :headers => {\"Authorization\" => \"Bearer \" + ENV[\"API_KEY\"] })\n end",
"def query\n @query || params[:q] || params[:tq]\n end"
] | [
"0.67230064",
"0.64006436",
"0.63310105",
"0.62810373",
"0.6196126",
"0.61491925",
"0.6140475",
"0.6122536",
"0.6067986",
"0.60374254",
"0.6034821",
"0.60152197",
"0.6011379",
"0.59772384",
"0.5967782",
"0.59344023",
"0.591815",
"0.5912542",
"0.58863527",
"0.5850398",
"0.58436817",
"0.58302915",
"0.582453",
"0.5784403",
"0.5784403",
"0.5761217",
"0.5751572",
"0.57493955",
"0.5749029",
"0.5745797",
"0.5731566",
"0.5728296",
"0.57260656",
"0.571401",
"0.5707805",
"0.5689495",
"0.5686395",
"0.5681222",
"0.5677336",
"0.56683713",
"0.5653838",
"0.5648187",
"0.5633392",
"0.5618549",
"0.56182975",
"0.55967134",
"0.5596498",
"0.5589762",
"0.55828303",
"0.55671227",
"0.5562598",
"0.5558844",
"0.55528826",
"0.55520254",
"0.55514085",
"0.5545511",
"0.5545369",
"0.55449975",
"0.5539685",
"0.5539324",
"0.55386674",
"0.5536275",
"0.55232143",
"0.5519557",
"0.5507981",
"0.550742",
"0.55070305",
"0.55032706",
"0.55026627",
"0.5498706",
"0.5495684",
"0.5492577",
"0.54903483",
"0.5488256",
"0.54761523",
"0.5475713",
"0.547314",
"0.5470385",
"0.54665196",
"0.54659885",
"0.5456267",
"0.54550046",
"0.54390955",
"0.54348195",
"0.54333997",
"0.54328513",
"0.5431657",
"0.5429231",
"0.54251456",
"0.5425033",
"0.54219687",
"0.5420832",
"0.5419013",
"0.5416504",
"0.54101324",
"0.5408128",
"0.5408028",
"0.5403791",
"0.53984356",
"0.5398367",
"0.5396247"
] | 0.0 | -1 |
POST /qs POST /qs.json | def create
@q = Q.new(q_params)
respond_to do |format|
if @q.save
format.html { redirect_to @q, notice: 'Q was successfully created.' }
format.json { render action: 'show', status: :created, location: @q }
else
format.html { render action: 'new' }
format.json { render json: @q.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n request_object.post_query\n end",
"def post(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :POST)\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_request\n response = RestClient.post url, request, content_type: :json, accept: :json\n response.body\n end",
"def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end",
"def query_params\n params.require(:query).permit(:question, :answer)\n end",
"def query(params)\n request(Resources::RESOURCE_QUERY, HTTP_METHOD_POST, params)\n end",
"def create\n @q = Q.new(params[:q])\n\n respond_to do |format|\n if @q.save\n format.html { redirect_to @q, notice: 'Q was successfully created.' }\n format.json { render json: @q, status: :created, location: @q }\n else\n format.html { render action: \"new\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post query=nil, content_type='application/x-www-form-urlencoded'\n\t\treq = Net::HTTP::Post.new(@uri.path)\n\n\t\treq.body= make_query query if query\n\t\treq.content_type=content_type if query\n\t\treq.content_length=query ? req.body.length : 0\n\n\t\tdo_http req\n\tend",
"def index\n @qs = Q.all\n end",
"def http_query(verb, uri, opts)\n JSON.parse RestClient.send(verb, uri.to_s, opts)\n end",
"def q_params\n params.fetch(:q, {}).permit(:name, :qn_id, :correct_flg)\n end",
"def post(url, query = {}, payload = {})\n restclient({\n method: :post,\n url: \"#{@scheme}://#{@host}/#{url}\",\n timeout: Timeout,\n open_timeout: OpenTimeout,\n payload: payload.to_json,\n headers: {\n authorization: @auth,\n content_type: :json,\n accept: :json,\n params: query\n }\n })\n end",
"def build_qs(args)\n args.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def post_analytics_queues_observations_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.post_analytics_queues_observations_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.post_analytics_queues_observations_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/queues/observations/query\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueueObservationQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#post_analytics_queues_observations_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def queries\n urls, url_base, url_vals = params.values_at('urls', 'url_base', 'url_vals')\n\n if urls && urls.is_a?(Hash)\n # the outcome of a json-encoded POST body\n raw_queries = urls\n\n elsif url_base && url_vals\n # assemble queries by slapping each url_val on the end of url_base\n raise BadRequestError, \"url_base must be a string\" unless url_base.is_a?(String)\n raise BadRequestError, \"url_vals must be an array or comma-delimited string\" unless url_vals.is_a?(String) || url_vals.is_a?(Array)\n url_vals = url_vals.split(',') if url_vals.is_a?(String)\n #\n raw_queries = {}\n url_vals.each_with_index do |val, idx|\n raw_queries[idx] = \"#{url_base}#{val}\"\n end\n else\n raise BadRequestError, \"Need either url_base and url_vals, or a JSON post body giving a hash of req_id:url pairs.\"\n end\n\n # make all the queries safe\n normalized_queries = {}\n raw_queries.each do |req_id, raw_q|\n raise BadRequestError, \"Request IDs must be numbers or simple identifiers\" unless (req_id.to_s =~ IDENTIFIER_OR_NUM_RE)\n norm_q = normalize_query(raw_q) or next\n normalized_queries[req_id.to_s] = norm_q\n end\n normalized_queries\n end",
"def sparql_query(query)\n query = query.join(\"\\n\\n\") + \"\\n\" rescue query\n path = \"/DAV/home/#{@username}/query\"\n\n res = http_request(\"POST\", path, query, {\n \"Content-Type\" => \"application/sparql-query\"\n })\n\n return res.code == \"201\"\n end",
"def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end",
"def request\n data = [\n exact_queries(%w[name user type]),\n switch_queries(%w[stable reviewed]),\n array_queries(%w[tags]),\n range_condition_queries(%w[downloads rating version]),\n sort_query,\n range_query\n ].reduce({}, :merge)\n\n url = \"/items/#{data.empty? ? '' : '?'}#{URI.encode_www_form(data)}\"\n @data = @api.request(url).map do |hash|\n hash['id'] = @api.normalize_id(hash['id'])\n hash\n end\n end",
"def query_params\n params.require(:query).permit(:name, :query)\n end",
"def post_analytics_queues_observations_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.post_analytics_queues_observations_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.post_analytics_queues_observations_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/queues/observations/query\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud Auth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QualifierMappingObservationQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#post_analytics_queues_observations_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(path, query_params={}, opts={})\n request(:post, path, query_params, opts)\n end",
"def query q, params={}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"q\" => q,\n \"Call_ID\" => params[:call_id],\n \"format\" => params[:format]\n }\n }\n get 'query.php', params\n end",
"def q\n @q ||= HTTP.parseQs qs[1..-1]\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def q_params\n params.require(:q)\n .permit(:requested_by_user_id, :assigned_to_user_id, :status,\n created_at: %i[start_date end_date])\n end",
"def q_params\n params.require(:q)\n .permit(:requested_by_user_id, :assigned_to_user_id, :status,\n created_at: %i[start_date end_date])\n end",
"def post_analytics_queues_observations_query_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AnalyticsApi.post_analytics_queues_observations_query ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AnalyticsApi.post_analytics_queues_observations_query\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/analytics/queues/observations/query\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'QueueObservationQueryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AnalyticsApi#post_analytics_queues_observations_query\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def post(uri, query = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def post(payload, request_opts={})\n if payload.is_a?(Hash)\n payload = self.class.item_class.new(payload) # apply data type conversion\n end\n qs = payload.query_string_params\n payload = payload.as_hash\n response = http(request_opts).post(resolved_path + qs, payload)\n new_item = self.class.item_class.new\n new_item.store_result(response)\n new_item\n end",
"def create(name, q, type='meter')\n raise \"Save search type must be meter or annotation.\" unless ['meter','annotation'].include?(type) \n ss = Hash.new\n ss[:name] = name\n ss[:q] = q\n ss[:types] = type\n response = Boundary.post(@url, JSON.generate(ss), {:content_type => :json, :accept => :json})\n response['id']\n end",
"def parse_query(qs, d = T.unsafe(nil), &unescaper); end",
"def parse_query(qs, d = T.unsafe(nil), &unescaper); end",
"def query_params\n params.require(:query).permit(:name, :query_string)\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def q_params\n params.require(:q).permit(:order, :quiz_id, :title)\n end",
"def parse_query(qs, d = '&;')\n params = {}\n (qs || '').split(/[#{d}] */n).each do |p|\n k, v = p.split('=', 2).map { |str| str } # NOTE: uri_unescape\n k = k.to_sym\n if cur = params[k]\n if cur.class == Array\n params[k] << v\n else\n params[k] = [cur, v]\n end\n else\n params[k] = v\n end\n end\n params\n end",
"def querylist_params\n params.require(:querylist).permit(:emailaddres, :query)\n end",
"def index\n @querylists = HTTParty.post(\"http://66.175.217.67:3020/argames/getQuery\", :body => { :checkFilter => '' }, :headers => {\"Authorization\" => \"Bearer \" + ENV[\"API_KEY\"] })\n end",
"def query_params\n params.require(:query).permit(:name, :filters, :user_id, :type, :open)\n end",
"def query_params\n params.permit(:aql)\n end",
"def set_dapi\n params.permit(:query)\n end",
"def build_request path, opts\n opts[:method] ||= :get\n raise \"The :data option can only be used if :method => :post\" if opts[:method] != :post and opts[:data]\n opts[:params] = opts[:params].nil? ? {:wt => :ruby} : opts[:params].merge(:wt => :ruby)\n query = RSolr::Uri.params_to_solr(opts[:params]) unless opts[:params].empty?\n opts[:query] = query\n if opts[:data].is_a? Hash\n opts[:data] = RSolr::Uri.params_to_solr opts[:data]\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'application/x-www-form-urlencoded'\n end\n opts[:path] = path\n opts[:uri] = base_uri.merge(path.to_s + (query ? \"?#{query}\" : \"\")) if base_uri\n opts\n end",
"def query(query:)\n path = '/graphql'\n\n if query.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"query\"')\n end\n\n params = {\n query: query,\n }\n \n headers = {\n \"x-sdk-graphql\": 'true',\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n )\n end",
"def to_query\n {\n json: query\n }\n end",
"def to_query\n {\n json: query\n }\n end",
"def quack_params\n params.require(:quack).permit(:name, :title)\n end",
"def q(*queries)\n new_queries = Array.wrap(queries).flatten\n\n add_params q: new_queries.join(' ')\n end",
"def response_key_value_data(code)\n HTTParty.post(\"https://www.googleapis.com/qpxExpress/v1/trips/search?key=#{ENV[\"GOOGLE_FLIGHT_API_KEY\"]}\",\n { \n :body => request_data(code).to_json,\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}\n })\nend",
"def create_query(project_id, opts = {})\n post \"projects/#{project_id}/queries\", opts\n end",
"def doc_request(query)\n endpoint = \"http://doc-#{search_domain}.#{aws_region}.cloudsearch.amazonaws.com/#{api_version}/documents/batch\"\n\n options = { :body => [query].to_json, :headers => { \"Content-Type\" => \"application/json\"} }\n\n begin\n response = HTTParty.post(endpoint, options)\n rescue Exception => e\n ae = Asari::DocumentUpdateException.new(\"#{e.class}: #{e.message}\")\n ae.set_backtrace e.backtrace\n raise ae\n end\n\n unless response.response.code == \"200\"\n raise Asari::DocumentUpdateException.new(\"#{response.response.code}: #{response.response.msg}\")\n end\n\n nil\n end",
"def query_params\n params.require(:query).permit(:date, :status, :note, :patient_id, :specialist_id)\n end",
"def query\n { \"page\" => page,\n \"page_size\" => page_size,\n \"phrase\" => phrase }\n end",
"def query(query, apikey, endpoint, accept = \"application/json\")\n\tjson = open(\"#{endpoint}?query=#{CGI.escape(query)}&apikey=#{apikey}\", \"Accept\" => accept).read\n\tJSON.parse(json)\n\nend",
"def serialize_query\n @query.map { |k,v| \"#{k}=#{v}\" }.join(\"&\")\n end",
"def create_deals_search body, from: nil, size: nil\r\n # the base uri for api requests\r\n query_builder = Configuration::BASE_URI.dup % [@version]\r\n\r\n # prepare query string for API call\r\n query_builder << \"/deals/search\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n \"from\" => from,\r\n \"size\" => size,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"content-type\" => \"application/json; charset=utf-8\",\r\n \"X-Api-Key\" => @x_api_key\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.post query_url, headers:headers, parameters:body.to_json\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def call method, args = {}\n unless args.is_a? Hash\n raise ArgumentError.new \"argument must be a Hash\"\n end\n\n args.each_key do |key|\n if args[key].is_a?(Array) || args[key].is_a?(Hash)\n args[key] = JSON.dump(args[key])\n end\n end\n\n @faraday.post method, args\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def query(query, params={})\n query *= '+' if query.is_a? Array\n request '', params.merge(:query => query)\n end",
"def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def execute\n res = Net::HTTP.start(@query.uri.hostname, @query.uri.port) do |http|\n req = Net::HTTP::Post.new(@query.uri)\n req['Cookie'] = @session_cookie_provider.current.value\n req['Content-Type'] = \"application/json; charset=utf-8\"\n req.body = build_body(@query.attributes)\n\n http.request(req)\n end\n # TODO: handle invalid responses\n @parser.parse(res.body)\n end",
"def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end",
"def post(query_url,\r\n headers: {},\r\n parameters: {})\r\n HttpRequest.new(HttpMethodEnum::POST,\r\n query_url,\r\n headers: headers,\r\n parameters: parameters)\r\n end",
"def search_posts\n @posts = Post.ransack(name_cont: params[:q]).result.limit(20)\n\n render json: @posts, status: 200\n end",
"def post(uri, query = {}, headers = {})\n return request_with_entity(:post, uri, query, headers) if String === query\n\n node = {}\n # Create a fake form\n class << node\n def search(*args); []; end\n end\n node['method'] = 'POST'\n node['enctype'] = 'application/x-www-form-urlencoded'\n\n form = Form.new(node)\n\n Mechanize::Util.each_parameter(query) { |k, v|\n if v.is_a?(IO)\n form.enctype = 'multipart/form-data'\n ul = Form::FileUpload.new({'name' => k.to_s},::File.basename(v.path))\n ul.file_data = v.read\n form.file_uploads << ul\n elsif v.is_a?(Form::FileUpload)\n form.enctype = 'multipart/form-data'\n form.file_uploads << v\n else\n form.fields << Form::Field.new({'name' => k.to_s},v)\n end\n }\n post_form(uri, form, headers)\n end",
"def custom_query(options)\n form_data = {}\n options.each {|k,v| form_data[k.to_s] = v.to_s }\n form_data['action'] = 'query'\n make_api_request(form_data).first.elements['query']\n end",
"def post(*args)\n request :post, *args\n end",
"def parse_query(qs, d = nil)\n params = {}\n (qs || '').split(d ? /[#{d}] */n : /[&;] */n).each do |p|\n k, v = p.split('=', 2).map { |x| CGI::unescape(x) }\n if (cur = params[k])\n if cur.class == Array\n params[k] << v\n else\n params[k] = [cur, v]\n end\n else\n params[k] = v\n end\n end\n\n params\n end",
"def simple_queue\n make_json_request('qstatus')\n end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end",
"def add_qs k,v,p={}; alter_qs :add, k,v,p; end",
"def query_params\n params.require(:query).permit(:keyword, :campaign_id, :search_engine_id)\n end",
"def new\n @q = Q.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @q }\n end\n end",
"def post_to_solr(params,commit=true)\n url=\"#{Blacklight.default_index.connection.options[:url]}/update?commit=#{commit}\"\n RestClient.post url, params,:content_type => :json, :accept=>:json\n end",
"def quatum_params\n params.require(:quatum).permit(:service_request_id, :user_id, :amount, :duration, :when, :state)\n end",
"def query(sql)\n path = 'query'\n io = request path, :post, {}, {query: sql}, stream: true\n io.each do |l|\n yield l\n end\n end",
"def post(path, query_string, data)\n # ...and delegate to the Faraday connection we created on initilization\n @conn.post \"#{path}?#{query_string}\", data\n end",
"def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def index\n @comment_qs = CommentQ.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comment_qs }\n end\n end",
"def query ; @request.params ; end",
"def batch_query\n render nothing: true\n\n # logger.info \"params: \" + params.inspect\n #\n # endpoints_all = Endpoint.all\n # logger.info \"List of all endpoints:\"\n # endpoints_all.each do |endpoint|\n # logger.info ' name: ' + endpoint[:name] + ', url: ' + endpoint[:base_url]\n # end\n\n # Select endpoints using array of endpoint names;\n # Unfortunately, they are not necessarily unique\n endpoint_names = params[:endpoint_names]\n logger.info 'param endpoint_names:' + endpoint_names.inspect\n selected_endpoints = []\n if endpoint_names\n parse_array(endpoint_names).each do |endpoint_name|\n match_ep = Endpoint.find_by_name(endpoint_name)\n if match_ep\n logger.info endpoint_name.to_s + ' matches: ' + match_ep[:name].inspect\n selected_endpoints.push(match_ep)\n else\n logger.info 'WARNING: ' + endpoint_name.to_s + ' has no match!'\n end\n end\n end\n # logger.info 'selected endpoings: ' + selected_endpoints.inspect\n\n\n # users = User.all\n # users.each do |user|\n # logger.info 'username: ' + user[:username]\n # end\n\n # queries_all = Query.all\n # logger.info \"List of all queries:\"\n # queries_all.each do |query|\n # logger.info ' title: ' + query[:title] + ', desc: ' + query[:description]\n # end\n\n # Select query using array of query descriptions;\n # Unfortunately, they are not necessarily unique\n #query_titles = params[:query_titles]\n username = params[:username]\n current_user = User.find_by_username(username)\n if current_user\n query_descriptions = params[:query_descriptions]\n # logger.info 'param query_descriptions:' + query_descriptions.inspect\n selected_queries = []\n if query_descriptions\n parse_array(query_descriptions).each do |query_desc|\n match_query = current_user.queries.find_by_description(query_desc)\n if match_query\n logger.info query_desc + ' matches: ' + match_query[:description].inspect\n selected_queries.push(match_query)\n else\n logger.info 'WARNING: ' + query_desc + ' has no match!'\n end\n end\n end\n end\n # logger.info 'selected queries: ' + selected_queries.inspect\n\n if selected_endpoints && !selected_endpoints.empty? &&\n selected_queries && !selected_queries.empty?\n notify = params[:notification]\n selected_queries.each do |eachQuery|\n #Parallel.each(selected_queries, :in_threads=>15) do |eachQuery|\n # execute the query, and pass in the endpoints and if the user should be notified by email when execution completes\n # logger.info 'title: ' + eachQuery[:title].inspect\n # logger.info 'desc: ' + eachQuery[:description].inspect\n # logger.info 'user_id: ' + eachQuery[:user_id].inspect\n eachQuery.execute(selected_endpoints, notify)\n end\n else\n flash[:alert] = 'Cannot execute a query if no endpoints are provided.'\n end\n end",
"def post(*args)\n request(:post, *args)\n end",
"def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end",
"def post_check(excon, body)\n excon.request(\n method: :post,\n path: '/check',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def detail_params\n params.require(:q).permit(:sorts)\n end",
"def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end",
"def series_params\n params.fetch(:series, :q, :test, {})\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def query_params; end",
"def index\n @rnaseqs = Rnaseq.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rnaseqs }\n end\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def query(query, args = {})\n args.merge!(q: query, qt: 'standard')\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end",
"def create\n #@query = Query.create!({:question =>params[:query][:question], :user_id => current_user.id})\n @query= current_user.queries.build(query_params)\n respond_to do |format|\n if @query.save\n format.html { redirect_to queries_path, notice: 'Query was successfully created.' }\n \n else\n format.html { render :new }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def altoq_params\n params.fetch(:altoq, {})\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end",
"def destroy\n @q.destroy\n respond_to do |format|\n format.html { redirect_to qs_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.6056008",
"0.58549833",
"0.58291733",
"0.575022",
"0.572263",
"0.5680553",
"0.56774926",
"0.5655744",
"0.56217605",
"0.5583506",
"0.5570381",
"0.55238485",
"0.55040896",
"0.54919994",
"0.54797703",
"0.54631466",
"0.5397797",
"0.539553",
"0.53905976",
"0.53873146",
"0.5377334",
"0.53722185",
"0.5357584",
"0.53567255",
"0.5353863",
"0.53421015",
"0.53421015",
"0.53303325",
"0.53156185",
"0.5312478",
"0.5311106",
"0.5301786",
"0.5301786",
"0.5291118",
"0.52442825",
"0.52442825",
"0.52327406",
"0.52327347",
"0.52292347",
"0.52229",
"0.52210754",
"0.5210816",
"0.5207797",
"0.51912993",
"0.51891774",
"0.51676977",
"0.51676977",
"0.5163571",
"0.5156244",
"0.51368225",
"0.5133346",
"0.5129783",
"0.5105004",
"0.51036996",
"0.5096488",
"0.50880605",
"0.5085381",
"0.5084051",
"0.5076659",
"0.5073905",
"0.5071396",
"0.5048041",
"0.5043417",
"0.50393873",
"0.50390804",
"0.50321126",
"0.5031601",
"0.50307214",
"0.5029771",
"0.50122756",
"0.50039923",
"0.49958578",
"0.49956694",
"0.49905154",
"0.49884403",
"0.49835685",
"0.4982888",
"0.4981517",
"0.4980276",
"0.4975675",
"0.49736068",
"0.49688214",
"0.49680772",
"0.4966264",
"0.49598256",
"0.49566114",
"0.4954191",
"0.4948129",
"0.49459022",
"0.49440676",
"0.49436828",
"0.49383292",
"0.49376497",
"0.4933015",
"0.49328876",
"0.49240613",
"0.49237508",
"0.49234784",
"0.49221852",
"0.4916931"
] | 0.5579825 | 10 |
PATCH/PUT /qs/1 PATCH/PUT /qs/1.json | def update
respond_to do |format|
if @q.update(q_params)
format.html { redirect_to @q, notice: 'Q was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @q.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @q = Q.find_by_unique_id(params[:id])\n\n respond_to do |format|\n if @q.update_attributes(params[:q])\n format.html { redirect_to @q, notice: 'Q was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @q.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def put!\n request! :put\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update_single_poll(id,polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n raise \"polls__question__ is required\" if polls__question__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id,\n :polls__question__ => polls__question__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update attrs\n put '', :body => {self.class.api_name => self.class.opts_to_query_opts(attrs)}\n end",
"def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @quack.update(quack_params)\n format.html { redirect_to @quack, notice: 'Quack was successfully updated.' }\n format.json { render :show, status: :ok, location: @quack }\n else\n format.html { render :edit }\n format.json { render json: @quack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @qu = Qu.find(params[:id])\n respond_to do |format|\n if @qu.update_attributes(params[:qu])\n format.html { redirect_to @qu, :notice => 'Qu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n respond_to do |format|\n if @rfq.update(rfq_params)\n format.html { redirect_to @rfq, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rfq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(request)\n end",
"def update(request)\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n put :update\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n respond_with []\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update_existing_quiz_question(course_id,quiz_id,id,question__question_name__,question__question_text__,question__question_type__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :question__question_name__,\n :question__question_text__,\n :question__quiz_group_id__,\n :question__question_type__,\n :question__position__,\n :question__points_possible__,\n :question__correct_comments__,\n :question__incorrect_comments__,\n :question__neutral_comments__,\n :question__text_after_answers__,\n :question__answers__,\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"quiz_id is required\" if quiz_id.nil?\n raise \"id is required\" if id.nil?\n raise \"question__question_name__ is required\" if question__question_name__.nil?\n raise \"question__question_text__ is required\" if question__question_text__.nil?\n raise \"question__question_type__ is required\" if question__question_type__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id,\n :question__question_name__ => question__question_name__,\n :question__question_text__ => question__question_text__,\n :question__question_type__ => question__question_type__\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{quiz_id}/questions/{id}\",\n :course_id => course_id,\n :quiz_id => quiz_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n QuizQuestion.new(response)\n end",
"def put(*args)\n request :put, *args\n end",
"def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end",
"def update\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n if @qa.update_attributes(params[:qa])\n format.html { redirect_to @qa, notice: 'Qa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request = Request.find_by_id(params[:id])\n if request\n request.status = 1\n if request.save\n render json: {\n status: 'success',\n message: 'Request marked as fulfilled',\n },\n status: :ok\n else\n render json: {\n status: 'error',\n message: 'Request failed',\n data: request.errors,\n },\n status: :unprocessable_entity\n end\n else\n render status: :unauthorized\n end\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update(*args)\n put(*args)\n end",
"def update(*args)\n put(*args)\n end",
"def put_update(options = {})\n options[:id] ||= @phone.id\n options[:phone] ||= @attributes\n\n # options[:email][@email.id.to_s] = @attributes\n put :update,options\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @group_id = args[:group_id] if args.key?(:group_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n end",
"def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @resource_info = args[:resource_info] if args.key?(:resource_info)\n @validate_only = args[:validate_only] if args.key?(:validate_only)\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def update\n @rnaseq = Rnaseq.find(params[:id])\n\n respond_to do |format|\n if @rnaseq.update_attributes(params[:rnaseq])\n format.html { redirect_to @rnaseq, notice: 'Rnaseq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rnaseq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @qux.update(qux_params)\n format.html { redirect_to @qux, notice: 'Qux was successfully updated.' }\n format.json { render :show, status: :ok, location: @qux }\n else\n format.html { render :edit }\n format.json { render json: @qux.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @question_localized = QuestionLocalized.find(params[:id])\n\n respond_to do |format|\n if @question_localized.update_attributes(params[:question_localized])\n flash[:notice] = 'QuestionLocalized was successfully updated.'\n format.html { redirect_to(@question_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question_localized.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @query = current_user.queries.find(params[:id])\n\n respond_to do |format|\n if @query.update_attributes(params[:query])\n format.html { redirect_to @query, notice: 'Query was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update\n #respond_to do |format|\n # if @request.update(request_params)\n # format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update \n respond_to do |format|\n if @sync_query.update_attributes(sync_query_params)\n format.html { redirect_to sync_queries_url, notice: 'Sync query was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sync_query.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update_request?(http_method = nil)\n http_method = http_method.downcase.to_sym if http_method.is_a?(String)\n %i[put post patch].include?(http_method || @verb)\n end",
"def update\n return\n respond_to do |format|\n if @quest.update(quest_params)\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(query_url,\r\n headers: {},\r\n parameters: {})\r\n HttpRequest.new(HttpMethodEnum::PATCH,\r\n query_url,\r\n headers: headers,\r\n parameters: parameters)\r\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def base_update(resource, id, options, format = nil, headers = nil)\n headers ||= {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n headers[:content_type] = \"#{format}\"\n headers[:prefer] = @return_preference if @use_return_preference\n options = {} if options.nil?\n options[:resource] = resource.class\n options[:format] = format\n options[:id] = id\n reply = put resource_url(options), resource, fhir_headers(headers)\n reply.resource = parse_reply(resource.class, format, reply) if reply.body.present?\n reply.resource_class = resource.class\n reply\n end",
"def update\n @quick_poll_option = QuickPollOption.find(params[:id])\n\n respond_to do |format|\n if @quick_poll_option.update_attributes(params[:quick_poll_option])\n format.html { redirect_to @quick_poll_option, notice: 'Quick poll option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quick_poll_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @qanote.update(qanote_parameters)\n format.html { redirect_to @qanote, notice: 'Qanote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @qanote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @response = args[:response] if args.key?(:response)\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(uri, options = T.unsafe(nil)); end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6570083",
"0.65507406",
"0.64701235",
"0.64398533",
"0.64398533",
"0.64269096",
"0.642601",
"0.62791115",
"0.6208684",
"0.620093",
"0.614093",
"0.61223507",
"0.6107214",
"0.61007965",
"0.6096938",
"0.60758585",
"0.60758585",
"0.60758585",
"0.60758585",
"0.6055955",
"0.604386",
"0.60297555",
"0.5999081",
"0.59833175",
"0.59833175",
"0.59797037",
"0.5912423",
"0.59086376",
"0.59086376",
"0.5905839",
"0.58909255",
"0.5880416",
"0.58681977",
"0.58681977",
"0.5863964",
"0.5863768",
"0.5856963",
"0.5856335",
"0.58488923",
"0.5841867",
"0.5841867",
"0.5816515",
"0.58160484",
"0.5815432",
"0.58150536",
"0.5802252",
"0.5786405",
"0.57788616",
"0.5776423",
"0.57750344",
"0.5774938",
"0.57732403",
"0.576836",
"0.57586867",
"0.57502884",
"0.5747842",
"0.57473916",
"0.5744749",
"0.5744749",
"0.5744656",
"0.5742733",
"0.5741241",
"0.5737751",
"0.5735682",
"0.5734236",
"0.57329506",
"0.5728326",
"0.5726058",
"0.5700119",
"0.569964",
"0.5699429",
"0.5692382",
"0.5681226",
"0.5678233",
"0.56766486",
"0.56719226",
"0.5670188",
"0.56690246",
"0.56580794",
"0.5656471",
"0.5656471",
"0.5648854",
"0.5642305",
"0.56397974",
"0.56381917",
"0.56341106",
"0.56313324",
"0.5629886",
"0.5628791",
"0.562709",
"0.5625857",
"0.56247526",
"0.5605193",
"0.5603676",
"0.55989796",
"0.55941534",
"0.55901194",
"0.55884355",
"0.55884355",
"0.55884355"
] | 0.639844 | 7 |
DELETE /qs/1 DELETE /qs/1.json | def destroy
@q.destroy
respond_to do |format|
format.html { redirect_to qs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @q = Q.find_by_unique_id(params[:id])\n @q.destroy\n\n respond_to do |format|\n format.html { redirect_to qs_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def delete!\n request! :delete\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @rnaseq = Rnaseq.find(params[:id])\n @rnaseq.destroy\n\n respond_to do |format|\n format.html { redirect_to rnaseqs_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete!(*rest) end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def deleteRequest\n\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete(*args)\n Request.delete(*args)\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @qu = Qu.find(params[:id])\n @qu.destroy\n\n respond_to do |format|\n format.html { redirect_to qus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to qas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qu = Qu.find(params[:id])\n @qu.destroy\n respond_to do |format|\n format.html { redirect_to qus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end",
"def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(path, query={})\n request.delete(path, query_options(query))\n end",
"def delete_by_query(queries)\n { delete: { query: queries } }.to_json\n end",
"def delete\n api(\"Delete\")\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete_by_query(query)\n rsp = post(\"<delete><query>#{query}</query></delete>\")\n success?(rsp.body) or log_error(rsp.body)\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(url, resource_name, options = {})\n build_response(resource_name) do\n connection.delete do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete(url)\n do_request(\"delete\", url)\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete options\n rest_request({ method: :delete }.merge(options))\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @saved_query.destroy\n respond_to do |format|\n format.html { redirect_to saved_queries_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def destroy\n @query = current_user.queries.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to queries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @q_response = QResponse.find(params[:id])\n @q_response.destroy\n\n respond_to do |format|\n format.html { redirect_to q_responses_url }\n format.json { head :ok }\n end\n end",
"def delete(path, opts = {})\n request(:delete, path, opts).body\n end",
"def do_delete(uri = '')\n build_request(:delete, uri)\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @altoq.destroy\n respond_to do |format|\n format.html { redirect_to altoqs_url, notice: 'Altoq was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end",
"def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end",
"def delete(url)\n call(url: url, action: :delete)\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete(uri, options = {})\n build_response(request.delete(uri, build_request_options({:input => options.to_params})))\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n \n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @quize = Quize.find(params[:id])\n @quize.destroy\n\n respond_to do |format|\n format.html { redirect_to quizes_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def destroy\n @quatum.destroy\n respond_to do |format|\n format.html { redirect_to quata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @query = Query.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @rfq = Rfq.find(params[:id])\n @rfq.destroy\n\n respond_to do |format|\n format.html { redirect_to rfqs_url }\n format.json { head :ok }\n end\n end",
"def delete_questions\n response = Request.delete_request(URL_QUESTION)\n if response.success?\n redirect '/upload-csv'\n end\nend",
"def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to(qas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to(qas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete\n render json: Like.delete(params[\"id\"])\n end",
"def destroy\n @query.destroy\n respond_to do |format|\n format.html { redirect_to queries_url, notice: 'Consulta deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\n end",
"def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"def delete\n\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end"
] | [
"0.72193485",
"0.7048139",
"0.69685876",
"0.6932484",
"0.6922741",
"0.68599194",
"0.68480086",
"0.6827804",
"0.68137574",
"0.681348",
"0.6812168",
"0.6812168",
"0.67819947",
"0.6755975",
"0.6731847",
"0.67178446",
"0.6711751",
"0.66873634",
"0.66723126",
"0.6664109",
"0.66443485",
"0.66440415",
"0.6638738",
"0.660674",
"0.660674",
"0.65979475",
"0.6585207",
"0.65739256",
"0.6556103",
"0.6549132",
"0.65486157",
"0.6548337",
"0.65470165",
"0.6521167",
"0.6517184",
"0.6515808",
"0.65061265",
"0.6496495",
"0.6491737",
"0.64764404",
"0.64533615",
"0.6450259",
"0.6450191",
"0.6450191",
"0.6450191",
"0.6450191",
"0.64348334",
"0.64346766",
"0.64299923",
"0.6425347",
"0.6425347",
"0.6424885",
"0.64171845",
"0.64152944",
"0.6414683",
"0.6413321",
"0.6403005",
"0.63730085",
"0.6367753",
"0.6367176",
"0.6360677",
"0.6355008",
"0.6353378",
"0.63510835",
"0.6339504",
"0.63290703",
"0.63256943",
"0.6324432",
"0.63128203",
"0.6312428",
"0.63099676",
"0.6305258",
"0.6301712",
"0.6300848",
"0.629904",
"0.6298519",
"0.62902355",
"0.62898624",
"0.6285039",
"0.6280954",
"0.6278835",
"0.6277522",
"0.62683743",
"0.6262623",
"0.6257374",
"0.6251752",
"0.6246135",
"0.6246135",
"0.6238737",
"0.6238737",
"0.6238737",
"0.6238737",
"0.6238149",
"0.6238112",
"0.6235127",
"0.62314576",
"0.623087",
"0.6226966",
"0.62264615",
"0.62262744"
] | 0.71344167 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_q
@q = Q.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def q_params
params.require(:q).permit(:order, :quiz_id, :title)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
even if list order is incorrect, parser shouldn't failed and it is recognized as toplevel. | def test_nested_ordered_list_incorrect
assert_nothing_raised do
parser = Juli::Parser.new
parser.parse(data_path('t005.txt'), Juli::Visitor::Tree.new)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_first_list_line(indentation, content); end",
"def parse_list; end",
"def parse_list; end",
"def parse_in_order(*files)\n global_state = OpenStruct.new\n\n return if before_parse_list_callbacks.any? do |cb|\n cb.call(files, global_state) == false\n end\n\n OrderedParser.new(global_state, files).parse\n\n after_parse_list_callbacks.each do |cb|\n cb.call(files, global_state)\n end\n end",
"def test_parser\n errors = [\n \"a=b\\n[section]\\c=d\",\n \"[section]\\nc\",\n \"[section]\\n=d\"\n ]\n errors.each {|error|\n io = StringIO.new(error)\n exception = assert_raise(RuntimeError){ @svnauthz.parse(io) }\n assert_match /Syntax error/, exception.message\n }\n end",
"def parse_in_order(*files); end",
"def parse_definition_list; end",
"def saw_begin_list(list); end",
"def top_level_li\n lambda do |env|\n name, node = env[:node_name], env[:node]\n if name == LIST_ITEM && !node.ancestors.any? { |n| LISTS.include?(n.name) }\n node.replace(node.children)\n end\n end\n end",
"def accept_list_start list\n case list.type\n when :BULLET, :LABEL, :NOTE then\n @list_index << nil\n when :LALPHA, :NUMBER, :UALPHA then\n @list_index << 1\n else\n raise RDoc::Error, \"invalid list type #{list.type}\"\n end\n\n @list_width << 4\n @list_type << list.type\n end",
"def parse(level=0, expected=nil, list=false)\n chain = false\n exp = []\n while true\n case fetch_token\n when '('\n exp << parse(level + 1, @@matching_paren[@token], true)\n when '[', '{'\n exp << parse(level + 1, @@matching_paren[@token])\n when ')', ']', '}'\n raise RuntimeError.new(\"Mismatched closing paren\") if @token != expected\n break\n when :\"'\"\n case fetch_token\n when '(', '[', '{' then exp << [:quote].concat([parse(level+1, @@matching_paren[@token])])\n else exp << [:quote, @token]\n end\n when :'.'\n if list\n rest = parse(level, ')')\n raise RuntimeError.new('Syntax error - more than one sexp after dot.') if rest.length > 1\n exp = exp + rest\n chain = true\n else\n raise RuntimeError.new('Syntax error - dot outside of a list.')\n end\n when :nil\n exp << nil\n when String, Fixnum, Bignum, Float, Symbol\n exp << @token\n when nil\n break\n end\n end\n list ? exp.send(chain ? :to_cons_chain : :to_list) : exp\n end",
"def test_parse05b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '-k', '3', '-l' ] )\n }\n end",
"def parse_top_level_statements container\n comment = collect_first_comment\n\n look_for_directives_in container, comment\n\n throw :eof if container.done_documenting\n\n @markup = comment.format\n\n # HACK move if to RDoc::Context#comment=\n container.comment = comment if container.document_self unless comment.empty?\n\n parse_statements container, NORMAL, nil, comment\n end",
"def parse\n s_expr_list\n end",
"def parsed_tree; end",
"def toplevel; end",
"def test_parse05b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt' ] )\n }\n end",
"def parse(parser,i=0,previous_level=0,parent=nil)\n if i < parser.headlines.count\n hl = parser.headlines[i]\n #str = hl.to_s.gsub('*','').gsub(' ','')\n str = hl.to_s\n level = hl.level\n if (level - previous_level == 1) && previous_level != 0\n parent = parser.headlines[i-1]\n $last_parent[level] = parent\n elsif level == previous_level || level < previous_level\n parent = $last_parent[level]\n else\n parent = nil\n end\n #TODO Fix order\n hl.body_lines.shift #remove title\n $headlines << {:id => Digest::MD5.hexdigest(hl.to_s), :title => str, :body => hl.body_lines.join(\"\\n\"), :level => hl.level, :parent => Digest::MD5.hexdigest(parent.to_s), :tags => hl.tags}\n if parent\n unless $children[Digest::MD5.hexdigest(parent.to_s)]\n $children[Digest::MD5.hexdigest(parent.to_s)] = []\n end\n $children[Digest::MD5.hexdigest(parent.to_s)] << {:title => str, :body => hl.body_lines.join(\"\\n\"), :parent => Digest::MD5.hexdigest(parent.to_s)}\n end\n parse(parser,i+1,level,parent)\n end\nend",
"def parse_arguments\n args_list = []\n\n expect(:L_PARANTH)\n\n args_list = parse_expression_list unless peek?(:R_PARANTH)\n\n expect(:R_PARANTH)\n\n args_list\n end",
"def test_parse03b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--t-opt' ] )\n }\n end",
"def exit_nests(line)\n indent = get_indent line\n while @nest_stack.last and @nest_stack.last[1] >= indent\n nest = @nest_stack.pop\n @token_que << [:LI_END, line]\n @token_que << [ListSymbols[nest[0]], line]\n end\n end",
"def test_parse01b\n assert_raise( RuntimeError ) {\n ArgumentManager.parse( [ '--s-opt=baz' ] )\n }\n end",
"def test_bad_nesting\n\texpect_error(\"<line1>\\n<bad>\\n<nesting></bad>\",\n\t\t /end tag 'bad' does not match last-seen start tag named 'nesting'/,\n\t\t 3)\n end",
"def parse parent, indent = 0\n p :parse_start => indent if @debug\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when :BREAK then\n parent << RDoc::Markup::BlankLine.new\n skip :NEWLINE, false\n next\n when :NEWLINE then\n # trailing newlines are skipped below, so this is a blank line\n parent << RDoc::Markup::BlankLine.new\n skip :NEWLINE, false\n next\n end\n\n # indentation change: break or verbatim\n if column < indent then\n unget\n break\n elsif column > indent then\n unget\n parent << build_verbatim(indent)\n next\n end\n\n # indentation is the same\n case type\n when :HEADER then\n parent << build_heading(data)\n when :RULE then\n parent << RDoc::Markup::Rule.new(data)\n skip :NEWLINE\n when :TEXT then\n unget\n parse_text parent, indent\n when :BLOCKQUOTE then\n type, _, column = get\n if type == :NEWLINE\n type, _, column = get\n end\n unget if type\n bq = RDoc::Markup::BlockQuote.new\n p :blockquote_start => [data, column] if @debug\n parse bq, column\n p :blockquote_end => indent if @debug\n parent << bq\n when *LIST_TOKENS then\n unget\n parent << build_list(indent)\n else\n type, data, column, line = @current_token\n raise ParseError, \"Unhandled token #{type} (#{data.inspect}) at #{line}:#{column}\"\n end\n end\n\n p :parse_end => indent if @debug\n\n parent\n\n end",
"def test_incomplete_semantic_hoisted_context\n equeue = ErrorQueue.new\n ErrorManager.set_error_listener(equeue)\n g = Grammar.new(\"parser grammar t;\\n\" + \"a : b | B;\\n\" + \"b : {p1}? B | B ;\")\n expecting = \".s0-B->:s1=>1\\n\"\n check_decision(g, 1, expecting, Array.typed(::Java::Int).new([2]), Array.typed(::Java::Int).new([1, 2]), \"B\", Array.typed(::Java::Int).new([1]), nil, 3, false)\n end",
"def parse\n @stack.push @current_level\n program_node = program Sets::EMPTY_SET \n \n SyntaxTree.new program_node\n end",
"def test_incomplete_semantic_hoisted_context2\n equeue = ErrorQueue.new\n ErrorManager.set_error_listener(equeue)\n g = Grammar.new(\"parser grammar t;\\n\" + \"a : b | B;\\n\" + \"b : {p1}? B | B D ;\")\n expecting = \".s0-B->:s1=>1\\n\"\n check_decision(g, 1, expecting, Array.typed(::Java::Int).new([2]), Array.typed(::Java::Int).new([1, 2]), \"B\", Array.typed(::Java::Int).new([1]), nil, 3, false)\n end",
"def test_parse\n @parser.meta_def(:parse_line) do |line|\n line.split(/\\s+/)\n end\n\n text = \"one line\\ntwo line\"\n should = [%w{one line}, %w{two line}]\n ret = nil\n assert_nothing_raised do\n ret = @parser.parse(text)\n end\n\n assert_equal(should, ret)\n end",
"def force_parse; end",
"def parse!\n ast = root\n error(\"Unexpected EOS (rest: '#{rest}')\") unless eos?\n error(\"Unclosed parentheses (#{unclosed_parens})\") unless unclosed_parens == 0\n ast\n end",
"def scan\n @top_level.comment = remove_private_comments(@content)\n @top_level.parser = self.class\n @top_level\n end",
"def order( items )\n self.parser.order(items) \n end",
"def _root\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_statements)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp = match_string(\"\\n\")\n unless _tmp\n _tmp = true\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_eof)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_root unless _tmp\n return _tmp\n end",
"def parse indent = 0\n p :parse_start => indent if @debug\n\n document = []\n\n until @tokens.empty? do\n type, data, column, = get\n\n if type != :INDENT and column < indent then\n unget\n break\n end\n\n case type\n when :HEADER then\n document << build_heading(data)\n when :INDENT then\n if indent > data then\n unget\n break\n elsif indent == data then\n next\n end\n\n unget\n document << build_verbatim(indent)\n when :NEWLINE then\n document << RDoc::Markup::BlankLine.new\n skip :NEWLINE, false\n when :RULE then\n document << RDoc::Markup::Rule.new(data)\n skip :NEWLINE\n when :TEXT then\n unget\n document << build_paragraph(indent)\n\n # we're done with this paragraph (indent mismatch)\n break if peek_token[0] == :TEXT\n when *LIST_TOKENS then\n unget\n\n list = build_list(indent)\n\n document << list if list\n\n # we're done with this list (indent mismatch)\n break if LIST_TOKENS.include? peek_token.first and indent > 0\n else\n type, data, column, line = @current_token\n raise ParseError,\n \"Unhandled token #{type} (#{data.inspect}) at #{line}:#{column}\"\n end\n end\n\n p :parse_end => indent if @debug\n\n document\n end",
"def parse_list(path, files)\n list_name = path.basename\n dir = path.dirname\n line_number = 0\n path.open('r') do |f|\n while (line = f.gets)\n line_number += 1\n # Strip the leading and trailing whitespace for sloppy typers\n line.strip!\n # Skip a blank line\n next if line.match(/^\\s+$/)\n # Check if the pattern or list exists\n line_path = Pathname.new(\"#{dir}/#{line}\")\n unless line_path.file?\n # puts \"Skipping #{line_path.to_s} at line ##{line_number} in file #{path.to_s} because it is not a file\"\n next\n end\n # Process the file\n process_file(line_path, files)\n end\n end\n end",
"def closed_begin_list(list); end",
"def parse_parenth\n expect :lparen\n if showNext.is_a?(:others) # e.g : (others=>'0')\n acceptIt\n expect :imply\n parse_expression\n else\n parse_expression\n end\n\n while showNext.is_a?(:comma) # aggregate\n acceptIt\n parse_expression\n end\n expect :rparen\n end",
"def parse!\n begin\n parse\n rescue Exception => e\n raise e if @options[:trace] || e.is_a?(SystemExit)\n\n $stderr.print \"#{e.class}: \" unless e.class == RuntimeError\n $stderr.puts \"#{e.message}\"\n exit 1\n end \n exit 0\n end",
"def scan(**kw)\n result = (parse(**kw) + errors + @stack.flatten).uniq.sort_by {|e| [*e.pos, (e.message ? -1 : 0)]}\n result.each_with_index do |e, i|\n if e.event == :on_parse_error and e.tok.empty? and (pre = result[i-1]) and\n pre.pos[0] == e.pos[0] and (pre.pos[1] + pre.tok.size) == e.pos[1]\n e.tok = pre.tok\n e.pos[1] = pre.pos[1]\n result[i-1] = e\n result[i] = pre\n end\n end\n result\n end",
"def parse(parser,i=0,previous_level=0,parent=nil)\n if i < parser.headlines.count\n hl = parser.headlines[i]\n #str = hl.to_s.gsub('*','').gsub(' ','')\n str = hl.to_s\n level = hl.level\n if (level - previous_level == 1) && previous_level != 0\n parent = parser.headlines[i-1]\n @last_parent[level] = parent\n elsif level == previous_level || level < previous_level\n parent = @last_parent[level]\n else\n parent = nil\n end\n #TODO Fix order\n hl.body_lines.shift #remove title\n @headlines << {:id => Digest::MD5.hexdigest(hl.to_s), :title => str, :body => hl.body_lines.join(\"\\n\"), :level => hl.level, :parent => Digest::MD5.hexdigest(parent.to_s), :tags => hl.tags}\n if parent\n unless @children[Digest::MD5.hexdigest(parent.to_s)]\n @children[Digest::MD5.hexdigest(parent.to_s)] = []\n end\n @children[Digest::MD5.hexdigest(parent.to_s)] << {:title => str, :body => hl.body_lines.join(\"\\n\"), :parent => Digest::MD5.hexdigest(parent.to_s)}\n end\n parse(parser,i+1,level,parent)\n end\n end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parseA(fileName)\n listOfTrees = []\n\n while( (thisToken = getToken(fileName)).typeName != \"eof\" ) ## HANDLES AA, ALSO EOF at END ##\n if(thisToken.typeName == \"LeftBracket\")\n listOfTrees << parseT(fileName)\n else ## WE MUST START WITH A LEFTBRACKET\n error = \"Line \" + @@lineNumber.to_s + \": \" + \"Found \" + thisToken.value.to_s\n error += \" Expected: [ or eof\"\n @@errorList << error\n end\n end\n\n return listOfTrees\nend",
"def first_nil_parse_index_assert\n idx = @children.index{|x| x.is_nil_parse? }\n if idx.nil?\n return @children.length\n end\n bad1 = (0..idx-1).map{|i|\n @children[i].is_nil_parse? ?\n [i,@children[i]] : nil\n }.compact\n bad2 = ([email protected]).map{|i|\n @children[i].is_nil_parse? ?\n nil : [i, @children[i]]\n }.compact\n bads = bad1 + bad2\n if bads.any? then no(\n \"found nil parses or non where we didn't expect to:\" <<\n \"i am #{short} and these are my bad children: \" << (\n bads.map{|b| \"at #{b[0]}: #{b[1].short}\"}.join(';')\n )\n ) end\n idx\n end",
"def parse!\n begin\n parse\n rescue Exception => e\n raise e if @options[:tron] || e.is_a?(SystemExit) || true\n\n $stderr.print \"#{e.class}: \" unless e.class == RuntimeError\n $stderr.puts \"#{e.message}\"\n $stderr.puts \" Use --tron for stacktrace.\"\n exit 1\n end\n exit 0\n end",
"def test_it_raise_error_if_internal_definition_is_at_wrong_position\n source = \"(define (foo x) (+ x 1) (define y 4) (* x y))\"\n assert_raises(Rubasteme::SchemeSyntaxErrorError) {\n _ = parse(source)\n }\n end",
"def parse!\n begin\n parse\n rescue StandardError => e\n raise e if @options[:trace] || e.is_a?(SystemExit)\n $stderr.puts \"#{e.class}: \" + e.message.to_s\n exit 1\n end\n exit 0\n end",
"def start_accepting\n @res = [\"\"]\n @indent = 0\n @prefix = nil\n\n @list_index = []\n @list_type = []\n @list_width = []\n end",
"def test_parse03b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '-j' ] )\n }\n end",
"def parse_explicit_navigation_args\n args = SimpleNavigation.explicit_navigation_args\n args = [Hash.new] if args.empty?\n if args.first.kind_of? Hash\n options = args.first\n else # args is a list of current navigation for several levels\n options = {}\n if args.size == 1 #only one navi-key has been specified, try to find out level\n level = SimpleNavigation.primary_navigation.level_for_item(args.first)\n options[:\"level_#{level}\"] = args.first if level\n else\n args.each_with_index {|arg, i| options[:\"level_#{i + 1}\"] = arg}\n end\n end\n #only the deepest level is relevant\n level = options.inject(0) do |max, kv|\n kv.first.to_s =~ /level_(\\d)/\n max = $1.to_i if $1.to_i > max\n max\n end\n raise ArgumentError, \"Invalid level specified or item key not found\" if level == 0\n [level, options[:\"level_#{level}\"]]\n end",
"def test_parsing_require_all_fields\n value_ = ::Versionomy.parse('2.0', :semver)\n assert_equal([2, 0, 0, ''], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_raises(::Versionomy::Errors::ParseError) do\n value_ = ::Versionomy.parse('2.0b1', :semver)\n end\n end",
"def test_tree_parser_rewrite_flat_list\n grammar = \"grammar T;\\n\" + \"options {output=AST;}\\n\" + \"a : ID INT;\\n\" + \"ID : 'a'..'z'+ ;\\n\" + \"INT : '0'..'9'+;\\n\" + \"WS : (' '|'\\\\n') {$channel=HIDDEN;} ;\\n\"\n tree_grammar = \"tree grammar TP;\\n\" + \"options {output=AST; ASTLabelType=CommonTree; tokenVocab=T;}\\n\" + \"@members {\\n\" + \"static class V extends CommonTree {\\n\" + \" public V(Object t) { super((CommonTree)t); }\\n\" + \" public String toString() { return token.getText()+\\\"<V>\\\";}\\n\" + \"}\\n\" + \"static class W extends CommonTree {\\n\" + \" public W(Object t) { super((CommonTree)t); }\\n\" + \" public String toString() { return token.getText()+\\\"<W>\\\";}\\n\" + \"}\\n\" + \"}\\n\" + \"a : ID INT -> INT<V> ID<W>\\n\" + \" ;\\n\"\n found = exec_tree_parser(\"T.g\", grammar, \"TParser\", \"TP.g\", tree_grammar, \"TP\", \"TLexer\", \"a\", \"a\", \"abc 34\")\n assert_equals(\"34<V> abc<W>\\n\", found)\n end",
"def assign_types_to_lines(margin = 0, level = 0)\n while line = @lines.next\n if line.blank? then\n line.stamp :BLANK, level\n next\n end\n\n # if a line contains non-blanks before the margin, then it must belong\n # to an outer level\n\n text = line.text\n\n for i in 0...margin\n if text[i] != SPACE\n @lines.unget\n return\n end\n end\n\n active_line = text[margin..-1]\n\n # Rules (horizontal lines) look like\n #\n # --- (three or more hyphens)\n #\n # The more hyphens, the thicker the rule\n #\n\n if /^(---+)\\s*$/ =~ active_line\n line.stamp :RULE, level, $1.length-2\n next\n end\n\n # Then look for list entries. First the ones that have to have\n # text following them (* xxx, - xxx, and dd. xxx)\n\n if SIMPLE_LIST_RE =~ active_line\n offset = margin + $1.length\n prefix = $2\n prefix_length = prefix.length\n\n flag = case prefix\n when \"*\",\"-\" then :BULLET\n when /^\\d/ then :NUMBER\n when /^[A-Z]/ then :UPPERALPHA\n when /^[a-z]/ then :LOWERALPHA\n else raise \"Invalid List Type: #{self.inspect}\"\n end\n\n line.stamp :LIST, level+1, prefix, flag\n text[margin, prefix_length] = \" \" * prefix_length\n assign_types_to_lines(offset, level + 1)\n next\n end\n\n if LABEL_LIST_RE =~ active_line\n offset = margin + $1.length\n prefix = $2\n prefix_length = prefix.length\n\n next if handled_labeled_list(line, level, margin, offset, prefix)\n end\n\n # Headings look like\n # = Main heading\n # == Second level\n # === Third\n #\n # Headings reset the level to 0\n\n if active_line[0] == ?= and active_line =~ /^(=+)\\s*(.*)/\n prefix_length = $1.length\n prefix_length = 6 if prefix_length > 6\n line.stamp :HEADING, 0, prefix_length\n line.strip_leading(margin + prefix_length)\n next\n end\n\n # If the character's a space, then we have verbatim text,\n # otherwise\n\n if active_line[0] == SPACE\n line.strip_leading(margin) if margin > 0\n line.stamp :VERBATIM, level\n else\n line.stamp :PARAGRAPH, level\n end\n end\n end",
"def parser=(_arg0); end",
"def preparse(unparsed, args = [], opts = {})\n case unparsed\n when Hash then opts.merge! unparsed\n when Array then unparsed.each { |e| preparse(e, args, opts) }\n else args << unparsed.to_s\n end\n [args, opts]\n end",
"def test_parse05a\n ArgumentManager.add_option( [ 'l' ], :type => :integer, :mandatory => true )\n \n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '-k', '3' ] )\n }\n end",
"def paren_nest; end",
"def paren_nest; end",
"def paren_nest; end",
"def tokenize input\n s = StringScanner.new input\n\n @line = 0\n @line_pos = 0\n\n until s.eos? do\n pos = s.pos\n\n @tokens << case\n when s.scan(/\\r?\\n/) then\n token = [:NEWLINE, s.matched, *token_pos(pos)]\n @line_pos = s.pos\n @line += 1\n token\n when s.scan(/ +/) then\n [:INDENT, s.matched_size, *token_pos(pos)]\n when s.scan(/(=+)\\s*/) then\n level = s[1].length\n level = 6 if level > 6\n @tokens << [:HEADER, level, *token_pos(pos)]\n\n pos = s.pos\n s.scan(/.*/)\n [:TEXT, s.matched, *token_pos(pos)]\n when s.scan(/^(-{3,}) *$/) then\n [:RULE, s[1].length - 2, *token_pos(pos)]\n when s.scan(/([*-])\\s+/) then\n @tokens << [:BULLET, :BULLET, *token_pos(pos)]\n [:SPACE, s.matched_size, *token_pos(pos)]\n when s.scan(/([a-z]|\\d+)\\.[ \\t]+\\S/i) then\n list_label = s[1]\n width = s.matched_size - 1\n\n s.pos -= 1 # unget \\S\n\n list_type = case list_label\n when /[a-z]/ then :LALPHA\n when /[A-Z]/ then :UALPHA\n when /\\d/ then :NUMBER\n else\n raise ParseError, \"BUG token #{list_label}\"\n end\n\n @tokens << [list_type, list_label, *token_pos(pos)]\n [:SPACE, width, *token_pos(pos)]\n when s.scan(/\\[(.*?)\\]( +|$)/) then\n @tokens << [:LABEL, s[1], *token_pos(pos)]\n [:SPACE, s.matched_size, *token_pos(pos)]\n when s.scan(/(.*?)::( +|$)/) then\n @tokens << [:NOTE, s[1], *token_pos(pos)]\n [:SPACE, s.matched_size, *token_pos(pos)]\n else s.scan(/.*/)\n [:TEXT, s.matched, *token_pos(pos)]\n end\n end\n\n self\n end",
"def assume_top_position\n set_list_position(acts_as_list_top)\n end",
"def _root\n\n _save = self.pos\n begin # sequence\n _tmp = apply(:_statements)\n break unless _tmp\n _tmp = apply(:__hyphen_)\n break unless _tmp\n # optional\n _tmp = apply(:_eof_comment)\n _tmp = true # end optional\n break unless _tmp\n _tmp = apply(:_eof)\n end while false\n unless _tmp\n self.pos = _save\n end # end sequence\n\n set_failed_rule :_root unless _tmp\n return _tmp\n end",
"def get_included_module_with_optional_parens\n skip_tkspace_without_nl\n get_tkread\n tk = get_tk\n end_token = get_end_token tk\n return '' unless end_token\n\n nest = 0\n continue = false\n only_constant = true\n\n while tk != nil do\n is_element_of_constant = false\n case tk[:kind]\n when :on_semicolon then\n break if nest == 0\n when :on_lbracket then\n nest += 1\n when :on_rbracket then\n nest -= 1\n when :on_lbrace then\n nest += 1\n when :on_rbrace then\n nest -= 1\n if nest <= 0\n # we might have a.each { |i| yield i }\n unget_tk(tk) if nest < 0\n break\n end\n when :on_lparen then\n nest += 1\n when end_token[:kind] then\n if end_token[:kind] == :on_rparen\n nest -= 1\n break if nest <= 0\n else\n break if nest <= 0\n end\n when :on_rparen then\n nest -= 1\n when :on_comment, :on_embdoc then\n @read.pop\n if :on_nl == end_token[:kind] and \"\\n\" == tk[:text][-1] and\n (!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then\n break if !continue and nest <= 0\n end\n when :on_comma then\n continue = true\n when :on_ident then\n continue = false if continue\n when :on_kw then\n case tk[:text]\n when 'def', 'do', 'case', 'for', 'begin', 'class', 'module'\n nest += 1\n when 'if', 'unless', 'while', 'until', 'rescue'\n # postfix if/unless/while/until/rescue must be EXPR_LABEL\n nest += 1 unless (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0\n when 'end'\n nest -= 1\n break if nest == 0\n end\n when :on_const then\n is_element_of_constant = true\n when :on_op then\n is_element_of_constant = true if '::' == tk[:text]\n end\n only_constant = false unless is_element_of_constant\n tk = get_tk\n end\n\n if only_constant\n get_tkread_clean(/\\s+/, ' ')\n else\n ''\n end\n end",
"def toplevel_names\n @toplevel ||= @lhs_names - @rhs_names\n @toplevel\n end",
"def lex_start; end",
"def lex_start; end",
"def lex_start; end",
"def lex_start; end",
"def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end",
"def saw_end_list(list); end",
"def parse_symbol_arg_paren no # :nodoc:\n args = []\n\n loop do\n skip_tkspace_comment\n if tk1 = parse_symbol_in_arg\n args.push tk1\n break if no and args.size >= no\n end\n\n skip_tkspace_comment\n case (tk2 = get_tk)[:kind]\n when :on_rparen\n break\n when :on_comma\n else\n warn(\"unexpected token: '#{tk2.inspect}'\") if $DEBUG_RDOC\n break\n end\n end\n\n args\n end",
"def test_parse02a\n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 's-opt' ] )\n end",
"def block_docbook_simple_lists( text )\n orig_text = text.dup\n delimiter = \"\"\n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ /^([_]+)(#{A}#{C}) (.*)$/m\n tl,atts,content = $~[1..4]\n if depth.last\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</member>\\n</simplelist>\\n\"\n depth.pop\n end\n end\n if depth.last.length == tl.length\n lines[line_id - 1] << \"</member>\"\n end\n end\n unless depth.last == tl\n depth << tl\n atts = docbook_pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = \"<simplelist#{ atts }>\\n<member>#{ content.gsub(\"<\",\"<\").gsub(\">\",\">\") }\"\n else\n lines[line_id] = \"<member>#{ content.gsub(\"<\",\"<\").gsub(\">\",\">\") }\"\n end\n last_line = line_id\n\n else\n last_line = line_id\n end\n if line_id - last_line > 1 or line_id == lines.length - 1\n depth.delete_if do |v|\n lines[last_line] << \"</member>\\n</simplelist>\"\n end\n end\n end\n lines.join( \"\\n\" )\n end\n text != orig_text\n end",
"def test_parse02a\n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 'i' ] )\n end",
"def opening(type, parent)\n case type.name.to_sym\n when :h1\n \"# \"\n when :li\n parent.eql?(:ul) ? \" - \" : \" \"+(@li_counter+=1).to_s+\". \"\n when :ol\n @li_counter = 0\n \"\"\n when :ul\n \"\"\n when :h2\n \"## \"\n when :h3\n \"### \"\n when :h4\n \"#### \"\n when :h5\n \"##### \"\n when :h6\n \"###### \"\n when :em\n \"*\"\n when :strong\n \"**\"\n when :blockquote\n # remove leading newline\n type.children.first.value = \"\"\n \"> \"\n when :code\n parent.eql?(:pre) ? \" \" : \"`\"\n when :a\n \"[\"\n when :img\n \"![\"\n when :hr\n \"----------\\n\\n\"\n when :root\n \"\"\n else\n @errors << \"unknown start tag: \"+type.name.to_s\n \"\"\n end\n end",
"def required_positionals; end",
"def test_it_replaces_asterisks_with_li_tags_in_ordered_lists\n ordered = OrderedListParser.new(\"1. Sushi\\n2. Barbeque\\n3. Mexican\")\n expected = \"\\t<li>Sushi</li>\\n\\t<li>Barbeque</li>\\n\\t<li>Mexican</li>\\n\"\n result = ordered.list_item_marker\n assert_equal expected, result\n end",
"def lex_start=(_arg0); end",
"def lex_start=(_arg0); end",
"def lex_start=(_arg0); end",
"def lex_start=(_arg0); end",
"def next_token\n return [false, false] if @src.eos?\n# p @src.rest if @yydebug\n if ret = @src.scan(EM_OPEN_RE)\n @pre << ret\n [:EM_OPEN, ret]\n elsif ret = @src.scan(EM_CLOSE_RE)\n @pre << ret\n [:EM_CLOSE, ret]\n elsif ret = @src.scan(CODE_OPEN_RE)\n @pre << ret\n [:CODE_OPEN, ret]\n elsif ret = @src.scan(CODE_CLOSE_RE)\n @pre << ret\n [:CODE_CLOSE, ret]\n elsif ret = @src.scan(VAR_OPEN_RE)\n @pre << ret\n [:VAR_OPEN, ret]\n elsif ret = @src.scan(VAR_CLOSE_RE)\n @pre << ret\n [:VAR_CLOSE, ret]\n elsif ret = @src.scan(KBD_OPEN_RE)\n @pre << ret\n [:KBD_OPEN, ret]\n elsif ret = @src.scan(KBD_CLOSE_RE)\n @pre << ret\n [:KBD_CLOSE, ret]\n elsif ret = @src.scan(INDEX_OPEN_RE)\n @pre << ret\n [:INDEX_OPEN, ret]\n elsif ret = @src.scan(INDEX_CLOSE_RE)\n @pre << ret\n [:INDEX_CLOSE, ret]\n elsif ret = @src.scan(REF_OPEN_RE)\n @pre << ret\n [:REF_OPEN, ret]\n elsif ret = @src.scan(REF_CLOSE_RE)\n @pre << ret\n [:REF_CLOSE, ret]\n elsif ret = @src.scan(FOOTNOTE_OPEN_RE)\n @pre << ret\n [:FOOTNOTE_OPEN, ret]\n elsif ret = @src.scan(FOOTNOTE_CLOSE_RE)\n @pre << ret\n [:FOOTNOTE_CLOSE, ret]\n elsif ret = @src.scan(VERB_OPEN_RE)\n @pre << ret\n [:VERB_OPEN, ret]\n elsif ret = @src.scan(VERB_CLOSE_RE)\n @pre << ret\n [:VERB_CLOSE, ret]\n elsif ret = @src.scan(BAR_RE)\n @pre << ret\n [:BAR, ret]\n elsif ret = @src.scan(QUOTE_RE)\n @pre << ret\n [:QUOTE, ret]\n elsif ret = @src.scan(SLASH_RE)\n @pre << ret\n [:SLASH, ret]\n elsif ret = @src.scan(BACK_SLASH_RE)\n @pre << ret\n [:BACK_SLASH, ret]\n elsif ret = @src.scan(URL_RE)\n @pre << ret\n [:URL, ret]\n elsif ret = @src.scan(OTHER_RE)\n @pre << ret\n [:OTHER, ret]\n else\n ret = @src.rest\n @pre << ret\n @src.terminate\n [:OTHER, ret]\n end\nend",
"def program\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n return_value = ProgramReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n statement1 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 14:5: ( statement )+\n # at file 14:5: ( statement )+\n match_count_1 = 0\n while true\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( AMP, AMP_ASGN ) || look_1_0 == POST_DECR || look_1_0.between?( GEQ, AREF ) || look_1_0.between?( GREATER, HAT ) || look_1_0.between?( ARROW, HAT_ASGN ) || look_1_0.between?( ASGN, REGEX ) || look_1_0.between?( IN, RETURN ) || look_1_0 == INCR || look_1_0.between?( BREAK, RSHIFT3 ) || look_1_0.between?( LABEL, CATCH ) || look_1_0 == RSHIFT_ASGN || look_1_0 == LEQ || look_1_0.between?( LESS, SLASH ) || look_1_0.between?( SLASH_ASGN, CONTINUE ) || look_1_0.between?( STAR, DECR ) || look_1_0 == STAR_ASGN || look_1_0.between?( LSHIFT, THIS ) || look_1_0 == THROW || look_1_0.between?( MINUS, MOD ) || look_1_0.between?( MOD_ASGN, TYPEOF ) || look_1_0.between?( NEQ, UMINUS ) || look_1_0.between?( NEQQ, UNDEFINED ) || look_1_0.between?( NEW, UPLUS ) || look_1_0.between?( OBJECT, FALSE ) || look_1_0.between?( WITH, PLUS ) || look_1_0.between?( ID, DOC ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 14:5: statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_IN_program_43 )\n statement1 = statement\n @state.following.pop\n\n @adaptor.add_child( root_0, statement1.tree )\n\n\n else\n match_count_1 > 0 and break\n eee = EarlyExit(1)\n\n\n raise eee\n end\n match_count_1 += 1\n end\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 1 )\n\n end\n \n return return_value\n end",
"def to_PLParser(startSym)\n\n thePLP = TextRect.new\n\n @ntIndex.each do |nt, s|\n\n theNT = TextRect.new(\"#{nt.name} ::= \")\n before = ' '\n\n s[:rules].each do |i|\n rhs = @ruleTable[i][:rule].rhs\n rhs.each { |sym| before << sym.name << ' ' }\n theNT.below!(before)\n before = ' | '\n end\n\n theNT.below!(' ;')\n thePLP.below!(theNT)\n\n end\n\n thePLP.below!('&G')\n\n end",
"def lex_en_expr_beg; end",
"def lex_en_expr_beg; end",
"def lex_en_expr_beg; end",
"def test_valid_parse\n test_songs, test_kits = SongParserTest.generate_test_data()\n \n assert_equal(120, test_songs[:no_tempo].tempo)\n assert_equal([:verse], test_songs[:no_tempo].flow)\n \n assert_equal(100, test_songs[:repeats_not_specified].tempo)\n assert_equal([:verse], test_songs[:repeats_not_specified].flow)\n \n # These two songs should be the same, except that one uses a kit in the song header\n # and the other doesn't.\n [:example_no_kit, :example_with_kit].each do |song_key|\n song = test_songs[song_key]\n assert_equal([:verse, :verse,\n :chorus, :chorus,\n :verse, :verse,\n :chorus, :chorus, :chorus, :chorus,\n :bridge,\n :chorus, :chorus, :chorus, :chorus],\n song.flow)\n assert_equal(99, song.tempo)\n assert_equal([\"bridge\", \"chorus\", \"verse\"], song.patterns.keys.map{|key| key.to_s}.sort)\n assert_equal(4, song.patterns[:verse].tracks.length)\n assert_equal(5, song.patterns[:chorus].tracks.length)\n assert_equal(1, song.patterns[:bridge].tracks.length)\n end\n \n song = test_songs[:example_with_empty_track]\n assert_equal(1, song.patterns.length)\n assert_equal(2, song.patterns[:verse].tracks.length)\n assert_equal(\"........\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/snare_mono_8.wav\"].rhythm)\n \n song = test_songs[:multiple_tracks_same_sound]\n assert_equal(2, song.patterns.length)\n assert_equal(7, song.patterns[:verse].tracks.length)\n assert_equal([\"agogo\", \"bass\", \"bass2\", \"bass3\", \"bass4\", \"hh_closed\", \"snare\"],\n song.patterns[:verse].tracks.keys.sort)\n assert_equal(\"X...............\", song.patterns[:verse].tracks[\"bass\"].rhythm)\n assert_equal(\"....X...........\", song.patterns[:verse].tracks[\"bass2\"].rhythm)\n assert_equal(\"........X.......\", song.patterns[:verse].tracks[\"bass3\"].rhythm)\n assert_equal(\"............X...\", song.patterns[:verse].tracks[\"bass4\"].rhythm)\n assert_equal(\"..............X.\", song.patterns[:verse].tracks[\"snare\"].rhythm)\n assert_equal(\"X.XXX.XXX.X.X.X.\", song.patterns[:verse].tracks[\"hh_closed\"].rhythm)\n assert_equal(\"..............XX\", song.patterns[:verse].tracks[\"agogo\"].rhythm)\n \n song = test_songs[:with_structure]\n assert_equal([:verse, :verse], song.flow)\n assert_equal(1, song.patterns.length)\n assert_equal(1, song.patterns[:verse].tracks.length)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n end",
"def parse_root\n s0 = @scanner.pos\n s1 = []\n s2 = parse_header\n while s2 != :failed\n s1 << s2\n s2 = parse_header\n end\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_initialboard\n s2 = nil if s2 == :failed\n s3 = []\n s4 = parse_header\n while s4 != :failed\n s3 << s4\n s4 = parse_header\n end\n s4 = parse_moves\n if s4 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s5 = []\n s6 = parse_fork\n while s6 != :failed\n s5 << s6\n s6 = parse_fork\n end\n @reported_pos = s0\n s0 = transform_root(s1, s2, s3, s4, s5)\n end\n end\n s0\n end",
"def wrong_parser!(ical, parent, message = nil) #:doc:\n message ||= \"#{self} is not the right parser for #{ical}\"\n error!(ical, parent, message)\n end",
"def parse_root\n @scanner << \"\\n\" unless @scanner.string.end_with?(\"\\n\")\n\n s0 = @scanner.pos\n s1 = []\n s2 = parse_skipline\n while s2 != :failed\n s1 << s2\n s2 = parse_skipline\n end\n\n s2 = []\n s3 = parse_header\n while s3 != :failed\n s2 << s3\n s3 = parse_header\n end\n s3 = parse_initialboard\n s3 = nil if s3 == :failed\n s4 = []\n s5 = parse_header\n while s5 != :failed\n s4 << s5\n s5 = parse_header\n end\n parse_split\n s6 = parse_moves\n if s6 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s7 = []\n s8 = parse_fork\n while s8 != :failed\n s7 << s8\n s8 = parse_fork\n end\n parse_nl\n @reported_pos = s0\n s0 = transform_root(s2, s3, s4, s6, s7)\n end\n\n s0\n end",
"def pluggable_parser; end",
"def next_item\n return @last_lexeme if @last_lexeme[0].nil?\n while true\n @line = next_line if buffer_empty?\n if @line.nil?\n lexeme = [nil, @line_no, 1]\n break\n end\n\n # Skip whitespaces\n while space?(@line[@pos])\n @pos += 1\n end\n\n # Skip triple dot characters (join lines)\n if @line[@pos, 4] == \"...\\n\" || @line[@pos, 2] == \"…\\n\"\n line_no, pos = @line_no, @pos + 1\n @line, @pos = next_line, 0\n if @line.nil? || @line.strip.empty?\n raise SyntaxError.new(line_no, pos, 'Line continuation may not be followed by an empty line')\n end\n next\n end\n\n # Skip one line comments\n if @line[@pos, 3] == 'BTW'\n @pos = @line.length - 1\n end\n # and multiline ones\n if @last_lexeme[0] == \"\\n\" && @line[@pos, 4] == 'OBTW'\n tldr_found, line_no, pos = false, @line_no, @pos + 1\n while true\n @line = next_line\n break if @line.nil?\n m = @line.chomp.match(/(^|\\s+)TLDR\\s*(,|$)/)\n unless m.nil?\n tldr_found = true\n @pos = m.end(0)\n break\n end\n end\n unless tldr_found\n raise SyntaxError.new(line_no, pos, 'Unterminated multiline comment')\n end\n next\n end\n\n if @line[@pos] == \"\\n\" || @line[@pos] == '!'\n # Handle newline and bang separately\n lexeme = [@line[@pos], @line_no, @pos + 1]\n @pos += 1\n elsif @line[@pos] == ','\n # Comma is a virtual newline\n lexeme = [\"\\n\", @line_no, @pos + 1]\n @pos += 1\n elsif @line[@pos] == '\"'\n # Strings begin with \"\n # Need to handle empty strings separately\n if @line[@pos + 1] == '\"'\n string = '\"\"'\n else\n m = @line.match(/([^:](?:::)*)\"/, @pos + 1)\n string = @line[@pos..m.end(0) - 1] unless m.nil?\n end\n # String must be followed by an allowed lexeme delimiter\n if string.nil? || !lexeme_delimiter?(@pos + string.length)\n raise SyntaxError.new(@line_no, @pos + 1, 'Unterminated string constant')\n end\n lexeme = [%Q[\"#{escape_string(string[1..-2])}\"], @line_no, @pos + 1]\n @pos = @pos + string.length\n else\n # Grab as much characters as we can until meeting lexeme delimiter\n # Treat what we grabbed as a lexeme\n seq, pos = '', @pos + 1\n until lexeme_delimiter?(@pos)\n seq += @line[@pos]\n @pos += 1\n end\n lexeme = [seq, @line_no, pos]\n end\n\n break\n end\n @last_lexeme = lexeme\n end",
"def parse\n raise \"absctract method called\"\n end",
"def test_parse05c\n options = ArgumentManager.parse( [ '-k', '3', '-l', '7' ] )\n assert_equal( 7, options[ 'l' ] )\n end",
"def accept_list_start list\n case list.type\n when :BULLET then\n @list_index << nil\n @list_width << 1\n when :LABEL, :NOTE then\n @list_index << nil\n @list_width << 2\n when :LALPHA then\n @list_index << 'a'\n @list_width << list.items.length.to_s.length\n when :NUMBER then\n @list_index << 1\n @list_width << list.items.length.to_s.length\n when :UALPHA then\n @list_index << 'A'\n @list_width << list.items.length.to_s.length\n else\n raise RDoc::Error, \"invalid list type #{list.type}\"\n end\n\n @list_type << list.type\n end",
"def parse(verbosity:false)\n verbose = verbosity\n traverse(@top_node, \"\")\n # get the last one added to the array\n test_cases << @current_test_case.clone\n test_cases.each do |tc|\n tc.skip += @skips_in_before\n end\n puts \"\" if verbose\n end",
"def parse\n @input.reverse!\n loop do\n if @input.empty?\n break\n end\n t = @input.pop\n t.freeze\n remainder = @conf.consume?(t)\n if remainder.nil? \n log \"+ #{t} not consumed\"\n return @conf.matchingCandidates(t)\n elsif remainder.strip.length > 0\n @input.push remainder\n end\n end\n return @conf.matchingCandidates(nil)\n end"
] | [
"0.6116236",
"0.57363546",
"0.57363546",
"0.57267565",
"0.5679573",
"0.55632204",
"0.55284613",
"0.5456274",
"0.53122115",
"0.5292543",
"0.5285692",
"0.5249667",
"0.5249475",
"0.5222049",
"0.5221276",
"0.5219012",
"0.52121663",
"0.51987255",
"0.5186715",
"0.5168006",
"0.5165693",
"0.5152663",
"0.5152644",
"0.5151255",
"0.51399857",
"0.51228726",
"0.5110778",
"0.50993156",
"0.50776774",
"0.5062334",
"0.5034424",
"0.5020316",
"0.5012049",
"0.5007331",
"0.49957997",
"0.49950594",
"0.4989843",
"0.4986031",
"0.49635297",
"0.49546522",
"0.49543345",
"0.49543345",
"0.49543345",
"0.49543345",
"0.4944354",
"0.49435508",
"0.4936927",
"0.49183354",
"0.49086055",
"0.49038976",
"0.49038228",
"0.48941082",
"0.48861244",
"0.4869164",
"0.48648506",
"0.4853591",
"0.48496497",
"0.4842527",
"0.48355034",
"0.48355034",
"0.48355034",
"0.48338518",
"0.48333344",
"0.48279515",
"0.48191917",
"0.48181197",
"0.48172614",
"0.48172614",
"0.48172614",
"0.48172614",
"0.48159894",
"0.48157936",
"0.48142257",
"0.4811314",
"0.4794561",
"0.47922212",
"0.47812817",
"0.47805196",
"0.4758556",
"0.47517627",
"0.47517627",
"0.47517627",
"0.47517627",
"0.47505897",
"0.4748087",
"0.47457173",
"0.47406986",
"0.47406986",
"0.47406986",
"0.47289157",
"0.4724802",
"0.4722946",
"0.4721665",
"0.4712911",
"0.4711198",
"0.47102803",
"0.47058854",
"0.47052783",
"0.47005868",
"0.46959862"
] | 0.71884537 | 0 |
t0122.txt resulted in 'syntax error' at the git version 0bc176893f57a6fdbecd0340101bd84a5eb724e0 (In other words, t0122.txt was the minimum input text to detect the parser bug of the version). | def test_list_n_verbatim2
t = build_tree_on('t012-2.txt')
assert_equal 3, t.array.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n errors << \"\\tError: Your custom commit doesn't seem like following conventional commit rules.\"\n errors << \"\\tCheck https://www.conventionalcommits.org\"\n end\n end\n errors << \"\\tError: Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(']')[1]&.length.to_i > 50\n errors << \"\\tError: Commit message subject should start in Capital.\" if line.split(']')[1] && line.split(']')[1].lstrip[0] == line.split(']')[1].lstrip[0].downcase\n end\n return errors\nend",
"def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n return errors << \"Error : Your commit message seems like not following conventional commit rules, please check your commit's convention\"\n end\n end\n errors << \"Error : Your commit message contains #{line.length} characters. Commit message should be less than 72 characters in length.\" if line.length > 72\n errors << \"Error : Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(':')[1].length > 50\n errors << \"Error : Commit message subject should start in Capital.\" if line.split(':')[1].lstrip[0] == line.split(':')[1].lstrip[0].downcase\n return errors\nend",
"def test_should_be_syntax_error\n \n dir = \"./test_case/syntax_error.rb\"\n filename = dir\n \n result = check_and_compile_file( dir , filename )\n \n assert_equal(false, result)\n \n end",
"def fix_syntax_errors!\n # 1.34\n # patch_file! \"common/on_actions/00_on_actions.txt\" do |content|\n # content.gsub(/(effect = )\"(.*?)\"/m){ $1 + \"{\" + $2 + \"}\" }\n # end\n end",
"def test_parser\n errors = [\n \"a=b\\n[section]\\c=d\",\n \"[section]\\nc\",\n \"[section]\\n=d\"\n ]\n errors.each {|error|\n io = StringIO.new(error)\n exception = assert_raise(RuntimeError){ @svnauthz.parse(io) }\n assert_match /Syntax error/, exception.message\n }\n end",
"def check_message_format\n missed_revs = `git rev-list #{$oldrev}..#{$newrev}`.split(\"\\n\")\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !$regex.match(message)\n puts \"[POLICY] Your message is not formatted correctly\"\n puts \"\\n\\tRefused message: #{message}\"\n puts \"\\nYour commit message should absolutely reference the issue number in redmine\"\n puts \"\\n\\tYou should use one of the below referencing keywords or fixing keywords\"\n puts \"\\n\\tReferencing keywords:\"\n puts \"\\t\\trefs #XXX\"\n puts \"\\t\\treferences #XXX\"\n puts \"\\t\\tIssueID #XXX\"\n puts \"\\n\\tFixing keywords:\"\n puts \"\\t\\tfixes #XXX\"\n puts \"\\t\\tcloses #XXX\"\n puts \"\\n\\treplace XXX with the issue's number.\"\n puts \"\\n\\tN.B: If the current commit is not related to any issue (which is usually a bad idea)\"\n puts \"\\tYou can use the MISC: keyword to bypass referencing an issue as follows.\"\n puts \"\\n\\t\\tMISC: Commit message\"\n puts \"\\n\\tN.B: There's a whitespace between MISC: and the commit message.\"\n puts \"\"\n exit 1\n end\n end\nend",
"def check_commit_change_for_untagged_version\n return unless spec\n return unless spec.version == Version.new('0.0.1')\n ref_spec = related_specifications.find { |s| s.version != '0.0.1' }\n return unless ref_spec\n unless ref_spec.source[:commit] == spec.source[:commit]\n error \"Attempt to rewrite the commit of 0.0.1 version.\"\n end\n end",
"def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def test_third_line\n assert_equal \" def valid_working_gemspec_args\\n\",\n Working.file_third_line(__FILE__)\n end",
"def check_message_format(regex, oldrev, newrev)\n missed_revs = `git rev-list #{oldrev}..#{newrev}`.split(\"\\n\")\n bad_commits = \"\"\n auth_fail = 0\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !regex.match(message) then\n bad_commits += \"#{rev}\\n\"\n else\n # Increment fail counter on failure\n auth_fail += verify_authcode(msg)\n end\n \n end\n\n if auth_fail > 0 or bad_commits.split(\"\\n\").nitems.to_i > 0 then\n puts \"[POLICY] Please ensure that your commit messages contain ticket or a current authorization numbers\"\n puts \"The list of commits you sent were: \"\n puts bad_commits\n exit 1\n end\nend",
"def test_ruby18\n err = assert_compile 'ruby18.y'\n assert_warnings err, useless_terms: 1\n assert_parser_unchanged 'ruby18.y'\n end",
"def exception_on_syntax_error; end",
"def check_changelog\n current_repo = File.basename(`git remote get-url origin`.chomp, '.git').freeze\n slug_re = '([a-zA-Z]*/[a-zA-Z]*)'\n links = %r{\\[#{slug_re}?\\#([0-9]+)\\]\\(https://github.com/#{slug_re}/(issues|pull)/([0-9]+)\\)}\n links_typos = %r{https://github.com/#{slug_re}/(issue|pulls)/([0-9]+)}\n\n all_warnings = []\n inside_entry = false\n last_line_has_correct_ending = false\n\n File.readlines('CHANGELOG.md').each_with_index do |line, idx|\n line.chomp! # Remove \\n the end, it's easier for checks below\n was_inside_entry = inside_entry\n just_started_new_entry = line.start_with?('* ')\n inside_entry = true if just_started_new_entry\n inside_entry = false if /^ \\[.*\\]\\(.*\\)$/ =~ line # link-only line\n\n if was_inside_entry && !inside_entry && !last_line_has_correct_ending\n # We just ended an entry's description by starting the links, but description didn't end with '. '\n # Note: entry descriptions can be on multiple lines, hence the need to wait for the next line\n # to not be inside an entry to be able to consider the previous line as the end of entry description.\n all_warnings.concat [\n { line: idx, message: 'Line describing your entry should end with a period and 2 spaces.' }\n ]\n end\n # Store if current line has correct ending, for next iteration, so that if the next line isn't\n # part of the entry description, we can check if previous line ends description correctly.\n # Also, lines just linking to CHANGELOG to other repositories (StencilSwiftKit & Stencil mainly)\n # should be considered as not needing the '. ' ending.\n last_line_has_correct_ending = line.end_with?('. ') || line.end_with?('/CHANGELOG.md)')\n\n # Now, check that links [#nn](.../nn) have matching numbers in link title & URL\n wrong_links = line.scan(links).reject do |m|\n slug = m[0] || \"SwiftGen/#{current_repo}\"\n (slug == m[2]) && (m[1] == m[4])\n end\n all_warnings.concat Array(wrong_links.map do |m|\n link_text = \"#{m[0]}##{m[1]}\"\n link_url = \"#{m[2]}##{m[4]}\"\n { line: idx + 1, message: \"Link text is #{link_text} but links points to #{link_url}.\" }\n end)\n\n # Flag common typos in GitHub issue/PR URLs\n typo_links = line.scan(links_typos)\n all_warnings.concat Array(typo_links.map do |_|\n { line: idx + 1, message: 'This looks like a GitHub link URL with a typo. Issue links should use `/issues/123` (plural) and PR links should use `/pull/123` (singular).' }\n end)\n end\n all_warnings\nend",
"def test_parsing_require_all_fields\n value_ = ::Versionomy.parse('2.0', :semver)\n assert_equal([2, 0, 0, ''], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_raises(::Versionomy::Errors::ParseError) do\n value_ = ::Versionomy.parse('2.0b1', :semver)\n end\n end",
"def format_compile_warning(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def version_tag(text); end",
"def check(source)\n compiler = VishCompiler.new source\n begin\n compiler.parse\n compiler.transform\n compiler.analyze\n puts 'Syntax OK'\n 0\nrescue Parslet::ParseFailed => failure\n $stderr.puts \"Syntax Error: #{failure.message}\"\n $stderr.puts failure.parse_failure_cause.ascii_tree\n 1\n rescue CompileError => err\n $stderr.puts \"Compile error: #{err.message}\"\n 2\n end\nend",
"def warnings_for_spec(spec, file)\n license = spec.license\n source = spec.source\n text = file.read\n warnings = []\n warnings << \"The name of the spec should match the name of the file\" unless path_matches_name?(file, spec)\n warnings << \"Missing license[:type]\" unless license && license[:type]\n warnings << \"Github repositories should end in `.git'\" if source && source[:git] =~ /github.com/ && source[:git] !~ /.*\\.git/\n warnings << \"Github repositories should start with `https'\" if source && source[:git] =~ /github.com/ && source[:git] !~ /https:\\/\\/github.com/\n warnings << \"The description should end with a dot\" if spec.description != spec.summary && spec.description !~ /.*\\./\n warnings << \"The summary should end with a dot\" if spec.summary !~ /.*\\./\n warnings << \"Missing license[:file] or [:text]\" unless license && (license[:file] || license[:text])\n warnings << \"Comments must be deleted\" if text =~ /^\\w*#\\n\\w*#/ # allow a single line comment as it is generally used in subspecs\n warnings\n end",
"def changed_files_since_deploy\n if File.exists?(\"log/latest-REVISION-syntaxcheck\")\n revision = File.read(\"log/latest-REVISION-syntaxcheck\").chomp\n\n `git whatchanged #{revision}..HEAD`.split(\"\\n\").select{|l| l =~ /^\\:/}.collect {|l| l.split(\"\\t\")[1]}.sort.uniq\n else\n puts \"log/latest-REVISION-syntaxcheck not found. run 'cap fetch_currently_deployed_version' to get it\"\n []\n end\n end",
"def exception_on_syntax_error=(_arg0); end",
"def test_it_raise_error_if_internal_definition_is_at_wrong_position\n source = \"(define (foo x) (+ x 1) (define y 4) (* x y))\"\n assert_raises(Rubasteme::SchemeSyntaxErrorError) {\n _ = parse(source)\n }\n end",
"def test_git_log_can_have_no_changes\n assert_equal(0, extract_change_count_from_git_log(\"\"))\n end",
"def test_eye_of_newt\n err = assert_compile 'eye-of-newt.y'\n assert_warnings err, sr_conflicts: 7, rr_conflicts: 5\n assert_parser_unchanged 'eye-of-newt.y'\n end",
"def check_format(file)\n \tbegin\n content = file_content(file)\n content = content.split(\"\\n\").reject { |c| c.empty? }\n read_file(content)\n rescue\n raise_error ERROR_READING_FILE\n end\n end",
"def test_no_author_log\r\n url = \"http://svn.apache.org/repos/asf/incubator/stdcxx/trunk\"\r\n path = \"incubator/stdcxx/trunk\"\r\n parser = SubversionLogParser.new(StringIO.new(NO_AUTHOR_LOG), url, nil, nil, path)\r\n revisions = parser.parse_revisions\r\n revisions.sort!\r\n assert_equal(1, revisions.length)\r\n\r\n assert_equal(1, revisions[0].length)\r\n assert_equal(\"tests/containers/23.vector.modifiers.cpp\", revisions[0][0].path)\r\n end",
"def parse_commit_message!(message)\n match = message.match(/ \\(#(?<pr_number>[0-9]*)\\)?$/)\n {\n \"pr_number\" => match && match[:pr_number] ? match[:pr_number].to_i : nil\n }\nend",
"def syntax_error(state, event, legal_events, line)\n end",
"def test_ut_diff_result_02\n original_source_code = OriginalSourceCode.new(\n :original_file_id => 10,\n :line_number => 349898,\n :error_line => 4564,\n :line_content => \"123456\"\n )\n assert_equal(10,original_source_code.original_file_id)\n assert_equal(349898,original_source_code.line_number)\n assert_equal(4564,original_source_code.error_line)\n assert_equal(\"123456\",original_source_code.line_content)\n end",
"def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end",
"def invalid_syntax\n mutations.reject do |mutation|\n ::Parser::CurrentRuby.parse(mutation.source)\n rescue ::Parser::SyntaxError # rubocop:disable Lint/HandleExceptions\n end\n end",
"def check_file(file_result)\n begin\n ::YAML.load(File.read(file_result.path))\n rescue Psych::SyntaxError => e\n file_result.add_issue(\n line_number: e.line,\n character: e.column,\n level: :error,\n raw_message: e.problem,\n )\n end\n end",
"def invalid_package_entry(match, line)\n {\n name: match[:name],\n version: nil,\n metadata: {\n \"scm\" => match[:scm]\n },\n error: \"Could not extract data from mix.lock line: #{line}\"\n }\n end",
"def do_error_command(name, file) \n output, result = compile_file(name)\n errors = parse_output(output)\n saved = []\n ln = 1 # first line is already parsed, start loop at 2\n file.each do |line| \n ln = ln + 1\n match = line.match(/(\\/\\/+).*ERROR(.*)/)\n unless !match.nil? && match[1].length == 2 \n\t\t\tunless errors[ln].nil?\n\t\t\t\terrors[ln].each do |err|\n\t\t\t\t\tsaved << [err, \"\"]\n\t\t\t\tend\n\t\t\tend\n next\n end\n\n regex = \"#{name}:#{ln}:.+:.*#{match[2].strip}\"\n regelse = \"#{name}:#{ln}:.+:.*\"\n\n\t\tif errors[ln].nil? \n\t\t\tsaved << [\"\", regex]\n\t\t\tnext\n\t\tend\n\n errors[ln].each do |err|\n omatch = output.match(regex)\n unless omatch.nil? \n next\n\t\t\tend\n\t\t\tsaved << [err, regex]\n end\n\tend\n\n if saved.length > 0 \n puts \"----------------------------------------------------------------------\"\n puts \"BUG: %s unmatched errors \" % name\n puts \"----------------------------------------------------------------------\"\n saved.each do |error|\n puts \"#{error[0]} -- #{error[1]}\"\n end\n puts \"----------------------------------------------------------------------\"\n exit 1\n end\nend",
"def test_ut_diff_source_code_02\n assert_equal(1,@diff_source_code_1.diff_result_id)\n assert_equal(1,@diff_source_code_1.original_file_id)\n assert_equal(1,@diff_source_code_1.diff_file_id)\n assert_equal(nil,@diff_source_code_1.added_lines)\n assert_equal(\"7;8;9;25;390;396;397;400;404\",@diff_source_code_1.deleted_lines)\n assert_equal(\"1,1;2,2;3,3;4,4;6,6;10,10;11,11;12,12;13,13;14,14;15,15;\",@diff_source_code_1.common_lines)\n end",
"def test_parse03b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--t-opt' ] )\n }\n end",
"def strip_diff_syntax(line)\n line[2..-1]\n end",
"def print_file_diffs(file_safety, repo, fname, user_name)\n entry = file_safety[fname]\n if entry.nil?\n # File not in audit list\n elsif entry[\"safe_revision\"].nil?\n puts \"No safe revision for #{fname}\"\n rev = %x[svn info -r head \"#{repo}/#{fname}\"].match('Last Changed Rev: ([0-9]*)').to_a[1]\n if rev\n mime_type = %x[svn propget svn:mime-type \"#{repo}/#{fname}\"].chomp\n if ['application/octet-stream'].include?(mime_type)\n puts \"Cannot display: file marked as a binary type.\"\n puts \"svn:mime-type = #{mime_type}\"\n else\n fdata = %x[svn cat -r \"#{rev}\" \"#{repo}/#{fname}\"]\n # TODO: Add header information like svn\n begin\n puts fdata.split(\"\\n\").collect{|line| \"+ #{line}\"}\n rescue ArgumentError # invalid byte sequence in UTF-8\n puts \"+ \" + fdata\n end\n end\n puts \"To flag the changes to this file as safe, run:\"\n else\n puts \"Please code review a recent working copy, note the revision number, and run:\"\n rev = '[revision]'\n end\n puts %( rake audit:safe release=#{rev} file=#{fname} reviewed_by=#{user_name} comments=\"\")\n puts\n else\n if entry[\"last_changed_rev\"].nil?\n update_changed_rev(file_safety, [fname])\n end\n svnlatest = entry[\"last_changed_rev\"] # May have been prepopulated en mass\n if entry[\"last_changed_rev\"] == -1\n # Not in svn repository\n elsif svnlatest > entry['safe_revision']\n cmd = \"svn diff -r #{entry['safe_revision']}:#{svnlatest} -x-b #{repo}/#{fname}\"\n puts cmd\n system(cmd)\n puts %(To flag the changes to this file as safe, run:)\n puts %( rake audit:safe release=#{svnlatest} file=#{fname} reviewed_by=#{user_name} comments=\"\")\n puts\n else\n # Safe\n end\n end\nend",
"def change_checker\n `svnlook changed #{@repo} -r #{@revision}`.split(\"\\n\")\n end",
"def test_version_message\n Repository.create()\n FileUtils.touch('.test_file1')\n a = ['.test_file1']\n Repository.add(a) \n Repository.commit()\n #Repository.version()\n end",
"def test_check_bad_prev_hash\n assert_raises SystemExit do\n assert_output 'Line 1: Previous hash was 1, should be 0\\nBLOCKCHAIN INVALID' do\n p_hash = '0'\n line_num = '1'\n block_p_hash = ['1']\n hash = '1'\n @verify.check_prev_hash(p_hash, block_p_hash, hash, line_num)\n end\n end\n end",
"def process\n filename = \"index.markdown\"\n markdowns = {filename => []} \n state = :message\n message = [\"\\n\"]\n patch = []\n commit = nil\n (@gitlogp.split(\"\\n\")+[\"DONE\"]).each { |line|\n words=line.split\n if line.slice(0,1)==\" \" || words.length==0\n # commit messages start with 4 spaces, diff contents with 1 space\n if state==:message\n if words[0]==\"OUTPUT_FILE:\"\n filename = words[1]\n markdowns[filename] ||= []\n else\n message << \"#{line.slice(4..-1)}\"\n end\n else\n patch << \" #{line}\" if state==:patch\n end\n elsif words[0]==\"commit\" or words[0]==\"DONE\"\n if !commit.nil?\n # replace the short description line with a named link\n shortlog = message[2]\n message[2] = \"<a name='#{shortlog}'> </a>\"\n markdowns[filename] += message.map {|l|\n if l==\"SHOW_PATCH\"\n (patch+[\"{: .diff}\\n\"]).join(\"\\n\")\n else\n l\n end\n }\n series = tags[commit].slice(-2..-1)\n markdowns[filename] << \"\\n#{tags[commit]}: [view on github](#{@commit_link_base}#{commit}), [download #{series}-#{shortlog}.patch](#{@patch_link_base}/#{series}-#{shortlog}.patch)\\n{: .commit}\\n\"\n end\n \n message=[\"\\n\"]\n patch=[]\n\n commit = words[1]\n state = :message\n elsif [\"Author:\", \"Date:\", \"new\", \"index\", \"---\", \"+++\", '\\\\'].include?(words[0])\n # chomp\n elsif words[0]==\"diff\"\n state = :patch\n left = words[2].slice(2..-1)\n right = words[3].slice(2..-1)\n if left==right\n patch << \" ::: #{right}\"\n else\n patch << \" ::: #{left} -> #{right}\"\n end\n elsif words[0]==\"@@\"\n # git tries to put the function or class name after @@. This\n # works great for C diffs, but it only finds the class name in\n # Ruby, which is usually similar to the file name, Therefore\n # it's distracting cruft. Toss it.\n patch << \" #{words.slice(0,4).join(\" \")}\"\n else\n message << \"#{line.slice(4..-1)}\" if state==:message\n patch << \" #{line}\" if state==:patch \n end\n }\n output = {}\n markdowns.each do |fn, markdown|\n output[fn] = markdown.join(\"\\n\")\n Rails.logger.info(output[fn]) if respond_to? :Rails\n end\n return output\n end",
"def syntax_error!(message, args = {})\n args[:orig_line] ||= @orig_line\n args[:line] ||= @line\n args[:lineno] ||= @lineno\n args[:column] ||= args[:orig_line] && args[:line] ? args[:orig_line].size - args[:line].size : 0\n raise SyntaxError.new(message, options[:file], args[:orig_line], args[:lineno], args[:column])\n end",
"def test_block_zero_valid\n text = []\n File.open(\"sample.txt\", \"r\") do |f|\n f.each_line do |line|\n text << line\n end\n end\n assert_equal true , @ver.incrementCorrectly(text)\n\n end",
"def local_git_commit\n ErrorEmittingExecutor.execute(\"git commit -m '#{COMMIT_DESCRIPTION}' Gemfile.lock\")\nend",
"def test_get_diff_lcs_format_04\n file_input_1 = OriginalFile.get_diff_lcs_format(1)\n test_get_array_diff_lcs_format_1 = [\"\\t File:\\r\", \"\\t analyzeme.c\\r\", \"\\t Copyright:\\r\", \"\\t Product:\\r\", \"\\t AnsdfgsdfgeMe\\r\", \"\\t Abstract:\\r\", \"\\t Analyzsdfgsdfgsdfgイン関数を定義する\\r\", \"\\t Author:\\r\", \"\\t zhang-gh\\r\", \"\\t Date:\\r\", \"\\t 2004/08/20\\r\", \"\\t REVISION HISTORY:\\r\", \"\\t\\r\", \"\\t*/\\r\", \"\\t\\r\", \"\\t/*\\r\", \"\\t $AnalyzeMe 1.0.0.1$\\r\\n\", \"\\t*/\\r\", \"\\t#include \\\"analyzeme.h\\\"\\r\", \"\\t#include \\\"common.h\\\"\\r\", \"\\t#include \\\"memory_manage.h\\\"\\r\", \"\\t#include \\\"parse_cmdline.h\\\"\\r\", \"\\t#include \\\"comsdfgsdfgsdfgmon_measure.h\\\"\\r\", \"\\t#include \\\"trend_measure.h\\\"\\r\", \"\\t#include \\\"make_file_list.h\\\"\\r\", \"\\t#include \\\"output.h\\\"\\r\\n\", \"\\t#include \\\"get_process_macro.h\\\"\\r\", \"\\t#include <signal.h>\\r\", \"\\t\\r\", \"\\t/****************************************************/\\r\", \"\\t/* 定数宣言 */\\r\", \"\\t/****************************************************/\\r\", \"\\tconst char* TRACEFILE = \\\"analyzeme_trace.txt\\\";\\r\", \"\\tconst char* APPLOGFILE = \\\"analyzeme_log.txt\\\";\\r\", \"\\t\\r\", \"\\t/****************************************************/\\r\", \"\\t/* グローバル変数宣言 */\\r\", \"\\t/****************************************************/\\r\", \"\\t/* いろいろのFileのハンドルを保存するグローバル変数の宣言 */\\r\", \"\\t\\r\", \"\\t/* Log File */\\r\\n\", \"\\tFILE *g_fpLogFile = NULL; /* Log File pointer */\\r\", \"\\t/* Trace File */\\r\\n\", \"\\tFILE *g_fpTraceFile = NULL; /* Trace File pointer */\\r\", \"\\t/* エラーFile */\\r\\n\", \"\\tFILE *g_fpErrorFile = NULL;\\r\", \"\\t\\r\\n\", \"\\tbool g_bTrace = false; /* Trace flag */\\r\", \"\\tchar g_szNVPath[MAX_PATH] = {0};\\r\", \"\\tchar g_szOVPath[MAX_PATH] = {0};\\r\"]\n assert_equal test_get_array_diff_lcs_format_1,file_input_1.values_at(1..50)\n assert_equal 660,file_input_1.size\n\n file_input_2 = OriginalFile.get_diff_lcs_format(2)\n test_get_array_diff_lcs_format_2 = [\"\\t File:\\r\", \"\\t analyzeme.c\\r\", \"\\t Copyright:\\r\", \"\\t Copyright (C) 2004 TOSHIBA CORPORATION. All Rights Reserved.\\r\", \"\\t Product:\\r\", \"\\t AnalyzeMe\\r\", \"\\t Abstract:\\r\\n\", \"\\t AnalyzeMeのメイン関数を定義する\\r\", \"\\t Author:\\r\", \"\\t zhang-gh\\r\", \"\\t Date:\\r\", \"\\t 2004/08/20\\r\", \"\\t REVISION HISTORY:\\r\", \"\\t\\r\", \"\\t*/\\r\", \"\\t\\r\", \"\\t/*\\r\", \"\\t $AnalyzeMe 1.0.0.1$\\r\\n\", \"\\t*/\\r\", \"\\t#include \\\"analyzeme.h\\\"\\r\", \"\\t#include \\\"common.h\\\"\\r\", \"\\t#include \\\"memory_manage.h\\\"\\r\", \"\\t#include \\\"parse_cmdline.h\\\"\\r\", \"\\t#include \\\"common_measure.h\\\"\\r\", \"\\t#include \\\"trend_measure.h\\\"\\r\", \"\\t#include \\\"make_file_list.h\\\"\\r\", \"\\t#include \\\"output.h\\\"\\r\\n\", \"\\t#include \\\"get_process_macro.h\\\"\\r\", \"\\t#include <signal.h>\\r\", \"\\t\\r\", \"\\t/****************************************************/\\r\", \"\\t/* 定数宣言 */\\r\", \"\\t/****************************************************/\\r\", \"\\tconst char* TRACEFILE = \\\"analyzeme_trace.txt\\\";\\r\", \"\\tconst char* APPLOGFILE = \\\"analyzeme_log.txt\\\";\\r\", \"\\t\\r\", \"\\t/****************************************************/\\r\", \"\\t/* グローバル変数宣言 */\\r\", \"\\t/****************************************************/\\r\", \"\\t/* いろいろのFileのハンドルを保存するグローバル変数の宣言 */\\r\", \"\\t\\r\", \"\\t/* Log File */\\r\\n\", \"\\tFILE *g_fpLogFile = NULL; /* Log File pointer */\\r\", \"\\t/* Trace File */\\r\\n\", \"\\tFILE *g_fpTraceFile = NULL; /* Trace File pointer */\\r\", \"\\t/* エラーFile */\\r\\n\", \"\\tFILE *g_fpErrorFile = NULL;\\r\", \"\\t\\r\\n\", \"\\tbool g_bTrace = false; /* Trace flag */\\r\", \"\\tchar g_szNVPath[MAX_PATH] = {0};\\r\"]\n assert_equal test_get_array_diff_lcs_format_2,file_input_2.values_at(1..50)\n assert_equal 661,file_input_2.size\n end",
"def print_invalid_bump_info(bump_info)\n log_red 'Some patterns are invalid!'\n log_red 'Stops updating version numbers.'\n log\n\n print_version_patterns bump_info\n end",
"def test_liquor\n err = assert_compile 'liquor.y'\n # liquor has S/R conflicts, but they are expected\n assert_warnings err, useless_terms: 1\n assert_parser_unchanged 'liquor.y'\n end",
"def formatted_source_file(source_file); end",
"def test_parse01b\n assert_raise( RuntimeError ) {\n ArgumentManager.parse( [ '--s-opt=baz' ] )\n }\n end",
"def test_timestamp_invalid_types\n parser = Parser::new\n timestamp = \"1518893687.twenty\"\n assert_raises SystemExit do\n parser.parse_timestamp timestamp\n end\n end",
"def release_notes\r\n changelog = File.read(CHANGELOG_FILE)\r\n match = /#\\s+(#{Regexp.quote(current_build_number)})[^\\r\\n]+[\\r\\n]+(?<text>[^#\\z]+)/.match(changelog)\r\n return \"\" if match.nil?\r\n match[:text].strip\r\nend",
"def test_error_normal\n stack = TokenStack.new\n expected = 'Line 0: Testing'\n terp = Interpreter.new(false, true)\n error = terp.error(0, stack, 0, 'Testing')\n\n assert_equal expected, error\n end",
"def source_change(change, filename)\n end",
"def git_ver\n '(git commit:' + _git('reflog').split(' ').first + ')'\n end",
"def check_ruby\n\tcommand = \"rubocop -c rubocop.yml . -D -o pre-commit-rubocop.txt\"\n\tsystem(command)\n\tfile = \"pre-commit-rubocop.txt\"\n\tlines = File.open(file).to_a\n\tresult = lines.last\n\t/, (?<nb_error>[^ ]*) offense/ =~ result\n\tif nb_error.to_i > 0\n\t\tputs \"Error ruby convention\"\n\t\tputs lines\n\t\t$errors = true\n\tend\n\tFile.delete(file)\nend",
"def breaking_change?(commit)\n !commit.fetch(\"message\").match(/^[a-z]*!/).nil?\nend",
"def lex_error; end",
"def lex_error; end",
"def lex_error; end",
"def lex_error; end",
"def test_edtf\n err = assert_compile 'edtf.y', '-v'\n assert_warnings err, useless_terms: 2\n assert_parser_unchanged 'edtf.y'\n assert_output_unchanged 'edtf.out', '-v', err\n end",
"def test_incorrect_current_hash\n hash_string = '10|cb0f|281974>443914(6):SYSTEM>572872(100)|1553188611.607041000'\n assert_raises BlockFormatError do\n verify_current_hash(hash_string, 'd5e', 10, PreHash.new)\n end\n end",
"def test_text_invariant(t)\n\tt1 = t.text.gsub(\"\\n\", \"\\\\n\")\n\trep = \"line indices: [#{t.line_indices.join(', ')}], text = #{t1}\"\n\n\tassert(t.text.gsub(/[^\\n]/, '').length == t.line_indices.length, \"Incorrect number of newlines: #{rep}\")\n\tassert(t.line_indices == t.line_indices.sort)\n\tt.line_indices.each do |i| \n\t\tassert(t.text[i,1] == \"\\n\", \"line_indices false positive: #{rep}\")\n\tend\nend",
"def format\n if compile_error?\n \"FAILED: Test did not run because of compilation error\"\n else\n lines.reduce([]) do |formatted, l|\n if l.match(/(FAILED: .*) expected to (.*), but (.*)/)\n formatted << $1\n formatted << \" expected: \" + $2\n formatted << \" actual: \" + replace_binary($3)\n end\n formatted\n end.join(\"\\n\")\n end\n end",
"def test_format_without_path\n formatted = DiffLog.format(\"/projects/xiki/trunk/\", \"diff_log.rb\",\n \"|--- /projects/xiki/trunk/diff_log.rb\t2008-03-03 20:35:30.000000000 -0500\n |+++ /tmp/latest-diff.txt\t2008-03-03 20:35:44.000000000 -0500\n |@@ -56,0 +57 @@\n |+#new\n |\".gsub(/^ *\\|/, '')\n )\n\n result =\n \"|/projects/xiki/trunk/\n | diff_log.rb\n | :57\n | +|#new\n |\".gsub(/^ *\\|/, '')\n assert_equal(result, formatted)\n end",
"def construct_blame(file = '', opts = {})\n @lines = {}\n\n opts[:file] = file\n\n lines = @base.lib.blame(opts)\n\n parsed_lines = {}\n commits = {}\n\n commit = nil\n\n lines.each do |line|\n new_commit = line.match(/^[a-fA-F0-9]{40}/)\n\n if ! new_commit.nil?\n commit = new_commit[0]\n\n line_num = line.sub(/^[a-f0-9]{40} [0-9]+ /, '')\n\n if line_num.match(/\\s[0-9]+/)\n block_length = line_num.sub(/^[0-9]+\\s/, '').sub(/\\s.*$/, '')\n\n line_num = line_num.sub(/\\s[0-9]+.*$/, '')\n else\n block_length = 1\n end\n\n # this looks odd, but it's correct... we're initializing this commit's hash, which\n # should contain a :hash -> <sha hash> element, among other things, and the hash\n # OF commit hashes is indexed on the sha hash, so... yeah :)\n #\n commits[commit] = {:commit => commit} if ! commits[commit]\n\n for i in line_num.to_i..(line_num.to_i + block_length.to_i - 1)\n parsed_lines[i] = commit\n end\n end\n\n if /^author\\s/.match(line)\n commits[commit][:author] = line.sub(/^author\\s/, '')\n elsif /^author-mail\\s/.match(line)\n commits[commit][:author_email] = line.sub(/^author-mail\\s/, '')\n elsif /^author-time\\s/.match(line)\n commits[commit][:author_timestamp] = line.sub(/^author-time\\s/, '')\n elsif /^author-tz\\s/.match(line)\n commits[commit][:author_timezone] = line.sub(/^author-tz\\s/, '')\n elsif /^committer\\s/.match(line)\n commits[commit][:committer] = line.sub(/^committer\\s/, '')\n elsif /^committer-mail\\s/.match(line)\n commits[commit][:committer_email] = line.sub(/^committer-mail\\s/, '')\n elsif /^committer-time\\s/.match(line)\n commits[commit][:committer_timestamp] = line.sub(/^committer-time\\s/, '')\n elsif /^committer-tz\\s/.match(line)\n commits[commit][:committer_timezone] = line.sub(/^committer-tz\\s/, '')\n elsif /^summary\\s/.match(line)\n commits[commit][:summary] = line.sub(/^summary\\s/, '')\n end\n end\n\n parsed_lines.each do |line, commit|\n commits[commit][:line] = line\n\n @lines[line] = BlameLine.new(line, commits[commit])\n end\n end",
"def check(config = {})\n defaults = {validator: 'clang-format', file_extensions: ['.h', '.m', '.mm'], ignore_file_patterns: []}\n config = defaults.merge(config)\n validator = *config[:validator]\n file_extensions = [*config[:file_extensions]]\n ignore_file_patterns = [*config[:ignore_file_patterns]]\n\n diff = git.added_files.concat git.modified_files\n offending_files, patches = resolve_changes(validator, diff)\n\n message = ''\n unless offending_files.empty?\n message = 'Code style violations detected in the following files:' + \"\\n\"\n offending_files.each do |file_name|\n message += '* `' + file_name + \"`\\n\\n\"\n end\n message += 'Execute one of the following actions and commit again:' + \"\\n\"\n message += '1. Run `%s` on the offending files' % validator + \"\\n\"\n message += '2. Apply the suggested patches with `git apply patch`.' + \"\\n\\n\"\n message += patches.join(\"\\n\")\n end\n\n return if message.empty?\n fail VIOLATION_ERROR_MESSAGE\n markdown '### Code Style Check'\n markdown '---'\n markdown message\n end",
"def invalid_ruby_file(ruby_file, error_message)\n file_relative_path = ruby_file[ruby_file.index(cookbook_path.split(\"/\").last), ruby_file.length]\n Chef::Log.fatal(\"Cookbook file #{file_relative_path} has a ruby syntax error.\")\n error_message.each_line { |l| Chef::Log.fatal(l.chomp) }\n false\n end",
"def test_cadenza\n err = assert_compile 'cadenza.y'\n # cadenza has 37 S/R conflicts, but they are expected\n assert_no_warnings err\n assert_parser_unchanged 'cadenza.y'\n end",
"def test_timestamp_invalid_format\n parser = Parser::new\n timestamp = \"15188.93687-562508000\"\n assert_raises SystemExit do\n parser.parse_timestamp timestamp\n end\n end",
"def extract_changes(str)\n str.lines.map do |line|\n new_git_change(*Regexp.last_match.captures) if line.match(/\\t(.*:)?(.*)/)\n end.compact # in case there were any non matching lines left\n end",
"def last_magic_comment(source); end",
"def test_check_bad_time\n assert_raises SystemExit do\n assert_output 'Line 0: Previous timestamp 1553188611.560418000 >= new\n timestamp 1553188611.100418000\\nBLOCKCHAIN INVALID' do\n time = '1553188611.100418000'\n prev_time = '1553188611.560418000'\n line_num = 0\n @verify.check_time(time, prev_time, line_num)\n end\n end\n end",
"def check_gh_link(file)\n\n File.foreach(file).with_index do |line, line_num|\n\n # If the link is present, return nil so the next file can be parsed.\n return nil if line.match(GHLINKREGEX)\n\n # Return an error message if the 'edit on GitHub' link is not present by line number 7.\n if line_num == 7\n @errors << \"No edit link found in #{file}\"\n break\n end\n end\nend",
"def test_huia\n err = assert_compile 'huia.y'\n assert_warnings err, sr_conflicts: 285\n assert_parser_unchanged 'huia.y'\n end",
"def test_semver_to_standard_fail\n value_ = ::Versionomy.parse('1.2.3c4', :semver)\n assert_raises(::Versionomy::Errors::ConversionError) do\n value_.convert(:standard)\n end\n end",
"def bad_changeset\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>[email protected]</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>[email protected]</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>Implement awesome feature but forgot to mention Story ID</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def check_line(filename, line_number, line_content)\n\t\tend",
"def _expected_error_or_warning(path)\n text = File.read(path, :binmode => true, :encoding => \"ASCII-8BIT\")\n SassSpec::Util.normalize_error(text)\n end",
"def parse(text)\n # match = text.scan(/^(\\/[^:]+):\\s([^:]+):\\s(.+)$/)[0]\n rows = text.split(/\\n/)\n \n rows.shift(rows.length-3) if rows.length > 3\n \n match = rows[0].scan(/^(\\d+)\\t([^\\t]+)\\t([^\\t]+)\\t(.+)$/)[0]\n \n result = {\n :linenumber => match[0],\n :file => match[1],\n :filename => match[2],\n :type => match[3] =~ /warning/i ? \"warning\" : \"error\",\n :description => match[3],\n :code => rows[1],\n :position => rows[2].scan(/^(.*)\\^$/)[0][0].length\n }\n return result\nend",
"def check(config = {})\n defaults = {validator: 'clang-format', file_extensions: ['.h', '.m', '.mm'], ignore_file_patterns: []}\n config = defaults.merge(config)\n validator = *config[:validator]\n file_extensions = [*config[:file_extensions]]\n ignore_file_patterns = [*config[:ignore_file_patterns]]\n\n diff = ''\n case danger.scm_provider\n when :github\n diff = github.pr_diff\n when :gitlab\n diff = gitlab.mr_diff\n when :bitbucket_server\n diff = bitbucket_server.pr_diff\n else\n raise 'Unknown SCM Provider'\n end\n\n changes = get_changes(diff, file_extensions, ignore_file_patterns)\n offending_files, patches = resolve_changes(validator, changes)\n\n message = ''\n unless offending_files.empty?\n message = 'Code style violations detected in the following files:' + \"\\n\"\n offending_files.each do |file_name|\n message += '* `' + file_name + \"`\\n\\n\"\n end\n message += 'Execute one of the following actions and commit again:' + \"\\n\"\n message += '1. Run `%s` on the offending files' % validator + \"\\n\"\n message += '2. Apply the suggested patches with `git apply patch`.' + \"\\n\\n\"\n message += patches.join(\"\\n\")\n end\n\n return if message.empty?\n fail VIOLATION_ERROR_MESSAGE\n markdown '### Code Style Check'\n markdown '---'\n markdown message\n end",
"def extract_version\n buildfile = File.read(Rake.application.rakefile).force_encoding(\"ISO-8859-1\").encode(\"utf-8\", replace: nil)\n buildfile.scan(THIS_VERSION_PATTERN)[0][2]\n rescue\n fail 'Looking for THIS_VERSION = \"1.0.0-rc1\" in your Buildfile, none found'\n end",
"def blame(file, line)\n #commit, author, line_no,\n output = `git blame --date=short -w -L #{line} #{file}`\n match = BLAME_REGEXP.match(output)\n if $?.success? && match && (match[3].to_i == line)\n return [ match[1].strip, match[2].strip ]\n else\n raise ProviderError, output\n end\n end",
"def is_changelog_format_correct?\n parser = Danger::Changelog::Config.parser\n changelog_file = Danger::Changelog::ChangelogFile.new(filename, parser: parser)\n\n if changelog_file.exists?\n changelog_file.parse\n changelog_file.bad_lines.each do |line|\n markdown <<~MARKDOWN\n ```markdown\n #{line.map(&:strip).join(\"\\n\")}\n ```\n MARKDOWN\n end\n messaging.fail(parser.bad_line_message(filename), sticky: false) if changelog_file.bad_lines?\n\n changelog_file.global_failures.each do |failure|\n messaging.fail(failure, sticky: false)\n end\n\n changelog_file.good?\n else\n messaging.fail(\"The #{filename} file does not exist.\", sticky: false)\n false\n end\n end",
"def test_wrong_fixture_format_string\n tmp_yaml [\"empty\", \"yml\"], \"qwerty\" do |t|\n assert_raises(ActiveRecord::Fixture::FormatError) do\n File.open(t.path) { |fh| fh.to_a }\n end\n end\n end",
"def complete\n # 'Completed' is a bad commit message\n end\n\n def tests\n # 'Tests' is also a bad message\n end\n\n def rename_variable\n # 'Rename variable' is also a bad message\n end\n\n def style_cops\n # you get the idea\n end\nend",
"def test_commit_again\n\tex = [\"Author: Meghan Johnson <[email protected]>\"]\n\tassert_equal 0, num_commits(ex), \"Should have counted zero commits\"\n end",
"def file_patterns_errors_for_spec(spec, file, platform_name)\n Dir.chdir(config.project_pods_root + spec.name ) do\n messages = []\n messages += check_spec_files_exists(spec, :source_files, platform_name, '*.{h,m,mm,c,cpp}')\n messages += check_spec_files_exists(spec, :resources, platform_name)\n messages << \"license[:file] = '#{spec.license[:file]}' -> did not match any file\" if spec.license[:file] && Pathname.pwd.glob(spec.license[:file]).empty?\n messages.compact\n end\n end",
"def test_scm_st_036\n printf \"\\n Test 036\"\n end",
"def testNormalWithKnownContent\n initTestCase do\n $Context[:WikiContent] = \"UnknownContent - Line 1\\n=== Current ===\\n\\nUnknownContent - Line 3\"\n $Context[:NewWikiContentRegExp] =\n Regexp.escape(\"UnknownContent - Line 1\\n=== Current ===\\n\\n* <code><small>[\") +\n '....-..-.. ..:..:..' +\n Regexp.escape(\"]</small></code> - Commit DummyCommitID by DummyCommitUser: DummyCommitComment\\nUnknownContent - Line 3\")\n execTest(\n 'DummyUserID',\n [\n 'BranchName',\n 'DummyCommitID',\n 'DummyCommitUser',\n 'DummyCommitComment'\n ]\n )\n end\n end",
"def parse_commit_line!(commit_line)\n # Parse the full commit line\n line_parts = commit_line.split(\"\\t\")\n sha = line_parts.fetch(0)\n message = line_parts.fetch(1)\n author = line_parts.fetch(2)\n date = Time.parse(line_parts.fetch(3))\n message_data = parse_commit_message!(message)\n pr_number = message_data.fetch(\"pr_number\")\n\n attributes =\n {\n \"sha\" => sha,\n \"message\" => message,\n \"author\" => author,\n \"date\" => date,\n \"pr_number\" => pr_number\n }\n\n # Parse the stats\n stats = get_commit_stats(attributes.fetch(\"sha\"))\n if /^\\W*\\p{Digit}+ files? changed,/.match(stats)\n stats_attributes = parse_commit_stats!(stats)\n attributes.merge!(stats_attributes)\n end\n\n attributes\nend",
"def infer_version_from_version_file\n vfile = root.glob('VERSION{,.txt,.yml,.yaml}', File::FNM_CASEFOLD).first\n if vfile && vfile.exist?\n text = vfile.read.strip\n case text\n when /\\A---/\n type = :yaml\n when /\\A\\d+[.]/\n type = :text\n when /[:]/\n type = :yaml\n else\n type = nil\n end\n\n case type\n when :yaml\n data = YAML.load(text)\n data = data.inject({}){|h,(k,v)| h[k.to_sym]=v; h}\n text = data.values_at(:major,:minor,:patch,:build).compact.join('.')\n set :version, text\n when :text\n set :version, text\n end\n end\n end",
"def blame(ex)\n file, line = ex.file, ex.line\n raise 'File does not exist!' unless File.exists?(file)\n raise 'Line must be provided!' unless line\n \n file_directory = file[/^.+\\//]\n old_directory = Dir.pwd\n \n Dir.chdir(file_directory)\n\n if system('git rev-parse --is-inside-work-tree')\n # Get a +/- 5 sample area of the exception line for context\n start_blame = [1, line.to_i - 5].max\n end_blame = line.to_i + 5\n\n raw_blame = \n `git blame #{file} -L#{start_blame},#{end_blame}`\n .split(\"\\n\")\n .map { |s| s.sub(/^.?[0-9a-f]+ +\\((\\w+ \\w+) +.+$/) { |m| $1 } } # Get the names\n .group_by { |s| s }\n .map { |name, values|\n OpenStruct.new(\n name: name,\n chance: ((values.count.to_f / (end_blame - start_blame)) * 100).round(2)\n )\n }\n .sort_by(&:chance)\n .reverse\n .map { |person| \"#{person.name}: #{person.chance}% likilihood of involvement\" }\n .join(\"\\n\")\n else\n raise 'Not a Git Directory!'\n end\n \n Dir.chdir(old_directory)\n raw_blame\nend",
"def parse\n lines = text.lines.to_a\n\n @header = lines.shift.strip\n\n parse_release_stamp(@header)\n\n # remove blank lines from top\n lines.shift until lines.first !~ /^\\s+$/\n\n idx = find_changes(lines)\n\n if idx.nil?\n @notes = lines.join\n @changes = ''\n elsif idx > 0\n @notes = lines[0...idx].join\n @changes = lines[idx..-1].join\n else # hmmm... is this ever used?\n gap = lines.index{ |line| /^\\s*$/ =~ line }\n @changes = lines[0...gap].join\n @notes = lines[gap..-1].join\n end\n end",
"def test_twowaysql\n err = assert_compile 'twowaysql.y'\n assert_warnings err, sr_conflicts: 4\n assert_parser_unchanged 'twowaysql.y'\n assert_html_unchanged 'twowaysql.y'\n end",
"def lint(*args); end",
"def stru(msg); \"202 Only accepts file\"; end",
"def test_it_can_parse_two_lines\n skip\n chisel = Chisel.new\n text = \"# My Life in Desserts\n## Chapter 1: The Beginning\"\n assert_equal \"<h1>My Life in Desserts</h1>\n <h2>Chapter 1: The Beginning</h2>\", chisel.parse(text)\n end",
"def test_nasl\n err = assert_compile 'nasl.y'\n # nasl has 1 S/R conflict, but it is expected\n assert_no_warnings err\n assert_parser_unchanged 'nasl.y'\n end",
"def test_pre\n pd_s = <<-EOF\n<PRE>\n## PATCHDIAG TOOL CROSS-REFERENCE FILE AS OF Sep/24/08 ##\n##\n## Please note that certain patches which are listed in\n## Sun's Quick Reference Section or other patch reference\n## files are not publicly available, but instead are\n## available only to customers of Sun Microsystems who\n## have purchased an appropriate support services contract.\n## For more information about Sun support services contracts\n## visit www.sun.com/service\n100287|05|Oct/31/91| | | | |Unbundled|||PC-NFS 3.5c: Jumbo patch (updated PRT.COM to v3.5c)\n100323|05|Feb/11/92| | | | |Unbundled|||PC-NFS Advanced Telnet: bug fixes, National Character Set support\n100386|01|Sep/20/91| | | | |Unbundled|||PC-NFS Programmer's Toolkit/2.0: Runtime modules\n139099|01|Sep/05/08|R|S| | |10|sparc;|SUNWgtar:11.10.0,REV=2005.01.08.05.16;SUNWgtarS:11.10.0,REV=2005.01.08.05.16;SUNWsfman:11.10.0,REV=2005.01.08.05.16;|SunOS 5.10: gtar patch\n139100|01|Sep/05/08|R|S| | |10_x86|i386;|SUNWgtar:11.10.0,REV=2005.01.08.01.09;SUNWgtarS:11.10.0,REV=2005.01.08.01.09;SUNWsfman:11.10.0,REV=2005.01.08.01.09;|SunOS 5.10_x86: gtar patch\n800054|01|Mar/16/01| | |O| |Unbundled|||Obsoleted by: 111346-01 Hardware/PROM: Sun Fire 3800/4800/4810/680\n</PRE>\nEOF\n pd = Solaris::Patchdiag.new(StringIO.new(pd_s))\n assert_equal(2008, pd.date.year)\n assert_equal(9, pd.date.month)\n assert_equal(24, pd.date.day)\n assert_equal(pd_s, pd.to_s)\n end",
"def test_missing_qmark\n\texpect_error('<?xml version=\"1.0\">', /missing '?'/, 1)\n end"
] | [
"0.6261784",
"0.61953443",
"0.6070767",
"0.60429984",
"0.5958418",
"0.5937136",
"0.5892407",
"0.57586676",
"0.57569396",
"0.5690387",
"0.5682005",
"0.5630323",
"0.5627618",
"0.5614959",
"0.5548733",
"0.55433947",
"0.5523248",
"0.54854363",
"0.5475023",
"0.546576",
"0.5428245",
"0.5421309",
"0.5327489",
"0.5320459",
"0.53183126",
"0.53107166",
"0.5303679",
"0.5294332",
"0.5272469",
"0.5245255",
"0.52422225",
"0.52369726",
"0.5204291",
"0.51977473",
"0.51899207",
"0.51751465",
"0.51745373",
"0.5173523",
"0.5164747",
"0.5157043",
"0.5147169",
"0.5125442",
"0.512162",
"0.5117354",
"0.5110729",
"0.51040936",
"0.5102395",
"0.5079826",
"0.50655067",
"0.5058235",
"0.5043033",
"0.5032954",
"0.5028048",
"0.50278103",
"0.502716",
"0.50256556",
"0.5018979",
"0.5018979",
"0.5018979",
"0.5018979",
"0.5016355",
"0.50047123",
"0.4996023",
"0.49904987",
"0.4984163",
"0.4982764",
"0.49814132",
"0.49751154",
"0.49747163",
"0.49745122",
"0.4970101",
"0.49625802",
"0.49607563",
"0.49591127",
"0.49489465",
"0.4948835",
"0.49479312",
"0.49473605",
"0.49376357",
"0.49352577",
"0.49305075",
"0.49297217",
"0.49263978",
"0.4926118",
"0.49247438",
"0.4923527",
"0.49230132",
"0.4922533",
"0.4916806",
"0.49075612",
"0.48984435",
"0.4898265",
"0.4894696",
"0.48931828",
"0.48923928",
"0.48914915",
"0.488813",
"0.48862305",
"0.487858",
"0.48724547",
"0.48686403"
] | 0.0 | -1 |
This is a kind of irregular case, but Juli must parse as much as possible. So far, it should be 2 verbatims and one list. | def test_nested_quote3
t = build_tree_on('t022-3.txt')
assert_equal 3, t.array.size
assert_equal 1, t.array[2].array.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_list; end",
"def parse_list; end",
"def test_parsing_with_string\n value_ = ::Versionomy.parse('1.9.2pre2', :semver)\n assert_equal([1, 9, 2, 'pre2'], value_.values_array)\n assert_equal('1.9.2pre2', value_.unparse)\n end",
"def parse_definition_list; end",
"def test_method_parts\n value_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n assert_equal([1, 9, 2, 'a', 2], value_.parts)\n value_ = ::Versionomy.create([1, 9, 0], :rubygems)\n assert_equal([1, 9], value_.parts)\n end",
"def wp_parse_list(list)\n return list if list.kind_of?(Array)\n list.split(/[\\s,]+/)\n end",
"def test_parsing_require_all_fields\n value_ = ::Versionomy.parse('2.0', :semver)\n assert_equal([2, 0, 0, ''], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_raises(::Versionomy::Errors::ParseError) do\n value_ = ::Versionomy.parse('2.0b1', :semver)\n end\n end",
"def parts(pathname)\n # [\"005010\", \"X221 HP835 Health Care Claim Payment Advice\"]\n parts = pathname.each_filename.to_a\n version, name, = parts\n\n case name\n when /^(X[^ ]+) ([^ ]+)/ # (X221) (HP835) Health Care Claim Payment Advice\n a, b = $1, $2\n gs01 = b[/^.{2}/]\n gs08 = [version, a]\n st01 = b[/.{3}$/]\n\n [versions.fetch(version, version), \"Implementations\", gs01, gs08, st01]\n\n when /^([A-Z]{2})(\\d{3})/ # (HP835) Health Care Claim Payment Advice\n gs01 = $1\n gs08 = [version]\n st01 = $2\n\n [versions.fetch(version, version), \"Standards\", gs01, gs08, st01]\n else\n raise name.inspect\n end\n end",
"def parslets; end",
"def accept_list_start list\n case list.type\n when :BULLET, :LABEL, :NOTE then\n @list_index << nil\n when :LALPHA, :NUMBER, :UALPHA then\n @list_index << 1\n else\n raise RDoc::Error, \"invalid list type #{list.type}\"\n end\n\n @list_width << 4\n @list_type << list.type\n end",
"def test_parsing_with_string\n value_ = ::Versionomy.parse('1.9.2.pre.2', :rubygems)\n assert_equal([1, 9, 2, 'pre', 2, 0, 0, 0], value_.values_array)\n assert_equal('1.9.2.pre.2', value_.unparse)\n end",
"def test_standard_to_semver_with_v\n value_ = ::Versionomy.parse('v1.2.3')\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 3, ''], value2_.values_array)\n value_ = ::Versionomy.parse('V 1.2.3')\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 3, ''], value2_.values_array)\n end",
"def test_majordomoII\n validate_case\\\n [\"[email protected] (Homey ( j (\\(\\() t ) Tibbs)\",\n [ { :name => 'Homey ( j ((() t ) Tibbs',\n :display_name => nil,\n :address => '[email protected]',\n :domain => 'uh.edu',\n :local => 'tibbs',\n :comments => [ 'Homey ( j ((() t ) Tibbs' ],\n :format => '[email protected] (Homey \\( j \\(\\(\\(\\) t \\) Tibbs)' } ] ]\n\n validate_case\\\n ['\"tibbs@home\"@hpc.uh.edu (JLT )',\n [ { :name => 'JLT ',\n :address => 'tibbs@[email protected]',\n :display_name => nil,\n :domain => 'hpc.uh.edu',\n :local => 'tibbs@home',\n :comments => [ 'JLT ' ],\n :format => '\"tibbs@home\"@hpc.uh.edu (JLT )' } ] ]\n\n validate_case\\\n ['tibbs@[129.7.3.5]',\n [ { :name => nil,\n :display_name => nil,\n :domain => '[129.7.3.5]',\n :local => 'tibbs',\n :comments => nil,\n :address => 'tibbs@[129.7.3.5]',\n :format => '<tibbs@[129.7.3.5]>' } ] ]\n\n validate_case\\\n ['A_Foriegner%[email protected]',\n [ { :name => nil,\n :display_name => nil,\n :domain => 'relay1.uu.net',\n :local => 'A_Foriegner%across.the.pond',\n :comments => nil,\n :address => 'A_Foriegner%[email protected]',\n :format => 'A_Foriegner%[email protected]' } ] ]\n\n validate_case\\\n ['\"Jason @ Tibbitts\" <[email protected]>',\n [ { :name => 'Jason @ Tibbitts',\n :display_name => 'Jason @ Tibbitts',\n :domain => 'uh.edu',\n :local => 'tibbs',\n :comments => nil,\n :address => '[email protected]',\n :format => '\"Jason @ Tibbitts\" <[email protected]>' } ] ]\n\n # Majordomo II parses all of these with an error. We have deleted\n # some of the tests when they are actually legal.\n validate_case ['[email protected] Jason Tibbitts', [] ]\n validate_case ['@uh.edu', [] ] # Can't start with @\n validate_case ['J <tibbs>', [] ] # Not FQDN\n validate_case ['<tibbs Da Man', [] ] # Unbalanced\n validate_case ['Jason <tibbs>>', [] ] # Unbalanced\n validate_case ['tibbs, nobody', [] ] # Multiple addresses not allowed\n validate_case ['[email protected]', [] ] # Illegal @.\n validate_case ['<a@b>@c', [] ] # @ illegal in phrase\n validate_case ['<a@>', [] ]\t# No hostname\n validate_case ['<a@b>.abc', [] ] # >. illegal\n validate_case ['<a@b> blah <d@e>', [] ] # Two routes illegal\n validate_case ['<tibbs<tib@a>@hpc.uh.edu>', [] ] # Nested routes illegal\n validate_case ['[<[email protected]>]', [] ]\t# Enclosed in []\n validate_case ['<[email protected]> Me [blurfl] U', [] ] # Domain literals illegal in comment\n validate_case ['A B @ C <[email protected]>', [] ] # @ not legal in comment\n validate_case ['blah . tibbs@', [] ] # Unquoted . not legal in comment\n validate_case ['[email protected].', [] ] # Address ends with a dot\n validate_case ['sina.hpc.uh.edu', [] ] # No local-part@\n validate_case ['tibbs@@math.uh.edu', [] ] # Two @s next to each other\n validate_case ['tibbs@[email protected]', [] ] # Two @s, not next to each other\n end",
"def test_nested_ordered_list_incorrect\n assert_nothing_raised do\n parser = Juli::Parser.new\n parser.parse(data_path('t005.txt'), Juli::Visitor::Tree.new)\n end\n end",
"def test_standard_to_semver_without_unparse_params\n value_ = ::Versionomy.create([1,2,3], :standard)\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 3, ''], value2_.values_array)\n end",
"def saw_begin_list(list); end",
"def listify(str)\n str.split(/(~\\[\\w*\\])/).inject(List.new) do |list, s|\n if @cfg.nonterm s then\n list << s\n else\n # This also handles the s.empty? case.\n s.split('').each { |c| list << c }\n end\n list\n end\n end",
"def normalize\n parts_arr = parse_parts_from_version_string\n if parts_arr.length != 1\n parts_arr.pop while parts_arr.last && parts_arr.last.value == 0\n parts_arr = [Part.new(0)] if parts_arr.empty?\n end\n parts_arr\n end",
"def human_list(list)\n case list.length\n when 0\n \"\"\n when 1\n list[0]\n when 2\n \"#{list[0]} and #{list[1]}\"\n else\n \"#{list[0...-1].join(', ')}, and #{list[-1]}\"\n end\nend",
"def accept_list_item_start list_item\n case @list_type.last\n when :NOTE, :LABEL then\n Array(list_item.label).map do |label|\n tt_sections label\n end.flatten\n end\n end",
"def test_semver_and_rubygems\n value_ = ::Versionomy.create([1,2,3], :semver)\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 3, 0, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.create([1,2,3], :rubygems)\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 3, ''], value2_.values_array)\n end",
"def parse(list)\n list.gsub(/[^\\w\\ ,]+/, '').squeeze(\" \").downcase.split(\",\").map(&:strip).reject { |s| s.blank? }.uniq\n end",
"def variants; end",
"def test_standard_to_rubygems_with_v\n value_ = ::Versionomy.parse('v1.2b3')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 'b', 3, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.parse('V 1.2b3')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 'b', 3, 0, 0, 0, 0], value2_.values_array)\n end",
"def test_parsing_trailing_zeros\n value_ = ::Versionomy.parse('2.0.0', :rubygems)\n assert_equal([2, 0, 0, 0, 0, 0, 0, 0], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_equal('2.0.0.0.0', value_.unparse(:required_fields => [:field4]))\n assert_equal('2.0', value_.unparse(:optional_fields => [:field2]))\n end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def saw_end_list(list); end",
"def test_verse_range_and_separated_verse\n text = 'Ruth 2,1-3.11'\n t1, t2 = text.split(dot)\n assert_parsed_ast_for_text [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)], text\n end",
"def video_types\n types = []\n\n types << 'VB' if self['538a:250a'].grep(/blu-ray/i).size > 0\n types << 'VB' if self['007[0-5]'].grep(/v...s/i).size > 0\n types << 'VB' if self['852j'].grep(/\\A(?:bd-rom|video-b)/i).size > 0\n\n @record.fields('007').map{|f| f.value}.each do |f|\n if (f[0] == 'v') || self['008[33]'].include?('v')\n types << 'VD' if f[4] == 'v'\n types << 'VH' if f[4] == 'b'\n end\n end\n\n\n types << 'VD' if self['538a'].grep(/\\Advd(?!\\-rom)/i).size > 0\n\n types << 'VH' if self['538a'].grep(/\\AVHS/i).size > 0\n\n\n types << 'VL' if self['007[0]'].include?('m')\n types << 'VL' if (self.bib_format == 'VM') && self['008[33]'].include?('m')\n\n types.uniq!\n return types\n end",
"def test_verse_range_and_separated_verse\n text = 'Ruth 2,1-3.11'\n t1, t2 = text.split(dot)\n assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)]\n end",
"def block_docbook_simple_lists( text )\n orig_text = text.dup\n delimiter = \"\"\n text.gsub!( LISTS_RE ) do |match|\n lines = match.split( /\\n/ )\n last_line = -1\n depth = []\n lines.each_with_index do |line, line_id|\n if line =~ /^([_]+)(#{A}#{C}) (.*)$/m\n tl,atts,content = $~[1..4]\n if depth.last\n if depth.last.length > tl.length\n (depth.length - 1).downto(0) do |i|\n break if depth[i].length == tl.length\n lines[line_id - 1] << \"</member>\\n</simplelist>\\n\"\n depth.pop\n end\n end\n if depth.last.length == tl.length\n lines[line_id - 1] << \"</member>\"\n end\n end\n unless depth.last == tl\n depth << tl\n atts = docbook_pba( atts )\n atts = shelve( atts ) if atts\n lines[line_id] = \"<simplelist#{ atts }>\\n<member>#{ content.gsub(\"<\",\"<\").gsub(\">\",\">\") }\"\n else\n lines[line_id] = \"<member>#{ content.gsub(\"<\",\"<\").gsub(\">\",\">\") }\"\n end\n last_line = line_id\n\n else\n last_line = line_id\n end\n if line_id - last_line > 1 or line_id == lines.length - 1\n depth.delete_if do |v|\n lines[last_line] << \"</member>\\n</simplelist>\"\n end\n end\n end\n lines.join( \"\\n\" )\n end\n text != orig_text\n end",
"def _extract_versions(pb_versioneds)\r\n\t\tversions = []\r\n\t\tfor versioned in pb_versioneds\r\n\t\t\tversions << [versioned.value, versioned.version]\r\n end\r\n\t\treturn _resolve_conflicts(versions)\r\n end",
"def parse_parameters(raw)\n ret = Array.new\n i = 0\n while raw.size > 0\n case raw[0]\n when 'Z', 'B', 'C', 'S', 'F', 'I', 'D', 'J'\n ret[i] = ['P']\n i += 1\n raw = raw[1..-1]\n when 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[1..t-1]]\n i += 1\n raw = raw[t+1..-1]\n if raw.size == 0\n return ret\n end\n when '['\n if raw[1] == 'L'\n t = raw.index(';')\n ret[i] = ['L', raw[2..t-1]]\n i += 1\n raw = raw[t+1..-1]\n else\n ret[i] = ['P']\n i += 1\n raw = raw[2..-1]\n end\n end\n end\n return ret\nend",
"def test_standard_to_semver_simple\n value_ = ::Versionomy.parse('1.2')\n value2_ = value_.convert(:semver)\n assert_equal(@semver_format, value2_.format)\n assert_equal([1, 2, 0, ''], value2_.values_array)\n value_ = ::Versionomy.parse('1.2.4')\n value2_ = value_.convert(:semver)\n assert_equal(@semver_format, value2_.format)\n assert_equal([1, 2, 4, ''], value2_.values_array)\n end",
"def split; end",
"def split(parts); end",
"def get_list_version(kind)\n kind = kind.to_s\n @lists[kind]\n end",
"def validate(list)\n if super && list.all?(&:literal?) && list.length == 2\n true\n else\n log_error(NAME) {\"list is not a pair of literals: #{list.to_sxp}\"}\n false\n end\n end",
"def baseball_team_lists\n [\"A's\", \"Tigers\", \"Stars\"] #Simple ruby array\nend",
"def accept_list_start list\n case list.type\n when :BULLET then\n @list_index << nil\n @list_width << 1\n when :LABEL, :NOTE then\n @list_index << nil\n @list_width << 2\n when :LALPHA then\n @list_index << 'a'\n @list_width << list.items.length.to_s.length\n when :NUMBER then\n @list_index << 1\n @list_width << list.items.length.to_s.length\n when :UALPHA then\n @list_index << 'A'\n @list_width << list.items.length.to_s.length\n else\n raise RDoc::Error, \"invalid list type #{list.type}\"\n end\n\n @list_type << list.type\n end",
"def list?; return stype == :list; end",
"def videogame_types\n if (bib_format == 'CF') && (self['008[26]'].include? 'g')\n return ['VG']\n else\n return []\n end\n end",
"def test_standard_to_semver_beta\n value_ = ::Versionomy.parse('1.2b3')\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 0, 'b3'], value2_.values_array)\n value_ = ::Versionomy.parse('1.2 beta 3')\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 0, 'beta3'], value2_.values_array)\n end",
"def format_list(items); end",
"def verbs\n (@verb.downcase.presence || 'get').split('|')\n end",
"def process_item_list(item)\n aux_item = item.strip\n\n # remove start [\n if aux_item.start_with?('[')\n aux_item = aux_item[1..aux_item.length]\n end\n\n # remove end ]\n if aux_item.end_with?(']')\n aux_item = aux_item[0..aux_item.length-2]\n end\n\n aux_item\n end",
"def available_verbs\n\t\treturn Verbs::VERBS.values\n\tend",
"def parts; end",
"def parts; end",
"def parts; end",
"def accept_list_start list\n @list << list.type\n @res << html_list_name(list.type, true)\n @in_list_entry.push ''\n end",
"def bulletlist\n b = pbpaste\n a = b.remove(/^[\\t]*\\*/) # strip off bullet etc from beginning\n\n if a.scan(\"\\n\").size > 1 # determine whether to split on newline, space or comma\n splt = \"\\n\"\n elsif a.scan(\")\").size > a.scan(\"(\").size + 2\n splt = \")\"\n a.gsub!(/[, (]*\\d+\\)/,\")\")\n elsif a.scan(\";\").size > 1\n splt = \";\"\n elsif a.scan(\".\").size > 2\n splt = \".\"\n elsif a.scan(\"?\").size > 2\n splt = \"?\"\n elsif a.scan(\",\").size < 1\n splt = \" \"\n else\n splt = \",\"\n end\n\n splits = a.split(splt)\n\n # deal with situation where the last two items are delimited with \"and\", but not for line shift or 1) 2) kind of lists\n if splits.last.index(\" and \") && !(splt == \"\\n\" || splt == \")\")\n x,y = splits.last.split(\" and \")\n splits.pop\n splits << x\n splits << y\n end\n\n out = ''\n splits.each do |item|\n i = item.remove(\n /p\\. *\\d+$/,\n \", and\",\n /[\\.\\*]/,\n /^ *and /,\n /\\.$/,\n \"•\",\n \"\",\n \"\"\n ).strip\n out << \" * #{i}\\n\" if i.size > 0\n end\n\n puts out\nend",
"def PARAMETER_LIST()\r\n\"\r\n_VT01.txt:5du-4du+-3du+,1p,2m 8 6 12 0 64 2 24\r\n_VT02.txt:5m-2p,4d-3me,1p\r\n_VT03.txt:2me,3m,4m 8 6 12 0 64 2 24\r\n_VT04.txt:2m,7d-2me,3pw 8 6 12 0 64 2 24\r\n_VT05.txt:2me,3m-7m-6p+,4m-5m+ 8 6 12 0 64 2 24\r\n_VT06.txt:2me[2f]-6p[3]+,3m[1e]-7m[6d]-6p[3]+-2mew+,4m[3c]-5m[2b]+-2me+ 8 6 12 0 64 2 24\r\n_VT07.txt:1d-2me-3p,4m[uf]-5m[2]+,5m[6]-6me[2]+-3p[3]+-2mew+ 8 6 12 0 64 2 6\r\n_VT08.txt:9d-10d-11d-12d, 4p-5m-7m, 6m-8m | 1me, 2me, 3p\r\n\"\r\nend",
"def list(*) end",
"def test_parse_set_collating_sequence\n root = RP.parse('[a[.span-ll.]h]', :any)\n exp = root[0]\n\n assert_equal '[.span-ll.]', exp[1].to_s\n end",
"def verbs\n pos 'VERB'\n end",
"def getWordList(arg, kind, option = \"\")\n\n #TODO:implement asrlog parser\n word_list = []\n\n case kind\n #if 1st argument is \"file\"\n when \"file\"\n #check 1st argument is XML or not.\n if arg =~ /^.*?\\.xml$/\n word_list = getWordListFromXML(arg, option)\n #if 1st argument isn't XML, open the file (then variable \"doc\" becomes sentence) \n else\n # puts File::expand_path(arg)\n doc = open(File::expand_path(arg)).read\n word_list = getWordListFromSentence(doc, option)\n end\n \n when \"sentence\"\n word_list = getWordListFromSentence(arg, option)\n\n when \"asrlog\"\n log = arg[0].split(\" \")\n word_list = getWordListFromAsrLog(log, arg[1])\n\n when \"asrlog-file\"\n #check 1st argument conteins \"asrlog file path\" and \"noun_list hash\"\n if arg.length != 2\n puts \"invalid arguments!\"\n else\n log = open(arg[0]).read\n log = log.gsub(/\\n/, \" \").split(\" \")\n word_list = getWordListFromAsrLog(log, arg[1])\n end\n\n when \"asrlog-frame\"\n #check 1st argument conteins \"asrlog file path\" and \"noun_list hash\"\n if arg.length != 2\n puts \"getWordList::invalid arguments!\" + \" arg is\" \n p arg\n else\n word_list = getWordListFromAsrLog(arg[0], arg[1])\n end\n \n when \"\"\n #do nothing\n else\n puts \"getWordList::invalid kind!\" + \" kind is\"\n p kind\n end\n \n return word_list\nend",
"def list\n line = peek.line\n col = peek.column\n\n return unless match(:'[')\n\n items = []\n\n while (item = expr)\n items << item\n end\n\n expect(:']')\n\n Apparat::Byte::List.new(items, line, col)\n end",
"def validate(list)\n if super && list.all? {|le| le.is_a?(RDF::Literal)} && list.length == 2\n true\n else\n log_error(NAME) {\"list is not a pair of literals: #{list.to_sxp}\"}\n false\n end\n end",
"def parse_vn(vn_str); vn_str.split(/[\\.p]/).map(&:to_i); end",
"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",
"def test_parse_parameters_literal\n literal_params = [\n [\":gem.:free_tier\", API_INFO[:free_tier].to_s],\n [\":gem.:yard_strict\", API_INFO[:yard_strict].to_s],\n [\":gem.:generic_endpoint\", API_INFO[:generic_endpoint].to_s],\n [\":gem.:is_cloud_product\", API_INFO[:is_cloud_product].to_s],\n [\":gem.:rest_numeric_enums\", API_INFO[:rest_numeric_enums].to_s],\n [\":generate_metadata\", API_INFO[:generate_metadata].to_s],\n\n [\":gem.:name\", API_INFO[:name]],\n [\":gem.:namespace\", API_INFO[:namespace]],\n [\":gem.:title\", API_INFO[:title]],\n [\":gem.:description\", API_INFO[:description]],\n [\":gem.:summary\", API_INFO[:summary]],\n [\":gem.:homepage\", API_INFO[:homepage]],\n [\":gem.:env_prefix\", API_INFO[:env_prefix]],\n [\":gem.:version_dependencies\", API_INFO[:wrapper_of]],\n [\":gem.:migration_version\", API_INFO[:migration_version]],\n [\":gem.:product_documentation_url\", API_INFO[:product_url]],\n [\":gem.:issue_tracker_url\", API_INFO[:issues_url]],\n [\":gem.:api_id\", API_INFO[:api_id]],\n [\":gem.:api_shortname\", API_INFO[:api_shortname]],\n [\":gem.:factory_method_suffix\", API_INFO[:factory_method_suffix]],\n [\":defaults.:service.:default_host\", API_INFO[:default_host]],\n [\"grpc_service_config\", API_INFO[:grpc_service_config]],\n [\":service_yaml\", API_INFO[:service_yaml]],\n [\":overrides.:wrapper_gem_name\", API_INFO[:wrapper_gem_name_override]],\n\n # arrays of values are joined with the ';' symbol\n [\":defaults.:service.:oauth_scopes\", API_INFO[:default_oauth_scopes].join(\";\")],\n [\":transports\", API_INFO[:transports].join(\";\")]\n ]\n\n # maps of values are split into separate command-line parameters (one parameter per map key).\n literal_params += create_map_params API_INFO[:common_services], \":common_services\"\n literal_params += create_map_params API_INFO[:path_override], \":overrides.:file_path\"\n literal_params += create_map_params API_INFO[:namespace_override], \":overrides.:namespace\"\n literal_params += create_map_params API_INFO[:service_override], \":overrides.:service\"\n literal_params += create_map_params API_INFO[:extra_dependencies], \":gem.:extra_dependencies\"\n\n literal_param_str = literal_params.map { |k, v| \"#{k}=#{v}\" }.join(\",\")\n request = OpenStruct.new parameter: literal_param_str, proto_file: []\n api = Gapic::Schema::Api.new request\n\n assert_equal CONFIG_EXPECTED, api.configuration\n end",
"def split_header_list\n %w[artist copyright character general meta]\n end",
"def primitive_list(value,tabs)\n s = \"\"\n s << tabs+'<ul>' << \"\\n\"\n value.each_pair do |k,v|\n s << tabs+' '+'<li>'+kv(k,v)+'</li>' << \"\\n\" if k.class == String\n end\n s << tabs+'</ul>' << \"\\n\"\n s\n end",
"def parse_lists_from_subject(subject)\n # extract part between '[...]'\n subject.to_s.match(/\\[(.*)\\]/)\n if $1\n # and create array by valid separators: \\s , |\n subject_array = $1.split(/[\\s,|]/)\n else\n return []\n end\n lists = []\n List.all.each do |list|\n subject_array.each do |pot_list|\n if pot_list.casecmp(list.name) == 0\n lists << list\n end\n end\n end\n return lists\n end",
"def decode_list\n accumulator = []\n\n # Elements begin at one past the index of the 'l'.\n @index += 1\n while self[@index] != 'e'\n case self[@index]\n when /\\d/\n accumulator << decode_str\n when 'l'\n accumulator << decode_list\n when 'i'\n accumulator << decode_int\n when 'd'\n accumulator << decode_dict\n else\n raise ArgumentError, \"Cannot bdecode string.\"\n end\n @index += 1\n end\n accumulator\n end",
"def initialize\n @exact = []\n @list = []\n end",
"def vls(filter=/./)\n VersionLS.print_vls(filter)\n end",
"def list_item_from unparsed\n parsed = inner_parse unparsed.join\n RDoc::Markup::ListItem.new nil, *parsed\n end",
"def ver(v, typ)\n v.gsub!(/ (?:^.+ \\sAS\\s (.+$))? | \\s+() | ^v() /nix, \"\\\\1\")\n case typ\n when :deb\n v.gsub!(/[-@](dev|patch).*$/, \"~~\")\n v.gsub!(/[-@](alpha|beta|RC|stable).*$/, \"~\")\n when :rpm\n v.gsub!(/[-@](dev|patch|alpha|beta|RC|stable).*$/, \"\")\n else\n v.gsub!(/@/, \"-\")\n end\n return v\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def accept_list_start(list)\n @list << list.type\n @res << html_list_name(list.type, true)\n @in_list_entry.push false\n end",
"def parts\n @parts ||= begin\n ary = string.split(/said/i, 2)\n if ary.size == 2 && ary[0].size > 31\n [string]\n else\n ary\n end\n end\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def safelists; end",
"def remove_initial_and_format_change(info) # removes middle initial for space_names and pipe_names AND puts comma_names into nested arrays\n if !info[0].include?(\"|\") && !info[0].include?(\",\")\n info.map! {|element| element.split(\" \")}\n info.each {|element| element.slice!(-4)} \n info\n elsif info[0].include?(\"|\")\n info.map! {|element| element.split(\" | \")}\n info.each {|element| element.slice!(-4)} \n info\n else\n info.map! {|element| element.split(\", \" )} \n end\nend",
"def verbs\n playbook.verbs.map(&:to_s).reject { |v| v.start_with?('_') }\n end",
"def assemble_list_by_forms(s_list_form,s_list_element_form,\n s_or_ar_of_element_form_blank_values)\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, String, s_list_form\n kibuvits_typecheck bn, String, s_list_element_form\n kibuvits_typecheck bn, [Array,String], s_or_ar_of_element_form_blank_values\n end # if\n ar=Kibuvits_ix.normalize2array(s_or_ar_of_element_form_blank_values)\n s_list=\"\"\n s=nil\n s_element_form_blank=nil\n i_arlen=ar.length\n i_arlen.times do |i|\n s_element_form_blank=ar[i]\n s=Kibuvits_cg.fill_form(s_element_form_blank,s_list_element_form)\n s_list=s_list+s\n end # loop\n s_out=Kibuvits_cg.fill_form(s_list,s_list_form)\n return s_out\n end",
"def test_alias_field_construction\n value_ = ::Versionomy.create({:major => 1, :minor => 9, :special_suffix => 'pre2'}, :semver)\n assert_equal([1, 9, 0, 'pre2'], value_.values_array)\n end",
"def test_semver_to_standard_simple\n value_ = ::Versionomy.parse('1.2', :semver)\n value2_ = value_.convert(:standard)\n assert_equal(@standard_format, value2_.format)\n assert_equal([1, 2, 0, 0, :final, 0, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2.4', :semver)\n value2_ = value_.convert(:standard)\n assert_equal(@standard_format, value2_.format)\n assert_equal([1, 2, 4, 0, :final, 0, 0], value2_.values_array)\n end",
"def test_many_number_list_with_em_tag\n input = \"1. one\\n2. two\\n3. *three*\\n4. four\\n5. five\"\n expected = \"\\t<li>one</li>\\n\\t<li>two</li>\\n\\t<li><em>three</em></li>\\n\\t<li>four</li>\\n\\t<li>five</li>\\n\"\n output = Lists.new(input)\n assert_equal expected, output.get_other_tags\n end",
"def test_semver_to_standard_beta\n value_ = ::Versionomy.parse('1.2.0b3', :semver)\n value2_ = value_.convert(:standard)\n assert_equal([1, 2, 0, 0, :beta, 3, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2.4beta3', :semver)\n value2_ = value_.convert(:standard)\n assert_equal([1, 2, 4, 0, :beta, 3, 0], value2_.values_array)\n end",
"def array_of_version_and_date\n @array_of_version_and_date ||=\n git_tag_list.lines.map(&:chomp).map(&:split).reject(&:empty?).sort_by(&:last)\n end",
"def is_a_list?(file)\n !!(file =~ /list$/)\n end",
"def apars\n self.apar_defect_version_maps.map { |m| m.apar }\n end",
"def split_definition(raw_def)\n # TODO: your implementation here\n\n #breaks down the non-terminal and the elements for the non-terminal\n raw_def = raw_def.map {|x| x.sub(/>/, '>;')}\n raw_def = raw_def.map{|x| x.strip}\n raw_def = raw_def.map{|x| x.split(/;/).flatten.map{|y| y.strip}}\n raw_def = raw_def.map{|x| x.map{|x| x.strip}}\n\nend",
"def parse_versions(entries)\n entries.map do |rw, ami|\n str, region = rw.split('?').map { |s| s.start_with?('region') ? s.split('=').last : s }\n version_str = fix_entry(str).split('-')\n name, version, baseos = version_str\n Struct::ElasticSearch.new(name,\n Semantic::Version.new(version.tr('=', '-')),\n baseos,\n version_str.include?('ebs') ? :ebs : :'instance-store',\n version_str.include?('x64') ? :amd64 : :i386,\n region,\n ami,\n version_str.include?('hvm') ? :hvm : :pv)\n end\n end",
"def extract_argument_lists(args, splittable_args); end",
"def transform_lists( str, rs )\n\t\t\[email protected] \" Transforming lists at %p\" % (str[0,100] + '...')\n\n\t\t\tstr.gsub( ListRegexp ) {|list|\n\t\t\t\[email protected] \" Found list %p\" % list\n\t\t\t\tbullet = $1\n\t\t\t\tlist_type = (ListMarkerUl.match(bullet) ? \"ul\" : \"ol\")\n\n\t\t\t\t%{<%s>\\n%s</%s>\\n} % [\n\t\t\t\t\tlist_type,\n\t\t\t\t\ttransform_list_items( list, rs ),\n\t\t\t\t\tlist_type,\n\t\t\t\t]\n\t\t\t}\n\t\tend",
"def parse_attribute_list(str, opts); end",
"def test_decode_list_trailer()\n input = [\n 131, 108, 0, 0, 0, 3, 98, 0, 0, 4, 0, 97, 69, 97, 42, 97, 1]\n expected = [1024, 69, 42, 1]\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def test_standard_to_rubygems_beta\n value_ = ::Versionomy.parse('1.2b3')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 'b', 3, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2 beta 3.4')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 'beta', 3, 4, 0, 0, 0], value2_.values_array)\n end"
] | [
"0.6353886",
"0.6353886",
"0.57955426",
"0.573632",
"0.5625695",
"0.557097",
"0.5523348",
"0.55168813",
"0.5499414",
"0.54836035",
"0.5454044",
"0.542114",
"0.53804547",
"0.5344722",
"0.53440255",
"0.5335734",
"0.53059345",
"0.5287439",
"0.5257027",
"0.5247941",
"0.52394265",
"0.5213612",
"0.5212581",
"0.5191989",
"0.51909316",
"0.516765",
"0.516765",
"0.516765",
"0.516765",
"0.51605815",
"0.51430255",
"0.51319593",
"0.51302993",
"0.5126245",
"0.51250166",
"0.5110016",
"0.5093859",
"0.50916654",
"0.5090463",
"0.5081797",
"0.50815666",
"0.50714433",
"0.50695354",
"0.505582",
"0.50446606",
"0.5038681",
"0.5036838",
"0.50267094",
"0.5019835",
"0.50179076",
"0.50129807",
"0.50129807",
"0.50129807",
"0.50041485",
"0.50023925",
"0.5000005",
"0.4985872",
"0.49852613",
"0.49690813",
"0.49665058",
"0.49653286",
"0.49582478",
"0.495557",
"0.4950344",
"0.4938807",
"0.49353626",
"0.49322364",
"0.49312878",
"0.49268496",
"0.49266785",
"0.49163198",
"0.49139437",
"0.49039826",
"0.4902541",
"0.4902541",
"0.4902541",
"0.48895326",
"0.48858455",
"0.4877054",
"0.4877054",
"0.4877054",
"0.4877054",
"0.4877054",
"0.48745313",
"0.48726398",
"0.4872034",
"0.4871262",
"0.4862091",
"0.48548344",
"0.48478317",
"0.4847295",
"0.48457178",
"0.48445234",
"0.48420808",
"0.4839387",
"0.48393786",
"0.48368478",
"0.48331636",
"0.482301",
"0.48187128",
"0.4816401"
] | 0.0 | -1 |
return full path of test data file. | def data_path(filename)
File.join(File.dirname(__FILE__), 'repo', filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_path\n File.join(root_path, \"test\")\n end",
"def get_test_data_path_for(test_data_sub_path)\n File.expand_path(File.dirname(__FILE__) + \"/../test_data/#{ test_data_sub_path }\")\nend",
"def get_data_file_path(file_name)\n base = File.dirname __FILE__\n File.join(base, \"data\", file_name)\nend",
"def data_file_full_path\n File.join(@data_lib.dir_name,\"#{@data_set_name}\")\n end",
"def data_root\n File.expand_path(\"spec/data\", Dir.pwd)\n end",
"def filepath\n\t\t\tFile.join(TsungWrapper.config_dir, 'data', @filename)\n\t\tend",
"def data_path(path)\n return File.expand_path(File.join(@@config['dataPath'], path))\n end",
"def _spec_data_dir(file)\n datadir = Dir.new('./spec/data/')\n File.join(datadir.path, file)\nend",
"def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend",
"def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend",
"def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend",
"def fixture_file_path(filename)\n Rails.root.join('test', 'fixtures', 'files', filename).to_s\n end",
"def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end",
"def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end",
"def datafile_path(file)\n local_profile = \"~/.souschef/#{@opts[:profile]}/#{file}\"\n profile = File.expand_path(local_profile, __FILE__)\n\n if File.exist?(profile)\n profile\n else\n p = \"../../../../data/#{file}\"\n File.expand_path(p, __FILE__)\n end\n end",
"def datadir\n \"#{Rails.root}/test/data\"\n end",
"def open_test_file(name)\n File.open(Rails.root.join('test', 'data', name))\n end",
"def get_data_file(dir, file_name)\n File.join(dir, file_name)\n end",
"def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend",
"def fixture_path\n File.expand_path('fixtures', 'spec')\n end",
"def testdata\n prefix/\"test\"\n end",
"def data_path(filetype)\n \"#{@datapath}.#{filetype}.txt\"\n end",
"def basic_values_path\n File.expand_path('../fixtures/basics/data/basic_values.rb', __FILE__)\n end",
"def tests_dir\n Pathname.new(path) + \"test\"\n end",
"def f(fname)\n \"#{File.join \"..\", \"test\", \"data\", fname}\"\nend",
"def fixture_path\n File.join(__dir__, '../chef/fixtures')\n end",
"def mock_file_path\n source = __dir__\n File.join(source, \"input/input.csv\")\n end",
"def path\n data.path\n end",
"def path\n data.path\n end",
"def data_store_path\n Rails.root.join('data', self.data_dir)\n end",
"def coverage_data_file\n file_name = File.basename(config_yml_path + '-coverage.dat')\n return file(file_name, test_xml_data_path)\n end",
"def data_file!(path)\n path = Pathname.new(path)\n if relative_data_files.include?(path)\n data_dir/path\n else\n raise FileNotFoundError, \"No such file #{path} in bag\"\n end\n end",
"def resource_path(resource)\n \"#{test_dir}/#{resource}\"\n end",
"def fixture_path(filename)\n File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)\nend",
"def fixture_path\n @fixture_path ||=\n File.expand_path(File.join(__dir__, '..', '..', 'fixtures', 'files'))\nend",
"def datafile_path(env)\n env[:machine].data_dir.join(\"berkshelf\")\n end",
"def path()\n file = File.join(Eddy.config.tmp_dir, \"eddy_persistent_data.json\")\n # FileUtils.mkdir_p(File.dirname(file))\n return Pathname.new(file)\n end",
"def observation_directory\n return @observation_directory unless @observation_directory.nil?\n test_file = @current_test.metadata[:file_path]\n File.join(File.dirname(File.absolute_path(test_file)), 'test_observations')\n end",
"def data_dir\n @datadir\n end",
"def data_file(date)\n File.expand_path(File.join(@config[:data_dir], date.strftime(\"%Y-%m-%d.espi\")))\n end",
"def setup\n File.expand_path(File.dirname(__FILE__) + '/data/')\n end",
"def fixture_dir\n runtime_config.fixture_dir\n end",
"def fixture_file(filename)\n return '' if filename == ''\n File.expand_path(RAILS_ROOT + '/features/fakeweb/' + filename)\n end",
"def data_directory\n @data_directory\n end",
"def filepath\n base = storage_root_path\n if base\n File.join(base, storage_key)\n else\n raise StandardError.new(\"no filesystem path found for datafile: #{self.web_id}\")\n end\n end",
"def test_config_filename\n File.join File.dirname(__FILE__), 'config.yml'\nend",
"def path_to_data_file( path_to_ai_file )\n source_folder = File.dirname( path_to_ai_file )\n base_name = File.basename( path_to_ai_file, '.ai' )\n data_file = source_folder + '/' + base_name + '_data.jsn'\n data_file\n end",
"def pathForDataFile\n return @@appDataFile if @@appDataFile\n fileManager = NSFileManager.defaultManager\n folder = \"~/Library/Application Support/#{@@appName}/\"\n folder = folder.stringByExpandingTildeInPath()\n if !fileManager.fileExistsAtPath(folder)\n print \"(Init) Creating directory #{folder}\\n\"\n fileManager.createDirectoryAtPath_attributes_(folder, nil)\n end\n fileName = \"#{@@appName}.appdata\"\n @@appDataFile = folder.stringByAppendingPathComponent(fileName)\n end",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def test_folder\n config[:test_folder].nil? ? config[:test_base_path] : absolute_test_folder\n end",
"def dataset_path\n @dataset_path ||= filename\n end",
"def tf(file)\n File.join(@test_dir, file)\n end",
"def destination_path\n File.join(test_path, name)\n end",
"def work_dir\n AYTests.work_dir\n end",
"def fixture_path\n # @_fixture_path ||= \"#{Emerson.fixture_path || RSpec.configuration.fixture_path}/responses\"\n @_fixture_path ||= File.join(Emerson.fixture_path, 'responses')\n end",
"def get_test_file_path(host, file_rel_path)\n File.join(@host_test_tmp_dirs[host.name], file_rel_path)\nend",
"def get_test_file_path(host, file_rel_path)\n File.join(@host_test_tmp_dirs[host.name], file_rel_path)\nend",
"def path_for(config); File.expand_path(File.join('../fixtures', config), __FILE__) ;end",
"def file_path\n dir\n end",
"def test_for(file)\n base = File.basename(file)\n extension = File.extname(base)\n dir = File.dirname(file)\n dir_array = dir.split('/')\n if extension == '.rb' and dir_array.first=='test'\n return file\n end\n if extension == '.rb'\n base_without_extension = base[0, base.size - extension.size]\n test_file = base_without_extension + '_test' + extension\n else\n test_file = base + '_test.rb'\n end\n dir_array[0]='test'\n case dir_array[1]\n when 'controllers'\n dir_array[1] = 'functional'\n when 'models'\n dir_array[1] = 'unit'\n end\n test_dir = dir_array.join('/')\n return File.join(test_dir, test_file)\n end",
"def file\n TestIds.database_file(id)\n end",
"def fixture(filename)\n File.join(FIXTURES_PATH, filename)\n end",
"def fixture_path\n File.expand_path('../fixtures', __FILE__)\nend",
"def fixture_path(path)\n return File.join(File.expand_path('../../fixtures', __FILE__), path)\nend",
"def fixtures_path\n Berkshelf.root.join(\"spec/fixtures\")\n end",
"def fixture_path(name, extension=\"xml\")\n project_root_path.join(\"spec\", \"fixtures\", \"#{name}.#{extension}\")\n end",
"def integration_test_config_filename\n filename = \"#{File.dirname(__FILE__)}/../../#{RGovData::Config::BASE_NAME}\"\n STDERR.puts \"Running integration tests with config: #{filename}\"\n filename\nend",
"def appDataPath\n \"#{SIMULATORS_ROOT}/#{@guid}/#{DEVICE_APP_DATA_RELATIVE_PATH}\"\n end",
"def getOtherLocation\n return \"#{Dir.tmpdir}/RDITest\"\n end",
"def resource_dir\n @resource_dir ||= \"#{test_dir}\"\n end",
"def get_test_path\n\n if @current_test_repeat == 1\n @test_path = @test_paths_absolute.shift\n end\n\n if @current_test_repeat == @test_repeats\n @current_test_repeat = 1\n else\n @current_test_repeat += 1\n end\n\n @test_path\n end",
"def file_fixture(path)\n return File.expand_path(File.join(File.dirname(__dir__), \"test\", \"fixtures\", \"files\", path))\nend",
"def file_fixture(path)\n return File.expand_path(File.join(File.dirname(__dir__), \"test\", \"fixtures\", \"files\", path))\nend",
"def file_fixture(path)\n return File.expand_path(File.join(File.dirname(__dir__), \"test\", \"fixtures\", \"files\", path))\nend",
"def test_file_path(name)\n path = Rails.root + \"spec/files/#{name}\"\n raise \"non-existant sample file (#{name})\" unless File.exists?(path)\n path\nend",
"def datafile(backend, scope, source, extension)\n file = File.join([datadir(backend, scope), \"#{source}.#{extension}\"])\n\n unless File.exist?(file)\n Hiera.debug(\"Cannot find datafile #{file}, skipping\")\n\n return nil\n end\n\n return file\n end",
"def fixture_data( filename )\n\t\tfixture = FIXTURE_DIR + filename\n\t\treturn fixture.open( 'r', encoding: 'binary' )\n\tend",
"def path\n @file\n end",
"def fixture(path)\n File.join(FIXTURES_ROOT, path)\nend",
"def default_test_base_path\n File.join(kitchen_root, Kitchen::DEFAULT_TEST_DIR)\n end",
"def read_test_file(file)\n File.read(File.join('./test/fixtures/dstu2_files', file))\n end",
"def xtest_local_file_path\n expected = File.expand_path(file_name, File.join(Geminabox.data, 'proxy'))\n assert_equal expected, splice.splice_path\n end",
"def get_web_sample_path()\n\t\treturn backslashify(File.join(Dir.pwd, WEB_SAMPLE_DIR))\n\tend",
"def file\n File.join(root, FILENAME)\n end",
"def file_path\n File.join(dir,filename)\n end",
"def path\n @file.path\n end",
"def fixtures_path\n root_path.join('spec', 'fixtures')\nend",
"def mock_data\n\t\tputs \"Failsafe. Using mock data as no data is provided or the file path is not a complete file path or file does not exist\"\n\t\tdata = File.open(\"./conference/data/problem_data.txt\",\"r+\") do |f|\n\t\t\tf.read\n\t\tend \n\t\treturn data\n\tend",
"def repository_path(name)\n File.expand_path(\"../fixtures/#{name}\", __FILE__)\n end",
"def full_path\n File.dirname(File.expand_path(serialized_filename))\n end",
"def fixture_path\n File.join(PROJECT_ROOT, 'spec', 'fixtures', 'integration', 'git')\n end",
"def tst_folder_path\n self.class.instance_variable_get(\"@test_folder_path\")\n end",
"def data_file\n @data_file ||= FileData.new(\"data.yml\")\n end",
"def fixture_dir\n File.join File.dirname(__FILE__), 'fixture'\nend",
"def file_fixture_path(filename)\n File.expand_path(File.dirname(__FILE__) + \"/../fixtures/Upload/#{ filename }\")\nend",
"def file_path\n FileUtils.mkdir_p @path unless Dir.exist? @path\n\n @path\n end",
"def path\n tempfile.path\n end",
"def com_dataset_file_path\n \"#{@tmp_dir}/#{@province.code}-8.geojson\"\n end",
"def fixture_filename(filename)\n File.expand_path(File.join(\"fixtures\", filename), File.dirname(__FILE__))\nend",
"def roby_app_fixture_path\n File.expand_path(\n File.join(\"..\", \"..\", \"..\", \"test\", \"app\", \"fixtures\"),\n __dir__\n )\n end"
] | [
"0.77206683",
"0.7702129",
"0.7649831",
"0.761749",
"0.7542942",
"0.74282926",
"0.7408876",
"0.7305462",
"0.7297348",
"0.7297348",
"0.7297348",
"0.7230224",
"0.7226076",
"0.7226076",
"0.7205902",
"0.7181113",
"0.704472",
"0.6867056",
"0.68566096",
"0.6840618",
"0.6826795",
"0.6824091",
"0.68213207",
"0.6809855",
"0.6807943",
"0.6807052",
"0.67904353",
"0.6760986",
"0.6760986",
"0.67513555",
"0.6748872",
"0.67417496",
"0.6740151",
"0.67109054",
"0.66942286",
"0.667116",
"0.66693234",
"0.6618498",
"0.6573432",
"0.6555125",
"0.6547397",
"0.65416473",
"0.6538381",
"0.6533303",
"0.6513379",
"0.6503098",
"0.6492266",
"0.64583534",
"0.643622",
"0.64353347",
"0.6425828",
"0.6419021",
"0.64161205",
"0.6414396",
"0.64067733",
"0.640028",
"0.640028",
"0.6398968",
"0.63864875",
"0.6385266",
"0.63782054",
"0.63659793",
"0.6358721",
"0.6336458",
"0.63331425",
"0.63274133",
"0.63243175",
"0.63192105",
"0.63188934",
"0.63071996",
"0.6301456",
"0.62932193",
"0.62932193",
"0.62932193",
"0.62726134",
"0.6258393",
"0.6257168",
"0.62542826",
"0.6240896",
"0.62377214",
"0.6225156",
"0.62230635",
"0.62227345",
"0.62207294",
"0.62044865",
"0.6191683",
"0.6187766",
"0.6183647",
"0.6181498",
"0.6178978",
"0.6174829",
"0.61730134",
"0.6172939",
"0.6167281",
"0.61644804",
"0.6159469",
"0.6148736",
"0.6147368",
"0.6137824",
"0.612513"
] | 0.71165705 | 16 |
redirect STDOUT in this block | def stdout_to_dev_null
$stdout = File.open('/dev/null', 'w')
yield
$stdout = STDOUT
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect\n orig_defout = $defout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = orig_defout\n end",
"def redirect_stdout\n if Capybara::Chromefoil.mri?\n yield\n else\n begin\n prev = STDOUT.dup\n $stdout = @write_io\n STDOUT.reopen(@write_io)\n yield\n ensure\n STDOUT.reopen(prev)\n $stdout = STDOUT\n prev.close\n end\n end\n end",
"def surpress_stdout\n stdout_orig = $stdout\n $stdout = @temp_file\n begin\n yield\n ensure\n $stdout = stdout_orig\n end\n end",
"def capture_output\n dummy_stdio{ yield }\n end",
"def capture_stdout(&block)\n\traise ArgumentError, \"No block given\" if !block_given?\n\told_stdout = $stdout\n\t$stdout = sio = StringIO.new\n\tyield\n\t$stdout = old_stdout\n\tsio.rewind\n\tputs sio.read\n\tsio.rewind\n\tsio.read\nend",
"def capture_stdout(&block)\n\t\t original_stdout = $stdout\n\t\t $stdout = fake = StringIO.new\n\t\t begin\n\t\t yield\n\t\t ensure\n\t\t $stdout = original_stdout\n\t\t end\n\t\t fake.string\n\t\tend",
"def capture_stdout(&block)\n out = StringIO.new\n old_stdout = $stdout\n $stdout = out\n\n block.call\n\n $stdout = old_stdout\n out.string\n end",
"def capture_stdout(&blk)\n old = $stdout\n $stdout = fake = StringIO.new\n blk.call\n fake.string\nensure\n $stdout = old\nend",
"def capture_stdout(&blk)\n old = $stdout\n $stdout = fake = StringIO.new\n blk.call\n fake.string\nensure\n $stdout = old\nend",
"def capture_stdout(&blk)\n old = $stdout\n $stdout = fake = StringIO.new\n blk.call\n fake.string\nensure\n $stdout = old\nend",
"def redirect_output!; end",
"def capture_stdout\n old_stdout = $stdout\n $stdout = StringIO.new\n\n yield\n\n $stdout.string\nensure\n $stdout = old_stdout\nend",
"def capture_stdout\n output = StringIO.new\n $stdout = output\n yield\n $stdout = STDOUT\n output\nend",
"def stdout_hook(&block)\n @rye_stdout_hook = block if block\n @rye_stdout_hook\n end",
"def capture_stdout(&block)\n original_stdout = $stdout\n $stdout = fake = StringIO.new\n begin\n yield\n ensure\n $stdout = original_stdout\n end\n fake.string\nend",
"def capture_stdout(&block)\n original_stdout = $stdout\n $stdout = fake = StringIO.new\n begin\n yield\n ensure\n $stdout = original_stdout\n end\n fake.string\nend",
"def silent_out\n stdout = $stdout\n $stdout = StringIO.new\n begin\n yield if block_given?\n ensure\n $stdout = stdout\n end\nend",
"def on_stdout(&block)\n\t\t@stdout_handler = block\n\tend",
"def with_captured_stdout\n begin\n old_stdout = $stdout\n $stdout = StringIO.new('','w')\n yield\n $stdout.string\n ensure\n $stdout = old_stdout\n end\n end",
"def capture_output &block\n old_stdout = $stdout\n test_stdout = StringIO.new\n $stdout = test_stdout\n block.call\n test_stdout.string\nensure\n $stdout = old_stdout\nend",
"def capture_stdout(&block)\n silence_stdout true, &block\n end",
"def redirect_stdout\n raise IllegalStateException, \"Already redirected\" if @saved_stdout\n @saved_stdout = $stdout\n $stdout = StringIO.new\n end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def without_stdout_buffering\n sync, $stdout.sync = $stdout.sync, true\n yield\n ensure\n $stdout.sync = sync\n end",
"def capture_stdout\n original_stdout = $stdout # capture previous value of $stdout\n $stdout = StringIO.new # assign a string buffer to $stdout\n yield # perform the body of the user code\n $stdout.string # return the contents of the string buffer\n ensure\n $stdout = original_stdout # restore $stdout to its previous value\n end",
"def write_to_file_if_needs_block(argv)\n unless argv.empty? \n $stdout = File.open(argv[0], \"w\")\n end\n\n yield\n\n unless argv.empty? \n $stdout.flush\n $stdout.close\n $stdout = STDOUT\n end\nend",
"def with_captured_stdout\n begin\n old_stdout = $stdout\n $stdout = StringIO.new('', 'w')\n yield\n $stdout.string\n ensure\n $stdout = old_stdout\n end\n end",
"def stdout\n run unless ran?\n\n @stdout\n end",
"def hide\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\nensure\n $stdout = real_stdout\nend",
"def capture_stdout(&printing_action)\n old = $stdout\n $stdout = next_stdout = StringIO.new\n printing_action.call\n next_stdout.string\nensure\n $stdout = old\nend",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture_stdout\n old_stdout, $stdout = $stdout, StringIO.new\n begin\n yield\n $stdout.string\n ensure\n $stdout = old_stdout\n end\n end",
"def after_resolution\n output.puts\n end",
"def silenced\n $stdout = StringIO.new\n\n yield\n ensure\n $stdout = STDOUT\n end",
"def redirect\n $stdin.reopen '/dev/null'\n $stdout.reopen File.new(out, \"a\")\n $stderr.reopen File.new(err, \"a\")\n $stdout.sync = $stderr.sync = true\n end",
"def capture(&block)\n begin\n original_output = output\n @output = \"\"\n yield\n raw(output.to_s)\n ensure\n @output = original_output\n end\n end",
"def redirect # :yields: redirected_erbout\n current = @_erbout\n @_erbout = \"\"\n result = yield(@_erbout)\n @_erbout = current\n concat(result)\n end",
"def swallow_stdout\n s = StringIO.new\n oldstd = $stdout\n $stdout = s\n yield\n return s.string\n ensure\n $stdout = oldstd\n end",
"def silence_output\n orig_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout = orig_stdout\nend",
"def stdout_redirect(stdout = T.unsafe(nil), stderr = T.unsafe(nil), append = T.unsafe(nil)); end",
"def stdouts; end",
"def re_stdout\n @logdev.re_stdout\n self\n end",
"def capture &block\n real_stdout = $stdout\n $stdout = StringIO.new\n block.call\n @captured_output = $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture &block\n real_stdout = $stdout\n $stdout = StringIO.new\n block.call\n @captured_output = $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture &block\n real_stdout = $stdout\n $stdout = StringIO.new\n block.call\n @captured_output = $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def supress_stdout\n mock_io = StringIO.new\n stdout_real, $stdout = $stdout, mock_io\n if block_given?\n begin\n yield\n ensure\n $stdout = stdout_real\n end\n end\n mock_io\nend",
"def capture_and_render(&block)\n render_method.call Util.capture_stdout(&block)\n end",
"def capture_stdout\n out = StringIO.new\n $stdout = out\n yield\n return out.string\n ensure\n $stdout = STDOUT\n end",
"def capture_stdout\n out = StringIO.new\n $stdout = out\n yield\n return out.string\n ensure\n $stdout = STDOUT\n end",
"def capture_stdout\n out = StringIO.new\n $stdout = out\n yield\n return out.string\n ensure\n $stdout = STDOUT\n end",
"def streams_after(out_,err_)\n $stdout = out_\n $stderr = err_\nend",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n @captured_output = $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def reset_output\n $stdout = StringIO.new\nend",
"def log_and_stream(output)\n write_file output, @filename if @filename\n @block.call(output)\n end",
"def output=(io); end",
"def log_output_on &block\n out = ''\n orig,@should_log_output = @should_log_output,true\n if not block.nil?\n begin\n out = block.call\n ensure\n @should_log_output = orig\n end\n end\n out\n end",
"def capture\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\n @captured_output = $stdout.string\n ensure\n $stdout = real_stdout\n end",
"def capture_stdout\n # The output stream must be an IO-like object. In this case we capture it in\n # an in-memory IO object so we can return the string value. You can assign any\n # IO object here.\n previous_stdout, $stdout = $stdout, StringIO.new\n yield\n $stdout.string\nensure\n # Restore the previous value of stderr (typically equal to STDERR).\n $stdout = previous_stdout\nend",
"def capture_output(&block)\n stdout = STDOUT.clone\n\n read_io, write_io = IO.pipe\n read_io.sync = true\n\n output = \"\"\n reader = Thread.new do\n begin\n loop do\n output << read_io.readpartial(1024)\n end\n rescue EOFError\n end\n end\n\n STDOUT.reopen(write_io)\n block.call\nensure\n STDOUT.reopen(stdout)\n write_io.close\n reader.join\n\n return output\nend",
"def log_and_stream(output)\n write_file output, runlog_filename if runlog_filename\n return @block.call(output) unless @block.nil?\n \"\"\n end",
"def redirect_io\n stdout = config.options[:redirect_stdout]\n stderr = config.options[:redirect_stderr] || stdout\n append = config.options[:redirect_append]\n\n if stdout\n STDOUT.reopen stdout, (append ? \"a\" : \"w\")\n STDOUT.sync = true\n STDOUT.puts \"=== puma startup: #{Time.now} ===\"\n end\n\n if stderr\n STDERR.reopen stderr, (append ? \"a\" : \"w\")\n STDERR.sync = true\n if stdout != stderr then\n # no need to dupe\n STDERR.puts \"=== puma startup: #{Time.now} ===\"\n end\n end\n end",
"def silent\n if ENV[\"RSPECQ_DEBUG\"]\n yield\n return\n end\n\n begin\n orig = $stdout.clone\n $stdout.reopen(File::NULL, \"w\")\n yield\n ensure\n $stdout.reopen(orig)\n end\n end",
"def stdout(event) ; $stdout.puts event ; $stdout.flush ; end",
"def output\n # if file name not present, just output to stdout.\n return $stdout.write(yield) if option[:ofile].nil?\n\n # times of calling output\n @serial ||= 0\n # Write to file, we should disable colorize\n enabled = Util.colorize_enabled?\n Util.disable_color! if enabled\n File.binwrite(file_of(option[:ofile], @serial), yield)\n Util.enable_color! if enabled\n @serial += 1\n end",
"def on_output(&block)\n @on_output << block\n end",
"def initialize\n $stdout.sync = true\n super\n end",
"def hide_output\n keep_stdout = $stdout\n keep_stderr = $stderr\n $stdout = StringIO.new\n $stderr = StringIO.new\n yield\n ensure\n $stdout = keep_stdout\n $stderr = keep_stderr\n end",
"def with_redirection\n ensure_files!\n redirect_stdio!\n yield\n restore_stdio!\n rescue Exception => exception\n fatal! exception.to_s_mri\n end",
"def flush!\n $stdout.flush\n end",
"def stdout(command, data)\n # called when the process writes to STDOUT\n end",
"def capture_stds(&block)\n real_stderr, $stderr = $stderr, StringIO.new\n real_stdout, $stdout = $stdout, StringIO.new\n yield\n [ $stderr.string, $stdout.string ]\n ensure\n $stdout, $stderr = real_stdout, real_stderr\n end",
"def output_stdout!\n\t\tmsg = @connection.gets\n\t\tbasic_parse(msg)\n\tend",
"def _buf\n return $stdout\nend",
"def _buf\n return $stdout\nend",
"def suppress_stdout\n original_stderr = $stderr\n original_stdout = $stdout\n $stderr = File.open(File::NULL, 'w')\n $stdout = File.open(File::NULL, 'w')\n yield\n ensure\n $stderr = original_stderr\n $stdout = original_stdout\n end",
"def setup_stdio_redirect\n $stdin.close\n $stdout.reopen(@context.logfile, 'w+') \n $stderr.reopen(@context.logfile, 'w+') \n end",
"def enable_output\n $stdout = @original_stdout\n @original_stdout = nil\nend",
"def capture_stdout\n orig, $stdout = $stdout, StringIO.new\n\n begin\n yield\n return $stdout.string\n ensure\n $stdout = orig\n end\n end",
"def setup()\n $stdout.sync\n end",
"def flush!\n $stdout.flush\nend",
"def flush!\n $stdout.flush\nend",
"def fake_stdout\n original_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout.string\n rescue RSpec::Expectations::ExpectationNotMetError => e\n @exception = e\n raise\n ensure\n $stdout = original_stdout\n end",
"def capture_stderr\n previous_stdout, $stdout = $stdout, StringIO.new\n yield\n $stdout.string\nensure\n $stdout = previous_stdout\nend",
"def with_output_buffer\n self.output_buffer, old_buffer = \"\", self.output_buffer\n yield if block_given?\n output_buffer\n ensure\n self.output_buffer = old_buffer\n end",
"def erb_with_output_buffer(buf = '')\n @_out_buf, old_buffer = buf, @_out_buf\n yield\n @_out_buf\n ensure\n @_out_buf = old_buffer\n end",
"def suppress_output\n original_stdout = $stdout.clone\n original_stderr = $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n $stdout.reopen File.new('/dev/null', 'w')\n yield\nensure\n $stdout.reopen original_stdout\n $stderr.reopen original_stderr\nend",
"def suppress_output\n original_stdout, original_stderr = $stdout.clone, $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n $stdout.reopen File.new('/dev/null', 'w')\n yield\nensure\n $stdout.reopen original_stdout\n $stderr.reopen original_stderr\nend",
"def dev_null(&block)\n orig_stdout = $stdout.dup # does a dup2() internally\n $stdout.reopen('/dev/null', 'w')\n yield\nensure\n $stdout.reopen(orig_stdout)\nend",
"def try_redirect\n $stdin.reopen(Rack::App::Utils.devnull_path)\n $stdout.reopen(Rack::App::Worker::Environment.stdout)\n $stderr.reopen(Rack::App::Worker::Environment.stderr)\n $stdout.sync = $stderr.sync = true\n rescue Errno::ENOENT\n retry\n end",
"def write\n w = Writer.new(self)\n yield w\n w.write(stdout)\n end"
] | [
"0.79063493",
"0.76731133",
"0.7332611",
"0.72548985",
"0.7159202",
"0.71449137",
"0.6980251",
"0.6970769",
"0.6970769",
"0.6970769",
"0.6964693",
"0.6954705",
"0.69212884",
"0.68780655",
"0.68737674",
"0.68737674",
"0.6872757",
"0.686467",
"0.68562454",
"0.68499285",
"0.6847904",
"0.6816558",
"0.6804811",
"0.6804811",
"0.6804811",
"0.6804811",
"0.6804811",
"0.6804811",
"0.67619234",
"0.6738803",
"0.67379236",
"0.6735218",
"0.67066854",
"0.6702326",
"0.668821",
"0.66564626",
"0.66564626",
"0.66564626",
"0.66564626",
"0.66564626",
"0.6656318",
"0.6649094",
"0.66408867",
"0.66278297",
"0.662582",
"0.6614613",
"0.661401",
"0.656854",
"0.65569425",
"0.65213245",
"0.6507477",
"0.6503674",
"0.6503674",
"0.6503674",
"0.65023565",
"0.6481285",
"0.64793116",
"0.64793116",
"0.64793116",
"0.6454303",
"0.64234143",
"0.6422321",
"0.6405363",
"0.64021516",
"0.64003617",
"0.6387671",
"0.6386476",
"0.6338446",
"0.630976",
"0.62906665",
"0.6290181",
"0.6286861",
"0.62712246",
"0.62674624",
"0.6253315",
"0.6233035",
"0.6228456",
"0.6228366",
"0.6227783",
"0.6225236",
"0.62236",
"0.61987877",
"0.61987877",
"0.6196635",
"0.61668533",
"0.6154143",
"0.6140821",
"0.61283547",
"0.61138654",
"0.61138654",
"0.6111973",
"0.6108945",
"0.6096595",
"0.60903376",
"0.60828453",
"0.6072544",
"0.60633415",
"0.6060576",
"0.6057895"
] | 0.6290815 | 70 |
TODO: Reuse the helper version | def sanitize_email(email)
email.gsub(/@/, "_at_").gsub(/\./, "_dot_")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def wrapper; end",
"def schubert; end",
"def probers; end",
"def formation; end",
"def common\n \n end",
"def custom; end",
"def custom; end",
"def suivre; end",
"def weber; end",
"def identify; end",
"def implementation; end",
"def implementation; end",
"def terpene; end",
"def refutal()\n end",
"def anchored; end",
"def original_result; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def file_utils; end",
"def returns; end",
"def operations; end",
"def operations; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def extra; end",
"def berlioz; end",
"def verdi; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def internal; end",
"def intensifier; end",
"def same; end",
"def who_we_are\r\n end",
"def private_method\n end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def version_helper=(_arg0); end",
"def transform; end",
"def transformations; end",
"def stderrs; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def helper(*args, &block); end",
"def bs; end",
"def sitemaps; end",
"def offences_by; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def get_actual\n end",
"def original; end",
"def isolated; end",
"def isolated; end",
"def processor; end",
"def converter; end",
"def next() end",
"def next() end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def rest_positionals; end",
"def extended(*) end",
"def user_os_complex\r\n end",
"def handle; end",
"def ext; end",
"def ext; end",
"def name_safe?; end",
"def generic?; true; end",
"def romeo_and_juliet; end",
"def _wrapper_formats; end",
"def villian; end",
"def operation; end",
"def instance_helper\n\tend",
"def compilereturn\n\n end",
"def trd; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end"
] | [
"0.69135237",
"0.6127033",
"0.6127033",
"0.6127033",
"0.60047126",
"0.60047126",
"0.60047126",
"0.60047126",
"0.5912897",
"0.5795617",
"0.5703639",
"0.56548977",
"0.5626937",
"0.5591493",
"0.5591493",
"0.55655",
"0.5556643",
"0.54763675",
"0.5450508",
"0.5450508",
"0.54270107",
"0.5349482",
"0.5339174",
"0.5334394",
"0.52973646",
"0.52973646",
"0.52973646",
"0.5279427",
"0.52302945",
"0.52254605",
"0.52254605",
"0.52199864",
"0.52199864",
"0.52199864",
"0.52199864",
"0.5200282",
"0.5179908",
"0.51790893",
"0.5175138",
"0.5175138",
"0.5175138",
"0.5175138",
"0.5161903",
"0.5153992",
"0.51417875",
"0.51356184",
"0.5134405",
"0.5133444",
"0.5133444",
"0.5133444",
"0.5130159",
"0.5130018",
"0.5112656",
"0.5104915",
"0.5104915",
"0.510466",
"0.50930095",
"0.5088204",
"0.5077956",
"0.50663275",
"0.50663275",
"0.50663275",
"0.50663275",
"0.5062901",
"0.505888",
"0.504861",
"0.504861",
"0.50460786",
"0.5044802",
"0.5040609",
"0.5040609",
"0.5040061",
"0.5040061",
"0.5040061",
"0.5040061",
"0.5040061",
"0.5040061",
"0.5040061",
"0.5040061",
"0.5035969",
"0.5033377",
"0.50331897",
"0.5031212",
"0.5025256",
"0.5025256",
"0.50186133",
"0.5010604",
"0.5010111",
"0.5007983",
"0.5005097",
"0.49987325",
"0.49982914",
"0.49962446",
"0.49884504",
"0.49866328",
"0.49866328",
"0.49866328",
"0.49866328",
"0.49866328",
"0.49866328",
"0.49866328"
] | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.notice_mailer.sendmail_confirm.subject | def subscription(letter)
@greeting = "ご担当者様"
@name = letter.name
@company = letter.company
@email = letter.email
mail to: "[email protected]",subject: "[コンフォート]ニュースレター購読申し込み"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end",
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n @mail.subject\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end",
"def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end",
"def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end",
"def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end",
"def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end",
"def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end",
"def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end",
"def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end",
"def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end",
"def subject=(subject); @message_impl.setSubject subject; end",
"def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end",
"def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end",
"def subject\n @options.fetch(:subject) { \"Invitation\" }\n end",
"def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end",
"def subject=(string)\n set('Subject', string)\n end",
"def sendmail_confirm(greeting, text, address, subject)\n @greeting = greeting\n\n @text = text\n mail to: address, subject: subject\n end",
"def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def set_Subject(value)\n set_input(\"Subject\", value)\n end",
"def message_subject\n return @message_subject\n end",
"def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def setSubject(subject)\n @fields['subject'] = subject\n self\n end",
"def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end",
"def sendmail_confirm\n @greeting = \"元気ー?\"\n\n mail to: \"[email protected]\"\n end",
"def send_confirm_email\n settings.fetch('send_mail',{}).fetch('confirm_email', true)\n end",
"def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end",
"def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = '[email protected]'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end",
"def confirmed(assignment)\n setup_user_email(assignment)\n @subject += I18n.translate 'assignment_mailer.accepted.subject', :event => assignment.event.code\n end",
"def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end",
"def subject\n message.subject\n end",
"def headers\n {\n :subject => \"Contact Form:#{subject}\",\n :to => Sufia::Engine.config.contact_email, \n :from => Sufia::Engine.config.from_email\n }\n end",
"def subject_name=(value)\n @subject_name = value\n end",
"def headers\n { subject: \"#{site_name} contact form\", to: site_email, from: email }\n end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def subject_name\n return @subject_name\n end",
"def set_subject(subject)\n\t\tend",
"def send_subscribe_email(subscriptor)\n @subscriptor = subscriptor\n @subject = \"Thanks for subscribe for our amazing app\"\n mail(to: @subscriptor.email, subject: @subject)\n # mail(to: , from: , subject:)\n end",
"def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"[email protected]\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def confirm ( recipient,subject,message)\n @recipients = recipient \n @subject = subject \n @from = '[email protected]' \n @password= 'job1come'\n @message=message \n @headers = {} \n sub = @subject + Time.now.strftime(\"%A %B %d, %Y\") \n \n mail(:to => recipient, :subject => sub)\n \n end",
"def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"[email protected]\", :subject => \"Subject line\"\n \n end",
"def subject_titles\n @subject_titles ||= sw_subject_titles\n end",
"def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end",
"def subject_name\n subject_full_name\n end",
"def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end",
"def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end",
"def newcompany_email(company)\n @company = company\n @message = t('mailers.company.created')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n \n end",
"def subject\n self['subject']\n end",
"def headers\n {\n :subject => %(#{subject}),\n :to => Contact.first.email,\n :body => %(#{message}),\n :from => %(\"#{email}\")\n }\n end",
"def confirmation_instructions(record, token, opts={})\n opts[:from] = %(\"Janice from Beebsy\" <[email protected]>)\n opts[:bcc] = '[email protected]'\n opts[:subject] = 'Thanks for joining Beebsy!'\n opts[:reply_to] = '[email protected]'\n super\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def subject=(value)\n @subject = value\n end",
"def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end",
"def subject\n title \n end",
"def subject; @message_impl.getSubject; end",
"def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end",
"def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end",
"def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <[email protected]>\",\n from: \"BaseRails <[email protected]>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end",
"def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend",
"def headers\n {\n :subject => \"Inscripción de músico - #{musician_name}\",\n :to => \"[email protected]\",\n :from => %(\"#{musician_name}\" <#{musician_email}>)\n }\n end",
"def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end",
"def set_title\n @title = t(:message_0, :scope => [:controller, :scholarships])\n end",
"def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end",
"def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end",
"def headers\n {\n :subject => \"Contact from website\",\n :to => Site.current.preferred_contact_email,\n :from => %(\"#{lastname}\" <#{email}>)\n }\n end",
"def email_verification_subject(token, server_hostname, protocol)\n \"#{server_hostname} e-mail verification\"\n end",
"def community_member_email(sender, recipient, email_subject, email_content, community)\n @email_type = \"email_from_admins\"\n set_up_layout_variables(recipient, community, @email_type)\n with_locale(recipient.locale, community.locales.map(&:to_sym), community.id) do\n @email_content = email_content\n @no_recipient_name = true\n premailer_mail(:to => recipient.confirmed_notification_emails_to,\n :from => community_specific_sender(community),\n :subject => email_subject,\n :reply_to => \"\\\"#{sender.name(community)}\\\"<#{sender.confirmed_notification_email_to}>\")\n end\n end",
"def alert_preamble\n text = user ? user.email : ''\n text += \" [#{company.name}]\" if company\n text\n end",
"def notify_course_teaching_assignment( user , course ) \n @course = course\n @subject = @course.subject \n @school = @subject.school\n @user = user\n mail( :to => user.email, \n :subject => \"potoSchool | Tuga Mengajar pelajaran #{@subject.name}, kelas #{@course.name} \" )\n end",
"def editcompany_email(company)\n @company = company\n @message = t('mailers.company.updated')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n end",
"def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end",
"def headers\n {\n subject: I18n.t('contact.subject'),\n to: info_email,\n from: \"Deskspotting <#{info_email}>\"\n }\n end",
"def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end",
"def devalert(subject, body='', extra_to=[])\n recipients = CONTACT_EMAIL_ACCOUNTS\n if RAILS_ENV == 'production'\n extra_to = [extra_to] if extra_to.is_a?(String)\n recipients = [recipients].concat(extra_to).join(',')\n end\n @subject = subject\n @body = {:msg => body}\n @recipients = recipients\n @from = ALERT_EMAIL_DEV\n @sent_on = Time.now\n @headers = {}\n end",
"def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end",
"def prompt_message(pre)\n @greeting = \"Hi\"\n @pre = pre\n @prompt = pre.prompt\n\n mail to: \"#{@pre.user.email}\",\n subject: \"#{@prompt.name}\"\n end",
"def setup_email(options)\n @recipients = options[:recipients]\n @from = options[:from] || SocialNewsConfig[\"email_addrs\"][\"support\"] \n @cc = options[:cc] || ''\n @bcc = options[:bcc] || ''\n @subject = SUBJECT_PREFIX + (options[:subject] || 'No Subject')\n @body = options[:body] || {}\n @headers = options[:headers] || {}\n @charset = options[:charset] || 'utf-8'\n end",
"def headers\n {\n :subject => \"#{subject}\",\n :to => \"[email protected]\",\n :from => %(\"#{name}\" <#{email}>)\n }\n end",
"def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end"
] | [
"0.6912236",
"0.6822053",
"0.67955226",
"0.6685173",
"0.6684034",
"0.6679745",
"0.6677418",
"0.6580407",
"0.65657467",
"0.65475017",
"0.64384675",
"0.6430921",
"0.64237833",
"0.6360387",
"0.6348668",
"0.6336274",
"0.633325",
"0.6320941",
"0.6286503",
"0.62223476",
"0.61912227",
"0.61651343",
"0.61464787",
"0.60964674",
"0.6047324",
"0.6020205",
"0.59785336",
"0.59785336",
"0.59785336",
"0.59785336",
"0.59785336",
"0.59785336",
"0.59785336",
"0.59785336",
"0.5975661",
"0.5966044",
"0.5964189",
"0.5964189",
"0.5964189",
"0.5964189",
"0.59545696",
"0.59543306",
"0.58981365",
"0.5896941",
"0.58876055",
"0.58831364",
"0.5879641",
"0.58474547",
"0.5835288",
"0.58107686",
"0.57895285",
"0.5760482",
"0.57431734",
"0.57337296",
"0.5720367",
"0.57175887",
"0.5711063",
"0.5703575",
"0.5691308",
"0.56849605",
"0.5683595",
"0.5667105",
"0.5661604",
"0.56614584",
"0.56593174",
"0.56126094",
"0.5612596",
"0.5602319",
"0.5602319",
"0.5602319",
"0.5602319",
"0.5602319",
"0.5602319",
"0.55887496",
"0.5588392",
"0.5581551",
"0.55704683",
"0.55675244",
"0.55658644",
"0.556019",
"0.5559727",
"0.5558804",
"0.5543862",
"0.55426913",
"0.55419236",
"0.55419236",
"0.55408597",
"0.55376035",
"0.5533192",
"0.55295306",
"0.5524537",
"0.5518633",
"0.551146",
"0.5506722",
"0.55015093",
"0.55006737",
"0.5494931",
"0.5486785",
"0.5485042",
"0.5469501",
"0.5462909"
] | 0.0 | -1 |
Allows builder's DSL methods to be called from a class scope | def method_missing(name, *args, &block)
super unless respond_to? name
@builder = Builder.new(builder.tree) do
__send__(name, *args, &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end",
"def method_missing(method, *args, &block)\n return super unless builder\n\n builder.send(method, *args, &block)\n end",
"def builder; end",
"def builder; end",
"def builder; end",
"def method_builder; end",
"def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end",
"def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end",
"def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end",
"def definition_builder; end",
"def definition_builder; end",
"def method_missing(*args, &block)\n Markaby::Builder.new({}, self).capture {send(*args, &block)}\n end",
"def setup_class_dsl(tool_class)\n return if tool_class.name.nil? || tool_class.is_a?(DSL::Tool)\n class << tool_class\n alias_method :super_include, :include\n end\n tool_class.extend(DSL::Tool)\n end",
"def command_builder; end",
"def method_missing(method_sym, *arguments, &_block)\n @dsl.send(method_sym, *arguments)\n end",
"def initialize(&block)\n unload\n @environment = 'development'\n @load_directories = []\n @dsl = Moonrope::DSL::BaseDSL.new(self)\n @dsl.instance_eval(&block) if block_given?\n end",
"def call\n define_methods_into(@client)\n define_classes\n end",
"def builder_method\n config[:child_builder]\n end",
"def initialize(_dsl)\n @dsl = _dsl\n end",
"def build(&block)\n instance_eval(&block)\n end",
"def build_method\nend",
"def build_method\nend",
"def run(*arguments)\n @builder.run(@klass, *arguments)\n end",
"def define_builder_class\n if @target.const_defined? :Builder\n @builder_class = @taget.const_get :Builder\n else\n @builder_class = Class.new\n @target.const_set :Builder, @builder_class\n end\n @builder_class.send :include, Assembler::CodeBuilderBase\n end",
"def compile_dsl\n @registry.each_with_object(Class.new(DSL)) { |(name, processor), dsl|\n define_dsl_method(name, processor, dsl)\n }\n end",
"def define_builder(klass, options={}, &block)\n builder = Builder.new(klass, :as => options.delete(:as))\n add_builder(builder)\n\n if block_given?\n define_new(builder, &block)\n else\n define_new(builder) do |proxy, overrides|\n proxy.new(options.merge(overrides))\n end\n end\n\n define_create(builder)\n define_valid_attributes(builder)\n end",
"def _to_dsl_proxy\n self\n end",
"def method_missing(method_name, *args, &block)\n if self.class.has_dsl_attribute?(method_name.to_sym)\n @builded_attributes[method_name.to_sym] = if block_given?\n build_hash_from_block(&block)\n else\n args[0]\n end\n else\n raise \"Configuration '#{method_name}' is not allowed for #{self}\"\n end\n end",
"def call\n klass = Class.new(parent)\n\n klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def self.name\n #{name.inspect}\n end\n\n def self.inspect\n name\n end\n\n def self.to_str\n name\n end\n\n def self.to_s\n name\n end\n RUBY\n\n yield(klass) if block_given?\n\n klass\n end",
"def define_helper(scope, method, *args, **kwargs, &block); end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def DefDsl! *black_list\n Module.new do\n define_singleton_method :extended do |target|\n target.send :extend, DefDsl\n target.def_dsl *black_list\n end\n end\nend",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def register_self_as(dsl_method)\n register_component(dsl_method, self)\n end",
"def class_def name, &blk\r\n class_eval { define_method name, &blk }\r\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def __dsl_execute(file = nil, &block)\n DSL.new(self, file, &block)\n end",
"def call(env)\n builder.call(env)\n end",
"def define_build_method(name, builder)\n define_helper \"build_#{name}\", ->(attrs={}) { builder.build(attrs) }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def define_attributes(&blk)\n k = Class.new do\n include ControllerDSL\n end\n\n k.new(self).instance_eval(&blk)\n end",
"def build_operation_class(*args)\n class_builder(self).(*args) # Uber::Builder::class_builder(context)\n end",
"def class() end",
"def run; new.run; end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def class_def name, &blk\n class_eval { define_method name, &blk }\n end",
"def build_class(*args, &block)\n if @class_builder\n @class_builder.call(*args, &block)\n else\n self\n end\n end",
"def build!\n end",
"def incorporate\r\n Builder.new(self)\r\n end",
"def class_def( name, &blk )\r\n class_eval { define_method name, &blk }\r\n end",
"def class_def( name, &blk )\n class_eval { define_method name, &blk }\n end",
"def build opts = nil, &blk\n builder.build opts, &blk\n end",
"def initialize_from_builder(&block)\n builder = Class.new(Builder)\n builder.setup\n \n builder.instance_eval &block\n \n unless @model.descends_from_active_record?\n stored_class = @model.store_full_sti_class ? @model.name : @model.name.demodulize\n builder.where(\"#{@model.quoted_table_name}.#{quote_column(@model.inheritance_column)} = '#{stored_class}'\")\n end\n\n @fields = builder.fields\n @attributes = builder.attributes\n @conditions = builder.conditions\n @groupings = builder.groupings\n @delta_object = ThinkingSphinx::Deltas.parse self, builder.properties\n @options = builder.properties\n \n # We want to make sure that if the database doesn't exist, then Thinking\n # Sphinx doesn't mind when running non-TS tasks (like db:create, db:drop\n # and db:migrate). It's a bit hacky, but I can't think of a better way.\n rescue StandardError => err\n case err.class.name\n when \"Mysql::Error\", \"ActiveRecord::StatementInvalid\"\n return\n else\n raise err\n end\n end",
"def main\n super\n return self\n end",
"def initialize(from_path, context, show_hash)\n super()\n\n # class names, variable names, or instance variables\n @markup.add_special(/(\n # A::B.meth(**) (for operator in Fortran95)\n \\w+(::\\w+)*[.\\#]\\w+(\\([\\.\\w+\\*\\/\\+\\-\\=\\<\\>]+\\))?\n # meth(**) (for operator in Fortran95)\n | \\#\\w+(\\([.\\w\\*\\/\\+\\-\\=\\<\\>]+\\))?\n | \\b([A-Z]\\w*(::\\w+)*[.\\#]\\w+) # A::B.meth\n | \\b([A-Z]\\w+(::\\w+)*) # A::B\n | \\#\\w+[!?=]? # #meth_name\n | \\\\?\\b\\w+([_\\/\\.]+\\w+)*[!?=]? # meth_name\n )/x,\n :CROSSREF)\n\n @from_path = from_path\n @context = context\n @show_hash = show_hash\n\n @seen = {}\n end",
"def dsl(&block)\n Polymer::DSL.build(project_dir, &block)\n end",
"def execute(&block)\n DSLHelper.new(Class => [:&, :|, :not]) do\n Kernel.load(File.join(File.dirname(__FILE__), 'dsl_ruby_extensions.rb'))\n self.instance_eval(&block)\n end\n end",
"def cloaker &b #:nodoc:\n (class << self; self; end).class_eval do\n define_method :cloaker_, &b\n meth = instance_method :cloaker_\n remove_method :cloaker_\n meth\n end\n end",
"def def_class(superklass=Object, methodname='result')\n cls = Class.new(superklass)\n def_method(cls, methodname, @filename || '(ERB)')\n cls\n end",
"def def_dsl trash = []\n DefDsl.traverse self, trash do |who|\n who.send :include, So\n who.send :include, Lazy if who.instance_eval { @lazy }\n\n DefDsl.shallow(who, trash).each do |mod|\n mini = mod.name.underscore # .....\n method = mod.instance_eval { @dsl } || mod.name.underscore\n\n who.module_eval do\n define_method method do |*a,&b|\n so [mini,method],*a,&b # artifact...\n end\n end\n # or check superclass if respond for meta_modules + test\n if who.class == Module\n who.send :module_function, method\n end\n end\n end\n end",
"def cloaker(&blk)\n cloaking_class.class_eval do\n define_method :cloaker_, &blk\n meth = instance_method( :cloaker_ )\n remove_method :cloaker_\n meth\n end\n end",
"def class_def(name, &blk)\n class_eval { define_method name, &blk }\n end",
"def definition\n super\n end",
"def definition\n super\n end",
"def define &blk\n self.instance_eval(&blk)\n end",
"def dsl_eval(block)\n @dsl ||= DSL.new(self)\n @dsl.instance_eval(&block)\n self\n end",
"def helpers &blk\n class_eval(&blk) if block_given?\n end",
"def factory_twiml_block(meth, *args)\n if meth =~ /twiml_appointments_/\n klass = meth.to_s.gsub(\"twiml_appointments_\", \"skej/twiml/appointments/\").classify\n else\n klass = meth.to_s.gsub(\"twiml_\", \"skej/twiml/\").classify\n end\n\n # Make the string representation a real Class object.\n klass = klass.constantize\n\n # Prepare view local variables\n data = { device: @device, session: @session, debug: generate_debug_formatted_message }\n if args.length > 0 and args[0].kind_of? Hash\n data.merge! args[0]\n end\n\n log \"twiml_view_factory -> #{klass.name.underscore}\"\n\n # Instantiate the new instance from the dynamic Klass\n # we generated earlier.\n instance = klass.new(data)\n\n # Return the TwiML view instance\n instance\n end",
"def use_semantic_builder(method_name, name, *args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n options = options.merge(:builder => SemanticFormBuilder::SemanticBuilder)\n args = (args << options)\n method(method_name).call(name, *args, &block)\n end",
"def get_builder_class\n Cybele::AppBuilder\n end",
"def class_def(name, &blk)\n class_eval { define_method(name, &blk) }\n end",
"def initialize ( _caller )\n super\n end",
"def initialize ( _caller )\n super\n end",
"def build_class\n return klass if klass\n\n included_attrs = attributes.reject do |_name, opts|\n opts && opts[:exclude]\n end\n builder&.call(included_attrs.map(&:first))\n end",
"def build(options = {}, & block)\n require 'limelight/dsl/prop_builder'\n builder = Limelight::DSL::PropBuilder.new(self)\n builder.__install_instance_variables(options)\n builder.__root_path__ = scene.path\n builder.instance_eval(& block)\n end",
"def setup(klass, *methods)\n \n end",
"def cloaker(&b)\n (class << self; self; end).class_eval do\n define_method :cloaker_, &b\n meth = instance_method :cloaker_\n remove_method :cloaker_\n meth\n end\n end",
"def build\n yield self\n self\n end",
"def build; end",
"def run_builder_block(block, controller, *args)\n controller.instance_exec(*args, &block)\n end",
"def domain_class\n self.class.const_get(:DSL)\n end",
"def build(*arguments, &block)\n build_class(*arguments, &block).new(*arguments, &block)\n end",
"def get_definition(cls, bld, fun)\r\n bld.add(\"//\")\r\n bld.add(\"// Configuration \")\r\n bld.add(\"//\")\r\n\r\n entityClassName = XCTECSharp::Utils.instance.getStyledClassName(cls.getUName())\r\n configFunName = \"Configure(EntityTypeBuilder<\" + entityClassName + \"> builder)\"\r\n\r\n bld.startFunction(\"public void \" + configFunName)\r\n\r\n get_body(cls, bld, fun)\r\n\r\n bld.endFunction\r\n end",
"def di(name, &block)\n rc = ::Dizzy::DSL::RuleContext.new\n rc.instance_exec(&block)\n\n di_define_method(name, rc.init_proc, rc.wire_proc)\n end",
"def define_class_method(name, &block)\n (class << self; self; end).instance_eval do\n define_method name, &block\n end\n end",
"def initialize(*args)\n super\n _rewire_dsl! if node\n end",
"def builder\n @builder ||= Builder.new(self)\n end",
"def markaby(&block)\n Markaby::Builder.new({}, self, &block)\nend",
"def definition\n \"class << #{full_name}\"\n end",
"def build_with(builder)\n case from = method_source\n when Parfait::CallableMethod\n callable = builder.load_object(from)\n when Parfait::CacheEntry\n callable = builder.load_object(from)[:cached_method].to_reg\n when Integer\n callable = builder.message[ \"arg#{from}\".to_sym ].to_reg\n else\n raise \"unknown source #{method_source.class}:#{method_source}\"\n end\n build_message_data(builder , callable)\n return builder.built\n end",
"def build\r\n raise \"Not implemented\"\r\n end",
"def invoking\n end",
"def emit_dsl\n declared_in.class_eval(<<-EOM, __FILE__, __LINE__ + 1)\n def #{name}(*values)\n property = self.class.properties[#{name.inspect}]\n if values.empty?\n property.get(self)\n elsif property.is_set?(self)\n property.set(self, property.get(self) + values.flatten)\n else\n property.set(self, values.flatten)\n end\n end\n EOM\n end"
] | [
"0.6604525",
"0.6604525",
"0.65737504",
"0.65737504",
"0.65737504",
"0.6501042",
"0.63955414",
"0.63955414",
"0.631219",
"0.6185696",
"0.6185696",
"0.6111498",
"0.60460174",
"0.5918728",
"0.58979577",
"0.5866636",
"0.58654225",
"0.58420295",
"0.5817687",
"0.5813736",
"0.57421595",
"0.57421595",
"0.572052",
"0.56987196",
"0.5683664",
"0.567011",
"0.5666792",
"0.5663869",
"0.56552196",
"0.564673",
"0.5643527",
"0.5643527",
"0.5640984",
"0.5608402",
"0.5608402",
"0.55975443",
"0.5594066",
"0.5581654",
"0.5571991",
"0.5564973",
"0.55451125",
"0.5530076",
"0.5527764",
"0.55263394",
"0.5521471",
"0.55163497",
"0.5505267",
"0.5505267",
"0.5505267",
"0.5505267",
"0.5505267",
"0.5505267",
"0.55041146",
"0.5490334",
"0.54785705",
"0.5449819",
"0.54474205",
"0.5442073",
"0.5433235",
"0.54310364",
"0.5419731",
"0.5419022",
"0.5412912",
"0.54046935",
"0.5401315",
"0.53858685",
"0.5383839",
"0.53796244",
"0.5376964",
"0.5371976",
"0.5371976",
"0.53568524",
"0.5344058",
"0.53372085",
"0.5334827",
"0.53188443",
"0.5318651",
"0.5314256",
"0.5304973",
"0.5304973",
"0.529854",
"0.52900803",
"0.52885133",
"0.5286207",
"0.52832294",
"0.52819806",
"0.5274317",
"0.52736574",
"0.5273374",
"0.5268839",
"0.52677125",
"0.5264965",
"0.52623767",
"0.52612525",
"0.5260406",
"0.52590674",
"0.5254804",
"0.5252112",
"0.5251592",
"0.5217936"
] | 0.599699 | 13 |
ajax answer the next page for paginated Prescriber search | def nextPrescribers
@searchPrescribers = Prescriber.nextPrescribers params[:start], params[:page], 9
render template: 'common/search/js/nextSearchPrescribers.js'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_next_page\n @browser.pluggable_parser.html = SearchPaginationParser\n\n @pagination.next\n previous_length = @results.size\n\n page = @browser.get(ajax_url)\n\n @results += page.search('.match_row').collect do |node|\n OKCupid::Profile.from_search_result(node)\n end\n\n @browser.pluggable_parser.html = Mechanize::Page\n\n previous_length != @results.size\n end",
"def next_page; end",
"def next_page\n end",
"def next_page(params = nil)\n perform_request(@next_page_link)\n end",
"def next_page\n if next_page?\n @query[:startPage] += 1\n fetch\n end\n end",
"def next_page\n page = self.page() + 1\n request = @request.clone()\n request.replace_param( :page, page )\n @client.execute( request )\n end",
"def next\n perform_request(next_page_uri) if next?\n end",
"def next_page(params = {})\n @items = load_page(params)\n end",
"def next_page\n pagination_adapter.next_page\n end",
"def nextItems\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchItems.js'\n end",
"def next_page\n @client.get(@raw_page['nextRecordsUrl']).body if has_next_page?\n end",
"def next; pager.page(page + 1); end",
"def next_page\n url = @entity[:next]\n return unless url\n\n query = URI.decode_www_form(URI(url).query).to_h\n query = query.to_h { |k, v| [k.to_sym, v] }\n self.class.list(**query)\n end",
"def next_page\n collection.next_page\n end",
"def next_page!\n page = @doc.css(\".paginator span.pagination_current\").first\n @next_page = page.next_element[\"href\"] if page\n on_url(@next_page) if @next_page\n end",
"def next_search_result_page(params = {}, opts = {})\n return self.class.empty_search_result(opts) unless has_more\n\n params = filters.merge(page: next_page).merge(params)\n\n _search(url, params, opts)\n end",
"def next_page_link\n paging['next'] if paging\n end",
"def next_page\n sync.get(next_page_url) if next_page?\n end",
"def next_page_url\n \"#{request.path}?page=#{@page + 1}\"\n end",
"def next_page\n next_page? ? updated_collection(next_page_params.merge(from: from)) : self\n end",
"def next_page\n @page = info(@page[:next_page])\n end",
"def next\n return nil unless has_next?\n perform_request(next_page_uri)\n end",
"def next_page\n # The only difference from the default here is we renamed the link to \"More\"\n # and added a custom class, twitter_pagination\n previous_or_next_page(@collection.next_page, '<div class=\"hover-move\"><img src=\"assets/next.png\" alt=\"next\"/></div><img src=\"assets/barre.png\"/>', 'next_pagination') if @collection.next_page\n end",
"def handle_next\n\n init_next\n\n respond_to do |format|\n\n format.js { render :file => 'shared/handle_next_prev.js.erb' }\n\n end\n\n end",
"def next\n return @page + 1\n end",
"def next_page\n page = @current_page + 1\n get_page(page)\n end",
"def next_page\n @links['next']\n end",
"def next_page\n go_to_page(@current_page+1)\n end",
"def next_page!\n next_page.tap { |page| update_self(page) }\n end",
"def nextCustomers\n\n @searchCustomers = Customer.nextCustomers params[:start], params[:page], 9\n\n # technique below eliminates the extra .js file used in the ajax response. it trades off the disk access for the \\n replacement below\n # remember, its not quite a standard rails approach\n # searchTemplate = render_to_string partial: 'common/search/customer_search_modal_template', locals: { searchCustomers: @searchCustomers }, :layout => false\n\n # when using the technique above, the newlines (\\n) have to be removed\n # render js: \"$('#customer_search_modal_partial').html(\\'\" + searchTemplate.gsub(\"\\n\",\"\") + '\\');'\n\n render template: 'common/search/js/nextSearchCustomers.js'\n\n end",
"def next\n goto(@current_page + 1)\n end",
"def next_page_token\n @response.next_page_token\n end",
"def next_page\n @page.link_with(:text => /Next/)\n end",
"def nextSigcodes\n @searchSigcodes = Sigcode.nextSigcodes params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchSigcodes.js'\n end",
"def next_page\n @collection.next_page\n end",
"def next_page\n @collection.next_page\n end",
"def next_page(options = nil)\n next_page_async(options).get\n end",
"def next_page; link 'next' end",
"def next_page\n return nil if @query_str_next_page.empty?\n @url_str = next_url_str\n @page = InWebPage.new(@url_str)\n @page_count += 1\n\n # Prepare for getting the page which follows.\n @doc = REXML::Document.new(@page.to_s)\n @query_str_next_page = ''\n @doc.root.elements.each(XPATH_NEXT_PAGE){|e| @query_str_next_page = \"resumptionToken=#{e.text}\"}\n true\n end",
"def nextIngredients\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchIngredients.js'\n end",
"def get_next_page\n nextlink = @doc.search(\"//p[@class='nextprev']/a[@rel='nofollow next']\")\n nextlink.map! { |link| \"#{link['href']}\" }\n stringlink = nextlink[0]\n @doc = open(stringlink) { |f| Hpricot(f) }\n get_links\n end",
"def next_page\n num = current_page + 1\n num if total_pages >= num\n end",
"def next_page!\n if self.page < 5\n self.page += 1\n if self.page == 3 && self.group == 1\n # Control group skips questions about first survey\n self.page += 1\n elsif self.page == 5\n self.completed = true\n end\n self.save\n end\n end",
"def next_page(extra_params = {})\n base, args = next_page_params\n base ? @api.get_page([base, args.merge(extra_params)]) : nil\n end",
"def paginator; end",
"def next() \n\t\treturn self.response.next()\n\tend",
"def next_page\n return nil unless paginated?\n return nil unless (total_pages - current_page) > 0\n request_with(page: current_page + 1)\n end",
"def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def after_pagination\n end",
"def next_page\n return if page >= total_pages\n page + 1\n end",
"def next_page\n @rally_rest.query(@query.next_page(:start => self.start_index + self.page_size,\n\t\t\t\t :pagesize => self.page_size))\n end",
"def ajax_next_patient\n begin\n if params[:commit]\n @ct = params[:patients_groups]\n @patient = Patient.find(@ct[:next_patient])\n set_patient_session(@patient.id, @patient.patient_name)\n else\n @patients_groups = PatientsGroup.find_all_by_group_id(session[:group]) \n @patient = Patient.find_all_by_id(@patients_groups.collect{|c| c.patient_id}, :order => \"last_name ASC, first_name ASC\") \n end\n \n #the get is an ajax call, th post is a redirect to new insurance billing\n respond_to do |format|\n format.html { redirect_to new_insurance_billing_path(:dos => session[:dos]) }\n format.js\n end\n rescue\n respond_to do |format|\n format.html { head :no_content }\n format.js { head :no_content }\n end\n end\n end",
"def get_next_url\n\n @index = @index + 1\n\n link = @url.to_s + \"?PageNumber=\"\n\n link = link + @index.to_s\n\n return link\n\nend",
"def get_next_url\n\n @index = @index + 1\n\n link = @url.to_s + \"?PageNumber=\"\n\n link = link + @index.to_s\n\n return link\n\nend",
"def found_next_product_page\n @country == DE ? show_next = 'weiter' : show_next = 'Next'\n\n if @page.all(:div_class, 'pagination').first.has_link?(\"#{show_next}\") == TRUE\n return TRUE\n else\n return FALSE\n end\n end",
"def parse\n super\n if next_page_url\n @doc = get_document(URI(next_page_url))\n self.parse\n end\n self\n end",
"def next_page!\n return unless next_page?\n @page += 1\n clear!\n end",
"def calculate_next\n n = @current_page + 1\n n > @total_pages || n <= 0 ? nil : n\n end",
"def next_page?\n return (@query[:startPage] * (@query[:count] + 1)) < @total_results\n end",
"def next_page\n @current_page + 1 if has_next_page?\n end",
"def next_page\n current_page >= total_pages ? nil : current_page + 1\n end",
"def nextResults\n # Update results\n updateResults(@nextURI)\n\n # Update nextURI\n updateNextURI\n end",
"def next_page\n num = @collection.current_page < @collection.total_pages && @collection.current_page + 1\n previous_or_next_page(num, @options[:next_label], 'next')\n end",
"def next_page\n return unless @next_page\n \"<a class='btn' href=\\\"#{modify_page(1)}\\\">Next Page</a>\"\n end",
"def next_page\n set RGhost::Cursor.next_page\n end",
"def next_page\n\t\t\tFeed.parse_url(next_page_url,@browser)\n\t\tend",
"def next_page\n string = QJ.next_string()\n url = BSU + string\n BR.goto(url)\nend",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def ajax_get_new_page\n case params[ :type ] \n when \"following\" , \"followers\" \n data = User.fetch_follow( params[ :id ] , current_user , params[ :type ], params[ :page ] ) [ \"data\" ]\n @user_list = data[ \"users\" ] \n @user_agree = data[ \"pending\" ] \n when \"commentlike\" , \"story\"\n query = {\n \"activity_ids[before]\" => params[ :activity ] ,\n \"comment_ids[before]\" => params[ :comment ] ,\n \"like_ids[before]\" => params[ :like ] \n }\n if params[ :type ] == \"story\" \n data = User.fetch_moments( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"moments\" ]\n @user = User.fetch( params[ :id ] , current_user , nil ) [ \"data\" ]\n else \n data = User.fetch_commentlike( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"likes_and_comments\" ]\n end\n @qparams = data[ \"next_query_parameters\" ] \n @qparams[ \"activity_ids\" ] = { \"before\" => params[ :activity ] } if @qparams[ \"activity_ids\" ] .nil?\n @qparams[ \"comment_ids\" ] = { \"before\" => params[ :comment ] } if @qparams[ \"comment_ids\" ] .nil?\n @qparams[ \"like_ids\" ] = { \"before\" => params[ :like ] } if @qparams[ \"like_ids\" ] .nil?\n end\n render :layout => false\n end",
"def pa_request(*args)\n bp_request\n @page_number = convert_expression(@page_number, args, \"page number\") - 1 # Becaue it will be incremented\n end",
"def get_next_url\n @index = @index + 1\n link = @url.to_s + \"?PageNumber=\"\n link = link + @index.to_s\n \n return link\nend",
"def get_next_url\n @index = @index + 1\n link = @url.to_s + \"?PageNumber=\"\n link = link + @index.to_s\n \n return link\nend",
"def update_page\n if Input.trigger?(Key_nextpage)\n next_page\n elsif Input.trigger?(Key_lastpage) && @page_index > 0\n last_page\n end\n end",
"def next_page\n current_page + 1 unless last_page? || out_of_range?\n end",
"def next_page\n page + 1 if pages.include?(page + 1)\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n @total_pages && current_page == @total_pages ? nil : current_page + 1\n end",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def get_next_page(page)\n\n # Todo: Put your code here to get the next page to be scraped\n\n next_page_condition = page.search('input[id$=nextPageHyperLink]')\n\n if !next_page_condition.empty? \n\n link = get_next_url()\n\n page = @agent.get(link)\n\n return page\n\n else\n\n return nil\n\n end\n\nend",
"def next_page(path)\n result = http_get(path)\n collection_from(result.body)\n end",
"def pagination\n [ :next_page ]\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_url_str\n \"#{@url_base_str}?#{QUERY_STRING_PART1}&#{@query_str_next_page}\"\n end",
"def nextExistingIngredients\n @currentIngredientId = params[:ingredient_id]\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchExistingIngredients.js.erb'\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page_url\n current_page = params[:page].try(:to_i) || 1\n if request.path.match /\\/page\\/(\\d+)/\n request.path.gsub(/\\/page\\/(\\d+)$/, \"/page/#{current_page+1}\")\n else\n \"#{request.path}/page/#{current_page+1}\"\n end\n end",
"def next\n next_button.click\n end",
"def next\n next_button.click\n end",
"def next\n next_button.click\n end",
"def next\n next_button.click\n end",
"def next_page_number\n Hash(next_page_params).fetch('page', {}).fetch('number', nil)\n end",
"def next_page_number\n self.pages.count + 1\n end",
"def index\n pages = Page.find_by_sql(\"select * from pages\").map { |page| {page: page} }\n if params[:page]\n @pages = get_page_and_offset(13, params[:page].to_i, pages)\n else\n @pages = get_page_and_offset(13, 1, pages)\n end\n\n respond_to do |format|\n format.html\n format.js {render 'paginate_pages.js.erb'}\n end\n end"
] | [
"0.7283596",
"0.719351",
"0.712438",
"0.70285916",
"0.6978852",
"0.6977104",
"0.6951121",
"0.69150895",
"0.6810806",
"0.6777248",
"0.6773149",
"0.6772437",
"0.6758603",
"0.67236286",
"0.67172444",
"0.6712684",
"0.66220665",
"0.66186017",
"0.6617014",
"0.6600223",
"0.6563989",
"0.65283954",
"0.6486253",
"0.6477873",
"0.64721495",
"0.64631367",
"0.64487094",
"0.6440505",
"0.6435967",
"0.63903165",
"0.63772935",
"0.63739586",
"0.63687986",
"0.6352016",
"0.63491976",
"0.63491976",
"0.6334535",
"0.6329903",
"0.63120884",
"0.6309509",
"0.6305122",
"0.62883973",
"0.6273671",
"0.6267123",
"0.6265846",
"0.6255857",
"0.6235123",
"0.623127",
"0.6225571",
"0.6225571",
"0.621668",
"0.62141323",
"0.618737",
"0.6185209",
"0.6166224",
"0.6166224",
"0.6142331",
"0.61413205",
"0.61409724",
"0.6138891",
"0.613568",
"0.61236525",
"0.6107301",
"0.60960567",
"0.6095413",
"0.6087974",
"0.6083552",
"0.6077428",
"0.6072087",
"0.60703886",
"0.6066726",
"0.6065932",
"0.60638374",
"0.60638374",
"0.6053812",
"0.60391766",
"0.60365915",
"0.60359526",
"0.60344523",
"0.60344523",
"0.60344523",
"0.6028906",
"0.6015524",
"0.6015524",
"0.60147256",
"0.60121036",
"0.60096025",
"0.60096025",
"0.60059977",
"0.6005301",
"0.5978157",
"0.5978157",
"0.59751093",
"0.5974975",
"0.5974975",
"0.5974975",
"0.5974975",
"0.59727156",
"0.5965327",
"0.59628296"
] | 0.79200375 | 0 |
DELETE /prescribers/1 DELETE /prescribers/1.json | def destroy
@prescriber.destroy
respond_to do |format|
format.html { redirect_to prescribers_url, notice: 'Prescriber was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber.destroy\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to account_subscribers_url(@account) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber.destroy\n respond_to do |format|\n format.html { redirect_to subscribers_url, notice: 'Subscriber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber.destroy\n respond_to do |format|\n format.html { redirect_to subscribers_url, notice: 'Suscriptor fue borrado exitósamente.' }\n format.json { head :no_content }\n end\n end",
"def deletesubscriber\n\n\tparams[\"phone\"] = params[\"phone\"].gsub(\"\\s\",\"\").gsub(/^0044/, \"\").gsub(/^\\+44/, \"\")\n\tif params[\"phone\"].length == 10\n\t\tparams[\"phone\"] = '0' + params[\"phone\"]\n\tend\n\n\tif (Subscriber.exists?(:phone => params[:phone]))\n\t\tsubscriber = Subscriber.where(:phone => params[:phone]).first\n\t\tsubscriber.destroy\n\n\t\trespond_to do |format|\n\t\t format.html # deletesubscriber.html.erb\n\t\tend\n\telse\n\t\tredirect_to :action => \"unsubscribe\", phone: params[:phone]\n end\n end",
"def destroy\n @launchsubscriber = Launchsubscriber.find(params[:id])\n @launchsubscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to launchsubscribers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribes_url }\n format.json { head :no_content }\n end\n end",
"def delete_subscriber(id_or_email)\n make_json_api_request :delete, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end",
"def destroy\n @newsletter_subscriber.destroy\n respond_to do |format|\n format.html { redirect_to newsletter_subscribers_url, notice: 'Newsletter subscriber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter_subscriber = NewsletterSubscriber.find(params[:id])\n @newsletter_subscriber.destroy\n\n respond_with\n end",
"def destroy\n @news_subscriber.destroy\n respond_to do |format|\n format.html { redirect_to news_subscribers_url, notice: 'News subscriber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter_subscription = NewsletterSubscription.find(params[:id])\n @newsletter_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletter_subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscriber.destroy\n render_success_format('subscriber eliminada',@subscriber,true)\n rescue Exception => e\n render_default_error e, 401\n end",
"def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member = @subscriber.member\n @check_in = @subscriber.check_in\n @subscriber.destroy\n respond_to do |format|\n format.html { redirect_to subscribers_url, notice: 'Subscriber was successfully destroyed.' }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @premium_subscription.destroy\n respond_to do |format|\n format.html { redirect_to premium_subscriptions_url, notice: 'Premium subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_subscriptions\n end",
"def destroy\n @subscription_request = SubscriptionRequest.find(params[:id])\n @subscription_request.destroy\n\n respond_to do |format|\n format.html { redirect_to subscription_requests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @email_newsletter_subscription.destroy\n respond_to do |format|\n format.html { redirect_to email_newsletter_subscriptions_url, notice: 'Email newsletter subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_prescription.destroy\n respond_to do |format|\n format.html { redirect_to users_prescriptions_url, notice: 'Users prescription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def deletePublisher( publisher_id)\n params = Hash.new\n params['publisher_id'] = publisher_id\n return doCurl(\"delete\",\"/publisher\",params)\n end",
"def destroy\n @admin_subscription.destroy\n respond_to do |format|\n format.html { redirect_to admin_subscriptions_url, notice: 'L\\'abonnement a bien été créé supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter.destroy\n respond_to do |format|\n format.html { redirect_to newsletters_url }\n format.json { head :no_content }\n end\n end",
"def delete\n result = Hash.new\n begin # try\n result = SubscribesHlp.delete(params[:id])\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def delete_subscribers(project_id, queue_name, subscribers, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling delete_subscribers\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling delete_subscribers\" if queue_name.nil?\n \n # verify the required parameter 'subscribers' is set\n raise \"Missing the required parameter 'subscribers' when calling delete_subscribers\" if subscribers.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/subscribers\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(subscribers)\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:DELETE, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = ResponseMessage.new() and obj.build_from_hash(response)\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to root_url}\n format.json { head :no_content }\n end\n end",
"def remove_subscription\n buyer = @current_user\n customer_id = buyer.stripe_customer_id\n customer = Stripe::Customer.retrieve(customer_id)\n subscription.delete\n render json: { message: 'Unsubscribed succesfully' }, status: 200\n end",
"def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html {redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.'}\n format.json {render json: @subscribe, status: :ok}\n end\n end",
"def destroy\n @unsubscription.destroy\n respond_to do |format|\n flash[:success] = \"Le traitement a bien été supprimé!\"\n format.html { redirect_to unsubscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: (I18n.t :subscription_deleted) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crytosubscription.destroy\n respond_to do |format|\n format.html { redirect_to crytosubscriptions_url, notice: 'Crytosubscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter_registrations = NewsletterRegistrations.find(params[:id])\n @newsletter_registrations.destroy\n\n respond_to do |format|\n format.html { redirect_to(newsletter_registrations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @subscription = Subscription.find(params[:id])\r\n @subscription.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to business_user_subscriptions_path }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @prescription.destroy\n respond_to do |format|\n format.html { redirect_to prescriptions_url, notice: 'Prescription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n\n head :no_content\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def delete(\n start_date: nil, end_date: nil, email: nil)\n res = connection.post(\n '/api/unsubscribes.delete.json',\n default_params(\n start_date: start_date,\n end_date: end_date,\n email: email))\n craft_response(res)\n end",
"def destroy\n @add_to_invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to add_to_invoice_clients_url, notice: 'Add to invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to @subscription.transaction }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vendor_subscription.destroy\n respond_to do |format|\n format.html { redirect_to vendor_subscriptions_url, notice: 'Vendor subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_subscription.destroy\n respond_to do |format|\n format.html { redirect_to api_subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletter.destroy\n end",
"def destroy\n @preregistration.destroy\n respond_to do |format|\n format.html { redirect_to preregistrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipient.destroy\n respond_to do |format|\n format.html { redirect_to recipients_url, notice: '送付先情報を削除しました。' }\n format.json { head :no_content }\n end\nend",
"def destroy\n @subscriber = Helpdesk::Subscriber.find_by_hashcode(params[:hashcode])\n @subscriber.destroy\n redirect_to root_path\n end",
"def destroy\n @subscriber.update(active: :false)\n respond_to do |format|\n format.html { redirect_to session[:request_page], notice: 'Subscriber is now inactive.' }\n format.json { head :no_content }\n end\n @subscriber.subscribers_books.each do |subscription|\n subscription.quantity = 0\n subscription.save\n end\n relations = Relationship.where(\"name_index = ?\", @subscriber.index)\n relations.each do |relation|\n relation.quantity = 0\n relation.save\n end\n end",
"def destroy\[email protected]\nrespond_to do |format|\n format.html { redirect_to :back, notice: 'Pet was successfully destroyed.' }\n format.json { head :no_content }\nend\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_subscriptions_path(@campaign) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prescribtion_detail.destroy\n respond_to do |format|\n format.html { redirect_to prescribtion_details_url, notice: 'Prescribtion detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n\t\tmanga = Manga.find(@subscription.manga_id)\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url, notice: 'Successfully unsubscribed to '+ manga.display_name.to_s}\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = User.find(params[:id])\n senator = Senator.find(params[:senator_id])\n user.senators.delete(senator)\n render json: user.senators\n end",
"def api_remove\n data_hash = make_hash\n delete_hash = { division: data_hash[:division][:value] }\n handler.remove(delete_hash, path, subscriber_id)\n end",
"def destroy\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",
"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",
"def destroy\n @report_subscriber.destroy\n respond_to do |format|\n format.html { redirect_to report_subscribers_url, notice: 'Report subscriber was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(address)\n \tMailgun.submit :delete, list_url(address)\n end",
"def destroy\n @customer_mailer.destroy\n respond_to do |format|\n format.html { redirect_to customer_mailers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # disabled for now\n # @publisher.destroy\n # respond_to do |format|\n # format.html { redirect_to publishers_url, notice: 'Publisher was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @notify_observer = NotifyObserver.find(params[:id])\n @notify_observer.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_observers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presponsable.destroy\n respond_to do |format|\n format.html { redirect_to presponsables_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to referrals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n deleted_publication = @publication.pub_name\n deleted_publication_client = @publication.client.client_name\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Publication #{deleted_publication} for #{deleted_publication_client} was successfully deleted\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def destroy\n result = access_token.delete(\"/api/v1/emails/#{params[:id]}\")\n display_api_response( result )\n respond_with(\"\",:location => :back)\n end",
"def destroy\n @recipient = Recipient.find(params[:id])\n @recipient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @recipient = Recipient.find(params[:id])\n @recipient.destroy\n\n respond_to do |format|\n format.html { redirect_to recipients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher.destroy\n respond_to do |format|\n format.html { redirect_to publishers_url, notice: 'Publisher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to artist_subscription_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @custumer.destroy\n respond_to do |format|\n format.html { redirect_to custumers_url, notice: 'Custumer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n subscribers.each do |name, subscriber|\n subscriber.destroy\n end\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @owner = @subscription.owner\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_url([@owner, :subscriptions]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @preregistration.destroy\n respond_to do |format|\n format.html { redirect_to preregistrations_url, notice: \"Preregistration was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end"
] | [
"0.75229764",
"0.74989325",
"0.7479443",
"0.7448541",
"0.7271936",
"0.7231357",
"0.71948296",
"0.7047412",
"0.7020993",
"0.6973432",
"0.6947614",
"0.6896681",
"0.6887121",
"0.6860743",
"0.68337417",
"0.67372745",
"0.67372745",
"0.67372745",
"0.67214495",
"0.66357785",
"0.66310096",
"0.6626897",
"0.66045195",
"0.65869814",
"0.65803385",
"0.6576783",
"0.6573943",
"0.65482324",
"0.6543845",
"0.65351254",
"0.65193707",
"0.6506967",
"0.65024877",
"0.65024877",
"0.65024877",
"0.65024877",
"0.6496394",
"0.6463537",
"0.6452526",
"0.6442193",
"0.64345014",
"0.64294714",
"0.64195025",
"0.6395206",
"0.6389671",
"0.6374777",
"0.63641673",
"0.63590425",
"0.63581675",
"0.63519853",
"0.63514775",
"0.6350963",
"0.6350963",
"0.6350963",
"0.63374233",
"0.6334028",
"0.6327036",
"0.6327036",
"0.6327036",
"0.6327036",
"0.6327036",
"0.6314371",
"0.63116205",
"0.63089633",
"0.63081026",
"0.6306255",
"0.6306229",
"0.6304015",
"0.6303853",
"0.6295323",
"0.6293204",
"0.6288229",
"0.6285858",
"0.62775904",
"0.6272085",
"0.6262565",
"0.6260844",
"0.62588364",
"0.6258213",
"0.62511164",
"0.62416947",
"0.62404954",
"0.623954",
"0.6231085",
"0.6223598",
"0.6221731",
"0.6219751",
"0.62135047",
"0.62094945",
"0.62088555",
"0.61981255",
"0.6193391",
"0.6192836",
"0.61907786",
"0.618691",
"0.61863756",
"0.6185604",
"0.618526",
"0.6179732",
"0.6179173"
] | 0.7593302 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_prescriber
@prescriber = Prescriber.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def prescriber_params
params.require(:prescriber).permit(:dept_number, :rna_prescriber_id_number, :last_name, :first_name, :middle_name, :dea_number, :npi_number, :surescripts_erx_id, :emdeon_erx_id, :active_flag, :participates_in_340b, :location_code, :requires_supervisor, :address1, :address2, :city, :state, :zip_code, :specialty, :memo, :group_code, :sig_default, :erx_eligibility, :remote_access, :facility_number, :allowed_to_prescribe_narcotics, :allowed_to_prescribe_controlled, :alternate_id1_qualifier, :alternate_id1, :alternate_id1_source, :alternate_id2_qualifier, :alternate_id2, :alternate_id2_source, :alternate_id3_qualifier, :alternate_id3, :alternate_id3_source, :alternate_id4_qualifier, :alternate_id4, :alternate_id4_source)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
Make sure the interactive shell is working. | def test_interactive_rucas
cmd = "#{RUBY} -w -Ilib:ext:bin:test -rubygems bin/rucas"
output = IO.popen(cmd, 'r+') {|p|
p.puts "rucas_help"
p.close_write
p.read
}
expected = <<EXPECTED
-- interactive rucas --
To exit, type exit or quit.
For help, type rucas_help.
rucas:001:0> rucas_help
Interactive rucas is based on the standard Interactive Ruby (irb).
Declare symbolic variables using var.
Then you can manipulate them using standard Ruby code.
Examples:
> var :x
#=> #<struct Rucas::VarExpr name=:x>
> var :y
#=> #<struct Rucas::VarExpr name=:y>
> var :z
#=> #<struct Rucas::VarExpr name=:z>
> (x + 1 - x).simplify.to_s
#=> "1"
> [x, y, z].sum.to_s
#=> "x + y + z"
You can use underscore (_) to get the result of the last command.
nil
rucas:002:0>
EXPECTED
assert_equal expected.strip, output.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interactive_shell\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n loop do\n cmd = readline(prompt)\n\n case cmd\n when \"\", \"\\\\\"\n next\n when \"exit\", nil\n finish\n break\n when /.?\\\\$/\n final_cmd += cmd.sub(/\\\\$/,\"\\n\")\n prompt = MULTILINE_PROMPT\n Readline::HISTORY.push(cmd)\n next\n else\n final_cmd += cmd\n Readline::HISTORY.push(cmd)\n end\n\n execute(final_cmd)\n final_cmd = \"\"\n prompt = DEFAULT_PROMPT\n end\n end",
"def shell_init\n return true\n end",
"def shell_init\n return true\n end",
"def shell_init\n return true\n end",
"def reopen_tty\n # If the hook isn't interactive, we need to map STDIN to keyboard manually\n STDIN.reopen('/dev/tty') if STDIN.eof?\n rescue # rubocop:disable HandleExceptions\n # Happens in tests run with no console available\n end",
"def debug_shell\n puts '------ Opening debug shell -----'\n @orig_dir = Dir.pwd\n begin\n if respond_to?(:prepare_debug_shell)\n prepare_debug_shell\n end\n system('bash')\n ensure\n Dir.chdir(@orig_dir)\n end\n puts '------ Exiting debug shell -----'\n end",
"def prepare_interact_environment\n env = {sig: {}}\n\n # Save old tty settings and set up the new environment\n env[:tty] = `stty -g`\n `stty -icanon min 1 time 0 -echo`\n\n # SIGINT should be sent to the child as \\C-c\n env[:sig]['INT'] = trap 'INT' do\n send \"\\C-c\"\n end\n\n # SIGTSTP should be sent to the process as \\C-z\n env[:sig]['TSTP'] = trap 'TSTP' do\n send \"\\C-z\"\n end\n\n @interact = true\n env\n end",
"def shell?\n false\n end",
"def _interact\n\t\t# Call the console interaction subsystem of the meterpreter client and\n\t\t# pass it a block that returns whether or not we should still be\n\t\t# interacting. This will allow the shell to abort if interaction is\n\t\t# canceled.\n\t\tconsole.interact { self.interacting != true }\n\n\t\t# If the stop flag has been set, then that means the user exited. Raise\n\t\t# the EOFError so we can drop this bitch like a bad habit.\n\t\traise EOFError if (console.stopped? == true)\n\tend",
"def main\n loop do\n # current path used for readline\n cmdline = Readline.readline(\"#{shell_format} \", true)\n break if %w[exit quit q].include?(cmdline)\n\n Readline::HISTORY.pop if %W[hist #{''}].include?(cmdline)\n check_type_of_command(cmdline)\n end\nend",
"def interactive?\n defined?(::Rails::Console) && $stdout.isatty && $stdin.isatty\n end",
"def interactive?\n\t\ttrue\n\tend",
"def init_shell()\n\t\traise NotImplementedError\n\tend",
"def interactive?\n\t\tfalse\n\tend",
"def interactive?\n\t\tfalse\n\tend",
"def _interact\n\t\tframework.events.on_session_interact(self)\n\t\t# Call the console interaction subsystem of the meterpreter client and\n\t\t# pass it a block that returns whether or not we should still be\n\t\t# interacting. This will allow the shell to abort if interaction is\n\t\t# canceled.\n\t\tconsole.interact { self.interacting != true }\n\n\t\t# If the stop flag has been set, then that means the user exited. Raise\n\t\t# the EOFError so we can drop this bitch like a bad habit.\n\t\traise EOFError if (console.stopped? == true)\n\tend",
"def prompt\n unless interactive?\n raise Inspec::UserInteractionRequired, \"Somthing is trying to ask the user a question, but interactivity is disabled.\"\n end\n\n require \"tty-prompt\"\n\n @prompt ||= TTY::Prompt.new\n end",
"def prompt_ready?(stdout)\n (@irb_prompt =~ />> $/) || super\n end",
"def process_shell_command\n command_line.set_prompt ':!'\n cmd = command_line.get_command(prompt: ':!')[1..-1]\n execute_external_command pause: true do\n system cmd\n end\n rescue Interrupt\n ensure\n command_line.clear\n command_line.noutrefresh\n end",
"def shell_init()\n\t\traise NotImplementedError\n\tend",
"def validate_environment(context)\n return if context.bash?\n raise(Cliqr::Error::IllegalCommandError,\n 'Cannot run another shell within an already running shell')\n end",
"def local_os_shell\n cls\n banner\n prompt = \"(Local)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit$|^quit$|^back$/i\n puts \"OK, Returning to Main Menu\".light_red + \"....\".white\n break\n else\n begin\n rez = commandz(cmd) #Run command passed\n puts \"#{rez.join}\".cyan #print results nicely for user....\n rescue Errno::ENOENT => e\n puts \"#{e}\".light_red\n rescue => e\n puts \"#{e}\".light_red\n end\n end\n end\nend",
"def init\n system 'tput civis; stty -icanon; stty -echo; clear'\n end",
"def tty?() end",
"def tty?() end",
"def tty?() end",
"def record_shell_interaction(commands)\n ShellSimulator.new(commands).capture_output do\n load VIRTUAL_SHELL_PROGRAM\n end\nend",
"def interactive?\n @interactive\n end",
"def prompt\n print '> '\n $stdout.flush\nend",
"def set_interactive_mode\n q = 'Do you want to proceed with INTERACTIVE MODE (y|n)? '\n @interactive = CHK.yn?(q.cyan, true)\n end",
"def before_exit\n system 'tput reset; stty icanon; stty echo; clear'\n end",
"def execute(sub_argv)\n require 'irb'\n\n $logger.info \"InteractiveRubyShell, sub_argv = #{sub_argv}\"\n\n options = {}\n\n opts = OptionParser.new do |o|\n o.banner = 'Usage: openstudio interactive_ruby'\n end\n\n # Parse the options\n argv = parse_options(opts, sub_argv)\n return 0 if argv == nil\n\n $logger.debug(\"InteractiveRubyShell command: #{argv.inspect} #{options.inspect}\")\n\n unless argv == []\n $logger.error 'Extra arguments passed to the i command.'\n return 1\n end\n\n IRB.start_session(binding)\n\n 0\n end",
"def open_shell()\n\t\traise NotImplementedError\n\tend",
"def shell(*) end",
"def tty?; _tty?; end",
"def startShell(mnopts=nil)\n \"Start a shell process for running commands\"\n if @shell\n error(\"%s: shell is already running\\n\" % @name)\n return\n end \n\n # mnexec: (c)lose descriptors, (d)etach from tty,\n # (p)rint pid, and run in (n)amespace\n if !mnopts\n opts='-cd'\n else\n opts=mnopts \n end \n #opts = '-cd' if !mnopts else mnopts\n if @inNamespace\n opts += 'n'\n end \n # bash -i: force interactive\n # -s: pass $* to shell, and make process easy to find in ps\n # prompt is set to sentinel chr( 127 )\n cmd = ['mnexec', opts, 'env', 'PS1=' + 127.chr,\n 'bash', '--norc', '-is', 'mininet:' + @name]\n # Spawn a shell subprocess in a pseudo-tty, to disable buffering\n # in the subprocess and insulate it from signals (e.g. SIGINT)\n # received by the parent\n master, slave = PTY.open\n #master=IO.try_convert(master) \n @shell = _popen(cmd, stdin=slave, stdout=slave, stderr=slave,\n close_fds=false)\n puts @shell\n #master=master.to_s\n @stdin = File.new(master.fileno, \"r+\")\n puts @stdin\n #@stdin = os.fdopen( master, 'rw' )\n @stdout = @stdin\n @pid = @shell.pid\n #@pollOut = select.poll()\n\n #@pollOut.register( @stdout )\n # Maintain mapping between file descriptors and nodes\n # This is useful for monitoring multiple nodes\n # using select.poll()\n @@outToNode[@stdout.fileno()] = self\n @@inToNode[@stdin.fileno()] = self\n @execed = false\n @lastCmd = nil\n @lastPid = nil\n @readbuf = ''\n cmd('unset HISTFILE; stty -echo; set +m')\n end",
"def start_interaction(sandbox=true)\n $__env__ = inspect_env\n puts \"Caller trace:\"\n Kernel.puts RMTools.format_trace(caller(2)).join(\"\\n\")\n puts \"Environment:\"\n $__env__.present\n $__binding__ = self\n if defined? SCRIPT_LINES__ and (file = caller(0)[0].parse(:caller).file) =~ /^\\(irb/\n SCRIPT_LINES__[\"(#{file[1..-2].next_version '#'})\"] = []\n end\n \n $__MAIN__.irb$__binding__\n \n if sandbox\n self.eval($__env__.keys.map {|k, v| \"#{k} = $__env__[#{k.inspect}]\" if k != 'self'} * '; ')\n end\n $__env__ = nil\n end",
"def interactive_mode(_pry_)\n _pry_.input = Pry.config.input\n _pry_.print = Pry.config.print\n _pry_.exception_handler = Pry.config.exception_handler\n end",
"def new_session\n # disable autocorrect (oh-my-zsh)\n shell_write(\"unsetopt correct_all; unsetopt correct\\n\")\n # fixing oh-my-zsh themes\n shell_write(\"PROMPT='$ '\\n\")\n # fixing issues with ZSH syntax highlighting (not very common)\n shell_write(\"unset ZSH_HIGHLIGHT_HIGHLIGHTERS\\n\")\n # fixing issues with exotic ZSH prompts\n shell_write(\"prompt off\\n\")\n ###\n\n # disable bash completetion\n shell_write(\"complete -r\\n\")\n # enter\n shell_write(\"\\n\")\n # second enter\n shell_write(\"\\n\")\n #############\n # new_session_start\n rstream.flush\n end",
"def raw_no_echo_mode\n FFI::NCurses.initscr\n FFI::NCurses.cbreak\n end",
"def before_shell\n end",
"def tty?()\n #This is a stub, used for indexing\n end",
"def run\n loop do\n prompt = self.class.prompt || \"#{`whoami`.chomp} $ \"\n cmd = @readline.readline prompt\n\n finish if cmd.nil? or cmd == 'exit'\n next if cmd.empty?\n @history << cmd\n execute cmd\n end\n end",
"def non_interactive_mode(_pry_)\n _pry_.print = proc {}\n _pry_.exception_handler = proc do |o, e, _pry_|\n _pry_.run_command \"cat --ex\"\n o.puts \"...exception encountered, going interactive!\"\n interactive_mode(_pry_)\n end\n end",
"def no_interrupt_if_interactive\n trap(\"INT\") {} if interactive\n end",
"def _tty?\n false\n end",
"def run_command_for_host\n ready_to_open_host_session do |spawn_cmd|\n open_interactive_process(spawn_cmd) do\n before_run_command\n run_command\n end\n end\n end",
"def sanity_check\n raise Net::SSH::Exception, \"session not open\" unless @open\n end",
"def tty?\n end",
"def tty?\n end",
"def execute\n __binding__ = binding\n while true\n command = prompt('IC> ')\n return if command.eql?('exit')\n\n begin\n result = eval(command, __binding__)\n echo(result) unless result.nil?\n rescue\n echo(format_exception($!))\n end\n end\n end",
"def console_for(bounding)\n puts \"== ENTERING CONSOLE MODE. ==\\nType 'exit' to move on.\\nContext: #{eval('self', bounding).inspect}\"\n\n begin\n oldargs = ARGV.dup\n ARGV.clear\n IRB.start_session(bounding)\n ensure\n ARGV.replace(oldargs)\n end\nend",
"def tty?\n false\n end",
"def prepare_process\n self.stty_save = `stty -g`.chomp\n\n trap(\"SIGINT\", \"IGNORE\")\n trap(\"SIGTSTP\", \"IGNORE\")\n end",
"def command_interactive(cmd)\n puts String.starline.blue\n puts (\"$ #{cmd}\".blue + \" 2>&1\".yellow)\n\n stdout_empty = true\n \n start = Time.now\n begin\n PTY.spawn( cmd ) do |stdin, stdout, pid|\n begin\n puts \"* * STDOUT & STDERR\".starfill.blue\n stdin.each { |line| \n stdout_empty = false\n puts \" * \".blue + line\n }\n rescue Errno::EIO\n end\n Process.wait(pid)\n end\n rescue PTY::ChildExited\n puts \" * Strange, the child process exited...\".starsaround.red\n end\n finish = Time.now\n\n puts \" * \".blue + \"STDOUT: none\".black if stdout_empty\n\n diff = finish - start\n puts String.starline.blue\n if diff > 5 then puts (\" * \".blue + (\"exec time: %.2f sec\" % diff))\n else puts (\" * \".blue + (\"exec time: %.2f sec\" % diff).black)\n end\n\n if $?.exitstatus === 0 then puts (\" * \".blue + \"exit code: #{$?.exitstatus}\".black)\n else puts \" * exit code: #{$?.exitstatus}\".starsaround.red\n end\n\n if $?.exitstatus != 0\n unless $!.nil?\n raise SystemCallError.new(\"Execution of `#{cmd}` failed with error code: #{$!.exitstatus}\")\n else\n raise SystemCallError.new(\"Execution of `#{cmd}` failed\")\n end\n end\nend",
"def shell_run\n success = ruby('rubytest', *config.to_shellwords)\n exit -1 unless success\n end",
"def desc\n \"Interactive TTY\"\n end",
"def tty_secret\n raise 'stdin is not a terminal!' unless $stdin.tty?\n raise '`stty` is unavailable!' unless system 'command -v stty &>/dev/null'\n\n $stderr.print 'Secret:'\n state = %x(stty -g).chomp\n system 'stty -echo'\n\n $stdin.readline.chomp rescue ''\n ensure\n system 'stty', state\n warn '####'\n end",
"def cmd_shell(*args)\n use_pty = false\n sh_path = '/bin/bash'\n\n @@shell_opts.parse(args) do |opt, idx, val|\n case opt\n when '-h'\n cmd_shell_help\n return true\n when '-l'\n return false unless client.fs.file.exist?('/etc/shells')\n\n begin\n client.fs.file.open('/etc/shells') do |f|\n print(f.read) until f.eof\n end\n rescue\n return false\n end\n\n return true\n when '-t'\n use_pty = true\n # XXX: No other options must follow\n sh_path = val if val\n end\n end\n\n case client.platform\n when 'windows'\n path = client.sys.config.getenv('COMSPEC')\n path = (path && !path.empty?) ? path : 'cmd.exe'\n\n # attempt the shell with thread impersonation\n begin\n cmd_execute('-f', path, '-c', '-i', '-H', '-t')\n rescue\n # if this fails, then we attempt without impersonation\n print_error('Failed to spawn shell with thread impersonation. Retrying without it.')\n cmd_execute('-f', path, '-c', '-i', '-H')\n end\n when 'android'\n cmd_execute('-f', '/system/bin/sh', '-c', '-i')\n when 'linux', 'osx'\n if use_pty && pty_shell(sh_path)\n return true\n end\n\n cmd_execute('-f', '/bin/sh', '-c', '-i')\n else\n # Then this is a multi-platform meterpreter (e.g., php or java), which\n # must special-case COMSPEC to return the system-specific shell.\n path = client.sys.config.getenv('COMSPEC')\n\n # If that failed for whatever reason, guess it's unix\n path = (path && !path.empty?) ? path : '/bin/sh'\n\n if use_pty && path == '/bin/sh' && pty_shell(sh_path)\n return true\n end\n\n cmd_execute('-f', path, '-c', '-i')\n end\n end",
"def interactive?\n # Default false and making subclasses figure out how to determine\n # interactiveness.\n false \n end",
"def shell\n verbose { \"Shell(#{@id})\" }\n ___init_readline\n loop do\n line = ___input || break\n puts ___exe(___cmds(line)) || @shell_output_proc.call\n end\n @terminate_procs.inject(self) { |a, e| e.call(a) }\n Msg.msg('Quit Shell', 3)\n end",
"def test\n system \"newlisp-edit\"\n end",
"def shell(cmd)\n puts \"Executing #{cmd}...\"\n Bundler.clean_system(cmd)\n abort \"Command '#{cmd}' failed\" unless $?.success?\n end",
"def pty_shell(sh_path)\n sh_path = client.fs.file.exist?(sh_path) ? sh_path : '/bin/sh'\n\n # Python Meterpreter calls pty.openpty() - No need for other methods\n if client.arch == 'python'\n cmd_execute('-f', sh_path, '-c', '-i')\n return true\n end\n\n # Check for the following in /usr{,/local}/bin:\n # script\n # python{,2,3}\n # socat\n # expect\n paths = %w[\n /usr/bin/script\n /usr/bin/python\n /usr/local/bin/python\n /usr/bin/python2\n /usr/local/bin/python2\n /usr/bin/python3\n /usr/local/bin/python3\n /usr/bin/socat\n /usr/local/bin/socat\n /usr/bin/expect\n /usr/local/bin/expect\n ]\n\n # Select method for spawning PTY Shell based on availability on the target.\n path = paths.find { |p| client.fs.file.exist?(p) }\n\n return false unless path\n\n # Commands for methods\n cmd =\n case path\n when /script/\n if client.platform == 'linux'\n \"#{path} -qc #{sh_path} /dev/null\"\n else\n # script(1) invocation for BSD, OS X, etc.\n \"#{path} -q /dev/null #{sh_path}\"\n end\n when /python/\n \"#{path} -c 'import pty; pty.spawn(\\\"#{sh_path}\\\")'\"\n when /socat/\n # sigint isn't passed through yet\n \"#{path} - exec:#{sh_path},pty,sane,setsid,sigint,stderr\"\n when /expect/\n \"#{path} -c 'spawn #{sh_path}; interact'\"\n end\n\n # \"env TERM=xterm\" provides colors, \"clear\" command, etc. as available on the target.\n cmd.prepend('env TERM=xterm HISTFILE= ')\n\n print_status(cmd)\n cmd_execute('-f', cmd, '-c', '-i')\n\n true\n end",
"def shell?\n @type == :shell\n end",
"def console\n repo = Repo.new\n repo.attach\n\n unless repo.has_repository?\n abort \"Cannot launch console: ripe repo not initialized\"\n end\n\n # Do not send arguments to the REPL\n ARGV.clear\n\n Ripl.config[:prompt] = proc do\n # This is the only place I could think of placing +Hirb#enable+.\n Hirb.enable unless Hirb::View.enabled?\n 'ripe> '\n end\n\n # Launch the REPL session in the context of +WorkerController+.\n Ripl.start :binding => repo.controller.instance_eval { binding }\n end",
"def run_command\n do_on_interactive_process do |match|\n @logger.debug \"Read: #{match}\"\n exec_each_prompt match[1]\n end\n end",
"def back_to_main()\n prompt = TTY::Prompt.new\n user_input = prompt.keypress(\n \"Press space or enter to return to main menu\", keys: [:space, :return]\n )\n system(\"clear\")\nend",
"def run_prepare_command\n return unless root_spec.prepare_command\n UI.section(\" > Running prepare command\", '', 1) do\n Dir.chdir(root) do\n ENV.delete('CDPATH')\n prepare_command = root_spec.prepare_command.strip_heredoc.chomp\n full_command = \"\\nset -e\\n\" + prepare_command\n bash!(full_command)\n end\n end\n end",
"def interactive_ssh(run=true)\n debug \"interactive_ssh with keys: #{@rye_opts[:keys].inspect}\"\n run = false unless STDIN.tty?\n args = []\n @rye_opts[:keys].each { |key| args.push *[:i, key] }\n args << \"#{@rye_user}@#{@rye_host}\"\n cmd = Rye.prepare_command(\"ssh\", args)\n return cmd unless run\n system(cmd)\n end",
"def bash(*args, &blk)\n setenv('PS1', \"(rye) \\\\h:\\\\w \\\\u\\\\$\\ \")\n __shell 'bash', *args, &blk\n end",
"def udf_sys_shell(dbc)\n prompt = \"(CMD)> \"\n while line = Readline.readline(\"#{prompt}\", true)\n cmd = line.chomp\n case cmd\n when /^exit$|^quit$/i\n puts \"\\n\\nOK, exiting shell & closing connection\".light_red + \".....\".white\n break\n else\n res = sys_eval_cmd(dbc, cmd)\n puts\n if res.nil? or res == 'NULL'\n puts \"NULL or No results returned\".light_red + \"....\".white\n else\n puts \"#{res}\".white\n end\n puts\n end\n end\nend",
"def test_2_capsicum\n refute Capsicum.sandboxed?\n assert Capsicum.enter!\n assert Capsicum.enter!\n assert Capsicum.sandboxed?\n\n assert_raises(Errno::ECAPMODE) do\n File.new(\"/dev/null\")\n end\n\n assert_raises(Errno::ECAPMODE) do\n puts `ls`\n end\n end",
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n @current = Open3.popen3(self.shell_executable)\n invoke_setup!\n end\n yield\n ensure\n @current = nil if no_current\n end",
"def prompt_password prompt = ''\n prompt += ' ' unless prompt.empty?\n $stderr.write \" CMS: #{prompt}password: \"\n system 'stty -echo'\n pass = $stdin.readline\n pass.chomp!\n pass\n ensure\n $stderr.write \"\\n\"\n system 'stty echo'\n end",
"def read_and_execute(pipe_server)\n prompt = \"#{config.app}> \"\n\n trap(\"SIGTSTP\", \"SYSTEM_DEFAULT\")\n trap(\"SIGCONT\") do\n print prompt\n end\n\n # Run any commands that have been passed\n result = process_command(pipe_server, @config.run_command)\n @config.run_command = \"\"\n if result == :exit || @config.once\n return false\n elsif result == :reload\n return true\n end\n\n define_autocomplete(pipe_server)\n\n # The command entry loop\n while command = Readline.readline(prompt, false)\n command.strip!\n result = process_command(pipe_server, command)\n\n if result == :exit\n return false\n elsif result == :reload\n return true\n end\n end\n\n send_message(:stop)\n false\n end",
"def do_shell(cmd)\n puts \"[METAMODELS]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend",
"def initialize\n @prompt = TTY::Prompt.new\n end",
"def initialize\n @prompt = TTY::Prompt.new\n end",
"def bash_on_windows?; end",
"def cmd_shell(*args)\n\t\t\tpath = \"/bin/bash -i\"\n\t\t\tcmd_execute(\"-f\", path, \"-c\", \"-i\")\n\tend",
"def execute(input: $stdin, output: $stdout)\n prompt = TTY::Prompt.new\n\n return :gui\n end",
"def tmux_available?\n system \"which tmux >/dev/null 2>&1\"\nend",
"def work_prompt(line, num, file)\n input = run_prompt(line)\n return true if input[0].nil?\n\n run = @key.run_quit(input)\n unless run\n return run if line.nil?\n abort\n end\n code = @key.command_type(input, num, file)\n @key.run_command(code, input, num, file)\n run\n end",
"def initialize\n @prompt = TTY::Prompt.new\n end",
"def start_cli\n puts hello\n quit = false\n while not quit\n line = gets.strip!\n\n quit = true if line == 'quit'\n action = take_cmd(@cli_cmds, line, @jid)\n unless quit\n output = action.call\n puts output unless output.nil?\n end\n end\n end",
"def interactive\n Thread.new { EM.run }.abort_on_exception = true\n end",
"def test_ask_sigint\n start_process do\n begin\n Prompt.ask('q')\n rescue Interrupt\n @ret.write(Marshal.dump(:SIGINT))\n end\n end\n\n sleep(0.05)\n Process.kill('INT', @pid)\n\n assert_result(\"? q\\n> \", \"^C\\n\", :SIGINT)\n end",
"def prompting?\n verbose? || (STDIN.tty? && @io.kind_of?(StdioInputMethod) ||\n @io.kind_of?(ReidlineInputMethod) ||\n (defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod)))\n end",
"def shell\n platform_service(:shell)\n end",
"def prompt; end",
"def prompt; end",
"def prompt; end",
"def prompt; end",
"def prompt\n @prompt ||= begin\n require \"tty-prompt\"\n TTY::Prompt.new(interrupt: :exit)\n end\n end",
"def readline(prompt)\n with_repl_like_sigint { without_readline_completion { Readline.readline(prompt) || EOF_ALIAS } }\n end",
"def do_shell(cmd)\n puts \"[METASIM]:#{Dir.pwd}$ #{cmd}\"\n raise \"Shell command failure\" unless system(cmd)\nend",
"def interactive_mode\n\t\tparse_user_input while recv_user_input\n\tend",
"def forced_exit?; @quit > 1 end",
"def interact?\n @interact\n end",
"def interact?\n @interact\n end"
] | [
"0.7322981",
"0.7044156",
"0.7044156",
"0.7044156",
"0.6518027",
"0.644695",
"0.62469447",
"0.61749923",
"0.614066",
"0.61399055",
"0.6101295",
"0.6072213",
"0.60472035",
"0.60273397",
"0.60273397",
"0.59777236",
"0.5953233",
"0.5913956",
"0.5849408",
"0.58268297",
"0.5774756",
"0.57109505",
"0.56865096",
"0.5668904",
"0.5668904",
"0.5668904",
"0.5645736",
"0.56369203",
"0.56337136",
"0.56108594",
"0.56018335",
"0.55837923",
"0.55828005",
"0.5571149",
"0.5557617",
"0.554626",
"0.5524936",
"0.5522771",
"0.5508712",
"0.5504691",
"0.5481815",
"0.5475398",
"0.54743147",
"0.5473304",
"0.54669714",
"0.54650074",
"0.5460312",
"0.5455491",
"0.54503036",
"0.54503036",
"0.5439293",
"0.54307866",
"0.5429067",
"0.54272634",
"0.5424625",
"0.54117095",
"0.53672254",
"0.536532",
"0.53633463",
"0.5353859",
"0.5352643",
"0.5346248",
"0.5318789",
"0.52956015",
"0.52934575",
"0.52902806",
"0.5289052",
"0.52720183",
"0.52691966",
"0.5267956",
"0.5257541",
"0.524599",
"0.52390224",
"0.52178913",
"0.52126646",
"0.52125746",
"0.5196713",
"0.51962864",
"0.51962864",
"0.5179178",
"0.5178741",
"0.5171156",
"0.5165033",
"0.51633185",
"0.51533777",
"0.5153052",
"0.5148251",
"0.51437604",
"0.5128803",
"0.5127229",
"0.51196975",
"0.51196975",
"0.51196975",
"0.51196975",
"0.51151097",
"0.51120245",
"0.5108926",
"0.51086867",
"0.5106785",
"0.51046413",
"0.51046413"
] | 0.0 | -1 |
Return true if one of the sample attachments is audio | def contains_audio?
result = false
sample_attachments.map{|sa| result = true if sa.is_audio?}
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audio?\n not audio_formats.empty?\n end",
"def audio?\n !!( content_type =~ Transit.config.audio_regexp )\n end",
"def is_audio_type?\n file_content_type =~ /\\Aaudio\\/.*\\Z/\n end",
"def audio?\n has_stream_of :audio\n end",
"def audio?\n if mime_type == 'application/mxf'\n !ffprobe.codec_type.any? {|type| type == 'video'}\n else\n super\n end\n end",
"def audio?\n filename =~ /^audio/\n end",
"def audio?\n @descriptive_detail.audio?\n end",
"def audio?\n codec_type == 'audio'\n end",
"def is_audio?\n result = false\n if !mime_type.blank?\n splits = mime_type.split('/')\n if splits[0] == AUDIO\n result = true\n end\n end\n \n result\nend",
"def audio?\n @streams.any? { |stream| stream.is_a? AudioStream }\n end",
"def audio?\n self.sti_type == AUDIO_TYPE\n end",
"def audio?\n #or @volume == 0\n if @mute or @type == \"image\"\n #puts \"no audio\"\n return false\n else\n #puts \"has audio\"\n return true\n end\n end",
"def audio?\n !!audio_stream\n end",
"def has_audios?\n audios[I18n.locale.to_sym].length + attached_audios[I18n.locale.to_sym].length > 0\n end",
"def has_audio?\n return !!get_audio\n end",
"def has_sound?\n @has_sound = if @movie_info[:format][:nb_streams] == 1\n false\n elsif @movie_info[:format][:nb_streams] == 2\n true\n end\n end",
"def audio_without_closed_captions?\n audio? && closed_captions.blank?\n end",
"def is_sound?\n type == 'SoundMessage'\n end",
"def audio\n first_stream_of :audio\n end",
"def is_audio(str)\n str.match(/\\A\\w*.(mp3|flac|alac|aac)\\Z/) != nil\nend",
"def audio\n @streams.select { |stream| stream.is_a? AudioStream }\n end",
"def is_a_recording?\n manifestation_type.manifestation_type_category == 2\n end",
"def contains_document?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_document?}\n result\n end",
"def contains_video?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_video?}\n result\n end",
"def has_sound?\n !!self.sound\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end",
"def non_musical_sound_recording?\n marc_leader_06_match = record.leader.byteslice(6) == 'i'\n\n marc_006_match = record.fields('006').find do |field|\n field.value.byteslice(0) == 'i'\n end\n\n return true if marc_leader_06_match || marc_006_match\n end",
"def check_audio_codec\n if has_sound?\n @audio_codec = (@audio_stream[:codec_name] + @audio_stream[:profile]).upcase!\n @audio_codec_check = if AUDIO_CODEC == @audio_codec\n true\n else\n false\n end\n end\n end",
"def all_formats_encoded?\n self.webm_file.path && self.mp4_file.path && self.ogg_file.path ? true : false\n end",
"def flac_with_m4a?\n asset.content_type == \"audio/flac\" && asset.file_derivatives.has_key?(:m4a)\n end",
"def check_audio\n post(:action => \"check-audio\")\n end",
"def audio_formats\n @descriptive_detail.audio_formats\n end",
"def podcast?\n podcast = false\n self.items.each do |item|\n item.enclosures.each do |enclosure|\n podcast = true if enclosure.audio?\n end\n end\n return podcast\n end",
"def audio_tracks\n tracks.select { |t| t.audio? }\n end",
"def audio_tracks\n tracks.select { |t| t.audio? }\n end",
"def audio; end",
"def audio_source_is_provided\n if self.external_url.blank? &&\n self.mp3.file.nil? &&\n self.enco_number.blank? &&\n self.enco_date.blank?\n self.errors.add(:base,\n \"Audio must have a source (upload, enco, or URL)\")\n end\n end",
"def soundcloud?; soundcloud.to_s != \"\" end",
"def is_mixable_with?(song)\n mixables.include?(song)\n end",
"def wp_get_audio_extensions\n # Filters the list of supported audio formats.\n apply_filters('wp_audio_extensions', ['mp3', 'ogg', 'flac', 'm4a', 'wav'])\n end",
"def contains_image?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_image?}\n result\n end",
"def get_audio\n return @audio\n end",
"def sound_attack?\n return data.sound_attack\n end",
"def is_mp3?\n if filename != nil\n filename.ends_with?('.mp3')\n else\n false\n end\nend",
"def audios_test\n end",
"def audio_format\n @descriptive_detail.audio_format\n end",
"def audio_stream\n @audio_stream ||= streams.find do |stream|\n stream.codec_context.codec_type == :AUDIO\n end\n end",
"def music_recording?\n marc_leader_06_match = record.leader.byteslice(6) == 'j'\n\n marc_006_match = record.fields('006').find do |field|\n field.value.byteslice(0) == 'j'\n end\n\n return true if marc_leader_06_match || marc_006_match\n end",
"def has_attachments\n preneed_attachments.present?\n end",
"def mp3?\n File.extname(@path).downcase.eql?('.mp3')\n end",
"def has_attachment?\n @has_attachment ||=\n mime_parts(\"text/plain\").any? do |type, fn, id, content|\n fn && (type !~ SIGNATURE_ATTACHMENT_TYPE)\n end\n end",
"def analise_audio\n ads_file_paths = []\n videos_with_ads_from_files = []\n\n Find.find('.') do |path|\n if path =~ /.*-ads\\.wav$/\n $file_name = ads_file_paths << path[2..-1].to_s\n end\n end\n if !$file_name.nil?\n videos_with_ads_from_files.push(\"'#{$file_name}': 'true'\")\n puts \"List of audio files with ads based on file names #{videos_with_ads_from_files[0]}\"\n end\n\n if $file_name.nil?\n puts 'No audio files with ads found'\n end\n #another way how we can check if ads displayed\n #here we can get a length of audio file in seconds by `sox file_name.wav -n stat 2>&1| grep 'Length'| awk '{print $3}'\n #if ads were displayed length of audio file will be like ads.length + original_video.length in seconds\n #if total audio file length > then RECORD_TIME in seconds it means that audio file contains ads\nend",
"def allow_sample?(sample)\n true\n end",
"def audiobook?\n marc_leader_06_match = record.leader.byteslice(6) == 'i'\n marc_008_30_31_match = record.fields('008').find do |field|\n (%w[a b d e f h k m o p] & (field.value.byteslice(30..31) || '').scrub(' ').split('')).any?\n end\n\n marc_006_00_13_14_match = record.fields('006').find do |field|\n field.value.byteslice(0) == 'i' &&\n (%w[a b d e f h k m o p] &\n (field.value.byteslice(13..14) || '').scrub(' ').split('')).any?\n end\n\n return true if (marc_leader_06_match &&\n marc_008_30_31_match) ||\n marc_006_00_13_14_match\n end",
"def resampling_required?\n flac_info.streaminfo[\"samplerate\"] != target_sample_rate\n end",
"def attached?\n attachments.any?\n end",
"def onload_function?\n [email protected]?\n end",
"def attachments?\n self.primary_attachment.file? || self.secondary_attachment.file?\n end",
"def audiotype(audio)\n if audio == \"n\"\n return \"Non-directive Audio\"\n elsif audio == \"d\"\n return \"Directive Audio\"\n else\n return \"invalid type\"\n end \n end",
"def soundcloud?\n\t\treturn path && path.starts_with?(\"stoffi:track:soundcloud:\")\n\tend",
"def check_audio_bitrate\n if has_sound?\n @audio_bit_rate = @audio_stream[:bit_rate].to_i\n @audio_bit_rate_check = if @audio_bit_rate > AUDIO_BITRATE\n true\n else\n false\n end\n end\n end",
"def attachments?\n !attachments.empty?\n end",
"def is_sound?\n @conf[:sandboxes].each do |v|\n name = v[:name]\n lxc = LXC.container(name)\n return false unless lxc.exists?\n end\n return true\n end",
"def processing_audio\n list.select {|l| l[:status] == 35 }\n end",
"def trigger_delete_audio\n if self.section_translations.present?\n delete_audio = self.section_translations.first.delete_audio\n if delete_audio.present? && delete_audio.to_bool == true\n self.section_translations.first.check_delete_audio\n end\n end\n return true\n end",
"def mono?\n @channels == 1\n end",
"def mono?\n @channels == 1\n end",
"def validate_header_file_audio\n self.validate_header_file(10, ['mp3', 'ogg', 'wav'], 'errors.messages.audio_too_large')\n end",
"def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end",
"def sound_exist?(filename)\n return File.exist?(filename)\n end",
"def has_media?\n [email protected]? or !back.media.empty?\n end",
"def modified?\n ((self.created_at != self.updated_at) ||\n (segments.collect { |e| e.audio_asset.authored? && e.audio_asset.delivered? }.include?(true))) \n end",
"def is_a_sounzmedia?\n manifestation_type_sounzmedia = ManifestationType.find(:first, :conditions => [\"manifestation_type_desc = 'Media on Demand'\"])\n manifestation_type.manifestation_type_id == manifestation_type_sounzmedia.manifestation_type_id\n end",
"def audio_assets(authored_only = false)\n assets = segments.collect { |e| e.audio_asset }\n authored_only ? assets.select { |a| a.authored? } : assets\n end",
"def add_audio\n update_attribute(:audio, true)\n end",
"def has_attachments?\n !attachments.empty?\n end",
"def attachment?\n attachment.present? && attachment.readable?\n end",
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def media_resource?\n true\n end",
"def has_attachment?\n !!attachment_ids && attachment_ids.any?\n end",
"def folder_exists_in_audio?(folder_name)\n `ls audio/ | grep #{folder_name}`.chomp.length > 0\n end",
"def accepted_mimes\n case self.type\n when'Recording'\n '.wav,.mp3'\n when 'Document'\n '.pdf'\n when 'Image'\n '.jpeg,.jpg,.gif,.bmp,.png'\n else\n ''\n end\n end",
"def narration_present?\n content_types_xml = nil\n pres_doc = @files.file.open '[Content_Types].xml' rescue nil\n content_types_xml = Nokogiri::XML::Document.parse(pres_doc) if pres_doc\n content = content_types_xml.xpath('//@Extension')\n if content.to_s.include?('m4a')\n @type = 'm4a'\n @narration = true\n end\n if content.to_s.include?('wav')\n @type = 'wav'\n @narration = true\n end\n end",
"def attachment?\n !!find_attachment\n end",
"def do_process(audio)\n SPF::Gateway::Audio.identify(audio)\n end",
"def acceptable?(media_type)\n !matches(media_type).empty?\n end",
"def mix_type_ok?(item)\n Bubs::Mix::MIX_TYPES.include?(item.mix_type)\n end",
"def is_music?\n @status\n end",
"def audiences\n respond_to?(:audience) ? audience : []\n end",
"def has_attachments?\n !(attachments.nil? || attachments.empty? || attachments[0].empty?)\n end",
"def sample?\n return true unless sampling\n sampler.sample?\n end",
"def have_sample_ids?\n if @options.samples && @options.samples.size > 0\n return true\n end\n @stderr.puts \"Missing sample id(s) to processor\"\n return false\nend",
"def exists\n if @file && @mp3\n return true\n else\n return false\n end\n end",
"def isPodcast?\n self.category =~ /(podcast|video|audio)/i\n end",
"def validate_audio\n errors, analysis = validate(source_format, source, options)\n info = { errors: errors, analysis: analysis }\n completed_with info\n end",
"def avro?\n @gapi.source_format == \"AVRO\"\n end",
"def music_file(file)\n ext_list = $config[\"music_file\"][\"media_extentions\"].gsub(/,/,\"|\")\n \n ext = \".*\\.(#{ext_list})$\" \n name = \"\"\n\n $config['music_file']['regex'].each do |pattern|\n if file =~ /.*#{pattern}#{ext}/i\n name = $1 if $1\n return false if name =~ /^sample/i\n return true\n end\n end\n return false\nend",
"def allows_text?\n case kind\n when TEXT, IMAGE1, AUDIO, VIDEO1 then true\n else false\n end\n end",
"def attachments?\n self.attachments.size > 0\n end",
"def attachments?\n self.attachments.size > 0\n end"
] | [
"0.8035807",
"0.80038804",
"0.7881955",
"0.7846738",
"0.7820245",
"0.77520734",
"0.773891",
"0.77171326",
"0.7713901",
"0.76059484",
"0.7589621",
"0.7556706",
"0.7498337",
"0.7420775",
"0.7122937",
"0.7079695",
"0.7054178",
"0.6868039",
"0.686134",
"0.6780883",
"0.67526555",
"0.667825",
"0.6656041",
"0.66535354",
"0.658067",
"0.6538165",
"0.6504507",
"0.64071286",
"0.63990515",
"0.63699245",
"0.63237053",
"0.63093656",
"0.6275029",
"0.62606585",
"0.62606585",
"0.6243554",
"0.62382096",
"0.6218947",
"0.61951727",
"0.6172228",
"0.6164842",
"0.6164545",
"0.6162879",
"0.6131026",
"0.6126704",
"0.6125819",
"0.60476893",
"0.60078436",
"0.60041404",
"0.5985197",
"0.597465",
"0.59484875",
"0.59375226",
"0.59277856",
"0.592688",
"0.59158266",
"0.59128153",
"0.5911344",
"0.58986217",
"0.5884445",
"0.58799076",
"0.5879735",
"0.58786845",
"0.58760756",
"0.5867604",
"0.5852458",
"0.5852458",
"0.5842134",
"0.58418256",
"0.5840558",
"0.5808548",
"0.5791254",
"0.57786816",
"0.5767835",
"0.5757981",
"0.5753219",
"0.5749448",
"0.5740711",
"0.5739735",
"0.5737093",
"0.57291675",
"0.57237625",
"0.5721959",
"0.5707826",
"0.5700756",
"0.5700381",
"0.5693721",
"0.56867164",
"0.56848985",
"0.5683929",
"0.5683712",
"0.56787664",
"0.56669015",
"0.5665079",
"0.5660954",
"0.56594586",
"0.5657983",
"0.5655809",
"0.565432",
"0.565432"
] | 0.87240237 | 0 |
Return true if one of the sample attachments is video | def contains_video?
result = false
sample_attachments.map{|sa| result = true if sa.is_video?}
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video?\n attributes['_type'].split('::').last == 'Video'\n end",
"def is_video_type?\n file_content_type =~ %r(video)\n end",
"def video?\n !!( content_type =~ Transit.config.video_regexp )\n end",
"def is_video_type?\n photo_content_type =~ %r(video)\n end",
"def video?\n self.type == \"Video\"\n end",
"def video?\n self.type == \"Assetabler::Video\"\n end",
"def is_video_type?\n background_media.content_type =~ %r(video)\n end",
"def video?\n if mime_type == 'application/mxf'\n ffprobe.codec_type.any? {|type| type == 'video'}\n else\n super\n end\n end",
"def video?\n codec_type == 'video'\n end",
"def video?\n @streams.any? { |stream| stream.is_a? VideoStream }\n end",
"def video?\n self.sti_type == VIDEO_TYPE\n end",
"def video?\n !!video_stream\n end",
"def web_video?\n %w(mp4 ogg webm).each do |sub_type|\n return true if Rack::Mime.match?(mime_type, \"video/#{sub_type}\")\n end\n\n false\n end",
"def video?(file)\n ext = File.extname(file)\n ext = ext[1, ext.length] if ext\n return ext == \"avi\" || ext == \"mpg\" || ext == 'mkv' || ext == 'rm' || ext == 'mp4'\nend",
"def has_video?\n false\n end",
"def is_video_file?(file)\n regex = /(.mkv|.mp4|.avi)$/i\n file.match?(regex)\n end",
"def video?\n marc_leader_06_match = record.leader.byteslice(6) == 'g'\n marc_008_33_match = record.fields('008').find do |field|\n %w[f m v].include?(field.value.byteslice(33))\n end\n\n marc_006_match = record.fields('006').find do |field|\n field.value.byteslice(0) == 'g' &&\n %w[f m v].include?(field.value.byteslice(16))\n end\n\n video_007_types = %w[m v]\n marc_007_match = record.fields('007').find do |field|\n video_007_types.include?(field.value.byteslice(0))\n end\n\n return true if (marc_leader_06_match && marc_008_33_match) ||\n marc_006_match || marc_007_match\n end",
"def playable?\n video_source\n end",
"def movie?\n content_type == \"Movie\"\n end",
"def decide_interested_video_type\n \n end",
"def contains_audio?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_audio?}\n result\n end",
"def attachments?\n self.primary_attachment.file? || self.secondary_attachment.file?\n end",
"def vidlog?\n vidlog = false\n self.items.each do |item|\n item.enclosures.each do |enclosure|\n vidlog = true if enclosure.video?\n end\n end\n return vidlog\n end",
"def has_videos?\n videos[:list][I18n.locale.to_sym].length > 0 || videos[:mpg][I18n.locale.to_sym].length > 0\n end",
"def can_be_repackaged_as_mp4?\n # If there's an mp4 track, assume this can be rewrapped as an mp4\n !!(find_id_of_track_type('V_MPEG4/ISO/AVC') && find_id_of_track_type('A_AAC'))\n end",
"def all_formats_encoded?\n self.webm_file.path && self.mp4_file.path && self.ogg_file.path ? true : false\n end",
"def has_video?(locale=I18n.locale.to_sym)\n !featured_video(locale).nil?\n end",
"def contains_image?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_image?}\n result\n end",
"def contains_document?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_document?}\n result\n end",
"def is_a_recording?\n manifestation_type.manifestation_type_category == 2\n end",
"def attachments?\n !attachments.empty?\n end",
"def audio?\n if mime_type == 'application/mxf'\n !ffprobe.codec_type.any? {|type| type == 'video'}\n else\n super\n end\n end",
"def video\n first_stream_of :video\n end",
"def valid_videos\n self.videos.select{ |video|\n video.exist? && video.embed? && video.auto_play?\n }\n end",
"def irrelevant?\n video.nil? && manuscript.nil? && external_reference_link.blank?\n end",
"def exists?( video_content )\n\t\traise NotImplementedError.new\n\tend",
"def video\n @streams.select { |stream| stream.is_a? VideoStream }\n end",
"def check_and_print_video_file_name()\n is_success = true\n video_file_name = @options.video_file_name()\n if !!video_file_name then\n @renderer.print(\"Video: #{video_file_name}\")\n if FileTest.exist?(video_file_name) then\n @renderer.print(\"\\n\")\n else\n @renderer.print(\": does not exist.\\n\")\n is_success = false\n end\n end\n return is_success\n end",
"def is_flv?\n if filename != nil\n filename.ends_with?('.flv')\n else\n false\n end\nend",
"def attached?\n attachments.any?\n end",
"def attachments?\n self.attachments.size > 0\n end",
"def attachments?\n self.attachments.size > 0\n end",
"def has_attachment?\n @has_attachment ||=\n mime_parts(\"text/plain\").any? do |type, fn, id, content|\n fn && (type !~ SIGNATURE_ATTACHMENT_TYPE)\n end\n end",
"def post_must_contain_video\n if self.type != \"video\" || self.link.blank?\n self.errors.add(:link, 'must contain a video')\n end\n end",
"def set_processed_flag\n if read_attribute(:processed).present? && !read_attribute(:processed) && self.asset_type != TYPE[:media_video]\n self.processed = true\n end\n return true\n end",
"def queued_video?(video)\n queue_items.map(&:video).include?(video)\n end",
"def has_attachments?\n !attachments.empty?\n end",
"def has_attachments?\n !(attachments.nil? || attachments.empty? || attachments[0].empty?)\n end",
"def acceptable?(media_type)\n !matches(media_type).empty?\n end",
"def attachment?\n attachment.present? && attachment.readable?\n end",
"def media_resource?\n true\n end",
"def video_watched?(user, video)\n @watched_video = WatchedVideo.where(user_id: user.id, video_id: video.id).first\n if @watched_video && @watched_video.watched == true\n true\n else\n false\n end\n end",
"def attachment?\n !!find_attachment\n end",
"def exists?( video_content )\n\t\tftp_open do |ftp|\n\t\t\treturn self.class.ftp_file_exists?( ftp, file_hash_and_extension_to_array( video_content.file_hash, video_content.file_extension ).join('/') )\n\t\tend\n\tend",
"def other?\n self.class.other?(asset_content_type)\n end",
"def length?\n video_length > 10.0\n end",
"def check_video_codec\n @video_codec = @video_stream[:codec_name]\n @video_codec_check = if VIDEO_CODEC == @video_codec\n true\n else\n false\n end\n end",
"def has_attachments\n preneed_attachments.present?\n end",
"def supports_derivatives?\n (attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|jpeg|jpg|pjpeg|png|webp|x-png)$}).present?\n end",
"def has_files?\n attachments.count > 0\n end",
"def video_ended(ref,event)\n return false unless ref\n return true if ref.video && !event.video\n return true if ref.video && ref.video != event.video\n false\n end",
"def has_advanced_video?\n patron?(tier: 1, before: STRIPE_MIGRATION_DATE) || patron?(tier: 4) || subscriptions.tier1.active.any? || admin? || self.class.stay_insideathon?\n end",
"def wp_attachment_is(type, post = nil)\n post = get_post(post)\n return false if post.nil?\n\n return false if (!file = get_attached_file(post.id))\n\n return true if post.post_mime_type.index(type + '/') == 0\n\n check = wp_check_filetype(file)\n return false if check[:ext].blank?\n\n ext = check[:ext]\n\n if 'import' != post.post_mime_type\n return type == ext\n end\n\n case type\n when 'image'\n ['jpg', 'jpeg', 'jpe', 'gif', 'png'].include? ext\n when 'audio'\n wp_get_audio_extensions.include? ext\n when 'video'\n wp_get_video_extensions.include? ext\n else\n type == ext\n end\n end",
"def attached?(filename); end",
"def is_audio?\n result = false\n if !mime_type.blank?\n splits = mime_type.split('/')\n if splits[0] == AUDIO\n result = true\n end\n end\n \n result\nend",
"def videos_test\n end",
"def multipart?\n has_content_type? ? !!(main_type =~ /^multipart$/i) : false\n end",
"def avro?\n @gapi.source_format == \"AVRO\"\n end",
"def preview_type\n return \"video\" if %w(mp4 m4v mov flv avi asf).include?(format)\n return \"audio\" if !format.blank?\n return nil\n end",
"def video_mime_types\n ['video/mpg', 'video/mpeg', 'video/mp4', 'video/x-m4v', 'video/webm', 'video/x-msvideo', 'video/avi', 'video/quicktime', 'application/mxf']\n end",
"def episode?\n content_type == \"Episode\"\n end",
"def matches(_ext)\n true\n end",
"def modified?\n ((self.created_at != self.updated_at) ||\n (segments.collect { |e| e.audio_asset.authored? && e.audio_asset.delivered? }.include?(true))) \n end",
"def has_multipart?(obj); end",
"def has_attachment?\n !!attachment_ids && attachment_ids.any?\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty? || preservation_file&.original_filename&.first&.downcase&.include?(\".wav\")\n end",
"def has_flash?\n not web_video.nil?\n end",
"def supported_format?\n !(@file_set.mime_type & self.class.supported_formats).empty?\n end",
"def has_attachments\n return @has_attachments\n end",
"def has_attachments\n return @has_attachments\n end",
"def has_attachments\n return @has_attachments\n end",
"def has_attachments\n return @has_attachments\n end",
"def image?\n attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end",
"def attached?\n attachment.present?\n end",
"def valid?\n VideoUrl.valid?(self.url)\n end",
"def check_live(video)\n return true if video.live == \"1\"\nend",
"def is_a_sounzmedia?\n manifestation_type_sounzmedia = ManifestationType.find(:first, :conditions => [\"manifestation_type_desc = 'Media on Demand'\"])\n manifestation_type.manifestation_type_id == manifestation_type_sounzmedia.manifestation_type_id\n end",
"def multipart?\n http.headers[\"content-type\"] =~ /^multipart/\n end",
"def multipart?\n message.multipart?\n end",
"def attached?\n !!file\n end",
"def has_media?\n [email protected]? or !back.media.empty?\n end",
"def attached?\n self.attachments.map(&:state).any? { |state| state == \"attached\" || state == \"attaching\" }\n end",
"def check_if_image?\n !(attachment_content_type =~ /^image.*/).nil?\n end",
"def end_of_feed?\n load_result.videos.length < 25\n end",
"def is_image?\n !(attachment_content_type =~ /^image.*/).nil?\n end",
"def spoofed?\n has_extension? and media_type_mismatch?\n end",
"def allows_text?\n case kind\n when TEXT, IMAGE1, AUDIO, VIDEO1 then true\n else false\n end\n end",
"def multipart?\n false\n end",
"def multipart?\n @multipart\n end",
"def multipart?\n @multipart\n end"
] | [
"0.79525316",
"0.78907645",
"0.78466475",
"0.77067894",
"0.76821923",
"0.7587372",
"0.75550485",
"0.7538511",
"0.74831045",
"0.74105394",
"0.7335338",
"0.7266732",
"0.7214892",
"0.7164728",
"0.713228",
"0.7058546",
"0.693672",
"0.69328326",
"0.66700315",
"0.66283065",
"0.66093814",
"0.6570655",
"0.6567364",
"0.6565008",
"0.6520059",
"0.65147686",
"0.6482417",
"0.64520097",
"0.6384345",
"0.63607526",
"0.634361",
"0.6340707",
"0.63336515",
"0.6277958",
"0.62653345",
"0.62519443",
"0.62475365",
"0.6219187",
"0.6209395",
"0.6201951",
"0.6101942",
"0.6101942",
"0.60994524",
"0.6093966",
"0.6089132",
"0.6085559",
"0.60701776",
"0.6052628",
"0.6043732",
"0.60391665",
"0.6022377",
"0.6011831",
"0.60010004",
"0.59939325",
"0.5964342",
"0.5961215",
"0.59609395",
"0.5960541",
"0.5953649",
"0.5942425",
"0.5922436",
"0.5907865",
"0.58996475",
"0.58887136",
"0.58758986",
"0.58615553",
"0.58578616",
"0.5845871",
"0.58345246",
"0.58169216",
"0.58139956",
"0.5786928",
"0.5774179",
"0.5757593",
"0.57559437",
"0.5751379",
"0.57434034",
"0.5712331",
"0.5688193",
"0.5688193",
"0.5688193",
"0.5688193",
"0.56874806",
"0.56725353",
"0.5672273",
"0.56633997",
"0.56633234",
"0.56539255",
"0.56489396",
"0.5643091",
"0.56417644",
"0.5630641",
"0.56270915",
"0.56244385",
"0.56229603",
"0.5621867",
"0.562152",
"0.5619456",
"0.5616696",
"0.5616696"
] | 0.86776674 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.